@webiny/api-headless-cms 0.0.0-unstable.d7f521b032 → 0.0.0-unstable.de38392959
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 +32 -0
- package/constants.js +57 -0
- package/constants.js.map +1 -0
- package/context.js +88 -47
- package/context.js.map +1 -1
- package/crud/contentEntry/afterDelete.js +3 -1
- package/crud/contentEntry/afterDelete.js.map +1 -1
- package/crud/contentEntry/beforeCreate.js +3 -1
- package/crud/contentEntry/beforeCreate.js.map +1 -1
- package/crud/contentEntry/beforeUpdate.js +3 -1
- package/crud/contentEntry/beforeUpdate.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryData.d.ts +20 -0
- package/crud/contentEntry/entryDataFactories/createEntryData.js +228 -0
- package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.d.ts +21 -0
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js +114 -0
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.d.ts +13 -0
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.js +61 -0
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.d.ts +12 -0
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js +57 -0
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.d.ts +12 -0
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js +38 -0
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.d.ts +20 -0
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js +122 -0
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/index.d.ts +8 -0
- package/crud/contentEntry/entryDataFactories/index.js +95 -0
- package/crud/contentEntry/entryDataFactories/index.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.d.ts +5 -0
- package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.js +36 -0
- package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.js.map +1 -0
- package/crud/contentEntry/entryDataFactories/statuses.d.ts +4 -0
- package/crud/contentEntry/entryDataFactories/statuses.js +15 -0
- package/crud/contentEntry/entryDataFactories/statuses.js.map +1 -0
- package/crud/contentEntry/entryDataValidation.d.ts +4 -2
- package/crud/contentEntry/entryDataValidation.js +223 -45
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentEntry/markLockedFields.d.ts +1 -1
- package/crud/contentEntry/markLockedFields.js +20 -10
- package/crud/contentEntry/markLockedFields.js.map +1 -1
- package/crud/contentEntry/referenceFieldsMapping.d.ts +6 -0
- package/crud/contentEntry/referenceFieldsMapping.js +142 -90
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
- package/crud/contentEntry/searchableFields.js +5 -4
- package/crud/contentEntry/searchableFields.js.map +1 -1
- package/crud/contentEntry.crud.d.ts +9 -5
- package/crud/contentEntry.crud.js +1093 -981
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/beforeCreate.d.ts +1 -1
- package/crud/contentModel/beforeCreate.js +50 -85
- package/crud/contentModel/beforeCreate.js.map +1 -1
- package/crud/contentModel/beforeDelete.d.ts +1 -1
- package/crud/contentModel/beforeDelete.js +4 -6
- package/crud/contentModel/beforeDelete.js.map +1 -1
- package/crud/contentModel/beforeUpdate.d.ts +1 -1
- package/crud/contentModel/beforeUpdate.js +31 -6
- package/crud/contentModel/beforeUpdate.js.map +1 -1
- package/crud/contentModel/compatibility/modelApiName.d.ts +3 -0
- package/crud/contentModel/compatibility/modelApiName.js +26 -0
- package/crud/contentModel/compatibility/modelApiName.js.map +1 -0
- package/crud/contentModel/contentModelManagerFactory.js +3 -1
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -1
- package/crud/contentModel/createFieldStorageId.js +3 -1
- package/crud/contentModel/createFieldStorageId.js.map +1 -1
- package/crud/contentModel/defaultFields.d.ts +5 -0
- package/crud/contentModel/defaultFields.js +60 -0
- package/crud/contentModel/defaultFields.js.map +1 -0
- package/crud/contentModel/ensureTypeTag.d.ts +5 -0
- package/crud/contentModel/ensureTypeTag.js +21 -0
- package/crud/contentModel/ensureTypeTag.js.map +1 -0
- package/crud/contentModel/fields/descriptionField.d.ts +2 -0
- package/crud/contentModel/fields/descriptionField.js +44 -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 +44 -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 +60 -0
- package/crud/contentModel/fields/titleField.js.map +1 -0
- package/crud/contentModel/listModelsFromDatabase.d.ts +10 -0
- package/crud/contentModel/listModelsFromDatabase.js +38 -0
- package/crud/contentModel/listModelsFromDatabase.js.map +1 -0
- package/crud/contentModel/validate/endingAllowed.d.ts +6 -0
- package/crud/contentModel/validate/endingAllowed.js +28 -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 +26 -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 +38 -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 +26 -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 +26 -0
- package/crud/contentModel/validate/singularApiName.js.map +1 -0
- package/crud/contentModel/validateModel.d.ts +1 -0
- package/crud/contentModel/validateModel.js +3 -1
- package/crud/contentModel/validateModel.js.map +1 -1
- package/crud/contentModel/validateModelFields.d.ts +2 -1
- package/crud/contentModel/validateModelFields.js +27 -64
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel/validation.d.ts +595 -200
- package/crud/contentModel/validation.js +125 -17
- package/crud/contentModel/validation.js.map +1 -1
- package/crud/contentModel.crud.d.ts +2 -0
- package/crud/contentModel.crud.js +437 -411
- package/crud/contentModel.crud.js.map +1 -1
- package/crud/contentModelGroup/beforeCreate.d.ts +1 -1
- package/crud/contentModelGroup/beforeCreate.js +15 -1
- package/crud/contentModelGroup/beforeCreate.js.map +1 -1
- package/crud/contentModelGroup/beforeDelete.js +3 -1
- package/crud/contentModelGroup/beforeDelete.js.map +1 -1
- package/crud/contentModelGroup/beforeUpdate.js +3 -1
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
- package/crud/contentModelGroup/listGroupsFromDatabase.d.ts +8 -0
- package/crud/contentModelGroup/listGroupsFromDatabase.js +22 -0
- package/crud/contentModelGroup/listGroupsFromDatabase.js.map +1 -0
- package/crud/contentModelGroup/validation.d.ts +10 -7
- package/crud/contentModelGroup/validation.js +5 -2
- package/crud/contentModelGroup/validation.js.map +1 -1
- package/crud/contentModelGroup.crud.d.ts +3 -1
- package/crud/contentModelGroup.crud.js +272 -228
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/crud/system.crud.js +8 -71
- package/crud/system.crud.js.map +1 -1
- package/export/crud/exporting.d.ts +3 -0
- package/export/crud/exporting.js +49 -0
- package/export/crud/exporting.js.map +1 -0
- package/export/crud/importing.d.ts +3 -0
- package/export/crud/importing.js +79 -0
- package/export/crud/importing.js.map +1 -0
- package/export/crud/imports/importData.d.ts +14 -0
- package/export/crud/imports/importData.js +52 -0
- package/export/crud/imports/importData.js.map +1 -0
- package/export/crud/imports/importGroups.d.ts +8 -0
- package/export/crud/imports/importGroups.js +104 -0
- package/export/crud/imports/importGroups.js.map +1 -0
- package/export/crud/imports/importModels.d.ts +8 -0
- package/export/crud/imports/importModels.js +136 -0
- package/export/crud/imports/importModels.js.map +1 -0
- package/export/crud/imports/validateGroups.d.ts +8 -0
- package/export/crud/imports/validateGroups.js +112 -0
- package/export/crud/imports/validateGroups.js.map +1 -0
- package/export/crud/imports/validateInput.d.ts +19 -0
- package/export/crud/imports/validateInput.js +55 -0
- package/export/crud/imports/validateInput.js.map +1 -0
- package/export/crud/imports/validateModels.d.ts +12 -0
- package/export/crud/imports/validateModels.js +203 -0
- package/export/crud/imports/validateModels.js.map +1 -0
- package/export/crud/index.d.ts +4 -0
- package/export/crud/index.js +15 -0
- package/export/crud/index.js.map +1 -0
- package/export/crud/sanitize.d.ts +4 -0
- package/export/crud/sanitize.js +35 -0
- package/export/crud/sanitize.js.map +1 -0
- package/export/graphql/index.d.ts +3 -0
- package/export/graphql/index.js +188 -0
- package/export/graphql/index.js.map +1 -0
- package/export/index.d.ts +2 -0
- package/export/index.js +29 -0
- package/export/index.js.map +1 -0
- package/export/types.d.ts +113 -0
- package/export/types.js +22 -0
- package/export/types.js.map +1 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js +4 -7
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +5 -8
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +47 -38
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/index.js +3 -1
- package/fieldConverters/index.js.map +1 -1
- package/graphql/buildSchemaPlugins.js +7 -1
- package/graphql/buildSchemaPlugins.js.map +1 -1
- package/graphql/checkEndpointAccess.d.ts +2 -0
- package/graphql/checkEndpointAccess.js +20 -0
- package/graphql/checkEndpointAccess.js.map +1 -0
- package/graphql/createExecutableSchema.d.ts +2 -3
- package/graphql/createExecutableSchema.js +3 -1
- package/graphql/createExecutableSchema.js.map +1 -1
- package/graphql/createRequestBody.d.ts +2 -0
- package/graphql/createRequestBody.js +16 -0
- package/graphql/createRequestBody.js.map +1 -0
- package/graphql/formatErrorPayload.d.ts +1 -0
- package/graphql/formatErrorPayload.js +27 -0
- package/graphql/formatErrorPayload.js.map +1 -0
- package/graphql/generateSchema.js +3 -1
- package/graphql/generateSchema.js.map +1 -1
- package/graphql/getSchema.d.ts +16 -0
- package/graphql/getSchema.js +118 -0
- package/graphql/getSchema.js.map +1 -0
- package/graphql/graphQLHandlerFactory.js +9 -146
- package/graphql/graphQLHandlerFactory.js.map +1 -1
- package/graphql/handleRequest.d.ts +11 -0
- package/graphql/handleRequest.js +79 -0
- package/graphql/handleRequest.js.map +1 -0
- package/graphql/index.d.ts +1 -1
- package/graphql/index.js +4 -2
- package/graphql/index.js.map +1 -1
- package/graphql/schema/baseContentSchema.js +10 -15
- package/graphql/schema/baseContentSchema.js.map +1 -1
- package/graphql/schema/baseSchema.d.ts +2 -3
- package/graphql/schema/baseSchema.js +95 -2
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/contentEntries.js +134 -59
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModelGroups.js +12 -9
- package/graphql/schema/contentModelGroups.js.map +1 -1
- package/graphql/schema/contentModels.js +33 -14
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +1 -1
- package/graphql/schema/createFieldResolvers.js +18 -22
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createFieldTypePluginRecords.d.ts +3 -0
- package/graphql/schema/createFieldTypePluginRecords.js +15 -0
- package/graphql/schema/createFieldTypePluginRecords.js.map +1 -0
- package/graphql/schema/createManageResolvers.d.ts +1 -1
- package/graphql/schema/createManageResolvers.js +60 -27
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.d.ts +1 -0
- package/graphql/schema/createManageSDL.js +116 -69
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createPreviewResolvers.js +10 -13
- package/graphql/schema/createPreviewResolvers.js.map +1 -1
- package/graphql/schema/createReadResolvers.js +11 -14
- package/graphql/schema/createReadResolvers.js.map +1 -1
- package/graphql/schema/createReadSDL.d.ts +1 -0
- package/graphql/schema/createReadSDL.js +51 -38
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreate.d.ts +2 -1
- package/graphql/schema/resolvers/manage/resolveCreate.js +4 -2
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +2 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js +4 -2
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +2 -1
- package/graphql/schema/resolvers/manage/resolveDelete.js +16 -4
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js +22 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGet.js +12 -5
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.js +3 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js +3 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +4 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js +20 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveList.js +3 -1
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveMove.d.ts +8 -0
- package/graphql/schema/resolvers/manage/resolveMove.js +27 -0
- package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolvePublish.js +3 -1
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRepublish.js +3 -1
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUnpublish.js +3 -1
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +2 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.js +4 -2
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveValidate.d.ts +8 -0
- package/graphql/schema/resolvers/manage/resolveValidate.js +20 -0
- package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -0
- package/graphql/schema/resolvers/preview/resolveGet.js +6 -5
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveList.js +3 -1
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveGet.js +6 -5
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveList.js +3 -1
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
- package/graphql/schema/schemaPlugins.js +10 -17
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/graphql/system.d.ts +2 -5
- package/graphql/system.js +4 -28
- package/graphql/system.js.map +1 -1
- package/graphqlFields/boolean.js +3 -1
- package/graphqlFields/boolean.js.map +1 -1
- package/graphqlFields/datetime.js +5 -5
- package/graphqlFields/datetime.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.js +86 -28
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +60 -12
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -1
- package/graphqlFields/dynamicZone/index.js +3 -1
- package/graphqlFields/dynamicZone/index.js.map +1 -1
- package/graphqlFields/file.js +3 -1
- package/graphqlFields/file.js.map +1 -1
- package/graphqlFields/helpers.d.ts +0 -1
- package/graphqlFields/helpers.js +6 -18
- package/graphqlFields/helpers.js.map +1 -1
- package/graphqlFields/index.js +5 -2
- package/graphqlFields/index.js.map +1 -1
- package/graphqlFields/json.d.ts +2 -0
- package/graphqlFields/json.js +49 -0
- package/graphqlFields/json.js.map +1 -0
- package/graphqlFields/longText.js +14 -3
- package/graphqlFields/longText.js.map +1 -1
- package/graphqlFields/number.js +4 -1
- package/graphqlFields/number.js.map +1 -1
- package/graphqlFields/object.js +33 -34
- package/graphqlFields/object.js.map +1 -1
- package/graphqlFields/ref.js +68 -28
- package/graphqlFields/ref.js.map +1 -1
- package/graphqlFields/richText/RichTextPluginsProcessor.d.ts +6 -0
- package/graphqlFields/richText/RichTextPluginsProcessor.js +34 -0
- package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -0
- package/graphqlFields/richText/richTextResolver.d.ts +7 -0
- package/graphqlFields/richText/richTextResolver.js +39 -0
- package/graphqlFields/richText/richTextResolver.js.map +1 -0
- package/graphqlFields/richText.js +11 -3
- package/graphqlFields/richText.js.map +1 -1
- package/graphqlFields/text.js +5 -1
- package/graphqlFields/text.js.map +1 -1
- package/htmlRenderer/LexicalRenderer.d.ts +5 -0
- package/htmlRenderer/LexicalRenderer.js +28 -0
- package/htmlRenderer/LexicalRenderer.js.map +1 -0
- package/htmlRenderer/createLexicalHTMLRenderer.d.ts +2 -0
- package/htmlRenderer/createLexicalHTMLRenderer.js +31 -0
- package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -0
- package/index.d.ts +5 -2
- package/index.js +44 -6
- package/index.js.map +1 -1
- package/modelManager/DefaultCmsModelManager.js +3 -5
- package/modelManager/DefaultCmsModelManager.js.map +1 -1
- package/modelManager/index.js +3 -1
- package/modelManager/index.js.map +1 -1
- package/package.json +36 -40
- package/parameters/context.js +4 -2
- package/parameters/context.js.map +1 -1
- package/parameters/header.js +7 -6
- package/parameters/header.js.map +1 -1
- package/parameters/index.js +3 -1
- package/parameters/index.js.map +1 -1
- package/parameters/manual.js +9 -4
- package/parameters/manual.js.map +1 -1
- package/parameters/path.js +4 -3
- package/parameters/path.js.map +1 -1
- package/plugins/CmsGraphQLSchemaPlugin.js +5 -4
- package/plugins/CmsGraphQLSchemaPlugin.js.map +1 -1
- package/plugins/CmsGraphQLSchemaSorterPlugin.js +4 -5
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -1
- package/plugins/CmsGroupPlugin.d.ts +6 -3
- package/plugins/CmsGroupPlugin.js +8 -6
- package/plugins/CmsGroupPlugin.js.map +1 -1
- package/plugins/CmsModelFieldConverterPlugin.js +5 -4
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
- package/plugins/CmsModelPlugin.d.ts +25 -5
- package/plugins/CmsModelPlugin.js +75 -20
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/plugins/CmsParametersPlugin.js +7 -4
- package/plugins/CmsParametersPlugin.js.map +1 -1
- package/plugins/CmsRichTextRendererPlugin.d.ts +24 -0
- package/plugins/CmsRichTextRendererPlugin.js +28 -0
- package/plugins/CmsRichTextRendererPlugin.js.map +1 -0
- package/plugins/StorageOperationsCmsModelPlugin.d.ts +23 -0
- package/plugins/StorageOperationsCmsModelPlugin.js +41 -0
- package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -0
- package/plugins/StorageTransformPlugin.d.ts +2 -2
- package/plugins/StorageTransformPlugin.js +3 -4
- package/plugins/StorageTransformPlugin.js.map +1 -1
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +25 -1
- package/plugins/index.js.map +1 -1
- package/storage/default.js +3 -1
- package/storage/default.js.map +1 -1
- package/storage/index.d.ts +1 -0
- package/storage/index.js +15 -0
- package/storage/index.js.map +1 -0
- package/storage/json.d.ts +2 -0
- package/storage/json.js +27 -0
- package/storage/json.js.map +1 -0
- package/storage/object.js +8 -8
- package/storage/object.js.map +1 -1
- package/types.d.ts +510 -334
- package/types.js +21 -21
- package/types.js.map +1 -1
- package/utils/access.d.ts +9 -8
- package/utils/access.js +12 -62
- package/utils/access.js.map +1 -1
- package/utils/caching/Cache.d.ts +2 -0
- package/utils/caching/Cache.js +51 -0
- package/utils/caching/Cache.js.map +1 -0
- package/utils/caching/CacheKey.d.ts +2 -0
- package/utils/caching/CacheKey.js +40 -0
- package/utils/caching/CacheKey.js.map +1 -0
- package/utils/caching/index.d.ts +2 -0
- package/utils/caching/index.js +29 -0
- package/utils/caching/index.js.map +1 -0
- package/utils/caching/types.d.ts +11 -0
- package/utils/caching/types.js +7 -0
- package/utils/caching/types.js.map +1 -0
- package/utils/converters/Converter.js +4 -5
- package/utils/converters/Converter.js.map +1 -1
- package/utils/converters/ConverterCollection.js +13 -7
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.d.ts +1 -5
- package/utils/converters/valueKeyStorageConverter.js +34 -21
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/createTypeFromFields.d.ts +1 -0
- package/utils/createTypeFromFields.js +14 -7
- package/utils/createTypeFromFields.js.map +1 -1
- package/utils/createTypeName.d.ts +0 -2
- package/utils/createTypeName.js +3 -9
- package/utils/createTypeName.js.map +1 -1
- package/utils/date.d.ts +10 -0
- package/utils/date.js +36 -0
- package/utils/date.js.map +1 -0
- package/utils/entryStorage.d.ts +4 -4
- package/utils/entryStorage.js +6 -4
- package/utils/entryStorage.js.map +1 -1
- package/utils/filterAsync.js +9 -8
- package/utils/filterAsync.js.map +1 -1
- package/utils/getBaseFieldType.d.ts +1 -3
- package/utils/getBaseFieldType.js +3 -1
- package/utils/getBaseFieldType.js.map +1 -1
- package/utils/getEntryDescription.d.ts +2 -0
- package/utils/getEntryDescription.js +19 -0
- package/utils/getEntryDescription.js.map +1 -0
- package/utils/getEntryImage.d.ts +2 -0
- package/utils/getEntryImage.js +19 -0
- package/utils/getEntryImage.js.map +1 -0
- package/utils/getEntryTitle.d.ts +1 -1
- package/utils/getEntryTitle.js +3 -1
- package/utils/getEntryTitle.js.map +1 -1
- package/utils/getSchemaFromFieldPlugins.d.ts +13 -2
- package/utils/getSchemaFromFieldPlugins.js +22 -4
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/identity.d.ts +2 -0
- package/utils/identity.js +20 -0
- package/utils/identity.js.map +1 -0
- package/utils/incrementEntryIdVersion.d.ts +5 -0
- package/utils/incrementEntryIdVersion.js +31 -0
- package/utils/incrementEntryIdVersion.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +18 -0
- package/utils/index.js.map +1 -0
- package/utils/permissions/EntriesPermissions.d.ts +4 -0
- package/utils/permissions/EntriesPermissions.js +11 -0
- package/utils/permissions/EntriesPermissions.js.map +1 -0
- package/utils/permissions/ModelGroupsPermissions.d.ts +9 -0
- package/utils/permissions/ModelGroupsPermissions.js +50 -0
- package/utils/permissions/ModelGroupsPermissions.js.map +1 -0
- package/utils/permissions/ModelsPermissions.d.ts +22 -0
- package/utils/permissions/ModelsPermissions.js +90 -0
- package/utils/permissions/ModelsPermissions.js.map +1 -0
- package/utils/renderFields.d.ts +4 -2
- package/utils/renderFields.js +13 -3
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.d.ts +2 -2
- package/utils/renderGetFilterFields.js +9 -21
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.d.ts +4 -2
- package/utils/renderInputFields.js +20 -6
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.d.ts +3 -1
- package/utils/renderListFilterFields.js +25 -22
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.d.ts +3 -2
- package/utils/renderSortEnum.js +10 -3
- package/utils/renderSortEnum.js.map +1 -1
- package/utils/toSlug.js +3 -1
- package/utils/toSlug.js.map +1 -1
- package/validators/dateGte.js +3 -1
- package/validators/dateGte.js.map +1 -1
- package/validators/dateLte.js +3 -1
- package/validators/dateLte.js.map +1 -1
- package/validators/gte.js +4 -3
- package/validators/gte.js.map +1 -1
- package/validators/in.js +4 -3
- package/validators/in.js.map +1 -1
- package/validators/index.js +4 -3
- package/validators/index.js.map +1 -1
- package/validators/lte.js +4 -3
- package/validators/lte.js.map +1 -1
- package/validators/maxLength.js +4 -3
- package/validators/maxLength.js.map +1 -1
- package/validators/minLength.js +4 -3
- package/validators/minLength.js.map +1 -1
- package/validators/pattern.js +5 -3
- package/validators/pattern.js.map +1 -1
- package/validators/patternPlugins/email.js +3 -1
- package/validators/patternPlugins/email.js.map +1 -1
- package/validators/patternPlugins/index.js +3 -1
- package/validators/patternPlugins/index.js.map +1 -1
- package/validators/patternPlugins/lowerCase.js +3 -1
- package/validators/patternPlugins/lowerCase.js.map +1 -1
- package/validators/patternPlugins/lowerCaseSpace.js +3 -1
- package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
- package/validators/patternPlugins/upperCase.js +3 -1
- package/validators/patternPlugins/upperCase.js.map +1 -1
- package/validators/patternPlugins/upperCaseSpace.js +3 -1
- package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
- package/validators/patternPlugins/url.js +3 -1
- package/validators/patternPlugins/url.js.map +1 -1
- package/validators/required.js +3 -1
- package/validators/required.js.map +1 -1
- package/validators/timeGte.js +4 -3
- package/validators/timeGte.js.map +1 -1
- package/validators/timeLte.js +4 -3
- package/validators/timeLte.js.map +1 -1
- package/validators/unique.js +4 -2
- package/validators/unique.js.map +1 -1
- package/crud/contentModel/afterCreate.d.ts +0 -8
- package/crud/contentModel/afterCreate.js +0 -16
- package/crud/contentModel/afterCreate.js.map +0 -1
- package/crud/contentModel/afterCreateFrom.d.ts +0 -8
- package/crud/contentModel/afterCreateFrom.js +0 -16
- package/crud/contentModel/afterCreateFrom.js.map +0 -1
- package/crud/contentModel/afterDelete.d.ts +0 -8
- package/crud/contentModel/afterDelete.js +0 -16
- package/crud/contentModel/afterDelete.js.map +0 -1
- package/crud/contentModel/afterUpdate.d.ts +0 -8
- package/crud/contentModel/afterUpdate.js +0 -16
- package/crud/contentModel/afterUpdate.js.map +0 -1
- package/crud/contentModel/createFieldModels.d.ts +0 -2
- package/crud/contentModel/createFieldModels.js +0 -26
- package/crud/contentModel/createFieldModels.js.map +0 -1
- package/crud/contentModel/fieldIdValidation.d.ts +0 -1
- package/crud/contentModel/fieldIdValidation.js +0 -25
- package/crud/contentModel/fieldIdValidation.js.map +0 -1
- package/crud/contentModel/idValidation.d.ts +0 -1
- package/crud/contentModel/idValidation.js +0 -22
- package/crud/contentModel/idValidation.js.map +0 -1
- package/crud/contentModel/models.d.ts +0 -4
- package/crud/contentModel/models.js +0 -192
- package/crud/contentModel/models.js.map +0 -1
- package/crud/contentModel/systemFields.d.ts +0 -1
- package/crud/contentModel/systemFields.js +0 -8
- package/crud/contentModel/systemFields.js.map +0 -1
- package/crud/contentModel/validateLayout.d.ts +0 -2
- package/crud/contentModel/validateLayout.js +0 -28
- package/crud/contentModel/validateLayout.js.map +0 -1
- package/crud/settings.crud.d.ts +0 -10
- package/crud/settings.crud.js +0 -71
- package/crud/settings.crud.js.map +0 -1
- package/graphql/schema/resolvers/commonFieldResolvers.d.ts +0 -6
- package/graphql/schema/resolvers/commonFieldResolvers.js +0 -12
- package/graphql/schema/resolvers/commonFieldResolvers.js.map +0 -1
- package/upgrades/5.33.0/index.d.ts +0 -3
- package/upgrades/5.33.0/index.js +0 -159
- package/upgrades/5.33.0/index.js.map +0 -1
- package/upgrades/index.d.ts +0 -1
- package/upgrades/index.js +0 -9
- package/upgrades/index.js.map +0 -1
- package/utils/ownership.d.ts +0 -8
- package/utils/ownership.js +0 -33
- package/utils/ownership.js.map +0 -1
- package/utils/permissions.d.ts +0 -7
- package/utils/permissions.js +0 -91
- package/utils/permissions.js.map +0 -1
- package/utils/pluralizedTypeName.d.ts +0 -1
- package/utils/pluralizedTypeName.js +0 -20
- package/utils/pluralizedTypeName.js.map +0 -1
- package/validators/dynamicZone.d.ts +0 -2
- package/validators/dynamicZone.js +0 -20
- package/validators/dynamicZone.js.map +0 -1
package/parameters/header.js
CHANGED
|
@@ -7,18 +7,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createHeaderParameterPlugin = void 0;
|
|
8
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
9
|
var _CmsParametersPlugin = require("../plugins/CmsParametersPlugin");
|
|
10
|
-
var HeaderKeys
|
|
11
|
-
(function (HeaderKeys) {
|
|
10
|
+
var HeaderKeys = /*#__PURE__*/function (HeaderKeys) {
|
|
12
11
|
HeaderKeys["TYPE"] = "x-webiny-cms-endpoint";
|
|
13
12
|
HeaderKeys["LOCALE"] = "x-webiny-cms-locale";
|
|
14
|
-
|
|
13
|
+
return HeaderKeys;
|
|
14
|
+
}(HeaderKeys || {});
|
|
15
15
|
const createHeaderParameterPlugin = () => {
|
|
16
16
|
return new _CmsParametersPlugin.CmsParametersPlugin(async context => {
|
|
17
|
-
var _context$request;
|
|
18
17
|
/**
|
|
19
18
|
* If any of the properties is not defined, just ignore this plugin
|
|
20
19
|
*/
|
|
21
|
-
if (!
|
|
20
|
+
if (!context.request?.headers) {
|
|
22
21
|
return null;
|
|
23
22
|
}
|
|
24
23
|
const headers = context.request.headers;
|
|
@@ -41,4 +40,6 @@ const createHeaderParameterPlugin = () => {
|
|
|
41
40
|
};
|
|
42
41
|
});
|
|
43
42
|
};
|
|
44
|
-
exports.createHeaderParameterPlugin = createHeaderParameterPlugin;
|
|
43
|
+
exports.createHeaderParameterPlugin = createHeaderParameterPlugin;
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=header.js.map
|
package/parameters/header.js.map
CHANGED
|
@@ -1 +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/
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsParametersPlugin","HeaderKeys","createHeaderParameterPlugin","CmsParametersPlugin","context","request","headers","type","TYPE","locale","LOCALE","WebinyError","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAAoE,IAG/DE,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA,EAAVA,UAAU;AAKR,MAAMC,2BAA2B,GAAGA,CAAA,KAAM;EAC7C,OAAO,IAAIC,wCAAmB,CAAC,MAAMC,OAAO,IAAI;IAC5C;AACR;AACA;IACQ,IAAI,CAACA,OAAO,CAACC,OAAO,EAAEC,OAAO,EAAE;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,CACJ,CAAC;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,CACJ,CAAC;IACL;IAEA,OAAO;MACHC,IAAI,EAAEA,IAAmB;MACzBE;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAV,2BAAA,GAAAA,2BAAA"}
|
package/parameters/index.js
CHANGED
package/parameters/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./manual\";\nexport * from \"./path\";\nexport * from \"./context\";\nexport * from \"./header\";\n"],"mappings":";;;;;AAAA;
|
|
1
|
+
{"version":3,"names":["_manual","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_path","_context","_header"],"sources":["index.ts"],"sourcesContent":["export * from \"./manual\";\nexport * from \"./path\";\nexport * from \"./context\";\nexport * from \"./header\";\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAA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ule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.createManualPlugin = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
10
9
|
var _CmsParametersPlugin = require("../plugins/CmsParametersPlugin");
|
|
11
10
|
/**
|
|
@@ -24,9 +23,13 @@ const createManualPlugin = params => {
|
|
|
24
23
|
if (!type && !locale) {
|
|
25
24
|
return null;
|
|
26
25
|
} else if (!type) {
|
|
27
|
-
throw new _error.default(`There is defined "locale" CMS parameter but no "endpointType".`, "MALFORMED_ENDPOINT_TYPE",
|
|
26
|
+
throw new _error.default(`There is defined "locale" CMS parameter but no "endpointType".`, "MALFORMED_ENDPOINT_TYPE", {
|
|
27
|
+
...params
|
|
28
|
+
});
|
|
28
29
|
} else if (!locale) {
|
|
29
|
-
throw new _error.default(`There is defined "endpointType" CMS parameter but no "locale".`, "MALFORMED_LOCALE_TYPE",
|
|
30
|
+
throw new _error.default(`There is defined "endpointType" CMS parameter but no "locale".`, "MALFORMED_LOCALE_TYPE", {
|
|
31
|
+
...params
|
|
32
|
+
});
|
|
30
33
|
}
|
|
31
34
|
return {
|
|
32
35
|
type,
|
|
@@ -34,4 +37,6 @@ const createManualPlugin = params => {
|
|
|
34
37
|
};
|
|
35
38
|
});
|
|
36
39
|
};
|
|
37
|
-
exports.createManualPlugin = createManualPlugin;
|
|
40
|
+
exports.createManualPlugin = createManualPlugin;
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=manual.js.map
|
package/parameters/manual.js.map
CHANGED
|
@@ -1 +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":"
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsParametersPlugin","createManualPlugin","params","CmsParametersPlugin","endpointType","type","locale","WebinyError","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAaO,MAAME,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,EACzB;QACI,GAAGL;MACP,CACJ,CAAC;IACL,CAAC,MAAM,IAAI,CAACI,MAAM,EAAE;MAChB,MAAM,IAAIC,cAAW,CAChB,gEAA+D,EAChE,uBAAuB,EACvB;QACI,GAAGL;MACP,CACJ,CAAC;IACL;IAEA,OAAO;MACHG,IAAI;MACJC;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAP,kBAAA,GAAAA,kBAAA"}
|
package/parameters/path.js
CHANGED
|
@@ -10,11 +10,10 @@ var _CmsParametersPlugin = require("../plugins/CmsParametersPlugin");
|
|
|
10
10
|
const allowedEndpoints = ["manage", "read", "preview"];
|
|
11
11
|
const createPathParameterPlugin = () => {
|
|
12
12
|
return new _CmsParametersPlugin.CmsParametersPlugin(async context => {
|
|
13
|
-
var _context$request;
|
|
14
13
|
/**
|
|
15
14
|
* If any of the properties is not defined, just ignore this plugin
|
|
16
15
|
*/
|
|
17
|
-
if (!
|
|
16
|
+
if (!context.request?.params) {
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
20
19
|
const {
|
|
@@ -37,4 +36,6 @@ const createPathParameterPlugin = () => {
|
|
|
37
36
|
};
|
|
38
37
|
});
|
|
39
38
|
};
|
|
40
|
-
exports.createPathParameterPlugin = createPathParameterPlugin;
|
|
39
|
+
exports.createPathParameterPlugin = createPathParameterPlugin;
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=path.js.map
|
package/parameters/path.js.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsParametersPlugin","allowedEndpoints","createPathParameterPlugin","CmsParametersPlugin","context","request","params","type","locale","WebinyError","includes","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAGA,MAAME,gBAA+B,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;AAE9D,MAAMC,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,IAAIC,wCAAmB,CAAC,MAAMC,OAAO,IAAI;IAC5C;AACR;AACA;IACQ,IAAI,CAACA,OAAO,CAACC,OAAO,EAAEC,MAAM,EAAE;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,IAAmB,CAAC,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;AAACG,OAAA,CAAAT,yBAAA,GAAAA,yBAAA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.CmsGraphQLSchemaPlugin = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
10
|
-
class CmsGraphQLSchemaPlugin extends _handlerGraphql.GraphQLSchemaPlugin {
|
|
8
|
+
class CmsGraphQLSchemaPlugin extends _handlerGraphql.GraphQLSchemaPlugin {
|
|
9
|
+
static type = "cms.graphql.schema";
|
|
10
|
+
}
|
|
11
11
|
exports.CmsGraphQLSchemaPlugin = CmsGraphQLSchemaPlugin;
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=CmsGraphQLSchemaPlugin.js.map
|
|
@@ -1 +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":"
|
|
1
|
+
{"version":3,"names":["_handlerGraphql","require","CmsGraphQLSchemaPlugin","GraphQLSchemaPlugin","type","exports"],"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,IAAAA,eAAA,GAAAC,OAAA;AAGO,MAAMC,sBAAsB,SAAyBC,mCAAmB,CAAI;EAC/E,OAAuBC,IAAI,GAAG,oBAAoB;AACtD;AAACC,OAAA,CAAAH,sBAAA,GAAAA,sBAAA"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.createCmsGraphQLSchemaSorterPlugin = exports.CmsGraphQLSchemaSorterPlugin = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _plugins = require("@webiny/plugins");
|
|
10
8
|
class CmsGraphQLSchemaSorterPlugin extends _plugins.Plugin {
|
|
9
|
+
static type = "cms.graphql.schema.sorter";
|
|
11
10
|
constructor(cb) {
|
|
12
11
|
super();
|
|
13
|
-
(0, _defineProperty2.default)(this, "cb", void 0);
|
|
14
12
|
this.cb = cb;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
@@ -21,8 +19,9 @@ class CmsGraphQLSchemaSorterPlugin extends _plugins.Plugin {
|
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
exports.CmsGraphQLSchemaSorterPlugin = CmsGraphQLSchemaSorterPlugin;
|
|
24
|
-
(0, _defineProperty2.default)(CmsGraphQLSchemaSorterPlugin, "type", "cms.graphql.schema.sorter");
|
|
25
22
|
const createCmsGraphQLSchemaSorterPlugin = cb => {
|
|
26
23
|
return new CmsGraphQLSchemaSorterPlugin(cb);
|
|
27
24
|
};
|
|
28
|
-
exports.createCmsGraphQLSchemaSorterPlugin = createCmsGraphQLSchemaSorterPlugin;
|
|
25
|
+
exports.createCmsGraphQLSchemaSorterPlugin = createCmsGraphQLSchemaSorterPlugin;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=CmsGraphQLSchemaSorterPlugin.js.map
|
|
@@ -1 +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":"
|
|
1
|
+
{"version":3,"names":["_plugins","require","CmsGraphQLSchemaSorterPlugin","Plugin","type","constructor","cb","createSorter","params","exports","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,IAAAA,QAAA,GAAAC,OAAA;AAUO,MAAMC,4BAA4B,SAASC,eAAM,CAAC;EACrD,OAAgCC,IAAI,GAAW,2BAA2B;EAGnEC,WAAWA,CAACC,EAAwC,EAAE;IACzD,KAAK,CAAC,CAAC;IAEP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EACA;AACJ;AACA;EACWC,YAAYA,CAACC,MAAkD,EAAY;IAC9E,OAAO,IAAI,CAACF,EAAE,CAACE,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAP,4BAAA,GAAAA,4BAAA;AAEM,MAAMQ,kCAAkC,GAC3CJ,EAAwC,IACT;EAC/B,OAAO,IAAIJ,4BAA4B,CAACI,EAAE,CAAC;AAC/C,CAAC;AAACG,OAAA,CAAAC,kCAAA,GAAAA,kCAAA"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
2
|
import { CmsGroup as BaseCmsGroup } from "../types";
|
|
3
|
-
interface
|
|
3
|
+
export interface CmsGroupInput extends Omit<BaseCmsGroup, "locale" | "tenant" | "webinyVersion" | "isPlugin"> {
|
|
4
|
+
tenant?: string;
|
|
5
|
+
locale?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CmsGroup extends Omit<BaseCmsGroup, "locale" | "tenant" | "webinyVersion"> {
|
|
4
8
|
tenant?: string;
|
|
5
9
|
locale?: string;
|
|
6
10
|
}
|
|
7
11
|
export declare class CmsGroupPlugin extends Plugin {
|
|
8
12
|
static readonly type: string;
|
|
9
13
|
readonly contentModelGroup: CmsGroup;
|
|
10
|
-
constructor(contentModelGroup:
|
|
14
|
+
constructor(contentModelGroup: CmsGroupInput);
|
|
11
15
|
}
|
|
12
16
|
export declare const createCmsGroup: (group: CmsGroup) => CmsGroupPlugin;
|
|
13
|
-
export {};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.createCmsGroup = exports.CmsGroupPlugin = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _plugins = require("@webiny/plugins");
|
|
10
8
|
class CmsGroupPlugin extends _plugins.Plugin {
|
|
9
|
+
static type = "cms-content-model-group";
|
|
11
10
|
constructor(contentModelGroup) {
|
|
12
11
|
super();
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
this.contentModelGroup = {
|
|
13
|
+
...contentModelGroup,
|
|
14
|
+
isPlugin: true
|
|
15
|
+
};
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
exports.CmsGroupPlugin = CmsGroupPlugin;
|
|
18
|
-
(0, _defineProperty2.default)(CmsGroupPlugin, "type", "cms-content-model-group");
|
|
19
19
|
const createCmsGroup = group => {
|
|
20
20
|
return new CmsGroupPlugin(group);
|
|
21
21
|
};
|
|
22
|
-
exports.createCmsGroup = createCmsGroup;
|
|
22
|
+
exports.createCmsGroup = createCmsGroup;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=CmsGroupPlugin.js.map
|
|
@@ -1 +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\
|
|
1
|
+
{"version":3,"names":["_plugins","require","CmsGroupPlugin","Plugin","type","constructor","contentModelGroup","isPlugin","exports","createCmsGroup","group"],"sources":["CmsGroupPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsGroup as BaseCmsGroup } from \"~/types\";\n\nexport interface CmsGroupInput\n extends Omit<BaseCmsGroup, \"locale\" | \"tenant\" | \"webinyVersion\" | \"isPlugin\"> {\n tenant?: string;\n locale?: string;\n}\n\nexport interface CmsGroup extends Omit<BaseCmsGroup, \"locale\" | \"tenant\" | \"webinyVersion\"> {\n tenant?: string;\n locale?: string;\n}\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: CmsGroupInput) {\n super();\n this.contentModelGroup = {\n ...contentModelGroup,\n isPlugin: true\n };\n }\n}\n\nexport const createCmsGroup = (group: CmsGroup): CmsGroupPlugin => {\n return new CmsGroupPlugin(group);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAcO,MAAMC,cAAc,SAASC,eAAM,CAAC;EACvC,OAAgCC,IAAI,GAAW,yBAAyB;EAGxEC,WAAWA,CAACC,iBAAgC,EAAE;IAC1C,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,iBAAiB,GAAG;MACrB,GAAGA,iBAAiB;MACpBC,QAAQ,EAAE;IACd,CAAC;EACL;AACJ;AAACC,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAEM,MAAMO,cAAc,GAAIC,KAAe,IAAqB;EAC/D,OAAO,IAAIR,cAAc,CAACQ,KAAK,CAAC;AACpC,CAAC;AAACF,OAAA,CAAAC,cAAA,GAAAA,cAAA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.CmsModelFieldConverterPlugin = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _plugins = require("@webiny/plugins");
|
|
10
|
-
class CmsModelFieldConverterPlugin extends _plugins.Plugin {
|
|
8
|
+
class CmsModelFieldConverterPlugin extends _plugins.Plugin {
|
|
9
|
+
static type = "cms.field.converter";
|
|
10
|
+
}
|
|
11
11
|
exports.CmsModelFieldConverterPlugin = CmsModelFieldConverterPlugin;
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=CmsModelFieldConverterPlugin.js.map
|
|
@@ -1 +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":"
|
|
1
|
+
{"version":3,"names":["_plugins","require","CmsModelFieldConverterPlugin","Plugin","type","exports"],"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,IAAAA,QAAA,GAAAC,OAAA;AAUO,MAAeC,4BAA4B,SAASC,eAAM,CAAC;EAC9D,OAAuBC,IAAI,GAAG,qBAAqB;AAMvD;AAACC,OAAA,CAAAH,4BAAA,GAAAA,4BAAA"}
|
|
@@ -20,12 +20,31 @@ interface CmsModelFieldInput extends Omit<CmsModelFieldBase, "storageId" | "sett
|
|
|
20
20
|
*/
|
|
21
21
|
settings?: CmsModelFieldSettings;
|
|
22
22
|
}
|
|
23
|
-
interface
|
|
23
|
+
export interface CmsApiModel extends Omit<CmsModelPluginModel, "isPrivate" | "fields" | "singularApiName" | "pluralApiName" | "isPlugin"> {
|
|
24
|
+
isPrivate?: never;
|
|
25
|
+
noValidate?: never;
|
|
26
|
+
singularApiName?: string;
|
|
27
|
+
pluralApiName?: string;
|
|
24
28
|
fields: CmsModelFieldInput[];
|
|
25
|
-
locale?: string;
|
|
26
|
-
tenant?: string;
|
|
27
29
|
}
|
|
28
|
-
interface
|
|
30
|
+
export interface CmsApiModelFull extends Omit<CmsApiModel, "fields" | "noValidate"> {
|
|
31
|
+
noValidate: true;
|
|
32
|
+
fields: CmsModelFieldBase[];
|
|
33
|
+
}
|
|
34
|
+
interface CmsPrivateModel extends Omit<CmsModelPluginModel, "isPrivate" | "singularApiName" | "pluralApiName" | "fields" | "isPlugin" | "layout" | "titleFieldId" | "description"> {
|
|
35
|
+
noValidate?: never;
|
|
36
|
+
titleFieldId?: string;
|
|
37
|
+
singularApiName?: never;
|
|
38
|
+
pluralApiName?: never;
|
|
39
|
+
isPrivate: true;
|
|
40
|
+
fields: CmsModelFieldInput[];
|
|
41
|
+
}
|
|
42
|
+
export interface CmsPrivateModelFull extends Omit<CmsPrivateModel, "fields" | "noValidate"> {
|
|
43
|
+
fields: CmsModelFieldBase[];
|
|
44
|
+
noValidate: true;
|
|
45
|
+
}
|
|
46
|
+
export declare type CmsModelInput = CmsApiModel | CmsPrivateModel | CmsApiModelFull | CmsPrivateModelFull;
|
|
47
|
+
export interface CmsModelPluginModel extends Omit<CmsModelBase, "locale" | "tenant" | "webinyVersion"> {
|
|
29
48
|
locale?: string;
|
|
30
49
|
tenant?: string;
|
|
31
50
|
}
|
|
@@ -34,7 +53,7 @@ interface CmsModelPluginOptions {
|
|
|
34
53
|
}
|
|
35
54
|
export declare class CmsModelPlugin extends Plugin {
|
|
36
55
|
static readonly type: string;
|
|
37
|
-
readonly contentModel:
|
|
56
|
+
readonly contentModel: CmsModelPluginModel;
|
|
38
57
|
private readonly options;
|
|
39
58
|
constructor(contentModel: CmsModelInput, options?: CmsModelPluginOptions);
|
|
40
59
|
private buildModel;
|
|
@@ -42,4 +61,5 @@ export declare class CmsModelPlugin extends Plugin {
|
|
|
42
61
|
private validateLayout;
|
|
43
62
|
}
|
|
44
63
|
export declare const createCmsModel: (model: CmsModelInput, options?: CmsModelPluginOptions) => CmsModelPlugin;
|
|
64
|
+
export declare const createPrivateModelDefinition: (input: Omit<CmsPrivateModelFull, "group" | "isPrivate" | "noValidate">) => CmsPrivateModelFull;
|
|
45
65
|
export {};
|
|
@@ -4,25 +4,66 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
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 _plugins = require("@webiny/plugins");
|
|
7
|
+
exports.createPrivateModelDefinition = exports.createCmsModel = exports.CmsModelPlugin = void 0;
|
|
11
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
12
|
-
var _createFieldStorageId = require("../crud/contentModel/createFieldStorageId");
|
|
13
9
|
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
10
|
+
var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
|
|
11
|
+
var _pluralize = _interopRequireDefault(require("pluralize"));
|
|
12
|
+
var _plugins = require("@webiny/plugins");
|
|
13
|
+
var _createFieldStorageId = require("../crud/contentModel/createFieldStorageId");
|
|
14
|
+
const createApiName = name => {
|
|
15
|
+
return (0, _upperFirst.default)((0, _camelCase.default)(name));
|
|
16
|
+
};
|
|
17
|
+
const createPluralApiName = name => {
|
|
18
|
+
return (0, _pluralize.default)(createApiName(name));
|
|
19
|
+
};
|
|
14
20
|
class CmsModelPlugin extends _plugins.Plugin {
|
|
21
|
+
static type = "cms-content-model";
|
|
15
22
|
constructor(contentModel, options) {
|
|
16
23
|
super();
|
|
17
|
-
(0, _defineProperty2.default)(this, "contentModel", void 0);
|
|
18
|
-
(0, _defineProperty2.default)(this, "options", void 0);
|
|
19
24
|
this.options = options || {};
|
|
20
25
|
this.contentModel = this.buildModel(contentModel);
|
|
21
26
|
}
|
|
22
27
|
buildModel(input) {
|
|
23
|
-
const
|
|
28
|
+
const isPrivate = input.isPrivate ?? false;
|
|
29
|
+
const singularApiName = input.singularApiName ? createApiName(input.singularApiName) : createApiName(input.name);
|
|
30
|
+
const pluralApiName = input.pluralApiName ? createApiName(input.pluralApiName) : createPluralApiName(input.name);
|
|
31
|
+
const modelPlugin = {
|
|
32
|
+
group: {
|
|
33
|
+
id: "",
|
|
34
|
+
name: ""
|
|
35
|
+
},
|
|
36
|
+
description: "",
|
|
37
|
+
fields: [],
|
|
38
|
+
isPlugin: true,
|
|
39
|
+
isPrivate,
|
|
40
|
+
layout: [],
|
|
41
|
+
modelId: input.modelId,
|
|
42
|
+
name: input.name,
|
|
43
|
+
pluralApiName,
|
|
44
|
+
singularApiName,
|
|
45
|
+
titleFieldId: "id"
|
|
46
|
+
};
|
|
47
|
+
if (input.noValidate) {
|
|
48
|
+
/**
|
|
49
|
+
* We can safely ignore this error, because we are sure noValidate is not a model field.
|
|
50
|
+
*/
|
|
51
|
+
// @ts-expect-error
|
|
52
|
+
delete input["noValidate"];
|
|
53
|
+
return {
|
|
54
|
+
...modelPlugin,
|
|
55
|
+
...input,
|
|
56
|
+
pluralApiName,
|
|
57
|
+
singularApiName
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const model = {
|
|
61
|
+
...modelPlugin,
|
|
62
|
+
...input,
|
|
63
|
+
pluralApiName,
|
|
64
|
+
singularApiName,
|
|
24
65
|
fields: this.buildFields(input, input.fields)
|
|
25
|
-
}
|
|
66
|
+
};
|
|
26
67
|
this.validateLayout(model);
|
|
27
68
|
return model;
|
|
28
69
|
}
|
|
@@ -36,7 +77,6 @@ class CmsModelPlugin extends _plugins.Plugin {
|
|
|
36
77
|
const storageIdList = [];
|
|
37
78
|
const fieldIdList = [];
|
|
38
79
|
for (const input of inputFields) {
|
|
39
|
-
var _settings;
|
|
40
80
|
/**
|
|
41
81
|
* Field must contain an fieldId. It is required in the graphql, but lets check it just in case
|
|
42
82
|
*/
|
|
@@ -68,7 +108,7 @@ class CmsModelPlugin extends _plugins.Plugin {
|
|
|
68
108
|
/**
|
|
69
109
|
* ... and fieldId must be unique.
|
|
70
110
|
*/
|
|
71
|
-
if (fieldIdList.includes(fieldId)
|
|
111
|
+
if (fieldIdList.includes(fieldId)) {
|
|
72
112
|
throw new _error.default(`Field's "fieldId" is not unique in the content model "${model.modelId}".`, "FIELD_ID_NOT_UNIQUE_ERROR", {
|
|
73
113
|
model,
|
|
74
114
|
field: input
|
|
@@ -91,7 +131,7 @@ class CmsModelPlugin extends _plugins.Plugin {
|
|
|
91
131
|
/**
|
|
92
132
|
* Fields storageId must be unique.
|
|
93
133
|
*/
|
|
94
|
-
if (storageIdList.includes(storageId)
|
|
134
|
+
if (storageIdList.includes(storageId)) {
|
|
95
135
|
throw new _error.default(`Field's "storageId" is not unique in the content model "${model.modelId}".`, "STORAGE_ID_ERROR", {
|
|
96
136
|
model,
|
|
97
137
|
field: input
|
|
@@ -101,18 +141,20 @@ class CmsModelPlugin extends _plugins.Plugin {
|
|
|
101
141
|
/**
|
|
102
142
|
* We can safely ignore error because we are going through the fields and making sure each has storageId.
|
|
103
143
|
*/
|
|
104
|
-
// @ts-
|
|
144
|
+
// @ts-expect-error
|
|
105
145
|
let settings = input.settings;
|
|
106
|
-
const childFields =
|
|
146
|
+
const childFields = settings?.fields || [];
|
|
107
147
|
if (input.type === "object" && childFields.length > 0) {
|
|
108
|
-
settings =
|
|
148
|
+
settings = {
|
|
149
|
+
...(settings || {}),
|
|
109
150
|
fields: this.buildFields(model, childFields)
|
|
110
|
-
}
|
|
151
|
+
};
|
|
111
152
|
}
|
|
112
|
-
const field =
|
|
153
|
+
const field = {
|
|
154
|
+
...input,
|
|
113
155
|
settings,
|
|
114
156
|
storageId
|
|
115
|
-
}
|
|
157
|
+
};
|
|
116
158
|
/**
|
|
117
159
|
* Add all relevant data to arrays.
|
|
118
160
|
*/
|
|
@@ -151,8 +193,21 @@ class CmsModelPlugin extends _plugins.Plugin {
|
|
|
151
193
|
}
|
|
152
194
|
}
|
|
153
195
|
exports.CmsModelPlugin = CmsModelPlugin;
|
|
154
|
-
(0, _defineProperty2.default)(CmsModelPlugin, "type", "cms-content-model");
|
|
155
196
|
const createCmsModel = (model, options) => {
|
|
156
197
|
return new CmsModelPlugin(model, options);
|
|
157
198
|
};
|
|
158
|
-
exports.createCmsModel = createCmsModel;
|
|
199
|
+
exports.createCmsModel = createCmsModel;
|
|
200
|
+
const createPrivateModelDefinition = input => {
|
|
201
|
+
return {
|
|
202
|
+
...input,
|
|
203
|
+
isPrivate: true,
|
|
204
|
+
noValidate: true,
|
|
205
|
+
group: {
|
|
206
|
+
id: "private",
|
|
207
|
+
name: "Private Models"
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
exports.createPrivateModelDefinition = createPrivateModelDefinition;
|
|
212
|
+
|
|
213
|
+
//# sourceMappingURL=CmsModelPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CmsModelPlugin","Plugin","constructor","contentModel","options","buildModel","input","model","fields","buildFields","validateLayout","inputFields","length","WebinyError","modelId","storageIdList","fieldIdList","fieldId","trim","field","lodashCamelCase","match","includes","storageId","createFieldStorageId","settings","childFields","type","push","total","row","layout","count","filter","cell","id","createCmsModel"],"sources":["CmsModelPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n CmsModel as CmsModelBase,\n CmsModelField as CmsModelFieldBase,\n CmsModelFieldSettings as BaseCmsModelFieldSettings\n} from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { createFieldStorageId } from \"~/crud/contentModel/createFieldStorageId\";\nimport lodashCamelCase from \"lodash/camelCase\";\n\ninterface CmsModelFieldSettings extends Omit<BaseCmsModelFieldSettings, \"fields\"> {\n /**\n * Object field has child fields.\n */\n fields?: CmsModelFieldInput[];\n}\n\ninterface CmsModelFieldInput extends Omit<CmsModelFieldBase, \"storageId\" | \"settings\"> {\n /**\n * If defined, it must be camelCased string.\n * This is for backwards compatibility - before fields had storageId.\n *\n * This should only be populated in old model fields.\n * News ones must have this empty.\n */\n storageId?: string;\n /**\n * We must have a possibility to have a nested field defined without the storageId.\n */\n settings?: CmsModelFieldSettings;\n}\n\ninterface CmsModelInput\n extends Omit<CmsModelBase, \"locale\" | \"tenant\" | \"webinyVersion\" | \"fields\"> {\n fields: CmsModelFieldInput[];\n locale?: string;\n tenant?: string;\n}\ninterface CmsModel extends Omit<CmsModelBase, \"locale\" | \"tenant\" | \"webinyVersion\"> {\n locale?: string;\n tenant?: string;\n}\n\ninterface CmsModelPluginOptions {\n validateLayout?: boolean;\n}\n\nexport class CmsModelPlugin extends Plugin {\n public static override readonly type: string = \"cms-content-model\";\n public readonly contentModel: CmsModel;\n\n private readonly options: CmsModelPluginOptions;\n\n constructor(contentModel: CmsModelInput, options?: CmsModelPluginOptions) {\n super();\n this.options = options || {};\n this.contentModel = this.buildModel(contentModel);\n }\n\n private buildModel(input: CmsModelInput): CmsModel {\n const model: CmsModel = {\n ...input,\n fields: this.buildFields(input, input.fields)\n };\n this.validateLayout(model);\n return model;\n }\n\n private buildFields(\n model: CmsModelInput,\n inputFields: CmsModelFieldInput[]\n ): CmsModelFieldBase[] {\n if (inputFields.length === 0) {\n throw new WebinyError(\n `Missing fields for the defined model \"${model.modelId}\".`,\n \"MISSING_FIELDS\",\n {\n model\n }\n );\n }\n const fields: CmsModelFieldBase[] = [];\n const storageIdList: string[] = [];\n const fieldIdList: string[] = [];\n for (const input of inputFields) {\n /**\n * Field must contain an fieldId. It is required in the graphql, but lets check it just in case\n */\n if (!(input.fieldId || \"\").trim()) {\n throw new WebinyError(\n `Field's \"storageId\" is not defined for the content model \"${model.modelId}\".`,\n \"FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n const fieldId = lodashCamelCase(input.fieldId);\n /**\n * FieldID must be in correct pattern.\n */\n if (fieldId.match(/^[0-9]/) !== null) {\n throw new WebinyError(\n `Field's \"fieldId\" does not match correct pattern in the content model \"${model.modelId}\" - cannot start with a number.`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * FieldID also must be camelCased.\n */\n if (fieldId !== input.fieldId) {\n throw new WebinyError(\n `Field's \"fieldId\" must be a camel cased string in the content model \"${model.modelId}\".`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * ... and fieldId must be unique.\n */\n if (fieldIdList.includes(fieldId) === true) {\n throw new WebinyError(\n `Field's \"fieldId\" is not unique in the content model \"${model.modelId}\".`,\n \"FIELD_ID_NOT_UNIQUE_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n let storageId = input.storageId ? lodashCamelCase(input.storageId) : null;\n /**\n * If defined, storageId MUST be camel cased string - for backward compatibility.\n */\n if (\n storageId &&\n (storageId.match(/^([a-zA-Z-0-9]+)$/) === null || storageId !== input.storageId)\n ) {\n throw new WebinyError(\n `Field's \"storageId\" of the field with \"fieldId\" ${input.fieldId} is not camel cased string in the content model \"${model.modelId}\".`,\n \"STORAGE_ID_NOT_CAMEL_CASED_ERROR\",\n {\n model,\n storageId,\n field: input\n }\n );\n } else if (!storageId) {\n storageId = createFieldStorageId(input);\n }\n\n /**\n * Fields storageId must be unique.\n */\n if (storageIdList.includes(storageId) === true) {\n throw new WebinyError(\n `Field's \"storageId\" is not unique in the content model \"${model.modelId}\".`,\n \"STORAGE_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n /**\n * We can safely ignore error because we are going through the fields and making sure each has storageId.\n */\n // @ts-ignore\n let settings: BaseCmsModelFieldSettings = input.settings;\n\n const childFields = settings?.fields || [];\n if (input.type === \"object\" && childFields.length > 0) {\n settings = {\n ...(settings || {}),\n fields: this.buildFields(model, childFields)\n };\n }\n\n const field: CmsModelFieldBase = {\n ...input,\n settings,\n storageId\n };\n /**\n * Add all relevant data to arrays.\n */\n fields.push(field);\n storageIdList.push(field.storageId);\n fieldIdList.push(field.fieldId);\n }\n return fields;\n }\n\n private validateLayout(model: CmsModel): void {\n /**\n * Only skip validation if option.validateLayout was set as false, explicitly.\n */\n if (this.options.validateLayout === false) {\n return;\n }\n for (const field of model.fields) {\n let total = 0;\n for (const row of model.layout) {\n const count = row.filter(cell => cell === field.id).length;\n total = total + count;\n }\n if (total === 1) {\n continue;\n } else if (total > 1) {\n throw new WebinyError(\n `Field \"${field.id}\" is in more than one layout cell.`,\n \"DUPLICATE_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n throw new WebinyError(\n `Missing field \"${field.id}\" in layout.`,\n \"MISSING_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n }\n}\n\nexport const createCmsModel = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n"],"mappings":";;;;;;;;;AAAA;AAMA;AACA;AACA;AAuCO,MAAMA,cAAc,SAASC,eAAM,CAAC;EAMvCC,WAAW,CAACC,YAA2B,EAAEC,OAA+B,EAAE;IACtE,KAAK,EAAE;IAAC;IAAA;IACR,IAAI,CAACA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACD,YAAY,GAAG,IAAI,CAACE,UAAU,CAACF,YAAY,CAAC;EACrD;EAEQE,UAAU,CAACC,KAAoB,EAAY;IAC/C,MAAMC,KAAe,+DACdD,KAAK;MACRE,MAAM,EAAE,IAAI,CAACC,WAAW,CAACH,KAAK,EAAEA,KAAK,CAACE,MAAM;IAAC,EAChD;IACD,IAAI,CAACE,cAAc,CAACH,KAAK,CAAC;IAC1B,OAAOA,KAAK;EAChB;EAEQE,WAAW,CACfF,KAAoB,EACpBI,WAAiC,EACd;IACnB,IAAIA,WAAW,CAACC,MAAM,KAAK,CAAC,EAAE;MAC1B,MAAM,IAAIC,cAAW,CAChB,yCAAwCN,KAAK,CAACO,OAAQ,IAAG,EAC1D,gBAAgB,EAChB;QACIP;MACJ,CAAC,CACJ;IACL;IACA,MAAMC,MAA2B,GAAG,EAAE;IACtC,MAAMO,aAAuB,GAAG,EAAE;IAClC,MAAMC,WAAqB,GAAG,EAAE;IAChC,KAAK,MAAMV,KAAK,IAAIK,WAAW,EAAE;MAAA;MAC7B;AACZ;AACA;MACY,IAAI,CAAC,CAACL,KAAK,CAACW,OAAO,IAAI,EAAE,EAAEC,IAAI,EAAE,EAAE;QAC/B,MAAM,IAAIL,cAAW,CAChB,6DAA4DN,KAAK,CAACO,OAAQ,IAAG,EAC9E,gBAAgB,EAChB;UAC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GAAGF,GAAG,CAACG,MAAM,CAACC,IAAI,IAAIA,IAAI,KAAKf,KAAK,CAACgB,EAAE,CAAC,CAACvB,MAAM;QAC1DiB,KAAK,GAAGA,KAAK,GAAGG,KAAK;MACzB;MACA,IAAIH,KAAK,KAAK,CAAC,EAAE;QACb;MACJ,CAAC,MAAM,IAAIA,KAAK,GAAG,CAAC,EAAE;QAClB,MAAM,IAAIhB,cAAW,CAChB,UAASM,KAAK,CAACgB,EAAG,oCAAmC,EACtD,2BAA2B,EAC3B;UACI5B,KAAK;UACLY;QACJ,CAAC,CACJ;MACL;MACA,MAAM,IAAIN,cAAW,CAChB,kBAAiBM,KAAK,CAACgB,EAAG,cAAa,EACxC,yBAAyB,EACzB;QACI5B,KAAK;QACLY;MACJ,CAAC,CACJ;IACL;EACJ;AACJ;AAAC;AAAA,8BA/LYnB,cAAc,UACwB,mBAAmB;AAgM/D,MAAMoC,cAAc,GAAG,CAC1B7B,KAAoB,EACpBH,OAA+B,KACd;EACjB,OAAO,IAAIJ,cAAc,CAACO,KAAK,EAAEH,OAAO,CAAC;AAC7C,CAAC;AAAC"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_camelCase","_upperFirst","_pluralize","_plugins","_createFieldStorageId","createApiName","name","upperFirst","camelCase","createPluralApiName","pluralize","CmsModelPlugin","Plugin","type","constructor","contentModel","options","buildModel","input","isPrivate","singularApiName","pluralApiName","modelPlugin","group","id","description","fields","isPlugin","layout","modelId","titleFieldId","noValidate","model","buildFields","validateLayout","inputFields","length","WebinyError","storageIdList","fieldIdList","fieldId","trim","field","lodashCamelCase","match","includes","storageId","createFieldStorageId","settings","childFields","push","total","row","count","filter","cell","exports","createCmsModel","createPrivateModelDefinition"],"sources":["CmsModelPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport lodashCamelCase from \"lodash/camelCase\";\nimport camelCase from \"lodash/camelCase\";\nimport upperFirst from \"lodash/upperFirst\";\nimport pluralize from \"pluralize\";\nimport { Plugin } from \"@webiny/plugins\";\nimport {\n CmsModel as CmsModelBase,\n CmsModelField as CmsModelFieldBase,\n CmsModelFieldSettings as BaseCmsModelFieldSettings\n} from \"~/types\";\nimport { createFieldStorageId } from \"~/crud/contentModel/createFieldStorageId\";\n\nconst createApiName = (name: string) => {\n return upperFirst(camelCase(name));\n};\n\nconst createPluralApiName = (name: string) => {\n return pluralize(createApiName(name));\n};\n\ninterface CmsModelFieldSettings extends Omit<BaseCmsModelFieldSettings, \"fields\"> {\n /**\n * Object field has child fields.\n */\n fields?: CmsModelFieldInput[];\n}\n\ninterface CmsModelFieldInput extends Omit<CmsModelFieldBase, \"storageId\" | \"settings\"> {\n /**\n * If defined, it must be camelCased string.\n * This is for backwards compatibility - before fields had storageId.\n *\n * This should only be populated in old model fields.\n * News ones must have this empty.\n */\n storageId?: string;\n /**\n * We must have a possibility to have a nested field defined without the storageId.\n */\n settings?: CmsModelFieldSettings;\n}\n\nexport interface CmsApiModel\n extends Omit<\n CmsModelPluginModel,\n \"isPrivate\" | \"fields\" | \"singularApiName\" | \"pluralApiName\" | \"isPlugin\"\n > {\n isPrivate?: never;\n noValidate?: never;\n singularApiName?: string;\n pluralApiName?: string;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsApiModelFull extends Omit<CmsApiModel, \"fields\" | \"noValidate\"> {\n noValidate: true;\n fields: CmsModelFieldBase[];\n}\n\ninterface CmsPrivateModel\n extends Omit<\n CmsModelPluginModel,\n | \"isPrivate\"\n | \"singularApiName\"\n | \"pluralApiName\"\n | \"fields\"\n | \"isPlugin\"\n | \"layout\"\n | \"titleFieldId\"\n | \"description\"\n > {\n noValidate?: never;\n titleFieldId?: string;\n singularApiName?: never;\n pluralApiName?: never;\n isPrivate: true;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsPrivateModelFull extends Omit<CmsPrivateModel, \"fields\" | \"noValidate\"> {\n fields: CmsModelFieldBase[];\n noValidate: true;\n}\n\nexport type CmsModelInput = CmsApiModel | CmsPrivateModel | CmsApiModelFull | CmsPrivateModelFull;\n\nexport interface CmsModelPluginModel\n extends Omit<CmsModelBase, \"locale\" | \"tenant\" | \"webinyVersion\"> {\n locale?: string;\n tenant?: string;\n}\n\ninterface CmsModelPluginOptions {\n validateLayout?: boolean;\n}\n\nexport class CmsModelPlugin extends Plugin {\n public static override readonly type: string = \"cms-content-model\";\n public readonly contentModel: CmsModelPluginModel;\n\n private readonly options: CmsModelPluginOptions;\n\n constructor(contentModel: CmsModelInput, options?: CmsModelPluginOptions) {\n super();\n this.options = options || {};\n this.contentModel = this.buildModel(contentModel);\n }\n\n private buildModel(input: CmsModelInput): CmsModelPluginModel {\n const isPrivate = input.isPrivate ?? false;\n\n const singularApiName = input.singularApiName\n ? createApiName(input.singularApiName)\n : createApiName(input.name);\n\n const pluralApiName = input.pluralApiName\n ? createApiName(input.pluralApiName)\n : createPluralApiName(input.name);\n\n const modelPlugin: CmsModelPluginModel = {\n group: {\n id: \"\",\n name: \"\"\n },\n description: \"\",\n fields: [],\n isPlugin: true,\n isPrivate,\n layout: [],\n modelId: input.modelId,\n name: input.name,\n pluralApiName,\n singularApiName,\n titleFieldId: \"id\"\n };\n\n if (input.noValidate) {\n /**\n * We can safely ignore this error, because we are sure noValidate is not a model field.\n */\n // @ts-expect-error\n delete input[\"noValidate\"];\n\n return {\n ...modelPlugin,\n ...input,\n pluralApiName,\n singularApiName\n };\n }\n\n const model: CmsModelPluginModel = {\n ...modelPlugin,\n ...input,\n pluralApiName,\n singularApiName,\n fields: this.buildFields(input, input.fields)\n };\n this.validateLayout(model);\n return model;\n }\n\n private buildFields(\n model: CmsModelInput,\n inputFields: CmsModelFieldInput[]\n ): CmsModelFieldBase[] {\n if (inputFields.length === 0) {\n throw new WebinyError(\n `Missing fields for the defined model \"${model.modelId}\".`,\n \"MISSING_FIELDS\",\n {\n model\n }\n );\n }\n const fields: CmsModelFieldBase[] = [];\n const storageIdList: string[] = [];\n const fieldIdList: string[] = [];\n for (const input of inputFields) {\n /**\n * Field must contain an fieldId. It is required in the graphql, but lets check it just in case\n */\n if (!(input.fieldId || \"\").trim()) {\n throw new WebinyError(\n `Field's \"storageId\" is not defined for the content model \"${model.modelId}\".`,\n \"FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n const fieldId = lodashCamelCase(input.fieldId);\n /**\n * FieldID must be in correct pattern.\n */\n if (fieldId.match(/^[0-9]/) !== null) {\n throw new WebinyError(\n `Field's \"fieldId\" does not match correct pattern in the content model \"${model.modelId}\" - cannot start with a number.`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * FieldID also must be camelCased.\n */\n if (fieldId !== input.fieldId) {\n throw new WebinyError(\n `Field's \"fieldId\" must be a camel cased string in the content model \"${model.modelId}\".`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * ... and fieldId must be unique.\n */\n if (fieldIdList.includes(fieldId)) {\n throw new WebinyError(\n `Field's \"fieldId\" is not unique in the content model \"${model.modelId}\".`,\n \"FIELD_ID_NOT_UNIQUE_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n let storageId = input.storageId ? lodashCamelCase(input.storageId) : null;\n /**\n * If defined, storageId MUST be camel cased string - for backward compatibility.\n */\n if (\n storageId &&\n (storageId.match(/^([a-zA-Z-0-9]+)$/) === null || storageId !== input.storageId)\n ) {\n throw new WebinyError(\n `Field's \"storageId\" of the field with \"fieldId\" ${input.fieldId} is not camel cased string in the content model \"${model.modelId}\".`,\n \"STORAGE_ID_NOT_CAMEL_CASED_ERROR\",\n {\n model,\n storageId,\n field: input\n }\n );\n } else if (!storageId) {\n storageId = createFieldStorageId(input);\n }\n\n /**\n * Fields storageId must be unique.\n */\n if (storageIdList.includes(storageId)) {\n throw new WebinyError(\n `Field's \"storageId\" is not unique in the content model \"${model.modelId}\".`,\n \"STORAGE_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n /**\n * We can safely ignore error because we are going through the fields and making sure each has storageId.\n */\n // @ts-expect-error\n let settings: BaseCmsModelFieldSettings = input.settings;\n\n const childFields = settings?.fields || [];\n if (input.type === \"object\" && childFields.length > 0) {\n settings = {\n ...(settings || {}),\n fields: this.buildFields(model, childFields)\n };\n }\n\n const field: CmsModelFieldBase = {\n ...input,\n settings,\n storageId\n };\n /**\n * Add all relevant data to arrays.\n */\n fields.push(field);\n storageIdList.push(field.storageId);\n fieldIdList.push(field.fieldId);\n }\n return fields;\n }\n\n private validateLayout(model: CmsModelPluginModel): void {\n /**\n * Only skip validation if option.validateLayout was set as false, explicitly.\n */\n if (this.options.validateLayout === false) {\n return;\n }\n for (const field of model.fields) {\n let total = 0;\n for (const row of model.layout) {\n const count = row.filter(cell => cell === field.id).length;\n total = total + count;\n }\n if (total === 1) {\n continue;\n } else if (total > 1) {\n throw new WebinyError(\n `Field \"${field.id}\" is in more than one layout cell.`,\n \"DUPLICATE_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n throw new WebinyError(\n `Missing field \"${field.id}\" in layout.`,\n \"MISSING_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n }\n}\n\nexport const createCmsModel = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\nexport const createPrivateModelDefinition = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\" | \"noValidate\">\n): CmsPrivateModelFull => {\n return {\n ...input,\n isPrivate: true,\n noValidate: true,\n group: {\n id: \"private\",\n name: \"Private Models\"\n }\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAM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AAG,CAAC,EAAE;QAClB,MAAM,IAAId,cAAW,CAChB,UAASK,KAAK,CAAClB,EAAG,oCAAmC,EACtD,2BAA2B,EAC3B;UACIQ,KAAK;UACLU;QACJ,CACJ,CAAC;MACL;MACA,MAAM,IAAIL,cAAW,CAChB,kBAAiBK,KAAK,CAAClB,EAAG,cAAa,EACxC,yBAAyB,EACzB;QACIQ,KAAK;QACLU;MACJ,CACJ,CAAC;IACL;EACJ;AACJ;AAACc,OAAA,CAAA7C,cAAA,GAAAA,cAAA;AAEM,MAAM8C,cAAc,GAAGA,CAC1BzB,KAAoB,EACpBhB,OAA+B,KACd;EACjB,OAAO,IAAIL,cAAc,CAACqB,KAAK,EAAEhB,OAAO,CAAC;AAC7C,CAAC;AAACwC,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAEK,MAAMC,4BAA4B,GACrCxC,KAAsE,IAChD;EACtB,OAAO;IACH,GAAGA,KAAK;IACRC,SAAS,EAAE,IAAI;IACfY,UAAU,EAAE,IAAI;IAChBR,KAAK,EAAE;MACHC,EAAE,EAAE,SAAS;MACblB,IAAI,EAAE;IACV;EACJ,CAAC;AACL,CAAC;AAACkD,OAAA,CAAAE,4BAAA,GAAAA,4BAAA"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.CmsParametersPlugin = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _plugins = require("@webiny/plugins");
|
|
8
|
+
/**
|
|
9
|
+
* Type can be null because it might be that Headless CMS context is loaded on a different Lambda where there is no GraphQL Schema generated.
|
|
10
|
+
*/
|
|
11
|
+
|
|
10
12
|
class CmsParametersPlugin extends _plugins.Plugin {
|
|
13
|
+
static type = "cms-parameters-plugin";
|
|
11
14
|
constructor(callable) {
|
|
12
15
|
super();
|
|
13
|
-
(0, _defineProperty2.default)(this, "callable", void 0);
|
|
14
16
|
this.callable = callable;
|
|
15
17
|
}
|
|
16
18
|
async getParameters(context) {
|
|
@@ -18,4 +20,5 @@ class CmsParametersPlugin extends _plugins.Plugin {
|
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
exports.CmsParametersPlugin = CmsParametersPlugin;
|
|
21
|
-
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=CmsParametersPlugin.js.map
|