@webiny/api-headless-cms 0.0.0-mt-3 → 0.0.0-unstable.3386f66516
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 +6 -0
- package/context.js +119 -0
- package/context.js.map +1 -0
- package/crud/contentEntry/afterDelete.d.ts +8 -0
- package/{content/plugins/crud → crud}/contentEntry/afterDelete.js +2 -2
- package/crud/contentEntry/afterDelete.js.map +1 -0
- package/crud/contentEntry/beforeCreate.d.ts +8 -0
- package/{content/plugins/crud → crud}/contentEntry/beforeCreate.js +2 -2
- package/crud/contentEntry/beforeCreate.js.map +1 -0
- package/crud/contentEntry/beforeUpdate.d.ts +8 -0
- package/{content/plugins/crud → crud}/contentEntry/beforeUpdate.js +2 -2
- package/crud/contentEntry/beforeUpdate.js.map +1 -0
- package/crud/contentEntry/entryDataValidation.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentEntry/entryDataValidation.js +23 -11
- package/crud/contentEntry/entryDataValidation.js.map +1 -0
- package/{content/plugins/crud → crud}/contentEntry/markLockedFields.d.ts +3 -2
- package/{content/plugins/crud → crud}/contentEntry/markLockedFields.js +14 -15
- package/crud/contentEntry/markLockedFields.js.map +1 -0
- package/crud/contentEntry/referenceFieldsMapping.d.ts +13 -0
- package/crud/contentEntry/referenceFieldsMapping.js +292 -0
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -0
- package/crud/contentEntry/searchableFields.d.ts +9 -0
- package/crud/contentEntry/searchableFields.js +83 -0
- package/crud/contentEntry/searchableFields.js.map +1 -0
- package/{content/plugins/crud → crud}/contentEntry.crud.d.ts +5 -9
- package/crud/contentEntry.crud.js +1309 -0
- package/crud/contentEntry.crud.js.map +1 -0
- package/crud/contentModel/afterCreate.d.ts +8 -0
- package/crud/contentModel/afterCreate.js +18 -0
- package/crud/contentModel/afterCreate.js.map +1 -0
- package/crud/contentModel/afterCreateFrom.d.ts +8 -0
- package/crud/contentModel/afterCreateFrom.js +18 -0
- package/crud/contentModel/afterCreateFrom.js.map +1 -0
- package/crud/contentModel/afterDelete.d.ts +8 -0
- package/crud/contentModel/afterDelete.js +18 -0
- package/crud/contentModel/afterDelete.js.map +1 -0
- package/crud/contentModel/afterUpdate.d.ts +8 -0
- package/crud/contentModel/afterUpdate.js +18 -0
- package/crud/contentModel/afterUpdate.js.map +1 -0
- package/crud/contentModel/beforeCreate.d.ts +14 -0
- package/{content/plugins/crud → crud}/contentModel/beforeCreate.js +61 -13
- package/crud/contentModel/beforeCreate.js.map +1 -0
- package/crud/contentModel/beforeDelete.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentModel/beforeDelete.js +14 -10
- package/crud/contentModel/beforeDelete.js.map +1 -0
- package/crud/contentModel/beforeUpdate.d.ts +8 -0
- package/crud/contentModel/beforeUpdate.js +37 -0
- package/crud/contentModel/beforeUpdate.js.map +1 -0
- package/crud/contentModel/contentModelManagerFactory.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/contentModelManagerFactory.js +0 -0
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -0
- package/crud/contentModel/createFieldModels.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/createFieldModels.js +6 -2
- package/crud/contentModel/createFieldModels.js.map +1 -0
- package/crud/contentModel/createFieldStorageId.d.ts +2 -0
- package/crud/contentModel/createFieldStorageId.js +20 -0
- package/crud/contentModel/createFieldStorageId.js.map +1 -0
- package/crud/contentModel/fieldIdValidation.d.ts +1 -0
- package/crud/contentModel/fieldIdValidation.js +25 -0
- package/crud/contentModel/fieldIdValidation.js.map +1 -0
- package/crud/contentModel/idValidation.d.ts +1 -0
- package/{content/plugins/crud → crud}/contentModel/idValidation.js +3 -3
- package/crud/contentModel/idValidation.js.map +1 -0
- package/{content/plugins/crud → crud}/contentModel/models.d.ts +2 -1
- package/{content/plugins/crud → crud}/contentModel/models.js +76 -25
- package/crud/contentModel/models.js.map +1 -0
- package/crud/contentModel/systemFields.d.ts +1 -0
- package/crud/contentModel/systemFields.js +8 -0
- package/crud/contentModel/systemFields.js.map +1 -0
- package/crud/contentModel/validateLayout.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/validateLayout.js +1 -3
- package/crud/contentModel/validateLayout.js.map +1 -0
- package/crud/contentModel/validateModel.d.ts +8 -0
- package/crud/contentModel/validateModel.js +35 -0
- package/crud/contentModel/validateModel.js.map +1 -0
- package/crud/contentModel/validateModelFields.d.ts +8 -0
- package/crud/contentModel/validateModelFields.js +436 -0
- package/crud/contentModel/validateModelFields.js.map +1 -0
- package/crud/contentModel/validation.d.ts +477 -0
- package/crud/contentModel/validation.js +109 -0
- package/crud/contentModel/validation.js.map +1 -0
- package/{content/plugins/crud → crud}/contentModel.crud.d.ts +3 -3
- package/crud/contentModel.crud.js +642 -0
- package/crud/contentModel.crud.js.map +1 -0
- package/crud/contentModelGroup/beforeCreate.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentModelGroup/beforeCreate.js +9 -9
- package/crud/contentModelGroup/beforeCreate.js.map +1 -0
- package/crud/contentModelGroup/beforeDelete.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentModelGroup/beforeDelete.js +4 -4
- package/crud/contentModelGroup/beforeDelete.js.map +1 -0
- package/crud/contentModelGroup/beforeUpdate.d.ts +9 -0
- package/{content/plugins/crud → crud}/contentModelGroup/beforeUpdate.js +3 -3
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -0
- package/crud/contentModelGroup/validation.d.ts +30 -0
- package/crud/contentModelGroup/validation.js +43 -0
- package/crud/contentModelGroup/validation.js.map +1 -0
- package/{content/plugins/crud → crud}/contentModelGroup.crud.d.ts +3 -3
- package/crud/contentModelGroup.crud.js +366 -0
- package/crud/contentModelGroup.crud.js.map +1 -0
- package/{plugins/crud → crud}/settings.crud.d.ts +3 -3
- package/crud/settings.crud.js +83 -0
- package/crud/settings.crud.js.map +1 -0
- package/{plugins/crud → crud}/system.crud.d.ts +6 -3
- package/crud/system.crud.js +221 -0
- package/crud/system.crud.js.map +1 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +7 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js +66 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +11 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +239 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +11 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +304 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/index.d.ts +4 -0
- package/fieldConverters/index.js +18 -0
- package/fieldConverters/index.js.map +1 -0
- package/graphql/buildSchemaPlugins.d.ts +11 -0
- package/graphql/buildSchemaPlugins.js +24 -0
- package/graphql/buildSchemaPlugins.js.map +1 -0
- package/graphql/createExecutableSchema.d.ts +7 -0
- package/graphql/createExecutableSchema.js +33 -0
- package/graphql/createExecutableSchema.js.map +1 -0
- package/graphql/generateSchema.d.ts +8 -0
- package/graphql/generateSchema.js +38 -0
- package/graphql/generateSchema.js.map +1 -0
- package/graphql/graphQLHandlerFactory.d.ts +5 -0
- package/graphql/graphQLHandlerFactory.js +202 -0
- package/graphql/graphQLHandlerFactory.js.map +1 -0
- package/graphql/index.d.ts +3 -0
- package/graphql/index.js +18 -0
- package/graphql/index.js.map +1 -0
- package/graphql/schema/baseContentSchema.d.ts +7 -0
- package/graphql/schema/baseContentSchema.js +78 -0
- package/graphql/schema/baseContentSchema.js.map +1 -0
- package/graphql/schema/baseSchema.d.ts +3 -0
- package/graphql/schema/baseSchema.js +60 -0
- package/graphql/schema/baseSchema.js.map +1 -0
- package/graphql/schema/contentEntries.d.ts +7 -0
- package/graphql/schema/contentEntries.js +357 -0
- package/graphql/schema/contentEntries.js.map +1 -0
- package/graphql/schema/contentModelGroups.d.ts +7 -0
- package/{content/plugins → graphql}/schema/contentModelGroups.js +40 -17
- package/graphql/schema/contentModelGroups.js.map +1 -0
- package/graphql/schema/contentModels.d.ts +7 -0
- package/{content/plugins → graphql}/schema/contentModels.js +108 -13
- package/graphql/schema/contentModels.js.map +1 -0
- package/graphql/schema/createFieldResolvers.d.ts +20 -0
- package/graphql/schema/createFieldResolvers.js +133 -0
- package/graphql/schema/createFieldResolvers.js.map +1 -0
- package/graphql/schema/createManageResolvers.d.ts +12 -0
- package/{content/plugins → graphql}/schema/createManageResolvers.js +36 -34
- package/graphql/schema/createManageResolvers.js.map +1 -0
- package/graphql/schema/createManageSDL.d.ts +12 -0
- package/{content/plugins → graphql}/schema/createManageSDL.js +31 -21
- package/graphql/schema/createManageSDL.js.map +1 -0
- package/graphql/schema/createPreviewResolvers.d.ts +12 -0
- package/graphql/schema/createPreviewResolvers.js +58 -0
- package/graphql/schema/createPreviewResolvers.js.map +1 -0
- package/graphql/schema/createReadResolvers.d.ts +12 -0
- package/graphql/schema/createReadResolvers.js +63 -0
- package/graphql/schema/createReadResolvers.js.map +1 -0
- package/graphql/schema/createReadSDL.d.ts +12 -0
- package/{content/plugins → graphql}/schema/createReadSDL.js +25 -13
- package/graphql/schema/createReadSDL.js.map +1 -0
- package/graphql/schema/resolvers/commonFieldResolvers.d.ts +6 -0
- package/{content/plugins → graphql}/schema/resolvers/commonFieldResolvers.js +0 -0
- package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveCreate.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreate.js +2 -4
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +8 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreateFrom.js +2 -4
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveDelete.js +10 -8
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGet.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveGet.js +79 -0
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetByIds.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetByIds.js +2 -4
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetRevisions.js +2 -4
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveList.d.ts +4 -0
- package/{content/plugins/schema/resolvers/read → graphql/schema/resolvers/manage}/resolveList.js +2 -4
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolvePublish.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolvePublish.js +0 -0
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +7 -0
- package/{content/plugins/schema/resolvers/manage/resolveGet.js → graphql/schema/resolvers/manage/resolveRepublish.js} +4 -4
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveUnpublish.js +0 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +8 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveUpdate.js +2 -4
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -0
- package/graphql/schema/resolvers/preview/resolveGet.d.ts +4 -0
- package/graphql/schema/resolvers/preview/resolveGet.js +34 -0
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/preview/resolveList.d.ts +4 -0
- package/{content/plugins → graphql}/schema/resolvers/preview/resolveList.js +2 -4
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -0
- package/graphql/schema/resolvers/read/resolveGet.d.ts +4 -0
- package/graphql/schema/resolvers/read/resolveGet.js +34 -0
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/read/resolveList.d.ts +4 -0
- package/{content/plugins/schema/resolvers/manage → graphql/schema/resolvers/read}/resolveList.js +2 -4
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -0
- package/graphql/schema/schemaPlugins.d.ts +8 -0
- package/graphql/schema/schemaPlugins.js +119 -0
- package/graphql/schema/schemaPlugins.js.map +1 -0
- package/graphql/system.d.ts +6 -0
- package/{plugins/graphql → graphql}/system.js +50 -6
- package/graphql/system.js.map +1 -0
- package/graphqlFields/boolean.d.ts +2 -0
- package/graphqlFields/boolean.js +69 -0
- package/graphqlFields/boolean.js.map +1 -0
- package/graphqlFields/datetime.d.ts +2 -0
- package/graphqlFields/datetime.js +95 -0
- package/graphqlFields/datetime.js.map +1 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +2 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js +234 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +3 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +79 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -0
- package/graphqlFields/dynamicZone/index.d.ts +2 -0
- package/graphqlFields/dynamicZone/index.js +21 -0
- package/graphqlFields/dynamicZone/index.js.map +1 -0
- package/graphqlFields/file.d.ts +2 -0
- package/graphqlFields/file.js +50 -0
- package/graphqlFields/file.js.map +1 -0
- package/graphqlFields/helpers.d.ts +6 -0
- package/graphqlFields/helpers.js +49 -0
- package/graphqlFields/helpers.js.map +1 -0
- package/graphqlFields/index.d.ts +2 -0
- package/graphqlFields/index.js +30 -0
- package/graphqlFields/index.js.map +1 -0
- package/graphqlFields/longText.d.ts +2 -0
- package/graphqlFields/longText.js +63 -0
- package/graphqlFields/longText.js.map +1 -0
- package/graphqlFields/number.d.ts +2 -0
- package/graphqlFields/number.js +79 -0
- package/graphqlFields/number.js.map +1 -0
- package/graphqlFields/object.d.ts +2 -0
- package/graphqlFields/object.js +275 -0
- package/graphqlFields/object.js.map +1 -0
- package/graphqlFields/ref.d.ts +2 -0
- package/graphqlFields/ref.js +261 -0
- package/graphqlFields/ref.js.map +1 -0
- package/graphqlFields/richText.d.ts +2 -0
- package/graphqlFields/richText.js +56 -0
- package/graphqlFields/richText.js.map +1 -0
- package/graphqlFields/text.d.ts +2 -0
- package/graphqlFields/text.js +73 -0
- package/graphqlFields/text.js.map +1 -0
- package/index.d.ts +10 -12
- package/index.js +75 -36
- package/index.js.map +1 -0
- package/modelManager/DefaultCmsModelManager.d.ts +14 -0
- package/{content/plugins/modelManager → modelManager}/DefaultCmsModelManager.js +12 -10
- package/modelManager/DefaultCmsModelManager.js.map +1 -0
- package/modelManager/index.d.ts +2 -0
- package/{content/plugins/modelManager → modelManager}/index.js +3 -3
- package/modelManager/index.js.map +1 -0
- package/package.json +38 -38
- package/parameters/context.d.ts +2 -0
- package/parameters/context.js +22 -0
- package/parameters/context.js.map +1 -0
- package/parameters/header.d.ts +2 -0
- package/parameters/header.js +55 -0
- package/parameters/header.js.map +1 -0
- package/parameters/index.d.ts +4 -0
- package/parameters/index.js +57 -0
- package/parameters/index.js.map +1 -0
- package/parameters/manual.d.ts +6 -0
- package/parameters/manual.js +44 -0
- package/parameters/manual.js.map +1 -0
- package/parameters/path.d.ts +2 -0
- package/parameters/path.js +51 -0
- package/parameters/path.js.map +1 -0
- package/plugins/CmsGraphQLSchemaPlugin.d.ts +5 -0
- package/plugins/CmsGraphQLSchemaPlugin.js +17 -0
- package/plugins/CmsGraphQLSchemaPlugin.js.map +1 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +20 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.js +38 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -0
- package/plugins/CmsGroupPlugin.d.ts +13 -0
- package/{content/plugins → plugins}/CmsGroupPlugin.js +9 -3
- package/plugins/CmsGroupPlugin.js.map +1 -0
- package/plugins/CmsModelFieldConverterPlugin.d.ts +14 -0
- package/plugins/CmsModelFieldConverterPlugin.js +17 -0
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -0
- package/plugins/CmsModelPlugin.d.ts +45 -0
- package/plugins/CmsModelPlugin.js +194 -0
- package/plugins/CmsModelPlugin.js.map +1 -0
- package/plugins/CmsParametersPlugin.d.ts +20 -0
- package/plugins/CmsParametersPlugin.js +28 -0
- package/plugins/CmsParametersPlugin.js.map +1 -0
- package/plugins/StorageTransformPlugin.d.ts +31 -0
- package/{content/plugins/storage → plugins}/StorageTransformPlugin.js +2 -1
- package/plugins/StorageTransformPlugin.js.map +1 -0
- package/plugins/index.d.ts +7 -0
- package/plugins/index.js +96 -0
- package/plugins/index.js.map +1 -0
- package/storage/default.d.ts +2 -0
- package/storage/default.js +27 -0
- package/storage/default.js.map +1 -0
- package/storage/object.d.ts +2 -0
- package/storage/object.js +127 -0
- package/storage/object.js.map +1 -0
- package/types.d.ts +878 -387
- package/types.js +130 -8
- package/types.js.map +1 -0
- package/upgrades/5.33.0/index.d.ts +3 -0
- package/upgrades/5.33.0/index.js +182 -0
- package/upgrades/5.33.0/index.js.map +1 -0
- package/upgrades/index.d.ts +1 -0
- package/upgrades/index.js +12 -0
- package/upgrades/index.js.map +1 -0
- package/utils/access.d.ts +8 -0
- package/utils/access.js +90 -0
- package/utils/access.js.map +1 -0
- package/utils/converters/Converter.d.ts +27 -0
- package/utils/converters/Converter.js +71 -0
- package/utils/converters/Converter.js.map +1 -0
- package/utils/converters/ConverterCollection.d.ts +31 -0
- package/utils/converters/ConverterCollection.js +143 -0
- package/utils/converters/ConverterCollection.js.map +1 -0
- package/utils/converters/valueKeyStorageConverter.d.ts +18 -0
- package/utils/converters/valueKeyStorageConverter.js +148 -0
- package/utils/converters/valueKeyStorageConverter.js.map +1 -0
- package/utils/createTypeFromFields.d.ts +15 -0
- package/utils/createTypeFromFields.js +75 -0
- package/utils/createTypeFromFields.js.map +1 -0
- package/{content/plugins/utils → utils}/createTypeName.d.ts +3 -3
- package/{content/plugins/utils → utils}/createTypeName.js +4 -2
- package/utils/createTypeName.js.map +1 -0
- package/{content/plugins/utils → utils}/entryStorage.d.ts +3 -3
- package/{content/plugins/utils → utils}/entryStorage.js +18 -23
- package/utils/entryStorage.js.map +1 -0
- package/utils/filterAsync.d.ts +1 -0
- package/utils/filterAsync.js +23 -0
- package/utils/filterAsync.js.map +1 -0
- package/utils/getBaseFieldType.d.ts +4 -0
- package/utils/getBaseFieldType.js +12 -0
- package/utils/getBaseFieldType.js.map +1 -0
- package/utils/getEntryTitle.d.ts +2 -0
- package/{content/plugins/utils → utils}/getEntryTitle.js +7 -6
- package/utils/getEntryTitle.js.map +1 -0
- package/utils/getSchemaFromFieldPlugins.d.ts +9 -0
- package/utils/getSchemaFromFieldPlugins.js +48 -0
- package/utils/getSchemaFromFieldPlugins.js.map +1 -0
- package/utils/ownership.d.ts +8 -0
- package/utils/ownership.js +41 -0
- package/utils/ownership.js.map +1 -0
- package/utils/permissions.d.ts +7 -0
- package/utils/permissions.js +106 -0
- package/utils/permissions.js.map +1 -0
- package/utils/pluralizedTypeName.d.ts +1 -0
- package/{content/plugins/utils → utils}/pluralizedTypeName.js +1 -1
- package/utils/pluralizedTypeName.js.map +1 -0
- package/utils/renderFields.d.ts +15 -0
- package/{content/plugins/utils → utils}/renderFields.js +7 -3
- package/utils/renderFields.js.map +1 -0
- package/utils/renderGetFilterFields.d.ts +10 -0
- package/utils/renderGetFilterFields.js +61 -0
- package/utils/renderGetFilterFields.js.map +1 -0
- package/utils/renderInputFields.d.ts +14 -0
- package/{content/plugins/utils → utils}/renderInputFields.js +4 -2
- package/utils/renderInputFields.js.map +1 -0
- package/utils/renderListFilterFields.d.ts +11 -0
- package/{content/plugins/utils → utils}/renderListFilterFields.js +40 -17
- package/utils/renderListFilterFields.js.map +1 -0
- package/utils/renderSortEnum.d.ts +12 -0
- package/utils/renderSortEnum.js +51 -0
- package/utils/renderSortEnum.js.map +1 -0
- package/utils/toSlug.d.ts +1 -0
- package/utils/toSlug.js +20 -0
- package/utils/toSlug.js.map +1 -0
- package/validators/dateGte.d.ts +2 -0
- package/{content/plugins/validators → validators}/dateGte.js +4 -4
- package/validators/dateGte.js.map +1 -0
- package/validators/dateLte.d.ts +2 -0
- package/{content/plugins/validators → validators}/dateLte.js +4 -4
- package/validators/dateLte.js.map +1 -0
- package/validators/dynamicZone.d.ts +2 -0
- package/validators/dynamicZone.js +24 -0
- package/validators/dynamicZone.js.map +1 -0
- package/validators/gte.d.ts +2 -0
- package/validators/gte.js +36 -0
- package/validators/gte.js.map +1 -0
- package/validators/in.d.ts +2 -0
- package/validators/in.js +36 -0
- package/validators/in.js.map +1 -0
- package/validators/index.d.ts +1 -0
- package/validators/index.js +38 -0
- package/validators/index.js.map +1 -0
- package/validators/lte.d.ts +2 -0
- package/validators/lte.js +36 -0
- package/validators/lte.js.map +1 -0
- package/validators/maxLength.d.ts +2 -0
- package/validators/maxLength.js +36 -0
- package/validators/maxLength.js.map +1 -0
- package/validators/minLength.d.ts +2 -0
- package/validators/minLength.js +36 -0
- package/validators/minLength.js.map +1 -0
- package/validators/pattern.d.ts +2 -0
- package/validators/pattern.js +50 -0
- package/validators/pattern.js.map +1 -0
- package/validators/patternPlugins/email.d.ts +2 -0
- package/validators/patternPlugins/email.js +20 -0
- package/validators/patternPlugins/email.js.map +1 -0
- package/validators/patternPlugins/index.d.ts +2 -0
- package/validators/patternPlugins/index.js +24 -0
- package/validators/patternPlugins/index.js.map +1 -0
- package/validators/patternPlugins/lowerCase.d.ts +2 -0
- package/validators/patternPlugins/lowerCase.js +20 -0
- package/validators/patternPlugins/lowerCase.js.map +1 -0
- package/validators/patternPlugins/lowerCaseSpace.d.ts +2 -0
- package/validators/patternPlugins/lowerCaseSpace.js +20 -0
- package/validators/patternPlugins/lowerCaseSpace.js.map +1 -0
- package/validators/patternPlugins/upperCase.d.ts +2 -0
- package/validators/patternPlugins/upperCase.js +20 -0
- package/validators/patternPlugins/upperCase.js.map +1 -0
- package/validators/patternPlugins/upperCaseSpace.d.ts +2 -0
- package/validators/patternPlugins/upperCaseSpace.js +20 -0
- package/validators/patternPlugins/upperCaseSpace.js.map +1 -0
- package/validators/patternPlugins/url.d.ts +2 -0
- package/validators/patternPlugins/url.js +20 -0
- package/validators/patternPlugins/url.js.map +1 -0
- package/validators/required.d.ts +2 -0
- package/validators/required.js +27 -0
- package/validators/required.js.map +1 -0
- package/validators/timeGte.d.ts +2 -0
- package/{content/plugins/validators → validators}/timeGte.js +6 -4
- package/validators/timeGte.js.map +1 -0
- package/validators/timeLte.d.ts +2 -0
- package/{content/plugins/validators → validators}/timeLte.js +6 -4
- package/validators/timeLte.js.map +1 -0
- package/validators/unique.d.ts +6 -0
- package/validators/unique.js +63 -0
- package/validators/unique.js.map +1 -0
- package/content/contextSetup.d.ts +0 -4
- package/content/contextSetup.js +0 -65
- package/content/graphQLHandlerFactory.d.ts +0 -5
- package/content/graphQLHandlerFactory.js +0 -173
- package/content/plugins/CmsGroupPlugin.d.ts +0 -11
- package/content/plugins/CmsModelPlugin.d.ts +0 -11
- package/content/plugins/CmsModelPlugin.js +0 -24
- package/content/plugins/buildSchemaPlugins.d.ts +0 -7
- package/content/plugins/buildSchemaPlugins.js +0 -29
- package/content/plugins/crud/contentEntry/afterDelete.d.ts +0 -7
- package/content/plugins/crud/contentEntry/beforeCreate.d.ts +0 -7
- package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +0 -7
- package/content/plugins/crud/contentEntry/entryDataValidation.d.ts +0 -4
- package/content/plugins/crud/contentEntry.crud.js +0 -931
- package/content/plugins/crud/contentModel/afterCreate.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterCreate.js +0 -18
- package/content/plugins/crud/contentModel/afterDelete.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterDelete.js +0 -18
- package/content/plugins/crud/contentModel/afterUpdate.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterUpdate.js +0 -18
- package/content/plugins/crud/contentModel/beforeCreate.d.ts +0 -9
- package/content/plugins/crud/contentModel/beforeDelete.d.ts +0 -9
- package/content/plugins/crud/contentModel/beforeUpdate.d.ts +0 -9
- package/content/plugins/crud/contentModel/beforeUpdate.js +0 -128
- package/content/plugins/crud/contentModel/contentModelManagerFactory.d.ts +0 -2
- package/content/plugins/crud/contentModel/createFieldModels.d.ts +0 -2
- package/content/plugins/crud/contentModel/idValidation.d.ts +0 -2
- package/content/plugins/crud/contentModel/validateLayout.d.ts +0 -2
- package/content/plugins/crud/contentModel.crud.js +0 -425
- package/content/plugins/crud/contentModelGroup/beforeCreate.d.ts +0 -9
- package/content/plugins/crud/contentModelGroup/beforeDelete.d.ts +0 -9
- package/content/plugins/crud/contentModelGroup/beforeUpdate.d.ts +0 -8
- package/content/plugins/crud/contentModelGroup.crud.js +0 -351
- package/content/plugins/crud/index.d.ts +0 -6
- package/content/plugins/crud/index.js +0 -100
- package/content/plugins/graphqlFields/boolean.d.ts +0 -3
- package/content/plugins/graphqlFields/boolean.js +0 -69
- package/content/plugins/graphqlFields/datetime.d.ts +0 -3
- package/content/plugins/graphqlFields/datetime.js +0 -83
- package/content/plugins/graphqlFields/file.d.ts +0 -3
- package/content/plugins/graphqlFields/file.js +0 -49
- package/content/plugins/graphqlFields/index.d.ts +0 -2
- package/content/plugins/graphqlFields/index.js +0 -30
- package/content/plugins/graphqlFields/longText.d.ts +0 -3
- package/content/plugins/graphqlFields/longText.js +0 -62
- package/content/plugins/graphqlFields/number.d.ts +0 -3
- package/content/plugins/graphqlFields/number.js +0 -75
- package/content/plugins/graphqlFields/object.d.ts +0 -3
- package/content/plugins/graphqlFields/object.js +0 -180
- package/content/plugins/graphqlFields/ref.d.ts +0 -3
- package/content/plugins/graphqlFields/ref.js +0 -205
- package/content/plugins/graphqlFields/richText.d.ts +0 -3
- package/content/plugins/graphqlFields/richText.js +0 -55
- package/content/plugins/graphqlFields/text.d.ts +0 -3
- package/content/plugins/graphqlFields/text.js +0 -72
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.d.ts +0 -8
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +0 -54
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.d.ts +0 -7
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +0 -35
- package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +0 -15
- package/content/plugins/modelManager/index.d.ts +0 -3
- package/content/plugins/schema/baseSchema.d.ts +0 -4
- package/content/plugins/schema/baseSchema.js +0 -98
- package/content/plugins/schema/contentEntries.d.ts +0 -4
- package/content/plugins/schema/contentEntries.js +0 -166
- package/content/plugins/schema/contentModelGroups.d.ts +0 -4
- package/content/plugins/schema/contentModels.d.ts +0 -4
- package/content/plugins/schema/createFieldResolvers.d.ts +0 -19
- package/content/plugins/schema/createFieldResolvers.js +0 -92
- package/content/plugins/schema/createManageResolvers.d.ts +0 -11
- package/content/plugins/schema/createManageSDL.d.ts +0 -9
- package/content/plugins/schema/createPreviewResolvers.d.ts +0 -10
- package/content/plugins/schema/createPreviewResolvers.js +0 -55
- package/content/plugins/schema/createReadResolvers.d.ts +0 -10
- package/content/plugins/schema/createReadResolvers.js +0 -55
- package/content/plugins/schema/createReadSDL.d.ts +0 -9
- package/content/plugins/schema/resolvers/commonFieldResolvers.d.ts +0 -6
- package/content/plugins/schema/resolvers/manage/resolveCreate.d.ts +0 -6
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.d.ts +0 -7
- package/content/plugins/schema/resolvers/manage/resolveDelete.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveGet.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveList.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolvePublish.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.d.ts +0 -6
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js +0 -23
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.d.ts +0 -6
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.js +0 -23
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveUpdate.d.ts +0 -7
- package/content/plugins/schema/resolvers/preview/resolveGet.d.ts +0 -2
- package/content/plugins/schema/resolvers/preview/resolveGet.js +0 -38
- package/content/plugins/schema/resolvers/preview/resolveList.d.ts +0 -2
- package/content/plugins/schema/resolvers/read/resolveGet.d.ts +0 -2
- package/content/plugins/schema/resolvers/read/resolveGet.js +0 -38
- package/content/plugins/schema/resolvers/read/resolveList.d.ts +0 -2
- package/content/plugins/schema/schemaPlugins.d.ts +0 -3
- package/content/plugins/schema/schemaPlugins.js +0 -92
- package/content/plugins/storage/StorageTransformPlugin.d.ts +0 -30
- package/content/plugins/storage/default.d.ts +0 -3
- package/content/plugins/storage/default.js +0 -28
- package/content/plugins/storage/object.d.ts +0 -3
- package/content/plugins/storage/object.js +0 -119
- package/content/plugins/utils/getEntryTitle.d.ts +0 -2
- package/content/plugins/utils/getSchemaFromFieldPlugins.d.ts +0 -11
- package/content/plugins/utils/getSchemaFromFieldPlugins.js +0 -30
- package/content/plugins/utils/pluralizedTypeName.d.ts +0 -1
- package/content/plugins/utils/renderFields.d.ts +0 -16
- package/content/plugins/utils/renderGetFilterFields.d.ts +0 -9
- package/content/plugins/utils/renderGetFilterFields.js +0 -41
- package/content/plugins/utils/renderInputFields.d.ts +0 -14
- package/content/plugins/utils/renderListFilterFields.d.ts +0 -10
- package/content/plugins/utils/renderSortEnum.d.ts +0 -9
- package/content/plugins/utils/renderSortEnum.js +0 -32
- package/content/plugins/validators/dateGte.d.ts +0 -3
- package/content/plugins/validators/dateLte.d.ts +0 -3
- package/content/plugins/validators/gte.d.ts +0 -3
- package/content/plugins/validators/gte.js +0 -32
- package/content/plugins/validators/in.d.ts +0 -3
- package/content/plugins/validators/in.js +0 -32
- package/content/plugins/validators/index.d.ts +0 -2
- package/content/plugins/validators/index.js +0 -36
- package/content/plugins/validators/lte.d.ts +0 -3
- package/content/plugins/validators/lte.js +0 -32
- package/content/plugins/validators/maxLength.d.ts +0 -3
- package/content/plugins/validators/maxLength.js +0 -32
- package/content/plugins/validators/minLength.d.ts +0 -3
- package/content/plugins/validators/minLength.js +0 -32
- package/content/plugins/validators/pattern.d.ts +0 -3
- package/content/plugins/validators/pattern.js +0 -47
- package/content/plugins/validators/patternPlugins/email.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/email.js +0 -17
- package/content/plugins/validators/patternPlugins/index.d.ts +0 -2
- package/content/plugins/validators/patternPlugins/index.js +0 -19
- package/content/plugins/validators/patternPlugins/lowerCase.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/lowerCase.js +0 -17
- package/content/plugins/validators/patternPlugins/upperCase.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/upperCase.js +0 -17
- package/content/plugins/validators/patternPlugins/url.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/url.js +0 -17
- package/content/plugins/validators/required.d.ts +0 -3
- package/content/plugins/validators/required.js +0 -25
- package/content/plugins/validators/timeGte.d.ts +0 -3
- package/content/plugins/validators/timeLte.d.ts +0 -3
- package/migrateCMSPermissions.d.ts +0 -17
- package/migrateCMSPermissions.js +0 -193
- package/plugins/context.d.ts +0 -4
- package/plugins/context.js +0 -34
- package/plugins/crud/index.d.ts +0 -6
- package/plugins/crud/index.js +0 -100
- package/plugins/crud/settings.crud.js +0 -93
- package/plugins/crud/system.crud.js +0 -182
- package/plugins/graphql/system.d.ts +0 -17
- package/plugins/graphql.d.ts +0 -2
- package/plugins/graphql.js +0 -79
- package/plugins/upgrades/index.d.ts +0 -2
- package/plugins/upgrades/index.js +0 -14
- package/plugins/upgrades/v5.5.0/helpers.d.ts +0 -6
- package/plugins/upgrades/v5.5.0/helpers.js +0 -10
- package/plugins/upgrades/v5.5.0/index.d.ts +0 -4
- package/plugins/upgrades/v5.5.0/index.js +0 -129
- package/transformers.d.ts +0 -2
- package/transformers.js +0 -25
- package/utils.d.ts +0 -25
- package/utils.js +0 -251
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
|
|
2
|
+
interface RenderFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
type: ApiEndpoint;
|
|
5
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
+
}
|
|
7
|
+
interface RenderFields {
|
|
8
|
+
(params: RenderFieldsParams): CmsModelFieldDefinition[];
|
|
9
|
+
}
|
|
10
|
+
export declare const renderFields: RenderFields;
|
|
11
|
+
interface RenderFieldParams extends RenderFieldsParams {
|
|
12
|
+
field: CmsModelField;
|
|
13
|
+
}
|
|
14
|
+
export declare const renderField: ({ model, type, field, fieldTypePlugins }: RenderFieldParams) => CmsModelFieldDefinition | null;
|
|
15
|
+
export {};
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderFields = exports.renderField = void 0;
|
|
7
7
|
|
|
8
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
9
|
+
|
|
8
10
|
const renderFields = ({
|
|
9
11
|
model,
|
|
10
12
|
type,
|
|
@@ -26,11 +28,11 @@ const renderField = ({
|
|
|
26
28
|
field,
|
|
27
29
|
fieldTypePlugins
|
|
28
30
|
}) => {
|
|
29
|
-
const plugin = fieldTypePlugins[field
|
|
31
|
+
const plugin = fieldTypePlugins[(0, _getBaseFieldType.getBaseFieldType)(field)];
|
|
30
32
|
|
|
31
33
|
if (!plugin) {
|
|
32
34
|
// Let's not render the field if it does not exist in the field plugins.
|
|
33
|
-
return;
|
|
35
|
+
return null;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
const defs = plugin[type].createTypeField({
|
|
@@ -39,7 +41,9 @@ const renderField = ({
|
|
|
39
41
|
fieldTypePlugins
|
|
40
42
|
});
|
|
41
43
|
|
|
42
|
-
if (
|
|
44
|
+
if (!defs) {
|
|
45
|
+
return null;
|
|
46
|
+
} else if (typeof defs === "string") {
|
|
43
47
|
return {
|
|
44
48
|
fields: defs
|
|
45
49
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderFields","model","type","fieldTypePlugins","fields","map","field","renderField","filter","Boolean","plugin","getBaseFieldType","defs","createTypeField"],"sources":["renderFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldDefinition,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderFieldsParams {\n model: CmsModel;\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderFields {\n (params: RenderFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderFields: RenderFields = ({\n model,\n type,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return model.fields\n .map(field => renderField({ model, type, field, fieldTypePlugins }))\n .filter(Boolean) as CmsModelFieldDefinition[];\n};\n\ninterface RenderFieldParams extends RenderFieldsParams {\n field: CmsModelField;\n}\n\nexport const renderField = ({\n model,\n type,\n field,\n fieldTypePlugins\n}: RenderFieldParams): CmsModelFieldDefinition | null => {\n const plugin: CmsModelFieldToGraphQLPlugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n const defs = plugin[type].createTypeField({\n model,\n field,\n fieldTypePlugins\n });\n\n if (!defs) {\n return null;\n } else if (typeof defs === \"string\") {\n return {\n fields: defs\n };\n }\n\n return defs;\n};\n"],"mappings":";;;;;;;AAQA;;AAWO,MAAMA,YAA0B,GAAG,CAAC;EACvCC,KADuC;EAEvCC,IAFuC;EAGvCC;AAHuC,CAAD,KAIT;EAC7B,OAAOF,KAAK,CAACG,MAAN,CACFC,GADE,CACEC,KAAK,IAAIC,WAAW,CAAC;IAAEN,KAAF;IAASC,IAAT;IAAeI,KAAf;IAAsBH;EAAtB,CAAD,CADtB,EAEFK,MAFE,CAEKC,OAFL,CAAP;AAGH,CARM;;;;AAcA,MAAMF,WAAW,GAAG,CAAC;EACxBN,KADwB;EAExBC,IAFwB;EAGxBI,KAHwB;EAIxBH;AAJwB,CAAD,KAK8B;EACrD,MAAMO,MAAoC,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAA,EAAiBL,KAAjB,CAAD,CAA7D;;EACA,IAAI,CAACI,MAAL,EAAa;IACT;IACA,OAAO,IAAP;EACH;;EACD,MAAME,IAAI,GAAGF,MAAM,CAACR,IAAD,CAAN,CAAaW,eAAb,CAA6B;IACtCZ,KADsC;IAEtCK,KAFsC;IAGtCH;EAHsC,CAA7B,CAAb;;EAMA,IAAI,CAACS,IAAL,EAAW;IACP,OAAO,IAAP;EACH,CAFD,MAEO,IAAI,OAAOA,IAAP,KAAgB,QAApB,EAA8B;IACjC,OAAO;MACHR,MAAM,EAAEQ;IADL,CAAP;EAGH;;EAED,OAAOA,IAAP;AACH,CA1BM"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CmsFieldTypePlugins, CmsModel } from "../types";
|
|
2
|
+
interface RenderGetFilterFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
5
|
+
}
|
|
6
|
+
interface RenderGetFilterFields {
|
|
7
|
+
(params: RenderGetFilterFieldsParams): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const renderGetFilterFields: RenderGetFilterFields;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderGetFilterFields = void 0;
|
|
7
|
+
|
|
8
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
9
|
+
|
|
10
|
+
const getCreateFilters = (plugins, fieldType) => {
|
|
11
|
+
if (!plugins[fieldType] || !plugins[fieldType].read.createGetFilters) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return plugins[fieldType].read.createGetFilters;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const renderGetFilterFields = ({
|
|
19
|
+
model,
|
|
20
|
+
fieldTypePlugins
|
|
21
|
+
}) => {
|
|
22
|
+
const fieldIdList = model.fields.filter(field => {
|
|
23
|
+
// Every time a client updates content model's fields, we check the type of each field. If a field plugin
|
|
24
|
+
// for a particular "field.type" doesn't exist on the backend yet, we throw an error. But still, we also
|
|
25
|
+
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
26
|
+
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
27
|
+
// could've just removed the plugin from the backend.
|
|
28
|
+
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
29
|
+
|
|
30
|
+
if (!fieldTypePlugins[baseType]) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return fieldTypePlugins[baseType].isSearchable;
|
|
35
|
+
}).map(f => f.fieldId);
|
|
36
|
+
const filters = ["id: ID", "entryId: String"];
|
|
37
|
+
|
|
38
|
+
for (const fieldId of fieldIdList) {
|
|
39
|
+
const field = model.fields.find(item => item.fieldId === fieldId);
|
|
40
|
+
|
|
41
|
+
if (!field) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
46
|
+
const createGetFilters = getCreateFilters(fieldTypePlugins, baseType);
|
|
47
|
+
|
|
48
|
+
if (typeof createGetFilters !== "function") {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
filters.push(createGetFilters({
|
|
53
|
+
model,
|
|
54
|
+
field
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return filters.filter(Boolean).join("\n");
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.renderGetFilterFields = renderGetFilterFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getCreateFilters","plugins","fieldType","read","createGetFilters","renderGetFilterFields","model","fieldTypePlugins","fieldIdList","fields","filter","field","baseType","getBaseFieldType","isSearchable","map","f","fieldId","filters","find","item","push","Boolean","join"],"sources":["renderGetFilterFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelFieldToGraphQLPlugin } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderGetFilterFieldsParams {\n model: CmsModel;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderGetFilterFields {\n (params: RenderGetFilterFieldsParams): string;\n}\n\nconst getCreateFilters = (\n plugins: CmsFieldTypePlugins,\n fieldType: string\n): CmsModelFieldToGraphQLPlugin[\"read\"][\"createGetFilters\"] | null => {\n if (!plugins[fieldType] || !plugins[fieldType].read.createGetFilters) {\n return null;\n }\n return plugins[fieldType].read.createGetFilters;\n};\n\nexport const renderGetFilterFields: RenderGetFilterFields = ({ model, fieldTypePlugins }) => {\n const fieldIdList = model.fields\n .filter(field => {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n if (!fieldTypePlugins[baseType]) {\n return false;\n }\n return fieldTypePlugins[baseType].isSearchable;\n })\n .map(f => f.fieldId);\n\n const filters: string[] = [\"id: ID\", \"entryId: String\"];\n\n for (const fieldId of fieldIdList) {\n const field = model.fields.find(item => item.fieldId === fieldId);\n if (!field) {\n continue;\n }\n const baseType = getBaseFieldType(field);\n const createGetFilters = getCreateFilters(fieldTypePlugins, baseType);\n if (typeof createGetFilters !== \"function\") {\n continue;\n }\n filters.push(createGetFilters({ model, field }));\n }\n\n return filters.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;;AACA;;AAUA,MAAMA,gBAAgB,GAAG,CACrBC,OADqB,EAErBC,SAFqB,KAG6C;EAClE,IAAI,CAACD,OAAO,CAACC,SAAD,CAAR,IAAuB,CAACD,OAAO,CAACC,SAAD,CAAP,CAAmBC,IAAnB,CAAwBC,gBAApD,EAAsE;IAClE,OAAO,IAAP;EACH;;EACD,OAAOH,OAAO,CAACC,SAAD,CAAP,CAAmBC,IAAnB,CAAwBC,gBAA/B;AACH,CARD;;AAUO,MAAMC,qBAA4C,GAAG,CAAC;EAAEC,KAAF;EAASC;AAAT,CAAD,KAAiC;EACzF,MAAMC,WAAW,GAAGF,KAAK,CAACG,MAAN,CACfC,MADe,CACRC,KAAK,IAAI;IACb;IACA;IACA;IACA;IACA;IACA,MAAMC,QAAQ,GAAG,IAAAC,kCAAA,EAAiBF,KAAjB,CAAjB;;IACA,IAAI,CAACJ,gBAAgB,CAACK,QAAD,CAArB,EAAiC;MAC7B,OAAO,KAAP;IACH;;IACD,OAAOL,gBAAgB,CAACK,QAAD,CAAhB,CAA2BE,YAAlC;EACH,CAZe,EAafC,GAbe,CAaXC,CAAC,IAAIA,CAAC,CAACC,OAbI,CAApB;EAeA,MAAMC,OAAiB,GAAG,CAAC,QAAD,EAAW,iBAAX,CAA1B;;EAEA,KAAK,MAAMD,OAAX,IAAsBT,WAAtB,EAAmC;IAC/B,MAAMG,KAAK,GAAGL,KAAK,CAACG,MAAN,CAAaU,IAAb,CAAkBC,IAAI,IAAIA,IAAI,CAACH,OAAL,KAAiBA,OAA3C,CAAd;;IACA,IAAI,CAACN,KAAL,EAAY;MACR;IACH;;IACD,MAAMC,QAAQ,GAAG,IAAAC,kCAAA,EAAiBF,KAAjB,CAAjB;IACA,MAAMP,gBAAgB,GAAGJ,gBAAgB,CAACO,gBAAD,EAAmBK,QAAnB,CAAzC;;IACA,IAAI,OAAOR,gBAAP,KAA4B,UAAhC,EAA4C;MACxC;IACH;;IACDc,OAAO,CAACG,IAAR,CAAajB,gBAAgB,CAAC;MAAEE,KAAF;MAASK;IAAT,CAAD,CAA7B;EACH;;EAED,OAAOO,OAAO,CAACR,MAAR,CAAeY,OAAf,EAAwBC,IAAxB,CAA6B,IAA7B,CAAP;AACH,CAhCM"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
|
|
2
|
+
interface RenderInputFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
5
|
+
}
|
|
6
|
+
interface RenderInputFieldParams extends RenderInputFieldsParams {
|
|
7
|
+
field: CmsModelField;
|
|
8
|
+
}
|
|
9
|
+
interface RenderInputFields {
|
|
10
|
+
(params: RenderInputFieldsParams): CmsModelFieldDefinition[];
|
|
11
|
+
}
|
|
12
|
+
export declare const renderInputFields: RenderInputFields;
|
|
13
|
+
export declare const renderInputField: ({ model, field, fieldTypePlugins }: RenderInputFieldParams) => CmsModelFieldDefinition | null;
|
|
14
|
+
export {};
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderInputFields = exports.renderInputField = void 0;
|
|
7
7
|
|
|
8
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
9
|
+
|
|
8
10
|
const renderInputFields = ({
|
|
9
11
|
model,
|
|
10
12
|
fieldTypePlugins
|
|
@@ -28,11 +30,11 @@ const renderInputField = ({
|
|
|
28
30
|
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
29
31
|
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
30
32
|
// could've just removed the plugin from the backend.
|
|
31
|
-
const plugin = fieldTypePlugins[field
|
|
33
|
+
const plugin = fieldTypePlugins[(0, _getBaseFieldType.getBaseFieldType)(field)];
|
|
32
34
|
|
|
33
35
|
if (!plugin) {
|
|
34
36
|
// Let's not render the field if it does not exist in the field plugins.
|
|
35
|
-
return;
|
|
37
|
+
return null;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
const def = plugin.manage.createInputField({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderInputFields","model","fieldTypePlugins","fields","map","field","renderInputField","filter","Boolean","plugin","getBaseFieldType","def","manage","createInputField"],"sources":["renderInputFields.ts"],"sourcesContent":["import {\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldDefinition,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderInputFieldsParams {\n model: CmsModel;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderInputFieldParams extends RenderInputFieldsParams {\n field: CmsModelField;\n}\ninterface RenderInputFields {\n (params: RenderInputFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderInputFields: RenderInputFields = ({\n model,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return model.fields\n .map(field => renderInputField({ model, field, fieldTypePlugins }))\n .filter(Boolean) as CmsModelFieldDefinition[];\n};\n\nexport const renderInputField = ({\n model,\n field,\n fieldTypePlugins\n}: RenderInputFieldParams): CmsModelFieldDefinition | null => {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const plugin: CmsModelFieldToGraphQLPlugin = fieldTypePlugins[getBaseFieldType(field)];\n\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n\n const def = plugin.manage.createInputField({\n model,\n field,\n fieldTypePlugins\n });\n if (typeof def === \"string\") {\n return {\n fields: def\n };\n }\n\n return def;\n};\n"],"mappings":";;;;;;;AAOA;;AAaO,MAAMA,iBAAoC,GAAG,CAAC;EACjDC,KADiD;EAEjDC;AAFiD,CAAD,KAGnB;EAC7B,OAAOD,KAAK,CAACE,MAAN,CACFC,GADE,CACEC,KAAK,IAAIC,gBAAgB,CAAC;IAAEL,KAAF;IAASI,KAAT;IAAgBH;EAAhB,CAAD,CAD3B,EAEFK,MAFE,CAEKC,OAFL,CAAP;AAGH,CAPM;;;;AASA,MAAMF,gBAAgB,GAAG,CAAC;EAC7BL,KAD6B;EAE7BI,KAF6B;EAG7BH;AAH6B,CAAD,KAI8B;EAC1D;EACA;EACA;EACA;EACA;EACA,MAAMO,MAAoC,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAA,EAAiBL,KAAjB,CAAD,CAA7D;;EAEA,IAAI,CAACI,MAAL,EAAa;IACT;IACA,OAAO,IAAP;EACH;;EAED,MAAME,GAAG,GAAGF,MAAM,CAACG,MAAP,CAAcC,gBAAd,CAA+B;IACvCZ,KADuC;IAEvCI,KAFuC;IAGvCH;EAHuC,CAA/B,CAAZ;;EAKA,IAAI,OAAOS,GAAP,KAAe,QAAnB,EAA6B;IACzB,OAAO;MACHR,MAAM,EAAEQ;IADL,CAAP;EAGH;;EAED,OAAOA,GAAP;AACH,CA7BM"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiEndpoint, CmsFieldTypePlugins, CmsModel } from "../types";
|
|
2
|
+
interface RenderListFilterFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
type: ApiEndpoint;
|
|
5
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
+
}
|
|
7
|
+
interface RenderListFilterFields {
|
|
8
|
+
(params: RenderListFilterFieldsParams): string;
|
|
9
|
+
}
|
|
10
|
+
export declare const renderListFilterFields: RenderListFilterFields;
|
|
11
|
+
export {};
|
|
@@ -1,36 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.renderListFilterFields = void 0;
|
|
9
7
|
|
|
10
|
-
var
|
|
8
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* We cast as read type, because input and output of read and manage are same. This way we ease things.
|
|
12
|
+
* Internal stuff so it should be ok.
|
|
13
|
+
* TODO note that if changing read/manage types, change this as well.
|
|
14
|
+
*/
|
|
15
|
+
const getCreateListFilters = (plugins, fieldType, type) => {
|
|
16
|
+
if (!plugins[fieldType]) {
|
|
17
|
+
return null;
|
|
18
|
+
} else if (!plugins[fieldType][type]) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return plugins[fieldType][type].createListFilters;
|
|
23
|
+
};
|
|
11
24
|
|
|
12
|
-
const renderListFilterFields =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
const renderListFilterFields = params => {
|
|
26
|
+
const {
|
|
27
|
+
model,
|
|
28
|
+
type,
|
|
29
|
+
fieldTypePlugins
|
|
30
|
+
} = params;
|
|
17
31
|
const fields = [["id: ID", "id_not: ID", "id_in: [ID!]", "id_not_in: [ID!]", "entryId: String", "entryId_not: String", "entryId_in: [String!]", "entryId_not_in: [String!]", "createdOn: DateTime", "createdOn_gt: DateTime", "createdOn_gte: DateTime", "createdOn_lt: DateTime", "createdOn_lte: DateTime", "createdOn_between: [DateTime!]", "createdOn_not_between: [DateTime!]", "savedOn: DateTime", "savedOn_gt: DateTime", "savedOn_gte: DateTime", "savedOn_lt: DateTime", "savedOn_lte: DateTime", "savedOn_between: [DateTime!]", "savedOn_not_between: [DateTime!]", "createdBy: String", "createdBy_not: String", "createdBy_in: [String!]", "createdBy_not_in: [String!]", "ownedBy: String", "ownedBy_not: String", "ownedBy_in: [String!]", "ownedBy_not_in: [String!]"].join("\n")];
|
|
32
|
+
/**
|
|
33
|
+
* We can find different statuses only in the manage API endpoint.
|
|
34
|
+
*/
|
|
18
35
|
|
|
19
|
-
|
|
20
|
-
|
|
36
|
+
if (type === "manage") {
|
|
37
|
+
fields.push(...["status: String", "status_not: String", "status_in: [String!]", "status_not_in: [String!]"]);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (const field of model.fields) {
|
|
41
|
+
// Every time a client updates content model's fields, we check the type of each field. If a field plugin
|
|
21
42
|
// for a particular "field.type" doesn't exist on the backend yet, we throw an error. But still, we also
|
|
22
43
|
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
23
44
|
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
24
45
|
// could've just removed the plugin from the backend.
|
|
46
|
+
const createListFilters = getCreateListFilters(fieldTypePlugins, (0, _getBaseFieldType.getBaseFieldType)(field), type);
|
|
25
47
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (typeof createListFilters === "function") {
|
|
29
|
-
fields.push(createListFilters({
|
|
30
|
-
model,
|
|
31
|
-
field
|
|
32
|
-
}));
|
|
48
|
+
if (typeof createListFilters !== "function") {
|
|
49
|
+
continue;
|
|
33
50
|
}
|
|
51
|
+
|
|
52
|
+
fields.push(createListFilters({
|
|
53
|
+
model,
|
|
54
|
+
field,
|
|
55
|
+
plugins: fieldTypePlugins
|
|
56
|
+
}));
|
|
34
57
|
}
|
|
35
58
|
|
|
36
59
|
return fields.filter(Boolean).join("\n");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getCreateListFilters","plugins","fieldType","type","createListFilters","renderListFilterFields","params","model","fieldTypePlugins","fields","join","push","field","getBaseFieldType","filter","Boolean"],"sources":["renderListFilterFields.ts"],"sourcesContent":["import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelFieldToGraphQLPlugin } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderListFilterFieldsParams {\n model: CmsModel;\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderListFilterFields {\n (params: RenderListFilterFieldsParams): string;\n}\n\ntype CreateListFiltersType =\n | CmsModelFieldToGraphQLPlugin[\"read\"][\"createListFilters\"]\n | CmsModelFieldToGraphQLPlugin[\"manage\"][\"createListFilters\"];\n/**\n * We cast as read type, because input and output of read and manage are same. This way we ease things.\n * Internal stuff so it should be ok.\n * TODO note that if changing read/manage types, change this as well.\n */\nconst getCreateListFilters = (\n plugins: CmsFieldTypePlugins,\n fieldType: string,\n type: ApiEndpoint\n): CreateListFiltersType | null => {\n if (!plugins[fieldType]) {\n return null;\n } else if (!plugins[fieldType][type]) {\n return null;\n }\n return plugins[fieldType][type].createListFilters;\n};\n\nexport const renderListFilterFields: RenderListFilterFields = (params): string => {\n const { model, type, fieldTypePlugins } = params;\n const fields: string[] = [\n [\n \"id: ID\",\n \"id_not: ID\",\n \"id_in: [ID!]\",\n \"id_not_in: [ID!]\",\n \"entryId: String\",\n \"entryId_not: String\",\n \"entryId_in: [String!]\",\n \"entryId_not_in: [String!]\",\n \"createdOn: DateTime\",\n \"createdOn_gt: DateTime\",\n \"createdOn_gte: DateTime\",\n \"createdOn_lt: DateTime\",\n \"createdOn_lte: DateTime\",\n \"createdOn_between: [DateTime!]\",\n \"createdOn_not_between: [DateTime!]\",\n \"savedOn: DateTime\",\n \"savedOn_gt: DateTime\",\n \"savedOn_gte: DateTime\",\n \"savedOn_lt: DateTime\",\n \"savedOn_lte: DateTime\",\n \"savedOn_between: [DateTime!]\",\n \"savedOn_not_between: [DateTime!]\",\n \"createdBy: String\",\n \"createdBy_not: String\",\n \"createdBy_in: [String!]\",\n \"createdBy_not_in: [String!]\",\n \"ownedBy: String\",\n \"ownedBy_not: String\",\n \"ownedBy_in: [String!]\",\n \"ownedBy_not_in: [String!]\"\n ].join(\"\\n\")\n ];\n /**\n * We can find different statuses only in the manage API endpoint.\n */\n if (type === \"manage\") {\n fields.push(\n ...[\n \"status: String\",\n \"status_not: String\",\n \"status_in: [String!]\",\n \"status_not_in: [String!]\"\n ]\n );\n }\n\n for (const field of model.fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n\n const createListFilters = getCreateListFilters(\n fieldTypePlugins,\n getBaseFieldType(field),\n type\n );\n if (typeof createListFilters !== \"function\") {\n continue;\n }\n fields.push(createListFilters({ model, field, plugins: fieldTypePlugins }));\n }\n\n return fields.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,GAAG,CACzBC,OADyB,EAEzBC,SAFyB,EAGzBC,IAHyB,KAIM;EAC/B,IAAI,CAACF,OAAO,CAACC,SAAD,CAAZ,EAAyB;IACrB,OAAO,IAAP;EACH,CAFD,MAEO,IAAI,CAACD,OAAO,CAACC,SAAD,CAAP,CAAmBC,IAAnB,CAAL,EAA+B;IAClC,OAAO,IAAP;EACH;;EACD,OAAOF,OAAO,CAACC,SAAD,CAAP,CAAmBC,IAAnB,EAAyBC,iBAAhC;AACH,CAXD;;AAaO,MAAMC,sBAA8C,GAAIC,MAAD,IAAoB;EAC9E,MAAM;IAAEC,KAAF;IAASJ,IAAT;IAAeK;EAAf,IAAoCF,MAA1C;EACA,MAAMG,MAAgB,GAAG,CACrB,CACI,QADJ,EAEI,YAFJ,EAGI,cAHJ,EAII,kBAJJ,EAKI,iBALJ,EAMI,qBANJ,EAOI,uBAPJ,EAQI,2BARJ,EASI,qBATJ,EAUI,wBAVJ,EAWI,yBAXJ,EAYI,wBAZJ,EAaI,yBAbJ,EAcI,gCAdJ,EAeI,oCAfJ,EAgBI,mBAhBJ,EAiBI,sBAjBJ,EAkBI,uBAlBJ,EAmBI,sBAnBJ,EAoBI,uBApBJ,EAqBI,8BArBJ,EAsBI,kCAtBJ,EAuBI,mBAvBJ,EAwBI,uBAxBJ,EAyBI,yBAzBJ,EA0BI,6BA1BJ,EA2BI,iBA3BJ,EA4BI,qBA5BJ,EA6BI,uBA7BJ,EA8BI,2BA9BJ,EA+BEC,IA/BF,CA+BO,IA/BP,CADqB,CAAzB;EAkCA;AACJ;AACA;;EACI,IAAIP,IAAI,KAAK,QAAb,EAAuB;IACnBM,MAAM,CAACE,IAAP,CACI,GAAG,CACC,gBADD,EAEC,oBAFD,EAGC,sBAHD,EAIC,0BAJD,CADP;EAQH;;EAED,KAAK,MAAMC,KAAX,IAAoBL,KAAK,CAACE,MAA1B,EAAkC;IAC9B;IACA;IACA;IACA;IACA;IAEA,MAAML,iBAAiB,GAAGJ,oBAAoB,CAC1CQ,gBAD0C,EAE1C,IAAAK,kCAAA,EAAiBD,KAAjB,CAF0C,EAG1CT,IAH0C,CAA9C;;IAKA,IAAI,OAAOC,iBAAP,KAA6B,UAAjC,EAA6C;MACzC;IACH;;IACDK,MAAM,CAACE,IAAP,CAAYP,iBAAiB,CAAC;MAAEG,KAAF;MAASK,KAAT;MAAgBX,OAAO,EAAEO;IAAzB,CAAD,CAA7B;EACH;;EAED,OAAOC,MAAM,CAACK,MAAP,CAAcC,OAAd,EAAuBL,IAAvB,CAA4B,IAA5B,CAAP;AACH,CArEM"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CmsFieldTypePlugins, CmsModel } from "../types";
|
|
2
|
+
import { CmsGraphQLSchemaSorterPlugin } from "../plugins/CmsGraphQLSchemaSorterPlugin";
|
|
3
|
+
interface RenderSortEnumParams {
|
|
4
|
+
model: CmsModel;
|
|
5
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
6
|
+
sorterPlugins: CmsGraphQLSchemaSorterPlugin[];
|
|
7
|
+
}
|
|
8
|
+
interface RenderSortEnum {
|
|
9
|
+
(params: RenderSortEnumParams): string;
|
|
10
|
+
}
|
|
11
|
+
export declare const renderSortEnum: RenderSortEnum;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderSortEnum = void 0;
|
|
7
|
+
|
|
8
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
9
|
+
|
|
10
|
+
const renderSortEnum = ({
|
|
11
|
+
model,
|
|
12
|
+
fieldTypePlugins,
|
|
13
|
+
sorterPlugins
|
|
14
|
+
}) => {
|
|
15
|
+
let sorters = [`id_ASC`, `id_DESC`, "savedOn_ASC", "savedOn_DESC", "createdOn_ASC", "createdOn_DESC"];
|
|
16
|
+
|
|
17
|
+
for (const field of model.fields) {
|
|
18
|
+
const plugin = fieldTypePlugins[(0, _getBaseFieldType.getBaseFieldType)(field)];
|
|
19
|
+
|
|
20
|
+
if (!plugin) {
|
|
21
|
+
continue;
|
|
22
|
+
} else if (plugin.createSorters) {
|
|
23
|
+
const result = plugin.createSorters({
|
|
24
|
+
model,
|
|
25
|
+
field,
|
|
26
|
+
sorters
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (result) {
|
|
30
|
+
sorters = result;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!plugin.isSortable) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
sorters.push(`${field.fieldId}_ASC`);
|
|
40
|
+
sorters.push(`${field.fieldId}_DESC`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return sorterPlugins.reduce((result, plugin) => {
|
|
44
|
+
return plugin.createSorter({
|
|
45
|
+
model,
|
|
46
|
+
sorters: result
|
|
47
|
+
});
|
|
48
|
+
}, sorters).join("\n");
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.renderSortEnum = renderSortEnum;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderSortEnum","model","fieldTypePlugins","sorterPlugins","sorters","field","fields","plugin","getBaseFieldType","createSorters","result","isSortable","push","fieldId","reduce","createSorter","join"],"sources":["renderSortEnum.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { CmsGraphQLSchemaSorterPlugin } from \"~/plugins/CmsGraphQLSchemaSorterPlugin\";\n\ninterface RenderSortEnumParams {\n model: CmsModel;\n fieldTypePlugins: CmsFieldTypePlugins;\n sorterPlugins: CmsGraphQLSchemaSorterPlugin[];\n}\ninterface RenderSortEnum {\n (params: RenderSortEnumParams): string;\n}\n\nexport const renderSortEnum: RenderSortEnum = ({\n model,\n fieldTypePlugins,\n sorterPlugins\n}): string => {\n let sorters: string[] = [\n `id_ASC`,\n `id_DESC`,\n \"savedOn_ASC\",\n \"savedOn_DESC\",\n \"createdOn_ASC\",\n \"createdOn_DESC\"\n ];\n\n for (const field of model.fields) {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n continue;\n } else if (plugin.createSorters) {\n const result = plugin.createSorters({\n model,\n field,\n sorters\n });\n if (result) {\n sorters = result;\n continue;\n }\n }\n if (!plugin.isSortable) {\n continue;\n }\n sorters.push(`${field.fieldId}_ASC`);\n sorters.push(`${field.fieldId}_DESC`);\n }\n\n return sorterPlugins\n .reduce((result, plugin) => {\n return plugin.createSorter({\n model,\n sorters: result\n });\n }, sorters)\n .join(\"\\n\");\n};\n"],"mappings":";;;;;;;AACA;;AAYO,MAAMA,cAA8B,GAAG,CAAC;EAC3CC,KAD2C;EAE3CC,gBAF2C;EAG3CC;AAH2C,CAAD,KAIhC;EACV,IAAIC,OAAiB,GAAG,CACnB,QADmB,EAEnB,SAFmB,EAGpB,aAHoB,EAIpB,cAJoB,EAKpB,eALoB,EAMpB,gBANoB,CAAxB;;EASA,KAAK,MAAMC,KAAX,IAAoBJ,KAAK,CAACK,MAA1B,EAAkC;IAC9B,MAAMC,MAAM,GAAGL,gBAAgB,CAAC,IAAAM,kCAAA,EAAiBH,KAAjB,CAAD,CAA/B;;IACA,IAAI,CAACE,MAAL,EAAa;MACT;IACH,CAFD,MAEO,IAAIA,MAAM,CAACE,aAAX,EAA0B;MAC7B,MAAMC,MAAM,GAAGH,MAAM,CAACE,aAAP,CAAqB;QAChCR,KADgC;QAEhCI,KAFgC;QAGhCD;MAHgC,CAArB,CAAf;;MAKA,IAAIM,MAAJ,EAAY;QACRN,OAAO,GAAGM,MAAV;QACA;MACH;IACJ;;IACD,IAAI,CAACH,MAAM,CAACI,UAAZ,EAAwB;MACpB;IACH;;IACDP,OAAO,CAACQ,IAAR,CAAc,GAAEP,KAAK,CAACQ,OAAQ,MAA9B;IACAT,OAAO,CAACQ,IAAR,CAAc,GAAEP,KAAK,CAACQ,OAAQ,OAA9B;EACH;;EAED,OAAOV,aAAa,CACfW,MADE,CACK,CAACJ,MAAD,EAASH,MAAT,KAAoB;IACxB,OAAOA,MAAM,CAACQ,YAAP,CAAoB;MACvBd,KADuB;MAEvBG,OAAO,EAAEM;IAFc,CAApB,CAAP;EAIH,CANE,EAMAN,OANA,EAOFY,IAPE,CAOG,IAPH,CAAP;AAQH,CA5CM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toSlug: (text: string) => string;
|
package/utils/toSlug.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.toSlug = void 0;
|
|
9
|
+
|
|
10
|
+
var _slugify = _interopRequireDefault(require("slugify"));
|
|
11
|
+
|
|
12
|
+
const toSlug = text => {
|
|
13
|
+
return (0, _slugify.default)(text, {
|
|
14
|
+
replacement: "-",
|
|
15
|
+
lower: true,
|
|
16
|
+
remove: /[*#\?<>_\{\}\[\]+~.()'"!:;@]/g
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.toSlug = toSlug;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["toSlug","text","slugify","replacement","lower","remove"],"sources":["toSlug.ts"],"sourcesContent":["import slugify from \"slugify\";\n\nexport const toSlug = (text: string): string => {\n return slugify(text, {\n replacement: \"-\",\n lower: true,\n remove: /[*#\\?<>_\\{\\}\\[\\]+~.()'\"!:;@]/g\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAIC,IAAD,IAA0B;EAC5C,OAAO,IAAAC,gBAAA,EAAQD,IAAR,EAAc;IACjBE,WAAW,EAAE,GADI;IAEjBC,KAAK,EAAE,IAFU;IAGjBC,MAAM,EAAE;EAHS,CAAd,CAAP;AAKH,CANM"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createDateGteValidator = void 0;
|
|
7
7
|
|
|
8
8
|
var _validation = require("@webiny/validation");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const createDateGteValidator = () => ({
|
|
11
11
|
type: "cms-model-field-validator",
|
|
12
12
|
name: "cms-model-field-validator-date-gte",
|
|
13
13
|
validator: {
|
|
@@ -20,7 +20,7 @@ var _default = () => ({
|
|
|
20
20
|
const {
|
|
21
21
|
value: gteValue,
|
|
22
22
|
type
|
|
23
|
-
} = validator.settings;
|
|
23
|
+
} = validator.settings || {};
|
|
24
24
|
|
|
25
25
|
if (typeof gteValue === "undefined") {
|
|
26
26
|
return true;
|
|
@@ -34,4 +34,4 @@ var _default = () => ({
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
exports.
|
|
37
|
+
exports.createDateGteValidator = createDateGteValidator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createDateGteValidator","type","name","validator","validate","value","gteValue","settings","validation","then","v","catch"],"sources":["dateGte.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createDateGteValidator = (): CmsModelFieldValidatorPlugin => ({\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-date-gte\",\n validator: {\n name: \"dateGte\",\n async validate({ value, validator }) {\n const { value: gteValue, type } = validator.settings || {};\n if (typeof gteValue === \"undefined\") {\n return true;\n } else if (type === \"time\") {\n return validation\n .validate(value, `timeGte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n return validation\n .validate(value, `dateGte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n }\n});\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,sBAAsB,GAAG,OAAqC;EACvEC,IAAI,EAAE,2BADiE;EAEvEC,IAAI,EAAE,oCAFiE;EAGvEC,SAAS,EAAE;IACPD,IAAI,EAAE,SADC;;IAEP,MAAME,QAAN,CAAe;MAAEC,KAAF;MAASF;IAAT,CAAf,EAAqC;MACjC,MAAM;QAAEE,KAAK,EAAEC,QAAT;QAAmBL;MAAnB,IAA4BE,SAAS,CAACI,QAAV,IAAsB,EAAxD;;MACA,IAAI,OAAOD,QAAP,KAAoB,WAAxB,EAAqC;QACjC,OAAO,IAAP;MACH,CAFD,MAEO,IAAIL,IAAI,KAAK,MAAb,EAAqB;QACxB,OAAOO,sBAAA,CACFJ,QADE,CACOC,KADP,EACe,WAAUC,QAAS,EADlC,EAEFG,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;MAIH;;MACD,OAAOH,sBAAA,CACFJ,QADE,CACOC,KADP,EACe,WAAUC,QAAS,EADlC,EAEFG,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;IAIH;;EAhBM;AAH4D,CAArC,CAA/B"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createDateLteValidator = void 0;
|
|
7
7
|
|
|
8
8
|
var _validation = require("@webiny/validation");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const createDateLteValidator = () => ({
|
|
11
11
|
type: "cms-model-field-validator",
|
|
12
12
|
name: "cms-model-field-validator-date-lte",
|
|
13
13
|
validator: {
|
|
@@ -20,7 +20,7 @@ var _default = () => ({
|
|
|
20
20
|
const {
|
|
21
21
|
value: lteValue,
|
|
22
22
|
type
|
|
23
|
-
} = validator.settings;
|
|
23
|
+
} = validator.settings || {};
|
|
24
24
|
|
|
25
25
|
if (typeof lteValue === "undefined") {
|
|
26
26
|
return true;
|
|
@@ -34,4 +34,4 @@ var _default = () => ({
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
exports.
|
|
37
|
+
exports.createDateLteValidator = createDateLteValidator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createDateLteValidator","type","name","validator","validate","value","lteValue","settings","validation","then","v","catch"],"sources":["dateLte.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createDateLteValidator = (): CmsModelFieldValidatorPlugin => ({\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-date-lte\",\n validator: {\n name: \"dateLte\",\n async validate({ value, validator }) {\n const { value: lteValue, type } = validator.settings || {};\n if (typeof lteValue === \"undefined\") {\n return true;\n } else if (type === \"time\") {\n return validation\n .validate(value, `timeLte:${lteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n return validation\n .validate(value, `dateLte:${lteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n }\n});\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,sBAAsB,GAAG,OAAqC;EACvEC,IAAI,EAAE,2BADiE;EAEvEC,IAAI,EAAE,oCAFiE;EAGvEC,SAAS,EAAE;IACPD,IAAI,EAAE,SADC;;IAEP,MAAME,QAAN,CAAe;MAAEC,KAAF;MAASF;IAAT,CAAf,EAAqC;MACjC,MAAM;QAAEE,KAAK,EAAEC,QAAT;QAAmBL;MAAnB,IAA4BE,SAAS,CAACI,QAAV,IAAsB,EAAxD;;MACA,IAAI,OAAOD,QAAP,KAAoB,WAAxB,EAAqC;QACjC,OAAO,IAAP;MACH,CAFD,MAEO,IAAIL,IAAI,KAAK,MAAb,EAAqB;QACxB,OAAOO,sBAAA,CACFJ,QADE,CACOC,KADP,EACe,WAAUC,QAAS,EADlC,EAEFG,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;MAIH;;MACD,OAAOH,sBAAA,CACFJ,QADE,CACOC,KADP,EACe,WAAUC,QAAS,EADlC,EAEFG,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;IAIH;;EAhBM;AAH4D,CAArC,CAA/B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createDynamicZoneValidator = void 0;
|
|
7
|
+
|
|
8
|
+
const createDynamicZoneValidator = () => {
|
|
9
|
+
return {
|
|
10
|
+
type: "cms-model-field-validator",
|
|
11
|
+
name: "cms-model-field-validator-dynamic-zone",
|
|
12
|
+
validator: {
|
|
13
|
+
name: "dynamicZone",
|
|
14
|
+
|
|
15
|
+
validate() {
|
|
16
|
+
// TODO: implement validation.
|
|
17
|
+
return Promise.resolve(true);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.createDynamicZoneValidator = createDynamicZoneValidator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createDynamicZoneValidator","type","name","validator","validate","Promise","resolve"],"sources":["dynamicZone.ts"],"sourcesContent":["import { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createDynamicZoneValidator = (): CmsModelFieldValidatorPlugin => {\n return {\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-dynamic-zone\",\n validator: {\n name: \"dynamicZone\",\n validate() {\n // TODO: implement validation.\n return Promise.resolve(true);\n }\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,0BAA0B,GAAG,MAAoC;EAC1E,OAAO;IACHC,IAAI,EAAE,2BADH;IAEHC,IAAI,EAAE,wCAFH;IAGHC,SAAS,EAAE;MACPD,IAAI,EAAE,aADC;;MAEPE,QAAQ,GAAG;QACP;QACA,OAAOC,OAAO,CAACC,OAAR,CAAgB,IAAhB,CAAP;MACH;;IALM;EAHR,CAAP;AAWH,CAZM"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createGteValidator = void 0;
|
|
7
|
+
|
|
8
|
+
var _validation = require("@webiny/validation");
|
|
9
|
+
|
|
10
|
+
const createGteValidator = () => {
|
|
11
|
+
return {
|
|
12
|
+
type: "cms-model-field-validator",
|
|
13
|
+
name: "cms-model-field-validator-gte",
|
|
14
|
+
validator: {
|
|
15
|
+
name: "gte",
|
|
16
|
+
|
|
17
|
+
validate({
|
|
18
|
+
value,
|
|
19
|
+
validator
|
|
20
|
+
}) {
|
|
21
|
+
var _validator$settings;
|
|
22
|
+
|
|
23
|
+
const gteValue = (_validator$settings = validator.settings) === null || _validator$settings === void 0 ? void 0 : _validator$settings.value;
|
|
24
|
+
|
|
25
|
+
if (typeof gteValue !== "undefined") {
|
|
26
|
+
return _validation.validation.validate(value, `gte:${gteValue}`).then(v => v === true).catch(() => false);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return Promise.resolve(true);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.createGteValidator = createGteValidator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createGteValidator","type","name","validator","validate","value","gteValue","settings","validation","then","v","catch","Promise","resolve"],"sources":["gte.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createGteValidator = (): CmsModelFieldValidatorPlugin => {\n return {\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-gte\",\n validator: {\n name: \"gte\",\n validate({ value, validator }) {\n const gteValue = validator.settings?.value;\n if (typeof gteValue !== \"undefined\") {\n return validation\n .validate(value, `gte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n return Promise.resolve(true);\n }\n }\n };\n};\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,kBAAkB,GAAG,MAAoC;EAClE,OAAO;IACHC,IAAI,EAAE,2BADH;IAEHC,IAAI,EAAE,+BAFH;IAGHC,SAAS,EAAE;MACPD,IAAI,EAAE,KADC;;MAEPE,QAAQ,CAAC;QAAEC,KAAF;QAASF;MAAT,CAAD,EAAuB;QAAA;;QAC3B,MAAMG,QAAQ,0BAAGH,SAAS,CAACI,QAAb,wDAAG,oBAAoBF,KAArC;;QACA,IAAI,OAAOC,QAAP,KAAoB,WAAxB,EAAqC;UACjC,OAAOE,sBAAA,CACFJ,QADE,CACOC,KADP,EACe,OAAMC,QAAS,EAD9B,EAEFG,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;QAIH;;QACD,OAAOC,OAAO,CAACC,OAAR,CAAgB,IAAhB,CAAP;MACH;;IAXM;EAHR,CAAP;AAiBH,CAlBM"}
|
package/validators/in.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createInValidator = void 0;
|
|
7
|
+
|
|
8
|
+
var _validation = require("@webiny/validation");
|
|
9
|
+
|
|
10
|
+
const createInValidator = () => {
|
|
11
|
+
return {
|
|
12
|
+
type: "cms-model-field-validator",
|
|
13
|
+
name: "cms-model-field-validator-in",
|
|
14
|
+
validator: {
|
|
15
|
+
name: "in",
|
|
16
|
+
|
|
17
|
+
validate({
|
|
18
|
+
value,
|
|
19
|
+
validator
|
|
20
|
+
}) {
|
|
21
|
+
var _validator$settings;
|
|
22
|
+
|
|
23
|
+
const values = (_validator$settings = validator.settings) === null || _validator$settings === void 0 ? void 0 : _validator$settings.values;
|
|
24
|
+
|
|
25
|
+
if (Array.isArray(values)) {
|
|
26
|
+
return _validation.validation.validate(value, `in:${values.join(":")}`).then(v => v === true).catch(() => false);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return Promise.resolve(true);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.createInValidator = createInValidator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createInValidator","type","name","validator","validate","value","values","settings","Array","isArray","validation","join","then","v","catch","Promise","resolve"],"sources":["in.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createInValidator = (): CmsModelFieldValidatorPlugin => {\n return {\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-in\",\n validator: {\n name: \"in\",\n validate({ value, validator }) {\n const values = validator.settings?.values;\n if (Array.isArray(values)) {\n return validation\n .validate(value, `in:${values.join(\":\")}`)\n .then(v => v === true)\n .catch(() => false);\n }\n\n return Promise.resolve(true);\n }\n }\n };\n};\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,iBAAiB,GAAG,MAAoC;EACjE,OAAO;IACHC,IAAI,EAAE,2BADH;IAEHC,IAAI,EAAE,8BAFH;IAGHC,SAAS,EAAE;MACPD,IAAI,EAAE,IADC;;MAEPE,QAAQ,CAAC;QAAEC,KAAF;QAASF;MAAT,CAAD,EAAuB;QAAA;;QAC3B,MAAMG,MAAM,0BAAGH,SAAS,CAACI,QAAb,wDAAG,oBAAoBD,MAAnC;;QACA,IAAIE,KAAK,CAACC,OAAN,CAAcH,MAAd,CAAJ,EAA2B;UACvB,OAAOI,sBAAA,CACFN,QADE,CACOC,KADP,EACe,MAAKC,MAAM,CAACK,IAAP,CAAY,GAAZ,CAAiB,EADrC,EAEFC,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;QAIH;;QAED,OAAOC,OAAO,CAACC,OAAR,CAAgB,IAAhB,CAAP;MACH;;IAZM;EAHR,CAAP;AAkBH,CAnBM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createValidators: () => (import("../types").CmsModelFieldValidatorPlugin | import("../types").CmsModelFieldPatternValidatorPlugin[])[];
|