@webiny/api-headless-cms 6.0.0-alpha.0 → 6.0.0-alpha.2
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 -1
- package/constants.js.map +1 -1
- package/context.d.ts +1 -1
- package/context.js.map +1 -1
- package/crud/AccessControl/AccessControl.d.ts +2 -2
- package/crud/AccessControl/AccessControl.js.map +1 -1
- package/crud/contentEntry/abstractions/IDeleteEntry.d.ts +1 -1
- package/crud/contentEntry/abstractions/IDeleteEntry.js.map +1 -1
- package/crud/contentEntry/abstractions/IDeleteEntryOperation.d.ts +1 -1
- package/crud/contentEntry/abstractions/IDeleteEntryOperation.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetEntriesByIds.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetEntriesByIds.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetEntry.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetEntry.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetRevisionById.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetRevisionById.js.map +1 -1
- package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.d.ts +1 -1
- package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js.map +1 -1
- package/crud/contentEntry/abstractions/IListEntries.d.ts +1 -1
- package/crud/contentEntry/abstractions/IListEntries.js.map +1 -1
- package/crud/contentEntry/abstractions/IListEntriesOperation.d.ts +1 -1
- package/crud/contentEntry/abstractions/IListEntriesOperation.js.map +1 -1
- package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.d.ts +1 -1
- package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js.map +1 -1
- package/crud/contentEntry/abstractions/IRestoreEntryFromBin.d.ts +1 -1
- package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js.map +1 -1
- package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.d.ts +1 -1
- package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js.map +1 -1
- package/crud/contentEntry/afterDelete.d.ts +2 -2
- package/crud/contentEntry/afterDelete.js.map +1 -1
- package/crud/contentEntry/beforeCreate.d.ts +2 -2
- package/crud/contentEntry/beforeCreate.js.map +1 -1
- package/crud/contentEntry/beforeUpdate.d.ts +2 -2
- package/crud/contentEntry/beforeUpdate.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryData.d.ts +5 -5
- package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.d.ts +5 -5
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.d.ts +4 -4
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.d.ts +2 -2
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.d.ts +4 -4
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.d.ts +4 -4
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.d.ts +1 -1
- package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.js.map +1 -1
- package/crud/contentEntry/entryDataValidation.d.ts +1 -1
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentEntry/markLockedFields.d.ts +1 -1
- package/crud/contentEntry/markLockedFields.js.map +1 -1
- package/crud/contentEntry/referenceFieldsMapping.d.ts +1 -1
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
- package/crud/contentEntry/searchableFields.d.ts +2 -2
- package/crud/contentEntry/searchableFields.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.d.ts +3 -3
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.d.ts +2 -2
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.d.ts +3 -3
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.d.ts +3 -3
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.d.ts +3 -3
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.d.ts +2 -2
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.d.ts +3 -3
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.d.ts +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.d.ts +2 -2
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js.map +1 -1
- package/crud/contentEntry/useCases/DeleteEntry/index.d.ts +5 -5
- package/crud/contentEntry/useCases/DeleteEntry/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.d.ts +7 -5
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js +6 -2
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js.map +1 -1
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.d.ts +3 -3
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js.map +1 -1
- package/crud/contentEntry/useCases/GetEntriesByIds/index.d.ts +4 -2
- package/crud/contentEntry/useCases/GetEntriesByIds/index.js +1 -1
- package/crud/contentEntry/useCases/GetEntriesByIds/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.d.ts +7 -5
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js +6 -2
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.d.ts +3 -3
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.d.ts +4 -2
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js +1 -1
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.d.ts +7 -5
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js +7 -2
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.d.ts +3 -1
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js +1 -1
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.d.ts +7 -5
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js +7 -2
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js.map +1 -1
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.d.ts +3 -1
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js +1 -1
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.d.ts +7 -5
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js +6 -2
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js.map +1 -1
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.d.ts +3 -3
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js.map +1 -1
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.d.ts +4 -2
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js +1 -1
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.d.ts +7 -5
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js +7 -2
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js.map +1 -1
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.d.ts +3 -1
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js +1 -1
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.d.ts +7 -5
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js +7 -2
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js.map +1 -1
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetRevisionById/index.d.ts +3 -1
- package/crud/contentEntry/useCases/GetRevisionById/index.js +1 -1
- package/crud/contentEntry/useCases/GetRevisionById/index.js.map +1 -1
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.d.ts +7 -5
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js +6 -2
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js.map +1 -1
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.d.ts +4 -2
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js +1 -1
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/GetEntry.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/GetEntry.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.d.ts +4 -4
- package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntries.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntries.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.d.ts +12 -5
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js +9 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.d.ts +3 -3
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.d.ts +2 -2
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.d.ts +4 -4
- package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js.map +1 -1
- package/crud/contentEntry/useCases/ListEntries/index.d.ts +6 -4
- package/crud/contentEntry/useCases/ListEntries/index.js +1 -1
- package/crud/contentEntry/useCases/ListEntries/index.js.map +1 -1
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.d.ts +3 -3
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js.map +1 -1
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.d.ts +7 -5
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js +4 -2
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js.map +1 -1
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.d.ts +3 -3
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js.map +1 -1
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.d.ts +3 -3
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js.map +1 -1
- package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.d.ts +2 -2
- package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js.map +1 -1
- package/crud/contentEntry/useCases/RestoreEntryFromBin/index.d.ts +7 -5
- package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js +1 -1
- package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js.map +1 -1
- package/crud/contentEntry.crud.d.ts +5 -5
- package/crud/contentEntry.crud.js +16 -3
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/beforeCreate.d.ts +2 -2
- package/crud/contentModel/beforeCreate.js.map +1 -1
- package/crud/contentModel/beforeDelete.d.ts +2 -2
- package/crud/contentModel/beforeDelete.js.map +1 -1
- package/crud/contentModel/beforeUpdate.d.ts +2 -2
- package/crud/contentModel/beforeUpdate.js.map +1 -1
- package/crud/contentModel/compatibility/modelApiName.d.ts +1 -1
- package/crud/contentModel/compatibility/modelApiName.js.map +1 -1
- package/crud/contentModel/contentModelManagerFactory.d.ts +1 -1
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -1
- package/crud/contentModel/createFieldStorageId.d.ts +1 -1
- package/crud/contentModel/createFieldStorageId.js.map +1 -1
- package/crud/contentModel/defaultFields.d.ts +1 -1
- package/crud/contentModel/defaultFields.js.map +1 -1
- package/crud/contentModel/ensureTypeTag.d.ts +1 -1
- package/crud/contentModel/ensureTypeTag.js.map +1 -1
- package/crud/contentModel/fields/descriptionField.d.ts +1 -1
- package/crud/contentModel/fields/descriptionField.js.map +1 -1
- package/crud/contentModel/fields/getApplicableFieldById.d.ts +1 -1
- package/crud/contentModel/fields/getApplicableFieldById.js.map +1 -1
- package/crud/contentModel/fields/imageField.d.ts +1 -1
- package/crud/contentModel/fields/imageField.js.map +1 -1
- package/crud/contentModel/fields/titleField.d.ts +1 -1
- package/crud/contentModel/fields/titleField.js.map +1 -1
- package/crud/contentModel/listModelsFromDatabase.d.ts +3 -3
- package/crud/contentModel/listModelsFromDatabase.js.map +1 -1
- package/crud/contentModel/validate/endingAllowed.d.ts +1 -1
- package/crud/contentModel/validate/endingAllowed.js.map +1 -1
- package/crud/contentModel/validate/modelId.d.ts +1 -1
- package/crud/contentModel/validate/modelId.js.map +1 -1
- package/crud/contentModel/validate/pluralApiName.d.ts +1 -1
- package/crud/contentModel/validate/pluralApiName.js.map +1 -1
- package/crud/contentModel/validate/singularApiName.d.ts +1 -1
- package/crud/contentModel/validate/singularApiName.js.map +1 -1
- package/crud/contentModel/validateModel.d.ts +1 -1
- package/crud/contentModel/validateModel.js.map +1 -1
- package/crud/contentModel/validateModelFields.d.ts +1 -1
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel/validation.d.ts +132 -132
- package/crud/contentModel.crud.d.ts +5 -5
- package/crud/contentModel.crud.js.map +1 -1
- package/crud/contentModelGroup/beforeCreate.d.ts +3 -3
- package/crud/contentModelGroup/beforeCreate.js.map +1 -1
- package/crud/contentModelGroup/beforeDelete.d.ts +3 -3
- package/crud/contentModelGroup/beforeDelete.js.map +1 -1
- package/crud/contentModelGroup/beforeUpdate.d.ts +3 -3
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
- package/crud/contentModelGroup/listGroupsFromDatabase.d.ts +1 -1
- package/crud/contentModelGroup/listGroupsFromDatabase.js.map +1 -1
- package/crud/contentModelGroup/validation.d.ts +2 -2
- package/crud/contentModelGroup.crud.d.ts +5 -5
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/crud/system.crud.d.ts +4 -4
- package/crud/system.crud.js +10 -0
- package/crud/system.crud.js.map +1 -1
- package/export/crud/exporting.d.ts +2 -2
- package/export/crud/exporting.js.map +1 -1
- package/export/crud/importing.d.ts +2 -2
- package/export/crud/importing.js.map +1 -1
- package/export/crud/imports/importData.d.ts +2 -2
- package/export/crud/imports/importData.js.map +1 -1
- package/export/crud/imports/importGroups.d.ts +2 -2
- package/export/crud/imports/importGroups.js.map +1 -1
- package/export/crud/imports/importModels.d.ts +2 -2
- package/export/crud/imports/importModels.js.map +1 -1
- package/export/crud/imports/validateGroups.d.ts +2 -2
- package/export/crud/imports/validateGroups.js.map +1 -1
- package/export/crud/imports/validateInput.d.ts +2 -2
- package/export/crud/imports/validateInput.js.map +1 -1
- package/export/crud/imports/validateModels.d.ts +2 -2
- package/export/crud/imports/validateModels.js.map +1 -1
- package/export/crud/index.d.ts +1 -1
- package/export/crud/index.js.map +1 -1
- package/export/crud/sanitize.d.ts +2 -2
- package/export/crud/sanitize.js.map +1 -1
- package/export/graphql/index.d.ts +1 -1
- package/export/graphql/index.js.map +1 -1
- package/export/types.d.ts +1 -1
- package/export/types.js.map +1 -1
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +3 -2
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +3 -2
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +3 -2
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/graphql/buildSchemaPlugins.d.ts +2 -2
- package/graphql/buildSchemaPlugins.js.map +1 -1
- package/graphql/checkEndpointAccess.d.ts +1 -1
- package/graphql/checkEndpointAccess.js.map +1 -1
- package/graphql/createExecutableSchema.d.ts +1 -1
- package/graphql/createExecutableSchema.js.map +1 -1
- package/graphql/createRequestBody.d.ts +1 -1
- package/graphql/createRequestBody.js.map +1 -1
- package/graphql/generateSchema.d.ts +2 -2
- package/graphql/generateSchema.js.map +1 -1
- package/graphql/getSchema/generateCacheId.d.ts +3 -3
- package/graphql/getSchema/generateCacheId.js.map +1 -1
- package/graphql/getSchema/generateCacheKey.d.ts +1 -1
- package/graphql/getSchema/generateCacheKey.js.map +1 -1
- package/graphql/getSchema.d.ts +4 -4
- package/graphql/getSchema.js.map +1 -1
- package/graphql/graphQLHandlerFactory.d.ts +1 -1
- package/graphql/graphQLHandlerFactory.js.map +1 -1
- package/graphql/handleRequest.d.ts +2 -2
- package/graphql/handleRequest.js.map +1 -1
- package/graphql/index.d.ts +2 -2
- package/graphql/index.js.map +1 -1
- package/graphql/scalars/RevisionIdScalarPlugin.d.ts +1 -1
- package/graphql/scalars/RevisionIdScalarPlugin.js.map +1 -1
- package/graphql/schema/baseContentSchema.d.ts +2 -2
- package/graphql/schema/baseContentSchema.js.map +1 -1
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/contentEntries.d.ts +2 -2
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModelGroups.d.ts +2 -2
- package/graphql/schema/contentModelGroups.js.map +1 -1
- package/graphql/schema/contentModels.d.ts +2 -2
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +2 -2
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createFieldTypePluginRecords.d.ts +2 -2
- package/graphql/schema/createFieldTypePluginRecords.js.map +1 -1
- package/graphql/schema/createManageSDL.d.ts +2 -2
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createReadSDL.d.ts +2 -2
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/createSingularSDL.d.ts +1 -1
- package/graphql/schema/createSingularSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/normalizeGraphQlInput.d.ts +1 -1
- package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreate.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGet.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveList.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveListDeleted.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveListDeleted.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveMove.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolvePublish.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRestoreFromBin.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveValidate.d.ts +1 -1
- package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveGet.d.ts +1 -1
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveList.d.ts +1 -1
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveGet.d.ts +1 -1
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveList.d.ts +1 -1
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/singular/resolveGet.d.ts +1 -1
- package/graphql/schema/resolvers/singular/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/singular/resolveUpdate.d.ts +1 -1
- package/graphql/schema/resolvers/singular/resolveUpdate.js.map +1 -1
- package/graphql/schema/schemaPlugins.d.ts +1 -1
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/graphql/system.d.ts +1 -1
- package/graphql/system.js.map +1 -1
- package/graphqlFields/boolean.d.ts +1 -1
- package/graphqlFields/boolean.js.map +1 -1
- package/graphqlFields/datetime.d.ts +1 -1
- package/graphqlFields/datetime.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
- package/graphqlFields/file.d.ts +1 -1
- package/graphqlFields/file.js.map +1 -1
- package/graphqlFields/helpers.d.ts +1 -1
- package/graphqlFields/helpers.js.map +1 -1
- package/graphqlFields/index.d.ts +1 -1
- package/graphqlFields/index.js.map +1 -1
- package/graphqlFields/json.d.ts +1 -1
- package/graphqlFields/json.js.map +1 -1
- package/graphqlFields/longText.d.ts +1 -1
- package/graphqlFields/longText.js.map +1 -1
- package/graphqlFields/number.d.ts +1 -1
- package/graphqlFields/number.js.map +1 -1
- package/graphqlFields/object.d.ts +1 -1
- package/graphqlFields/object.js.map +1 -1
- package/graphqlFields/ref.d.ts +1 -1
- package/graphqlFields/ref.js.map +1 -1
- package/graphqlFields/richText/RichTextPluginsProcessor.d.ts +1 -1
- package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -1
- package/graphqlFields/richText/richTextResolver.d.ts +2 -2
- package/graphqlFields/richText/richTextResolver.js.map +1 -1
- package/graphqlFields/richText.d.ts +1 -1
- package/graphqlFields/richText.js.map +1 -1
- package/graphqlFields/searchableJson.d.ts +1 -1
- package/graphqlFields/searchableJson.js +5 -0
- package/graphqlFields/searchableJson.js.map +1 -1
- package/graphqlFields/text.d.ts +1 -1
- package/graphqlFields/text.js.map +1 -1
- package/htmlRenderer/LexicalRenderer.d.ts +1 -1
- package/htmlRenderer/LexicalRenderer.js.map +1 -1
- package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js.map +1 -1
- package/modelManager/SingletonModelManager.d.ts +1 -1
- package/modelManager/SingletonModelManager.js.map +1 -1
- package/modelManager/index.d.ts +1 -1
- package/modelManager/index.js.map +1 -1
- package/package.json +21 -21
- package/parameters/header.js.map +1 -1
- package/parameters/manual.d.ts +2 -1
- package/parameters/manual.js.map +1 -1
- package/parameters/path.js.map +1 -1
- package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.d.ts +3 -2
- package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js.map +1 -1
- package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +1 -1
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -1
- package/plugins/CmsGroupPlugin.d.ts +1 -1
- package/plugins/CmsGroupPlugin.js.map +1 -1
- package/plugins/CmsModelFieldConverterPlugin.d.ts +2 -2
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
- package/plugins/CmsModelPlugin.d.ts +1 -1
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/plugins/CmsParametersPlugin.d.ts +1 -1
- package/plugins/CmsParametersPlugin.js.map +1 -1
- package/plugins/StorageOperationsCmsModelPlugin.d.ts +1 -1
- package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -1
- package/plugins/StorageTransformPlugin.d.ts +2 -2
- package/plugins/StorageTransformPlugin.js.map +1 -1
- package/storage/date.d.ts +1 -1
- package/storage/date.js.map +1 -1
- package/storage/dynamicZone.js.map +1 -1
- package/storage/json.js +34 -5
- package/storage/json.js.map +1 -1
- package/storage/object.js.map +1 -1
- package/types/context.d.ts +7 -7
- package/types/context.js.map +1 -1
- package/types/fields/dynamicZoneField.d.ts +1 -1
- package/types/fields/dynamicZoneField.js.map +1 -1
- package/types/fields/objectField.d.ts +1 -1
- package/types/fields/objectField.js.map +1 -1
- package/types/model.d.ts +3 -3
- package/types/model.js.map +1 -1
- package/types/modelAst.d.ts +1 -1
- package/types/modelAst.js.map +1 -1
- package/types/modelField.d.ts +2 -2
- package/types/modelField.js.map +1 -1
- package/types/modelGroup.d.ts +1 -1
- package/types/modelGroup.js.map +1 -1
- package/types/plugins.d.ts +6 -6
- package/types/plugins.js.map +1 -1
- package/types/types.d.ts +19 -19
- package/types/types.js.map +1 -1
- package/utils/RichTextRenderer.d.ts +2 -2
- package/utils/RichTextRenderer.js.map +1 -1
- package/utils/caching/Cache.d.ts +1 -1
- package/utils/caching/Cache.js.map +1 -1
- package/utils/caching/CacheKey.d.ts +2 -2
- package/utils/caching/CacheKey.js.map +1 -1
- package/utils/contentEntryTraverser/ContentEntryTraverser.d.ts +1 -1
- package/utils/contentEntryTraverser/ContentEntryTraverser.js.map +1 -1
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.d.ts +1 -1
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js.map +1 -1
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.d.ts +1 -1
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js.map +1 -1
- package/utils/contentModelAst/CmsModelToAstConverter.d.ts +1 -1
- package/utils/contentModelAst/CmsModelToAstConverter.js.map +1 -1
- package/utils/converters/Converter.d.ts +3 -3
- package/utils/converters/Converter.js.map +1 -1
- package/utils/converters/ConverterCollection.d.ts +2 -2
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.d.ts +3 -3
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/createModelField.d.ts +1 -1
- package/utils/createModelField.js.map +1 -1
- package/utils/createTypeFromFields.d.ts +1 -1
- package/utils/createTypeFromFields.js.map +1 -1
- package/utils/entryStorage.d.ts +8 -1
- package/utils/entryStorage.js +37 -4
- package/utils/entryStorage.js.map +1 -1
- package/utils/getBaseFieldType.d.ts +1 -1
- package/utils/getBaseFieldType.js.map +1 -1
- package/utils/getEntryDescription.d.ts +1 -1
- package/utils/getEntryDescription.js.map +1 -1
- package/utils/getEntryImage.d.ts +1 -1
- package/utils/getEntryImage.js.map +1 -1
- package/utils/getEntryTitle.d.ts +1 -1
- package/utils/getEntryTitle.js.map +1 -1
- package/utils/getSchemaFromFieldPlugins.d.ts +4 -4
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/identity.d.ts +1 -1
- package/utils/identity.js.map +1 -1
- package/utils/isHeadlessCmsReady.d.ts +1 -1
- package/utils/isHeadlessCmsReady.js.map +1 -1
- package/utils/modelFieldTraverser/ModelFieldTraverser.d.ts +1 -1
- package/utils/modelFieldTraverser/ModelFieldTraverser.js.map +1 -1
- package/utils/renderFields.d.ts +1 -1
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.d.ts +1 -1
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.d.ts +1 -1
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.d.ts +1 -1
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.d.ts +2 -2
- package/utils/renderSortEnum.js.map +1 -1
- package/validators/dateGte.d.ts +1 -1
- package/validators/dateGte.js.map +1 -1
- package/validators/dateLte.d.ts +1 -1
- package/validators/dateLte.js.map +1 -1
- package/validators/gte.d.ts +1 -1
- package/validators/gte.js.map +1 -1
- package/validators/in.d.ts +1 -1
- package/validators/in.js.map +1 -1
- package/validators/lte.d.ts +1 -1
- package/validators/lte.js.map +1 -1
- package/validators/maxLength.d.ts +1 -1
- package/validators/maxLength.js.map +1 -1
- package/validators/minLength.d.ts +1 -1
- package/validators/minLength.js.map +1 -1
- package/validators/pattern.d.ts +1 -1
- package/validators/pattern.js.map +1 -1
- package/validators/patternPlugins/email.d.ts +1 -1
- package/validators/patternPlugins/email.js.map +1 -1
- package/validators/patternPlugins/index.d.ts +1 -1
- package/validators/patternPlugins/index.js.map +1 -1
- package/validators/patternPlugins/lowerCase.d.ts +1 -1
- package/validators/patternPlugins/lowerCase.js.map +1 -1
- package/validators/patternPlugins/lowerCaseSpace.d.ts +1 -1
- package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
- package/validators/patternPlugins/upperCase.d.ts +1 -1
- package/validators/patternPlugins/upperCase.js.map +1 -1
- package/validators/patternPlugins/upperCaseSpace.d.ts +1 -1
- package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
- package/validators/patternPlugins/url.d.ts +1 -1
- package/validators/patternPlugins/url.js.map +1 -1
- package/validators/required.d.ts +1 -1
- package/validators/required.js.map +1 -1
- package/validators/timeGte.d.ts +1 -1
- package/validators/timeGte.js.map +1 -1
- package/validators/timeLte.d.ts +1 -1
- package/validators/timeLte.js.map +1 -1
- package/validators/unique.d.ts +1 -1
- package/validators/unique.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lexicalConverter","require","_jsdom","_interopRequireDefault","LexicalRenderer","constructor","global","window","dom","jsdom","JSDOM","document","DocumentFragment","render","contents","transformer","createLexicalStateTransformer","toHtml","exports"],"sources":["LexicalRenderer.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":["_lexicalConverter","require","_jsdom","_interopRequireDefault","LexicalRenderer","constructor","global","window","dom","jsdom","JSDOM","document","DocumentFragment","render","contents","transformer","createLexicalStateTransformer","toHtml","exports"],"sources":["LexicalRenderer.ts"],"sourcesContent":["import type { SerializedEditorState } from \"@webiny/lexical-converter\";\nimport { createLexicalStateTransformer } from \"@webiny/lexical-converter\";\n// @ts-expect-error jsdom types are messing with the repo, so they're disabled in the root package.json.\nimport jsdom from \"jsdom\";\n\nexport class LexicalRenderer {\n constructor() {\n if (!global.window) {\n const dom = new jsdom.JSDOM();\n global.window = dom.window;\n global.document = dom.window.document;\n global.DocumentFragment = dom.window.DocumentFragment;\n }\n }\n\n render(contents: SerializedEditorState): string {\n const transformer = createLexicalStateTransformer();\n return transformer.toHtml(contents);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AADA;;AAGO,MAAMG,eAAe,CAAC;EACzBC,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,MAAM,CAACC,MAAM,EAAE;MAChB,MAAMC,GAAG,GAAG,IAAIC,cAAK,CAACC,KAAK,CAAC,CAAC;MAC7BJ,MAAM,CAACC,MAAM,GAAGC,GAAG,CAACD,MAAM;MAC1BD,MAAM,CAACK,QAAQ,GAAGH,GAAG,CAACD,MAAM,CAACI,QAAQ;MACrCL,MAAM,CAACM,gBAAgB,GAAGJ,GAAG,CAACD,MAAM,CAACK,gBAAgB;IACzD;EACJ;EAEAC,MAAMA,CAACC,QAA+B,EAAU;IAC5C,MAAMC,WAAW,GAAG,IAAAC,+CAA6B,EAAC,CAAC;IACnD,OAAOD,WAAW,CAACE,MAAM,CAACH,QAAQ,CAAC;EACvC;AACJ;AAACI,OAAA,CAAAd,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","isLexicalContents","contents","hasOwnProperty","createLexicalHTMLRenderer","CmsRichTextRendererPlugin","undefined","then","LexicalRenderer","renderer","render","err","console","log","exports"],"sources":["createLexicalHTMLRenderer.ts"],"sourcesContent":["import type { SerializedEditorState } from \"@webiny/lexical-converter\";\nimport {
|
|
1
|
+
{"version":3,"names":["_plugins","require","isLexicalContents","contents","hasOwnProperty","createLexicalHTMLRenderer","CmsRichTextRendererPlugin","undefined","then","LexicalRenderer","renderer","render","err","console","log","exports"],"sources":["createLexicalHTMLRenderer.ts"],"sourcesContent":["import type { SerializedEditorState } from \"@webiny/lexical-converter\";\nimport type { RichTextContents } from \"~/plugins\";\nimport { CmsRichTextRendererPlugin } from \"~/plugins\";\n\nconst isLexicalContents = (contents: RichTextContents): contents is SerializedEditorState => {\n return contents.hasOwnProperty(\"root\");\n};\n\nexport const createLexicalHTMLRenderer = () => {\n return new CmsRichTextRendererPlugin(\"html\", contents => {\n if (!isLexicalContents(contents)) {\n return undefined;\n }\n\n return import(/* webpackChunkName: \"LexicalRenderer\" */ \"./LexicalRenderer\").then(\n ({ LexicalRenderer }) => {\n try {\n const renderer = new LexicalRenderer();\n return renderer.render(contents);\n } catch (err) {\n console.log(err);\n return undefined;\n }\n }\n );\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEA,MAAMC,iBAAiB,GAAIC,QAA0B,IAAwC;EACzF,OAAOA,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAC;AAC1C,CAAC;AAEM,MAAMC,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,IAAIC,kCAAyB,CAAC,MAAM,EAAEH,QAAQ,IAAI;IACrD,IAAI,CAACD,iBAAiB,CAACC,QAAQ,CAAC,EAAE;MAC9B,OAAOI,SAAS;IACpB;IAEA,OAAO,MAAM,CAAC,4DAA6D,CAAC,CAACC,IAAI,CAC7E,CAAC;MAAEC;IAAgB,CAAC,KAAK;MACrB,IAAI;QACA,MAAMC,QAAQ,GAAG,IAAID,eAAe,CAAC,CAAC;QACtC,OAAOC,QAAQ,CAACC,MAAM,CAACR,QAAQ,CAAC;MACpC,CAAC,CAAC,OAAOS,GAAG,EAAE;QACVC,OAAO,CAACC,GAAG,CAACF,GAAG,CAAC;QAChB,OAAOL,SAAS;MACpB;IACJ,CACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAV,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CreateGraphQLParams } from "./graphql";
|
|
2
|
-
import { CrudParams } from "./context";
|
|
1
|
+
import type { CreateGraphQLParams } from "./graphql";
|
|
2
|
+
import type { CrudParams } from "./context";
|
|
3
3
|
import { entryFieldFromStorageTransform, entryFromStorageTransform, entryToStorageTransform } from "./utils/entryStorage";
|
|
4
|
-
import { Plugin } from "@webiny/plugins/types";
|
|
4
|
+
import type { Plugin } from "@webiny/plugins/types";
|
|
5
5
|
export * from "./utils/isHeadlessCmsReady";
|
|
6
6
|
export * from "./utils/createModelField";
|
|
7
7
|
export * from "./graphql/schema/resolvers/manage/normalizeGraphQlInput";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graphql","require","_modelManager","_graphqlFields","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_validators","_parameters","_context","_entryStorage","_fieldConverters","_export","_storage","_createLexicalHTMLRenderer","_RevisionIdScalarPlugin","_isHeadlessCmsReady","_createModelField","_normalizeGraphQlInput","_plugins","_incrementEntryIdVersion","_RichTextRenderer","_handleRequest","_ContentEntryTraverser","_contentModelAst","createHeadlessCmsGraphQL","params","createRevisionIdScalarPlugin","createPathParameterPlugin","createHeaderParameterPlugin","createContextParameterPlugin","baseCreateGraphQL","createExportGraphQL","createLexicalHTMLRenderer","createHeadlessCmsContext","createContextPlugin","createDefaultModelManager","createGraphQLFields","createFieldConverters","createValidators","createStorageTransform"],"sources":["index.ts"],"sourcesContent":["import { createGraphQL as baseCreateGraphQL
|
|
1
|
+
{"version":3,"names":["_graphql","require","_modelManager","_graphqlFields","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_validators","_parameters","_context","_entryStorage","_fieldConverters","_export","_storage","_createLexicalHTMLRenderer","_RevisionIdScalarPlugin","_isHeadlessCmsReady","_createModelField","_normalizeGraphQlInput","_plugins","_incrementEntryIdVersion","_RichTextRenderer","_handleRequest","_ContentEntryTraverser","_contentModelAst","createHeadlessCmsGraphQL","params","createRevisionIdScalarPlugin","createPathParameterPlugin","createHeaderParameterPlugin","createContextParameterPlugin","baseCreateGraphQL","createExportGraphQL","createLexicalHTMLRenderer","createHeadlessCmsContext","createContextPlugin","createDefaultModelManager","createGraphQLFields","createFieldConverters","createValidators","createStorageTransform"],"sources":["index.ts"],"sourcesContent":["import type { CreateGraphQLParams } from \"~/graphql\";\nimport { createGraphQL as baseCreateGraphQL } from \"~/graphql\";\nimport { createDefaultModelManager } from \"~/modelManager\";\nimport { createGraphQLFields } from \"~/graphqlFields\";\nimport { createValidators } from \"~/validators\";\nimport {\n createContextParameterPlugin,\n createHeaderParameterPlugin,\n createPathParameterPlugin\n} from \"~/parameters\";\nimport type { CrudParams } from \"~/context\";\nimport { createContextPlugin } from \"~/context\";\nimport {\n entryFieldFromStorageTransform,\n entryFromStorageTransform,\n entryToStorageTransform\n} from \"./utils/entryStorage\";\nimport { createFieldConverters } from \"~/fieldConverters\";\nimport { createExportGraphQL } from \"~/export\";\nimport { createStorageTransform } from \"~/storage\";\nimport { createLexicalHTMLRenderer } from \"./htmlRenderer/createLexicalHTMLRenderer\";\nimport { createRevisionIdScalarPlugin } from \"~/graphql/scalars/RevisionIdScalarPlugin\";\nimport type { Plugin } from \"@webiny/plugins/types\";\n\nexport * from \"./utils/isHeadlessCmsReady\";\nexport * from \"./utils/createModelField\";\nexport * from \"./graphql/schema/resolvers/manage/normalizeGraphQlInput\";\n\nexport type CreateHeadlessCmsGraphQLParams = CreateGraphQLParams;\nexport const createHeadlessCmsGraphQL = (params: CreateHeadlessCmsGraphQLParams = {}): Plugin[] => {\n return [\n ...createRevisionIdScalarPlugin(),\n /**\n * PathParameter plugins are used to determine the type of the cms endpoint\n */\n createPathParameterPlugin(),\n createHeaderParameterPlugin(),\n createContextParameterPlugin(),\n /**\n * At this point we can create, or not create, CMS GraphQL Schema.\n */\n ...baseCreateGraphQL(params),\n createExportGraphQL(),\n createLexicalHTMLRenderer()\n ];\n};\n\nexport type ContentContextParams = CrudParams;\nexport const createHeadlessCmsContext = (params: ContentContextParams) => {\n return [\n /**\n * Context for all Lambdas - everything is loaded now.\n */\n createContextPlugin(params),\n createDefaultModelManager(),\n createGraphQLFields(),\n createFieldConverters(),\n createValidators(),\n ...createStorageTransform()\n ];\n};\nexport * from \"~/graphqlFields\";\nexport * from \"~/plugins\";\nexport * from \"~/utils/incrementEntryIdVersion\";\nexport * from \"~/utils/RichTextRenderer\";\nexport * from \"./graphql/handleRequest\";\nexport * from \"./utils/contentEntryTraverser/ContentEntryTraverser\";\nexport * from \"./utils/contentModelAst\";\nexport { entryToStorageTransform, entryFieldFromStorageTransform, entryFromStorageTransform };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,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MAAM2B,wBAAwB,GAAGA,CAACC,MAAsC,GAAG,CAAC,CAAC,KAAe;EAC/F,OAAO,CACH,GAAG,IAAAC,oDAA4B,EAAC,CAAC;EACjC;AACR;AACA;EACQ,IAAAC,qCAAyB,EAAC,CAAC,EAC3B,IAAAC,uCAA2B,EAAC,CAAC,EAC7B,IAAAC,wCAA4B,EAAC,CAAC;EAC9B;AACR;AACA;EACQ,GAAG,IAAAC,sBAAiB,EAACL,MAAM,CAAC,EAC5B,IAAAM,2BAAmB,EAAC,CAAC,EACrB,IAAAC,oDAAyB,EAAC,CAAC,CAC9B;AACL,CAAC;AAAC9B,OAAA,CAAAsB,wBAAA,GAAAA,wBAAA;AAGK,MAAMS,wBAAwB,GAAIR,MAA4B,IAAK;EACtE,OAAO;EACH;AACR;AACA;EACQ,IAAAS,4BAAmB,EAACT,MAAM,CAAC,EAC3B,IAAAU,uCAAyB,EAAC,CAAC,EAC3B,IAAAC,kCAAmB,EAAC,CAAC,EACrB,IAAAC,sCAAqB,EAAC,CAAC,EACvB,IAAAC,4BAAgB,EAAC,CAAC,EAClB,GAAG,IAAAC,+BAAsB,EAAC,CAAC,CAC9B;AACL,CAAC;AAACrC,OAAA,CAAA+B,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CmsEntry, CmsEntryValues, CmsModelManager, UpdateCmsEntryInput, UpdateCmsEntryOptionsInput } from "../types";
|
|
1
|
+
import type { CmsEntry, CmsEntryValues, CmsModelManager, UpdateCmsEntryInput, UpdateCmsEntryOptionsInput } from "../types";
|
|
2
2
|
export interface ISingletonModelManager<T extends CmsEntryValues = CmsEntryValues> {
|
|
3
3
|
update(data: UpdateCmsEntryInput, options?: UpdateCmsEntryOptionsInput): Promise<CmsEntry<T>>;
|
|
4
4
|
get(): Promise<CmsEntry<T>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","require","_constants","_utils","SingletonModelManager","constructor","manager","model","tags","includes","CMS_MODEL_SINGLETON_TAG","WebinyError","message","code","data","update","options","entry","get","id","createCacheKey","modelId","algorithm","encoding","create","skipValidators","exports"],"sources":["SingletonModelManager.ts"],"sourcesContent":["import {\n CmsEntry,\n CmsEntryValues,\n CmsModelManager,\n UpdateCmsEntryInput,\n UpdateCmsEntryOptionsInput\n} from \"~/types\";\nimport { WebinyError } from \"@webiny/error\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"~/constants\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport interface ISingletonModelManager<T extends CmsEntryValues = CmsEntryValues> {\n update(data: UpdateCmsEntryInput, options?: UpdateCmsEntryOptionsInput): Promise<CmsEntry<T>>;\n get(): Promise<CmsEntry<T>>;\n}\n\nexport class SingletonModelManager<T extends CmsEntryValues> implements ISingletonModelManager<T> {\n private readonly manager: CmsModelManager<T>;\n\n private constructor(manager: CmsModelManager<T>) {\n if (!manager.model.tags?.includes(CMS_MODEL_SINGLETON_TAG)) {\n throw new WebinyError({\n message: \"Model is not marked as singular.\",\n code: \"MODEL_NOT_MARKED_AS_SINGULAR\",\n data: {\n model: manager.model\n }\n });\n }\n this.manager = manager;\n }\n\n public async update(\n data: UpdateCmsEntryInput,\n options?: UpdateCmsEntryOptionsInput\n ): Promise<CmsEntry<T>> {\n const entry = await this.get();\n\n return await this.manager.update(entry.id, data, options);\n }\n\n public async get(): Promise<CmsEntry<T>> {\n const id = createCacheKey(this.manager.model.modelId, {\n algorithm: \"sha256\",\n encoding: \"hex\"\n });\n try {\n return await this.manager.get(`${id}#0001`);\n } catch {\n return await this.manager.create(\n {\n id\n },\n {\n skipValidators: [\"required\"]\n }\n );\n }\n }\n\n public static create<T extends CmsEntryValues>(\n manager: CmsModelManager<T>\n ): ISingletonModelManager<T> {\n return new SingletonModelManager<T>(manager);\n }\n}\n"],"mappings":";;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,G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_error","require","_constants","_utils","SingletonModelManager","constructor","manager","model","tags","includes","CMS_MODEL_SINGLETON_TAG","WebinyError","message","code","data","update","options","entry","get","id","createCacheKey","modelId","algorithm","encoding","create","skipValidators","exports"],"sources":["SingletonModelManager.ts"],"sourcesContent":["import type {\n CmsEntry,\n CmsEntryValues,\n CmsModelManager,\n UpdateCmsEntryInput,\n UpdateCmsEntryOptionsInput\n} from \"~/types\";\nimport { WebinyError } from \"@webiny/error\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"~/constants\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport interface ISingletonModelManager<T extends CmsEntryValues = CmsEntryValues> {\n update(data: UpdateCmsEntryInput, options?: UpdateCmsEntryOptionsInput): Promise<CmsEntry<T>>;\n get(): Promise<CmsEntry<T>>;\n}\n\nexport class SingletonModelManager<T extends CmsEntryValues> implements ISingletonModelManager<T> {\n private readonly manager: CmsModelManager<T>;\n\n private constructor(manager: CmsModelManager<T>) {\n if (!manager.model.tags?.includes(CMS_MODEL_SINGLETON_TAG)) {\n throw new WebinyError({\n message: \"Model is not marked as singular.\",\n code: \"MODEL_NOT_MARKED_AS_SINGULAR\",\n data: {\n model: manager.model\n }\n });\n }\n this.manager = manager;\n }\n\n public async update(\n data: UpdateCmsEntryInput,\n options?: UpdateCmsEntryOptionsInput\n ): Promise<CmsEntry<T>> {\n const entry = await this.get();\n\n return await this.manager.update(entry.id, data, options);\n }\n\n public async get(): Promise<CmsEntry<T>> {\n const id = createCacheKey(this.manager.model.modelId, {\n algorithm: \"sha256\",\n encoding: \"hex\"\n });\n try {\n return await this.manager.get(`${id}#0001`);\n } catch {\n return await this.manager.create(\n {\n id\n },\n {\n skipValidators: [\"required\"]\n }\n );\n }\n }\n\n public static create<T extends CmsEntryValues>(\n manager: CmsModelManager<T>\n ): ISingletonModelManager<T> {\n return new SingletonModelManager<T>(manager);\n }\n}\n"],"mappings":";;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UA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ignoreList":[]}
|
package/modelManager/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_DefaultCmsModelManager","require","_SingletonModelManager","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","plugin","type","name","create","context","model","DefaultCmsModelManager","createDefaultModelManager"],"sources":["index.ts"],"sourcesContent":["import { CmsModelManager, ModelManagerPlugin } from \"~/types\";\nimport { DefaultCmsModelManager } from \"./DefaultCmsModelManager\";\nexport * from \"./SingletonModelManager\";\n\nconst plugin: ModelManagerPlugin = {\n type: \"cms-content-model-manager\",\n name: \"content-model-manager-default\",\n async create(context, model) {\n return new DefaultCmsModelManager(context, model) as CmsModelManager<any>;\n }\n};\n\nexport const createDefaultModelManager = () => plugin;\n"],"mappings":";;;;;;;;;AACA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,sBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,sBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,sBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,MAAMS,MAA0B,GAAG;EAC/BC,IAAI,EAAE,2BAA2B;EACjCC,IAAI,EAAE,+BAA+B;EACrC,MAAMC,MAAMA,CAACC,OAAO,EAAEC,KAAK,EAAE;IACzB,OAAO,IAAIC,8CAAsB,CAACF,OAAO,EAAEC,KAAK,CAAC;EACrD;AACJ,CAAC;AAEM,MAAME,yBAAyB,GAAGA,CAAA,KAAMP,MAAM;AAACJ,OAAA,CAAAW,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_DefaultCmsModelManager","require","_SingletonModelManager","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","plugin","type","name","create","context","model","DefaultCmsModelManager","createDefaultModelManager"],"sources":["index.ts"],"sourcesContent":["import type { CmsModelManager, ModelManagerPlugin } from \"~/types\";\nimport { DefaultCmsModelManager } from \"./DefaultCmsModelManager\";\nexport * from \"./SingletonModelManager\";\n\nconst plugin: ModelManagerPlugin = {\n type: \"cms-content-model-manager\",\n name: \"content-model-manager-default\",\n async create(context, model) {\n return new DefaultCmsModelManager(context, model) as CmsModelManager<any>;\n }\n};\n\nexport const createDefaultModelManager = () => plugin;\n"],"mappings":";;;;;;;;;AACA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,sBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,sBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,sBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,MAAMS,MAA0B,GAAG;EAC/BC,IAAI,EAAE,2BAA2B;EACjCC,IAAI,EAAE,+BAA+B;EACrC,MAAMC,MAAMA,CAACC,OAAO,EAAEC,KAAK,EAAE;IACzB,OAAO,IAAIC,8CAAsB,CAACF,OAAO,EAAEC,KAAK,CAAC;EACrD;AACJ,CAAC;AAEM,MAAME,yBAAyB,GAAGA,CAAA,KAAMP,MAAM;AAACJ,OAAA,CAAAW,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms:base"
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"@babel/code-frame": "7.26.2",
|
|
22
22
|
"@graphql-tools/merge": "9.0.8",
|
|
23
23
|
"@graphql-tools/schema": "10.0.7",
|
|
24
|
-
"@webiny/api": "6.0.0-alpha.
|
|
25
|
-
"@webiny/api-i18n": "6.0.0-alpha.
|
|
26
|
-
"@webiny/api-security": "6.0.0-alpha.
|
|
27
|
-
"@webiny/api-tenancy": "6.0.0-alpha.
|
|
28
|
-
"@webiny/error": "6.0.0-alpha.
|
|
29
|
-
"@webiny/handler": "6.0.0-alpha.
|
|
30
|
-
"@webiny/handler-aws": "6.0.0-alpha.
|
|
31
|
-
"@webiny/handler-db": "6.0.0-alpha.
|
|
32
|
-
"@webiny/handler-graphql": "6.0.0-alpha.
|
|
33
|
-
"@webiny/lexical-converter": "6.0.0-alpha.
|
|
34
|
-
"@webiny/plugins": "6.0.0-alpha.
|
|
35
|
-
"@webiny/pubsub": "6.0.0-alpha.
|
|
36
|
-
"@webiny/utils": "6.0.0-alpha.
|
|
37
|
-
"@webiny/validation": "6.0.0-alpha.
|
|
24
|
+
"@webiny/api": "6.0.0-alpha.2",
|
|
25
|
+
"@webiny/api-i18n": "6.0.0-alpha.2",
|
|
26
|
+
"@webiny/api-security": "6.0.0-alpha.2",
|
|
27
|
+
"@webiny/api-tenancy": "6.0.0-alpha.2",
|
|
28
|
+
"@webiny/error": "6.0.0-alpha.2",
|
|
29
|
+
"@webiny/handler": "6.0.0-alpha.2",
|
|
30
|
+
"@webiny/handler-aws": "6.0.0-alpha.2",
|
|
31
|
+
"@webiny/handler-db": "6.0.0-alpha.2",
|
|
32
|
+
"@webiny/handler-graphql": "6.0.0-alpha.2",
|
|
33
|
+
"@webiny/lexical-converter": "6.0.0-alpha.2",
|
|
34
|
+
"@webiny/plugins": "6.0.0-alpha.2",
|
|
35
|
+
"@webiny/pubsub": "6.0.0-alpha.2",
|
|
36
|
+
"@webiny/utils": "6.0.0-alpha.2",
|
|
37
|
+
"@webiny/validation": "6.0.0-alpha.2",
|
|
38
38
|
"dot-prop": "6.0.1",
|
|
39
39
|
"graphql": "15.9.0",
|
|
40
40
|
"graphql-tag": "2.12.6",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/babel__code-frame": "7.0.6",
|
|
52
|
-
"@webiny/api-wcp": "6.0.0-alpha.
|
|
53
|
-
"@webiny/aws-sdk": "6.0.0-alpha.
|
|
54
|
-
"@webiny/cli": "6.0.0-alpha.
|
|
55
|
-
"@webiny/db-dynamodb": "6.0.0-alpha.
|
|
52
|
+
"@webiny/api-wcp": "6.0.0-alpha.2",
|
|
53
|
+
"@webiny/aws-sdk": "6.0.0-alpha.2",
|
|
54
|
+
"@webiny/cli": "6.0.0-alpha.2",
|
|
55
|
+
"@webiny/db-dynamodb": "6.0.0-alpha.2",
|
|
56
56
|
"@webiny/handler-db": "0.0.0",
|
|
57
|
-
"@webiny/project-utils": "6.0.0-alpha.
|
|
57
|
+
"@webiny/project-utils": "6.0.0-alpha.2",
|
|
58
58
|
"apollo-graphql": "0.9.7",
|
|
59
59
|
"graphql": "15.9.0",
|
|
60
60
|
"jest": "29.7.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"build": "node ../cli/bin.js run build",
|
|
72
72
|
"watch": "node ../cli/bin.js run watch"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "7c9e8fbfd62a57ece5f880dbad6c864636b0355e"
|
|
75
75
|
}
|
package/parameters/header.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CACjB,eAAeV,UAAU,CAACO,IAAI,oBAAoBP,UAAU,CAACS,MAAM,IAAI,EACvE,yBAAyB,EACzB;QACIJ;MACJ,CACJ,CAAC;IACL,CAAC,MAAM,IAAI,CAACC,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MAC1C,MAAM,IAAII,cAAW,CACjB,eAAeV,UAAU,CAACS,MAAM,oBAAoBT,UAAU,CAACO,IAAI,IAAI,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","ignoreList":[]}
|
|
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 type { 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,CACjB,eAAeV,UAAU,CAACO,IAAI,oBAAoBP,UAAU,CAACS,MAAM,IAAI,EACvE,yBAAyB,EACzB;QACIJ;MACJ,CACJ,CAAC;IACL,CAAC,MAAM,IAAI,CAACC,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MAC1C,MAAM,IAAII,cAAW,CACjB,eAAeV,UAAU,CAACS,MAAM,oBAAoBT,UAAU,CAACO,IAAI,IAAI,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","ignoreList":[]}
|
package/parameters/manual.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CmsParametersPluginResponseLocale, CmsParametersPluginResponseType } from "../plugins/CmsParametersPlugin";
|
|
2
|
+
import { CmsParametersPlugin } from "../plugins/CmsParametersPlugin";
|
|
2
3
|
export interface ManualPluginParams {
|
|
3
4
|
endpointType?: CmsParametersPluginResponseType;
|
|
4
5
|
locale?: CmsParametersPluginResponseLocale;
|
package/parameters/manual.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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 type {\n CmsParametersPluginResponseLocale,\n CmsParametersPluginResponseType\n} from \"~/plugins/CmsParametersPlugin\";\nimport { CmsParametersPlugin } 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;AAKA,IAAAC,oBAAA,GAAAD,OAAA;AARA;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,CACjB,gEAAgE,EAChE,yBAAyB,EACzB;QACI,GAAGL;MACP,CACJ,CAAC;IACL,CAAC,MAAM,IAAI,CAACI,MAAM,EAAE;MAChB,MAAM,IAAIC,cAAW,CACjB,gEAAgE,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","ignoreList":[]}
|
package/parameters/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CAAC,mCAAmC,CAAC;IAC9D,CAAC,MAAM,IAAI,CAACD,MAAM,EAAE;MAChB,MAAM,IAAIC,cAAW,CAAC,qCAAqC,CAAC;IAChE,CAAC,MAAM,IAAIR,gBAAgB,CAACS,QAAQ,CAACH,IAAmB,CAAC,KAAK,KAAK,EAAE;MACjE,MAAM,IAAIE,cAAW,CAAC,aAAaF,IAAI,gBAAgB,CAAC;IAC5D;IAEA,OAAO;MACHA,IAAI,EAAEA,IAAmB;MACzBC;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAT,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
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 type { 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,CAAC,mCAAmC,CAAC;IAC9D,CAAC,MAAM,IAAI,CAACD,MAAM,EAAE;MAChB,MAAM,IAAIC,cAAW,CAAC,qCAAqC,CAAC;IAChE,CAAC,MAAM,IAAIR,gBAAgB,CAACS,QAAQ,CAACH,IAAmB,CAAC,KAAK,KAAK,EAAE;MACjE,MAAM,IAAIE,cAAW,CAAC,aAAaF,IAAI,gBAAgB,CAAC;IAC5D;IAEA,OAAO;MACHA,IAAI,EAAEA,IAAmB;MACzBC;IACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAT,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { GraphQLSchemaPluginConfig as BaseGraphQLSchemaPluginConfig, IGraphQLSchemaPlugin } from "@webiny/handler-graphql";
|
|
2
|
+
import { GraphQLSchemaPlugin } from "@webiny/handler-graphql";
|
|
3
|
+
import type { CmsContext } from "../../types";
|
|
3
4
|
export type ICmsGraphQLSchemaPlugin<T extends CmsContext = CmsContext> = IGraphQLSchemaPlugin<T>;
|
|
4
5
|
export type CmsGraphQLSchemaPluginConfig<T extends CmsContext = CmsContext> = BaseGraphQLSchemaPluginConfig<T>;
|
|
5
6
|
export declare class CmsGraphQLSchemaPlugin<T extends CmsContext = CmsContext> extends GraphQLSchemaPlugin<T> implements ICmsGraphQLSchemaPlugin<T> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_handlerGraphql","require","CmsGraphQLSchemaPlugin","GraphQLSchemaPlugin","type","exports","createCmsGraphQLSchemaPlugin","config"],"sources":["CmsGraphQLSchemaPlugin.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"names":["_handlerGraphql","require","CmsGraphQLSchemaPlugin","GraphQLSchemaPlugin","type","exports","createCmsGraphQLSchemaPlugin","config"],"sources":["CmsGraphQLSchemaPlugin.ts"],"sourcesContent":["import type {\n GraphQLSchemaPluginConfig as BaseGraphQLSchemaPluginConfig,\n IGraphQLSchemaPlugin\n} from \"@webiny/handler-graphql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport type { CmsContext } from \"~/types\";\n\nexport type ICmsGraphQLSchemaPlugin<T extends CmsContext = CmsContext> = IGraphQLSchemaPlugin<T>;\n\nexport type CmsGraphQLSchemaPluginConfig<T extends CmsContext = CmsContext> =\n BaseGraphQLSchemaPluginConfig<T>;\n\nexport class CmsGraphQLSchemaPlugin<T extends CmsContext = CmsContext>\n extends GraphQLSchemaPlugin<T>\n implements ICmsGraphQLSchemaPlugin<T>\n{\n public static override readonly type = \"cms.graphql.schema\";\n}\n\nexport const createCmsGraphQLSchemaPlugin = <T extends CmsContext = CmsContext>(\n config: CmsGraphQLSchemaPluginConfig<T>\n): ICmsGraphQLSchemaPlugin<T> => {\n return new CmsGraphQLSchemaPlugin(config);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,eAAA,GAAAC,OAAA;AAQO,MAAMC,sBAAsB,SACvBC,mCAAmB,CAE/B;EACI,OAAgCC,IAAI,GAAG,oBAAoB;AAC/D;AAACC,OAAA,CAAAH,sBAAA,GAAAA,sBAAA;AAEM,MAAMI,4BAA4B,GACrCC,MAAuC,IACV;EAC7B,OAAO,IAAIL,sBAAsB,CAACK,MAAM,CAAC;AAC7C,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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","ignoreList":[]}
|
|
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 type { 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","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import { CmsGroup as BaseCmsGroup } from "../types";
|
|
2
|
+
import type { CmsGroup as BaseCmsGroup } from "../types";
|
|
3
3
|
export interface CmsGroupInput extends Omit<BaseCmsGroup, "locale" | "tenant" | "webinyVersion" | "isPlugin"> {
|
|
4
4
|
tenant?: string;
|
|
5
5
|
locale?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","CmsGroupPlugin","Plugin","type","constructor","contentModelGroup","isPlugin","exports","createCmsGroup","group","createCmsGroupPlugin","createModelGroupPlugin"],"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\n/**\n * @deprecated Use `createCmsGroupPlugin` instead.\n */\nexport const createCmsGroup = (group: CmsGroup): CmsGroupPlugin => {\n return new CmsGroupPlugin(group);\n};\n\n/**\n * @deprecated Use `createModelGroupPlugin` instead.\n */\nexport const createCmsGroupPlugin = (group: CmsGroup): CmsGroupPlugin => {\n return new CmsGroupPlugin(group);\n};\n\nexport const createModelGroupPlugin = (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;;AAEA;AACA;AACA;AAFAC,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAGO,MAAMO,cAAc,GAAIC,KAAe,IAAqB;EAC/D,OAAO,IAAIR,cAAc,CAACQ,KAAK,CAAC;AACpC,CAAC;;AAED;AACA;AACA;AAFAF,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAGO,MAAME,oBAAoB,GAAID,KAAe,IAAqB;EACrE,OAAO,IAAIR,cAAc,CAACQ,KAAK,CAAC;AACpC,CAAC;AAACF,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAEK,MAAMC,sBAAsB,GAAIF,KAAe,IAAqB;EACvE,OAAO,IAAIR,cAAc,CAACQ,KAAK,CAAC;AACpC,CAAC;AAACF,OAAA,CAAAI,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugins","require","CmsGroupPlugin","Plugin","type","constructor","contentModelGroup","isPlugin","exports","createCmsGroup","group","createCmsGroupPlugin","createModelGroupPlugin"],"sources":["CmsGroupPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { 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\n/**\n * @deprecated Use `createCmsGroupPlugin` instead.\n */\nexport const createCmsGroup = (group: CmsGroup): CmsGroupPlugin => {\n return new CmsGroupPlugin(group);\n};\n\n/**\n * @deprecated Use `createModelGroupPlugin` instead.\n */\nexport const createCmsGroupPlugin = (group: CmsGroup): CmsGroupPlugin => {\n return new CmsGroupPlugin(group);\n};\n\nexport const createModelGroupPlugin = (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;;AAEA;AACA;AACA;AAFAC,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAGO,MAAMO,cAAc,GAAIC,KAAe,IAAqB;EAC/D,OAAO,IAAIR,cAAc,CAACQ,KAAK,CAAC;AACpC,CAAC;;AAED;AACA;AACA;AAFAF,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAGO,MAAME,oBAAoB,GAAID,KAAe,IAAqB;EACrE,OAAO,IAAIR,cAAc,CAACQ,KAAK,CAAC;AACpC,CAAC;AAACF,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAEK,MAAMC,sBAAsB,GAAIF,KAAe,IAAqB;EACvE,OAAO,IAAIR,cAAc,CAACQ,KAAK,CAAC;AACpC,CAAC;AAACF,OAAA,CAAAI,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Field converters are used to convert the fieldId to storageId and vice versa.
|
|
3
3
|
*/
|
|
4
4
|
import { Plugin } from "@webiny/plugins";
|
|
5
|
-
import { CmsEntryValues, CmsModelFieldWithParent } from "../types";
|
|
6
|
-
import { ConverterCollection } from "../utils/converters/ConverterCollection";
|
|
5
|
+
import type { CmsEntryValues, CmsModelFieldWithParent } from "../types";
|
|
6
|
+
import type { ConverterCollection } from "../utils/converters/ConverterCollection";
|
|
7
7
|
export interface ConvertParams<F = CmsModelFieldWithParent> {
|
|
8
8
|
field: F;
|
|
9
9
|
value: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","CmsModelFieldConverterPlugin","Plugin","type","exports"],"sources":["CmsModelFieldConverterPlugin.ts"],"sourcesContent":["/**\n * Field converters are used to convert the fieldId to storageId and vice versa.\n */\nimport { 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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAWO,MAAeC,4BAA4B,SAASC,eAAM,CAAC;EAC9D,OAAuBC,IAAI,GAAG,qBAAqB;AAMvD;AAACC,OAAA,CAAAH,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugins","require","CmsModelFieldConverterPlugin","Plugin","type","exports"],"sources":["CmsModelFieldConverterPlugin.ts"],"sourcesContent":["/**\n * Field converters are used to convert the fieldId to storageId and vice versa.\n */\nimport { Plugin } from \"@webiny/plugins\";\nimport type { CmsEntryValues, CmsModelFieldWithParent } from \"~/types\";\nimport type { 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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAWO,MAAeC,4BAA4B,SAASC,eAAM,CAAC;EAC9D,OAAuBC,IAAI,GAAG,qBAAqB;AAMvD;AAACC,OAAA,CAAAH,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import { CmsModel as CmsModelBase, CmsModelField as CmsModelFieldBase, CmsModelFieldSettings as BaseCmsModelFieldSettings } from "../types";
|
|
2
|
+
import type { CmsModel as CmsModelBase, CmsModelField as CmsModelFieldBase, CmsModelFieldSettings as BaseCmsModelFieldSettings } from "../types";
|
|
3
3
|
interface CmsModelFieldSettings extends Omit<BaseCmsModelFieldSettings, "fields"> {
|
|
4
4
|
/**
|
|
5
5
|
* Object field has child fields.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_camelCase","_upperFirst","_pluralize","_plugins","_createFieldStorageId","_validateStorageId","_constants","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","validateStorageId","e","from","data","createFieldStorageId","settings","childFields","push","total","row","count","filter","cell","exports","createCmsModel","createCmsModelPlugin","createModelPlugin","createPrivateModel","authorization","createPrivateModelPlugin","ensureSingletonTag","tags","CMS_MODEL_SINGLETON_TAG","createSingleEntryModel","createSingleEntryModelPlugin","createSingleEntryPrivateModel","createPrivateSingleEntryModelPlugin"],"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\";\nimport { validateStorageId } from \"~/crud/contentModel/validateStorageId\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"~/constants\";\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 * New 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?: boolean;\n singularApiName?: string;\n pluralApiName?: string;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsApiModelFull extends Omit<CmsApiModel, \"fields\"> {\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?: boolean;\n titleFieldId?: string;\n singularApiName?: never;\n pluralApiName?: never;\n isPrivate: true;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsPrivateModelFull\n extends Omit<CmsPrivateModel, \"fields\" | \"createdBy\" | \"createdOn\" | \"savedOn\"> {\n fields: CmsModelFieldBase[];\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 delete input[\"noValidate\"];\n\n return {\n ...modelPlugin,\n ...input,\n // Since `noValidate` is set, we trust the input, and cast to `CmsModelFieldBase`.\n fields: input.fields as CmsModelFieldBase[],\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\" (id: ${input.id}) 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;\n if (storageId) {\n try {\n validateStorageId(storageId);\n } catch (e) {\n throw WebinyError.from(e, {\n data: { model, storageId, field: input }\n });\n }\n } else {\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\n/**\n * @deprecated Use `createCmsModelPlugin` instead.\n */\nexport const createCmsModel = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\n/**\n * @deprecated Use `createModelPlugin` instead.\n */\nexport const createCmsModelPlugin = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\nexport const createModelPlugin = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\n/**\n * @deprecated Use `createPrivateModelPlugin` instead.\n */\nexport const createPrivateModel = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n): CmsPrivateModelFull => {\n return {\n authorization: false,\n noValidate: true,\n isPrivate: true,\n group: {\n id: \"private\",\n name: \"Private Models\"\n },\n ...input\n };\n};\n\nexport const createPrivateModelPlugin = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n): CmsModelPlugin => {\n return createModelPlugin(\n {\n authorization: false,\n noValidate: true,\n isPrivate: true,\n group: {\n id: \"private\",\n name: \"Private Models\"\n },\n ...input\n },\n {\n validateLayout: false\n }\n );\n};\n\nconst ensureSingletonTag = (input?: string[]) => {\n const tags = input || [];\n return tags.includes(CMS_MODEL_SINGLETON_TAG) ? tags : [...tags, CMS_MODEL_SINGLETON_TAG];\n};\n\n/**\n * @deprecated Use `createSingleEntryModelPlugin` instead.\n */\nexport const createSingleEntryModel = (input: CmsModelInput, options?: CmsModelPluginOptions) => {\n return createCmsModelPlugin(\n {\n ...input,\n tags: ensureSingletonTag(input.tags)\n },\n options\n );\n};\n\nexport const createSingleEntryModelPlugin = (\n input: CmsModelInput,\n options?: CmsModelPluginOptions\n) => {\n return createModelPlugin(\n {\n ...input,\n tags: ensureSingletonTag(input.tags)\n },\n options\n );\n};\n\n/**\n * @deprecated Use `createSingleEntryPrivateModelPlugin` instead.\n */\nexport const createSingleEntryPrivateModel = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n) => {\n return createPrivateModel({\n ...input,\n tags: ensureSingletonTag(input.tags)\n });\n};\n\nexport const createPrivateSingleEntryModelPlugin = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n) => {\n return createPrivateModelPlugin({\n ...input,\n tags: ensureSingletonTag(input.tags)\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;AAMA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAEA,MAAMQ,aAAa,GAAIC,IAAY,IAAK;EACpC,OAAO,IAAAC,mBAAU,EAAC,IAAAC,kBAAS,EAACF,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,MAAMG,mBAAmB,GAAIH,IAAY,IAAK;EAC1C,OAAO,IAAAI,kBAAS,EAACL,aAAa,CAACC,IAAI,CAAC,CAAC;AACzC,CAAC;AA6EM,MAAMK,cAAc,SAASC,eAAM,CAAC;EACvC,OAAgCC,IAAI,GAAW,mBAAmB;EAKlEC,WAAWA,CAACC,YAA2B,EAAEC,OAA+B,EAAE;IACtE,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACD,YAAY,G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D,KAAoB,EAAEF,OAA+B,KAAK;EAC7F,OAAO8C,oBAAoB,CACvB;IACI,GAAG5C,KAAK;IACRkD,IAAI,EAAED,kBAAkB,CAACjD,KAAK,CAACkD,IAAI;EACvC,CAAC,EACDpD,OACJ,CAAC;AACL,CAAC;AAAC4C,OAAA,CAAAU,sBAAA,GAAAA,sBAAA;AAEK,MAAMC,4BAA4B,GAAGA,CACxCrD,KAAoB,EACpBF,OAA+B,KAC9B;EACD,OAAO+C,iBAAiB,CACpB;IACI,GAAG7C,KAAK;IACRkD,IAAI,EAAED,kBAAkB,CAACjD,KAAK,CAACkD,IAAI;EACvC,CAAC,EACDpD,OACJ,CAAC;AACL,CAAC;;AAED;AACA;AACA;AAFA4C,OAAA,CAAAW,4BAAA,GAAAA,4BAAA;AAGO,MAAMC,6BAA6B,GACtCtD,KAAuD,IACtD;EACD,OAAO8C,kBAAkB,CAAC;IACtB,GAAG9C,KAAK;IACRkD,IAAI,EAAED,kBAAkB,CAACjD,KAAK,CAACkD,IAAI;EACvC,CAAC,CAAC;AACN,CAAC;AAACR,OAAA,CAAAY,6BAAA,GAAAA,6BAAA;AAEK,MAAMC,mCAAmC,GAC5CvD,KAAuD,IACtD;EACD,OAAOgD,wBAAwB,CAAC;IAC5B,GAAGhD,KAAK;IACRkD,IAAI,EAAED,kBAAkB,CAACjD,KAAK,CAACkD,IAAI;EACvC,CAAC,CAAC;AACN,CAAC;AAACR,OAAA,CAAAa,mCAAA,GAAAA,mCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_camelCase","_upperFirst","_pluralize","_plugins","_createFieldStorageId","_validateStorageId","_constants","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","validateStorageId","e","from","data","createFieldStorageId","settings","childFields","push","total","row","count","filter","cell","exports","createCmsModel","createCmsModelPlugin","createModelPlugin","createPrivateModel","authorization","createPrivateModelPlugin","ensureSingletonTag","tags","CMS_MODEL_SINGLETON_TAG","createSingleEntryModel","createSingleEntryModelPlugin","createSingleEntryPrivateModel","createPrivateSingleEntryModelPlugin"],"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 type {\n CmsModel as CmsModelBase,\n CmsModelField as CmsModelFieldBase,\n CmsModelFieldSettings as BaseCmsModelFieldSettings\n} from \"~/types\";\nimport { createFieldStorageId } from \"~/crud/contentModel/createFieldStorageId\";\nimport { validateStorageId } from \"~/crud/contentModel/validateStorageId\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"~/constants\";\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 * New 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?: boolean;\n singularApiName?: string;\n pluralApiName?: string;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsApiModelFull extends Omit<CmsApiModel, \"fields\"> {\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?: boolean;\n titleFieldId?: string;\n singularApiName?: never;\n pluralApiName?: never;\n isPrivate: true;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsPrivateModelFull\n extends Omit<CmsPrivateModel, \"fields\" | \"createdBy\" | \"createdOn\" | \"savedOn\"> {\n fields: CmsModelFieldBase[];\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 delete input[\"noValidate\"];\n\n return {\n ...modelPlugin,\n ...input,\n // Since `noValidate` is set, we trust the input, and cast to `CmsModelFieldBase`.\n fields: input.fields as CmsModelFieldBase[],\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\" (id: ${input.id}) 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;\n if (storageId) {\n try {\n validateStorageId(storageId);\n } catch (e) {\n throw WebinyError.from(e, {\n data: { model, storageId, field: input }\n });\n }\n } else {\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\n/**\n * @deprecated Use `createCmsModelPlugin` instead.\n */\nexport const createCmsModel = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\n/**\n * @deprecated Use `createModelPlugin` instead.\n */\nexport const createCmsModelPlugin = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\nexport const createModelPlugin = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\n/**\n * @deprecated Use `createPrivateModelPlugin` instead.\n */\nexport const createPrivateModel = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n): CmsPrivateModelFull => {\n return {\n authorization: false,\n noValidate: true,\n isPrivate: true,\n group: {\n id: \"private\",\n name: \"Private Models\"\n },\n ...input\n };\n};\n\nexport const createPrivateModelPlugin = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n): CmsModelPlugin => {\n return createModelPlugin(\n {\n authorization: false,\n noValidate: true,\n isPrivate: true,\n group: {\n id: \"private\",\n name: \"Private Models\"\n },\n ...input\n },\n {\n validateLayout: false\n }\n );\n};\n\nconst ensureSingletonTag = (input?: string[]) => {\n const tags = input || [];\n return tags.includes(CMS_MODEL_SINGLETON_TAG) ? tags : [...tags, CMS_MODEL_SINGLETON_TAG];\n};\n\n/**\n * @deprecated Use `createSingleEntryModelPlugin` instead.\n */\nexport const createSingleEntryModel = (input: CmsModelInput, options?: CmsModelPluginOptions) => {\n return createCmsModelPlugin(\n {\n ...input,\n tags: ensureSingletonTag(input.tags)\n },\n options\n );\n};\n\nexport const createSingleEntryModelPlugin = (\n input: CmsModelInput,\n options?: CmsModelPluginOptions\n) => {\n return createModelPlugin(\n {\n ...input,\n tags: ensureSingletonTag(input.tags)\n },\n options\n );\n};\n\n/**\n * @deprecated Use `createSingleEntryPrivateModelPlugin` instead.\n */\nexport const createSingleEntryPrivateModel = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n) => {\n return createPrivateModel({\n ...input,\n tags: ensureSingletonTag(input.tags)\n });\n};\n\nexport const createPrivateSingleEntryModelPlugin = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n) => {\n return createPrivateModelPlugin({\n ...input,\n tags: ensureSingletonTag(input.tags)\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;AAMA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAEA,MAAMQ,aAAa,GAAIC,IAAY,IAAK;EACpC,OAAO,IAAAC,mBAAU,EAAC,IAAAC,kBAAS,EAACF,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,MAAMG,mBAAmB,GAAIH,IAAY,IAAK;EAC1C,OAAO,IAAAI,kBAAS,EAACL,aAAa,CAACC,IAAI,CAAC,CAAC;AACzC,CAAC;AA6EM,MAAMK,cAAc,SAASC,eAAM,CAAC;EACvC,OAAgCC,IAAI,GAAW,mBAAmB;EAKlEC,WAAWA,CAACC,YAA2B,EAAEC,OAA+B,EAAE;IACtE,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACD,YAAY,GAAG,IAAI,CAACE,UAAU,CAACF,YAAY,CAAC;EACrD;EAEQE,UAAUA,CAACC,KAAoB,EAAuB;IAC1D,MAAMC,SAAS,GAAGD,KAAK,CAACC,SAAS,IAAI,KAAK;IAE1C,MAAMC,eAAe,GAAGF,KAAK,CAACE,eAAe,GACvCf,aAAa,CAACa,KAAK,CAACE,eAAe,CAAC,GACpCf,aAAa,CAACa,KAAK,CAACZ,IAAI,CAAC;IAE/B,MAAMe,aAAa,GAAGH,KAAK,CAACG,aAAa,GACnChB,aAAa,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IACRkD,IAAI,EAAED,kBAAkB,CAACjD,KAAK,CAACkD,IAAI;EACvC,CAAC,EACDpD,OACJ,CAAC;AACL,CAAC;;AAED;AACA;AACA;AAFA4C,OAAA,CAAAW,4BAAA,GAAAA,4BAAA;AAGO,MAAMC,6BAA6B,GACtCtD,KAAuD,IACtD;EACD,OAAO8C,kBAAkB,CAAC;IACtB,GAAG9C,KAAK;IACRkD,IAAI,EAAED,kBAAkB,CAACjD,KAAK,CAACkD,IAAI;EACvC,CAAC,CAAC;AACN,CAAC;AAACR,OAAA,CAAAY,6BAAA,GAAAA,6BAAA;AAEK,MAAMC,mCAAmC,GAC5CvD,KAAuD,IACtD;EACD,OAAOgD,wBAAwB,CAAC;IAC5B,GAAGhD,KAAK;IACRkD,IAAI,EAAED,kBAAkB,CAACjD,KAAK,CAACkD,IAAI;EACvC,CAAC,CAAC;AACN,CAAC;AAACR,OAAA,CAAAa,mCAAA,GAAAA,mCAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import { ApiEndpoint, CmsContext } from "../types";
|
|
2
|
+
import type { ApiEndpoint, CmsContext } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* 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.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","CmsParametersPlugin","Plugin","type","constructor","callable","getParameters","context","exports"],"sources":["CmsParametersPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ApiEndpoint, CmsContext } from \"~/types\";\n\n/**\n * 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.\n */\nexport type CmsParametersPluginResponseType = ApiEndpoint | null;\nexport type CmsParametersPluginResponseLocale = string;\n\nexport interface CmsParametersPluginResponse {\n type: CmsParametersPluginResponseType;\n locale: CmsParametersPluginResponseLocale;\n}\n\nexport interface CmsParametersPluginCallable {\n (context: CmsContext): Promise<CmsParametersPluginResponse | null>;\n}\n\nexport class CmsParametersPlugin extends Plugin {\n public static override readonly type: string = \"cms-parameters-plugin\";\n\n private readonly callable: CmsParametersPluginCallable;\n\n public constructor(callable: CmsParametersPluginCallable) {\n super();\n\n this.callable = callable;\n }\n\n public async getParameters(context: CmsContext): Promise<CmsParametersPluginResponse | null> {\n return this.callable(context);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA;AACA;AACA;;AAaO,MAAMC,mBAAmB,SAASC,eAAM,CAAC;EAC5C,OAAgCC,IAAI,GAAW,uBAAuB;EAI/DC,WAAWA,CAACC,QAAqC,EAAE;IACtD,KAAK,CAAC,CAAC;IAEP,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAaC,aAAaA,CAACC,OAAmB,EAA+C;IACzF,OAAO,IAAI,CAACF,QAAQ,CAACE,OAAO,CAAC;EACjC;AACJ;AAACC,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugins","require","CmsParametersPlugin","Plugin","type","constructor","callable","getParameters","context","exports"],"sources":["CmsParametersPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ApiEndpoint, CmsContext } from \"~/types\";\n\n/**\n * 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.\n */\nexport type CmsParametersPluginResponseType = ApiEndpoint | null;\nexport type CmsParametersPluginResponseLocale = string;\n\nexport interface CmsParametersPluginResponse {\n type: CmsParametersPluginResponseType;\n locale: CmsParametersPluginResponseLocale;\n}\n\nexport interface CmsParametersPluginCallable {\n (context: CmsContext): Promise<CmsParametersPluginResponse | null>;\n}\n\nexport class CmsParametersPlugin extends Plugin {\n public static override readonly type: string = \"cms-parameters-plugin\";\n\n private readonly callable: CmsParametersPluginCallable;\n\n public constructor(callable: CmsParametersPluginCallable) {\n super();\n\n this.callable = callable;\n }\n\n public async getParameters(context: CmsContext): Promise<CmsParametersPluginResponse | null> {\n return this.callable(context);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA;AACA;AACA;;AAaO,MAAMC,mBAAmB,SAASC,eAAM,CAAC;EAC5C,OAAgCC,IAAI,GAAW,uBAAuB;EAI/DC,WAAWA,CAACC,QAAqC,EAAE;IACtD,KAAK,CAAC,CAAC;IAEP,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAaC,aAAaA,CAACC,OAAmB,EAA+C;IACzF,OAAO,IAAI,CAACF,QAAQ,CAACE,OAAO,CAAC;EACjC;AACJ;AAACC,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import { CmsModel, StorageOperationsCmsModel } from "../types";
|
|
2
|
+
import type { CmsModel, StorageOperationsCmsModel } from "../types";
|
|
3
3
|
export interface StorageOperationsCmsModelPluginCallable {
|
|
4
4
|
(model: CmsModel): StorageOperationsCmsModel;
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","StorageOperationsCmsModelPlugin","Plugin","type","name","models","constructor","cb","getModel","input","cacheKey","createCacheKey","model","tenant","locale","modelId","savedOn","join","exports"],"sources":["StorageOperationsCmsModelPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsModel, StorageOperationsCmsModel } from \"~/types\";\n\nexport interface StorageOperationsCmsModelPluginCallable {\n (model: CmsModel): StorageOperationsCmsModel;\n}\n\n/**\n * This plugin should be initialized only once and hence the name.\n */\nexport class StorageOperationsCmsModelPlugin extends Plugin {\n public static override readonly type: string = \"cms.storageOperations.model\";\n public override name = \"cms.storageOperations.model\";\n\n private readonly models: Record<string, StorageOperationsCmsModel> = {};\n private readonly cb: StorageOperationsCmsModelPluginCallable;\n\n public constructor(cb: StorageOperationsCmsModelPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public getModel(input: CmsModel) {\n const cacheKey = this.createCacheKey(input);\n if (this.models[cacheKey]) {\n return this.models[cacheKey];\n }\n const model = this.cb(input);\n\n this.models[cacheKey] = model;\n\n return model;\n }\n\n /**\n * We can cache the converters by having a cache key that is a combination of model ID and savedOn.\n * The models created via the code will not have savedOn, so they will be unknown - and that is ok as they cannot change in the middle of the call.\n *\n * The models created via the CRUD operations might get changed in the middle of the call, so we need to re-create the SO model.\n */\n private createCacheKey(model: CmsModel): string {\n return [model.tenant, model.locale, model.modelId, model.savedOn || \"unknown\"].join(\"#\");\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOA;AACA;AACA;AACO,MAAMC,+BAA+B,SAASC,eAAM,CAAC;EACxD,OAAgCC,IAAI,GAAW,6BAA6B;EAC5DC,IAAI,GAAG,6BAA6B;EAEnCC,MAAM,GAA8C,CAAC,CAAC;EAGhEC,WAAWA,CAACC,EAA2C,EAAE;IAC5D,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEOC,QAAQA,CAACC,KAAe,EAAE;IAC7B,MAAMC,QAAQ,GAAG,IAAI,CAACC,cAAc,CAACF,KAAK,CAAC;IAC3C,IAAI,IAAI,CAACJ,MAAM,CAACK,QAAQ,CAAC,EAAE;MACvB,OAAO,IAAI,CAACL,MAAM,CAACK,QAAQ,CAAC;IAChC;IACA,MAAME,KAAK,GAAG,IAAI,CAACL,EAAE,CAACE,KAAK,CAAC;IAE5B,IAAI,CAACJ,MAAM,CAACK,QAAQ,CAAC,GAAGE,KAAK;IAE7B,OAAOA,KAAK;EAChB;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACYD,cAAcA,CAACC,KAAe,EAAU;IAC5C,OAAO,CAACA,KAAK,CAACC,MAAM,EAAED,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,OAAO,EAAEH,KAAK,CAACI,OAAO,IAAI,SAAS,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;EAC5F;AACJ;AAACC,OAAA,CAAAjB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugins","require","StorageOperationsCmsModelPlugin","Plugin","type","name","models","constructor","cb","getModel","input","cacheKey","createCacheKey","model","tenant","locale","modelId","savedOn","join","exports"],"sources":["StorageOperationsCmsModelPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsModel, StorageOperationsCmsModel } from \"~/types\";\n\nexport interface StorageOperationsCmsModelPluginCallable {\n (model: CmsModel): StorageOperationsCmsModel;\n}\n\n/**\n * This plugin should be initialized only once and hence the name.\n */\nexport class StorageOperationsCmsModelPlugin extends Plugin {\n public static override readonly type: string = \"cms.storageOperations.model\";\n public override name = \"cms.storageOperations.model\";\n\n private readonly models: Record<string, StorageOperationsCmsModel> = {};\n private readonly cb: StorageOperationsCmsModelPluginCallable;\n\n public constructor(cb: StorageOperationsCmsModelPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public getModel(input: CmsModel) {\n const cacheKey = this.createCacheKey(input);\n if (this.models[cacheKey]) {\n return this.models[cacheKey];\n }\n const model = this.cb(input);\n\n this.models[cacheKey] = model;\n\n return model;\n }\n\n /**\n * We can cache the converters by having a cache key that is a combination of model ID and savedOn.\n * The models created via the code will not have savedOn, so they will be unknown - and that is ok as they cannot change in the middle of the call.\n *\n * The models created via the CRUD operations might get changed in the middle of the call, so we need to re-create the SO model.\n */\n private createCacheKey(model: CmsModel): string {\n return [model.tenant, model.locale, model.modelId, model.savedOn || \"unknown\"].join(\"#\");\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOA;AACA;AACA;AACO,MAAMC,+BAA+B,SAASC,eAAM,CAAC;EACxD,OAAgCC,IAAI,GAAW,6BAA6B;EAC5DC,IAAI,GAAG,6BAA6B;EAEnCC,MAAM,GAA8C,CAAC,CAAC;EAGhEC,WAAWA,CAACC,EAA2C,EAAE;IAC5D,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEOC,QAAQA,CAACC,KAAe,EAAE;IAC7B,MAAMC,QAAQ,GAAG,IAAI,CAACC,cAAc,CAACF,KAAK,CAAC;IAC3C,IAAI,IAAI,CAACJ,MAAM,CAACK,QAAQ,CAAC,EAAE;MACvB,OAAO,IAAI,CAACL,MAAM,CAACK,QAAQ,CAAC;IAChC;IACA,MAAME,KAAK,GAAG,IAAI,CAACL,EAAE,CAACE,KAAK,CAAC;IAE5B,IAAI,CAACJ,MAAM,CAACK,QAAQ,CAAC,GAAGE,KAAK;IAE7B,OAAOA,KAAK;EAChB;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACYD,cAAcA,CAACC,KAAe,EAAU;IAC5C,OAAO,CAACA,KAAK,CAACC,MAAM,EAAED,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,OAAO,EAAEH,KAAK,CAACI,OAAO,IAAI,SAAS,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;EAC5F;AACJ;AAACC,OAAA,CAAAjB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Storage transforms are used to transform the data before it is saved to the database and after it is read from the database.
|
|
3
3
|
*/
|
|
4
4
|
import { Plugin } from "@webiny/plugins/Plugin";
|
|
5
|
-
import { CmsModel, CmsModelField, CmsModelFieldType } from "../types";
|
|
6
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
5
|
+
import type { CmsModel, CmsModelField, CmsModelFieldType } from "../types";
|
|
6
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
7
7
|
export interface ToStorageParams<T, F extends CmsModelField> {
|
|
8
8
|
model: CmsModel;
|
|
9
9
|
field: F;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Plugin","require","StorageTransformPlugin","Plugin","type","fieldType","config","constructor","name","toStorage","params","fromStorage","exports","createStorageTransformPlugin"],"sources":["StorageTransformPlugin.ts"],"sourcesContent":["/**\n * Storage transforms are used to transform the data before it is saved to the database and after it is read from the database.\n */\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModel, CmsModelField, CmsModelFieldType } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface ToStorageParams<T, F extends CmsModelField> {\n model: CmsModel;\n field: F;\n value: T;\n getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;\n plugins: PluginsContainer;\n}\n\nexport interface FromStorageParams<T, F extends CmsModelField> {\n model: CmsModel;\n field: Partial<F> & Pick<F, \"id\" | \"fieldId\" | \"storageId\" | \"type\" | \"settings\">;\n value: T;\n getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;\n plugins: PluginsContainer;\n}\n\nexport interface StorageTransformPluginParams<T, R, F extends CmsModelField> {\n name?: string;\n fieldType: CmsModelFieldType;\n toStorage: (params: ToStorageParams<T, F>) => Promise<R>;\n fromStorage: (params: FromStorageParams<R, F>) => Promise<T>;\n}\nexport class StorageTransformPlugin<\n T = any,\n R = any,\n F extends CmsModelField = CmsModelField\n> extends Plugin {\n public static override readonly type: string = \"cms.storage.transform.plugin\";\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n private readonly config: StorageTransformPluginParams<T, R, F>;\n\n public constructor(config: StorageTransformPluginParams<T, R, F>) {\n super();\n this.name = config.name;\n this.config = config;\n }\n\n public toStorage(params: ToStorageParams<T, F>): Promise<R> {\n return this.config.toStorage(params);\n }\n\n public fromStorage(params: FromStorageParams<R, F>): Promise<T> {\n return this.config.fromStorage(params);\n }\n}\n\nexport const createStorageTransformPlugin = <\n T = any,\n R = any,\n F extends CmsModelField = CmsModelField\n>(\n config: StorageTransformPluginParams<T, R, F>\n) => {\n return new StorageTransformPlugin(config);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AA2BO,MAAMC,sBAAsB,SAIzBC,cAAM,CAAC;EACb,OAAgCC,IAAI,GAAW,8BAA8B;EAC7E,IAAWC,SAASA,CAAA,EAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAIOE,WAAWA,CAACD,MAA6C,EAAE;IAC9D,KAAK,CAAC,CAAC;IACP,IAAI,CAACE,IAAI,GAAGF,MAAM,CAACE,IAAI;IACvB,IAAI,CAACF,MAAM,GAAGA,MAAM;EACxB;EAEOG,SAASA,CAACC,MAA6B,EAAc;IACxD,OAAO,IAAI,CAACJ,MAAM,CAACG,SAAS,CAACC,MAAM,CAAC;EACxC;EAEOC,WAAWA,CAACD,MAA+B,EAAc;IAC5D,OAAO,IAAI,CAACJ,MAAM,CAACK,WAAW,CAACD,MAAM,CAAC;EAC1C;AACJ;AAACE,OAAA,CAAAV,sBAAA,GAAAA,sBAAA;AAEM,MAAMW,4BAA4B,GAKrCP,MAA6C,IAC5C;EACD,OAAO,IAAIJ,sBAAsB,CAACI,MAAM,CAAC;AAC7C,CAAC;AAACM,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_Plugin","require","StorageTransformPlugin","Plugin","type","fieldType","config","constructor","name","toStorage","params","fromStorage","exports","createStorageTransformPlugin"],"sources":["StorageTransformPlugin.ts"],"sourcesContent":["/**\n * Storage transforms are used to transform the data before it is saved to the database and after it is read from the database.\n */\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { CmsModel, CmsModelField, CmsModelFieldType } from \"~/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface ToStorageParams<T, F extends CmsModelField> {\n model: CmsModel;\n field: F;\n value: T;\n getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;\n plugins: PluginsContainer;\n}\n\nexport interface FromStorageParams<T, F extends CmsModelField> {\n model: CmsModel;\n field: Partial<F> & Pick<F, \"id\" | \"fieldId\" | \"storageId\" | \"type\" | \"settings\">;\n value: T;\n getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;\n plugins: PluginsContainer;\n}\n\nexport interface StorageTransformPluginParams<T, R, F extends CmsModelField> {\n name?: string;\n fieldType: CmsModelFieldType;\n toStorage: (params: ToStorageParams<T, F>) => Promise<R>;\n fromStorage: (params: FromStorageParams<R, F>) => Promise<T>;\n}\nexport class StorageTransformPlugin<\n T = any,\n R = any,\n F extends CmsModelField = CmsModelField\n> extends Plugin {\n public static override readonly type: string = \"cms.storage.transform.plugin\";\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n private readonly config: StorageTransformPluginParams<T, R, F>;\n\n public constructor(config: StorageTransformPluginParams<T, R, F>) {\n super();\n this.name = config.name;\n this.config = config;\n }\n\n public toStorage(params: ToStorageParams<T, F>): Promise<R> {\n return this.config.toStorage(params);\n }\n\n public fromStorage(params: FromStorageParams<R, F>): Promise<T> {\n return this.config.fromStorage(params);\n }\n}\n\nexport const createStorageTransformPlugin = <\n T = any,\n R = any,\n F extends CmsModelField = CmsModelField\n>(\n config: StorageTransformPluginParams<T, R, F>\n) => {\n return new StorageTransformPlugin(config);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AA2BO,MAAMC,sBAAsB,SAIzBC,cAAM,CAAC;EACb,OAAgCC,IAAI,GAAW,8BAA8B;EAC7E,IAAWC,SAASA,CAAA,EAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAIOE,WAAWA,CAACD,MAA6C,EAAE;IAC9D,KAAK,CAAC,CAAC;IACP,IAAI,CAACE,IAAI,GAAGF,MAAM,CAACE,IAAI;IACvB,IAAI,CAACF,MAAM,GAAGA,MAAM;EACxB;EAEOG,SAASA,CAACC,MAA6B,EAAc;IACxD,OAAO,IAAI,CAACJ,MAAM,CAACG,SAAS,CAACC,MAAM,CAAC;EACxC;EAEOC,WAAWA,CAACD,MAA+B,EAAc;IAC5D,OAAO,IAAI,CAACJ,MAAM,CAACK,WAAW,CAACD,MAAM,CAAC;EAC1C;AACJ;AAACE,OAAA,CAAAV,sBAAA,GAAAA,sBAAA;AAEM,MAAMW,4BAA4B,GAKrCP,MAA6C,IAC5C;EACD,OAAO,IAAIJ,sBAAsB,CAACI,MAAM,CAAC;AAC7C,CAAC;AAACM,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
package/storage/date.d.ts
CHANGED