@webiny/api-headless-cms 0.0.0-mt-2 → 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,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createHeaderParameterPlugin = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
var _CmsParametersPlugin = require("../plugins/CmsParametersPlugin");
|
|
10
|
+
var HeaderKeys;
|
|
11
|
+
(function (HeaderKeys) {
|
|
12
|
+
HeaderKeys["TYPE"] = "x-webiny-cms-endpoint";
|
|
13
|
+
HeaderKeys["LOCALE"] = "x-webiny-cms-locale";
|
|
14
|
+
})(HeaderKeys || (HeaderKeys = {}));
|
|
15
|
+
const createHeaderParameterPlugin = () => {
|
|
16
|
+
return new _CmsParametersPlugin.CmsParametersPlugin(async context => {
|
|
17
|
+
var _context$request;
|
|
18
|
+
/**
|
|
19
|
+
* If any of the properties is not defined, just ignore this plugin
|
|
20
|
+
*/
|
|
21
|
+
if (!((_context$request = context.request) !== null && _context$request !== void 0 && _context$request.headers)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const headers = context.request.headers;
|
|
25
|
+
const type = headers[HeaderKeys.TYPE];
|
|
26
|
+
const locale = headers[HeaderKeys.LOCALE];
|
|
27
|
+
if (!type && !locale) {
|
|
28
|
+
return null;
|
|
29
|
+
} else if (!locale || typeof locale !== "string") {
|
|
30
|
+
throw new _error.default(`There is a "${HeaderKeys.TYPE}" header but no "${HeaderKeys.LOCALE}".`, "MALFORMED_HEADERS_ERROR", {
|
|
31
|
+
headers
|
|
32
|
+
});
|
|
33
|
+
} else if (!type || typeof type !== "string") {
|
|
34
|
+
throw new _error.default(`There is a "${HeaderKeys.LOCALE}" header but no "${HeaderKeys.TYPE}".`, "MALFORMED_HEADERS_ERROR", {
|
|
35
|
+
headers
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
type: type,
|
|
40
|
+
locale
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.createHeaderParameterPlugin = createHeaderParameterPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HeaderKeys","createHeaderParameterPlugin","CmsParametersPlugin","context","request","headers","type","TYPE","locale","LOCALE","WebinyError"],"sources":["header.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsParametersPlugin } from \"~/plugins/CmsParametersPlugin\";\nimport { ApiEndpoint } from \"~/types\";\n\nenum HeaderKeys {\n TYPE = \"x-webiny-cms-endpoint\",\n LOCALE = \"x-webiny-cms-locale\"\n}\n\nexport const createHeaderParameterPlugin = () => {\n return new CmsParametersPlugin(async context => {\n /**\n * If any of the properties is not defined, just ignore this plugin\n */\n if (!context.request?.headers) {\n return null;\n }\n\n const headers = context.request.headers;\n\n const type = headers[HeaderKeys.TYPE];\n const locale = headers[HeaderKeys.LOCALE];\n\n if (!type && !locale) {\n return null;\n } else if (!locale || typeof locale !== \"string\") {\n throw new WebinyError(\n `There is a \"${HeaderKeys.TYPE}\" header but no \"${HeaderKeys.LOCALE}\".`,\n \"MALFORMED_HEADERS_ERROR\",\n {\n headers\n }\n );\n } else if (!type || typeof type !== \"string\") {\n throw new WebinyError(\n `There is a \"${HeaderKeys.LOCALE}\" header but no \"${HeaderKeys.TYPE}\".`,\n \"MALFORMED_HEADERS_ERROR\",\n {\n headers\n }\n );\n }\n\n return {\n type: type as ApiEndpoint,\n locale\n };\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAAoE,IAG/DA,UAAU;AAAA,WAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAVA,UAAU;AAKR,MAAMC,2BAA2B,GAAG,MAAM;EAC7C,OAAO,IAAIC,wCAAmB,CAAC,MAAMC,OAAO,IAAI;IAAA;IAC5C;AACR;AACA;IACQ,IAAI,sBAACA,OAAO,CAACC,OAAO,6CAAf,iBAAiBC,OAAO,GAAE;MAC3B,OAAO,IAAI;IACf;IAEA,MAAMA,OAAO,GAAGF,OAAO,CAACC,OAAO,CAACC,OAAO;IAEvC,MAAMC,IAAI,GAAGD,OAAO,CAACL,UAAU,CAACO,IAAI,CAAC;IACrC,MAAMC,MAAM,GAAGH,OAAO,CAACL,UAAU,CAACS,MAAM,CAAC;IAEzC,IAAI,CAACH,IAAI,IAAI,CAACE,MAAM,EAAE;MAClB,OAAO,IAAI;IACf,CAAC,MAAM,IAAI,CAACA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;MAC9C,MAAM,IAAIE,cAAW,CAChB,eAAcV,UAAU,CAACO,IAAK,oBAAmBP,UAAU,CAACS,MAAO,IAAG,EACvE,yBAAyB,EACzB;QACIJ;MACJ,CAAC,CACJ;IACL,CAAC,MAAM,IAAI,CAACC,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MAC1C,MAAM,IAAII,cAAW,CAChB,eAAcV,UAAU,CAACS,MAAO,oBAAmBT,UAAU,CAACO,IAAK,IAAG,EACvE,yBAAyB,EACzB;QACIF;MACJ,CAAC,CACJ;IACL;IAEA,OAAO;MACHC,IAAI,EAAEA,IAAmB;MACzBE;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _manual = require("./manual");
|
|
7
|
+
Object.keys(_manual).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _manual[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _manual[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _path = require("./path");
|
|
18
|
+
Object.keys(_path).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _path[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _path[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _context = require("./context");
|
|
29
|
+
Object.keys(_context).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _context[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _context[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _header = require("./header");
|
|
40
|
+
Object.keys(_header).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _header[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _header[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./manual\";\nexport * from \"./path\";\nexport * from \"./context\";\nexport * from \"./header\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CmsParametersPlugin, CmsParametersPluginResponseLocale, CmsParametersPluginResponseType } from "../plugins/CmsParametersPlugin";
|
|
2
|
+
export interface ManualPluginParams {
|
|
3
|
+
endpointType?: CmsParametersPluginResponseType;
|
|
4
|
+
locale?: CmsParametersPluginResponseLocale;
|
|
5
|
+
}
|
|
6
|
+
export declare const createManualPlugin: (params: ManualPluginParams) => CmsParametersPlugin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createManualPlugin = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
10
|
+
var _CmsParametersPlugin = require("../plugins/CmsParametersPlugin");
|
|
11
|
+
/**
|
|
12
|
+
* This would be used for custom Lambdas when there is no path or header information about the endpoint type and locale.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const createManualPlugin = params => {
|
|
16
|
+
return new _CmsParametersPlugin.CmsParametersPlugin(async () => {
|
|
17
|
+
const {
|
|
18
|
+
endpointType: type,
|
|
19
|
+
locale
|
|
20
|
+
} = params;
|
|
21
|
+
/**
|
|
22
|
+
* if both of parameters are not existing, just skip this plugin.
|
|
23
|
+
*/
|
|
24
|
+
if (!type && !locale) {
|
|
25
|
+
return null;
|
|
26
|
+
} else if (!type) {
|
|
27
|
+
throw new _error.default(`There is defined "locale" CMS parameter but no "endpointType".`, "MALFORMED_ENDPOINT_TYPE", (0, _objectSpread2.default)({}, params));
|
|
28
|
+
} else if (!locale) {
|
|
29
|
+
throw new _error.default(`There is defined "endpointType" CMS parameter but no "locale".`, "MALFORMED_LOCALE_TYPE", (0, _objectSpread2.default)({}, params));
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
type,
|
|
33
|
+
locale
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.createManualPlugin = createManualPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createManualPlugin","params","CmsParametersPlugin","endpointType","type","locale","WebinyError"],"sources":["manual.ts"],"sourcesContent":["/**\n * This would be used for custom Lambdas when there is no path or header information about the endpoint type and locale.\n */\nimport WebinyError from \"@webiny/error\";\nimport {\n CmsParametersPlugin,\n CmsParametersPluginResponseLocale,\n CmsParametersPluginResponseType\n} from \"~/plugins/CmsParametersPlugin\";\n\nexport interface ManualPluginParams {\n endpointType?: CmsParametersPluginResponseType;\n locale?: CmsParametersPluginResponseLocale;\n}\n\nexport const createManualPlugin = (params: ManualPluginParams): CmsParametersPlugin => {\n return new CmsParametersPlugin(async () => {\n const { endpointType: type, locale } = params;\n /**\n * if both of parameters are not existing, just skip this plugin.\n */\n if (!type && !locale) {\n return null;\n } else if (!type) {\n throw new WebinyError(\n `There is defined \"locale\" CMS parameter but no \"endpointType\".`,\n \"MALFORMED_ENDPOINT_TYPE\",\n {\n ...params\n }\n );\n } else if (!locale) {\n throw new WebinyError(\n `There is defined \"endpointType\" CMS parameter but no \"locale\".`,\n \"MALFORMED_LOCALE_TYPE\",\n {\n ...params\n }\n );\n }\n\n return {\n type,\n locale\n };\n });\n};\n"],"mappings":";;;;;;;;AAGA;AACA;AAJA;AACA;AACA;;AAaO,MAAMA,kBAAkB,GAAIC,MAA0B,IAA0B;EACnF,OAAO,IAAIC,wCAAmB,CAAC,YAAY;IACvC,MAAM;MAAEC,YAAY,EAAEC,IAAI;MAAEC;IAAO,CAAC,GAAGJ,MAAM;IAC7C;AACR;AACA;IACQ,IAAI,CAACG,IAAI,IAAI,CAACC,MAAM,EAAE;MAClB,OAAO,IAAI;IACf,CAAC,MAAM,IAAI,CAACD,IAAI,EAAE;MACd,MAAM,IAAIE,cAAW,CAChB,gEAA+D,EAChE,yBAAyB,kCAElBL,MAAM,EAEhB;IACL,CAAC,MAAM,IAAI,CAACI,MAAM,EAAE;MAChB,MAAM,IAAIC,cAAW,CAChB,gEAA+D,EAChE,uBAAuB,kCAEhBL,MAAM,EAEhB;IACL;IAEA,OAAO;MACHG,IAAI;MACJC;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createPathParameterPlugin = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
var _CmsParametersPlugin = require("../plugins/CmsParametersPlugin");
|
|
10
|
+
const allowedEndpoints = ["manage", "read", "preview"];
|
|
11
|
+
const createPathParameterPlugin = () => {
|
|
12
|
+
return new _CmsParametersPlugin.CmsParametersPlugin(async context => {
|
|
13
|
+
var _context$request;
|
|
14
|
+
/**
|
|
15
|
+
* If any of the properties is not defined, just ignore this plugin
|
|
16
|
+
*/
|
|
17
|
+
if (!((_context$request = context.request) !== null && _context$request !== void 0 && _context$request.params)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const {
|
|
21
|
+
type,
|
|
22
|
+
locale
|
|
23
|
+
} = context.request.params;
|
|
24
|
+
if (!type && !locale) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (!type) {
|
|
28
|
+
throw new _error.default(`Missing request parameter "type".`);
|
|
29
|
+
} else if (!locale) {
|
|
30
|
+
throw new _error.default(`Missing request parameter "locale".`);
|
|
31
|
+
} else if (allowedEndpoints.includes(type) === false) {
|
|
32
|
+
throw new _error.default(`Endpoint "${type}" not allowed!`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
type: type,
|
|
36
|
+
locale
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.createPathParameterPlugin = createPathParameterPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["allowedEndpoints","createPathParameterPlugin","CmsParametersPlugin","context","request","params","type","locale","WebinyError","includes"],"sources":["path.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsParametersPlugin } from \"~/plugins/CmsParametersPlugin\";\nimport { ApiEndpoint } from \"~/types\";\n\nconst allowedEndpoints: ApiEndpoint[] = [\"manage\", \"read\", \"preview\"];\n\nexport const createPathParameterPlugin = () => {\n return new CmsParametersPlugin(async context => {\n /**\n * If any of the properties is not defined, just ignore this plugin\n */\n if (!context.request?.params) {\n return null;\n }\n\n const { type, locale } = context.request.params as Record<string, string | null>;\n if (!type && !locale) {\n return null;\n }\n\n if (!type) {\n throw new WebinyError(`Missing request parameter \"type\".`);\n } else if (!locale) {\n throw new WebinyError(`Missing request parameter \"locale\".`);\n } else if (allowedEndpoints.includes(type as ApiEndpoint) === false) {\n throw new WebinyError(`Endpoint \"${type}\" not allowed!`);\n }\n\n return {\n type: type as ApiEndpoint,\n locale\n };\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAGA,MAAMA,gBAA+B,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;AAE9D,MAAMC,yBAAyB,GAAG,MAAM;EAC3C,OAAO,IAAIC,wCAAmB,CAAC,MAAMC,OAAO,IAAI;IAAA;IAC5C;AACR;AACA;IACQ,IAAI,sBAACA,OAAO,CAACC,OAAO,6CAAf,iBAAiBC,MAAM,GAAE;MAC1B,OAAO,IAAI;IACf;IAEA,MAAM;MAAEC,IAAI;MAAEC;IAAO,CAAC,GAAGJ,OAAO,CAACC,OAAO,CAACC,MAAuC;IAChF,IAAI,CAACC,IAAI,IAAI,CAACC,MAAM,EAAE;MAClB,OAAO,IAAI;IACf;IAEA,IAAI,CAACD,IAAI,EAAE;MACP,MAAM,IAAIE,cAAW,CAAE,mCAAkC,CAAC;IAC9D,CAAC,MAAM,IAAI,CAACD,MAAM,EAAE;MAChB,MAAM,IAAIC,cAAW,CAAE,qCAAoC,CAAC;IAChE,CAAC,MAAM,IAAIR,gBAAgB,CAACS,QAAQ,CAACH,IAAI,CAAgB,KAAK,KAAK,EAAE;MACjE,MAAM,IAAIE,cAAW,CAAE,aAAYF,IAAK,gBAAe,CAAC;IAC5D;IAEA,OAAO;MACHA,IAAI,EAAEA,IAAmB;MACzBC;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CmsGraphQLSchemaPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
10
|
+
class CmsGraphQLSchemaPlugin extends _handlerGraphql.GraphQLSchemaPlugin {}
|
|
11
|
+
exports.CmsGraphQLSchemaPlugin = CmsGraphQLSchemaPlugin;
|
|
12
|
+
(0, _defineProperty2.default)(CmsGraphQLSchemaPlugin, "type", "cms.graphql.schema");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CmsGraphQLSchemaPlugin","GraphQLSchemaPlugin"],"sources":["CmsGraphQLSchemaPlugin.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { CmsContext } from \"~/types\";\n\nexport class CmsGraphQLSchemaPlugin<T = CmsContext> extends GraphQLSchemaPlugin<T> {\n public static override type = \"cms.graphql.schema\";\n}\n"],"mappings":";;;;;;;;AAAA;AAGO,MAAMA,sBAAsB,SAAyBC,mCAAmB,CAAI;AAElF;AAAA,8BAFYD,sBAAsB,UACD,oBAAoB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { CmsModel } from "../types";
|
|
3
|
+
interface CmsGraphQLSchemaSorterPluginCallableParams {
|
|
4
|
+
model: CmsModel;
|
|
5
|
+
sorters: string[];
|
|
6
|
+
}
|
|
7
|
+
interface CmsGraphQLSchemaSorterPluginCallable {
|
|
8
|
+
(params: CmsGraphQLSchemaSorterPluginCallableParams): string[];
|
|
9
|
+
}
|
|
10
|
+
export declare class CmsGraphQLSchemaSorterPlugin extends Plugin {
|
|
11
|
+
static readonly type: string;
|
|
12
|
+
private readonly cb;
|
|
13
|
+
constructor(cb: CmsGraphQLSchemaSorterPluginCallable);
|
|
14
|
+
/**
|
|
15
|
+
* Method must return new sorting array. Or existing one if no changes are made.
|
|
16
|
+
*/
|
|
17
|
+
createSorter(params: CmsGraphQLSchemaSorterPluginCallableParams): string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const createCmsGraphQLSchemaSorterPlugin: (cb: CmsGraphQLSchemaSorterPluginCallable) => CmsGraphQLSchemaSorterPlugin;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createCmsGraphQLSchemaSorterPlugin = exports.CmsGraphQLSchemaSorterPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _plugins = require("@webiny/plugins");
|
|
10
|
+
class CmsGraphQLSchemaSorterPlugin extends _plugins.Plugin {
|
|
11
|
+
constructor(cb) {
|
|
12
|
+
super();
|
|
13
|
+
(0, _defineProperty2.default)(this, "cb", void 0);
|
|
14
|
+
this.cb = cb;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Method must return new sorting array. Or existing one if no changes are made.
|
|
18
|
+
*/
|
|
19
|
+
createSorter(params) {
|
|
20
|
+
return this.cb(params);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.CmsGraphQLSchemaSorterPlugin = CmsGraphQLSchemaSorterPlugin;
|
|
24
|
+
(0, _defineProperty2.default)(CmsGraphQLSchemaSorterPlugin, "type", "cms.graphql.schema.sorter");
|
|
25
|
+
const createCmsGraphQLSchemaSorterPlugin = cb => {
|
|
26
|
+
return new CmsGraphQLSchemaSorterPlugin(cb);
|
|
27
|
+
};
|
|
28
|
+
exports.createCmsGraphQLSchemaSorterPlugin = createCmsGraphQLSchemaSorterPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CmsGraphQLSchemaSorterPlugin","Plugin","constructor","cb","createSorter","params","createCmsGraphQLSchemaSorterPlugin"],"sources":["CmsGraphQLSchemaSorterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsModel } from \"~/types\";\n\ninterface CmsGraphQLSchemaSorterPluginCallableParams {\n model: CmsModel;\n sorters: string[];\n}\ninterface CmsGraphQLSchemaSorterPluginCallable {\n (params: CmsGraphQLSchemaSorterPluginCallableParams): string[];\n}\nexport class CmsGraphQLSchemaSorterPlugin extends Plugin {\n public static override readonly type: string = \"cms.graphql.schema.sorter\";\n\n private readonly cb: CmsGraphQLSchemaSorterPluginCallable;\n public constructor(cb: CmsGraphQLSchemaSorterPluginCallable) {\n super();\n\n this.cb = cb;\n }\n /**\n * Method must return new sorting array. Or existing one if no changes are made.\n */\n public createSorter(params: CmsGraphQLSchemaSorterPluginCallableParams): string[] {\n return this.cb(params);\n }\n}\n\nexport const createCmsGraphQLSchemaSorterPlugin = (\n cb: CmsGraphQLSchemaSorterPluginCallable\n): CmsGraphQLSchemaSorterPlugin => {\n return new CmsGraphQLSchemaSorterPlugin(cb);\n};\n"],"mappings":";;;;;;;;AAAA;AAUO,MAAMA,4BAA4B,SAASC,eAAM,CAAC;EAI9CC,WAAW,CAACC,EAAwC,EAAE;IACzD,KAAK,EAAE;IAAC;IAER,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EACA;AACJ;AACA;EACWC,YAAY,CAACC,MAAkD,EAAY;IAC9E,OAAO,IAAI,CAACF,EAAE,CAACE,MAAM,CAAC;EAC1B;AACJ;AAAC;AAAA,8BAfYL,4BAA4B,UACU,2BAA2B;AAgBvE,MAAMM,kCAAkC,GAC3CH,EAAwC,IACT;EAC/B,OAAO,IAAIH,4BAA4B,CAACG,EAAE,CAAC;AAC/C,CAAC;AAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { CmsGroup as BaseCmsGroup } from "../types";
|
|
3
|
+
interface CmsGroup extends Omit<BaseCmsGroup, "locale" | "tenant" | "webinyVersion"> {
|
|
4
|
+
tenant?: string;
|
|
5
|
+
locale?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class CmsGroupPlugin extends Plugin {
|
|
8
|
+
static readonly type: string;
|
|
9
|
+
readonly contentModelGroup: CmsGroup;
|
|
10
|
+
constructor(contentModelGroup: CmsGroup);
|
|
11
|
+
}
|
|
12
|
+
export declare const createCmsGroup: (group: CmsGroup) => CmsGroupPlugin;
|
|
13
|
+
export {};
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.CmsGroupPlugin = void 0;
|
|
9
|
-
|
|
7
|
+
exports.createCmsGroup = exports.CmsGroupPlugin = void 0;
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _plugins = require("@webiny/plugins");
|
|
13
|
-
|
|
14
10
|
class CmsGroupPlugin extends _plugins.Plugin {
|
|
15
11
|
constructor(contentModelGroup) {
|
|
16
12
|
super();
|
|
17
13
|
(0, _defineProperty2.default)(this, "contentModelGroup", void 0);
|
|
18
14
|
this.contentModelGroup = contentModelGroup;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
exports.CmsGroupPlugin = CmsGroupPlugin;
|
|
24
|
-
(0, _defineProperty2.default)(CmsGroupPlugin, "type", "cms-content-model-group");
|
|
18
|
+
(0, _defineProperty2.default)(CmsGroupPlugin, "type", "cms-content-model-group");
|
|
19
|
+
const createCmsGroup = group => {
|
|
20
|
+
return new CmsGroupPlugin(group);
|
|
21
|
+
};
|
|
22
|
+
exports.createCmsGroup = createCmsGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CmsGroupPlugin","Plugin","constructor","contentModelGroup","createCmsGroup","group"],"sources":["CmsGroupPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsGroup as BaseCmsGroup } from \"~/types\";\n\ninterface CmsGroup extends Omit<BaseCmsGroup, \"locale\" | \"tenant\" | \"webinyVersion\"> {\n tenant?: string;\n locale?: string;\n}\nexport class CmsGroupPlugin extends Plugin {\n public static override readonly type: string = \"cms-content-model-group\";\n public readonly contentModelGroup: CmsGroup;\n\n constructor(contentModelGroup: CmsGroup) {\n super();\n this.contentModelGroup = contentModelGroup;\n }\n}\n\nexport const createCmsGroup = (group: CmsGroup): CmsGroupPlugin => {\n return new CmsGroupPlugin(group);\n};\n"],"mappings":";;;;;;;;AAAA;AAOO,MAAMA,cAAc,SAASC,eAAM,CAAC;EAIvCC,WAAW,CAACC,iBAA2B,EAAE;IACrC,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,iBAAiB,GAAGA,iBAAiB;EAC9C;AACJ;AAAC;AAAA,8BARYH,cAAc,UACwB,yBAAyB;AASrE,MAAMI,cAAc,GAAIC,KAAe,IAAqB;EAC/D,OAAO,IAAIL,cAAc,CAACK,KAAK,CAAC;AACpC,CAAC;AAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { CmsEntryValues, CmsModelFieldWithParent } from "../types";
|
|
3
|
+
import { ConverterCollection } from "../utils/converters/ConverterCollection";
|
|
4
|
+
export interface ConvertParams<F = CmsModelFieldWithParent> {
|
|
5
|
+
field: F;
|
|
6
|
+
value: any;
|
|
7
|
+
converterCollection: ConverterCollection;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class CmsModelFieldConverterPlugin extends Plugin {
|
|
10
|
+
static type: string;
|
|
11
|
+
abstract getFieldType(): string;
|
|
12
|
+
abstract convertToStorage(params: ConvertParams): CmsEntryValues;
|
|
13
|
+
abstract convertFromStorage(params: ConvertParams): CmsEntryValues;
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CmsModelFieldConverterPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _plugins = require("@webiny/plugins");
|
|
10
|
+
class CmsModelFieldConverterPlugin extends _plugins.Plugin {}
|
|
11
|
+
exports.CmsModelFieldConverterPlugin = CmsModelFieldConverterPlugin;
|
|
12
|
+
(0, _defineProperty2.default)(CmsModelFieldConverterPlugin, "type", "cms.field.converter");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CmsModelFieldConverterPlugin","Plugin"],"sources":["CmsModelFieldConverterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsEntryValues, CmsModelFieldWithParent } from \"~/types\";\nimport { ConverterCollection } from \"~/utils/converters/ConverterCollection\";\n\nexport interface ConvertParams<F = CmsModelFieldWithParent> {\n field: F;\n value: any;\n converterCollection: ConverterCollection;\n}\n\nexport abstract class CmsModelFieldConverterPlugin extends Plugin {\n public static override type = \"cms.field.converter\";\n\n public abstract getFieldType(): string;\n\n public abstract convertToStorage(params: ConvertParams): CmsEntryValues;\n public abstract convertFromStorage(params: ConvertParams): CmsEntryValues;\n}\n"],"mappings":";;;;;;;;AAAA;AAUO,MAAeA,4BAA4B,SAASC,eAAM,CAAC;AAOjE;AAAA,8BAPqBD,4BAA4B,UAChB,qBAAqB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { CmsModel as CmsModelBase, CmsModelField as CmsModelFieldBase, CmsModelFieldSettings as BaseCmsModelFieldSettings } from "../types";
|
|
3
|
+
interface CmsModelFieldSettings extends Omit<BaseCmsModelFieldSettings, "fields"> {
|
|
4
|
+
/**
|
|
5
|
+
* Object field has child fields.
|
|
6
|
+
*/
|
|
7
|
+
fields?: CmsModelFieldInput[];
|
|
8
|
+
}
|
|
9
|
+
interface CmsModelFieldInput extends Omit<CmsModelFieldBase, "storageId" | "settings"> {
|
|
10
|
+
/**
|
|
11
|
+
* If defined, it must be camelCased string.
|
|
12
|
+
* This is for backwards compatibility - before fields had storageId.
|
|
13
|
+
*
|
|
14
|
+
* This should only be populated in old model fields.
|
|
15
|
+
* News ones must have this empty.
|
|
16
|
+
*/
|
|
17
|
+
storageId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* We must have a possibility to have a nested field defined without the storageId.
|
|
20
|
+
*/
|
|
21
|
+
settings?: CmsModelFieldSettings;
|
|
22
|
+
}
|
|
23
|
+
export interface CmsApiModel extends Omit<CmsModel, "isPrivate" | "fields" | "singularApiName" | "pluralApiName"> {
|
|
24
|
+
isPrivate?: never;
|
|
25
|
+
noValidate?: never;
|
|
26
|
+
singularApiName?: string;
|
|
27
|
+
pluralApiName?: string;
|
|
28
|
+
fields: CmsModelFieldInput[];
|
|
29
|
+
}
|
|
30
|
+
export interface CmsApiModelFull extends Omit<CmsApiModel, "fields" | "noValidate"> {
|
|
31
|
+
noValidate: true;
|
|
32
|
+
fields: CmsModelFieldBase[];
|
|
33
|
+
}
|
|
34
|
+
interface CmsPrivateModel extends Omit<CmsModel, "isPrivate" | "singularApiName" | "pluralApiName" | "fields"> {
|
|
35
|
+
noValidate?: never;
|
|
36
|
+
singularApiName?: never;
|
|
37
|
+
pluralApiName?: never;
|
|
38
|
+
isPrivate: true;
|
|
39
|
+
fields: CmsModelFieldInput[];
|
|
40
|
+
}
|
|
41
|
+
export interface CmsPrivateModelFull extends Omit<CmsPrivateModel, "fields" | "noValidate"> {
|
|
42
|
+
fields: CmsModelFieldBase[];
|
|
43
|
+
noValidate: true;
|
|
44
|
+
}
|
|
45
|
+
export declare type CmsModelInput = CmsApiModel | CmsPrivateModel | CmsApiModelFull | CmsPrivateModelFull;
|
|
46
|
+
interface CmsModel extends Omit<CmsModelBase, "locale" | "tenant" | "webinyVersion"> {
|
|
47
|
+
locale?: string;
|
|
48
|
+
tenant?: string;
|
|
49
|
+
}
|
|
50
|
+
interface CmsModelPluginOptions {
|
|
51
|
+
validateLayout?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare class CmsModelPlugin extends Plugin {
|
|
54
|
+
static readonly type: string;
|
|
55
|
+
readonly contentModel: CmsModel;
|
|
56
|
+
private readonly options;
|
|
57
|
+
constructor(contentModel: CmsModelInput, options?: CmsModelPluginOptions);
|
|
58
|
+
private buildModel;
|
|
59
|
+
private buildFields;
|
|
60
|
+
private validateLayout;
|
|
61
|
+
}
|
|
62
|
+
export declare const createCmsModel: (model: CmsModelInput, options?: CmsModelPluginOptions) => CmsModelPlugin;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createCmsModel = exports.CmsModelPlugin = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
12
|
+
var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
|
|
13
|
+
var _pluralize = _interopRequireDefault(require("pluralize"));
|
|
14
|
+
var _plugins = require("@webiny/plugins");
|
|
15
|
+
var _createFieldStorageId = require("../crud/contentModel/createFieldStorageId");
|
|
16
|
+
const createApiName = name => {
|
|
17
|
+
return (0, _upperFirst.default)((0, _camelCase.default)(name));
|
|
18
|
+
};
|
|
19
|
+
const createPluralApiName = name => {
|
|
20
|
+
return (0, _pluralize.default)(createApiName(name));
|
|
21
|
+
};
|
|
22
|
+
class CmsModelPlugin extends _plugins.Plugin {
|
|
23
|
+
constructor(contentModel, options) {
|
|
24
|
+
super();
|
|
25
|
+
(0, _defineProperty2.default)(this, "contentModel", void 0);
|
|
26
|
+
(0, _defineProperty2.default)(this, "options", void 0);
|
|
27
|
+
this.options = options || {};
|
|
28
|
+
this.contentModel = this.buildModel(contentModel);
|
|
29
|
+
}
|
|
30
|
+
buildModel(input) {
|
|
31
|
+
const isPrivate = input.isPrivate || false;
|
|
32
|
+
const singularApiName = input.singularApiName ? createApiName(input.singularApiName) : createApiName(input.name);
|
|
33
|
+
const pluralApiName = input.pluralApiName ? createApiName(input.pluralApiName) : createPluralApiName(input.name);
|
|
34
|
+
if (input.noValidate) {
|
|
35
|
+
/**
|
|
36
|
+
* We can safely ignore this error, because we are sure noValidate is not a model field.
|
|
37
|
+
*/
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
delete input["noValidate"];
|
|
40
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
|
|
41
|
+
isPrivate,
|
|
42
|
+
singularApiName,
|
|
43
|
+
pluralApiName
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const model = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
|
|
47
|
+
isPrivate,
|
|
48
|
+
singularApiName,
|
|
49
|
+
pluralApiName,
|
|
50
|
+
fields: this.buildFields(input, input.fields)
|
|
51
|
+
});
|
|
52
|
+
this.validateLayout(model);
|
|
53
|
+
return model;
|
|
54
|
+
}
|
|
55
|
+
buildFields(model, inputFields) {
|
|
56
|
+
if (inputFields.length === 0) {
|
|
57
|
+
throw new _error.default(`Missing fields for the defined model "${model.modelId}".`, "MISSING_FIELDS", {
|
|
58
|
+
model
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const fields = [];
|
|
62
|
+
const storageIdList = [];
|
|
63
|
+
const fieldIdList = [];
|
|
64
|
+
for (const input of inputFields) {
|
|
65
|
+
var _settings;
|
|
66
|
+
/**
|
|
67
|
+
* Field must contain an fieldId. It is required in the graphql, but lets check it just in case
|
|
68
|
+
*/
|
|
69
|
+
if (!(input.fieldId || "").trim()) {
|
|
70
|
+
throw new _error.default(`Field's "storageId" is not defined for the content model "${model.modelId}".`, "FIELD_ID_ERROR", {
|
|
71
|
+
model,
|
|
72
|
+
field: input
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const fieldId = (0, _camelCase.default)(input.fieldId);
|
|
76
|
+
/**
|
|
77
|
+
* FieldID must be in correct pattern.
|
|
78
|
+
*/
|
|
79
|
+
if (fieldId.match(/^[0-9]/) !== null) {
|
|
80
|
+
throw new _error.default(`Field's "fieldId" does not match correct pattern in the content model "${model.modelId}" - cannot start with a number.`, "FIELD_FIELD_ID_ERROR", {
|
|
81
|
+
model,
|
|
82
|
+
field: input
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* FieldID also must be camelCased.
|
|
87
|
+
*/
|
|
88
|
+
if (fieldId !== input.fieldId) {
|
|
89
|
+
throw new _error.default(`Field's "fieldId" must be a camel cased string in the content model "${model.modelId}".`, "FIELD_FIELD_ID_ERROR", {
|
|
90
|
+
model,
|
|
91
|
+
field: input
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* ... and fieldId must be unique.
|
|
96
|
+
*/
|
|
97
|
+
if (fieldIdList.includes(fieldId) === true) {
|
|
98
|
+
throw new _error.default(`Field's "fieldId" is not unique in the content model "${model.modelId}".`, "FIELD_ID_NOT_UNIQUE_ERROR", {
|
|
99
|
+
model,
|
|
100
|
+
field: input
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
let storageId = input.storageId ? (0, _camelCase.default)(input.storageId) : null;
|
|
104
|
+
/**
|
|
105
|
+
* If defined, storageId MUST be camel cased string - for backward compatibility.
|
|
106
|
+
*/
|
|
107
|
+
if (storageId && (storageId.match(/^([a-zA-Z-0-9]+)$/) === null || storageId !== input.storageId)) {
|
|
108
|
+
throw new _error.default(`Field's "storageId" of the field with "fieldId" ${input.fieldId} is not camel cased string in the content model "${model.modelId}".`, "STORAGE_ID_NOT_CAMEL_CASED_ERROR", {
|
|
109
|
+
model,
|
|
110
|
+
storageId,
|
|
111
|
+
field: input
|
|
112
|
+
});
|
|
113
|
+
} else if (!storageId) {
|
|
114
|
+
storageId = (0, _createFieldStorageId.createFieldStorageId)(input);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Fields storageId must be unique.
|
|
119
|
+
*/
|
|
120
|
+
if (storageIdList.includes(storageId) === true) {
|
|
121
|
+
throw new _error.default(`Field's "storageId" is not unique in the content model "${model.modelId}".`, "STORAGE_ID_ERROR", {
|
|
122
|
+
model,
|
|
123
|
+
field: input
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* We can safely ignore error because we are going through the fields and making sure each has storageId.
|
|
129
|
+
*/
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
let settings = input.settings;
|
|
132
|
+
const childFields = ((_settings = settings) === null || _settings === void 0 ? void 0 : _settings.fields) || [];
|
|
133
|
+
if (input.type === "object" && childFields.length > 0) {
|
|
134
|
+
settings = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, settings || {}), {}, {
|
|
135
|
+
fields: this.buildFields(model, childFields)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const field = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
|
|
139
|
+
settings,
|
|
140
|
+
storageId
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Add all relevant data to arrays.
|
|
144
|
+
*/
|
|
145
|
+
fields.push(field);
|
|
146
|
+
storageIdList.push(field.storageId);
|
|
147
|
+
fieldIdList.push(field.fieldId);
|
|
148
|
+
}
|
|
149
|
+
return fields;
|
|
150
|
+
}
|
|
151
|
+
validateLayout(model) {
|
|
152
|
+
/**
|
|
153
|
+
* Only skip validation if option.validateLayout was set as false, explicitly.
|
|
154
|
+
*/
|
|
155
|
+
if (this.options.validateLayout === false) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
for (const field of model.fields) {
|
|
159
|
+
let total = 0;
|
|
160
|
+
for (const row of model.layout) {
|
|
161
|
+
const count = row.filter(cell => cell === field.id).length;
|
|
162
|
+
total = total + count;
|
|
163
|
+
}
|
|
164
|
+
if (total === 1) {
|
|
165
|
+
continue;
|
|
166
|
+
} else if (total > 1) {
|
|
167
|
+
throw new _error.default(`Field "${field.id}" is in more than one layout cell.`, "DUPLICATE_FIELD_IN_LAYOUT", {
|
|
168
|
+
model,
|
|
169
|
+
field
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
throw new _error.default(`Missing field "${field.id}" in layout.`, "MISSING_FIELD_IN_LAYOUT", {
|
|
173
|
+
model,
|
|
174
|
+
field
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.CmsModelPlugin = CmsModelPlugin;
|
|
180
|
+
(0, _defineProperty2.default)(CmsModelPlugin, "type", "cms-content-model");
|
|
181
|
+
const createCmsModel = (model, options) => {
|
|
182
|
+
return new CmsModelPlugin(model, options);
|
|
183
|
+
};
|
|
184
|
+
exports.createCmsModel = createCmsModel;
|