@webiny/api-headless-cms 0.0.0-unstable.de38392959 → 0.0.0-unstable.e0bfc55d5a
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 +197 -176
- 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 +1 -1
- 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 +2 -2
- package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -1
- package/graphqlFields/richText/richTextResolver.d.ts +2 -2
- package/graphqlFields/richText/richTextResolver.js +4 -19
- package/graphqlFields/richText/richTextResolver.js.map +1 -1
- package/graphqlFields/richText.d.ts +1 -1
- package/graphqlFields/richText.js.map +1 -1
- package/graphqlFields/searchableJson.d.ts +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 +1 -1
- package/htmlRenderer/LexicalRenderer.js.map +1 -1
- package/htmlRenderer/createLexicalHTMLRenderer.js +1 -1
- package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -1
- package/index.d.ts +13 -7
- package/index.js +67 -7
- 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 -38
- 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 +101 -19
- 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 +6 -6
- package/plugins/CmsRichTextRendererPlugin.js.map +1 -1
- 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.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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Plugin } from "@webiny/plugins/types";
|
|
2
2
|
export interface GraphQLHandlerFactoryParams {
|
|
3
3
|
debug?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare const graphQLHandlerFactory: ({ debug }: GraphQLHandlerFactoryParams) =>
|
|
5
|
+
export declare const graphQLHandlerFactory: ({ debug }: GraphQLHandlerFactoryParams) => Plugin[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_debugPlugins","_interopRequireDefault","require","_handler","_handleRequest","cmsRoutes","RoutePlugin","onPost","onOptions","context","request","reply","handleRequest","_","status","send","hijack","name","graphQLHandlerFactory","debug","debugPlugins","type","exports"],"sources":["graphQLHandlerFactory.ts"],"sourcesContent":["import debugPlugins from \"@webiny/handler-graphql/debugPlugins\";\nimport { CmsContext } from \"~/types\";\nimport {
|
|
1
|
+
{"version":3,"names":["_debugPlugins","_interopRequireDefault","require","_handler","_handleRequest","cmsRoutes","RoutePlugin","onPost","onOptions","context","request","reply","handleRequest","_","status","send","hijack","name","graphQLHandlerFactory","debug","debugPlugins","type","exports"],"sources":["graphQLHandlerFactory.ts"],"sourcesContent":["import debugPlugins from \"@webiny/handler-graphql/debugPlugins\";\nimport type { CmsContext } from \"~/types\";\nimport type { Plugin } from \"@webiny/plugins/types\";\nimport { RoutePlugin } from \"@webiny/handler\";\nimport { handleRequest } from \"./handleRequest\";\n\nexport interface GraphQLHandlerFactoryParams {\n debug?: boolean;\n}\n\nconst cmsRoutes = new RoutePlugin<CmsContext>(({ onPost, onOptions, context }) => {\n onPost(\"/cms/:type(^manage|preview|read$)/:locale\", async (request, reply) => {\n return handleRequest({ context, request, reply });\n });\n\n onOptions(\"/cms/:type(^manage|preview|read$)/:locale\", async (_, reply) => {\n return reply.status(204).send({}).hijack();\n });\n});\n\ncmsRoutes.name = \"headless-cms.graphql.route.default\";\n\nexport const graphQLHandlerFactory = ({ debug }: GraphQLHandlerFactoryParams): Plugin[] => {\n return [\n ...(debug ? debugPlugins() : []),\n cmsRoutes,\n {\n type: \"wcp-telemetry-tracker\"\n }\n ];\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAMA,MAAMG,SAAS,GAAG,IAAIC,oBAAW,CAAa,CAAC;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAQ,CAAC,KAAK;EAC9EF,MAAM,CAAC,2CAA2C,EAAE,OAAOG,OAAO,EAAEC,KAAK,KAAK;IAC1E,OAAO,IAAAC,4BAAa,EAAC;MAAEH,OAAO;MAAEC,OAAO;MAAEC;IAAM,CAAC,CAAC;EACrD,CAAC,CAAC;EAEFH,SAAS,CAAC,2CAA2C,EAAE,OAAOK,CAAC,EAAEF,KAAK,KAAK;IACvE,OAAOA,KAAK,CAACG,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC,CAACC,MAAM,CAAC,CAAC;EAC9C,CAAC,CAAC;AACN,CAAC,CAAC;AAEFX,SAAS,CAACY,IAAI,GAAG,oCAAoC;AAE9C,MAAMC,qBAAqB,GAAGA,CAAC;EAAEC;AAAmC,CAAC,KAAe;EACvF,OAAO,CACH,IAAIA,KAAK,GAAG,IAAAC,qBAAY,EAAC,CAAC,GAAG,EAAE,CAAC,EAChCf,SAAS,EACT;IACIgB,IAAI,EAAE;EACV,CAAC,CACJ;AACL,CAAC;AAACC,OAAA,CAAAJ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CmsContext } from "../types";
|
|
2
|
-
import { Reply, Request } from "@webiny/handler/types";
|
|
1
|
+
import type { CmsContext } from "../types";
|
|
2
|
+
import type { Reply, Request } from "@webiny/handler/types";
|
|
3
3
|
export interface HandleRequestParams {
|
|
4
4
|
context: CmsContext;
|
|
5
5
|
request: Request;
|
package/graphql/handleRequest.js
CHANGED
|
@@ -72,7 +72,14 @@ const handleRequest = async params => {
|
|
|
72
72
|
throw ex;
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* IMPORTANT! Do not send anything if reply was already sent.
|
|
77
|
+
*/
|
|
78
|
+
if (reply.sent) {
|
|
79
|
+
console.warn("Reply already sent, cannot send the result (api-headless-cms).");
|
|
80
|
+
return reply;
|
|
81
|
+
}
|
|
82
|
+
return reply.send(result);
|
|
76
83
|
};
|
|
77
84
|
exports.handleRequest = handleRequest;
|
|
78
85
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_checkEndpointAccess","require","_createRequestBody","_formatErrorPayload","_getSchema","_handlerGraphql","handleRequest","params","context","request","reply","checkEndpointAccess","ex","code","send","data","error","message","stack","getTenant","tenancy","getCurrentTenant","getLocale","cms","schema","benchmark","measure","getSchema","type","console","formatErrorPayload","body","createRequestBody","result","processRequestBody","exports"],"sources":["handleRequest.ts"],"sourcesContent":["import { ApiEndpoint, CmsContext } from \"~/types\";\nimport { checkEndpointAccess } from \"./checkEndpointAccess\";\nimport { createRequestBody } from \"./createRequestBody\";\nimport { formatErrorPayload } from \"./formatErrorPayload\";\nimport { getSchema } from \"./getSchema\";\nimport { Reply, Request } from \"@webiny/handler/types\";\nimport { processRequestBody } from \"@webiny/handler-graphql\";\nimport { ExecutionResult } from \"graphql\";\n\nexport interface HandleRequestParams {\n context: CmsContext;\n request: Request;\n reply: Reply;\n}\n\nexport interface HandleRequest {\n (params: HandleRequestParams): Promise<Reply>;\n}\n\nexport const handleRequest: HandleRequest = async params => {\n const { context, request, reply } = params;\n try {\n await checkEndpointAccess(context);\n } catch (ex) {\n return reply.code(401).send({\n data: null,\n error: {\n message: ex.message || \"Not authorized!\",\n code: ex.code || \"SECURITY_NOT_AUTHORIZED\",\n data: ex.data || null,\n stack: null\n }\n });\n }\n\n const getTenant = () => {\n return context.tenancy.getCurrentTenant();\n };\n\n const getLocale = () => {\n return context.cms.getLocale();\n };\n\n const schema = await context.benchmark.measure(\"headlessCms.graphql.getSchema\", async () => {\n try {\n return await getSchema({\n context,\n getTenant,\n getLocale,\n type: context.cms.type as ApiEndpoint\n });\n } catch (ex) {\n console.error(`Error while generating the schema.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n });\n\n const body = await context.benchmark.measure(\n \"headlessCms.graphql.createRequestBody\",\n async () => {\n try {\n return createRequestBody(request.body);\n } catch (ex) {\n console.error(`Error while creating the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n }\n );\n\n /**\n * We need to store the processRequestBody result in a variable and output it after the measurement.\n * Otherwise, the measurement will not be shown in the output.\n */\n let result: ExecutionResult[] | ExecutionResult | null = null;\n\n await context.benchmark.measure(\"headlessCms.graphql.processRequestBody\", async () => {\n try {\n result = await processRequestBody(body, schema, context);\n } catch (ex) {\n console.error(`Error while processing the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n });\n
|
|
1
|
+
{"version":3,"names":["_checkEndpointAccess","require","_createRequestBody","_formatErrorPayload","_getSchema","_handlerGraphql","handleRequest","params","context","request","reply","checkEndpointAccess","ex","code","send","data","error","message","stack","getTenant","tenancy","getCurrentTenant","getLocale","cms","schema","benchmark","measure","getSchema","type","console","formatErrorPayload","body","createRequestBody","result","processRequestBody","sent","warn","exports"],"sources":["handleRequest.ts"],"sourcesContent":["import type { ApiEndpoint, CmsContext } from \"~/types\";\nimport { checkEndpointAccess } from \"./checkEndpointAccess\";\nimport { createRequestBody } from \"./createRequestBody\";\nimport { formatErrorPayload } from \"./formatErrorPayload\";\nimport { getSchema } from \"./getSchema\";\nimport type { Reply, Request } from \"@webiny/handler/types\";\nimport { processRequestBody } from \"@webiny/handler-graphql\";\nimport type { ExecutionResult } from \"graphql\";\n\nexport interface HandleRequestParams {\n context: CmsContext;\n request: Request;\n reply: Reply;\n}\n\nexport interface HandleRequest {\n (params: HandleRequestParams): Promise<Reply>;\n}\n\nexport const handleRequest: HandleRequest = async params => {\n const { context, request, reply } = params;\n try {\n await checkEndpointAccess(context);\n } catch (ex) {\n return reply.code(401).send({\n data: null,\n error: {\n message: ex.message || \"Not authorized!\",\n code: ex.code || \"SECURITY_NOT_AUTHORIZED\",\n data: ex.data || null,\n stack: null\n }\n });\n }\n\n const getTenant = () => {\n return context.tenancy.getCurrentTenant();\n };\n\n const getLocale = () => {\n return context.cms.getLocale();\n };\n\n const schema = await context.benchmark.measure(\"headlessCms.graphql.getSchema\", async () => {\n try {\n return await getSchema({\n context,\n getTenant,\n getLocale,\n type: context.cms.type as ApiEndpoint\n });\n } catch (ex) {\n console.error(`Error while generating the schema.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n });\n\n const body = await context.benchmark.measure(\n \"headlessCms.graphql.createRequestBody\",\n async () => {\n try {\n return createRequestBody(request.body);\n } catch (ex) {\n console.error(`Error while creating the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n }\n );\n\n /**\n * We need to store the processRequestBody result in a variable and output it after the measurement.\n * Otherwise, the measurement will not be shown in the output.\n */\n let result: ExecutionResult[] | ExecutionResult | null = null;\n\n await context.benchmark.measure(\"headlessCms.graphql.processRequestBody\", async () => {\n try {\n result = await processRequestBody(body, schema, context);\n } catch (ex) {\n console.error(`Error while processing the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n });\n /**\n * IMPORTANT! Do not send anything if reply was already sent.\n */\n if (reply.sent) {\n console.warn(\"Reply already sent, cannot send the result (api-headless-cms).\");\n return reply;\n }\n\n return reply.send(result);\n};\n"],"mappings":";;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,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,EAAE,CAAC,CAAC;MACrC,MAAMA,EAAE;IACZ;EACJ,CAAC,CAAC;EAEF,MAAMmB,IAAI,GAAG,MAAMvB,OAAO,CAACiB,SAAS,CAACC,OAAO,CACxC,uCAAuC,EACvC,YAAY;IACR,IAAI;MACA,OAAO,IAAAM,oCAAiB,EAACvB,OAAO,CAACsB,IAAI,CAAC;IAC1C,CAAC,CAAC,OAAOnB,EAAE,EAAE;MACTiB,OAAO,CAACb,KAAK,CAAC,wCAAwC,CAAC;MACvDa,OAAO,CAACb,KAAK,CAAC,IAAAc,sCAAkB,EAAClB,EAAE,CAAC,CAAC;MACrC,MAAMA,EAAE;IACZ;EACJ,CACJ,CAAC;;EAED;AACJ;AACA;AACA;EACI,IAAIqB,MAAkD,GAAG,IAAI;EAE7D,MAAMzB,OAAO,CAACiB,SAAS,CAACC,OAAO,CAAC,wCAAwC,EAAE,YAAY;IAClF,IAAI;MACAO,MAAM,GAAG,MAAM,IAAAC,kCAAkB,EAACH,IAAI,EAAEP,MAAM,EAAEhB,OAAO,CAAC;IAC5D,CAAC,CAAC,OAAOI,EAAE,EAAE;MACTiB,OAAO,CAACb,KAAK,CAAC,0CAA0C,CAAC;MACzDa,OAAO,CAACb,KAAK,CAAC,IAAAc,sCAAkB,EAAClB,EAAE,CAAC,CAAC;MACrC,MAAMA,EAAE;IACZ;EACJ,CAAC,CAAC;EACF;AACJ;AACA;EACI,IAAIF,KAAK,CAACyB,IAAI,EAAE;IACZN,OAAO,CAACO,IAAI,CAAC,gEAAgE,CAAC;IAC9E,OAAO1B,KAAK;EAChB;EAEA,OAAOA,KAAK,CAACI,IAAI,CAACmB,MAAM,CAAC;AAC7B,CAAC;AAACI,OAAA,CAAA/B,aAAA,GAAAA,aAAA","ignoreList":[]}
|
package/graphql/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import type { Plugin } from "@webiny/plugins/types";
|
|
2
|
+
import type { GraphQLHandlerFactoryParams } from "./graphQLHandlerFactory";
|
|
3
|
+
export type CreateGraphQLParams = GraphQLHandlerFactoryParams;
|
|
4
|
+
export declare const createGraphQL: (params: CreateGraphQLParams) => Plugin[];
|
package/graphql/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var _system = require("./system");
|
|
|
8
8
|
var _graphQLHandlerFactory = require("./graphQLHandlerFactory");
|
|
9
9
|
var _baseSchema = require("./schema/baseSchema");
|
|
10
10
|
const createGraphQL = params => {
|
|
11
|
-
return [(0, _baseSchema.createBaseSchema)(), (0, _system.createSystemSchemaPlugin)(), (0, _graphQLHandlerFactory.graphQLHandlerFactory)(params)];
|
|
11
|
+
return [(0, _baseSchema.createBaseSchema)(), (0, _system.createSystemSchemaPlugin)(), ...(0, _graphQLHandlerFactory.graphQLHandlerFactory)(params)];
|
|
12
12
|
};
|
|
13
13
|
exports.createGraphQL = createGraphQL;
|
|
14
14
|
|
package/graphql/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_system","require","_graphQLHandlerFactory","_baseSchema","createGraphQL","params","createBaseSchema","createSystemSchemaPlugin","graphQLHandlerFactory","exports"],"sources":["index.ts"],"sourcesContent":["import { createSystemSchemaPlugin } from \"./system\";\nimport { graphQLHandlerFactory
|
|
1
|
+
{"version":3,"names":["_system","require","_graphQLHandlerFactory","_baseSchema","createGraphQL","params","createBaseSchema","createSystemSchemaPlugin","graphQLHandlerFactory","exports"],"sources":["index.ts"],"sourcesContent":["import type { Plugin } from \"@webiny/plugins/types\";\nimport { createSystemSchemaPlugin } from \"./system\";\nimport type { GraphQLHandlerFactoryParams } from \"./graphQLHandlerFactory\";\nimport { graphQLHandlerFactory } from \"./graphQLHandlerFactory\";\nimport { createBaseSchema } from \"~/graphql/schema/baseSchema\";\n\nexport type CreateGraphQLParams = GraphQLHandlerFactoryParams;\nexport const createGraphQL = (params: CreateGraphQLParams): Plugin[] => {\n return [createBaseSchema(), createSystemSchemaPlugin(), ...graphQLHandlerFactory(params)];\n};\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAGO,MAAMG,aAAa,GAAIC,MAA2B,IAAe;EACpE,OAAO,CAAC,IAAAC,4BAAgB,EAAC,CAAC,EAAE,IAAAC,gCAAwB,EAAC,CAAC,EAAE,GAAG,IAAAC,4CAAqB,EAACH,MAAM,CAAC,CAAC;AAC7F,CAAC;AAACI,OAAA,CAAAL,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RevisionIdScalar = void 0;
|
|
7
|
+
var _graphql = require("graphql");
|
|
8
|
+
var _utils = require("@webiny/utils");
|
|
9
|
+
const RevisionIdScalar = exports.RevisionIdScalar = new _graphql.GraphQLScalarType({
|
|
10
|
+
name: "RevisionId",
|
|
11
|
+
description: "A Headless CMS Reference field input type.",
|
|
12
|
+
parseValue: value => {
|
|
13
|
+
if (!value) {
|
|
14
|
+
return null;
|
|
15
|
+
} else if (typeof value !== "string") {
|
|
16
|
+
throw new Error("RevisionId value must be a string!");
|
|
17
|
+
}
|
|
18
|
+
const result = (0, _utils.parseIdentifier)(value);
|
|
19
|
+
if (!result.version) {
|
|
20
|
+
throw new Error(`RevisionId value must be a valid Revision ID property! Example: "abcdef#0001"`);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=RevisionId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_graphql","require","_utils","RevisionIdScalar","exports","GraphQLScalarType","name","description","parseValue","value","Error","result","parseIdentifier","version"],"sources":["RevisionId.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const RevisionIdScalar = new GraphQLScalarType({\n name: \"RevisionId\",\n description: \"A Headless CMS Reference field input type.\",\n parseValue: value => {\n if (!value) {\n return null;\n } else if (typeof value !== \"string\") {\n throw new Error(\"RevisionId value must be a string!\");\n }\n\n const result = parseIdentifier(value);\n if (!result.version) {\n throw new Error(\n `RevisionId value must be a valid Revision ID property! Example: \"abcdef#0001\"`\n );\n }\n return value;\n }\n});\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAIE,0BAAiB,CAAC;EAClDC,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,4CAA4C;EACzDC,UAAU,EAAEC,KAAK,IAAI;IACjB,IAAI,CAACA,KAAK,EAAE;MACR,OAAO,IAAI;IACf,CAAC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAClC,MAAM,IAAIC,KAAK,CAAC,oCAAoC,CAAC;IACzD;IAEA,MAAMC,MAAM,GAAG,IAAAC,sBAAe,EAACH,KAAK,CAAC;IACrC,IAAI,CAACE,MAAM,CAACE,OAAO,EAAE;MACjB,MAAM,IAAIH,KAAK,CACX,+EACJ,CAAC;IACL;IACA,OAAOD,KAAK;EAChB;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createRevisionIdScalarPlugin = void 0;
|
|
7
|
+
var _RevisionId = require("./RevisionId");
|
|
8
|
+
const createRevisionIdScalarPlugin = () => {
|
|
9
|
+
const plugin = {
|
|
10
|
+
name: "headlessCms.graphql.revisionIdScalar",
|
|
11
|
+
type: "graphql-scalar",
|
|
12
|
+
scalar: _RevisionId.RevisionIdScalar
|
|
13
|
+
};
|
|
14
|
+
return [plugin];
|
|
15
|
+
};
|
|
16
|
+
exports.createRevisionIdScalarPlugin = createRevisionIdScalarPlugin;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=RevisionIdScalarPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_RevisionId","require","createRevisionIdScalarPlugin","plugin","name","type","scalar","RevisionIdScalar","exports"],"sources":["RevisionIdScalarPlugin.ts"],"sourcesContent":["import type { GraphQLScalarPlugin } from \"@webiny/handler-graphql/types\";\nimport { RevisionIdScalar } from \"~/graphql/scalars/RevisionId\";\n\nexport const createRevisionIdScalarPlugin = (): GraphQLScalarPlugin[] => {\n const plugin: GraphQLScalarPlugin = {\n name: \"headlessCms.graphql.revisionIdScalar\",\n type: \"graphql-scalar\",\n scalar: RevisionIdScalar\n };\n return [plugin];\n};\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,4BAA4B,GAAGA,CAAA,KAA6B;EACrE,MAAMC,MAA2B,GAAG;IAChCC,IAAI,EAAE,sCAAsC;IAC5CC,IAAI,EAAE,gBAAgB;IACtBC,MAAM,EAAEC;EACZ,CAAC;EACD,OAAO,CAACJ,MAAM,CAAC;AACnB,CAAC;AAACK,OAAA,CAAAN,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CmsContext } from "../../types";
|
|
2
|
-
import {
|
|
1
|
+
import type { CmsContext } from "../../types";
|
|
2
|
+
import type { ICmsGraphQLSchemaPlugin } from "../../plugins";
|
|
3
3
|
interface Params {
|
|
4
4
|
context: CmsContext;
|
|
5
5
|
}
|
|
6
|
-
export declare const createBaseContentSchema: ({ context }: Params) =>
|
|
6
|
+
export declare const createBaseContentSchema: ({ context }: Params) => ICmsGraphQLSchemaPlugin;
|
|
7
7
|
export {};
|
|
@@ -10,7 +10,7 @@ const createBaseContentSchema = ({
|
|
|
10
10
|
context
|
|
11
11
|
}) => {
|
|
12
12
|
const scalars = context.plugins.byType("graphql-scalar").map(item => item.scalar);
|
|
13
|
-
const plugin =
|
|
13
|
+
const plugin = (0, _plugins.createCmsGraphQLSchemaPlugin)({
|
|
14
14
|
typeDefs: /* GraphQL */`
|
|
15
15
|
${scalars.map(scalar => `scalar ${scalar.name}`).join(" ")}
|
|
16
16
|
scalar JSON
|
|
@@ -29,12 +29,6 @@ const createBaseContentSchema = ({
|
|
|
29
29
|
_empty: String
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
type CmsIdentity {
|
|
33
|
-
id: String
|
|
34
|
-
displayName: String
|
|
35
|
-
type: String
|
|
36
|
-
}
|
|
37
|
-
|
|
38
32
|
enum CmsEntryStatusType {
|
|
39
33
|
latest
|
|
40
34
|
published
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_builtInTypes","require","_plugins","createBaseContentSchema","context","scalars","plugins","byType","map","item","scalar","plugin","
|
|
1
|
+
{"version":3,"names":["_builtInTypes","require","_plugins","createBaseContentSchema","context","scalars","plugins","byType","map","item","scalar","plugin","createCmsGraphQLSchemaPlugin","typeDefs","name","join","resolvers","reduce","acc","s","JSON","JsonScalar","Long","LongScalar","RefInput","RefInputScalar","Number","NumberScalar","Any","AnyScalar","DateTime","DateTimeScalar","DateTimeZ","DateTimeZScalar","Date","DateScalar","Time","TimeScalar","Mutation","_empty","exports"],"sources":["baseContentSchema.ts"],"sourcesContent":["import type { GraphQLScalarPlugin } from \"@webiny/handler-graphql/types\";\nimport type { CmsContext } from \"~/types\";\nimport {\n AnyScalar,\n DateScalar,\n DateTimeScalar,\n DateTimeZScalar,\n JsonScalar,\n LongScalar,\n NumberScalar,\n RefInputScalar,\n TimeScalar\n} from \"@webiny/handler-graphql/builtInTypes\";\nimport type { GraphQLScalarType } from \"graphql\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins\";\n\ninterface Params {\n context: CmsContext;\n}\n\nexport const createBaseContentSchema = ({ context }: Params): ICmsGraphQLSchemaPlugin => {\n const scalars = context.plugins\n .byType<GraphQLScalarPlugin>(\"graphql-scalar\")\n .map(item => item.scalar);\n\n const plugin = createCmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n ${scalars.map(scalar => `scalar ${scalar.name}`).join(\" \")}\n scalar JSON\n scalar Long\n scalar RefInput\n scalar Number\n scalar Any\n scalar Date\n scalar DateTime\n scalar DateTimeZ\n scalar Time\n\n type Query\n\n type Mutation {\n _empty: String\n }\n\n enum CmsEntryStatusType {\n latest\n published\n }\n `,\n resolvers: {\n ...scalars.reduce<Record<string, GraphQLScalarType>>((acc, s) => {\n acc[s.name] = s;\n return acc;\n }, {}),\n JSON: JsonScalar,\n Long: LongScalar,\n RefInput: RefInputScalar,\n Number: NumberScalar,\n Any: AnyScalar,\n DateTime: DateTimeScalar,\n DateTimeZ: DateTimeZScalar,\n Date: DateScalar,\n Time: TimeScalar,\n Mutation: {\n _empty: () => \"_empty\"\n }\n }\n });\n plugin.name = `headless-cms.graphql.schema.baseContentSchema`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AAaA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,uBAAuB,GAAGA,CAAC;EAAEC;AAAgB,CAAC,KAA8B;EACrF,MAAMC,OAAO,GAAGD,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAsB,gBAAgB,CAAC,CAC7CC,GAAG,CAACC,IAAI,IAAIA,IAAI,CAACC,MAAM,CAAC;EAE7B,MAAMC,MAAM,GAAG,IAAAC,qCAA4B,EAAC;IACxCC,QAAQ,EAAE,aAAc;AAChC,cAAcR,OAAO,CAACG,GAAG,CAACE,MAAM,IAAI,UAAUA,MAAM,CAACI,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;IACDC,SAAS,EAAE;MACP,GAAGX,OAAO,CAACY,MAAM,CAAoC,CAACC,GAAG,EAAEC,CAAC,KAAK;QAC7DD,GAAG,CAACC,CAAC,CAACL,IAAI,CAAC,GAAGK,CAAC;QACf,OAAOD,GAAG;MACd,CAAC,EAAE,CAAC,CAAC,CAAC;MACNE,IAAI,EAAEC,wBAAU;MAChBC,IAAI,EAAEC,wBAAU;MAChBC,QAAQ,EAAEC,4BAAc;MACxBC,MAAM,EAAEC,0BAAY;MACpBC,GAAG,EAAEC,uBAAS;MACdC,QAAQ,EAAEC,4BAAc;MACxBC,SAAS,EAAEC,6BAAe;MAC1BC,IAAI,EAAEC,wBAAU;MAChBC,IAAI,EAAEC,wBAAU;MAChBC,QAAQ,EAAE;QACNC,MAAM,EAAEA,CAAA,KAAM;MAClB;IACJ;EACJ,CAAC,CAAC;EACF5B,MAAM,CAACG,IAAI,GAAG,+CAA+C;EAE7D,OAAOH,MAAM;AACjB,CAAC;AAAC6B,OAAA,CAAArC,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -21,17 +21,22 @@ const createSkipValidatorEnum = plugins => {
|
|
|
21
21
|
if (validators.length === 0) {
|
|
22
22
|
validators.push("_empty");
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return /* GraphQL */`
|
|
25
25
|
enum SkipValidatorEnum {
|
|
26
|
-
|
|
26
|
+
${validators.join("\n")}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
);
|
|
28
|
+
`;
|
|
30
29
|
};
|
|
31
30
|
const createSchema = plugins => {
|
|
32
31
|
const skipValidatorEnum = createSkipValidatorEnum(plugins);
|
|
33
|
-
const cmsPlugin =
|
|
32
|
+
const cmsPlugin = (0, _plugins.createCmsGraphQLSchemaPlugin)({
|
|
34
33
|
typeDefs: /* GraphQL */`
|
|
34
|
+
type CmsIdentity {
|
|
35
|
+
id: String
|
|
36
|
+
displayName: String
|
|
37
|
+
type: String
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
type CmsError {
|
|
36
41
|
code: String
|
|
37
42
|
message: String
|
|
@@ -54,6 +59,8 @@ const createSchema = plugins => {
|
|
|
54
59
|
# force delete an entry that might have some records left behind in the database
|
|
55
60
|
# see CmsDeleteEntryOptions in types.ts
|
|
56
61
|
force: Boolean
|
|
62
|
+
# permanently delete an entry without moving it to the bin
|
|
63
|
+
permanently: Boolean
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
type CmsDeleteResponse {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","_handlerGraphql","_api","_camelCase","_interopRequireDefault","createSkipValidatorEnum","plugins","validators","byType","reduce","collection","validator","name","camelCase","includes","push","length","join","createSchema","skipValidatorEnum","cmsPlugin","
|
|
1
|
+
{"version":3,"names":["_plugins","require","_handlerGraphql","_api","_camelCase","_interopRequireDefault","createSkipValidatorEnum","plugins","validators","byType","reduce","collection","validator","name","camelCase","includes","push","length","join","createSchema","skipValidatorEnum","cmsPlugin","createCmsGraphQLSchemaPlugin","typeDefs","resolvers","corePlugin","GraphQLSchemaPlugin","schema","createBaseSchema","ContextPlugin","context","register","exports"],"sources":["baseSchema.ts"],"sourcesContent":["import type { CmsContext, CmsModelFieldValidatorPlugin } from \"~/types\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport camelCase from \"lodash/camelCase\";\n\nconst createSkipValidatorEnum = (plugins: PluginsContainer) => {\n const validators = plugins\n .byType<CmsModelFieldValidatorPlugin>(\"cms-model-field-validator\")\n .reduce<string[]>((collection, validator) => {\n const name = camelCase(validator.validator.name);\n if (collection.includes(name)) {\n return collection;\n }\n collection.push(name);\n return collection;\n }, []);\n\n if (validators.length === 0) {\n validators.push(\"_empty\");\n }\n return /* GraphQL */ `\n enum SkipValidatorEnum {\n ${validators.join(\"\\n\")}\n }\n `;\n};\n\nconst createSchema = (plugins: PluginsContainer): IGraphQLSchemaPlugin<CmsContext>[] => {\n const skipValidatorEnum = createSkipValidatorEnum(plugins);\n\n const cmsPlugin = createCmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type CmsIdentity {\n id: String\n displayName: String\n type: String\n }\n\n type CmsError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type CmsCursors {\n next: String\n previous: String\n }\n\n type CmsListMeta {\n cursor: String\n hasMoreItems: Boolean\n totalCount: Int\n }\n\n input CmsDeleteEntryOptions {\n # force delete an entry that might have some records left behind in the database\n # see CmsDeleteEntryOptions in types.ts\n force: Boolean\n # permanently delete an entry without moving it to the bin\n permanently: Boolean\n }\n\n type CmsDeleteResponse {\n data: Boolean\n error: CmsError\n }\n\n type CmsDeleteMultipleDataResponse {\n id: ID!\n }\n\n type CmsDeleteMultipleResponse {\n data: [CmsDeleteMultipleDataResponse!]\n error: CmsError\n }\n\n type CmsBooleanResponse {\n data: Boolean\n error: CmsError\n }\n\n # Advanced Content Organization\n type WbyAcoLocation {\n folderId: ID\n }\n\n input WbyAcoLocationInput {\n folderId: ID!\n }\n\n input WbyAcoLocationWhereInput {\n folderId: ID\n folderId_in: [ID!]\n folderId_not: ID\n folderId_not_in: [ID!]\n }\n\n ${skipValidatorEnum}\n\n input CreateCmsEntryOptionsInput {\n skipValidators: [SkipValidatorEnum!]\n }\n\n input CreateRevisionCmsEntryOptionsInput {\n skipValidators: [SkipValidatorEnum!]\n }\n\n input UpdateCmsEntryOptionsInput {\n skipValidators: [SkipValidatorEnum!]\n }\n\n input CmsIdentityInput {\n id: String!\n displayName: String!\n type: String!\n }\n\n type CmsEntryValidationResponseData {\n error: String!\n id: String!\n fieldId: String!\n parents: [String!]!\n }\n\n type CmsEntryValidationResponse {\n data: [CmsEntryValidationResponseData!]\n error: CmsError\n }\n `,\n resolvers: {}\n });\n cmsPlugin.name = \"headless-cms.graphql.schema.base\";\n const corePlugin = new GraphQLSchemaPlugin<CmsContext>({\n typeDefs: cmsPlugin.schema.typeDefs,\n resolvers: cmsPlugin.schema.resolvers\n });\n corePlugin.name = \"headless-cms.graphql.core.schema.base\";\n /**\n * Due to splitting of CMS and Core schema plugins, we must have both defined for CMS to work.\n */\n return [cmsPlugin, corePlugin];\n};\n\nexport const createBaseSchema = () => {\n return new ContextPlugin(async context => {\n context.plugins.register(...createSchema(context.plugins));\n });\n};\n"],"mappings":";;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,MAAMK,uBAAuB,GAAIC,OAAyB,IAAK;EAC3D,MAAMC,UAAU,GAAGD,OAAO,CACrBE,MAAM,CAA+B,2BAA2B,CAAC,CACjEC,MAAM,CAAW,CAACC,UAAU,EAAEC,SAAS,KAAK;IACzC,MAAMC,IAAI,GAAG,IAAAC,kBAAS,EAACF,SAAS,CAACA,SAAS,CAACC,IAAI,CAAC;IAChD,IAAIF,UAAU,CAACI,QAAQ,CAACF,IAAI,CAAC,EAAE;MAC3B,OAAOF,UAAU;IACrB;IACAA,UAAU,CAACK,IAAI,CAACH,IAAI,CAAC;IACrB,OAAOF,UAAU;EACrB,CAAC,EAAE,EAAE,CAAC;EAEV,IAAIH,UAAU,CAACS,MAAM,KAAK,CAAC,EAAE;IACzBT,UAAU,CAACQ,IAAI,CAAC,QAAQ,CAAC;EAC7B;EACA,OAAO,aAAc;AACzB;AACA,aAAaR,UAAU,CAACU,IAAI,CAAC,IAAI,CAAC;AAClC;AACA,KAAK;AACL,CAAC;AAED,MAAMC,YAAY,GAAIZ,OAAyB,IAAyC;EACpF,MAAMa,iBAAiB,GAAGd,uBAAuB,CAACC,OAAO,CAAC;EAE1D,MAAMc,SAAS,GAAG,IAAAC,qCAA4B,EAAC;IAC3CC,QAAQ,EAAE,aAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcH,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;IACDI,SAAS,EAAE,CAAC;EAChB,CAAC,CAAC;EACFH,SAAS,CAACR,IAAI,GAAG,kCAAkC;EACnD,MAAMY,UAAU,GAAG,IAAIC,mCAAmB,CAAa;IACnDH,QAAQ,EAAEF,SAAS,CAACM,MAAM,CAACJ,QAAQ;IACnCC,SAAS,EAAEH,SAAS,CAACM,MAAM,CAACH;EAChC,CAAC,CAAC;EACFC,UAAU,CAACZ,IAAI,GAAG,uCAAuC;EACzD;AACJ;AACA;EACI,OAAO,CAACQ,SAAS,EAAEI,UAAU,CAAC;AAClC,CAAC;AAEM,MAAMG,gBAAgB,GAAGA,CAAA,KAAM;EAClC,OAAO,IAAIC,kBAAa,CAAC,MAAMC,OAAO,IAAI;IACtCA,OAAO,CAACvB,OAAO,CAACwB,QAAQ,CAAC,GAAGZ,YAAY,CAACW,OAAO,CAACvB,OAAO,CAAC,CAAC;EAC9D,CAAC,CAAC;AACN,CAAC;AAACyB,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CmsContext } from "../../types";
|
|
2
|
-
import {
|
|
1
|
+
import type { CmsContext } from "../../types";
|
|
2
|
+
import type { ICmsGraphQLSchemaPlugin } from "../../plugins";
|
|
3
3
|
interface Params {
|
|
4
4
|
context: CmsContext;
|
|
5
5
|
}
|
|
6
|
-
export declare const createContentEntriesSchema: ({ context }: Params) =>
|
|
6
|
+
export declare const createContentEntriesSchema: ({ context }: Params) => ICmsGraphQLSchemaPlugin<CmsContext>;
|
|
7
7
|
export {};
|
|
@@ -210,7 +210,7 @@ const createContentEntriesSchema = ({
|
|
|
210
210
|
context
|
|
211
211
|
}) => {
|
|
212
212
|
if (!context.cms.MANAGE) {
|
|
213
|
-
const plugin =
|
|
213
|
+
const plugin = (0, _plugins.createCmsGraphQLSchemaPlugin)({
|
|
214
214
|
typeDefs: "",
|
|
215
215
|
resolvers: {}
|
|
216
216
|
});
|
|
@@ -218,11 +218,10 @@ const createContentEntriesSchema = ({
|
|
|
218
218
|
return plugin;
|
|
219
219
|
}
|
|
220
220
|
const onByMetaFields = _constants.ENTRY_META_FIELDS.map(field => {
|
|
221
|
-
const isNullable = (0, _constants.isNullableEntryMetaField)(field) ? "" : "!";
|
|
222
221
|
const fieldType = (0, _constants.isDateTimeEntryMetaField)(field) ? "DateTime" : "CmsIdentity";
|
|
223
|
-
return `${field}: ${fieldType}
|
|
222
|
+
return `${field}: ${fieldType}`;
|
|
224
223
|
}).join("\n");
|
|
225
|
-
const plugin =
|
|
224
|
+
const plugin = (0, _plugins.createCmsGraphQLSchemaPlugin)({
|
|
226
225
|
// Had to remove /* GraphQL */ because prettier would not format the code correctly.
|
|
227
226
|
typeDefs: `
|
|
228
227
|
type CmsModelMeta {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_handlerGraphql","_apiSecurity","_getEntryTitle","_plugins","_getEntryDescription","_getEntryImage","_entryStorage","_constants","createDate","date","Date","createCmsEntryRecord","model","entry","id","entryId","modelId","name","status","title","getEntryTitle","description","getEntryDescription","image","getEntryImage","createdOn","modifiedOn","savedOn","createdBy","savedBy","modifiedBy","firstPublishedOn","lastPublishedOn","firstPublishedBy","lastPublishedBy","revisionCreatedOn","revisionSavedOn","revisionModifiedOn","revisionCreatedBy","revisionModifiedBy","revisionSavedBy","revisionFirstPublishedOn","revisionLastPublishedOn","revisionFirstPublishedBy","revisionLastPublishedBy","wbyAco_location","folderId","location","getFetchMethod","type","context","getContentEntriesMethods","WebinyError","methodName","cms","GetContentEntryMethods","latest","published","exact","getContentEntries","params","args","method","models","listModels","modelsMap","reduce","collection","argsEntries","entries","entriesByModel","ref","includes","push","getters","Object","keys","map","length","Response","results","Promise","all","items","concat","item","filter","Boolean","ex","ErrorResponse","getContentEntry","find","m","NotAuthorizedResponse","data","result","shift","createResolveDescription","parent","_","field","fields","f","fieldId","descriptionFieldId","value","entryFieldFromStorageTransform","createContentEntriesSchema","MANAGE","plugin","CmsGraphQLSchemaPlugin","typeDefs","resolvers","onByMetaFields","ENTRY_META_FIELDS","isNullable","isNullableEntryMetaField","fieldType","isDateTimeEntryMetaField","join","CmsContentEntry","getPublishedEntriesByIds","CmsPublishedContentEntry","Query","searchContentEntries","modelIds","query","limit","modelManager","getEntryManager","where","listLatest","search","undefined","then","sort","a","b","getTime","slice","getLatestContentEntry","getPublishedContentEntry","getLatestContentEntries","getPublishedContentEntries","exports"],"sources":["contentEntries.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql\";\nimport { CmsContext, CmsEntry, CmsEntryListWhere, CmsIdentity, CmsModel } from \"~/types\";\nimport { NotAuthorizedResponse } from \"@webiny/api-security\";\nimport { getEntryTitle } from \"~/utils/getEntryTitle\";\nimport { CmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { getEntryDescription } from \"~/utils/getEntryDescription\";\nimport { getEntryImage } from \"~/utils/getEntryImage\";\nimport { entryFieldFromStorageTransform } from \"~/utils/entryStorage\";\nimport { Resolvers } from \"@webiny/handler-graphql/types\";\nimport { ENTRY_META_FIELDS, isNullableEntryMetaField, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface EntriesByModel {\n [key: string]: string[];\n}\n\ntype GetContentEntryType = \"latest\" | \"published\" | \"exact\";\n\nconst createDate = (date: string | null): Date | null => {\n if (!date) {\n return null;\n }\n\n try {\n return new Date(date);\n } catch {\n return new Date();\n }\n};\n\ninterface CmsEntryRecord {\n id: string;\n entryId: string;\n model: {\n modelId: string;\n name: string;\n };\n status: string;\n title: string;\n description?: string | null;\n image?: string | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: Date;\n modifiedOn: Date | null;\n savedOn: Date;\n createdBy: CmsIdentity;\n modifiedBy: CmsIdentity | null;\n savedBy: CmsIdentity;\n firstPublishedOn: Date | null;\n lastPublishedOn: Date | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: Date;\n revisionModifiedOn: Date | null;\n revisionSavedOn: Date;\n revisionCreatedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity | null;\n revisionSavedBy: CmsIdentity;\n revisionFirstPublishedOn: Date | null;\n revisionLastPublishedOn: Date | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedBy: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n}\n\nconst createCmsEntryRecord = (model: CmsModel, entry: CmsEntry): CmsEntryRecord => {\n return {\n id: entry.id,\n entryId: entry.entryId,\n model: {\n modelId: model.modelId,\n name: model.name\n },\n status: entry.status,\n title: getEntryTitle(model, entry),\n description: getEntryDescription(model, entry),\n image: getEntryImage(model, entry),\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: createDate(entry.createdOn)!,\n modifiedOn: createDate(entry.modifiedOn),\n savedOn: createDate(entry.savedOn)!,\n createdBy: entry.createdBy,\n savedBy: entry.savedBy,\n modifiedBy: entry.modifiedBy,\n firstPublishedOn: createDate(entry.firstPublishedOn),\n lastPublishedOn: createDate(entry.lastPublishedOn),\n firstPublishedBy: entry.firstPublishedBy,\n lastPublishedBy: entry.lastPublishedBy,\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: createDate(entry.revisionCreatedOn)!,\n revisionSavedOn: createDate(entry.revisionSavedOn)!,\n revisionModifiedOn: createDate(entry.revisionModifiedOn),\n revisionCreatedBy: entry.revisionCreatedBy,\n revisionModifiedBy: entry.revisionModifiedBy,\n revisionSavedBy: entry.revisionSavedBy,\n revisionFirstPublishedOn: createDate(entry.revisionFirstPublishedOn),\n revisionLastPublishedOn: createDate(entry.revisionLastPublishedOn),\n revisionFirstPublishedBy: entry.revisionFirstPublishedBy,\n revisionLastPublishedBy: entry.revisionLastPublishedBy,\n\n wbyAco_location: {\n folderId: entry.location?.folderId || null\n }\n };\n};\n\ninterface FetchMethod {\n (model: CmsModel, ids: string[]): Promise<CmsEntry[]>;\n}\n\nconst getFetchMethod = (type: GetContentEntryType, context: CmsContext): FetchMethod => {\n if (!getContentEntriesMethods[type]) {\n throw new WebinyError(\n `Unknown getContentEntries method \"${type}\". Could not fetch content entries.`,\n \"UNKNOWN_METHOD_ERROR\",\n {\n type\n }\n );\n }\n const methodName = getContentEntriesMethods[type] as GetContentEntryMethods;\n if (!context.cms[methodName]) {\n throw new WebinyError(\n `Unknown context.cms method \"${methodName}\". Could not fetch content entries.`,\n \"UNKNOWN_METHOD_ERROR\",\n {\n type,\n methodName\n }\n );\n }\n\n return context.cms[methodName];\n};\n\n/**\n * Function to get the list of content entries depending on latest, published or exact GraphQL queries.\n */\ninterface GetContentEntriesParams {\n args: {\n entries: Pick<CmsEntry, \"id\" | \"modelId\">[];\n };\n context: CmsContext;\n type: GetContentEntryType;\n}\n\nenum GetContentEntryMethods {\n getLatestEntriesByIds = \"getLatestEntriesByIds\",\n getPublishedEntriesByIds = \"getPublishedEntriesByIds\",\n getEntriesByIds = \"getEntriesByIds\"\n}\n\nconst getContentEntriesMethods = {\n latest: \"getLatestEntriesByIds\",\n published: \"getPublishedEntriesByIds\",\n exact: \"getEntriesByIds\"\n};\nconst getContentEntries = async (\n params: GetContentEntriesParams\n): Promise<Response | ErrorResponse> => {\n const { args, context, type } = params;\n\n const method = getFetchMethod(type, context);\n\n const models = await context.cms.listModels();\n\n const modelsMap = models.reduce((collection, model) => {\n collection[model.modelId] = model;\n return collection;\n }, {} as Record<string, CmsModel>);\n\n const argsEntries = args.entries as Pick<CmsEntry, \"id\" | \"modelId\">[];\n\n const entriesByModel = argsEntries.reduce((collection, ref) => {\n if (!collection[ref.modelId]) {\n collection[ref.modelId] = [];\n } else if (collection[ref.modelId].includes(ref.id)) {\n return collection;\n }\n collection[ref.modelId].push(ref.id);\n return collection;\n }, {} as EntriesByModel);\n\n const getters: Promise<CmsEntry[]>[] = Object.keys(entriesByModel).map(async modelId => {\n return method(modelsMap[modelId], entriesByModel[modelId]);\n });\n\n if (getters.length === 0) {\n return new Response([]);\n }\n\n try {\n const results = await Promise.all(getters);\n\n const entries = results\n .reduce<CmsEntryRecord[]>((collection, items) => {\n return collection.concat(\n items.map(item => {\n const model = modelsMap[item.modelId];\n\n return createCmsEntryRecord(model, item);\n })\n );\n }, [])\n .filter(Boolean);\n\n return new Response(entries);\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n};\n\n/**\n * Function to fetch a single content entry depending on latest, published or exact GraphQL query.\n */\ninterface GetContentEntryParams {\n args: {\n entry: Pick<CmsEntry, \"id\" | \"modelId\">;\n };\n context: CmsContext;\n type: \"latest\" | \"published\" | \"exact\";\n}\n\nconst getContentEntry = async (\n params: GetContentEntryParams\n): Promise<Response<CmsEntryRecord | null> | NotAuthorizedResponse> => {\n const { args, context, type } = params;\n if (!getContentEntriesMethods[type]) {\n throw new WebinyError(\n `Unknown getContentEntry method \"${type}\". Could not fetch content entry.`,\n \"UNKNOWN_METHOD_ERROR\",\n {\n args,\n type\n }\n );\n }\n\n const method = getFetchMethod(type, context);\n\n const { modelId, id } = args.entry;\n const models = await context.cms.listModels();\n const model = models.find(m => m.modelId === modelId);\n\n if (!model) {\n return new NotAuthorizedResponse({\n data: {\n modelId\n }\n });\n }\n\n const result = await method(model, [id]);\n\n const entry = result.shift();\n if (!entry) {\n return new Response(null);\n }\n\n return new Response(createCmsEntryRecord(model, entry));\n};\n/**\n * As we support description field, we need to transform the value from storage.\n */\nconst createResolveDescription = (): Resolvers<CmsContext> => {\n return async (parent, _, context) => {\n const models = await context.cms.listModels();\n const model = models.find(({ modelId }) => {\n return parent.model.modelId === modelId;\n });\n if (!model) {\n return null;\n }\n const field = model.fields.find(f => f.fieldId === model.descriptionFieldId);\n if (!field) {\n return null;\n }\n const value = parent.description || parent[field.fieldId];\n if (!value) {\n return null;\n }\n return entryFieldFromStorageTransform({\n context,\n model,\n field,\n value\n });\n };\n};\n\ninterface Params {\n context: CmsContext;\n}\n\nexport const createContentEntriesSchema = ({\n context\n}: Params): CmsGraphQLSchemaPlugin<CmsContext> => {\n if (!context.cms.MANAGE) {\n const plugin = new CmsGraphQLSchemaPlugin({\n typeDefs: \"\",\n resolvers: {}\n });\n plugin.name = `headless-cms.graphql.schema.${context.cms.type}.empty`;\n return plugin;\n }\n\n const onByMetaFields = ENTRY_META_FIELDS.map(field => {\n const isNullable = isNullableEntryMetaField(field) ? \"\" : \"!\";\n const fieldType = isDateTimeEntryMetaField(field) ? \"DateTime\" : \"CmsIdentity\";\n\n return `${field}: ${fieldType}${isNullable}`;\n }).join(\"\\n\");\n\n const plugin = new CmsGraphQLSchemaPlugin({\n // Had to remove /* GraphQL */ because prettier would not format the code correctly.\n typeDefs: `\n type CmsModelMeta {\n modelId: String!\n name: String!\n }\n\n type CmsPublishedContentEntry {\n id: ID!\n entryId: String!\n title: String\n description: String\n image: String\n }\n\n type CmsContentEntry {\n id: ID!\n entryId: String!\n model: CmsModelMeta!\n status: String!\n published: CmsPublishedContentEntry\n title: String!\n description: String\n image: String\n \n ${onByMetaFields}\n \n wbyAco_location: WbyAcoLocation\n }\n\n type CmsContentEntriesResponse {\n data: [CmsContentEntry!]\n error: CmsError\n }\n\n type CmsContentEntryResponse {\n data: CmsContentEntry\n error: CmsError\n }\n\n input CmsModelEntryInput {\n modelId: ID!\n id: ID!\n }\n\n extend type Query {\n # Search content entries for given content models using the query string.\n searchContentEntries(\n modelIds: [ID!]!\n query: String\n fields: [String!]\n limit: Int\n ): CmsContentEntriesResponse!\n\n # Get content entry meta data\n getContentEntry(entry: CmsModelEntryInput!): CmsContentEntryResponse!\n\n getLatestContentEntry(entry: CmsModelEntryInput!): CmsContentEntryResponse!\n getPublishedContentEntry(entry: CmsModelEntryInput!): CmsContentEntryResponse!\n\n # Get content entries meta data\n getContentEntries(entries: [CmsModelEntryInput!]!): CmsContentEntriesResponse!\n getLatestContentEntries(entries: [CmsModelEntryInput!]!): CmsContentEntriesResponse!\n getPublishedContentEntries(\n entries: [CmsModelEntryInput!]!\n ): CmsContentEntriesResponse!\n }\n `,\n resolvers: {\n CmsContentEntry: {\n published: async (parent, _, context) => {\n try {\n const models = await context.cms.listModels();\n const model = models.find(({ modelId }) => {\n return parent.model.modelId === modelId;\n });\n if (!model) {\n return null;\n }\n const [entry] = await context.cms.getPublishedEntriesByIds(model, [\n parent.id\n ]);\n if (!entry) {\n return null;\n }\n return createCmsEntryRecord(model, entry);\n } catch (ex) {\n return null;\n }\n },\n description: createResolveDescription()\n },\n CmsPublishedContentEntry: {\n description: createResolveDescription()\n },\n Query: {\n async searchContentEntries(_, args: any, context) {\n const { modelIds, fields, query, limit = 10 } = args;\n const models = await context.cms.listModels();\n\n const getters = models\n .filter(model => modelIds.includes(model.modelId))\n .map(async model => {\n const modelManager = await context.cms.getEntryManager(model.modelId);\n const where: CmsEntryListWhere = {};\n\n const [items] = await modelManager.listLatest({\n limit,\n where,\n search: !!query ? query : undefined,\n fields: fields || []\n });\n\n return items.map((entry: CmsEntry) => {\n return createCmsEntryRecord(model, entry);\n });\n });\n\n try {\n const entries = await Promise.all(getters).then(results =>\n results.reduce((result, item) => result.concat(item), [])\n );\n\n return new Response(\n entries\n .sort((a, b) => b.savedOn.getTime() - a.savedOn.getTime())\n .slice(0, limit)\n );\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n },\n async getContentEntry(_, args: any, context) {\n return getContentEntry({\n args,\n context,\n type: \"exact\"\n });\n },\n async getLatestContentEntry(_, args: any, context) {\n return getContentEntry({\n args,\n context,\n type: \"latest\"\n });\n },\n async getPublishedContentEntry(_, args: any, context) {\n return getContentEntry({\n args,\n context,\n type: \"published\"\n });\n },\n async getContentEntries(_, args: any, context) {\n return getContentEntries({\n args,\n context,\n type: \"exact\"\n });\n },\n async getLatestContentEntries(_, args: any, context) {\n return getContentEntries({\n args,\n context,\n type: \"latest\"\n });\n },\n async getPublishedContentEntries(_, args: any, context) {\n return getContentEntries({\n args,\n context,\n type: \"published\"\n });\n }\n }\n }\n });\n\n plugin.name = `headless-cms.graphql.schema.${context.cms.type}.content-entries`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAQA,MAAMS,UAAU,GAAIC,IAAmB,IAAkB;EACrD,IAAI,CAACA,IAAI,EAAE;IACP,OAAO,IAAI;EACf;EAEA,IAAI;IACA,OAAO,IAAIC,IAAI,CAACD,IAAI,CAAC;EACzB,CAAC,CAAC,MAA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AS,EAAEX,OAAO,EAAE;UACzC,OAAOwC,eAAe,CAAC;YACnB7B,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAM2F,qBAAqBA,CAACzC,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UAC/C,OAAOwC,eAAe,CAAC;YACnB7B,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAM4F,wBAAwBA,CAAC1C,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UAClD,OAAOwC,eAAe,CAAC;YACnB7B,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAMU,iBAAiBA,CAACwC,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UAC3C,OAAOS,iBAAiB,CAAC;YACrBE,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAM6F,uBAAuBA,CAAC3C,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UACjD,OAAOS,iBAAiB,CAAC;YACrBE,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAM8F,0BAA0BA,CAAC5C,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UACpD,OAAOS,iBAAiB,CAAC;YACrBE,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN;MACJ;IACJ;EACJ,CAAC,CAAC;EAEF4D,MAAM,CAAC5F,IAAI,GAAI,+BAA8BiC,OAAO,CAACI,GAAG,CAACL,IAAK,kBAAiB;EAE/E,OAAO4D,MAAM;AACjB,CAAC;AAACmC,OAAA,CAAArC,0BAAA,GAAAA,0BAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_handlerGraphql","_apiSecurity","_getEntryTitle","_plugins","_getEntryDescription","_getEntryImage","_entryStorage","_constants","createDate","date","Date","createCmsEntryRecord","model","entry","id","entryId","modelId","name","status","title","getEntryTitle","description","getEntryDescription","image","getEntryImage","createdOn","modifiedOn","savedOn","createdBy","savedBy","modifiedBy","firstPublishedOn","lastPublishedOn","firstPublishedBy","lastPublishedBy","revisionCreatedOn","revisionSavedOn","revisionModifiedOn","revisionCreatedBy","revisionModifiedBy","revisionSavedBy","revisionFirstPublishedOn","revisionLastPublishedOn","revisionFirstPublishedBy","revisionLastPublishedBy","wbyAco_location","folderId","location","getFetchMethod","type","context","getContentEntriesMethods","WebinyError","methodName","cms","GetContentEntryMethods","latest","published","exact","getContentEntries","params","args","method","models","listModels","modelsMap","reduce","collection","argsEntries","entries","entriesByModel","ref","includes","push","getters","Object","keys","map","length","Response","results","Promise","all","items","concat","item","filter","Boolean","ex","ErrorResponse","getContentEntry","find","m","NotAuthorizedResponse","data","result","shift","createResolveDescription","parent","_","field","fields","f","fieldId","descriptionFieldId","value","entryFieldFromStorageTransform","createContentEntriesSchema","MANAGE","plugin","createCmsGraphQLSchemaPlugin","typeDefs","resolvers","onByMetaFields","ENTRY_META_FIELDS","fieldType","isDateTimeEntryMetaField","join","CmsContentEntry","getPublishedEntriesByIds","CmsPublishedContentEntry","Query","searchContentEntries","modelIds","query","limit","modelManager","getEntryManager","where","listLatest","search","undefined","then","sort","a","b","getTime","slice","getLatestContentEntry","getPublishedContentEntry","getLatestContentEntries","getPublishedContentEntries","exports"],"sources":["contentEntries.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql\";\nimport type { CmsContext, CmsEntry, CmsEntryListWhere, CmsIdentity, CmsModel } from \"~/types\";\nimport { NotAuthorizedResponse } from \"@webiny/api-security\";\nimport { getEntryTitle } from \"~/utils/getEntryTitle\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { getEntryDescription } from \"~/utils/getEntryDescription\";\nimport { getEntryImage } from \"~/utils/getEntryImage\";\nimport { entryFieldFromStorageTransform } from \"~/utils/entryStorage\";\nimport type { GraphQLFieldResolver } from \"@webiny/handler-graphql/types\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface EntriesByModel {\n [key: string]: string[];\n}\n\ntype GetContentEntryType = \"latest\" | \"published\" | \"exact\";\n\nconst createDate = (date: string | null): Date | null => {\n if (!date) {\n return null;\n }\n\n try {\n return new Date(date);\n } catch {\n return new Date();\n }\n};\n\ninterface CmsEntryRecord {\n id: string;\n entryId: string;\n model: {\n modelId: string;\n name: string;\n };\n status: string;\n title: string;\n description?: string | null;\n image?: string | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: Date;\n modifiedOn: Date | null;\n savedOn: Date;\n createdBy: CmsIdentity;\n modifiedBy: CmsIdentity | null;\n savedBy: CmsIdentity;\n firstPublishedOn: Date | null;\n lastPublishedOn: Date | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: Date;\n revisionModifiedOn: Date | null;\n revisionSavedOn: Date;\n revisionCreatedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity | null;\n revisionSavedBy: CmsIdentity;\n revisionFirstPublishedOn: Date | null;\n revisionLastPublishedOn: Date | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedBy: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n}\n\nconst createCmsEntryRecord = (model: CmsModel, entry: CmsEntry): CmsEntryRecord => {\n return {\n id: entry.id,\n entryId: entry.entryId,\n model: {\n modelId: model.modelId,\n name: model.name\n },\n status: entry.status,\n title: getEntryTitle(model, entry),\n description: getEntryDescription(model, entry),\n image: getEntryImage(model, entry),\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: createDate(entry.createdOn)!,\n modifiedOn: createDate(entry.modifiedOn),\n savedOn: createDate(entry.savedOn)!,\n createdBy: entry.createdBy,\n savedBy: entry.savedBy,\n modifiedBy: entry.modifiedBy,\n firstPublishedOn: createDate(entry.firstPublishedOn),\n lastPublishedOn: createDate(entry.lastPublishedOn),\n firstPublishedBy: entry.firstPublishedBy,\n lastPublishedBy: entry.lastPublishedBy,\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: createDate(entry.revisionCreatedOn)!,\n revisionSavedOn: createDate(entry.revisionSavedOn)!,\n revisionModifiedOn: createDate(entry.revisionModifiedOn),\n revisionCreatedBy: entry.revisionCreatedBy,\n revisionModifiedBy: entry.revisionModifiedBy,\n revisionSavedBy: entry.revisionSavedBy,\n revisionFirstPublishedOn: createDate(entry.revisionFirstPublishedOn),\n revisionLastPublishedOn: createDate(entry.revisionLastPublishedOn),\n revisionFirstPublishedBy: entry.revisionFirstPublishedBy,\n revisionLastPublishedBy: entry.revisionLastPublishedBy,\n\n wbyAco_location: {\n folderId: entry.location?.folderId || null\n }\n };\n};\n\ninterface FetchMethod {\n (model: CmsModel, ids: string[]): Promise<CmsEntry[]>;\n}\n\nconst getFetchMethod = (type: GetContentEntryType, context: CmsContext): FetchMethod => {\n if (!getContentEntriesMethods[type]) {\n throw new WebinyError(\n `Unknown getContentEntries method \"${type}\". Could not fetch content entries.`,\n \"UNKNOWN_METHOD_ERROR\",\n {\n type\n }\n );\n }\n const methodName = getContentEntriesMethods[type] as GetContentEntryMethods;\n if (!context.cms[methodName]) {\n throw new WebinyError(\n `Unknown context.cms method \"${methodName}\". Could not fetch content entries.`,\n \"UNKNOWN_METHOD_ERROR\",\n {\n type,\n methodName\n }\n );\n }\n\n return context.cms[methodName];\n};\n\n/**\n * Function to get the list of content entries depending on latest, published or exact GraphQL queries.\n */\ninterface GetContentEntriesParams {\n args: {\n entries: Pick<CmsEntry, \"id\" | \"modelId\">[];\n };\n context: CmsContext;\n type: GetContentEntryType;\n}\n\nenum GetContentEntryMethods {\n getLatestEntriesByIds = \"getLatestEntriesByIds\",\n getPublishedEntriesByIds = \"getPublishedEntriesByIds\",\n getEntriesByIds = \"getEntriesByIds\"\n}\n\nconst getContentEntriesMethods = {\n latest: \"getLatestEntriesByIds\",\n published: \"getPublishedEntriesByIds\",\n exact: \"getEntriesByIds\"\n};\nconst getContentEntries = async (\n params: GetContentEntriesParams\n): Promise<Response | ErrorResponse> => {\n const { args, context, type } = params;\n\n const method = getFetchMethod(type, context);\n\n const models = await context.cms.listModels();\n\n const modelsMap = models.reduce((collection, model) => {\n collection[model.modelId] = model;\n return collection;\n }, {} as Record<string, CmsModel>);\n\n const argsEntries = args.entries as Pick<CmsEntry, \"id\" | \"modelId\">[];\n\n const entriesByModel = argsEntries.reduce((collection, ref) => {\n if (!collection[ref.modelId]) {\n collection[ref.modelId] = [];\n } else if (collection[ref.modelId].includes(ref.id)) {\n return collection;\n }\n collection[ref.modelId].push(ref.id);\n return collection;\n }, {} as EntriesByModel);\n\n const getters: Promise<CmsEntry[]>[] = Object.keys(entriesByModel).map(async modelId => {\n return method(modelsMap[modelId], entriesByModel[modelId]);\n });\n\n if (getters.length === 0) {\n return new Response([]);\n }\n\n try {\n const results = await Promise.all(getters);\n\n const entries = results\n .reduce<CmsEntryRecord[]>((collection, items) => {\n return collection.concat(\n items.map(item => {\n const model = modelsMap[item.modelId];\n\n return createCmsEntryRecord(model, item);\n })\n );\n }, [])\n .filter(Boolean);\n\n return new Response(entries);\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n};\n\n/**\n * Function to fetch a single content entry depending on latest, published or exact GraphQL query.\n */\ninterface GetContentEntryParams {\n args: {\n entry: Pick<CmsEntry, \"id\" | \"modelId\">;\n };\n context: CmsContext;\n type: \"latest\" | \"published\" | \"exact\";\n}\n\nconst getContentEntry = async (\n params: GetContentEntryParams\n): Promise<Response<CmsEntryRecord | null> | NotAuthorizedResponse> => {\n const { args, context, type } = params;\n if (!getContentEntriesMethods[type]) {\n throw new WebinyError(\n `Unknown getContentEntry method \"${type}\". Could not fetch content entry.`,\n \"UNKNOWN_METHOD_ERROR\",\n {\n args,\n type\n }\n );\n }\n\n const method = getFetchMethod(type, context);\n\n const { modelId, id } = args.entry;\n const models = await context.cms.listModels();\n const model = models.find(m => m.modelId === modelId);\n\n if (!model) {\n return new NotAuthorizedResponse({\n data: {\n modelId\n }\n });\n }\n\n const result = await method(model, [id]);\n\n const entry = result.shift();\n if (!entry) {\n return new Response(null);\n }\n\n return new Response(createCmsEntryRecord(model, entry));\n};\n/**\n * As we support description field, we need to transform the value from storage.\n */\nconst createResolveDescription = (): GraphQLFieldResolver<any, any, CmsContext> => {\n return async (parent, _, context) => {\n const models = await context.cms.listModels();\n const model = models.find(({ modelId }) => {\n return parent.model.modelId === modelId;\n });\n if (!model) {\n return null;\n }\n const field = model.fields.find(f => f.fieldId === model.descriptionFieldId);\n if (!field) {\n return null;\n }\n const value = parent.description || parent[field.fieldId];\n if (!value) {\n return null;\n }\n return entryFieldFromStorageTransform({\n context,\n model,\n field,\n value\n });\n };\n};\n\ninterface Params {\n context: CmsContext;\n}\n\nexport const createContentEntriesSchema = ({\n context\n}: Params): ICmsGraphQLSchemaPlugin<CmsContext> => {\n if (!context.cms.MANAGE) {\n const plugin = createCmsGraphQLSchemaPlugin({\n typeDefs: \"\",\n resolvers: {}\n });\n plugin.name = `headless-cms.graphql.schema.${context.cms.type}.empty`;\n return plugin;\n }\n\n const onByMetaFields = ENTRY_META_FIELDS.map(field => {\n const fieldType = isDateTimeEntryMetaField(field) ? \"DateTime\" : \"CmsIdentity\";\n\n return `${field}: ${fieldType}`;\n }).join(\"\\n\");\n\n const plugin = createCmsGraphQLSchemaPlugin({\n // Had to remove /* GraphQL */ because prettier would not format the code correctly.\n typeDefs: `\n type CmsModelMeta {\n modelId: String!\n name: String!\n }\n\n type CmsPublishedContentEntry {\n id: ID!\n entryId: String!\n title: String\n description: String\n image: String\n }\n\n type CmsContentEntry {\n id: ID!\n entryId: String!\n model: CmsModelMeta!\n status: String!\n published: CmsPublishedContentEntry\n title: String!\n description: String\n image: String\n \n ${onByMetaFields}\n \n wbyAco_location: WbyAcoLocation\n }\n\n type CmsContentEntriesResponse {\n data: [CmsContentEntry!]\n error: CmsError\n }\n\n type CmsContentEntryResponse {\n data: CmsContentEntry\n error: CmsError\n }\n\n input CmsModelEntryInput {\n modelId: ID!\n id: ID!\n }\n\n extend type Query {\n # Search content entries for given content models using the query string.\n searchContentEntries(\n modelIds: [ID!]!\n query: String\n fields: [String!]\n limit: Int\n ): CmsContentEntriesResponse!\n\n # Get content entry meta data\n getContentEntry(entry: CmsModelEntryInput!): CmsContentEntryResponse!\n\n getLatestContentEntry(entry: CmsModelEntryInput!): CmsContentEntryResponse!\n getPublishedContentEntry(entry: CmsModelEntryInput!): CmsContentEntryResponse!\n\n # Get content entries meta data\n getContentEntries(entries: [CmsModelEntryInput!]!): CmsContentEntriesResponse!\n getLatestContentEntries(entries: [CmsModelEntryInput!]!): CmsContentEntriesResponse!\n getPublishedContentEntries(\n entries: [CmsModelEntryInput!]!\n ): CmsContentEntriesResponse!\n }\n `,\n resolvers: {\n CmsContentEntry: {\n published: async (parent, _, context) => {\n try {\n const models = await context.cms.listModels();\n const model = models.find(({ modelId }) => {\n return parent.model.modelId === modelId;\n });\n if (!model) {\n return null;\n }\n const [entry] = await context.cms.getPublishedEntriesByIds(model, [\n parent.id\n ]);\n if (!entry) {\n return null;\n }\n return createCmsEntryRecord(model, entry);\n } catch (ex) {\n return null;\n }\n },\n description: createResolveDescription()\n },\n CmsPublishedContentEntry: {\n description: createResolveDescription()\n },\n Query: {\n async searchContentEntries(_, args: any, context) {\n const { modelIds, fields, query, limit = 10 } = args;\n const models = await context.cms.listModels();\n\n const getters = models\n .filter(model => modelIds.includes(model.modelId))\n .map(async model => {\n const modelManager = await context.cms.getEntryManager(model.modelId);\n const where: CmsEntryListWhere = {};\n\n const [items] = await modelManager.listLatest({\n limit,\n where,\n search: !!query ? query : undefined,\n fields: fields || []\n });\n\n return items.map((entry: CmsEntry) => {\n return createCmsEntryRecord(model, entry);\n });\n });\n\n try {\n const entries = await Promise.all(getters).then(results =>\n results.reduce((result, item) => result.concat(item), [])\n );\n\n return new Response(\n entries\n .sort((a, b) => b.savedOn.getTime() - a.savedOn.getTime())\n .slice(0, limit)\n );\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n },\n async getContentEntry(_, args: any, context) {\n return getContentEntry({\n args,\n context,\n type: \"exact\"\n });\n },\n async getLatestContentEntry(_, args: any, context) {\n return getContentEntry({\n args,\n context,\n type: \"latest\"\n });\n },\n async getPublishedContentEntry(_, args: any, context) {\n return getContentEntry({\n args,\n context,\n type: \"published\"\n });\n },\n async getContentEntries(_, args: any, context) {\n return getContentEntries({\n args,\n context,\n type: \"exact\"\n });\n },\n async getLatestContentEntries(_, args: any, context) {\n return getContentEntries({\n args,\n context,\n type: \"latest\"\n });\n },\n async getPublishedContentEntries(_, args: any, context) {\n return getContentEntries({\n args,\n context,\n type: \"published\"\n });\n }\n }\n }\n });\n\n plugin.name = `headless-cms.graphql.schema.${context.cms.type}.content-entries`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAQA,MAAMS,UAAU,GAAIC,IAAmB,IAAkB;EACrD,IAAI,CAACA,IAAI,EAAE;IACP,OAAO,IAAI;EACf;EAEA,IAAI;IACA,OAAO,IAAIC,IAAI,CAACD,IAAI,CAAC;EACzB,CAAC,CAAC,MAAM;IACJ,OAAO,IAAIC,IAAI,CAAC,C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BAAqBA,CAACvC,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UAC/C,OAAOwC,eAAe,CAAC;YACnB7B,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAM0F,wBAAwBA,CAACxC,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UAClD,OAAOwC,eAAe,CAAC;YACnB7B,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAMU,iBAAiBA,CAACwC,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UAC3C,OAAOS,iBAAiB,CAAC;YACrBE,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAM2F,uBAAuBA,CAACzC,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UACjD,OAAOS,iBAAiB,CAAC;YACrBE,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN,CAAC;QACD,MAAM4F,0BAA0BA,CAAC1C,CAAC,EAAEtC,IAAS,EAAEX,OAAO,EAAE;UACpD,OAAOS,iBAAiB,CAAC;YACrBE,IAAI;YACJX,OAAO;YACPD,IAAI,EAAE;UACV,CAAC,CAAC;QACN;MACJ;IACJ;EACJ,CAAC,CAAC;EAEF4D,MAAM,CAAC5F,IAAI,GAAG,+BAA+BiC,OAAO,CAACI,GAAG,CAACL,IAAI,kBAAkB;EAE/E,OAAO4D,MAAM;AACjB,CAAC;AAACiC,OAAA,CAAAnC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CmsContext } from "../../types";
|
|
2
|
-
import {
|
|
1
|
+
import type { CmsContext } from "../../types";
|
|
2
|
+
import type { ICmsGraphQLSchemaPlugin } from "../../plugins";
|
|
3
3
|
interface Params {
|
|
4
4
|
context: CmsContext;
|
|
5
5
|
}
|
|
6
|
-
export declare const createGroupsSchema: ({ context }: Params) =>
|
|
6
|
+
export declare const createGroupsSchema: ({ context }: Params) => ICmsGraphQLSchemaPlugin;
|
|
7
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_handlerGraphql","require","_CmsGroupPlugin","_plugins","createGroupsSchema","context","manageSchema","cms","MANAGE","resolvers","CmsContentModelGroup","contentModels","group","_","models","security","withoutAuthorization","listModels","filter","model","isPrivate","id","totalContentModels","length","plugin","plugins","byType","CmsGroupPlugin","type","some","item","contentModelGroup","Query","getContentModelGroup","args","getGroup","NotFoundError","Response","e","ErrorResponse","listContentModelGroups","__","groups","listGroups","Mutation","createContentModelGroup","createGroup","data","updateContentModelGroup","updateGroup","deleteContentModelGroup","deleteGroup","CmsGraphQLSchemaPlugin","typeDefs","name","exports"],"sources":["contentModelGroups.ts"],"sourcesContent":["import { ErrorResponse, NotFoundError, Response } from \"@webiny/handler-graphql\";\nimport { CmsContext } from \"~/types\";\nimport { Resolvers } from \"@webiny/handler-graphql/types\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport { CmsGraphQLSchemaPlugin } from \"~/plugins\";\n\ninterface Params {\n context: CmsContext;\n}\nexport const createGroupsSchema = ({ context }: Params): CmsGraphQLSchemaPlugin => {\n let manageSchema = \"\";\n if (context.cms.MANAGE) {\n manageSchema = /* GraphQL */ `\n input CmsContentModelGroupInput {\n id: ID\n name: String!\n slug: String\n description: String\n icon: String!\n }\n\n type CmsContentModelGroupResponse {\n data: CmsContentModelGroup\n error: CmsError\n }\n\n type CmsContentModelGroupListResponse {\n data: [CmsContentModelGroup]\n meta: CmsListMeta\n error: CmsError\n }\n\n extend type Query {\n getContentModelGroup(id: ID): CmsContentModelGroupResponse\n listContentModelGroups: CmsContentModelGroupListResponse\n }\n\n extend type Mutation {\n createContentModelGroup(\n data: CmsContentModelGroupInput!\n ): CmsContentModelGroupResponse\n\n updateContentModelGroup(\n id: ID!\n data: CmsContentModelGroupInput!\n ): CmsContentModelGroupResponse\n\n deleteContentModelGroup(id: ID!): CmsDeleteResponse\n }\n `;\n }\n\n let resolvers: Resolvers<CmsContext> = {};\n\n if (context.cms.MANAGE) {\n resolvers = {\n CmsContentModelGroup: {\n contentModels: async (group, _, context) => {\n const models = await context.security.withoutAuthorization(async () => {\n return context.cms.listModels();\n });\n return models.filter(model => {\n if (model.isPrivate === true) {\n return false;\n }\n return model.group.id === group.id;\n });\n },\n totalContentModels: async (group, _, context) => {\n const models = await context.security.withoutAuthorization(async () => {\n return context.cms.listModels();\n });\n return models.filter(model => {\n if (model.isPrivate === true) {\n return false;\n }\n return model.group === group.id;\n }).length;\n },\n plugin: async (group, _, context: CmsContext): Promise<boolean> => {\n return context.plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .some(item => item.contentModelGroup.id === group.id);\n }\n },\n Query: {\n getContentModelGroup: async (_, args: any, context) => {\n try {\n const { id } = args;\n const group = await context.cms.getGroup(id);\n if (group?.isPrivate) {\n throw new NotFoundError(`Cms Group \"${id}\" was not found!`);\n }\n return new Response(group);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listContentModelGroups: async (_, __, context) => {\n try {\n const groups = await context.cms.listGroups();\n return new Response(groups.filter(group => group.isPrivate !== true));\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n Mutation: {\n createContentModelGroup: async (_, args: any, context) => {\n try {\n const model = await context.cms.createGroup(args.data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateContentModelGroup: async (_, args: any, context) => {\n try {\n const group = await context.cms.updateGroup(args.id, args.data);\n return new Response(group);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteContentModelGroup: async (_, args: any, context) => {\n try {\n await context.cms.deleteGroup(args.id);\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n };\n }\n\n const plugin = new CmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type CmsContentModelGroup {\n id: ID!\n createdOn: DateTime\n savedOn: DateTime\n name: String!\n contentModels: [CmsContentModel!]\n totalContentModels: Int!\n slug: String!\n description: String\n icon: String\n createdBy: CmsIdentity\n\n # Returns true if the content model group is registered via a plugin.\n plugin: Boolean!\n }\n ${manageSchema}\n `,\n resolvers\n });\n\n plugin.name = `headless-cms.graphql.schema.${context.cms.type}.content-model-groups`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKO,MAAMG,kBAAkB,GAAGA,CAAC;EAAEC;AAAgB,CAAC,KAA6B;EAC/E,IAAIC,YAAY,GAAG,EAAE;EACrB,IAAID,OAAO,CAACE,GAAG,CAACC,MAAM,EAAE;IACpBF,YAAY,GAAG,aAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;EACL;EAEA,IAAIG,SAAgC,GAAG,CAAC,CAAC;EAEzC,IAAIJ,OAAO,CAACE,GAAG,CAACC,MAAM,EAAE;IACpBC,SAAS,GAAG;MACRC,oBAAoB,EAAE;QAClBC,aAAa,EAAE,MAAAA,CAAOC,KAAK,EAAEC,CAAC,EAAER,OAAO,KAAK;UACxC,MAAMS,MAAM,GAAG,MAAMT,OAAO,CAACU,QAAQ,CAACC,oBAAoB,CAAC,YAAY;YACnE,OAAOX,OAAO,CAACE,GAAG,CAACU,UAAU,CAAC,CAAC;UACnC,CAAC,CAAC;UACF,OAAOH,MAAM,CAACI,MAAM,CAACC,KAAK,IAAI;YAC1B,IAAIA,KAAK,CAACC,SAAS,KAAK,IAAI,EAAE;cAC1B,OAAO,KAAK;YAChB;YACA,OAAO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OAAO,KAAK;UACtD,IAAI;YACA,MAAMA,OAAO,CAACE,GAAG,CAAC4C,WAAW,CAACjB,IAAI,CAACb,EAAE,CAAC;YACtC,OAAO,IAAIgB,wBAAQ,CAAC,IAAI,CAAC;UAC7B,CAAC,CAAC,OAAOC,CAAC,EAAE;YACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;UAC/B;QACJ;MACJ;IACJ,CAAC;EACL;EAEA,MAAMd,MAAM,GAAG,IAAI4B,+BAAsB,CAAC;IACtCC,QAAQ,EAAE,aAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc/C,YAAa;AAC3B,SAAS;IACDG;EACJ,CAAC,CAAC;EAEFe,MAAM,CAAC8B,IAAI,GAAI,+BAA8BjD,OAAO,CAACE,GAAG,CAACqB,IAAK,uBAAsB;EAEpF,OAAOJ,MAAM;AACjB,CAAC;AAAC+B,OAAA,CAAAnD,kBAAA,GAAAA,kBAAA"}
|
|
1
|
+
{"version":3,"names":["_handlerGraphql","require","_CmsGroupPlugin","_plugins","createGroupsSchema","context","manageSchema","cms","MANAGE","resolvers","CmsContentModelGroup","contentModels","group","_","models","security","withoutAuthorization","listModels","filter","model","isPrivate","id","totalContentModels","length","plugin","plugins","byType","CmsGroupPlugin","type","some","item","contentModelGroup","Query","getContentModelGroup","args","getGroup","NotFoundError","Response","e","ErrorResponse","listContentModelGroups","__","groups","listGroups","Mutation","createContentModelGroup","createGroup","data","updateContentModelGroup","updateGroup","deleteContentModelGroup","deleteGroup","createCmsGraphQLSchemaPlugin","typeDefs","name","exports"],"sources":["contentModelGroups.ts"],"sourcesContent":["import { ErrorResponse, NotFoundError, Response } from \"@webiny/handler-graphql\";\nimport type { CmsContext } from \"~/types\";\nimport type { Resolvers } from \"@webiny/handler-graphql/types\";\nimport { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins\";\n\ninterface Params {\n context: CmsContext;\n}\nexport const createGroupsSchema = ({ context }: Params): ICmsGraphQLSchemaPlugin => {\n let manageSchema = \"\";\n if (context.cms.MANAGE) {\n manageSchema = /* GraphQL */ `\n input CmsContentModelGroupInput {\n id: ID\n name: String!\n slug: String\n description: String\n icon: String!\n }\n\n type CmsContentModelGroupResponse {\n data: CmsContentModelGroup\n error: CmsError\n }\n\n type CmsContentModelGroupListResponse {\n data: [CmsContentModelGroup]\n meta: CmsListMeta\n error: CmsError\n }\n\n extend type Query {\n getContentModelGroup(id: ID): CmsContentModelGroupResponse\n listContentModelGroups: CmsContentModelGroupListResponse\n }\n\n extend type Mutation {\n createContentModelGroup(\n data: CmsContentModelGroupInput!\n ): CmsContentModelGroupResponse\n\n updateContentModelGroup(\n id: ID!\n data: CmsContentModelGroupInput!\n ): CmsContentModelGroupResponse\n\n deleteContentModelGroup(id: ID!): CmsDeleteResponse\n }\n `;\n }\n\n let resolvers: Resolvers<CmsContext> = {};\n\n if (context.cms.MANAGE) {\n resolvers = {\n CmsContentModelGroup: {\n contentModels: async (group, _, context) => {\n const models = await context.security.withoutAuthorization(async () => {\n return context.cms.listModels();\n });\n return models.filter(model => {\n if (model.isPrivate === true) {\n return false;\n }\n return model.group.id === group.id;\n });\n },\n totalContentModels: async (group, _, context) => {\n const models = await context.security.withoutAuthorization(async () => {\n return context.cms.listModels();\n });\n return models.filter(model => {\n if (model.isPrivate === true) {\n return false;\n }\n return model.group === group.id;\n }).length;\n },\n plugin: async (group, _, context: CmsContext): Promise<boolean> => {\n return context.plugins\n .byType<CmsGroupPlugin>(CmsGroupPlugin.type)\n .some(item => item.contentModelGroup.id === group.id);\n }\n },\n Query: {\n getContentModelGroup: async (_, args: any, context) => {\n try {\n const { id } = args;\n const group = await context.cms.getGroup(id);\n if (group?.isPrivate) {\n throw new NotFoundError(`Cms Group \"${id}\" was not found!`);\n }\n return new Response(group);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listContentModelGroups: async (_, __, context) => {\n try {\n const groups = await context.cms.listGroups();\n return new Response(groups.filter(group => group.isPrivate !== true));\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n Mutation: {\n createContentModelGroup: async (_, args: any, context) => {\n try {\n const model = await context.cms.createGroup(args.data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateContentModelGroup: async (_, args: any, context) => {\n try {\n const group = await context.cms.updateGroup(args.id, args.data);\n return new Response(group);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteContentModelGroup: async (_, args: any, context) => {\n try {\n await context.cms.deleteGroup(args.id);\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n };\n }\n\n const plugin = createCmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type CmsContentModelGroup {\n id: ID!\n createdOn: DateTime\n savedOn: DateTime\n name: String!\n contentModels: [CmsContentModel!]\n totalContentModels: Int!\n slug: String!\n description: String\n icon: String\n createdBy: CmsIdentity\n\n # Returns true if the content model group is registered via a plugin.\n plugin: Boolean!\n }\n ${manageSchema}\n `,\n resolvers\n });\n\n plugin.name = `headless-cms.graphql.schema.${context.cms.type}.content-model-groups`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAKO,MAAMG,kBAAkB,GAAGA,CAAC;EAAEC;AAAgB,CAAC,KAA8B;EAChF,IAAIC,YAAY,GAAG,EAAE;EACrB,IAAID,OAAO,CAACE,GAAG,CAACC,MAAM,EAAE;IACpBF,YAAY,GAAG,aAAc;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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";
|
|
2
|
-
import {
|
|
3
|
-
interface
|
|
1
|
+
import type { CmsContext } from "../../types";
|
|
2
|
+
import type { ICmsGraphQLSchemaPlugin } from "../../plugins";
|
|
3
|
+
export interface CreateModelsSchemaParams {
|
|
4
4
|
context: CmsContext;
|
|
5
5
|
}
|
|
6
|
-
export declare const createModelsSchema: ({ context }:
|
|
7
|
-
export {};
|
|
6
|
+
export declare const createModelsSchema: ({ context }: CreateModelsSchemaParams) => ICmsGraphQLSchemaPlugin;
|