@webiny/api-headless-cms 0.0.0-mt-3 → 0.0.0-unstable.085ff6572f
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/constants.d.ts +1 -0
- package/constants.js +8 -0
- package/constants.js.map +1 -0
- package/context.d.ts +6 -0
- package/context.js +130 -0
- package/context.js.map +1 -0
- package/crud/contentEntry/afterDelete.d.ts +8 -0
- package/{content/plugins/crud → crud}/contentEntry/afterDelete.js +2 -7
- 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 -5
- 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 -5
- package/crud/contentEntry/beforeUpdate.js.map +1 -0
- package/crud/contentEntry/entryDataValidation.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentEntry/entryDataValidation.js +22 -49
- 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 +29 -43
- package/crud/contentEntry/markLockedFields.js.map +1 -0
- package/crud/contentEntry/referenceFieldsMapping.d.ts +13 -0
- package/crud/contentEntry/referenceFieldsMapping.js +265 -0
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -0
- package/crud/contentEntry/searchableFields.d.ts +9 -0
- package/crud/contentEntry/searchableFields.js +72 -0
- package/crud/contentEntry/searchableFields.js.map +1 -0
- package/crud/contentEntry.crud.d.ts +20 -0
- package/crud/contentEntry.crud.js +1477 -0
- package/crud/contentEntry.crud.js.map +1 -0
- package/crud/contentModel/afterCreate.d.ts +8 -0
- package/crud/contentModel/afterCreate.js +16 -0
- package/crud/contentModel/afterCreate.js.map +1 -0
- package/crud/contentModel/afterCreateFrom.d.ts +8 -0
- package/crud/contentModel/afterCreateFrom.js +16 -0
- package/crud/contentModel/afterCreateFrom.js.map +1 -0
- package/crud/contentModel/afterDelete.d.ts +8 -0
- package/crud/contentModel/afterDelete.js +16 -0
- package/crud/contentModel/afterDelete.js.map +1 -0
- package/crud/contentModel/afterUpdate.d.ts +8 -0
- package/crud/contentModel/afterUpdate.js +16 -0
- package/crud/contentModel/afterUpdate.js.map +1 -0
- package/crud/contentModel/beforeCreate.d.ts +14 -0
- package/crud/contentModel/beforeCreate.js +128 -0
- package/crud/contentModel/beforeCreate.js.map +1 -0
- package/crud/contentModel/beforeDelete.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentModel/beforeDelete.js +8 -18
- package/crud/contentModel/beforeDelete.js.map +1 -0
- package/crud/contentModel/beforeUpdate.d.ts +8 -0
- package/crud/contentModel/beforeUpdate.js +60 -0
- package/crud/contentModel/beforeUpdate.js.map +1 -0
- package/crud/contentModel/compatibility/modelApiName.d.ts +3 -0
- package/crud/contentModel/compatibility/modelApiName.js +24 -0
- package/crud/contentModel/compatibility/modelApiName.js.map +1 -0
- package/crud/contentModel/contentModelManagerFactory.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/contentModelManagerFactory.js +0 -7
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -0
- package/crud/contentModel/createFieldStorageId.d.ts +2 -0
- package/crud/contentModel/createFieldStorageId.js +17 -0
- package/crud/contentModel/createFieldStorageId.js.map +1 -0
- package/crud/contentModel/defaultFields.d.ts +5 -0
- package/crud/contentModel/defaultFields.js +58 -0
- package/crud/contentModel/defaultFields.js.map +1 -0
- package/crud/contentModel/fields/descriptionField.d.ts +2 -0
- package/crud/contentModel/fields/descriptionField.js +42 -0
- package/crud/contentModel/fields/descriptionField.js.map +1 -0
- package/crud/contentModel/fields/imageField.d.ts +2 -0
- package/crud/contentModel/fields/imageField.js +46 -0
- package/crud/contentModel/fields/imageField.js.map +1 -0
- package/crud/contentModel/fields/titleField.d.ts +2 -0
- package/crud/contentModel/fields/titleField.js +58 -0
- package/crud/contentModel/fields/titleField.js.map +1 -0
- package/crud/contentModel/validate/endingAllowed.d.ts +6 -0
- package/crud/contentModel/validate/endingAllowed.js +26 -0
- package/crud/contentModel/validate/endingAllowed.js.map +1 -0
- package/crud/contentModel/validate/isModelEndingAllowed.d.ts +6 -0
- package/crud/contentModel/validate/isModelEndingAllowed.js +24 -0
- package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -0
- package/crud/contentModel/validate/modelId.d.ts +11 -0
- package/crud/contentModel/validate/modelId.js +36 -0
- package/crud/contentModel/validate/modelId.js.map +1 -0
- package/crud/contentModel/validate/pluralApiName.d.ts +7 -0
- package/crud/contentModel/validate/pluralApiName.js +24 -0
- package/crud/contentModel/validate/pluralApiName.js.map +1 -0
- package/crud/contentModel/validate/singularApiName.d.ts +7 -0
- package/crud/contentModel/validate/singularApiName.js +24 -0
- package/crud/contentModel/validate/singularApiName.js.map +1 -0
- package/crud/contentModel/validateLayout.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/validateLayout.js +1 -11
- package/crud/contentModel/validateLayout.js.map +1 -0
- package/crud/contentModel/validateModel.d.ts +9 -0
- package/crud/contentModel/validateModel.js +27 -0
- package/crud/contentModel/validateModel.js.map +1 -0
- package/crud/contentModel/validateModelFields.d.ts +9 -0
- package/crud/contentModel/validateModelFields.js +342 -0
- package/crud/contentModel/validateModelFields.js.map +1 -0
- package/crud/contentModel/validation.d.ts +551 -0
- package/crud/contentModel/validation.js +145 -0
- package/crud/contentModel/validation.js.map +1 -0
- package/crud/contentModel.crud.d.ts +14 -0
- package/crud/contentModel.crud.js +626 -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 +8 -20
- 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 -12
- 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 -8
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -0
- package/crud/contentModelGroup/validation.d.ts +30 -0
- package/crud/contentModelGroup/validation.js +34 -0
- package/crud/contentModelGroup/validation.js.map +1 -0
- package/{content/plugins/crud → crud}/contentModelGroup.crud.d.ts +5 -3
- package/crud/contentModelGroup.crud.js +367 -0
- package/crud/contentModelGroup.crud.js.map +1 -0
- package/crud/settings.crud.d.ts +12 -0
- package/crud/settings.crud.js +62 -0
- package/crud/settings.crud.js.map +1 -0
- package/{content/plugins/crud/contentModel.crud.d.ts → crud/system.crud.d.ts} +5 -4
- package/crud/system.crud.js +126 -0
- package/crud/system.crud.js.map +1 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +7 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js +53 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +11 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +203 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +11 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +251 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/index.d.ts +4 -0
- package/fieldConverters/index.js +13 -0
- package/fieldConverters/index.js.map +1 -0
- package/graphql/buildSchemaPlugins.d.ts +11 -0
- package/graphql/buildSchemaPlugins.js +19 -0
- package/graphql/buildSchemaPlugins.js.map +1 -0
- package/graphql/checkEndpointAccess.d.ts +2 -0
- package/graphql/checkEndpointAccess.js +18 -0
- package/graphql/checkEndpointAccess.js.map +1 -0
- package/graphql/createExecutableSchema.d.ts +6 -0
- package/graphql/createExecutableSchema.js +29 -0
- package/graphql/createExecutableSchema.js.map +1 -0
- package/graphql/createRequestBody.d.ts +2 -0
- package/graphql/createRequestBody.js +14 -0
- package/graphql/createRequestBody.js.map +1 -0
- package/graphql/formatErrorPayload.d.ts +1 -0
- package/graphql/formatErrorPayload.js +25 -0
- package/graphql/formatErrorPayload.js.map +1 -0
- package/graphql/generateSchema.d.ts +8 -0
- package/graphql/generateSchema.js +31 -0
- package/graphql/generateSchema.js.map +1 -0
- package/graphql/getSchema.d.ts +17 -0
- package/graphql/getSchema.js +102 -0
- package/graphql/getSchema.js.map +1 -0
- package/graphql/graphQLHandlerFactory.d.ts +5 -0
- package/graphql/graphQLHandlerFactory.js +35 -0
- package/graphql/graphQLHandlerFactory.js.map +1 -0
- package/graphql/handleRequest.d.ts +11 -0
- package/graphql/handleRequest.js +81 -0
- package/graphql/handleRequest.js.map +1 -0
- package/graphql/index.d.ts +3 -0
- package/graphql/index.js +13 -0
- package/graphql/index.js.map +1 -0
- package/graphql/schema/baseContentSchema.d.ts +7 -0
- package/graphql/schema/baseContentSchema.js +66 -0
- package/graphql/schema/baseContentSchema.js.map +1 -0
- package/graphql/schema/baseSchema.d.ts +3 -0
- package/graphql/schema/baseSchema.js +84 -0
- package/graphql/schema/baseSchema.js.map +1 -0
- package/graphql/schema/contentEntries.d.ts +7 -0
- package/graphql/schema/contentEntries.js +367 -0
- package/graphql/schema/contentEntries.js.map +1 -0
- package/graphql/schema/contentModelGroups.d.ts +7 -0
- package/{content/plugins → graphql}/schema/contentModelGroups.js +39 -33
- package/graphql/schema/contentModelGroups.js.map +1 -0
- package/graphql/schema/contentModels.d.ts +7 -0
- package/{content/plugins → graphql}/schema/contentModels.js +121 -29
- package/graphql/schema/contentModels.js.map +1 -0
- package/graphql/schema/createFieldResolvers.d.ts +20 -0
- package/graphql/schema/createFieldResolvers.js +104 -0
- package/graphql/schema/createFieldResolvers.js.map +1 -0
- package/graphql/schema/createFieldTypePluginRecords.d.ts +3 -0
- package/graphql/schema/createFieldTypePluginRecords.js +13 -0
- package/graphql/schema/createFieldTypePluginRecords.js.map +1 -0
- package/graphql/schema/createManageResolvers.d.ts +12 -0
- package/graphql/schema/createManageResolvers.js +141 -0
- package/graphql/schema/createManageResolvers.js.map +1 -0
- package/graphql/schema/createManageSDL.d.ts +13 -0
- package/graphql/schema/createManageSDL.js +180 -0
- package/graphql/schema/createManageSDL.js.map +1 -0
- package/graphql/schema/createPreviewResolvers.d.ts +12 -0
- package/graphql/schema/createPreviewResolvers.js +44 -0
- package/graphql/schema/createPreviewResolvers.js.map +1 -0
- package/graphql/schema/createReadResolvers.d.ts +12 -0
- package/graphql/schema/createReadResolvers.js +49 -0
- package/graphql/schema/createReadResolvers.js.map +1 -0
- package/graphql/schema/createReadSDL.d.ts +13 -0
- package/graphql/schema/createReadSDL.js +104 -0
- package/graphql/schema/createReadSDL.js.map +1 -0
- package/graphql/schema/resolvers/commonFieldResolvers.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/commonFieldResolvers.js +2 -3
- 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 -7
- 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 -7
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +8 -0
- package/graphql/schema/resolvers/manage/resolveDelete.js +36 -0
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js +20 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGet.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveGet.js +63 -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 -7
- 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 -7
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +4 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js +18 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveList.d.ts +4 -0
- package/{content/plugins/schema/resolvers/preview → graphql/schema/resolvers/manage}/resolveList.js +2 -7
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveMove.d.ts +8 -0
- package/graphql/schema/resolvers/manage/resolveMove.js +30 -0
- package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolvePublish.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolvePublish.js +0 -3
- 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 -7
- 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 -3
- 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 -7
- 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 +26 -0
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/preview/resolveList.d.ts +4 -0
- package/{content/plugins/schema/resolvers/manage → graphql/schema/resolvers/preview}/resolveList.js +2 -7
- 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 +26 -0
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/read/resolveList.d.ts +4 -0
- package/{content/plugins → graphql}/schema/resolvers/read/resolveList.js +2 -7
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -0
- package/graphql/schema/schemaPlugins.d.ts +8 -0
- package/graphql/schema/schemaPlugins.js +100 -0
- package/graphql/schema/schemaPlugins.js.map +1 -0
- package/graphql/system.d.ts +3 -0
- package/{plugins/graphql → graphql}/system.js +29 -24
- package/graphql/system.js.map +1 -0
- package/graphqlFields/boolean.d.ts +2 -0
- package/graphqlFields/boolean.js +57 -0
- package/graphqlFields/boolean.js.map +1 -0
- package/graphqlFields/datetime.d.ts +2 -0
- package/graphqlFields/datetime.js +78 -0
- package/graphqlFields/datetime.js.map +1 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +2 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js +243 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +3 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +63 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -0
- package/graphqlFields/dynamicZone/index.d.ts +2 -0
- package/graphqlFields/dynamicZone/index.js +19 -0
- package/graphqlFields/dynamicZone/index.js.map +1 -0
- package/graphqlFields/file.d.ts +2 -0
- package/graphqlFields/file.js +42 -0
- package/graphqlFields/file.js.map +1 -0
- package/graphqlFields/helpers.d.ts +6 -0
- package/graphqlFields/helpers.js +39 -0
- package/graphqlFields/helpers.js.map +1 -0
- package/graphqlFields/index.d.ts +2 -0
- package/graphqlFields/index.js +18 -0
- package/graphqlFields/index.js.map +1 -0
- package/graphqlFields/longText.d.ts +2 -0
- package/graphqlFields/longText.js +53 -0
- package/graphqlFields/longText.js.map +1 -0
- package/graphqlFields/number.d.ts +2 -0
- package/graphqlFields/number.js +68 -0
- package/graphqlFields/number.js.map +1 -0
- package/graphqlFields/object.d.ts +2 -0
- package/graphqlFields/object.js +258 -0
- package/graphqlFields/object.js.map +1 -0
- package/graphqlFields/ref.d.ts +2 -0
- package/graphqlFields/ref.js +255 -0
- package/graphqlFields/ref.js.map +1 -0
- package/graphqlFields/richText.d.ts +2 -0
- package/graphqlFields/richText.js +47 -0
- package/graphqlFields/richText.js.map +1 -0
- package/graphqlFields/text.d.ts +2 -0
- package/graphqlFields/text.js +64 -0
- package/graphqlFields/text.js.map +1 -0
- package/index.d.ts +12 -12
- package/index.js +98 -55
- package/index.js.map +1 -0
- package/modelManager/DefaultCmsModelManager.d.ts +14 -0
- package/{content/plugins/modelManager → modelManager}/DefaultCmsModelManager.js +10 -24
- package/modelManager/DefaultCmsModelManager.js.map +1 -0
- package/modelManager/index.d.ts +2 -0
- package/{content/plugins/modelManager → modelManager}/index.js +3 -7
- package/modelManager/index.js.map +1 -0
- package/package.json +39 -44
- package/parameters/context.d.ts +2 -0
- package/parameters/context.js +18 -0
- package/parameters/context.js.map +1 -0
- package/parameters/header.d.ts +2 -0
- package/parameters/header.js +44 -0
- package/parameters/header.js.map +1 -0
- package/parameters/index.d.ts +4 -0
- package/parameters/index.js +49 -0
- package/parameters/index.js.map +1 -0
- package/parameters/manual.d.ts +6 -0
- package/parameters/manual.js +37 -0
- package/parameters/manual.js.map +1 -0
- package/parameters/path.d.ts +2 -0
- package/parameters/path.js +40 -0
- package/parameters/path.js.map +1 -0
- package/plugins/CmsGraphQLSchemaPlugin.d.ts +5 -0
- package/plugins/CmsGraphQLSchemaPlugin.js +12 -0
- package/plugins/CmsGraphQLSchemaPlugin.js.map +1 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +20 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.js +28 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -0
- package/plugins/CmsGroupPlugin.d.ts +13 -0
- package/{content/plugins → plugins}/CmsGroupPlugin.js +7 -9
- package/plugins/CmsGroupPlugin.js.map +1 -0
- package/plugins/CmsModelFieldConverterPlugin.d.ts +14 -0
- package/plugins/CmsModelFieldConverterPlugin.js +12 -0
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -0
- package/plugins/CmsModelPlugin.d.ts +63 -0
- package/plugins/CmsModelPlugin.js +184 -0
- package/plugins/CmsModelPlugin.js.map +1 -0
- package/plugins/CmsParametersPlugin.d.ts +20 -0
- package/plugins/CmsParametersPlugin.js +21 -0
- package/plugins/CmsParametersPlugin.js.map +1 -0
- package/plugins/StorageOperationsCmsModelPlugin.d.ts +23 -0
- package/plugins/StorageOperationsCmsModelPlugin.js +42 -0
- package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -0
- package/plugins/StorageTransformPlugin.d.ts +31 -0
- package/{content/plugins/storage → plugins}/StorageTransformPlugin.js +2 -10
- package/plugins/StorageTransformPlugin.js.map +1 -0
- package/plugins/index.d.ts +8 -0
- package/plugins/index.js +93 -0
- package/plugins/index.js.map +1 -0
- package/storage/default.d.ts +2 -0
- package/storage/default.js +24 -0
- package/storage/default.js.map +1 -0
- package/storage/object.d.ts +2 -0
- package/storage/object.js +108 -0
- package/storage/object.js.map +1 -0
- package/types.d.ts +1010 -382
- package/types.js +116 -62
- package/types.js.map +1 -0
- package/utils/converters/Converter.d.ts +27 -0
- package/utils/converters/Converter.js +58 -0
- package/utils/converters/Converter.js.map +1 -0
- package/utils/converters/ConverterCollection.d.ts +31 -0
- package/utils/converters/ConverterCollection.js +119 -0
- package/utils/converters/ConverterCollection.js.map +1 -0
- package/utils/converters/valueKeyStorageConverter.d.ts +14 -0
- package/utils/converters/valueKeyStorageConverter.js +128 -0
- package/utils/converters/valueKeyStorageConverter.js.map +1 -0
- package/utils/createTypeFromFields.d.ts +16 -0
- package/utils/createTypeFromFields.js +66 -0
- package/utils/createTypeFromFields.js.map +1 -0
- package/utils/createTypeName.d.ts +1 -0
- package/utils/createTypeName.js +13 -0
- package/utils/createTypeName.js.map +1 -0
- package/{content/plugins/utils → utils}/entryStorage.d.ts +3 -3
- package/{content/plugins/utils → utils}/entryStorage.js +26 -47
- package/utils/entryStorage.js.map +1 -0
- package/utils/filterAsync.d.ts +1 -0
- package/utils/filterAsync.js +18 -0
- package/utils/filterAsync.js.map +1 -0
- package/utils/getBaseFieldType.d.ts +2 -0
- package/utils/getBaseFieldType.js +10 -0
- package/utils/getBaseFieldType.js.map +1 -0
- package/utils/getEntryDescription.d.ts +2 -0
- package/utils/getEntryDescription.js +17 -0
- package/utils/getEntryDescription.js.map +1 -0
- package/utils/getEntryImage.d.ts +2 -0
- package/utils/getEntryImage.js +17 -0
- package/utils/getEntryImage.js.map +1 -0
- package/utils/getEntryTitle.d.ts +2 -0
- package/{content/plugins/utils → utils}/getEntryTitle.js +7 -15
- package/utils/getEntryTitle.js.map +1 -0
- package/utils/getSchemaFromFieldPlugins.d.ts +9 -0
- package/utils/getSchemaFromFieldPlugins.js +39 -0
- package/utils/getSchemaFromFieldPlugins.js.map +1 -0
- package/utils/incrementEntryIdVersion.d.ts +5 -0
- package/utils/incrementEntryIdVersion.js +29 -0
- package/utils/incrementEntryIdVersion.js.map +1 -0
- package/utils/permissions/EntriesPermissions.d.ts +4 -0
- package/utils/permissions/EntriesPermissions.js +9 -0
- package/utils/permissions/EntriesPermissions.js.map +1 -0
- package/utils/permissions/ModelGroupsPermissions.d.ts +11 -0
- package/utils/permissions/ModelGroupsPermissions.js +48 -0
- package/utils/permissions/ModelGroupsPermissions.js.map +1 -0
- package/utils/permissions/ModelsPermissions.d.ts +20 -0
- package/utils/permissions/ModelsPermissions.js +91 -0
- package/utils/permissions/ModelsPermissions.js.map +1 -0
- package/utils/permissions/SettingsPermissions.d.ts +4 -0
- package/utils/permissions/SettingsPermissions.js +9 -0
- package/utils/permissions/SettingsPermissions.js.map +1 -0
- package/utils/renderFields.d.ts +17 -0
- package/{content/plugins/utils → utils}/renderFields.js +16 -13
- package/utils/renderFields.js.map +1 -0
- package/utils/renderGetFilterFields.d.ts +10 -0
- package/{content/plugins/utils → utils}/renderGetFilterFields.js +16 -22
- package/utils/renderGetFilterFields.js.map +1 -0
- package/utils/renderInputFields.d.ts +16 -0
- package/{content/plugins/utils → utils}/renderInputFields.js +20 -15
- package/utils/renderInputFields.js.map +1 -0
- package/utils/renderListFilterFields.d.ts +13 -0
- package/utils/renderListFilterFields.js +48 -0
- package/utils/renderListFilterFields.js.map +1 -0
- package/utils/renderSortEnum.d.ts +13 -0
- package/utils/renderSortEnum.js +46 -0
- package/utils/renderSortEnum.js.map +1 -0
- package/utils/toSlug.d.ts +1 -0
- package/utils/toSlug.js +16 -0
- package/utils/toSlug.js.map +1 -0
- package/validators/dateGte.d.ts +2 -0
- package/{content/plugins/validators → validators}/dateGte.js +4 -11
- package/validators/dateGte.js.map +1 -0
- package/validators/dateLte.d.ts +2 -0
- package/{content/plugins/validators → validators}/dateLte.js +4 -11
- package/validators/dateLte.js.map +1 -0
- package/validators/dynamicZone.d.ts +2 -0
- package/validators/dynamicZone.js +20 -0
- package/validators/dynamicZone.js.map +1 -0
- package/validators/gte.d.ts +2 -0
- package/validators/gte.js +28 -0
- package/validators/gte.js.map +1 -0
- package/validators/in.d.ts +2 -0
- package/validators/in.js +28 -0
- package/validators/in.js.map +1 -0
- package/validators/index.d.ts +1 -0
- package/validators/index.js +22 -0
- package/validators/index.js.map +1 -0
- package/validators/lte.d.ts +2 -0
- package/validators/lte.js +28 -0
- package/validators/lte.js.map +1 -0
- package/validators/maxLength.d.ts +2 -0
- package/validators/maxLength.js +28 -0
- package/validators/maxLength.js.map +1 -0
- package/validators/minLength.d.ts +2 -0
- package/validators/minLength.js +28 -0
- package/validators/minLength.js.map +1 -0
- package/validators/pattern.d.ts +2 -0
- package/validators/pattern.js +41 -0
- package/validators/pattern.js.map +1 -0
- package/validators/patternPlugins/email.d.ts +2 -0
- package/validators/patternPlugins/email.js +18 -0
- package/validators/patternPlugins/email.js.map +1 -0
- package/validators/patternPlugins/index.d.ts +2 -0
- package/validators/patternPlugins/index.js +16 -0
- package/validators/patternPlugins/index.js.map +1 -0
- package/validators/patternPlugins/lowerCase.d.ts +2 -0
- package/validators/patternPlugins/lowerCase.js +18 -0
- package/validators/patternPlugins/lowerCase.js.map +1 -0
- package/validators/patternPlugins/lowerCaseSpace.d.ts +2 -0
- package/validators/patternPlugins/lowerCaseSpace.js +18 -0
- package/validators/patternPlugins/lowerCaseSpace.js.map +1 -0
- package/validators/patternPlugins/upperCase.d.ts +2 -0
- package/validators/patternPlugins/upperCase.js +18 -0
- package/validators/patternPlugins/upperCase.js.map +1 -0
- package/validators/patternPlugins/upperCaseSpace.d.ts +2 -0
- package/validators/patternPlugins/upperCaseSpace.js +18 -0
- package/validators/patternPlugins/upperCaseSpace.js.map +1 -0
- package/validators/patternPlugins/url.d.ts +2 -0
- package/validators/patternPlugins/url.js +18 -0
- package/validators/patternPlugins/url.js.map +1 -0
- package/validators/required.d.ts +2 -0
- package/validators/required.js +22 -0
- package/validators/required.js.map +1 -0
- package/validators/timeGte.d.ts +2 -0
- package/{content/plugins/validators → validators}/timeGte.js +5 -11
- package/validators/timeGte.js.map +1 -0
- package/validators/timeLte.d.ts +2 -0
- package/{content/plugins/validators → validators}/timeLte.js +5 -11
- package/validators/timeLte.js.map +1 -0
- package/validators/unique.d.ts +6 -0
- package/validators/unique.js +56 -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.d.ts +0 -17
- 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/beforeCreate.js +0 -146
- 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/createFieldModels.js +0 -22
- package/content/plugins/crud/contentModel/idValidation.d.ts +0 -2
- package/content/plugins/crud/contentModel/idValidation.js +0 -22
- package/content/plugins/crud/contentModel/models.d.ts +0 -3
- package/content/plugins/crud/contentModel/models.js +0 -141
- 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/createManageResolvers.js +0 -135
- package/content/plugins/schema/createManageSDL.d.ts +0 -9
- package/content/plugins/schema/createManageSDL.js +0 -153
- 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/createReadSDL.js +0 -96
- 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/resolveDelete.js +0 -30
- 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/createTypeName.d.ts +0 -3
- package/content/plugins/utils/createTypeName.js +0 -28
- 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/pluralizedTypeName.js +0 -26
- package/content/plugins/utils/renderFields.d.ts +0 -16
- package/content/plugins/utils/renderGetFilterFields.d.ts +0 -9
- package/content/plugins/utils/renderInputFields.d.ts +0 -14
- package/content/plugins/utils/renderListFilterFields.d.ts +0 -10
- package/content/plugins/utils/renderListFilterFields.js +0 -39
- 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.d.ts +0 -10
- package/plugins/crud/settings.crud.js +0 -93
- package/plugins/crud/system.crud.d.ts +0 -10
- 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 @@
|
|
|
1
|
+
{"version":3,"names":["ModelsPermissions","AppPermissions","constructor","params","modelGroupsPermissions","canAccessModel","model","locale","hasFullAccess","modelsPermissions","canReadGroups","ensure","rwd","throw","canReadModels","modelGroupsPermissionsList","getPermissions","modelsPermissionsList","i","length","modelGroupPermission","groups","j","modelPermission","models","Array","isArray","includes","group","id","modelId","ensureCanAccessModel","NotAuthorizedError","data","reason"],"sources":["ModelsPermissions.ts"],"sourcesContent":["import { AppPermissions, AppPermissionsParams, NotAuthorizedError } from \"@webiny/api-security\";\nimport { CmsGroupPermission, CmsModel, CmsModelPermission } from \"~/types\";\nimport { ModelGroupsPermissions } from \"~/utils/permissions/ModelGroupsPermissions\";\n\nexport interface ModelsPermissionsParams extends AppPermissionsParams<CmsGroupPermission> {\n modelGroupsPermissions: ModelGroupsPermissions;\n}\n\nexport interface CanAccessModelParams {\n model: CmsModel;\n locale: string;\n}\n\nexport interface EnsureModelAccessParams {\n model: CmsModel;\n locale: string;\n}\n\nexport class ModelsPermissions extends AppPermissions<CmsModelPermission> {\n private modelGroupsPermissions: ModelGroupsPermissions;\n\n constructor(params: ModelsPermissionsParams) {\n super(params);\n this.modelGroupsPermissions = params.modelGroupsPermissions;\n }\n\n async canAccessModel({ model, locale }: CanAccessModelParams) {\n if (await this.hasFullAccess()) {\n return true;\n }\n\n const modelGroupsPermissions = this.modelGroupsPermissions;\n\n // eslint-disable-next-line\n const modelsPermissions = this;\n\n const canReadGroups = await modelGroupsPermissions.ensure({ rwd: \"r\" }, { throw: false });\n if (!canReadGroups) {\n return false;\n }\n\n const canReadModels = await modelsPermissions.ensure({ rwd: \"r\" }, { throw: false });\n if (!canReadModels) {\n return false;\n }\n\n const modelGroupsPermissionsList = await modelGroupsPermissions.getPermissions();\n const modelsPermissionsList = await this.getPermissions();\n\n for (let i = 0; i < modelGroupsPermissionsList.length; i++) {\n const modelGroupPermission = modelGroupsPermissionsList[i];\n\n const { groups } = modelGroupPermission;\n\n for (let j = 0; j < modelsPermissionsList.length; j++) {\n const modelPermission = modelsPermissionsList[j];\n\n const { models } = modelPermission;\n // when no models or groups defined on permission\n // it means user has access to everything\n if (!models && !groups) {\n return true;\n }\n\n // Does the model belong to a group for which user has permission?\n if (groups) {\n if (\n Array.isArray(groups[locale]) === false ||\n groups[locale].includes(model.group.id) === false\n ) {\n continue;\n }\n }\n\n // Does the user have access to the specific model?\n if (models) {\n if (\n Array.isArray(models[locale]) === false ||\n models[locale].includes(model.modelId) === false\n ) {\n continue;\n }\n }\n\n return true;\n }\n }\n\n return false;\n }\n\n async ensureCanAccessModel(params: EnsureModelAccessParams) {\n const canAccessModel = await this.canAccessModel(params);\n if (canAccessModel) {\n return;\n }\n\n throw new NotAuthorizedError({\n data: {\n reason: `Not allowed to access model \"${params.model.modelId}\".`\n }\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAkBO,MAAMA,iBAAiB,SAASC,2BAAc,CAAqB;EAGtEC,WAAW,CAACC,MAA+B,EAAE;IACzC,KAAK,CAACA,MAAM,CAAC;IAAC;IACd,IAAI,CAACC,sBAAsB,GAAGD,MAAM,CAACC,sBAAsB;EAC/D;EAEA,MAAMC,cAAc,CAAC;IAAEC,KAAK;IAAEC;EAA6B,CAAC,EAAE;IAC1D,IAAI,MAAM,IAAI,CAACC,aAAa,EAAE,EAAE;MAC5B,OAAO,IAAI;IACf;IAEA,MAAMJ,sBAAsB,GAAG,IAAI,CAACA,sBAAsB;;IAE1D;IACA,MAAMK,iBAAiB,GAAG,IAAI;IAE9B,MAAMC,aAAa,GAAG,MAAMN,sBAAsB,CAACO,MAAM,CAAC;MAAEC,GAAG,EAAE;IAAI,CAAC,EAAE;MAAEC,KAAK,EAAE;IAAM,CAAC,CAAC;IACzF,IAAI,CAACH,aAAa,EAAE;MAChB,OAAO,KAAK;IAChB;IAEA,MAAMI,aAAa,GAAG,MAAML,iBAAiB,CAACE,MAAM,CAAC;MAAEC,GAAG,EAAE;IAAI,CAAC,EAAE;MAAEC,KAAK,EAAE;IAAM,CAAC,CAAC;IACpF,IAAI,CAACC,aAAa,EAAE;MAChB,OAAO,KAAK;IAChB;IAEA,MAAMC,0BAA0B,GAAG,MAAMX,sBAAsB,CAACY,cAAc,EAAE;IAChF,MAAMC,qBAAqB,GAAG,MAAM,IAAI,CAACD,cAAc,EAAE;IAEzD,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,0BAA0B,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;MACxD,MAAME,oBAAoB,GAAGL,0BAA0B,CAACG,CAAC,CAAC;MAE1D,MAAM;QAAEG;MAAO,CAAC,GAAGD,oBAAoB;MAEvC,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,qBAAqB,CAACE,MAAM,EAAEG,CAAC,EAAE,EAAE;QACnD,MAAMC,eAAe,GAAGN,qBAAqB,CAACK,CAAC,CAAC;QAEhD,MAAM;UAAEE;QAAO,CAAC,GAAGD,eAAe;QAClC;QACA;QACA,IAAI,CAACC,MAAM,IAAI,CAACH,MAAM,EAAE;UACpB,OAAO,IAAI;QACf;;QAEA;QACA,IAAIA,MAAM,EAAE;UACR,IACII,KAAK,CAACC,OAAO,CAACL,MAAM,CAACd,MAAM,CAAC,CAAC,KAAK,KAAK,IACvCc,MAAM,CAACd,MAAM,CAAC,CAACoB,QAAQ,CAACrB,KAAK,CAACsB,KAAK,CAACC,EAAE,CAAC,KAAK,KAAK,EACnD;YACE;UACJ;QACJ;;QAEA;QACA,IAAIL,MAAM,EAAE;UACR,IACIC,KAAK,CAACC,OAAO,CAACF,MAAM,CAACjB,MAAM,CAAC,CAAC,KAAK,KAAK,IACvCiB,MAAM,CAACjB,MAAM,CAAC,CAACoB,QAAQ,CAACrB,KAAK,CAACwB,OAAO,CAAC,KAAK,KAAK,EAClD;YACE;UACJ;QACJ;QAEA,OAAO,IAAI;MACf;IACJ;IAEA,OAAO,KAAK;EAChB;EAEA,MAAMC,oBAAoB,CAAC5B,MAA+B,EAAE;IACxD,MAAME,cAAc,GAAG,MAAM,IAAI,CAACA,cAAc,CAACF,MAAM,CAAC;IACxD,IAAIE,cAAc,EAAE;MAChB;IACJ;IAEA,MAAM,IAAI2B,+BAAkB,CAAC;MACzBC,IAAI,EAAE;QACFC,MAAM,EAAG,gCAA+B/B,MAAM,CAACG,KAAK,CAACwB,OAAQ;MACjE;IACJ,CAAC,CAAC;EACN;AACJ;AAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SettingsPermissions = void 0;
|
|
7
|
+
var _apiSecurity = require("@webiny/api-security");
|
|
8
|
+
class SettingsPermissions extends _apiSecurity.AppPermissions {}
|
|
9
|
+
exports.SettingsPermissions = SettingsPermissions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SettingsPermissions","AppPermissions"],"sources":["SettingsPermissions.ts"],"sourcesContent":["import { CmsSettingsPermission } from \"~/types\";\nimport { AppPermissions } from \"@webiny/api-security\";\n\nexport class SettingsPermissions extends AppPermissions<CmsSettingsPermission> {}\n"],"mappings":";;;;;;AACA;AAEO,MAAMA,mBAAmB,SAASC,2BAAc,CAAwB;AAAE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
|
|
2
|
+
interface RenderFieldsParams {
|
|
3
|
+
models: CmsModel[];
|
|
4
|
+
model: CmsModel;
|
|
5
|
+
fields: CmsModelField[];
|
|
6
|
+
type: ApiEndpoint;
|
|
7
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
8
|
+
}
|
|
9
|
+
interface RenderFields {
|
|
10
|
+
(params: RenderFieldsParams): CmsModelFieldDefinition[];
|
|
11
|
+
}
|
|
12
|
+
export declare const renderFields: RenderFields;
|
|
13
|
+
interface RenderFieldParams extends Omit<RenderFieldsParams, "fields"> {
|
|
14
|
+
field: CmsModelField;
|
|
15
|
+
}
|
|
16
|
+
export declare const renderField: ({ models, model, type, field, fieldTypePlugins }: RenderFieldParams) => CmsModelFieldDefinition | null;
|
|
17
|
+
export {};
|
|
@@ -4,48 +4,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.renderFields = exports.renderField = void 0;
|
|
7
|
-
|
|
7
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
8
8
|
const renderFields = ({
|
|
9
|
+
models,
|
|
9
10
|
model,
|
|
11
|
+
fields,
|
|
10
12
|
type,
|
|
11
13
|
fieldTypePlugins
|
|
12
14
|
}) => {
|
|
13
|
-
return
|
|
15
|
+
return fields.map(field => renderField({
|
|
16
|
+
models,
|
|
14
17
|
model,
|
|
15
18
|
type,
|
|
16
19
|
field,
|
|
17
20
|
fieldTypePlugins
|
|
18
21
|
})).filter(Boolean);
|
|
19
22
|
};
|
|
20
|
-
|
|
21
23
|
exports.renderFields = renderFields;
|
|
22
|
-
|
|
23
24
|
const renderField = ({
|
|
25
|
+
models,
|
|
24
26
|
model,
|
|
25
27
|
type,
|
|
26
28
|
field,
|
|
27
29
|
fieldTypePlugins
|
|
28
30
|
}) => {
|
|
29
|
-
const plugin = fieldTypePlugins[field
|
|
30
|
-
|
|
31
|
+
const plugin = fieldTypePlugins[(0, _getBaseFieldType.getBaseFieldType)(field)];
|
|
31
32
|
if (!plugin) {
|
|
32
33
|
// Let's not render the field if it does not exist in the field plugins.
|
|
33
|
-
return;
|
|
34
|
+
return null;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const {
|
|
37
|
+
createTypeField
|
|
38
|
+
} = plugin[type];
|
|
39
|
+
const defs = createTypeField({
|
|
40
|
+
models,
|
|
37
41
|
model,
|
|
38
42
|
field,
|
|
39
43
|
fieldTypePlugins
|
|
40
44
|
});
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
if (!defs) {
|
|
46
|
+
return null;
|
|
47
|
+
} else if (typeof defs === "string") {
|
|
43
48
|
return {
|
|
44
49
|
fields: defs
|
|
45
50
|
};
|
|
46
51
|
}
|
|
47
|
-
|
|
48
52
|
return defs;
|
|
49
53
|
};
|
|
50
|
-
|
|
51
54
|
exports.renderField = renderField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderFields","models","model","fields","type","fieldTypePlugins","map","field","renderField","filter","Boolean","plugin","getBaseFieldType","createTypeField","defs"],"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 models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderFields {\n (params: RenderFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderFields: RenderFields = ({\n models,\n model,\n fields,\n type,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields\n .map(field => renderField({ models, model, type, field, fieldTypePlugins }))\n .filter(Boolean) as CmsModelFieldDefinition[];\n};\n\ninterface RenderFieldParams extends Omit<RenderFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\nexport const renderField = ({\n models,\n model,\n type,\n field,\n fieldTypePlugins\n}: RenderFieldParams): CmsModelFieldDefinition | null => {\n const plugin = 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 { createTypeField } = plugin[type] as CmsModelFieldToGraphQLPlugin[\"manage\"];\n const defs = createTypeField({\n models,\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;AAcO,MAAMA,YAA0B,GAAG,CAAC;EACvCC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC,IAAI;EACJC;AACJ,CAAC,KAAgC;EAC7B,OAAOF,MAAM,CACRG,GAAG,CAACC,KAAK,IAAIC,WAAW,CAAC;IAAEP,MAAM;IAAEC,KAAK;IAAEE,IAAI;IAAEG,KAAK;IAAEF;EAAiB,CAAC,CAAC,CAAC,CAC3EI,MAAM,CAACC,OAAO,CAAC;AACxB,CAAC;AAAC;AAMK,MAAMF,WAAW,GAAG,CAAC;EACxBP,MAAM;EACNC,KAAK;EACLE,IAAI;EACJG,KAAK;EACLF;AACe,CAAC,KAAqC;EACrD,MAAMM,MAAM,GAAGN,gBAAgB,CAAC,IAAAO,kCAAgB,EAACL,KAAK,CAAC,CAAC;EACxD,IAAI,CAACI,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EACA,MAAM;IAAEE;EAAgB,CAAC,GAAGF,MAAM,CAACP,IAAI,CAA2C;EAClF,MAAMU,IAAI,GAAGD,eAAe,CAAC;IACzBZ,MAAM;IACNC,KAAK;IACLK,KAAK;IACLF;EACJ,CAAC,CAAC;EAEF,IAAI,CAACS,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACjC,OAAO;MACHX,MAAM,EAAEW;IACZ,CAAC;EACL;EAEA,OAAOA,IAAI;AACf,CAAC;AAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CmsFieldTypePlugins, CmsModelField } from "../types";
|
|
2
|
+
interface RenderGetFilterFieldsParams {
|
|
3
|
+
fields: CmsModelField[];
|
|
4
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
5
|
+
}
|
|
6
|
+
interface RenderGetFilterFields {
|
|
7
|
+
(params: RenderGetFilterFieldsParams): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const renderGetFilterFields: RenderGetFilterFields;
|
|
10
|
+
export {};
|
|
@@ -1,41 +1,35 @@
|
|
|
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.renderGetFilterFields = void 0;
|
|
9
|
-
|
|
10
|
-
var _get = _interopRequireDefault(require("lodash/get"));
|
|
11
|
-
|
|
7
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
12
8
|
const renderGetFilterFields = ({
|
|
13
|
-
|
|
9
|
+
fields,
|
|
14
10
|
fieldTypePlugins
|
|
15
11
|
}) => {
|
|
16
|
-
const
|
|
12
|
+
const filters = ["id: ID", "entryId: String"];
|
|
13
|
+
for (const field of fields) {
|
|
14
|
+
var _plugin$read;
|
|
17
15
|
// Every time a client updates content model's fields, we check the type of each field. If a field plugin
|
|
18
16
|
// for a particular "field.type" doesn't exist on the backend yet, we throw an error. But still, we also
|
|
19
17
|
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
20
18
|
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
21
19
|
// could've just removed the plugin from the backend.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (typeof createGetFilters === "function") {
|
|
31
|
-
filters.push(createGetFilters({
|
|
32
|
-
model,
|
|
33
|
-
field
|
|
34
|
-
}));
|
|
20
|
+
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
21
|
+
const plugin = fieldTypePlugins[baseType];
|
|
22
|
+
if (!(plugin !== null && plugin !== void 0 && plugin.isSearchable)) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const createGetFilters = (_plugin$read = plugin.read) === null || _plugin$read === void 0 ? void 0 : _plugin$read.createGetFilters;
|
|
26
|
+
if (typeof createGetFilters !== "function") {
|
|
27
|
+
continue;
|
|
35
28
|
}
|
|
29
|
+
filters.push(createGetFilters({
|
|
30
|
+
field
|
|
31
|
+
}));
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
return filters.filter(Boolean).join("\n");
|
|
39
34
|
};
|
|
40
|
-
|
|
41
35
|
exports.renderGetFilterFields = renderGetFilterFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderGetFilterFields","fields","fieldTypePlugins","filters","field","baseType","getBaseFieldType","plugin","isSearchable","createGetFilters","read","push","filter","Boolean","join"],"sources":["renderGetFilterFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderGetFilterFieldsParams {\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderGetFilterFields {\n (params: RenderGetFilterFieldsParams): string;\n}\n\nexport const renderGetFilterFields: RenderGetFilterFields = ({ fields, fieldTypePlugins }) => {\n const filters: string[] = [\"id: ID\", \"entryId: String\"];\n\n for (const field of 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 const baseType = getBaseFieldType(field);\n const plugin = fieldTypePlugins[baseType];\n if (!plugin?.isSearchable) {\n continue;\n }\n const createGetFilters = plugin.read?.createGetFilters;\n if (typeof createGetFilters !== \"function\") {\n continue;\n }\n filters.push(createGetFilters({ field }));\n }\n\n return filters.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA;AAUO,MAAMA,qBAA4C,GAAG,CAAC;EAAEC,MAAM;EAAEC;AAAiB,CAAC,KAAK;EAC1F,MAAMC,OAAiB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC;EAEvD,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;IAAA;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMI,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACxC,MAAMG,MAAM,GAAGL,gBAAgB,CAACG,QAAQ,CAAC;IACzC,IAAI,EAACE,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEC,YAAY,GAAE;MACvB;IACJ;IACA,MAAMC,gBAAgB,mBAAGF,MAAM,CAACG,IAAI,iDAAX,aAAaD,gBAAgB;IACtD,IAAI,OAAOA,gBAAgB,KAAK,UAAU,EAAE;MACxC;IACJ;IACAN,OAAO,CAACQ,IAAI,CAACF,gBAAgB,CAAC;MAAEL;IAAM,CAAC,CAAC,CAAC;EAC7C;EAEA,OAAOD,OAAO,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC7C,CAAC;AAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
|
|
2
|
+
interface RenderInputFieldsParams {
|
|
3
|
+
models: CmsModel[];
|
|
4
|
+
model: CmsModel;
|
|
5
|
+
fields: CmsModelField[];
|
|
6
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
7
|
+
}
|
|
8
|
+
interface RenderInputFieldParams extends Omit<RenderInputFieldsParams, "fields"> {
|
|
9
|
+
field: CmsModelField;
|
|
10
|
+
}
|
|
11
|
+
interface RenderInputFields {
|
|
12
|
+
(params: RenderInputFieldsParams): CmsModelFieldDefinition[];
|
|
13
|
+
}
|
|
14
|
+
export declare const renderInputFields: RenderInputFields;
|
|
15
|
+
export declare const renderInputField: ({ models, model, field, fieldTypePlugins }: RenderInputFieldParams) => CmsModelFieldDefinition | null;
|
|
16
|
+
export {};
|
|
@@ -4,21 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.renderInputFields = exports.renderInputField = void 0;
|
|
7
|
-
|
|
7
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
8
8
|
const renderInputFields = ({
|
|
9
|
+
models,
|
|
9
10
|
model,
|
|
11
|
+
fields,
|
|
10
12
|
fieldTypePlugins
|
|
11
13
|
}) => {
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return fields.reduce((result, field) => {
|
|
15
|
+
const input = renderInputField({
|
|
16
|
+
models,
|
|
17
|
+
model,
|
|
18
|
+
field,
|
|
19
|
+
fieldTypePlugins
|
|
20
|
+
});
|
|
21
|
+
if (!input) {
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
result.push(input);
|
|
25
|
+
return result;
|
|
26
|
+
}, []);
|
|
17
27
|
};
|
|
18
|
-
|
|
19
28
|
exports.renderInputFields = renderInputFields;
|
|
20
|
-
|
|
21
29
|
const renderInputField = ({
|
|
30
|
+
models,
|
|
22
31
|
model,
|
|
23
32
|
field,
|
|
24
33
|
fieldTypePlugins
|
|
@@ -28,26 +37,22 @@ const renderInputField = ({
|
|
|
28
37
|
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
29
38
|
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
30
39
|
// could've just removed the plugin from the backend.
|
|
31
|
-
const plugin = fieldTypePlugins[field
|
|
32
|
-
|
|
40
|
+
const plugin = fieldTypePlugins[(0, _getBaseFieldType.getBaseFieldType)(field)];
|
|
33
41
|
if (!plugin) {
|
|
34
42
|
// Let's not render the field if it does not exist in the field plugins.
|
|
35
|
-
return;
|
|
43
|
+
return null;
|
|
36
44
|
}
|
|
37
|
-
|
|
38
45
|
const def = plugin.manage.createInputField({
|
|
46
|
+
models,
|
|
39
47
|
model,
|
|
40
48
|
field,
|
|
41
49
|
fieldTypePlugins
|
|
42
50
|
});
|
|
43
|
-
|
|
44
51
|
if (typeof def === "string") {
|
|
45
52
|
return {
|
|
46
53
|
fields: def
|
|
47
54
|
};
|
|
48
55
|
}
|
|
49
|
-
|
|
50
56
|
return def;
|
|
51
57
|
};
|
|
52
|
-
|
|
53
58
|
exports.renderInputField = renderInputField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderInputFields","models","model","fields","fieldTypePlugins","reduce","result","field","input","renderInputField","push","plugin","getBaseFieldType","def","manage","createInputField"],"sources":["renderInputFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderInputFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderInputFieldParams extends Omit<RenderInputFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\ninterface RenderInputFields {\n (params: RenderInputFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderInputFields: RenderInputFields = ({\n models,\n model,\n fields,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields.reduce<CmsModelFieldDefinition[]>((result, field) => {\n const input = renderInputField({ models, model, field, fieldTypePlugins });\n if (!input) {\n return result;\n }\n result.push(input);\n return result;\n }, []);\n};\n\nexport const renderInputField = ({\n models,\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 = 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 models,\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":";;;;;;AACA;AAiBO,MAAMA,iBAAoC,GAAG,CAAC;EACjDC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC;AACJ,CAAC,KAAgC;EAC7B,OAAOD,MAAM,CAACE,MAAM,CAA4B,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC/D,MAAMC,KAAK,GAAGC,gBAAgB,CAAC;MAAER,MAAM;MAAEC,KAAK;MAAEK,KAAK;MAAEH;IAAiB,CAAC,CAAC;IAC1E,IAAI,CAACI,KAAK,EAAE;MACR,OAAOF,MAAM;IACjB;IACAA,MAAM,CAACI,IAAI,CAACF,KAAK,CAAC;IAClB,OAAOF,MAAM;EACjB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAAC;AAEK,MAAMG,gBAAgB,GAAG,CAAC;EAC7BR,MAAM;EACNC,KAAK;EACLK,KAAK;EACLH;AACoB,CAAC,KAAqC;EAC1D;EACA;EACA;EACA;EACA;EACA,MAAMO,MAAM,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAgB,EAACL,KAAK,CAAC,CAAC;EAExD,IAAI,CAACI,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EAEA,MAAME,GAAG,GAAGF,MAAM,CAACG,MAAM,CAACC,gBAAgB,CAAC;IACvCd,MAAM;IACNC,KAAK;IACLK,KAAK;IACLH;EACJ,CAAC,CAAC;EACF,IAAI,OAAOS,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO;MACHV,MAAM,EAAEU;IACZ,CAAC;EACL;EAEA,OAAOA,GAAG;AACd,CAAC;AAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
|
|
2
|
+
interface RenderListFilterFieldsParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
fields: CmsModelField[];
|
|
5
|
+
type: ApiEndpoint;
|
|
6
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
7
|
+
excludeFields?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface RenderListFilterFields {
|
|
10
|
+
(params: RenderListFilterFieldsParams): string;
|
|
11
|
+
}
|
|
12
|
+
export declare const renderListFilterFields: RenderListFilterFields;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderListFilterFields = void 0;
|
|
7
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
8
|
+
const renderListFilterFields = params => {
|
|
9
|
+
const {
|
|
10
|
+
model,
|
|
11
|
+
fields,
|
|
12
|
+
type,
|
|
13
|
+
fieldTypePlugins,
|
|
14
|
+
excludeFields = []
|
|
15
|
+
} = params;
|
|
16
|
+
const result = ["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!]"];
|
|
17
|
+
/**
|
|
18
|
+
* We can find different statuses only in the manage API endpoint.
|
|
19
|
+
*/
|
|
20
|
+
if (type === "manage") {
|
|
21
|
+
result.push("status: String", "status_not: String", "status_in: [String!]", "status_not_in: [String!]");
|
|
22
|
+
}
|
|
23
|
+
const finalFields = result.filter(field => {
|
|
24
|
+
return !excludeFields.some(excl => {
|
|
25
|
+
return field.startsWith(`${excl}_`) || field.startsWith(`${excl}: `);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
for (const field of fields) {
|
|
29
|
+
var _fieldTypePlugins$bas, _fieldTypePlugins$bas2;
|
|
30
|
+
// Every time a client updates content model's fields, we check the type of each field. If a field plugin
|
|
31
|
+
// for a particular "field.type" doesn't exist on the backend yet, we throw an error. But still, we also
|
|
32
|
+
// want to be careful when accessing the field plugin here too. It is still possible to have a content model
|
|
33
|
+
// that contains a field, for which we don't have a plugin registered on the backend. For example, user
|
|
34
|
+
// could've just removed the plugin from the backend.
|
|
35
|
+
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
36
|
+
const createListFilters = (_fieldTypePlugins$bas = fieldTypePlugins[baseType]) === null || _fieldTypePlugins$bas === void 0 ? void 0 : (_fieldTypePlugins$bas2 = _fieldTypePlugins$bas[type]) === null || _fieldTypePlugins$bas2 === void 0 ? void 0 : _fieldTypePlugins$bas2.createListFilters;
|
|
37
|
+
if (typeof createListFilters !== "function") {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
finalFields.push(createListFilters({
|
|
41
|
+
model,
|
|
42
|
+
field,
|
|
43
|
+
plugins: fieldTypePlugins
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
return finalFields.filter(Boolean).join("\n");
|
|
47
|
+
};
|
|
48
|
+
exports.renderListFilterFields = renderListFilterFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderListFilterFields","params","model","fields","type","fieldTypePlugins","excludeFields","result","push","finalFields","filter","field","some","excl","startsWith","baseType","getBaseFieldType","createListFilters","plugins","Boolean","join"],"sources":["renderListFilterFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderListFilterFieldsParams {\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n excludeFields?: string[];\n}\ninterface RenderListFilterFields {\n (params: RenderListFilterFieldsParams): string;\n}\n\ntype CreateListFiltersType =\n | CmsModelFieldToGraphQLPlugin[\"read\"][\"createListFilters\"]\n | CmsModelFieldToGraphQLPlugin[\"manage\"][\"createListFilters\"];\n\nexport const renderListFilterFields: RenderListFilterFields = (params): string => {\n const { model, fields, type, fieldTypePlugins, excludeFields = [] } = params;\n const result: string[] = [\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 ];\n /**\n * We can find different statuses only in the manage API endpoint.\n */\n if (type === \"manage\") {\n result.push(\n \"status: String\",\n \"status_not: String\",\n \"status_in: [String!]\",\n \"status_not_in: [String!]\"\n );\n }\n\n const finalFields = result.filter(field => {\n return !excludeFields.some(excl => {\n return field.startsWith(`${excl}_`) || field.startsWith(`${excl}: `);\n });\n });\n\n for (const field of 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 const baseType = getBaseFieldType(field);\n const createListFilters: CreateListFiltersType | undefined =\n fieldTypePlugins[baseType]?.[type]?.createListFilters;\n if (typeof createListFilters !== \"function\") {\n continue;\n }\n finalFields.push(createListFilters({ model, field, plugins: fieldTypePlugins }));\n }\n\n return finalFields.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AAOA;AAiBO,MAAMA,sBAA8C,GAAIC,MAAM,IAAa;EAC9E,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,gBAAgB;IAAEC,aAAa,GAAG;EAAG,CAAC,GAAGL,MAAM;EAC5E,MAAMM,MAAgB,GAAG,CACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,kCAAkC,EAClC,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,CAC9B;EACD;AACJ;AACA;EACI,IAAIH,IAAI,KAAK,QAAQ,EAAE;IACnBG,MAAM,CAACC,IAAI,CACP,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,CAC7B;EACL;EAEA,MAAMC,WAAW,GAAGF,MAAM,CAACG,MAAM,CAACC,KAAK,IAAI;IACvC,OAAO,CAACL,aAAa,CAACM,IAAI,CAACC,IAAI,IAAI;MAC/B,OAAOF,KAAK,CAACG,UAAU,CAAE,GAAED,IAAK,GAAE,CAAC,IAAIF,KAAK,CAACG,UAAU,CAAE,GAAED,IAAK,IAAG,CAAC;IACxE,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,KAAK,MAAMF,KAAK,IAAIR,MAAM,EAAE;IAAA;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMY,QAAQ,GAAG,IAAAC,kCAAgB,EAACL,KAAK,CAAC;IACxC,MAAMM,iBAAoD,4BACtDZ,gBAAgB,CAACU,QAAQ,CAAC,oFAA1B,sBAA6BX,IAAI,CAAC,2DAAlC,uBAAoCa,iBAAiB;IACzD,IAAI,OAAOA,iBAAiB,KAAK,UAAU,EAAE;MACzC;IACJ;IACAR,WAAW,CAACD,IAAI,CAACS,iBAAiB,CAAC;MAAEf,KAAK;MAAES,KAAK;MAAEO,OAAO,EAAEb;IAAiB,CAAC,CAAC,CAAC;EACpF;EAEA,OAAOI,WAAW,CAACC,MAAM,CAACS,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC;AAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
|
|
2
|
+
import { CmsGraphQLSchemaSorterPlugin } from "../plugins/CmsGraphQLSchemaSorterPlugin";
|
|
3
|
+
interface RenderSortEnumParams {
|
|
4
|
+
model: CmsModel;
|
|
5
|
+
fields: CmsModelField[];
|
|
6
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
7
|
+
sorterPlugins?: CmsGraphQLSchemaSorterPlugin[];
|
|
8
|
+
}
|
|
9
|
+
interface RenderSortEnum {
|
|
10
|
+
(params: RenderSortEnumParams): string;
|
|
11
|
+
}
|
|
12
|
+
export declare const renderSortEnum: RenderSortEnum;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderSortEnum = void 0;
|
|
7
|
+
var _getBaseFieldType = require("./getBaseFieldType");
|
|
8
|
+
const renderSortEnum = ({
|
|
9
|
+
model,
|
|
10
|
+
fields,
|
|
11
|
+
fieldTypePlugins,
|
|
12
|
+
sorterPlugins
|
|
13
|
+
}) => {
|
|
14
|
+
let sorters = [`id_ASC`, `id_DESC`, "savedOn_ASC", "savedOn_DESC", "createdOn_ASC", "createdOn_DESC"];
|
|
15
|
+
for (const field of fields) {
|
|
16
|
+
const plugin = fieldTypePlugins[(0, _getBaseFieldType.getBaseFieldType)(field)];
|
|
17
|
+
if (!plugin) {
|
|
18
|
+
continue;
|
|
19
|
+
} else if (plugin.createSorters) {
|
|
20
|
+
const result = plugin.createSorters({
|
|
21
|
+
model,
|
|
22
|
+
field,
|
|
23
|
+
sorters
|
|
24
|
+
});
|
|
25
|
+
if (result) {
|
|
26
|
+
sorters = result;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!plugin.isSortable) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
sorters.push(`${field.fieldId}_ASC`);
|
|
34
|
+
sorters.push(`${field.fieldId}_DESC`);
|
|
35
|
+
}
|
|
36
|
+
if (!sorterPlugins) {
|
|
37
|
+
return sorters.join("\n");
|
|
38
|
+
}
|
|
39
|
+
return sorterPlugins.reduce((result, plugin) => {
|
|
40
|
+
return plugin.createSorter({
|
|
41
|
+
model,
|
|
42
|
+
sorters: result
|
|
43
|
+
});
|
|
44
|
+
}, sorters).join("\n");
|
|
45
|
+
};
|
|
46
|
+
exports.renderSortEnum = renderSortEnum;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["renderSortEnum","model","fields","fieldTypePlugins","sorterPlugins","sorters","field","plugin","getBaseFieldType","createSorters","result","isSortable","push","fieldId","join","reduce","createSorter"],"sources":["renderSortEnum.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { CmsGraphQLSchemaSorterPlugin } from \"~/plugins/CmsGraphQLSchemaSorterPlugin\";\n\ninterface RenderSortEnumParams {\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n sorterPlugins?: CmsGraphQLSchemaSorterPlugin[];\n}\ninterface RenderSortEnum {\n (params: RenderSortEnumParams): string;\n}\n\nexport const renderSortEnum: RenderSortEnum = ({\n model,\n fields,\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 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 if (!sorterPlugins) {\n return sorters.join(\"\\n\");\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;AAaO,MAAMA,cAA8B,GAAG,CAAC;EAC3CC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACJ,CAAC,KAAa;EACV,IAAIC,OAAiB,GAAG,CACnB,QAAO,EACP,SAAQ,EACT,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,CACnB;EAED,KAAK,MAAMC,KAAK,IAAIJ,MAAM,EAAE;IACxB,MAAMK,MAAM,GAAGJ,gBAAgB,CAAC,IAAAK,kCAAgB,EAACF,KAAK,CAAC,CAAC;IACxD,IAAI,CAACC,MAAM,EAAE;MACT;IACJ,CAAC,MAAM,IAAIA,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAMC,MAAM,GAAGH,MAAM,CAACE,aAAa,CAAC;QAChCR,KAAK;QACLK,KAAK;QACLD;MACJ,CAAC,CAAC;MACF,IAAIK,MAAM,EAAE;QACRL,OAAO,GAAGK,MAAM;QAChB;MACJ;IACJ;IACA,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;MACpB;IACJ;IACAN,OAAO,CAACO,IAAI,CAAE,GAAEN,KAAK,CAACO,OAAQ,MAAK,CAAC;IACpCR,OAAO,CAACO,IAAI,CAAE,GAAEN,KAAK,CAACO,OAAQ,OAAM,CAAC;EACzC;EACA,IAAI,CAACT,aAAa,EAAE;IAChB,OAAOC,OAAO,CAACS,IAAI,CAAC,IAAI,CAAC;EAC7B;EAEA,OAAOV,aAAa,CACfW,MAAM,CAAC,CAACL,MAAM,EAAEH,MAAM,KAAK;IACxB,OAAOA,MAAM,CAACS,YAAY,CAAC;MACvBf,KAAK;MACLI,OAAO,EAAEK;IACb,CAAC,CAAC;EACN,CAAC,EAAEL,OAAO,CAAC,CACVS,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toSlug: (text: string) => string;
|
package/utils/toSlug.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.toSlug = void 0;
|
|
8
|
+
var _slugify = _interopRequireDefault(require("slugify"));
|
|
9
|
+
const toSlug = text => {
|
|
10
|
+
return (0, _slugify.default)(text, {
|
|
11
|
+
replacement: "-",
|
|
12
|
+
lower: true,
|
|
13
|
+
remove: /[*#\?<>_\{\}\[\]+~.()'"!:;@]/g
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
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,IAAY,IAAa;EAC5C,OAAO,IAAAC,gBAAO,EAACD,IAAI,EAAE;IACjBE,WAAW,EAAE,GAAG;IAChBC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE;EACZ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.createDateGteValidator = void 0;
|
|
8
7
|
var _validation = require("@webiny/validation");
|
|
9
|
-
|
|
10
|
-
var _default = () => ({
|
|
8
|
+
const createDateGteValidator = () => ({
|
|
11
9
|
type: "cms-model-field-validator",
|
|
12
10
|
name: "cms-model-field-validator-date-gte",
|
|
13
11
|
validator: {
|
|
14
12
|
name: "dateGte",
|
|
15
|
-
|
|
16
13
|
async validate({
|
|
17
14
|
value,
|
|
18
15
|
validator
|
|
@@ -20,18 +17,14 @@ var _default = () => ({
|
|
|
20
17
|
const {
|
|
21
18
|
value: gteValue,
|
|
22
19
|
type
|
|
23
|
-
} = validator.settings;
|
|
24
|
-
|
|
20
|
+
} = validator.settings || {};
|
|
25
21
|
if (typeof gteValue === "undefined") {
|
|
26
22
|
return true;
|
|
27
23
|
} else if (type === "time") {
|
|
28
24
|
return _validation.validation.validate(value, `timeGte:${gteValue}`).then(v => v === true).catch(() => false);
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
return _validation.validation.validate(value, `dateGte:${gteValue}`).then(v => v === true).catch(() => false);
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
}
|
|
35
29
|
});
|
|
36
|
-
|
|
37
|
-
exports.default = _default;
|
|
30
|
+
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,2BAA2B;EACjCC,IAAI,EAAE,oCAAoC;EAC1CC,SAAS,EAAE;IACPD,IAAI,EAAE,SAAS;IACf,MAAME,QAAQ,CAAC;MAAEC,KAAK;MAAEF;IAAU,CAAC,EAAE;MACjC,MAAM;QAAEE,KAAK,EAAEC,QAAQ;QAAEL;MAAK,CAAC,GAAGE,SAAS,CAACI,QAAQ,IAAI,CAAC,CAAC;MAC1D,IAAI,OAAOD,QAAQ,KAAK,WAAW,EAAE;QACjC,OAAO,IAAI;MACf,CAAC,MAAM,IAAIL,IAAI,KAAK,MAAM,EAAE;QACxB,OAAOO,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAG,WAAUC,QAAS,EAAC,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;MAC3B;MACA,OAAOH,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAG,WAAUC,QAAS,EAAC,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;IAC3B;EACJ;AACJ,CAAC,CAAC;AAAC"}
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.createDateLteValidator = void 0;
|
|
8
7
|
var _validation = require("@webiny/validation");
|
|
9
|
-
|
|
10
|
-
var _default = () => ({
|
|
8
|
+
const createDateLteValidator = () => ({
|
|
11
9
|
type: "cms-model-field-validator",
|
|
12
10
|
name: "cms-model-field-validator-date-lte",
|
|
13
11
|
validator: {
|
|
14
12
|
name: "dateLte",
|
|
15
|
-
|
|
16
13
|
async validate({
|
|
17
14
|
value,
|
|
18
15
|
validator
|
|
@@ -20,18 +17,14 @@ var _default = () => ({
|
|
|
20
17
|
const {
|
|
21
18
|
value: lteValue,
|
|
22
19
|
type
|
|
23
|
-
} = validator.settings;
|
|
24
|
-
|
|
20
|
+
} = validator.settings || {};
|
|
25
21
|
if (typeof lteValue === "undefined") {
|
|
26
22
|
return true;
|
|
27
23
|
} else if (type === "time") {
|
|
28
24
|
return _validation.validation.validate(value, `timeLte:${lteValue}`).then(v => v === true).catch(() => false);
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
return _validation.validation.validate(value, `dateLte:${lteValue}`).then(v => v === true).catch(() => false);
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
}
|
|
35
29
|
});
|
|
36
|
-
|
|
37
|
-
exports.default = _default;
|
|
30
|
+
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,2BAA2B;EACjCC,IAAI,EAAE,oCAAoC;EAC1CC,SAAS,EAAE;IACPD,IAAI,EAAE,SAAS;IACf,MAAME,QAAQ,CAAC;MAAEC,KAAK;MAAEF;IAAU,CAAC,EAAE;MACjC,MAAM;QAAEE,KAAK,EAAEC,QAAQ;QAAEL;MAAK,CAAC,GAAGE,SAAS,CAACI,QAAQ,IAAI,CAAC,CAAC;MAC1D,IAAI,OAAOD,QAAQ,KAAK,WAAW,EAAE;QACjC,OAAO,IAAI;MACf,CAAC,MAAM,IAAIL,IAAI,KAAK,MAAM,EAAE;QACxB,OAAOO,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAG,WAAUC,QAAS,EAAC,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;MAC3B;MACA,OAAOH,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAG,WAAUC,QAAS,EAAC,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;IAC3B;EACJ;AACJ,CAAC,CAAC;AAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createDynamicZoneValidator = void 0;
|
|
7
|
+
const createDynamicZoneValidator = () => {
|
|
8
|
+
return {
|
|
9
|
+
type: "cms-model-field-validator",
|
|
10
|
+
name: "cms-model-field-validator-dynamic-zone",
|
|
11
|
+
validator: {
|
|
12
|
+
name: "dynamicZone",
|
|
13
|
+
validate() {
|
|
14
|
+
// TODO: implement validation.
|
|
15
|
+
return Promise.resolve(true);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
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,2BAA2B;IACjCC,IAAI,EAAE,wCAAwC;IAC9CC,SAAS,EAAE;MACPD,IAAI,EAAE,aAAa;MACnBE,QAAQ,GAAG;QACP;QACA,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;MAChC;IACJ;EACJ,CAAC;AACL,CAAC;AAAC"}
|