@webiny/api-headless-cms 0.0.0-unstable.2696f9d9e8 → 0.0.0-unstable.2aaa1916d9
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 +18 -6
- package/constants.js +29 -16
- package/constants.js.map +1 -1
- package/context.d.ts +1 -1
- package/context.js +61 -32
- package/context.js.map +1 -1
- package/crud/AccessControl/AccessControl.d.ts +98 -0
- package/crud/AccessControl/AccessControl.js +542 -0
- package/crud/AccessControl/AccessControl.js.map +1 -0
- package/crud/AccessControl/README.md +47 -0
- package/crud/AccessControl/groups-own.png +0 -0
- package/crud/AccessControl/models-own.png +0 -0
- package/crud/contentEntry/abstractions/IDeleteEntry.d.ts +4 -0
- package/crud/contentEntry/abstractions/IDeleteEntry.js +7 -0
- package/crud/contentEntry/abstractions/IDeleteEntry.js.map +1 -0
- package/crud/contentEntry/abstractions/IDeleteEntryOperation.d.ts +4 -0
- package/crud/contentEntry/abstractions/IDeleteEntryOperation.js +7 -0
- package/crud/contentEntry/abstractions/IDeleteEntryOperation.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetEntriesByIds.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetEntriesByIds.js +7 -0
- package/crud/contentEntry/abstractions/IGetEntriesByIds.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetEntry.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetEntry.js +7 -0
- package/crud/contentEntry/abstractions/IGetEntry.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js +7 -0
- package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js +7 -0
- package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js +7 -0
- package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js +7 -0
- package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js +7 -0
- package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetRevisionById.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetRevisionById.js +7 -0
- package/crud/contentEntry/abstractions/IGetRevisionById.js.map +1 -0
- package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.d.ts +4 -0
- package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js +7 -0
- package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js.map +1 -0
- package/crud/contentEntry/abstractions/IListEntries.d.ts +4 -0
- package/crud/contentEntry/abstractions/IListEntries.js +7 -0
- package/crud/contentEntry/abstractions/IListEntries.js.map +1 -0
- package/crud/contentEntry/abstractions/IListEntriesOperation.d.ts +4 -0
- package/crud/contentEntry/abstractions/IListEntriesOperation.js +7 -0
- package/crud/contentEntry/abstractions/IListEntriesOperation.js.map +1 -0
- package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.d.ts +4 -0
- package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js +7 -0
- package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js.map +1 -0
- package/crud/contentEntry/abstractions/IRestoreEntryFromBin.d.ts +4 -0
- package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js +7 -0
- package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js.map +1 -0
- package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.d.ts +4 -0
- package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js +7 -0
- package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js.map +1 -0
- package/crud/contentEntry/abstractions/index.d.ts +16 -0
- package/crud/contentEntry/abstractions/index.js +183 -0
- package/crud/contentEntry/abstractions/index.js.map +1 -0
- package/crud/contentEntry/afterDelete.d.ts +6 -2
- package/crud/contentEntry/afterDelete.js +15 -1
- 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 +8 -8
- package/crud/contentEntry/entryDataFactories/createEntryData.js +30 -4
- package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.d.ts +8 -6
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js +54 -11
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.d.ts +5 -5
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.js +22 -20
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.d.ts +3 -3
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js +18 -16
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.d.ts +5 -5
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js +10 -8
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.d.ts +5 -5
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js +8 -0
- package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/index.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/entryDataFactories/statuses.js +3 -6
- package/crud/contentEntry/entryDataFactories/statuses.js.map +1 -1
- package/crud/contentEntry/entryDataValidation.d.ts +2 -2
- 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 +10 -10
- 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 +10 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js +58 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.d.ts +7 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js +17 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.d.ts +9 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js +45 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.d.ts +9 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js +22 -0
- package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.d.ts +10 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js +33 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.d.ts +7 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js +17 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.d.ts +9 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js +45 -0
- package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.d.ts +6 -0
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js +21 -0
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.d.ts +9 -0
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js +54 -0
- package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js.map +1 -0
- package/crud/contentEntry/useCases/DeleteEntry/index.d.ts +28 -0
- package/crud/contentEntry/useCases/DeleteEntry/index.js +42 -0
- package/crud/contentEntry/useCases/DeleteEntry/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.d.ts +9 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js +21 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js.map +1 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js +18 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.d.ts +9 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js +28 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js.map +1 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/index.d.ts +13 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/index.js +20 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.d.ts +9 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js +21 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js +18 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.d.ts +9 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js +28 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.d.ts +13 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js +20 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.d.ts +9 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js +22 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js +21 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js +21 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.d.ts +15 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js +22 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.d.ts +9 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js +22 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js.map +1 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js +21 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.d.ts +11 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js +18 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.d.ts +9 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js +21 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js.map +1 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js +18 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.d.ts +9 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js +28 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js.map +1 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.d.ts +13 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js +20 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.d.ts +9 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js +22 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js.map +1 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js +21 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.d.ts +11 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js +18 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.d.ts +9 -0
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js +22 -0
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js.map +1 -0
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js +21 -0
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetRevisionById/index.d.ts +11 -0
- package/crud/contentEntry/useCases/GetRevisionById/index.js +18 -0
- package/crud/contentEntry/useCases/GetRevisionById/index.js.map +1 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.d.ts +9 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js +21 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js.map +1 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js +18 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.d.ts +13 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js +18 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/GetEntry.d.ts +7 -0
- package/crud/contentEntry/useCases/ListEntries/GetEntry.js +29 -0
- package/crud/contentEntry/useCases/ListEntries/GetEntry.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.d.ts +11 -0
- package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js +38 -0
- package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntries.d.ts +7 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntries.js +62 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntries.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.d.ts +14 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js +24 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js +24 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.d.ts +7 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js +25 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.d.ts +7 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js +24 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.d.ts +7 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js +24 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.d.ts +9 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js +22 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.d.ts +8 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js +27 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.d.ts +8 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js +26 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.d.ts +7 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js +36 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.d.ts +11 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js +41 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js.map +1 -0
- package/crud/contentEntry/useCases/ListEntries/index.d.ts +26 -0
- package/crud/contentEntry/useCases/ListEntries/index.js +61 -0
- package/crud/contentEntry/useCases/ListEntries/index.js.map +1 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.d.ts +10 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js +37 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js.map +1 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.d.ts +9 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js +19 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js.map +1 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.d.ts +9 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js +42 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js.map +1 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.d.ts +9 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js +22 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js.map +1 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.d.ts +9 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js +53 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js.map +1 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/index.d.ts +25 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js +24 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js.map +1 -0
- package/crud/contentEntry/useCases/index.d.ts +11 -0
- package/crud/contentEntry/useCases/index.js +128 -0
- package/crud/contentEntry/useCases/index.js.map +1 -0
- package/crud/contentEntry.crud.d.ts +6 -8
- package/crud/contentEntry.crud.js +304 -357
- 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 +3 -5
- package/crud/contentModel/beforeDelete.js +49 -15
- 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 +2 -2
- 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 +6 -2
- package/crud/contentModel/fields/descriptionField.js +14 -28
- package/crud/contentModel/fields/descriptionField.js.map +1 -1
- package/crud/contentModel/fields/getApplicableFieldById.d.ts +2 -0
- package/crud/contentModel/fields/getApplicableFieldById.js +15 -0
- package/crud/contentModel/fields/getApplicableFieldById.js.map +1 -0
- package/crud/contentModel/fields/imageField.d.ts +2 -2
- package/crud/contentModel/fields/imageField.js +9 -28
- package/crud/contentModel/fields/imageField.js.map +1 -1
- package/crud/contentModel/fields/titleField.d.ts +6 -2
- package/crud/contentModel/fields/titleField.js +14 -43
- 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/isModelEndingAllowed.js +1 -2
- package/crud/contentModel/validate/isModelEndingAllowed.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 +1 -1
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel/validateStorageId.d.ts +1 -0
- package/crud/contentModel/validateStorageId.js +19 -0
- package/crud/contentModel/validateStorageId.js.map +1 -0
- package/crud/contentModel/validation.d.ts +84 -63
- package/crud/contentModel/validation.js +5 -5
- package/crud/contentModel/validation.js.map +1 -1
- package/crud/contentModel.crud.d.ts +6 -6
- package/crud/contentModel.crud.js +76 -37
- 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/validation.js.map +1 -1
- package/crud/contentModelGroup.crud.d.ts +6 -6
- package/crud/contentModelGroup.crud.js +17 -28
- 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 +3 -3
- package/export/crud/sanitize.js +2 -1
- package/export/crud/sanitize.js.map +1 -1
- package/export/graphql/index.d.ts +1 -1
- package/export/graphql/index.js +1 -1
- package/export/graphql/index.js.map +1 -1
- package/export/index.js.map +1 -1
- package/export/types.d.ts +5 -5
- package/export/types.js +1 -2
- package/export/types.js.map +1 -1
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +5 -3
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +3 -2
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +23 -65
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +3 -2
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +2 -2
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/index.d.ts +3 -0
- package/fieldConverters/index.js +4 -0
- package/fieldConverters/index.js.map +1 -1
- package/graphql/buildSchemaPlugins.d.ts +3 -3
- 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 +2 -2
- package/graphql/createExecutableSchema.js +14 -7
- package/graphql/createExecutableSchema.js.map +1 -1
- package/graphql/createRequestBody.d.ts +1 -1
- package/graphql/createRequestBody.js.map +1 -1
- package/graphql/formatErrorPayload.js.map +1 -1
- package/graphql/generateSchema.d.ts +2 -2
- package/graphql/generateSchema.js +6 -1
- package/graphql/generateSchema.js.map +1 -1
- package/graphql/getSchema/generateCacheId.d.ts +10 -0
- package/graphql/getSchema/generateCacheId.js +17 -0
- package/graphql/getSchema/generateCacheId.js.map +1 -0
- package/graphql/getSchema/generateCacheKey.d.ts +10 -0
- package/graphql/getSchema/generateCacheKey.js +34 -0
- package/graphql/getSchema/generateCacheKey.js.map +1 -0
- package/graphql/getSchema.d.ts +4 -4
- package/graphql/getSchema.js +13 -50
- package/graphql/getSchema.js.map +1 -1
- package/graphql/graphQLHandlerFactory.d.ts +2 -2
- package/graphql/graphQLHandlerFactory.js.map +1 -1
- package/graphql/handleRequest.d.ts +2 -2
- package/graphql/handleRequest.js +8 -1
- package/graphql/handleRequest.js.map +1 -1
- package/graphql/index.d.ts +4 -3
- package/graphql/index.js +1 -1
- package/graphql/index.js.map +1 -1
- package/graphql/scalars/RevisionId.d.ts +2 -0
- package/graphql/scalars/RevisionId.js +26 -0
- package/graphql/scalars/RevisionId.js.map +1 -0
- package/graphql/scalars/RevisionIdScalarPlugin.d.ts +2 -0
- package/graphql/scalars/RevisionIdScalarPlugin.js +18 -0
- package/graphql/scalars/RevisionIdScalarPlugin.js.map +1 -0
- package/graphql/schema/baseContentSchema.d.ts +3 -3
- package/graphql/schema/baseContentSchema.js +1 -7
- package/graphql/schema/baseContentSchema.js.map +1 -1
- package/graphql/schema/baseSchema.js +12 -5
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/contentEntries.d.ts +3 -3
- package/graphql/schema/contentEntries.js +3 -4
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModelGroups.d.ts +3 -3
- package/graphql/schema/contentModelGroups.js +1 -1
- package/graphql/schema/contentModelGroups.js.map +1 -1
- package/graphql/schema/contentModels.d.ts +4 -5
- package/graphql/schema/contentModels.js +21 -5
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +2 -2
- package/graphql/schema/createFieldResolvers.js +1 -3
- 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/createManageResolvers.d.ts +1 -2
- package/graphql/schema/createManageResolvers.js +24 -49
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.d.ts +2 -2
- package/graphql/schema/createManageSDL.js +14 -5
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createPreviewResolvers.d.ts +1 -2
- package/graphql/schema/createPreviewResolvers.js +4 -7
- package/graphql/schema/createPreviewResolvers.js.map +1 -1
- package/graphql/schema/createReadResolvers.d.ts +1 -2
- package/graphql/schema/createReadResolvers.js +4 -7
- package/graphql/schema/createReadResolvers.js.map +1 -1
- package/graphql/schema/createReadSDL.d.ts +2 -2
- package/graphql/schema/createReadSDL.js +6 -7
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/createSingularResolvers.d.ts +12 -0
- package/graphql/schema/createSingularResolvers.js +56 -0
- package/graphql/schema/createSingularResolvers.js.map +1 -0
- package/graphql/schema/createSingularSDL.d.ts +12 -0
- package/graphql/schema/createSingularSDL.js +95 -0
- package/graphql/schema/createSingularSDL.js.map +1 -0
- package/graphql/schema/resolvers/manage/normalizeGraphQlInput.d.ts +7 -0
- package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js +59 -0
- package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveCreate.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveDelete.js +2 -1
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGet.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveList.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveListDeleted.d.ts +4 -0
- package/graphql/schema/resolvers/manage/resolveListDeleted.js +20 -0
- package/graphql/schema/resolvers/manage/resolveListDeleted.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveMove.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolvePublish.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRestoreFromBin.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js +20 -0
- package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveValidate.d.ts +2 -2
- package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveGet.d.ts +2 -2
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveList.d.ts +2 -2
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveGet.d.ts +2 -2
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveList.d.ts +2 -2
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/singular/resolveGet.d.ts +7 -0
- package/graphql/schema/resolvers/singular/resolveGet.js +21 -0
- package/graphql/schema/resolvers/singular/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/singular/resolveUpdate.d.ts +8 -0
- package/graphql/schema/resolvers/singular/resolveUpdate.js +21 -0
- package/graphql/schema/resolvers/singular/resolveUpdate.js.map +1 -0
- package/graphql/schema/schemaPlugins.d.ts +3 -3
- package/graphql/schema/schemaPlugins.js +32 -11
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/graphql/system.d.ts +1 -1
- package/graphql/system.js +2 -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 +62 -8
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
- package/graphqlFields/dynamicZone/index.d.ts +0 -1
- package/graphqlFields/dynamicZone/index.js +0 -7
- package/graphqlFields/dynamicZone/index.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 +2 -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 +2 -2
- package/graphqlFields/object.js +14 -0
- package/graphqlFields/object.js.map +1 -1
- package/graphqlFields/ref.d.ts +1 -1
- package/graphqlFields/ref.js +1 -1
- package/graphqlFields/ref.js.map +1 -1
- package/graphqlFields/richText/RichTextPluginsProcessor.d.ts +6 -0
- package/graphqlFields/richText/RichTextPluginsProcessor.js +34 -0
- package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -0
- package/graphqlFields/richText/richTextResolver.d.ts +7 -0
- package/graphqlFields/richText/richTextResolver.js +24 -0
- package/graphqlFields/richText/richTextResolver.js.map +1 -0
- package/graphqlFields/richText.d.ts +1 -1
- package/graphqlFields/richText.js +8 -2
- package/graphqlFields/richText.js.map +1 -1
- package/graphqlFields/searchableJson.d.ts +2 -0
- package/graphqlFields/searchableJson.js +60 -0
- package/graphqlFields/searchableJson.js.map +1 -0
- package/graphqlFields/text.d.ts +1 -1
- package/graphqlFields/text.js.map +1 -1
- package/htmlRenderer/LexicalRenderer.d.ts +5 -0
- package/htmlRenderer/LexicalRenderer.js +28 -0
- package/htmlRenderer/LexicalRenderer.js.map +1 -0
- package/htmlRenderer/createLexicalHTMLRenderer.d.ts +2 -0
- package/htmlRenderer/createLexicalHTMLRenderer.js +31 -0
- package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -0
- package/index.d.ts +13 -7
- package/index.js +69 -8
- package/index.js.map +1 -1
- package/modelManager/DefaultCmsModelManager.d.ts +11 -10
- package/modelManager/DefaultCmsModelManager.js +16 -13
- package/modelManager/DefaultCmsModelManager.js.map +1 -1
- package/modelManager/SingletonModelManager.d.ts +12 -0
- package/modelManager/SingletonModelManager.js +48 -0
- package/modelManager/SingletonModelManager.js.map +1 -0
- package/modelManager/index.d.ts +2 -1
- package/modelManager/index.js +16 -1
- package/modelManager/index.js.map +1 -1
- package/package.json +37 -36
- package/parameters/context.js.map +1 -1
- package/parameters/header.js.map +1 -1
- package/parameters/index.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 +9 -0
- package/plugins/{CmsGraphQLSchemaPlugin.js → CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js} +5 -1
- package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js.map +1 -0
- package/plugins/CmsGraphQLSchemaPlugin/index.d.ts +1 -0
- package/plugins/CmsGraphQLSchemaPlugin/index.js +18 -0
- package/plugins/CmsGraphQLSchemaPlugin/index.js.map +1 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +1 -1
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -1
- package/plugins/CmsGroupPlugin.d.ts +9 -1
- package/plugins/CmsGroupPlugin.js +17 -1
- package/plugins/CmsGroupPlugin.js.map +1 -1
- package/plugins/CmsModelFieldConverterPlugin.d.ts +5 -2
- package/plugins/CmsModelFieldConverterPlugin.js +4 -0
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
- package/plugins/CmsModelPlugin.d.ts +30 -10
- package/plugins/CmsModelPlugin.js +106 -20
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/plugins/CmsParametersPlugin.d.ts +3 -3
- package/plugins/CmsParametersPlugin.js.map +1 -1
- package/plugins/CmsRichTextRendererPlugin.d.ts +24 -0
- package/plugins/CmsRichTextRendererPlugin.js +28 -0
- package/plugins/CmsRichTextRendererPlugin.js.map +1 -0
- package/plugins/StorageOperationsCmsModelPlugin.d.ts +1 -1
- package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -1
- package/plugins/StorageTransformPlugin.d.ts +6 -2
- package/plugins/StorageTransformPlugin.js +9 -1
- package/plugins/StorageTransformPlugin.js.map +1 -1
- package/plugins/index.d.ts +1 -0
- package/plugins/index.js +11 -0
- package/plugins/index.js.map +1 -1
- package/storage/date.d.ts +3 -0
- package/storage/date.js +119 -0
- package/storage/date.js.map +1 -0
- package/storage/default.js.map +1 -1
- package/storage/dynamicZone.d.ts +2 -0
- package/storage/dynamicZone.js +157 -0
- package/storage/dynamicZone.js.map +1 -0
- package/storage/index.js +7 -1
- package/storage/index.js.map +1 -1
- package/storage/json.js +34 -5
- package/storage/json.js.map +1 -1
- package/storage/object.js +16 -12
- package/storage/object.js.map +1 -1
- package/types/context.d.ts +146 -0
- package/types/context.js +7 -0
- package/types/context.js.map +1 -0
- package/types/fields/dynamicZoneField.d.ts +23 -0
- package/types/fields/dynamicZoneField.js +7 -0
- package/types/fields/dynamicZoneField.js.map +1 -0
- package/types/fields/objectField.d.ts +13 -0
- package/types/fields/objectField.js +7 -0
- package/types/fields/objectField.js.map +1 -0
- package/types/identity.d.ts +19 -0
- package/types/identity.js +7 -0
- package/types/identity.js.map +1 -0
- package/types/index.d.ts +10 -0
- package/types/index.js +117 -0
- package/types/index.js.map +1 -0
- package/types/model.d.ts +199 -0
- package/types/model.js +7 -0
- package/types/model.js.map +1 -0
- package/types/modelAst.d.ts +39 -0
- package/types/modelAst.js +7 -0
- package/types/modelAst.js.map +1 -0
- package/types/modelField.d.ts +330 -0
- package/types/modelField.js +7 -0
- package/types/modelField.js.map +1 -0
- package/types/modelGroup.d.ts +77 -0
- package/types/modelGroup.js +7 -0
- package/types/modelGroup.js.map +1 -0
- package/types/plugins.d.ts +365 -0
- package/types/plugins.js +7 -0
- package/types/plugins.js.map +1 -0
- package/{types.d.ts → types/types.d.ts} +295 -1215
- package/{types.js → types/types.js} +18 -119
- package/types/types.js.map +1 -0
- package/utils/RichTextRenderer.d.ts +10 -0
- package/utils/RichTextRenderer.js +33 -0
- package/utils/RichTextRenderer.js.map +1 -0
- package/utils/caching/Cache.d.ts +5 -2
- package/utils/caching/Cache.js +4 -7
- package/utils/caching/Cache.js.map +1 -1
- package/utils/caching/CacheKey.d.ts +2 -1
- package/utils/caching/CacheKey.js +5 -17
- package/utils/caching/CacheKey.js.map +1 -1
- package/utils/caching/index.js.map +1 -1
- package/utils/caching/types.d.ts +3 -1
- package/utils/caching/types.js +7 -0
- package/utils/caching/types.js.map +1 -1
- package/utils/contentEntryTraverser/ContentEntryTraverser.d.ts +13 -0
- package/utils/contentEntryTraverser/ContentEntryTraverser.js +97 -0
- package/utils/contentEntryTraverser/ContentEntryTraverser.js.map +1 -0
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.d.ts +6 -0
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js +23 -0
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js.map +1 -0
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.d.ts +7 -0
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js +22 -0
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js.map +1 -0
- package/utils/contentModelAst/CmsModelToAstConverter.d.ts +11 -0
- package/utils/contentModelAst/CmsModelToAstConverter.js +28 -0
- package/utils/contentModelAst/CmsModelToAstConverter.js.map +1 -0
- package/utils/contentModelAst/index.d.ts +3 -0
- package/utils/contentModelAst/index.js +40 -0
- package/utils/contentModelAst/index.js.map +1 -0
- 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 +7 -0
- package/utils/createModelField.js +51 -0
- package/utils/createModelField.js.map +1 -0
- package/utils/createTypeFromFields.d.ts +1 -1
- package/utils/createTypeFromFields.js.map +1 -1
- package/utils/createTypeName.js.map +1 -1
- package/utils/date.js.map +1 -1
- package/utils/entryStorage.d.ts +13 -1
- package/utils/entryStorage.js +37 -3
- package/utils/entryStorage.js.map +1 -1
- package/utils/filterAsync.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 +6 -6
- package/utils/getSchemaFromFieldPlugins.js +5 -4
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/identity.d.ts +1 -1
- package/utils/identity.js.map +1 -1
- package/utils/incrementEntryIdVersion.js.map +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +11 -0
- package/utils/index.js.map +1 -1
- package/utils/isHeadlessCmsReady.d.ts +2 -0
- package/utils/isHeadlessCmsReady.js +23 -0
- package/utils/isHeadlessCmsReady.js.map +1 -0
- package/utils/modelFieldTraverser/ModelFieldTraverser.d.ts +16 -0
- package/utils/modelFieldTraverser/ModelFieldTraverser.js +41 -0
- package/utils/modelFieldTraverser/ModelFieldTraverser.js.map +1 -0
- package/utils/modelFieldTraverser/index.d.ts +1 -0
- package/utils/modelFieldTraverser/index.js +18 -0
- package/utils/modelFieldTraverser/index.js.map +1 -0
- package/utils/renderFields.d.ts +1 -1
- package/utils/renderFields.js +2 -0
- 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/utils/toSlug.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/index.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 +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
- package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +0 -3
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +0 -111
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +0 -1
- package/plugins/CmsGraphQLSchemaPlugin.d.ts +0 -5
- package/plugins/CmsGraphQLSchemaPlugin.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/access.d.ts +0 -9
- package/utils/access.js +0 -26
- package/utils/access.js.map +0 -1
- package/utils/permissions/EntriesPermissions.d.ts +0 -4
- package/utils/permissions/EntriesPermissions.js +0 -11
- package/utils/permissions/EntriesPermissions.js.map +0 -1
- package/utils/permissions/ModelGroupsPermissions.d.ts +0 -9
- package/utils/permissions/ModelGroupsPermissions.js +0 -50
- package/utils/permissions/ModelGroupsPermissions.js.map +0 -1
- package/utils/permissions/ModelsPermissions.d.ts +0 -22
- package/utils/permissions/ModelsPermissions.js +0 -90
- package/utils/permissions/ModelsPermissions.js.map +0 -1
|
@@ -20,13 +20,15 @@ var _utils2 = require("../utils");
|
|
|
20
20
|
var _ensureTypeTag = require("./contentModel/ensureTypeTag");
|
|
21
21
|
var _listModelsFromDatabase = require("./contentModel/listModelsFromDatabase");
|
|
22
22
|
var _filterAsync = require("../utils/filterAsync");
|
|
23
|
+
var _contentModelAst = require("../utils/contentModelAst");
|
|
24
|
+
var _modelManager = require("../modelManager");
|
|
23
25
|
const createModelsCrud = params => {
|
|
24
26
|
const {
|
|
25
27
|
getTenant,
|
|
26
28
|
getIdentity,
|
|
27
29
|
getLocale,
|
|
28
30
|
storageOperations,
|
|
29
|
-
|
|
31
|
+
accessControl,
|
|
30
32
|
context
|
|
31
33
|
} = params;
|
|
32
34
|
const listPluginModelsCache = (0, _utils2.createMemoryCache)();
|
|
@@ -42,23 +44,9 @@ const createModelsCrud = params => {
|
|
|
42
44
|
managers.set(model.modelId, manager);
|
|
43
45
|
return manager;
|
|
44
46
|
};
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
const filterModel = async model => {
|
|
51
|
-
const ownsModel = await modelsPermissions.ensure({
|
|
52
|
-
owns: model.createdBy
|
|
53
|
-
}, {
|
|
54
|
-
throw: false
|
|
55
|
-
});
|
|
56
|
-
if (!ownsModel) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
return modelsPermissions.canAccessModel({
|
|
60
|
-
model
|
|
61
|
-
});
|
|
47
|
+
const fieldTypePlugins = context.plugins.byType("cms-model-field-to-graphql");
|
|
48
|
+
const getModelToAstConverter = () => {
|
|
49
|
+
return new _contentModelAst.CmsModelToAstConverter(new _contentModelAst.CmsModelFieldToAstConverterFromPlugins(fieldTypePlugins));
|
|
62
50
|
};
|
|
63
51
|
const listPluginModels = async (tenant, locale) => {
|
|
64
52
|
const modelPlugins = context.plugins.byType(_CmsModelPlugin.CmsModelPlugin.type);
|
|
@@ -68,7 +56,7 @@ const createModelsCrud = params => {
|
|
|
68
56
|
models: modelPlugins.map(({
|
|
69
57
|
contentModel: model
|
|
70
58
|
}) => {
|
|
71
|
-
return `${model.modelId}#${model.pluralApiName}#${model.singularApiName}#${model.savedOn || "
|
|
59
|
+
return `${model.modelId}#${model.pluralApiName}#${model.singularApiName}#${model.savedOn || "savedOn:plugin"}`;
|
|
72
60
|
}).join("/"),
|
|
73
61
|
identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined
|
|
74
62
|
});
|
|
@@ -97,7 +85,11 @@ const createModelsCrud = params => {
|
|
|
97
85
|
webinyVersion: context.WEBINY_VERSION
|
|
98
86
|
};
|
|
99
87
|
});
|
|
100
|
-
return (0, _filterAsync.filterAsync)(models,
|
|
88
|
+
return (0, _filterAsync.filterAsync)(models, async model => {
|
|
89
|
+
return accessControl.canAccessModel({
|
|
90
|
+
model
|
|
91
|
+
});
|
|
92
|
+
});
|
|
101
93
|
});
|
|
102
94
|
};
|
|
103
95
|
const getModelFromCache = async modelId => {
|
|
@@ -120,7 +112,7 @@ const createModelsCrud = params => {
|
|
|
120
112
|
* We always fetch the plugins and database models separately.
|
|
121
113
|
* Then we combine them and run access filtering on them
|
|
122
114
|
*/
|
|
123
|
-
const listModels = async
|
|
115
|
+
const listModels = async input => {
|
|
124
116
|
return context.benchmark.measure("headlessCms.crud.models.listModels", async () => {
|
|
125
117
|
/**
|
|
126
118
|
* Maybe we can cache based on permissions, not the identity id?
|
|
@@ -129,7 +121,7 @@ const createModelsCrud = params => {
|
|
|
129
121
|
*/
|
|
130
122
|
const tenant = getTenant().id;
|
|
131
123
|
const locale = getLocale().code;
|
|
132
|
-
|
|
124
|
+
let pluginModels = await listPluginModels(tenant, locale);
|
|
133
125
|
const dbCacheKey = (0, _utils2.createCacheKey)({
|
|
134
126
|
tenant,
|
|
135
127
|
locale
|
|
@@ -141,25 +133,38 @@ const createModelsCrud = params => {
|
|
|
141
133
|
dbCacheKey: dbCacheKey.get(),
|
|
142
134
|
identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined
|
|
143
135
|
});
|
|
144
|
-
|
|
145
|
-
return (0, _filterAsync.filterAsync)(databaseModels,
|
|
136
|
+
let filteredModels = await listFilteredModelsCache.getOrSet(filteredCacheKey, async () => {
|
|
137
|
+
return (0, _filterAsync.filterAsync)(databaseModels, async model => {
|
|
138
|
+
return accessControl.canAccessModel({
|
|
139
|
+
model
|
|
140
|
+
});
|
|
141
|
+
});
|
|
146
142
|
});
|
|
143
|
+
/**
|
|
144
|
+
* Do we need to hide private models?
|
|
145
|
+
*/
|
|
146
|
+
if (input?.includePrivate === false) {
|
|
147
|
+
filteredModels = filteredModels.filter(model => !model.isPrivate);
|
|
148
|
+
pluginModels = pluginModels.filter(model => !model.isPrivate);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Do we need to hide plugin models?
|
|
152
|
+
*/
|
|
153
|
+
if (input?.includePlugins === false) {
|
|
154
|
+
return filteredModels;
|
|
155
|
+
}
|
|
147
156
|
return filteredModels.concat(pluginModels);
|
|
148
157
|
});
|
|
149
158
|
};
|
|
150
159
|
const getModel = async modelId => {
|
|
151
160
|
return context.benchmark.measure("headlessCms.crud.models.getModel", async () => {
|
|
152
|
-
await checkModelPermissions("r");
|
|
153
161
|
const model = await context.security.withoutAuthorization(async () => {
|
|
154
162
|
return await getModelFromCache(modelId);
|
|
155
163
|
});
|
|
156
164
|
if (!model) {
|
|
157
165
|
throw new _handlerGraphql.NotFoundError(`Content model "${modelId}" was not found!`);
|
|
158
166
|
}
|
|
159
|
-
await
|
|
160
|
-
owns: model.createdBy
|
|
161
|
-
});
|
|
162
|
-
await modelsPermissions.ensureCanAccessModel({
|
|
167
|
+
await accessControl.ensureCanAccessModel({
|
|
163
168
|
model
|
|
164
169
|
});
|
|
165
170
|
return model;
|
|
@@ -173,6 +178,11 @@ const createModelsCrud = params => {
|
|
|
173
178
|
const model = await getModelFromCache(modelId);
|
|
174
179
|
return await updateManager(context, model);
|
|
175
180
|
};
|
|
181
|
+
const getSingletonEntryManager = async input => {
|
|
182
|
+
const model = typeof input === "string" ? await getModel(input) : input;
|
|
183
|
+
const manager = await getEntryManager(model);
|
|
184
|
+
return _modelManager.SingletonModelManager.create(manager);
|
|
185
|
+
};
|
|
176
186
|
|
|
177
187
|
/**
|
|
178
188
|
* Create
|
|
@@ -217,15 +227,16 @@ const createModelsCrud = params => {
|
|
|
217
227
|
});
|
|
218
228
|
(0, _beforeDelete.assignModelBeforeDelete)({
|
|
219
229
|
onModelBeforeDelete,
|
|
220
|
-
|
|
221
|
-
storageOperations
|
|
230
|
+
context
|
|
222
231
|
});
|
|
223
232
|
|
|
224
233
|
/**
|
|
225
234
|
* CRUD methods
|
|
226
235
|
*/
|
|
227
236
|
const createModel = async input => {
|
|
228
|
-
await
|
|
237
|
+
await accessControl.ensureCanAccessModel({
|
|
238
|
+
rwd: "w"
|
|
239
|
+
});
|
|
229
240
|
const result = await (0, _validation.createModelCreateValidation)().safeParseAsync(input);
|
|
230
241
|
if (!result.success) {
|
|
231
242
|
throw (0, _utils.createZodError)(result.error);
|
|
@@ -268,6 +279,10 @@ const createModelsCrud = params => {
|
|
|
268
279
|
webinyVersion: context.WEBINY_VERSION
|
|
269
280
|
};
|
|
270
281
|
model.tags = (0, _ensureTypeTag.ensureTypeTag)(model);
|
|
282
|
+
await accessControl.ensureCanAccessModel({
|
|
283
|
+
model,
|
|
284
|
+
rwd: "w"
|
|
285
|
+
});
|
|
271
286
|
try {
|
|
272
287
|
await onModelBeforeCreate.publish({
|
|
273
288
|
input: data,
|
|
@@ -293,7 +308,9 @@ const createModelsCrud = params => {
|
|
|
293
308
|
}
|
|
294
309
|
};
|
|
295
310
|
const updateModel = async (modelId, input) => {
|
|
296
|
-
await
|
|
311
|
+
await accessControl.ensureCanAccessModel({
|
|
312
|
+
rwd: "w"
|
|
313
|
+
});
|
|
297
314
|
|
|
298
315
|
// Get a model record; this will also perform ownership validation.
|
|
299
316
|
const original = await getModel(modelId);
|
|
@@ -333,6 +350,10 @@ const createModelsCrud = params => {
|
|
|
333
350
|
webinyVersion: context.WEBINY_VERSION,
|
|
334
351
|
savedOn: new Date().toISOString()
|
|
335
352
|
};
|
|
353
|
+
await accessControl.ensureCanAccessModel({
|
|
354
|
+
model,
|
|
355
|
+
rwd: "w"
|
|
356
|
+
});
|
|
336
357
|
model.tags = (0, _ensureTypeTag.ensureTypeTag)(model);
|
|
337
358
|
try {
|
|
338
359
|
await onModelBeforeUpdate.publish({
|
|
@@ -399,7 +420,10 @@ const createModelsCrud = params => {
|
|
|
399
420
|
}
|
|
400
421
|
};
|
|
401
422
|
const createModelFrom = async (modelId, input) => {
|
|
402
|
-
await
|
|
423
|
+
await accessControl.ensureCanAccessModel({
|
|
424
|
+
rwd: "w"
|
|
425
|
+
});
|
|
426
|
+
|
|
403
427
|
/**
|
|
404
428
|
* Get a model record; this will also perform ownership validation.
|
|
405
429
|
*/
|
|
@@ -451,6 +475,10 @@ const createModelsCrud = params => {
|
|
|
451
475
|
lockedFields: [],
|
|
452
476
|
webinyVersion: context.WEBINY_VERSION
|
|
453
477
|
};
|
|
478
|
+
await accessControl.ensureCanAccessModel({
|
|
479
|
+
model,
|
|
480
|
+
rwd: "w"
|
|
481
|
+
});
|
|
454
482
|
try {
|
|
455
483
|
await onModelBeforeCreateFrom.publish({
|
|
456
484
|
input: data,
|
|
@@ -479,8 +507,14 @@ const createModelsCrud = params => {
|
|
|
479
507
|
}
|
|
480
508
|
};
|
|
481
509
|
const deleteModel = async modelId => {
|
|
482
|
-
await
|
|
510
|
+
await accessControl.ensureCanAccessModel({
|
|
511
|
+
rwd: "d"
|
|
512
|
+
});
|
|
483
513
|
const model = await getModel(modelId);
|
|
514
|
+
await accessControl.ensureCanAccessModel({
|
|
515
|
+
model,
|
|
516
|
+
rwd: "d"
|
|
517
|
+
});
|
|
484
518
|
try {
|
|
485
519
|
await onModelBeforeDelete.publish({
|
|
486
520
|
model
|
|
@@ -513,8 +547,11 @@ const createModelsCrud = params => {
|
|
|
513
547
|
* We require that users have write permissions to initialize models.
|
|
514
548
|
* Maybe introduce another permission for it?
|
|
515
549
|
*/
|
|
516
|
-
await checkModelPermissions("w");
|
|
517
550
|
const model = await getModel(modelId);
|
|
551
|
+
await accessControl.ensureCanAccessModel({
|
|
552
|
+
model,
|
|
553
|
+
rwd: "w"
|
|
554
|
+
});
|
|
518
555
|
await onModelInitialize.publish({
|
|
519
556
|
model,
|
|
520
557
|
data
|
|
@@ -537,6 +574,7 @@ const createModelsCrud = params => {
|
|
|
537
574
|
onModelInitialize,
|
|
538
575
|
clearModelsCache,
|
|
539
576
|
getModel,
|
|
577
|
+
getModelToAstConverter,
|
|
540
578
|
listModels,
|
|
541
579
|
async createModel(input) {
|
|
542
580
|
return context.benchmark.measure("headlessCms.crud.models.createModel", async () => {
|
|
@@ -573,7 +611,8 @@ const createModelsCrud = params => {
|
|
|
573
611
|
});
|
|
574
612
|
},
|
|
575
613
|
getEntryManager,
|
|
576
|
-
getEntryManagers: () => managers
|
|
614
|
+
getEntryManagers: () => managers,
|
|
615
|
+
getSingletonEntryManager
|
|
577
616
|
};
|
|
578
617
|
};
|
|
579
618
|
exports.createModelsCrud = createModelsCrud;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_handlerGraphql","_contentModelManagerFactory","_pubsub","_beforeCreate","_beforeUpdate","_beforeDelete","_CmsModelPlugin","_validation","_utils","_defaultFields","_utils2","_ensureTypeTag","_listModelsFromDatabase","_filterAsync","createModelsCrud","params","getTenant","getIdentity","getLocale","storageOperations","modelsPermissions","context","listPluginModelsCache","createMemoryCache","listFilteredModelsCache","listDatabaseModelsCache","clearModelsCache","clear","managers","Map","updateManager","model","manager","contentModelManagerFactory","set","modelId","checkModelPermissions","rwd","ensure","filterModel","ownsModel","owns","createdBy","throw","canAccessModel","listPluginModels","tenant","locale","modelPlugins","plugins","byType","CmsModelPlugin","type","cacheKey","createCacheKey","models","map","contentModel","pluralApiName","singularApiName","savedOn","join","identity","security","isAuthorizationEnabled","id","undefined","getOrSet","filter","plugin","modelTenant","modelLocale","tags","ensureTypeTag","webinyVersion","WEBINY_VERSION","filterAsync","getModelFromCache","listModels","find","m","NotFoundError","code","benchmark","measure","pluginModels","dbCacheKey","databaseModels","listModelsFromDatabase","filteredCacheKey","get","filteredModels","concat","getModel","withoutAuthorization","ensureCanAccessModel","getEntryManager","target","has","onModelBeforeCreate","createTopic","onModelAfterCreate","onModelCreateError","onModelBeforeCreateFrom","onModelAfterCreateFrom","onModelCreateFromError","onModelBeforeUpdate","onModelAfterUpdate","onModelUpdateError","onModelBeforeDelete","onModelAfterDelete","onModelDeleteError","onModelInitialize","assignModelBeforeCreate","assignModelBeforeUpdate","assignModelBeforeDelete","createModel","input","result","createModelCreateValidation","safeParseAsync","success","createZodError","error","defaultFields","data","removeUndefinedValues","assignModelDefaultFields","group","cms","getGroup","titleFieldId","descriptionFieldId","imageFieldId","description","name","displayName","createdOn","Date","toISOString","lockedFields","publish","createdModel","create","ex","updateModel","original","createModelUpdateValidation","Object","keys","length","groupId","groupData","resultModel","update","updateModelDirect","initialModel","createModelFrom","createModelCreateFromValidation","i18n","groups","icon","deleteModel","delete","WebinyError","message","initializeModel","userInput","getEntryManagers","exports"],"sources":["contentModel.crud.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n CmsContext,\n CmsModel,\n CmsModelContext,\n CmsModelGroup,\n CmsModelManager,\n CmsModelUpdateInput,\n HeadlessCmsStorageOperations,\n OnModelAfterCreateFromTopicParams,\n OnModelAfterCreateTopicParams,\n OnModelAfterDeleteTopicParams,\n OnModelAfterUpdateTopicParams,\n OnModelBeforeCreateFromTopicParams,\n OnModelBeforeCreateTopicParams,\n OnModelBeforeDeleteTopicParams,\n OnModelBeforeUpdateTopicParams,\n OnModelCreateErrorTopicParams,\n OnModelCreateFromErrorParams,\n OnModelDeleteErrorTopicParams,\n OnModelInitializeParams,\n OnModelUpdateErrorTopicParams\n} from \"~/types\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { contentModelManagerFactory } from \"./contentModel/contentModelManagerFactory\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { assignModelBeforeCreate } from \"./contentModel/beforeCreate\";\nimport { assignModelBeforeUpdate } from \"./contentModel/beforeUpdate\";\nimport { assignModelBeforeDelete } from \"./contentModel/beforeDelete\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport {\n createModelCreateFromValidation,\n createModelCreateValidation,\n createModelUpdateValidation\n} from \"~/crud/contentModel/validation\";\nimport { createZodError, removeUndefinedValues } from \"@webiny/utils\";\nimport { assignModelDefaultFields } from \"~/crud/contentModel/defaultFields\";\nimport { ModelsPermissions } from \"~/utils/permissions/ModelsPermissions\";\nimport { createCacheKey, createMemoryCache } from \"~/utils\";\nimport { ensureTypeTag } from \"./contentModel/ensureTypeTag\";\nimport { listModelsFromDatabase } from \"~/crud/contentModel/listModelsFromDatabase\";\nimport { filterAsync } from \"~/utils/filterAsync\";\n\nexport interface CreateModelsCrudParams {\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n storageOperations: HeadlessCmsStorageOperations;\n modelsPermissions: ModelsPermissions;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n}\n\nexport const createModelsCrud = (params: CreateModelsCrudParams): CmsModelContext => {\n const { getTenant, getIdentity, getLocale, storageOperations, modelsPermissions, context } =\n params;\n\n const listPluginModelsCache = createMemoryCache<Promise<CmsModel[]>>();\n const listFilteredModelsCache = createMemoryCache<Promise<CmsModel[]>>();\n const listDatabaseModelsCache = createMemoryCache<Promise<CmsModel[]>>();\n const clearModelsCache = (): void => {\n listDatabaseModelsCache.clear();\n listFilteredModelsCache.clear();\n };\n\n const managers = new Map<string, CmsModelManager>();\n const updateManager = async (\n context: CmsContext,\n model: CmsModel\n ): Promise<CmsModelManager> => {\n const manager = await contentModelManagerFactory(context, model);\n managers.set(model.modelId, manager);\n return manager;\n };\n\n const checkModelPermissions = async (rwd: string) => {\n return modelsPermissions.ensure({ rwd });\n };\n\n const filterModel = async (model: CmsModel): Promise<boolean> => {\n const ownsModel = await modelsPermissions.ensure(\n { owns: model.createdBy },\n { throw: false }\n );\n\n if (!ownsModel) {\n return false;\n }\n\n return modelsPermissions.canAccessModel({\n model\n });\n };\n\n const listPluginModels = async (tenant: string, locale: string): Promise<CmsModel[]> => {\n const modelPlugins = context.plugins.byType<CmsModelPlugin>(CmsModelPlugin.type);\n const cacheKey = createCacheKey({\n tenant,\n locale,\n models: modelPlugins\n .map(({ contentModel: model }) => {\n return `${model.modelId}#${model.pluralApiName}#${model.singularApiName}#${\n model.savedOn || \"unknown\"\n }`;\n })\n .join(\"/\"),\n identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined\n });\n return listPluginModelsCache.getOrSet(cacheKey, async () => {\n const models = modelPlugins\n /**\n * We need to filter out models that are not for this tenant or locale.\n * If it does not have tenant or locale define, it is for every locale and tenant\n */\n .filter(plugin => {\n const { tenant: modelTenant, locale: modelLocale } = plugin.contentModel;\n if (modelTenant && modelTenant !== tenant) {\n return false;\n } else if (modelLocale && modelLocale !== locale) {\n return false;\n }\n return true;\n })\n .map(plugin => {\n return {\n ...plugin.contentModel,\n tags: ensureTypeTag(plugin.contentModel),\n tenant,\n locale,\n webinyVersion: context.WEBINY_VERSION\n };\n }) as unknown as CmsModel[];\n return filterAsync(models, filterModel);\n });\n };\n\n const getModelFromCache = async (modelId: string) => {\n const models = await listModels();\n const model = models.find(m => m.modelId === modelId);\n if (!model) {\n throw new NotFoundError(`Content model \"${modelId}\" was not found!`);\n }\n\n return {\n ...model,\n tags: ensureTypeTag(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code\n };\n };\n\n /**\n * The list models cache is a key -> Promise pair so it the listModels() can be called multiple times but executed only once.\n *\n * We always fetch the plugins and database models separately.\n * Then we combine them and run access filtering on them\n */\n const listModels = async () => {\n return context.benchmark.measure(\"headlessCms.crud.models.listModels\", async () => {\n /**\n * Maybe we can cache based on permissions, not the identity id?\n *\n * TODO: @adrian please check if possible.\n */\n const tenant = getTenant().id;\n const locale = getLocale().code;\n const pluginModels = await listPluginModels(tenant, locale);\n const dbCacheKey = createCacheKey({\n tenant,\n locale\n });\n const databaseModels = await listDatabaseModelsCache.getOrSet(dbCacheKey, async () => {\n return await listModelsFromDatabase(params);\n });\n\n const filteredCacheKey = createCacheKey({\n dbCacheKey: dbCacheKey.get(),\n identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined\n });\n\n const filteredModels = await listFilteredModelsCache.getOrSet(\n filteredCacheKey,\n async () => {\n return filterAsync(databaseModels, filterModel);\n }\n );\n\n return filteredModels.concat(pluginModels);\n });\n };\n\n const getModel = async (modelId: string): Promise<CmsModel> => {\n return context.benchmark.measure(\"headlessCms.crud.models.getModel\", async () => {\n await checkModelPermissions(\"r\");\n\n const model = await context.security.withoutAuthorization(async () => {\n return await getModelFromCache(modelId);\n });\n if (!model) {\n throw new NotFoundError(`Content model \"${modelId}\" was not found!`);\n }\n\n await modelsPermissions.ensure({ owns: model.createdBy });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n return model;\n });\n };\n\n const getEntryManager: CmsModelContext[\"getEntryManager\"] = async (\n target\n ): Promise<CmsModelManager> => {\n const modelId = typeof target === \"string\" ? target : target.modelId;\n if (managers.has(modelId)) {\n return managers.get(modelId) as CmsModelManager;\n }\n const model = await getModelFromCache(modelId);\n return await updateManager(context, model);\n };\n\n /**\n * Create\n */\n const onModelBeforeCreate =\n createTopic<OnModelBeforeCreateTopicParams>(\"cms.onModelBeforeCreate\");\n const onModelAfterCreate = createTopic<OnModelAfterCreateTopicParams>(\"cms.onModelAfterCreate\");\n const onModelCreateError = createTopic<OnModelCreateErrorTopicParams>(\"cms.onModelCreateError\");\n /**\n * Create from / clone\n */\n const onModelBeforeCreateFrom = createTopic<OnModelBeforeCreateFromTopicParams>(\n \"cms.onModelBeforeCreateFrom\"\n );\n const onModelAfterCreateFrom = createTopic<OnModelAfterCreateFromTopicParams>(\n \"cms.onModelAfterCreateFrom\"\n );\n const onModelCreateFromError = createTopic<OnModelCreateFromErrorParams>(\n \"cms.onModelCreateFromError\"\n );\n /**\n * Update\n */\n const onModelBeforeUpdate =\n createTopic<OnModelBeforeUpdateTopicParams>(\"cms.onModelBeforeUpdate\");\n const onModelAfterUpdate = createTopic<OnModelAfterUpdateTopicParams>(\"cms.onModelAfterUpdate\");\n const onModelUpdateError = createTopic<OnModelUpdateErrorTopicParams>(\"cms.onModelUpdateError\");\n /**\n * Delete\n */\n const onModelBeforeDelete =\n createTopic<OnModelBeforeDeleteTopicParams>(\"cms.onModelBeforeDelete\");\n const onModelAfterDelete = createTopic<OnModelAfterDeleteTopicParams>(\"cms.onModelAfterDelete\");\n const onModelDeleteError = createTopic<OnModelDeleteErrorTopicParams>(\"cms.onModelDeleteError\");\n /**\n * Initialize\n */\n const onModelInitialize = createTopic<OnModelInitializeParams>(\"cms.onModelInitialize\");\n /**\n * We need to assign some default behaviors.\n */\n assignModelBeforeCreate({\n onModelBeforeCreate,\n onModelBeforeCreateFrom,\n context,\n storageOperations\n });\n assignModelBeforeUpdate({\n onModelBeforeUpdate,\n context\n });\n assignModelBeforeDelete({\n onModelBeforeDelete,\n plugins: context.plugins,\n storageOperations\n });\n\n /**\n * CRUD methods\n */\n const createModel: CmsModelContext[\"createModel\"] = async input => {\n await checkModelPermissions(\"w\");\n\n const result = await createModelCreateValidation().safeParseAsync(input);\n if (!result.success) {\n throw createZodError(result.error);\n }\n /**\n * We need to extract the defaultFields because it is not for the CmsModel object.\n */\n const { defaultFields, ...data } = removeUndefinedValues(result.data);\n if (defaultFields) {\n assignModelDefaultFields(data);\n }\n\n const group = await context.cms.getGroup(data.group);\n\n const identity = getIdentity();\n const model: CmsModel = {\n ...data,\n modelId: data.modelId || \"\",\n singularApiName: data.singularApiName,\n pluralApiName: data.pluralApiName,\n titleFieldId: \"id\",\n descriptionFieldId: null,\n imageFieldId: null,\n description: data.description || \"\",\n locale: getLocale().code,\n tenant: getTenant().id,\n group: {\n id: group.id,\n name: group.name\n },\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n lockedFields: [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n model.tags = ensureTypeTag(model);\n\n try {\n await onModelBeforeCreate.publish({\n input: data,\n model\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n clearModelsCache();\n\n await updateManager(context, model);\n\n await onModelAfterCreate.publish({\n input: data,\n model: createdModel\n });\n\n return createdModel;\n } catch (ex) {\n await onModelCreateError.publish({\n input: data,\n model,\n error: ex\n });\n throw ex;\n }\n };\n const updateModel: CmsModelContext[\"updateModel\"] = async (modelId, input) => {\n await checkModelPermissions(\"w\");\n\n // Get a model record; this will also perform ownership validation.\n const original = await getModel(modelId);\n\n const result = await createModelUpdateValidation().safeParseAsync(input);\n if (!result.success) {\n throw createZodError(result.error);\n }\n\n const data = removeUndefinedValues(result.data);\n\n if (Object.keys(data).length === 0) {\n /**\n * We need to return the original if nothing is to be updated.\n */\n return original;\n }\n let group: CmsModelGroup = {\n id: original.group.id,\n name: original.group.name\n };\n const groupId = data.group;\n if (groupId) {\n const groupData = await context.cms.getGroup(groupId);\n group = {\n id: groupData.id,\n name: groupData.name\n };\n }\n const model: CmsModel = {\n ...original,\n ...data,\n titleFieldId:\n data.titleFieldId === undefined\n ? original.titleFieldId\n : (data.titleFieldId as string),\n descriptionFieldId:\n data.descriptionFieldId === undefined\n ? original.descriptionFieldId\n : data.descriptionFieldId,\n imageFieldId:\n data.imageFieldId === undefined ? original.imageFieldId : data.imageFieldId,\n group,\n description: data.description || original.description,\n tenant: original.tenant || getTenant().id,\n locale: original.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION,\n savedOn: new Date().toISOString()\n };\n\n model.tags = ensureTypeTag(model);\n\n try {\n await onModelBeforeUpdate.publish({\n input: data,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n await onModelAfterUpdate.publish({\n input: data,\n original,\n model: resultModel\n });\n\n return resultModel;\n } catch (ex) {\n await onModelUpdateError.publish({\n input: data,\n model,\n original,\n error: ex\n });\n\n throw ex;\n }\n };\n const updateModelDirect: CmsModelContext[\"updateModelDirect\"] = async params => {\n const { model: initialModel, original } = params;\n\n const model: CmsModel = {\n ...initialModel,\n tenant: initialModel.tenant || getTenant().id,\n locale: initialModel.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION\n };\n\n try {\n await onModelBeforeUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n clearModelsCache();\n\n await onModelAfterUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model: resultModel\n });\n\n return resultModel;\n } catch (ex) {\n await onModelUpdateError.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model,\n error: ex\n });\n throw ex;\n }\n };\n const createModelFrom: CmsModelContext[\"createModelFrom\"] = async (modelId, input) => {\n await checkModelPermissions(\"w\");\n /**\n * Get a model record; this will also perform ownership validation.\n */\n const original = await getModel(modelId);\n\n const result = await createModelCreateFromValidation().safeParseAsync({\n ...input,\n description: input.description || original.description\n });\n if (!result.success) {\n throw createZodError(result.error);\n }\n\n const data = removeUndefinedValues(result.data);\n\n const locale = await context.i18n.getLocale(data.locale || original.locale);\n if (!locale) {\n throw new NotFoundError(`There is no locale \"${data.locale}\".`);\n }\n /**\n * Use storage operations directly because we cannot get group from different locale via context methods.\n */\n const group = await context.cms.storageOperations.groups.get({\n id: data.group,\n tenant: original.tenant,\n locale: locale.code\n });\n if (!group) {\n throw new NotFoundError(`There is no group \"${data.group}\".`);\n }\n\n const identity = getIdentity();\n const model: CmsModel = {\n ...original,\n singularApiName: data.singularApiName,\n pluralApiName: data.pluralApiName,\n locale: locale.code,\n group: {\n id: group.id,\n name: group.name\n },\n icon: data.icon,\n name: data.name,\n modelId: data.modelId || \"\",\n description: data.description || \"\",\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n lockedFields: [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n try {\n await onModelBeforeCreateFrom.publish({\n input: data,\n model,\n original\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n clearModelsCache();\n\n await updateManager(context, model);\n\n await onModelAfterCreateFrom.publish({\n input: data,\n original,\n model: createdModel\n });\n\n return createdModel;\n } catch (ex) {\n await onModelCreateFromError.publish({\n input: data,\n original,\n model,\n error: ex\n });\n throw ex;\n }\n };\n const deleteModel: CmsModelContext[\"deleteModel\"] = async modelId => {\n await checkModelPermissions(\"d\");\n\n const model = await getModel(modelId);\n\n try {\n await onModelBeforeDelete.publish({\n model\n });\n\n try {\n await storageOperations.models.delete({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete the content model\",\n ex.code || \"CONTENT_MODEL_DELETE_ERROR\",\n {\n error: ex,\n modelId: model.modelId\n }\n );\n }\n\n clearModelsCache();\n\n await onModelAfterDelete.publish({\n model\n });\n\n managers.delete(model.modelId);\n } catch (ex) {\n await onModelDeleteError.publish({\n model,\n error: ex\n });\n throw ex;\n }\n };\n const initializeModel: CmsModelContext[\"initializeModel\"] = async (modelId, data) => {\n /**\n * We require that users have write permissions to initialize models.\n * Maybe introduce another permission for it?\n */\n await checkModelPermissions(\"w\");\n\n const model = await getModel(modelId);\n\n await onModelInitialize.publish({ model, data });\n\n return true;\n };\n return {\n onModelBeforeCreate,\n onModelAfterCreate,\n onModelCreateError,\n onModelBeforeCreateFrom,\n onModelAfterCreateFrom,\n onModelCreateFromError,\n onModelBeforeUpdate,\n onModelAfterUpdate,\n onModelUpdateError,\n onModelBeforeDelete,\n onModelAfterDelete,\n onModelDeleteError,\n onModelInitialize,\n clearModelsCache,\n getModel,\n listModels,\n async createModel(input) {\n return context.benchmark.measure(\"headlessCms.crud.models.createModel\", async () => {\n return createModel(input);\n });\n },\n /**\n * Method does not check for permissions or ownership.\n * @internal\n */\n async updateModelDirect(params) {\n return context.benchmark.measure(\n \"headlessCms.crud.models.updateModelDirect\",\n async () => {\n return updateModelDirect(params);\n }\n );\n },\n async createModelFrom(modelId, userInput) {\n return context.benchmark.measure(\n \"headlessCms.crud.models.createModelFrom\",\n async () => {\n return createModelFrom(modelId, userInput);\n }\n );\n },\n async updateModel(modelId, input) {\n return context.benchmark.measure(\"headlessCms.crud.models.updateModel\", async () => {\n return updateModel(modelId, input);\n });\n },\n async deleteModel(modelId) {\n return context.benchmark.measure(\"headlessCms.crud.models.deleteModel\", async () => {\n return deleteModel(modelId);\n });\n },\n async initializeModel(modelId, data) {\n return context.benchmark.measure(\n \"headlessCms.crud.models.initializeModel\",\n async () => {\n return initializeModel(modelId, data);\n }\n );\n },\n getEntryManager,\n getEntryManagers: () => managers\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAuBA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,G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C,OAAOlJ,OAAO,CAAC8D,SAAS,CAACC,OAAO,CAC5B,yCAAyC,EACzC,YAAY;QACR,OAAOyE,eAAe,CAAC1H,OAAO,EAAEoI,SAAS,CAAC;MAC9C,CACJ,CAAC;IACL,CAAC;IACD,MAAMtB,WAAWA,CAAC9G,OAAO,EAAEkF,KAAK,EAAE;MAC9B,OAAOhG,OAAO,CAAC8D,SAAS,CAACC,OAAO,CAAC,qCAAqC,EAAE,YAAY;QAChF,OAAO6D,WAAW,CAAC9G,OAAO,EAAEkF,KAAK,CAAC;MACtC,CAAC,CAAC;IACN,CAAC;IACD,MAAM6C,WAAWA,CAAC/H,OAAO,EAAE;MACvB,OAAOd,OAAO,CAAC8D,SAAS,CAACC,OAAO,CAAC,qCAAqC,EAAE,YAAY;QAChF,OAAO8E,WAAW,CAAC/H,OAAO,CAAC;MAC/B,CAAC,CAAC;IACN,CAAC;IACD,MAAMmI,eAAeA,CAACnI,OAAO,EAAE0F,IAAI,EAAE;MACjC,OAAOxG,OAAO,CAAC8D,SAAS,CAACC,OAAO,CAC5B,yCAAyC,EACzC,YAAY;QACR,OAAOkF,eAAe,CAACnI,OAAO,EAAE0F,IAAI,CAAC;MACzC,CACJ,CAAC;IACL,CAAC;IACD7B,eAAe;IACfwE,gBAAgB,EAAEA,CAAA,KAAM5I;EAC5B,CAAC;AACL,CAAC;AAAC6I,OAAA,CAAA3J,gBAAA,GAAAA,gBAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_handlerGraphql","_contentModelManagerFactory","_pubsub","_beforeCreate","_beforeUpdate","_beforeDelete","_CmsModelPlugin","_validation","_utils","_defaultFields","_utils2","_ensureTypeTag","_listModelsFromDatabase","_filterAsync","_contentModelAst","_modelManager","createModelsCrud","params","getTenant","getIdentity","getLocale","storageOperations","accessControl","context","listPluginModelsCache","createMemoryCache","listFilteredModelsCache","listDatabaseModelsCache","clearModelsCache","clear","managers","Map","updateManager","model","manager","contentModelManagerFactory","set","modelId","fieldTypePlugins","plugins","byType","getModelToAstConverter","CmsModelToAstConverter","CmsModelFieldToAstConverterFromPlugins","listPluginModels","tenant","locale","modelPlugins","CmsModelPlugin","type","cacheKey","createCacheKey","models","map","contentModel","pluralApiName","singularApiName","savedOn","join","identity","security","isAuthorizationEnabled","id","undefined","getOrSet","filter","plugin","modelTenant","modelLocale","tags","ensureTypeTag","webinyVersion","WEBINY_VERSION","filterAsync","canAccessModel","getModelFromCache","listModels","find","m","NotFoundError","code","input","benchmark","measure","pluginModels","dbCacheKey","databaseModels","listModelsFromDatabase","filteredCacheKey","get","filteredModels","includePrivate","isPrivate","includePlugins","concat","getModel","withoutAuthorization","ensureCanAccessModel","getEntryManager","target","has","getSingletonEntryManager","SingletonModelManager","create","onModelBeforeCreate","createTopic","onModelAfterCreate","onModelCreateError","onModelBeforeCreateFrom","onModelAfterCreateFrom","onModelCreateFromError","onModelBeforeUpdate","onModelAfterUpdate","onModelUpdateError","onModelBeforeDelete","onModelAfterDelete","onModelDeleteError","onModelInitialize","assignModelBeforeCreate","assignModelBeforeUpdate","assignModelBeforeDelete","createModel","rwd","result","createModelCreateValidation","safeParseAsync","success","createZodError","error","defaultFields","data","removeUndefinedValues","assignModelDefaultFields","group","cms","getGroup","titleFieldId","descriptionFieldId","imageFieldId","description","name","createdBy","displayName","createdOn","Date","toISOString","lockedFields","publish","createdModel","ex","updateModel","original","createModelUpdateValidation","Object","keys","length","groupId","groupData","resultModel","update","updateModelDirect","initialModel","createModelFrom","createModelCreateFromValidation","i18n","groups","icon","deleteModel","delete","WebinyError","message","initializeModel","userInput","getEntryManagers","exports"],"sources":["contentModel.crud.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsContext,\n CmsEntryValues,\n CmsModel,\n CmsModelContext,\n CmsModelFieldToGraphQLPlugin,\n CmsModelGroup,\n CmsModelManager,\n CmsModelUpdateInput,\n HeadlessCmsStorageOperations,\n ICmsModelListParams,\n OnModelAfterCreateFromTopicParams,\n OnModelAfterCreateTopicParams,\n OnModelAfterDeleteTopicParams,\n OnModelAfterUpdateTopicParams,\n OnModelBeforeCreateFromTopicParams,\n OnModelBeforeCreateTopicParams,\n OnModelBeforeDeleteTopicParams,\n OnModelBeforeUpdateTopicParams,\n OnModelCreateErrorTopicParams,\n OnModelCreateFromErrorParams,\n OnModelDeleteErrorTopicParams,\n OnModelInitializeParams,\n OnModelUpdateErrorTopicParams\n} from \"~/types\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { contentModelManagerFactory } from \"./contentModel/contentModelManagerFactory\";\nimport type { Tenant } from \"@webiny/api-tenancy/types\";\nimport type { I18NLocale } from \"@webiny/api-i18n/types\";\nimport type { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { assignModelBeforeCreate } from \"./contentModel/beforeCreate\";\nimport { assignModelBeforeUpdate } from \"./contentModel/beforeUpdate\";\nimport { assignModelBeforeDelete } from \"./contentModel/beforeDelete\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport {\n createModelCreateFromValidation,\n createModelCreateValidation,\n createModelUpdateValidation\n} from \"~/crud/contentModel/validation\";\nimport { createZodError, removeUndefinedValues } from \"@webiny/utils\";\nimport { assignModelDefaultFields } from \"~/crud/contentModel/defaultFields\";\nimport { createCacheKey, createMemoryCache } from \"~/utils\";\nimport { ensureTypeTag } from \"./contentModel/ensureTypeTag\";\nimport { listModelsFromDatabase } from \"~/crud/contentModel/listModelsFromDatabase\";\nimport { filterAsync } from \"~/utils/filterAsync\";\nimport type { AccessControl } from \"./AccessControl/AccessControl\";\nimport {\n CmsModelFieldToAstConverterFromPlugins,\n CmsModelToAstConverter\n} from \"~/utils/contentModelAst\";\nimport { SingletonModelManager } from \"~/modelManager\";\n\nexport interface CreateModelsCrudParams {\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n storageOperations: HeadlessCmsStorageOperations;\n accessControl: AccessControl;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n}\n\nexport const createModelsCrud = (params: CreateModelsCrudParams): CmsModelContext => {\n const { getTenant, getIdentity, getLocale, storageOperations, accessControl, context } = params;\n\n const listPluginModelsCache = createMemoryCache<Promise<CmsModel[]>>();\n const listFilteredModelsCache = createMemoryCache<Promise<CmsModel[]>>();\n const listDatabaseModelsCache = createMemoryCache<Promise<CmsModel[]>>();\n const clearModelsCache = (): void => {\n listDatabaseModelsCache.clear();\n listFilteredModelsCache.clear();\n };\n\n const managers = new Map<string, CmsModelManager>();\n const updateManager = async <T extends CmsEntryValues = CmsEntryValues>(\n context: CmsContext,\n model: CmsModel\n ): Promise<CmsModelManager<T>> => {\n const manager = await contentModelManagerFactory<T>(context, model);\n managers.set(model.modelId, manager);\n return manager;\n };\n\n const fieldTypePlugins = context.plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n\n const getModelToAstConverter = () => {\n return new CmsModelToAstConverter(\n new CmsModelFieldToAstConverterFromPlugins(fieldTypePlugins)\n );\n };\n\n const listPluginModels = async (tenant: string, locale: string): Promise<CmsModel[]> => {\n const modelPlugins = context.plugins.byType<CmsModelPlugin>(CmsModelPlugin.type);\n const cacheKey = createCacheKey({\n tenant,\n locale,\n models: modelPlugins\n .map(({ contentModel: model }) => {\n return `${model.modelId}#${model.pluralApiName}#${model.singularApiName}#${\n model.savedOn || \"savedOn:plugin\"\n }`;\n })\n .join(\"/\"),\n identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined\n });\n return listPluginModelsCache.getOrSet(cacheKey, async () => {\n const models = modelPlugins\n /**\n * We need to filter out models that are not for this tenant or locale.\n * If it does not have tenant or locale define, it is for every locale and tenant\n */\n .filter(plugin => {\n const { tenant: modelTenant, locale: modelLocale } = plugin.contentModel;\n if (modelTenant && modelTenant !== tenant) {\n return false;\n } else if (modelLocale && modelLocale !== locale) {\n return false;\n }\n return true;\n })\n .map(plugin => {\n return {\n ...plugin.contentModel,\n tags: ensureTypeTag(plugin.contentModel),\n tenant,\n locale,\n webinyVersion: context.WEBINY_VERSION\n };\n }) as unknown as CmsModel[];\n\n return filterAsync(models, async model => {\n return accessControl.canAccessModel({ model });\n });\n });\n };\n\n const getModelFromCache = async (modelId: string) => {\n const models = await listModels();\n const model = models.find(m => m.modelId === modelId);\n if (!model) {\n throw new NotFoundError(`Content model \"${modelId}\" was not found!`);\n }\n\n return {\n ...model,\n tags: ensureTypeTag(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code\n };\n };\n\n /**\n * The list models cache is a key -> Promise pair so it the listModels() can be called multiple times but executed only once.\n *\n * We always fetch the plugins and database models separately.\n * Then we combine them and run access filtering on them\n */\n const listModels = async (input?: ICmsModelListParams) => {\n return context.benchmark.measure(\"headlessCms.crud.models.listModels\", async () => {\n /**\n * Maybe we can cache based on permissions, not the identity id?\n *\n * TODO: @adrian please check if possible.\n */\n const tenant = getTenant().id;\n const locale = getLocale().code;\n let pluginModels = await listPluginModels(tenant, locale);\n const dbCacheKey = createCacheKey({\n tenant,\n locale\n });\n const databaseModels = await listDatabaseModelsCache.getOrSet(dbCacheKey, async () => {\n return await listModelsFromDatabase(params);\n });\n\n const filteredCacheKey = createCacheKey({\n dbCacheKey: dbCacheKey.get(),\n identity: context.security.isAuthorizationEnabled() ? getIdentity()?.id : undefined\n });\n\n let filteredModels = await listFilteredModelsCache.getOrSet(\n filteredCacheKey,\n async () => {\n return filterAsync(databaseModels, async model => {\n return accessControl.canAccessModel({ model });\n });\n }\n );\n /**\n * Do we need to hide private models?\n */\n if (input?.includePrivate === false) {\n filteredModels = filteredModels.filter(model => !model.isPrivate);\n pluginModels = pluginModels.filter(model => !model.isPrivate);\n }\n /**\n * Do we need to hide plugin models?\n */\n if (input?.includePlugins === false) {\n return filteredModels;\n }\n\n return filteredModels.concat(pluginModels);\n });\n };\n\n const getModel = async (modelId: string): Promise<CmsModel> => {\n return context.benchmark.measure(\"headlessCms.crud.models.getModel\", async () => {\n const model = await context.security.withoutAuthorization(async () => {\n return await getModelFromCache(modelId);\n });\n if (!model) {\n throw new NotFoundError(`Content model \"${modelId}\" was not found!`);\n }\n\n await accessControl.ensureCanAccessModel({ model });\n\n return model;\n });\n };\n\n const getEntryManager: CmsModelContext[\"getEntryManager\"] = async <\n T extends CmsEntryValues = CmsEntryValues\n >(\n target: string | Pick<CmsModel, \"modelId\">\n ): Promise<CmsModelManager<T>> => {\n const modelId = typeof target === \"string\" ? target : target.modelId;\n if (managers.has(modelId)) {\n return managers.get(modelId) as CmsModelManager<T>;\n }\n const model = await getModelFromCache(modelId);\n return await updateManager<T>(context, model);\n };\n\n const getSingletonEntryManager = async <T extends CmsEntryValues = CmsEntryValues>(\n input: CmsModel | string\n ) => {\n const model = typeof input === \"string\" ? await getModel(input) : input;\n\n const manager = await getEntryManager<T>(model);\n\n return SingletonModelManager.create<T>(manager);\n };\n\n /**\n * Create\n */\n const onModelBeforeCreate =\n createTopic<OnModelBeforeCreateTopicParams>(\"cms.onModelBeforeCreate\");\n const onModelAfterCreate = createTopic<OnModelAfterCreateTopicParams>(\"cms.onModelAfterCreate\");\n const onModelCreateError = createTopic<OnModelCreateErrorTopicParams>(\"cms.onModelCreateError\");\n /**\n * Create from / clone\n */\n const onModelBeforeCreateFrom = createTopic<OnModelBeforeCreateFromTopicParams>(\n \"cms.onModelBeforeCreateFrom\"\n );\n const onModelAfterCreateFrom = createTopic<OnModelAfterCreateFromTopicParams>(\n \"cms.onModelAfterCreateFrom\"\n );\n const onModelCreateFromError = createTopic<OnModelCreateFromErrorParams>(\n \"cms.onModelCreateFromError\"\n );\n /**\n * Update\n */\n const onModelBeforeUpdate =\n createTopic<OnModelBeforeUpdateTopicParams>(\"cms.onModelBeforeUpdate\");\n const onModelAfterUpdate = createTopic<OnModelAfterUpdateTopicParams>(\"cms.onModelAfterUpdate\");\n const onModelUpdateError = createTopic<OnModelUpdateErrorTopicParams>(\"cms.onModelUpdateError\");\n /**\n * Delete\n */\n const onModelBeforeDelete =\n createTopic<OnModelBeforeDeleteTopicParams>(\"cms.onModelBeforeDelete\");\n const onModelAfterDelete = createTopic<OnModelAfterDeleteTopicParams>(\"cms.onModelAfterDelete\");\n const onModelDeleteError = createTopic<OnModelDeleteErrorTopicParams>(\"cms.onModelDeleteError\");\n /**\n * Initialize\n */\n const onModelInitialize = createTopic<OnModelInitializeParams>(\"cms.onModelInitialize\");\n /**\n * We need to assign some default behaviors.\n */\n assignModelBeforeCreate({\n onModelBeforeCreate,\n onModelBeforeCreateFrom,\n context,\n storageOperations\n });\n assignModelBeforeUpdate({\n onModelBeforeUpdate,\n context\n });\n assignModelBeforeDelete({\n onModelBeforeDelete,\n context\n });\n\n /**\n * CRUD methods\n */\n const createModel: CmsModelContext[\"createModel\"] = async input => {\n await accessControl.ensureCanAccessModel({ rwd: \"w\" });\n\n const result = await createModelCreateValidation().safeParseAsync(input);\n if (!result.success) {\n throw createZodError(result.error);\n }\n /**\n * We need to extract the defaultFields because it is not for the CmsModel object.\n */\n const { defaultFields, ...data } = removeUndefinedValues(result.data);\n if (defaultFields) {\n assignModelDefaultFields(data);\n }\n\n const group = await context.cms.getGroup(data.group);\n\n const identity = getIdentity();\n const model: CmsModel = {\n ...data,\n modelId: data.modelId || \"\",\n singularApiName: data.singularApiName,\n pluralApiName: data.pluralApiName,\n titleFieldId: \"id\",\n descriptionFieldId: null,\n imageFieldId: null,\n description: data.description || \"\",\n locale: getLocale().code,\n tenant: getTenant().id,\n group: {\n id: group.id,\n name: group.name\n },\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n lockedFields: [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n model.tags = ensureTypeTag(model);\n\n await accessControl.ensureCanAccessModel({ model, rwd: \"w\" });\n\n try {\n await onModelBeforeCreate.publish({\n input: data,\n model\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n clearModelsCache();\n\n await updateManager(context, model);\n\n await onModelAfterCreate.publish({\n input: data,\n model: createdModel\n });\n\n return createdModel;\n } catch (ex) {\n await onModelCreateError.publish({\n input: data,\n model,\n error: ex\n });\n throw ex;\n }\n };\n const updateModel: CmsModelContext[\"updateModel\"] = async (modelId, input) => {\n await accessControl.ensureCanAccessModel({ rwd: \"w\" });\n\n // Get a model record; this will also perform ownership validation.\n const original = await getModel(modelId);\n\n const result = await createModelUpdateValidation().safeParseAsync(input);\n if (!result.success) {\n throw createZodError(result.error);\n }\n\n const data = removeUndefinedValues(result.data);\n\n if (Object.keys(data).length === 0) {\n /**\n * We need to return the original if nothing is to be updated.\n */\n return original;\n }\n let group: CmsModelGroup = {\n id: original.group.id,\n name: original.group.name\n };\n const groupId = data.group;\n if (groupId) {\n const groupData = await context.cms.getGroup(groupId);\n group = {\n id: groupData.id,\n name: groupData.name\n };\n }\n const model: CmsModel = {\n ...original,\n ...data,\n titleFieldId:\n data.titleFieldId === undefined\n ? original.titleFieldId\n : (data.titleFieldId as string),\n descriptionFieldId:\n data.descriptionFieldId === undefined\n ? original.descriptionFieldId\n : data.descriptionFieldId,\n imageFieldId:\n data.imageFieldId === undefined ? original.imageFieldId : data.imageFieldId,\n group,\n description: data.description || original.description,\n tenant: original.tenant || getTenant().id,\n locale: original.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION,\n savedOn: new Date().toISOString()\n };\n\n await accessControl.ensureCanAccessModel({ model, rwd: \"w\" });\n\n model.tags = ensureTypeTag(model);\n\n try {\n await onModelBeforeUpdate.publish({\n input: data,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n await onModelAfterUpdate.publish({\n input: data,\n original,\n model: resultModel\n });\n\n return resultModel;\n } catch (ex) {\n await onModelUpdateError.publish({\n input: data,\n model,\n original,\n error: ex\n });\n\n throw ex;\n }\n };\n const updateModelDirect: CmsModelContext[\"updateModelDirect\"] = async params => {\n const { model: initialModel, original } = params;\n\n const model: CmsModel = {\n ...initialModel,\n tenant: initialModel.tenant || getTenant().id,\n locale: initialModel.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION\n };\n\n try {\n await onModelBeforeUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n clearModelsCache();\n\n await onModelAfterUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model: resultModel\n });\n\n return resultModel;\n } catch (ex) {\n await onModelUpdateError.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model,\n error: ex\n });\n throw ex;\n }\n };\n const createModelFrom: CmsModelContext[\"createModelFrom\"] = async (modelId, input) => {\n await accessControl.ensureCanAccessModel({ rwd: \"w\" });\n\n /**\n * Get a model record; this will also perform ownership validation.\n */\n const original = await getModel(modelId);\n\n const result = await createModelCreateFromValidation().safeParseAsync({\n ...input,\n description: input.description || original.description\n });\n if (!result.success) {\n throw createZodError(result.error);\n }\n\n const data = removeUndefinedValues(result.data);\n\n const locale = await context.i18n.getLocale(data.locale || original.locale);\n if (!locale) {\n throw new NotFoundError(`There is no locale \"${data.locale}\".`);\n }\n /**\n * Use storage operations directly because we cannot get group from different locale via context methods.\n */\n const group = await context.cms.storageOperations.groups.get({\n id: data.group,\n tenant: original.tenant,\n locale: locale.code\n });\n if (!group) {\n throw new NotFoundError(`There is no group \"${data.group}\".`);\n }\n\n const identity = getIdentity();\n const model: CmsModel = {\n ...original,\n singularApiName: data.singularApiName,\n pluralApiName: data.pluralApiName,\n locale: locale.code,\n group: {\n id: group.id,\n name: group.name\n },\n icon: data.icon,\n name: data.name,\n modelId: data.modelId || \"\",\n description: data.description || \"\",\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n lockedFields: [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n await accessControl.ensureCanAccessModel({ model, rwd: \"w\" });\n\n try {\n await onModelBeforeCreateFrom.publish({\n input: data,\n model,\n original\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n clearModelsCache();\n\n await updateManager(context, model);\n\n await onModelAfterCreateFrom.publish({\n input: data,\n original,\n model: createdModel\n });\n\n return createdModel;\n } catch (ex) {\n await onModelCreateFromError.publish({\n input: data,\n original,\n model,\n error: ex\n });\n throw ex;\n }\n };\n const deleteModel: CmsModelContext[\"deleteModel\"] = async modelId => {\n await accessControl.ensureCanAccessModel({ rwd: \"d\" });\n\n const model = await getModel(modelId);\n\n await accessControl.ensureCanAccessModel({ model, rwd: \"d\" });\n\n try {\n await onModelBeforeDelete.publish({\n model\n });\n\n try {\n await storageOperations.models.delete({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete the content model\",\n ex.code || \"CONTENT_MODEL_DELETE_ERROR\",\n {\n error: ex,\n modelId: model.modelId\n }\n );\n }\n\n clearModelsCache();\n\n await onModelAfterDelete.publish({\n model\n });\n\n managers.delete(model.modelId);\n } catch (ex) {\n await onModelDeleteError.publish({\n model,\n error: ex\n });\n throw ex;\n }\n };\n const initializeModel: CmsModelContext[\"initializeModel\"] = async (modelId, data) => {\n /**\n * We require that users have write permissions to initialize models.\n * Maybe introduce another permission for it?\n */\n const model = await getModel(modelId);\n\n await accessControl.ensureCanAccessModel({ model, rwd: \"w\" });\n\n await onModelInitialize.publish({ model, data });\n\n return true;\n };\n return {\n onModelBeforeCreate,\n onModelAfterCreate,\n onModelCreateError,\n onModelBeforeCreateFrom,\n onModelAfterCreateFrom,\n onModelCreateFromError,\n onModelBeforeUpdate,\n onModelAfterUpdate,\n onModelUpdateError,\n onModelBeforeDelete,\n onModelAfterDelete,\n onModelDeleteError,\n onModelInitialize,\n clearModelsCache,\n getModel,\n getModelToAstConverter,\n listModels,\n async createModel(input) {\n return context.benchmark.measure(\"headlessCms.crud.models.createModel\", async () => {\n return createModel(input);\n });\n },\n /**\n * Method does not check for permissions or ownership.\n * @internal\n */\n async updateModelDirect(params) {\n return context.benchmark.measure(\n \"headlessCms.crud.models.updateModelDirect\",\n async () => {\n return updateModelDirect(params);\n }\n );\n },\n async createModelFrom(modelId, userInput) {\n return context.benchmark.measure(\n \"headlessCms.crud.models.createModelFrom\",\n async () => {\n return createModelFrom(modelId, userInput);\n }\n );\n },\n async updateModel(modelId, input) {\n return context.benchmark.measure(\"headlessCms.crud.models.updateModel\", async () => {\n return updateModel(modelId, input);\n });\n },\n async deleteModel(modelId) {\n return context.benchmark.measure(\"headlessCms.crud.models.deleteModel\", async () => {\n return deleteModel(modelId);\n });\n },\n async initializeModel(modelId, data) {\n return context.benchmark.measure(\n \"headlessCms.crud.models.initializeModel\",\n async () => {\n return initializeModel(modelId, data);\n }\n );\n },\n getEntryManager,\n getEntryManagers: () => managers,\n getSingletonEntryManager\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AA0BA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,cAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,cAAA,GAAAZ,OAAA;AACA,IAAAa,uBAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AAEA,IAAAe,gBAAA,GAAAf,OAAA;AAIA,IAAAgB,aAAA,GAAAhB,OAAA;AAWO,MAAMiB,gBAAgB,GAAIC,MAA8B,IAAsB;EACjF,MAAM;IAAEC,SAAS;IAAEC,WAAW;IAAEC,SAAS;IAAEC,iBAAiB;IAAEC,aAAa;IAAEC;E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CAAC;IACDhC,eAAe;IACf2E,gBAAgB,EAAEA,CAAA,KAAM/I,QAAQ;IAChCuE;EACJ,CAAC;AACL,CAAC;AAACyE,OAAA,CAAA9J,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HeadlessCmsStorageOperations, OnGroupBeforeCreateTopicParams } from "../../types";
|
|
2
|
-
import { Topic } from "@webiny/pubsub/types";
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
1
|
+
import type { HeadlessCmsStorageOperations, OnGroupBeforeCreateTopicParams } from "../../types";
|
|
2
|
+
import type { Topic } from "@webiny/pubsub/types";
|
|
3
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
4
|
interface AssignBeforeGroupCreateParams {
|
|
5
5
|
onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;
|
|
6
6
|
plugins: PluginsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_toSlug","_CmsGroupPlugin","_utils","assignBeforeGroupCreate","params","onGroupBeforeCreate","plugins","storageOperations","subscribe","group","id","groups","list","where","tenant","locale","length","WebinyError","slug","trim","toSlug","name","generateAlphaNumericId","groupPlugin","byType","CmsGroupPlugin","type","find","item","contentModelGroup","Error","exports"],"sources":["beforeCreate.ts"],"sourcesContent":["import { HeadlessCmsStorageOperations, OnGroupBeforeCreateTopicParams } from \"~/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\nimport { toSlug } from \"~/utils/toSlug\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\ninterface AssignBeforeGroupCreateParams {\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n plugins: PluginsContainer;\n storageOperations: HeadlessCmsStorageOperations;\n}\nexport const assignBeforeGroupCreate = (params: AssignBeforeGroupCreateParams) => {\n const { onGroupBeforeCreate, plugins, storageOperations } = params;\n\n onGroupBeforeCreate.subscribe(async params => {\n const { group } = params;\n\n if (group.id) {\n const groups = await storageOperations.groups.list({\n where: {\n tenant: group.tenant,\n locale: group.locale,\n id: group.id\n }\n });\n if (groups.length > 0) {\n throw new WebinyError(\n `Cms Group with the id \"${group.id}\" already exists.`,\n \"ID_ALREADY_EXISTS\"\n );\n }\n }\n\n if (group.slug && group.slug.trim()) {\n const groups = await storageOperations.groups.list({\n where: {\n tenant: group.tenant,\n locale: group.locale,\n slug: group.slug\n }\n });\n if (groups.length > 0) {\n throw new WebinyError(\n `Cms Group with the slug \"${group.slug}\" already exists.`,\n \"SLUG_ALREADY_EXISTS\"\n );\n }\n } else {\n const slug = toSlug(group.name);\n const groups = await storageOperations.groups.list({\n where: {\n tenant: group.tenant,\n locale: group.locale,\n slug\n }\n });\n\n if (groups.length === 0) {\n group.slug = slug;\n } else {\n group.slug = `${slug}-${generateAlphaNumericId(8)}`;\n }\n }\n\n const groupPlugin = plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .find(item => item.contentModelGroup.slug === group.slug);\n\n if (groupPlugin) {\n throw new Error(\n `Cannot create \"${group.slug}\" content model group because one is already registered via a plugin.`\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAOO,MAAMI,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,mBAAmB;IAAEC,OAAO;IAAEC;EAAkB,CAAC,GAAGH,MAAM;EAElEC,mBAAmB,CAACG,SAAS,CAAC,MAAMJ,MAAM,IAAI;IAC1C,MAAM;MAAEK;IAAM,CAAC,GAAGL,MAAM;IAExB,IAAIK,KAAK,CAACC,EAAE,EAAE;MACV,MAAMC,MAAM,GAAG,MAAMJ,iBAAiB,CAACI,MAAM,CAACC,IAAI,CAAC;QAC/CC,KAAK,EAAE;UACHC,MAAM,EAAEL,KAAK,CAACK,MAAM;UACpBC,MAAM,EAAEN,KAAK,CAACM,MAAM;UACpBL,EAAE,EAAED,KAAK,CAACC;QACd;MACJ,CAAC,CAAC;MACF,IAAIC,MAAM,CAACK,MAAM,GAAG,CAAC,EAAE;QACnB,MAAM,IAAIC,cAAW,
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_toSlug","_CmsGroupPlugin","_utils","assignBeforeGroupCreate","params","onGroupBeforeCreate","plugins","storageOperations","subscribe","group","id","groups","list","where","tenant","locale","length","WebinyError","slug","trim","toSlug","name","generateAlphaNumericId","groupPlugin","byType","CmsGroupPlugin","type","find","item","contentModelGroup","Error","exports"],"sources":["beforeCreate.ts"],"sourcesContent":["import type { HeadlessCmsStorageOperations, OnGroupBeforeCreateTopicParams } from \"~/types\";\nimport type { Topic } from \"@webiny/pubsub/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\nimport { toSlug } from \"~/utils/toSlug\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\ninterface AssignBeforeGroupCreateParams {\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n plugins: PluginsContainer;\n storageOperations: HeadlessCmsStorageOperations;\n}\nexport const assignBeforeGroupCreate = (params: AssignBeforeGroupCreateParams) => {\n const { onGroupBeforeCreate, plugins, storageOperations } = params;\n\n onGroupBeforeCreate.subscribe(async params => {\n const { group } = params;\n\n if (group.id) {\n const groups = await storageOperations.groups.list({\n where: {\n tenant: group.tenant,\n locale: group.locale,\n id: group.id\n }\n });\n if (groups.length > 0) {\n throw new WebinyError(\n `Cms Group with the id \"${group.id}\" already exists.`,\n \"ID_ALREADY_EXISTS\"\n );\n }\n }\n\n if (group.slug && group.slug.trim()) {\n const groups = await storageOperations.groups.list({\n where: {\n tenant: group.tenant,\n locale: group.locale,\n slug: group.slug\n }\n });\n if (groups.length > 0) {\n throw new WebinyError(\n `Cms Group with the slug \"${group.slug}\" already exists.`,\n \"SLUG_ALREADY_EXISTS\"\n );\n }\n } else {\n const slug = toSlug(group.name);\n const groups = await storageOperations.groups.list({\n where: {\n tenant: group.tenant,\n locale: group.locale,\n slug\n }\n });\n\n if (groups.length === 0) {\n group.slug = slug;\n } else {\n group.slug = `${slug}-${generateAlphaNumericId(8)}`;\n }\n }\n\n const groupPlugin = plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .find(item => item.contentModelGroup.slug === group.slug);\n\n if (groupPlugin) {\n throw new Error(\n `Cannot create \"${group.slug}\" content model group because one is already registered via a plugin.`\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAOO,MAAMI,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,mBAAmB;IAAEC,OAAO;IAAEC;EAAkB,CAAC,GAAGH,MAAM;EAElEC,mBAAmB,CAACG,SAAS,CAAC,MAAMJ,MAAM,IAAI;IAC1C,MAAM;MAAEK;IAAM,CAAC,GAAGL,MAAM;IAExB,IAAIK,KAAK,CAACC,EAAE,EAAE;MACV,MAAMC,MAAM,GAAG,MAAMJ,iBAAiB,CAACI,MAAM,CAACC,IAAI,CAAC;QAC/CC,KAAK,EAAE;UACHC,MAAM,EAAEL,KAAK,CAACK,MAAM;UACpBC,MAAM,EAAEN,KAAK,CAACM,MAAM;UACpBL,EAAE,EAAED,KAAK,CAACC;QACd;MACJ,CAAC,CAAC;MACF,IAAIC,MAAM,CAACK,MAAM,GAAG,CAAC,EAAE;QACnB,MAAM,IAAIC,c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AM,IAAIO,KAAK,CACX,kBAAkBrB,KAAK,CAACS,IAAI,uEAChC,CAAC;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAA5B,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Topic } from "@webiny/pubsub/types";
|
|
2
|
-
import { OnGroupBeforeDeleteTopicParams, HeadlessCmsStorageOperations } from "../../types";
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
1
|
+
import type { Topic } from "@webiny/pubsub/types";
|
|
2
|
+
import type { OnGroupBeforeDeleteTopicParams, HeadlessCmsStorageOperations } from "../../types";
|
|
3
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
4
|
interface AssignBeforeGroupDeleteParams {
|
|
5
5
|
onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;
|
|
6
6
|
plugins: PluginsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_CmsGroupPlugin","require","_error","_interopRequireDefault","assignBeforeGroupDelete","params","onGroupBeforeDelete","plugins","storageOperations","subscribe","group","groupPlugin","byType","CmsGroupPlugin","type","find","item","contentModelGroup","slug","Error","models","list","where","tenant","locale","items","filter","model","id","length","WebinyError","exports"],"sources":["beforeDelete.ts"],"sourcesContent":["import { Topic } from \"@webiny/pubsub/types\";\nimport { OnGroupBeforeDeleteTopicParams, HeadlessCmsStorageOperations } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport WebinyError from \"@webiny/error\";\n\ninterface AssignBeforeGroupDeleteParams {\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n plugins: PluginsContainer;\n storageOperations: HeadlessCmsStorageOperations;\n}\nexport const assignBeforeGroupDelete = (params: AssignBeforeGroupDeleteParams) => {\n const { onGroupBeforeDelete, plugins, storageOperations } = params;\n\n onGroupBeforeDelete.subscribe(async params => {\n const { group } = params;\n\n const groupPlugin = plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .find(item => item.contentModelGroup.slug === group.slug);\n\n if (groupPlugin) {\n throw new Error(`Cms Groups defined via plugins cannot be deleted.`);\n }\n\n const models = await storageOperations.models.list({\n where: {\n tenant: group.tenant,\n locale: group.locale\n }\n });\n const items = models.filter(model => {\n return model.group.id === group.id;\n });\n if (items.length > 0) {\n throw new WebinyError(\n \"Cannot delete this group because there are models that belong to it.\",\n \"BEFORE_DELETE_ERROR\",\n {\n group\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAOO,MAAMG,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,mBAAmB;IAAEC,OAAO;IAAEC;EAAkB,CAAC,GAAGH,MAAM;EAElEC,mBAAmB,CAACG,SAAS,CAAC,MAAMJ,MAAM,IAAI;IAC1C,MAAM;MAAEK;IAAM,CAAC,GAAGL,MAAM;IAExB,MAAMM,WAAW,GAAGJ,OAAO,CACtBK,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,iBAAiB,CAACC,IAAI,KAAKR,KAAK,CAACQ,IAAI,CAAC;IAE7D,IAAIP,WAAW,EAAE;MACb,MAAM,IAAIQ,KAAK,
|
|
1
|
+
{"version":3,"names":["_CmsGroupPlugin","require","_error","_interopRequireDefault","assignBeforeGroupDelete","params","onGroupBeforeDelete","plugins","storageOperations","subscribe","group","groupPlugin","byType","CmsGroupPlugin","type","find","item","contentModelGroup","slug","Error","models","list","where","tenant","locale","items","filter","model","id","length","WebinyError","exports"],"sources":["beforeDelete.ts"],"sourcesContent":["import type { Topic } from \"@webiny/pubsub/types\";\nimport type { OnGroupBeforeDeleteTopicParams, HeadlessCmsStorageOperations } from \"~/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport WebinyError from \"@webiny/error\";\n\ninterface AssignBeforeGroupDeleteParams {\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n plugins: PluginsContainer;\n storageOperations: HeadlessCmsStorageOperations;\n}\nexport const assignBeforeGroupDelete = (params: AssignBeforeGroupDeleteParams) => {\n const { onGroupBeforeDelete, plugins, storageOperations } = params;\n\n onGroupBeforeDelete.subscribe(async params => {\n const { group } = params;\n\n const groupPlugin = plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .find(item => item.contentModelGroup.slug === group.slug);\n\n if (groupPlugin) {\n throw new Error(`Cms Groups defined via plugins cannot be deleted.`);\n }\n\n const models = await storageOperations.models.list({\n where: {\n tenant: group.tenant,\n locale: group.locale\n }\n });\n const items = models.filter(model => {\n return model.group.id === group.id;\n });\n if (items.length > 0) {\n throw new WebinyError(\n \"Cannot delete this group because there are models that belong to it.\",\n \"BEFORE_DELETE_ERROR\",\n {\n group\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAOO,MAAMG,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,mBAAmB;IAAEC,OAAO;IAAEC;EAAkB,CAAC,GAAGH,MAAM;EAElEC,mBAAmB,CAACG,SAAS,CAAC,MAAMJ,MAAM,IAAI;IAC1C,MAAM;MAAEK;IAAM,CAAC,GAAGL,MAAM;IAExB,MAAMM,WAAW,GAAGJ,OAAO,CACtBK,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,iBAAiB,CAACC,IAAI,KAAKR,KAAK,CAACQ,IAAI,CAAC;IAE7D,IAAIP,WAAW,EAAE;MACb,MAAM,IAAIQ,KAAK,CAAC,mDAAmD,CAAC;IACxE;IAEA,MAAMC,MAAM,GAAG,MAAMZ,iBAAiB,CAACY,MAAM,CAACC,IAAI,CAAC;MAC/CC,KAAK,EAAE;QACHC,MAAM,EAAEb,KAAK,CAACa,MAAM;QACpBC,MAAM,EAAEd,KAAK,CAACc;MAClB;IACJ,CAAC,CAAC;IACF,MAAMC,KAAK,GAAGL,MAAM,CAACM,MAAM,CAACC,KAAK,IAAI;MACjC,OAAOA,KAAK,CAACjB,KAAK,CAACkB,EAAE,KAAKlB,KAAK,CAACkB,EAAE;IACtC,CAAC,CAAC;IACF,IAAIH,KAAK,CAACI,MAAM,GAAG,CAAC,EAAE;MAClB,MAAM,IAAIC,cAAW,CACjB,sEAAsE,EACtE,qBAAqB,EACrB;QACIpB;MACJ,CACJ,CAAC;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAACqB,OAAA,CAAA3B,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Topic } from "@webiny/pubsub/types";
|
|
2
|
-
import { OnGroupBeforeUpdateTopicParams } from "../../types";
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
1
|
+
import type { Topic } from "@webiny/pubsub/types";
|
|
2
|
+
import type { OnGroupBeforeUpdateTopicParams } from "../../types";
|
|
3
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
4
|
interface AssignBeforeGroupUpdateParams {
|
|
5
5
|
onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;
|
|
6
6
|
plugins: PluginsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_CmsGroupPlugin","require","assignBeforeGroupUpdate","params","onGroupBeforeUpdate","plugins","subscribe","group","groupPlugin","byType","CmsGroupPlugin","type","find","item","contentModelGroup","slug","Error","exports"],"sources":["beforeUpdate.ts"],"sourcesContent":["import { Topic } from \"@webiny/pubsub/types\";\nimport { OnGroupBeforeUpdateTopicParams } from \"~/types\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\ninterface AssignBeforeGroupUpdateParams {\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n plugins: PluginsContainer;\n}\nexport const assignBeforeGroupUpdate = (params: AssignBeforeGroupUpdateParams) => {\n const { onGroupBeforeUpdate, plugins } = params;\n\n onGroupBeforeUpdate.subscribe(({ group }) => {\n const groupPlugin = plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .find(item => item.contentModelGroup.slug === group.slug);\n if (!groupPlugin) {\n return;\n }\n throw new Error(`Cms Groups defined via plugins cannot be updated.`);\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AAOO,MAAMC,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,mBAAmB;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAE/CC,mBAAmB,CAACE,SAAS,CAAC,CAAC;IAAEC;EAAM,CAAC,KAAK;IACzC,MAAMC,WAAW,GAAGH,OAAO,CACtBI,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,iBAAiB,CAACC,IAAI,KAAKR,KAAK,CAACQ,IAAI,CAAC;IAC7D,IAAI,CAACP,WAAW,EAAE;MACd;IACJ;IACA,MAAM,IAAIQ,KAAK,
|
|
1
|
+
{"version":3,"names":["_CmsGroupPlugin","require","assignBeforeGroupUpdate","params","onGroupBeforeUpdate","plugins","subscribe","group","groupPlugin","byType","CmsGroupPlugin","type","find","item","contentModelGroup","slug","Error","exports"],"sources":["beforeUpdate.ts"],"sourcesContent":["import type { Topic } from \"@webiny/pubsub/types\";\nimport type { OnGroupBeforeUpdateTopicParams } from \"~/types\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\ninterface AssignBeforeGroupUpdateParams {\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n plugins: PluginsContainer;\n}\nexport const assignBeforeGroupUpdate = (params: AssignBeforeGroupUpdateParams) => {\n const { onGroupBeforeUpdate, plugins } = params;\n\n onGroupBeforeUpdate.subscribe(({ group }) => {\n const groupPlugin = plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .find(item => item.contentModelGroup.slug === group.slug);\n if (!groupPlugin) {\n return;\n }\n throw new Error(`Cms Groups defined via plugins cannot be updated.`);\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AAOO,MAAMC,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,mBAAmB;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAE/CC,mBAAmB,CAACE,SAAS,CAAC,CAAC;IAAEC;EAAM,CAAC,KAAK;IACzC,MAAMC,WAAW,GAAGH,OAAO,CACtBI,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,iBAAiB,CAACC,IAAI,KAAKR,KAAK,CAACQ,IAAI,CAAC;IAC7D,IAAI,CAACP,WAAW,EAAE;MACd;IACJ;IACA,MAAM,IAAIQ,KAAK,CAAC,mDAAmD,CAAC;EACxE,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAf,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["listGroupsFromDatabase","params","storageOperations","tenant","locale","groups","list","where","exports"],"sources":["listGroupsFromDatabase.ts"],"sourcesContent":["import { HeadlessCmsStorageOperations } from \"~/types\";\n\ninterface Params {\n storageOperations: HeadlessCmsStorageOperations;\n tenant: string;\n locale: string;\n}\n\nexport const listGroupsFromDatabase = async (params: Params) => {\n const { storageOperations, tenant, locale } = params;\n\n return await storageOperations.groups.list({\n where: {\n tenant,\n locale\n }\n });\n};\n"],"mappings":";;;;;;AAQO,MAAMA,sBAAsB,GAAG,MAAOC,MAAc,IAAK;EAC5D,MAAM;IAAEC,iBAAiB;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEpD,OAAO,MAAMC,iBAAiB,CAACG,MAAM,CAACC,IAAI,CAAC;IACvCC,KAAK,EAAE;MACHJ,MAAM;MACNC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAR,sBAAA,GAAAA,sBAAA"}
|
|
1
|
+
{"version":3,"names":["listGroupsFromDatabase","params","storageOperations","tenant","locale","groups","list","where","exports"],"sources":["listGroupsFromDatabase.ts"],"sourcesContent":["import type { HeadlessCmsStorageOperations } from \"~/types\";\n\ninterface Params {\n storageOperations: HeadlessCmsStorageOperations;\n tenant: string;\n locale: string;\n}\n\nexport const listGroupsFromDatabase = async (params: Params) => {\n const { storageOperations, tenant, locale } = params;\n\n return await storageOperations.groups.list({\n where: {\n tenant,\n locale\n }\n });\n};\n"],"mappings":";;;;;;AAQO,MAAMA,sBAAsB,GAAG,MAAOC,MAAc,IAAK;EAC5D,MAAM;IAAEC,iBAAiB;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEpD,OAAO,MAAMC,iBAAiB,CAACG,MAAM,CAACC,IAAI,CAAC;IACvCC,KAAK,EAAE;MACHJ,MAAM;MACNC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAR,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -6,8 +6,8 @@ export declare const createGroupCreateValidation: () => zod.ZodObject<{
|
|
|
6
6
|
description: zod.ZodEffects<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>, string, string | null | undefined>;
|
|
7
7
|
icon: zod.ZodString;
|
|
8
8
|
}, "strip", zod.ZodTypeAny, {
|
|
9
|
-
description: string;
|
|
10
9
|
name: string;
|
|
10
|
+
description: string;
|
|
11
11
|
slug: string;
|
|
12
12
|
icon: string;
|
|
13
13
|
id?: string | null | undefined;
|
|
@@ -15,8 +15,8 @@ export declare const createGroupCreateValidation: () => zod.ZodObject<{
|
|
|
15
15
|
name: string;
|
|
16
16
|
icon: string;
|
|
17
17
|
id?: string | null | undefined;
|
|
18
|
-
slug?: string | undefined;
|
|
19
18
|
description?: string | null | undefined;
|
|
19
|
+
slug?: string | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
export declare const createGroupUpdateValidation: () => zod.ZodObject<{
|
|
22
22
|
name: zod.ZodOptional<zod.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_zod","_interopRequireDefault","require","_toSlug","str","zod","string","trim","name","max","description","optional","nullish","icon","min","createGroupCreateValidation","object","id","slug","transform","value","toSlug","exports","createGroupUpdateValidation"],"sources":["validation.ts"],"sourcesContent":["import zod from \"zod\";\nimport { toSlug } from \"~/utils/toSlug\";\n\nconst str = zod.string().trim();\n\nconst name = str.max(100);\nconst description = str.max(255).optional().nullish();\nconst icon = str.min(1).max(255);\n\nexport const createGroupCreateValidation = () => {\n return zod.object({\n id: str.optional().nullish(),\n name: name.min(1),\n slug: str\n .max(100)\n .optional()\n .transform(value => {\n return value ? toSlug(value) : \"\";\n }),\n description: description.transform(value => {\n return value || \"\";\n }),\n icon\n });\n};\n\nexport const createGroupUpdateValidation = () => {\n return zod.object({\n name: name.optional(),\n description,\n icon: icon.optional()\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,GAAG,GAAGC,YAAG,CAACC,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC;AAE/B,MAAMC,IAAI,GAAGJ,GAAG,CAACK,GAAG,CAAC,GAAG,CAAC;AACzB,MAAMC,WAAW,GAAGN,GAAG,CAACK,GAAG,CAAC,GAAG,CAAC,CAACE,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;AACrD,MAAMC,IAAI,GAAGT,GAAG,CAACU,GAAG,CAAC,CAAC,CAAC,CAACL,GAAG,CAAC,GAAG,CAAC;AAEzB,MAAMM,2BAA2B,GAAGA,CAAA,KAAM;EAC7C,OAAOV,YAAG,CAACW,MAAM,CAAC;IACdC,EAAE,EAAEb,GAAG,CAACO,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;IAC5BJ,IAAI,EAAEA,IAAI,CAACM,GAAG,CAAC,CAAC,CAAC;IACjBI,IAAI,EAAEd,GAAG,CACJK,GAAG,CAAC,GAAG,CAAC,CACRE,QAAQ,CAAC,CAAC,CACVQ,SAAS,CAACC,KAAK,IAAI;MAChB,OAAOA,KAAK,GAAG,IAAAC,cAAM,EAACD,KAAK,CAAC,GAAG,EAAE;IACrC,CAAC,CAAC;IACNV,WAAW,EAAEA,WAAW,CAACS,SAAS,CAACC,KAAK,IAAI;MACxC,OAAOA,KAAK,IAAI,EAAE;IACtB,CAAC,CAAC;IACFP;EACJ,CAAC,CAAC;AACN,CAAC;AAACS,OAAA,CAAAP,2BAAA,GAAAA,2BAAA;AAEK,MAAMQ,2BAA2B,GAAGA,CAAA,KAAM;EAC7C,OAAOlB,YAAG,CAACW,MAAM,CAAC;IACdR,IAAI,EAAEA,IAAI,CAACG,QAAQ,CAAC,CAAC;IACrBD,WAAW;IACXG,IAAI,EAAEA,IAAI,CAACF,QAAQ,CAAC;EACxB,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAC,2BAAA,GAAAA,2BAAA"}
|
|
1
|
+
{"version":3,"names":["_zod","_interopRequireDefault","require","_toSlug","str","zod","string","trim","name","max","description","optional","nullish","icon","min","createGroupCreateValidation","object","id","slug","transform","value","toSlug","exports","createGroupUpdateValidation"],"sources":["validation.ts"],"sourcesContent":["import zod from \"zod\";\nimport { toSlug } from \"~/utils/toSlug\";\n\nconst str = zod.string().trim();\n\nconst name = str.max(100);\nconst description = str.max(255).optional().nullish();\nconst icon = str.min(1).max(255);\n\nexport const createGroupCreateValidation = () => {\n return zod.object({\n id: str.optional().nullish(),\n name: name.min(1),\n slug: str\n .max(100)\n .optional()\n .transform(value => {\n return value ? toSlug(value) : \"\";\n }),\n description: description.transform(value => {\n return value || \"\";\n }),\n icon\n });\n};\n\nexport const createGroupUpdateValidation = () => {\n return zod.object({\n name: name.optional(),\n description,\n icon: icon.optional()\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,GAAG,GAAGC,YAAG,CAACC,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC;AAE/B,MAAMC,IAAI,GAAGJ,GAAG,CAACK,GAAG,CAAC,GAAG,CAAC;AACzB,MAAMC,WAAW,GAAGN,GAAG,CAACK,GAAG,CAAC,GAAG,CAAC,CAACE,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;AACrD,MAAMC,IAAI,GAAGT,GAAG,CAACU,GAAG,CAAC,CAAC,CAAC,CAACL,GAAG,CAAC,GAAG,CAAC;AAEzB,MAAMM,2BAA2B,GAAGA,CAAA,KAAM;EAC7C,OAAOV,YAAG,CAACW,MAAM,CAAC;IACdC,EAAE,EAAEb,GAAG,CAACO,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;IAC5BJ,IAAI,EAAEA,IAAI,CAACM,GAAG,CAAC,CAAC,CAAC;IACjBI,IAAI,EAAEd,GAAG,CACJK,GAAG,CAAC,GAAG,CAAC,CACRE,QAAQ,CAAC,CAAC,CACVQ,SAAS,CAACC,KAAK,IAAI;MAChB,OAAOA,KAAK,GAAG,IAAAC,cAAM,EAACD,KAAK,CAAC,GAAG,EAAE;IACrC,CAAC,CAAC;IACNV,WAAW,EAAEA,WAAW,CAACS,SAAS,CAACC,KAAK,IAAI;MACxC,OAAOA,KAAK,IAAI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