@webiny/api-headless-cms 5.40.0-beta.2 → 5.40.0-beta.3
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 +11 -1
- package/constants.js +15 -9
- package/constants.js.map +1 -1
- package/context.js +47 -31
- package/context.js.map +1 -1
- package/crud/AccessControl/AccessControl.d.ts +3 -3
- package/crud/AccessControl/AccessControl.js.map +1 -1
- 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.js.map +1 -1
- package/crud/contentEntry/beforeCreate.js.map +1 -1
- package/crud/contentEntry/beforeUpdate.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryData.js +9 -1
- package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
- 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.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.js.map +1 -1
- package/crud/contentEntry/markLockedFields.js.map +1 -1
- package/crud/contentEntry/referenceFieldsMapping.js +1 -1
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
- 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 +62 -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 +7 -0
- package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js +17 -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 +11 -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 +7 -0
- package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js +17 -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 +11 -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 +7 -0
- package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js +17 -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 +13 -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 +7 -0
- package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js +17 -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 +9 -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 +7 -0
- package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js +17 -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 +11 -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 +7 -0
- package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js +17 -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 +9 -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 +7 -0
- package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js +17 -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 +9 -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 +7 -0
- package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js +17 -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 +11 -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 +7 -0
- package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js +17 -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 +24 -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 +7 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js +17 -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 +61 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js.map +1 -0
- package/crud/contentEntry/useCases/RestoreEntryFromBin/index.d.ts +23 -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.js +210 -269
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/beforeCreate.js.map +1 -1
- package/crud/contentModel/beforeDelete.js.map +1 -1
- package/crud/contentModel/beforeUpdate.js.map +1 -1
- package/crud/contentModel/compatibility/modelApiName.js.map +1 -1
- package/crud/contentModel/contentModelManagerFactory.d.ts +1 -1
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -1
- package/crud/contentModel/createFieldStorageId.js.map +1 -1
- package/crud/contentModel/defaultFields.js.map +1 -1
- package/crud/contentModel/ensureTypeTag.js.map +1 -1
- package/crud/contentModel/fields/descriptionField.js.map +1 -1
- package/crud/contentModel/fields/imageField.js.map +1 -1
- package/crud/contentModel/fields/titleField.js.map +1 -1
- package/crud/contentModel/listModelsFromDatabase.js.map +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.js.map +1 -1
- package/crud/contentModel/validate/pluralApiName.js.map +1 -1
- package/crud/contentModel/validate/singularApiName.js.map +1 -1
- package/crud/contentModel/validateModel.js.map +1 -1
- package/crud/contentModel/validateModelFields.d.ts +1 -1
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel/validateStorageId.d.ts +1 -0
- package/crud/contentModel/validateStorageId.js +29 -0
- package/crud/contentModel/validateStorageId.js.map +1 -0
- package/crud/contentModel/validation.d.ts +51 -30
- package/crud/contentModel/validation.js +3 -2
- package/crud/contentModel/validation.js.map +1 -1
- package/crud/contentModel.crud.js +6 -0
- package/crud/contentModel.crud.js.map +1 -1
- package/crud/contentModelGroup/beforeCreate.js.map +1 -1
- package/crud/contentModelGroup/beforeDelete.js.map +1 -1
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
- package/crud/contentModelGroup/listGroupsFromDatabase.js.map +1 -1
- package/crud/contentModelGroup/validation.js.map +1 -1
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/crud/system.crud.js.map +1 -1
- package/export/crud/exporting.js.map +1 -1
- package/export/crud/importing.js.map +1 -1
- package/export/crud/imports/importData.js.map +1 -1
- package/export/crud/imports/importGroups.js.map +1 -1
- package/export/crud/imports/importModels.js.map +1 -1
- package/export/crud/imports/validateGroups.js.map +1 -1
- package/export/crud/imports/validateInput.js.map +1 -1
- package/export/crud/imports/validateModels.js.map +1 -1
- package/export/crud/index.js.map +1 -1
- package/export/crud/sanitize.js.map +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.js +1 -2
- package/export/types.js.map +1 -1
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +4 -14
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/index.js.map +1 -1
- package/graphql/buildSchemaPlugins.d.ts +2 -2
- package/graphql/buildSchemaPlugins.js.map +1 -1
- package/graphql/checkEndpointAccess.js.map +1 -1
- package/graphql/createExecutableSchema.d.ts +2 -2
- package/graphql/createExecutableSchema.js.map +1 -1
- package/graphql/createRequestBody.js.map +1 -1
- package/graphql/formatErrorPayload.js.map +1 -1
- package/graphql/generateSchema.js.map +1 -1
- package/graphql/getSchema.js.map +1 -1
- package/graphql/graphQLHandlerFactory.js.map +1 -1
- package/graphql/handleRequest.js.map +1 -1
- package/graphql/index.js.map +1 -1
- package/graphql/schema/baseContentSchema.d.ts +2 -2
- 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 +2 -2
- package/graphql/schema/contentEntries.js +2 -2
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModelGroups.d.ts +2 -2
- package/graphql/schema/contentModelGroups.js +1 -1
- package/graphql/schema/contentModelGroups.js.map +1 -1
- package/graphql/schema/contentModels.d.ts +2 -2
- package/graphql/schema/contentModels.js +3 -1
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createFieldTypePluginRecords.js.map +1 -1
- package/graphql/schema/createManageResolvers.js +8 -0
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.js +10 -0
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createPreviewResolvers.js.map +1 -1
- package/graphql/schema/createReadResolvers.js.map +1 -1
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
- 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.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
- 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.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
- 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.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
- package/graphql/schema/schemaPlugins.d.ts +2 -2
- package/graphql/schema/schemaPlugins.js +2 -2
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/graphql/system.js.map +1 -1
- package/graphqlFields/boolean.js.map +1 -1
- package/graphqlFields/datetime.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.js +27 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -1
- package/graphqlFields/dynamicZone/index.js.map +1 -1
- package/graphqlFields/file.js.map +1 -1
- package/graphqlFields/helpers.js.map +1 -1
- package/graphqlFields/index.js.map +1 -1
- package/graphqlFields/json.js.map +1 -1
- package/graphqlFields/longText.js.map +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.js.map +1 -1
- package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -1
- package/graphqlFields/richText/richTextResolver.js.map +1 -1
- package/graphqlFields/richText.js.map +1 -1
- package/graphqlFields/text.js.map +1 -1
- package/htmlRenderer/LexicalRenderer.js.map +1 -1
- package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -1
- package/index.js.map +1 -1
- package/modelManager/DefaultCmsModelManager.d.ts +1 -0
- package/modelManager/DefaultCmsModelManager.js +3 -0
- package/modelManager/DefaultCmsModelManager.js.map +1 -1
- package/modelManager/index.js +1 -1
- package/modelManager/index.js.map +1 -1
- package/package.json +27 -27
- package/parameters/context.js.map +1 -1
- package/parameters/header.js.map +1 -1
- package/parameters/index.js.map +1 -1
- package/parameters/manual.js.map +1 -1
- package/parameters/path.js.map +1 -1
- package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.d.ts +8 -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.js.map +1 -1
- package/plugins/CmsGroupPlugin.d.ts +4 -0
- package/plugins/CmsGroupPlugin.js +9 -1
- package/plugins/CmsGroupPlugin.js.map +1 -1
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
- package/plugins/CmsModelPlugin.d.ts +10 -8
- package/plugins/CmsModelPlugin.js +29 -16
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/plugins/CmsParametersPlugin.js.map +1 -1
- package/plugins/CmsRichTextRendererPlugin.js.map +1 -1
- package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -1
- package/plugins/StorageTransformPlugin.js.map +1 -1
- package/plugins/index.js.map +1 -1
- package/storage/default.js.map +1 -1
- package/storage/index.js.map +1 -1
- package/storage/json.js.map +1 -1
- 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 +320 -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 +364 -0
- package/types/plugins.js +7 -0
- package/types/plugins.js.map +1 -0
- package/{types.d.ts → types/types.d.ts} +196 -1171
- package/{types.js → types/types.js} +18 -119
- package/types/types.js.map +1 -0
- package/utils/caching/Cache.js.map +1 -1
- package/utils/caching/CacheKey.js.map +1 -1
- package/utils/caching/index.js.map +1 -1
- package/utils/caching/types.js.map +1 -1
- package/utils/contentEntryTraverser/ContentEntryTraverser.d.ts +10 -0
- package/utils/contentEntryTraverser/ContentEntryTraverser.js +84 -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.js.map +1 -1
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/createModelField.d.ts +2 -0
- package/utils/createModelField.js +14 -4
- package/utils/createModelField.js.map +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.js.map +1 -1
- package/utils/filterAsync.js.map +1 -1
- package/utils/getBaseFieldType.js.map +1 -1
- package/utils/getEntryDescription.js.map +1 -1
- package/utils/getEntryImage.js.map +1 -1
- package/utils/getEntryTitle.js.map +1 -1
- package/utils/getSchemaFromFieldPlugins.d.ts +4 -4
- package/utils/getSchemaFromFieldPlugins.js +2 -2
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/identity.js.map +1 -1
- package/utils/incrementEntryIdVersion.js.map +1 -1
- package/utils/index.js.map +1 -1
- package/utils/isHeadlessCmsReady.js.map +1 -1
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.js.map +1 -1
- package/utils/toSlug.js.map +1 -1
- package/validators/dateGte.js.map +1 -1
- package/validators/dateLte.js.map +1 -1
- package/validators/gte.js.map +1 -1
- package/validators/in.js.map +1 -1
- package/validators/index.js.map +1 -1
- package/validators/lte.js.map +1 -1
- package/validators/maxLength.js.map +1 -1
- package/validators/minLength.js.map +1 -1
- package/validators/pattern.js.map +1 -1
- package/validators/patternPlugins/email.js.map +1 -1
- package/validators/patternPlugins/index.js.map +1 -1
- package/validators/patternPlugins/lowerCase.js.map +1 -1
- package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
- package/validators/patternPlugins/upperCase.js.map +1 -1
- package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
- package/validators/patternPlugins/url.js.map +1 -1
- package/validators/required.js.map +1 -1
- package/validators/timeGte.js.map +1 -1
- package/validators/timeLte.js.map +1 -1
- package/validators/unique.js.map +1 -1
- package/plugins/CmsGraphQLSchemaPlugin.d.ts +0 -5
- package/plugins/CmsGraphQLSchemaPlugin.js.map +0 -1
- package/types.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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelDescriptionFieldId","fields","descriptionFieldId","length","descriptionField","find","field","getBaseFieldType","multipleValues","fieldId","target","WebinyError","storageId","type","exports"],"sources":["descriptionField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelDescriptionFieldId = (\n fields: CmsModelField[],\n descriptionFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If description field is not defined, let us find possible one.\n */\n if (!descriptionFieldId) {\n const descriptionField = fields.find(field => {\n return getBaseFieldType(field) === \"long-text\" && !field.multipleValues;\n });\n return descriptionField?.fieldId || null;\n }\n const target = fields.find(\n field => field.fieldId === descriptionFieldId && getBaseFieldType(field) === \"long-text\"\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the description field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: descriptionFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry description.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,iCAAiC,GAAGA,CAC7CC,MAAuB,EACvBC,kBAAkC,KACN;EAC5B;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACD,kBAAkB,EAAE;IACrB,MAAME,gBAAgB,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MAC1C,OAAO,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,WAAW,IAAI,CAACA,KAAK,CAACE,cAAc;IAC3E,CAAC,CAAC;IACF,OAAOJ,gBAAgB,EAAEK,OAAO,IAAI,IAAI;EAC5C;EACA,MAAMC,MAAM,GAAGT,MAAM,CAACI,IAAI,CACtBC,KAAK,IAAIA,KAAK,CAACG,OAAO,KAAKP,kBAAkB,IAAI,IAAAK,kCAAgB,EAACD,KAAK,CAAC,KAAK,WACjF,CAAC;EACD,IAAI,CAACI,MAAM,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,uEAAsE,EACvE,kBAAkB,EAClB;MACIF,OAAO,EAAEP,kBAAkB;MAC3BD;IACJ,CACJ,CAAC;EACL;EACA,IAAIS,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAIG,cAAW,CAChB,6EAA4E,EAC7E,wBAAwB,EACxB;MACIC,SAAS,EAAEF,MAAM,CAACE,SAAS;MAC3BH,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBI,IAAI,EAAEH,MAAM,CAACG;IACjB,CACJ,CAAC;EACL;EAEA,OAAOH,MAAM,CAACD,OAAO;AACzB,CAAC;AAACK,OAAA,CAAAd,iCAAA,GAAAA,iCAAA"}
|
|
1
|
+
{"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelDescriptionFieldId","fields","descriptionFieldId","length","descriptionField","find","field","getBaseFieldType","multipleValues","fieldId","target","WebinyError","storageId","type","exports"],"sources":["descriptionField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelDescriptionFieldId = (\n fields: CmsModelField[],\n descriptionFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If description field is not defined, let us find possible one.\n */\n if (!descriptionFieldId) {\n const descriptionField = fields.find(field => {\n return getBaseFieldType(field) === \"long-text\" && !field.multipleValues;\n });\n return descriptionField?.fieldId || null;\n }\n const target = fields.find(\n field => field.fieldId === descriptionFieldId && getBaseFieldType(field) === \"long-text\"\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the description field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: descriptionFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry description.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,iCAAiC,GAAGA,CAC7CC,MAAuB,EACvBC,kBAAkC,KACN;EAC5B;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACD,kBAAkB,EAAE;IACrB,MAAME,gBAAgB,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MAC1C,OAAO,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,WAAW,IAAI,CAACA,KAAK,CAACE,cAAc;IAC3E,CAAC,CAAC;IACF,OAAOJ,gBAAgB,EAAEK,OAAO,IAAI,IAAI;EAC5C;EACA,MAAMC,MAAM,GAAGT,MAAM,CAACI,IAAI,CACtBC,KAAK,IAAIA,KAAK,CAACG,OAAO,KAAKP,kBAAkB,IAAI,IAAAK,kCAAgB,EAACD,KAAK,CAAC,KAAK,WACjF,CAAC;EACD,IAAI,CAACI,MAAM,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,uEAAsE,EACvE,kBAAkB,EAClB;MACIF,OAAO,EAAEP,kBAAkB;MAC3BD;IACJ,CACJ,CAAC;EACL;EACA,IAAIS,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAIG,cAAW,CAChB,6EAA4E,EAC7E,wBAAwB,EACxB;MACIC,SAAS,EAAEF,MAAM,CAACE,SAAS;MAC3BH,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBI,IAAI,EAAEH,MAAM,CAACG;IACjB,CACJ,CAAC;EACL;EAEA,OAAOH,MAAM,CAACD,OAAO;AACzB,CAAC;AAACK,OAAA,CAAAd,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelImageFieldId","fields","imageFieldId","length","imageField","find","field","getBaseFieldType","multipleValues","settings","imagesOnly","fieldId","target","WebinyError","storageId","type","exports"],"sources":["imageField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelImageFieldId = (\n fields: CmsModelField[],\n imageFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If image field is not defined, let us find possible one.\n */\n if (!imageFieldId) {\n const imageField = fields.find(field => {\n return (\n getBaseFieldType(field) === \"file\" &&\n !field.multipleValues &&\n field.settings?.imagesOnly\n );\n });\n return imageField?.fieldId || null;\n }\n const target = fields.find(\n field =>\n field.fieldId === imageFieldId &&\n getBaseFieldType(field) === \"file\" &&\n field.settings?.imagesOnly\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the image field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: imageFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry image.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,2BAA2B,GAAGA,CACvCC,MAAuB,EACvBC,YAA4B,KACA;EAC5B;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACD,YAAY,EAAE;IACf,MAAME,UAAU,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MACpC,OACI,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAClC,CAACA,KAAK,CAACE,cAAc,IACrBF,KAAK,CAACG,QAAQ,EAAEC,UAAU;IAElC,CAAC,CAAC;IACF,OAAON,UAAU,EAAEO,OAAO,IAAI,IAAI;EACtC;EACA,MAAMC,MAAM,GAAGX,MAAM,CAACI,IAAI,CACtBC,KAAK,IACDA,KAAK,CAACK,OAAO,KAAKT,YAAY,IAC9B,IAAAK,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAClCA,KAAK,CAACG,QAAQ,EAAEC,UACxB,CAAC;EACD,IAAI,CAACE,MAAM,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,iEAAgE,EACjE,kBAAkB,EAClB;MACIF,OAAO,EAAET,YAAY;MACrBD;IACJ,CACJ,CAAC;EACL;EACA,IAAIW,MAAM,CAACJ,cAAc,EAAE;IACvB,MAAM,IAAIK,cAAW,CAChB,uEAAsE,EACvE,wBAAwB,EACxB;MACIC,SAAS,EAAEF,MAAM,CAACE,SAAS;MAC3BH,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBI,IAAI,EAAEH,MAAM,CAACG;IACjB,CACJ,CAAC;EACL;EAEA,OAAOH,MAAM,CAACD,OAAO;AACzB,CAAC;AAACK,OAAA,CAAAhB,2BAAA,GAAAA,2BAAA"}
|
|
1
|
+
{"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelImageFieldId","fields","imageFieldId","length","imageField","find","field","getBaseFieldType","multipleValues","settings","imagesOnly","fieldId","target","WebinyError","storageId","type","exports"],"sources":["imageField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelImageFieldId = (\n fields: CmsModelField[],\n imageFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If image field is not defined, let us find possible one.\n */\n if (!imageFieldId) {\n const imageField = fields.find(field => {\n return (\n getBaseFieldType(field) === \"file\" &&\n !field.multipleValues &&\n field.settings?.imagesOnly\n );\n });\n return imageField?.fieldId || null;\n }\n const target = fields.find(\n field =>\n field.fieldId === imageFieldId &&\n getBaseFieldType(field) === \"file\" &&\n field.settings?.imagesOnly\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the image field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: imageFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry image.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId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
|
|
1
|
-
{"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","defaultTitleFieldId","allowedTitleFieldTypes","getContentModelTitleFieldId","fields","titleFieldId","length","titleField","find","field","getBaseFieldType","multipleValues","fieldId","target","f","WebinyError","includes","type","join","storageId","exports"],"sources":["titleField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nconst defaultTitleFieldId = \"id\";\n\nconst allowedTitleFieldTypes = [\"text\", \"number\"];\n\nexport const getContentModelTitleFieldId = (\n fields: CmsModelField[],\n titleFieldId?: string\n): string => {\n /**\n * If there are no fields defined, we will return the default field\n */\n if (fields.length === 0) {\n return defaultTitleFieldId;\n }\n /**\n * if there is no title field defined either in input data or existing content model data\n * we will take first text field that has no multiple values enabled\n * or if initial titleFieldId is the default one also try to find first available text field\n */\n if (!titleFieldId || titleFieldId === defaultTitleFieldId) {\n const titleField = fields.find(field => {\n return getBaseFieldType(field) === \"text\" && !field.multipleValues;\n });\n return titleField?.fieldId || defaultTitleFieldId;\n }\n /**\n * check existing titleFieldId for existence in the model\n * for correct type\n * and that it is not multiple values field\n */\n const target = fields.find(f => f.fieldId === titleFieldId);\n if (!target) {\n throw new WebinyError(\n `Field selected for the title field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: titleFieldId,\n fields\n }\n );\n }\n\n if (allowedTitleFieldTypes.includes(target.type) === false) {\n throw new WebinyError(\n `Only ${allowedTitleFieldTypes.join(\n \", \"\n )} and id fields can be used as an entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.f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AACI;IACjB,CACJ,CAAC;EACL;EAEA,IAAIJ,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAII,cAAW,CAChB,uEAAsE,EACvE,wBAAwB,EACxB;MACII,SAAS,EAAEN,MAAM,CAACM,SAAS;MAC3BP,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBK,IAAI,EAAEJ,MAAM,CAACI;IACjB,CACJ,CAAC;EACL;EAEA,OAAOJ,MAAM,CAACD,OAAO;AACzB,CAAC;AAACQ,OAAA,CAAAjB,2BAAA,GAAAA,2BAAA"}
|
|
1
|
+
{"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","defaultTitleFieldId","allowedTitleFieldTypes","getContentModelTitleFieldId","fields","titleFieldId","length","titleField","find","field","getBaseFieldType","multipleValues","fieldId","target","f","WebinyError","includes","type","join","storageId","exports"],"sources":["titleField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nconst defaultTitleFieldId = \"id\";\n\nconst allowedTitleFieldTypes = [\"text\", \"number\"];\n\nexport const getContentModelTitleFieldId = (\n fields: CmsModelField[],\n titleFieldId?: string\n): string => {\n /**\n * If there are no fields defined, we will return the default field\n */\n if (fields.length === 0) {\n return defaultTitleFieldId;\n }\n /**\n * if there is no title field defined either in input data or existing content model data\n * we will take first text field that has no multiple values enabled\n * or if initial titleFieldId is the default one also try to find first available text field\n */\n if (!titleFieldId || titleFieldId === defaultTitleFieldId) {\n const titleField = fields.find(field => {\n return getBaseFieldType(field) === \"text\" && !field.multipleValues;\n });\n return titleField?.fieldId || defaultTitleFieldId;\n }\n /**\n * check existing titleFieldId for existence in the model\n * for correct type\n * and that it is not multiple values field\n */\n const target = fields.find(f => f.fieldId === titleFieldId);\n if (!target) {\n throw new WebinyError(\n `Field selected for the title field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: titleFieldId,\n fields\n }\n );\n }\n\n if (allowedTitleFieldTypes.includes(target.type) === false) {\n throw new WebinyError(\n `Only ${allowedTitleFieldTypes.join(\n \", \"\n )} and id fields can be used as an entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,MAAMG,mBAAmB,GAAG,IAAI;AAEhC,MAAMC,sBAAsB,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;AAE1C,MAAMC,2BAA2B,GAAGA,CACvCC,MAAuB,EACvBC,YAAqB,KACZ;EACT;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAOL,mBAAmB;EAC9B;EACA;AACJ;AACA;AACA;AACA;EACI,IAAI,CAACI,YAAY,IAAIA,YAAY,KAAKJ,mBAAmB,EAAE;IACvD,MAAMM,UAAU,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MACpC,OAAO,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAAI,CAACA,KAAK,CAACE,cAAc;IACtE,CAAC,CAAC;IACF,OAAOJ,UAAU,EAAEK,OAAO,IAAIX,mBAAmB;EACrD;EACA;AACJ;AACA;AACA;AACA;EACI,MAAMY,MAAM,GAAGT,MAAM,CAACI,IAAI,CAACM,CAAC,IAAIA,CAAC,CAACF,OAAO,KAAKP,YAAY,CAAC;EAC3D,IAAI,CAACQ,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CAChB,iEAAgE,EACjE,kBAAkB,EAClB;MACIH,OAAO,EAAEP,YAAY;MACrBD;IACJ,CACJ,CAAC;EACL;EAEA,IAAIF,sBAAsB,CAACc,QAAQ,CAACH,MAAM,CAACI,IAAI,CAAC,KAAK,KAAK,EAAE;IACxD,MAAM,IAAIF,cAAW,CAChB,QAAOb,sBAAsB,CAACgB,IAAI,CAC/B,IACJ,CAAE,+CAA8C,EAChD,wBAAwB,EACxB;MACIC,SAAS,EAAEN,MAAM,CAACM,SAAS;MAC3BP,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBK,IAAI,EAAEJ,MAAM,CAACI;IACjB,CACJ,CAAC;EACL;EAEA,IAAIJ,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAII,cAAW,CAChB,uEAAsE,EACvE,wBAAwB,EACxB;MACII,SAAS,EAAEN,MAAM,CAACM,SAAS;MAC3BP,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBK,IAAI,EAAEJ,MAAM,CAACI;IACjB,CACJ,CAAC;EACL;EAEA,OAAOJ,MAAM,CAACD,OAAO;AACzB,CAAC;AAACQ,OAAA,CAAAjB,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_modelApiName","require","_ensureTypeTag","listModelsFromDatabase","params","storageOperations","getTenant","getLocale","models","list","where","tenant","id","locale","code","map","model","tags","ensureTypeTag","singularApiName","ensureSingularApiName","pluralApiName","ensurePluralApiName","exports"],"sources":["listModelsFromDatabase.ts"],"sourcesContent":["import { CmsModel, HeadlessCmsStorageOperations } from \"~/types\";\nimport {\n ensurePluralApiName,\n ensureSingularApiName\n} from \"~/crud/contentModel/compatibility/modelApiName\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { ensureTypeTag } from \"./ensureTypeTag\";\n\ninterface Params {\n storageOperations: HeadlessCmsStorageOperations;\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n}\n\nexport const listModelsFromDatabase = async (params: Params): Promise<CmsModel[]> => {\n const { storageOperations, getTenant, getLocale } = params;\n const models = await storageOperations.models.list({\n where: {\n tenant: getTenant().id,\n locale: getLocale().code\n }\n });\n return models.map(model => {\n return {\n ...model,\n tags: ensureTypeTag(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code,\n /**\n * TODO: remove in v5.36.0\n * This is for backward compatibility while migrations are not yet executed.\n */\n singularApiName: ensureSingularApiName(model),\n pluralApiName: ensurePluralApiName(model)\n };\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAAC,cAAA,GAAAD,OAAA;AAQO,MAAME,sBAAsB,GAAG,MAAOC,MAAc,IAA0B;EACjF,MAAM;IAAEC,iBAAiB;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGH,MAAM;EAC1D,MAAMI,MAAM,GAAG,MAAMH,iBAAiB,CAACG,MAAM,CAACC,IAAI,CAAC;IAC/CC,KAAK,EAAE;MACHC,MAAM,EAAEL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtBC,MAAM,EAAEN,SAAS,CAAC,CAAC,CAACO;IACxB;EACJ,CAAC,CAAC;EACF,OAAON,MAAM,CAACO,GAAG,CAACC,KAAK,IAAI;IACvB,OAAO;MACH,GAAGA,KAAK;MACRC,IAAI,EAAE,IAAAC,4BAAa,EAACF,KAAK,CAAC;MAC1BL,MAAM,EAAEK,KAAK,CAACL,MAAM,IAAIL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtCC,MAAM,EAAEG,KAAK,CAACH,MAAM,IAAIN,SAAS,CAAC,CAAC,CAACO,IAAI;MACxC;AACZ;AACA;AACA;MACYK,eAAe,EAAE,IAAAC,mCAAqB,EAACJ,KAAK,CAAC;MAC7CK,aAAa,EAAE,IAAAC,iCAAmB,EAACN,KAAK;IAC5C,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAApB,sBAAA,GAAAA,sBAAA"}
|
|
1
|
+
{"version":3,"names":["_modelApiName","require","_ensureTypeTag","listModelsFromDatabase","params","storageOperations","getTenant","getLocale","models","list","where","tenant","id","locale","code","map","model","tags","ensureTypeTag","singularApiName","ensureSingularApiName","pluralApiName","ensurePluralApiName","exports"],"sources":["listModelsFromDatabase.ts"],"sourcesContent":["import { CmsModel, HeadlessCmsStorageOperations } from \"~/types\";\nimport {\n ensurePluralApiName,\n ensureSingularApiName\n} from \"~/crud/contentModel/compatibility/modelApiName\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { ensureTypeTag } from \"./ensureTypeTag\";\n\ninterface Params {\n storageOperations: HeadlessCmsStorageOperations;\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n}\n\nexport const listModelsFromDatabase = async (params: Params): Promise<CmsModel[]> => {\n const { storageOperations, getTenant, getLocale } = params;\n const models = await storageOperations.models.list({\n where: {\n tenant: getTenant().id,\n locale: getLocale().code\n }\n });\n return models.map(model => {\n return {\n ...model,\n tags: ensureTypeTag(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code,\n /**\n * TODO: remove in v5.36.0\n * This is for backward compatibility while migrations are not yet executed.\n */\n singularApiName: ensureSingularApiName(model),\n pluralApiName: ensurePluralApiName(model)\n };\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAAC,cAAA,GAAAD,OAAA;AAQO,MAAME,sBAAsB,GAAG,MAAOC,MAAc,IAA0B;EACjF,MAAM;IAAEC,iBAAiB;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGH,MAAM;EAC1D,MAAMI,MAAM,GAAG,MAAMH,iBAAiB,CAACG,MAAM,CAACC,IAAI,CAAC;IAC/CC,KAAK,EAAE;MACHC,MAAM,EAAEL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtBC,MAAM,EAAEN,SAAS,CAAC,CAAC,CAACO;IACxB;EACJ,CAAC,CAAC;EACF,OAAON,MAAM,CAACO,GAAG,CAACC,KAAK,IAAI;IACvB,OAAO;MACH,GAAGA,KAAK;MACRC,IAAI,EAAE,IAAAC,4BAAa,EAACF,KAAK,CAAC;MAC1BL,MAAM,EAAEK,KAAK,CAACL,MAAM,IAAIL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtCC,MAAM,EAAEG,KAAK,CAACH,MAAM,IAAIN,SAAS,CAAC,CAAC,CAACO,IAAI;MACxC;AACZ;AACA;AACA;MACYK,eAAe,EAAE,IAAAC,mCAAqB,EAACJ,KAAK,CAAC;MAC7CK,aAAa,EAAE,IAAAC,iCAAmB,EAACN,KAAK;IAC5C,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAApB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_isModelEndingAllowed","validateEndingAllowed","params","model","isModelEndingAllowed","singularApiName","WebinyError","input","disallowedEnding","pluralApiName","exports"],"sources":["endingAllowed.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { disallowedEnding, isModelEndingAllowed } from \"./isModelEndingAllowed\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateEndingAllowed = (params: Params): void => {\n const { model } = params;\n if (isModelEndingAllowed(model.singularApiName) === false) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_SINGULAR_API_NAME_ENDING_NOT_ALLOWED\",\n {\n input: model.singularApiName,\n disallowedEnding\n }\n );\n } else if (isModelEndingAllowed(model.pluralApiName) === false) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_PLURAL_API_NAME_NOT_ENDING_ALLOWED\",\n {\n input: model.pluralApiName,\n disallowedEnding: disallowedEnding\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAOO,MAAME,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAI,IAAAE,0CAAoB,EAACD,KAAK,CAACE,eAAe,CAAC,KAAK,KAAK,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,eAAgB,mDAAkD,EAC/G,4CAA4C,EAC5C;MACIE,KAAK,EAAEJ,KAAK,CAACE,eAAe;MAC5BG,gBAAgB,EAAhBA;IACJ,CACJ,CAAC;EACL,CAAC,MAAM,IAAI,IAAAJ,0CAAoB,EAACD,KAAK,CAACM,aAAa,CAAC,KAAK,KAAK,EAAE;IAC5D,MAAM,IAAIH,cAAW,CAChB,qCAAoCH,KAAK,CAACM,aAAc,mDAAkD,EAC3G,0CAA0C,EAC1C;MACIF,KAAK,EAAEJ,KAAK,CAACM,aAAa;MAC1BD,gBAAgB,EAAEA;IACtB,CACJ,CAAC;EACL;AACJ,CAAC;AAACE,OAAA,CAAAT,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_isModelEndingAllowed","validateEndingAllowed","params","model","isModelEndingAllowed","singularApiName","WebinyError","input","disallowedEnding","pluralApiName","exports"],"sources":["endingAllowed.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { disallowedEnding, isModelEndingAllowed } from \"./isModelEndingAllowed\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateEndingAllowed = (params: Params): void => {\n const { model } = params;\n if (isModelEndingAllowed(model.singularApiName) === false) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_SINGULAR_API_NAME_ENDING_NOT_ALLOWED\",\n {\n input: model.singularApiName,\n disallowedEnding\n }\n );\n } else if (isModelEndingAllowed(model.pluralApiName) === false) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_PLURAL_API_NAME_NOT_ENDING_ALLOWED\",\n {\n input: model.pluralApiName,\n disallowedEnding: disallowedEnding\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAOO,MAAME,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAI,IAAAE,0CAAoB,EAACD,KAAK,CAACE,eAAe,CAAC,KAAK,KAAK,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,eAAgB,mDAAkD,EAC/G,4CAA4C,EAC5C;MACIE,KAAK,EAAEJ,KAAK,CAACE,eAAe;MAC5BG,gBAAgB,EAAhBA;IACJ,CACJ,CAAC;EACL,CAAC,MAAM,IAAI,IAAAJ,0CAAoB,EAACD,KAAK,CAACM,aAAa,CAAC,KAAK,KAAK,EAAE;IAC5D,MAAM,IAAIH,cAAW,CAChB,qCAAoCH,KAAK,CAACM,aAAc,mDAAkD,EAC3G,0CAA0C,EAC1C;MACIF,KAAK,EAAEJ,KAAK,CAACM,aAAa;MAC1BD,gBAAgB,EAAEA;IACtB,CACJ,CAAC;EACL;AACJ,CAAC;AAACE,OAAA,CAAAT,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -8,8 +8,7 @@ exports.isModelEndingAllowed = exports.disallowedEnding = void 0;
|
|
|
8
8
|
* This list is to disallow creating models that might interfere with GraphQL schema creation.
|
|
9
9
|
* Add more if required.
|
|
10
10
|
*/
|
|
11
|
-
const disallowedEnding = ["Response", "List", "Meta", "Input", "Sorter", "RefType"];
|
|
12
|
-
exports.disallowedEnding = disallowedEnding;
|
|
11
|
+
const disallowedEnding = exports.disallowedEnding = ["Response", "List", "Meta", "Input", "Sorter", "RefType"];
|
|
13
12
|
const isModelEndingAllowed = apiName => {
|
|
14
13
|
for (const ending of disallowedEnding) {
|
|
15
14
|
const re = new RegExp(`${ending}$`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["disallowedEnding","exports","isModelEndingAllowed","apiName","ending","re","RegExp","matched","match"],"sources":["isModelEndingAllowed.ts"],"sourcesContent":["/**\n * This list is to disallow creating models that might interfere with GraphQL schema creation.\n * Add more if required.\n */\nexport const disallowedEnding: string[] = [\n \"Response\",\n \"List\",\n \"Meta\",\n \"Input\",\n \"Sorter\",\n \"RefType\"\n];\n\nexport const isModelEndingAllowed = (apiName: string): boolean => {\n for (const ending of disallowedEnding) {\n const re = new RegExp(`${ending}$`);\n const matched = apiName.match(re);\n if (matched === null) {\n continue;\n }\n return false;\n }\n return true;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,gBAA0B,GAAG,CACtC,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,CACZ;
|
|
1
|
+
{"version":3,"names":["disallowedEnding","exports","isModelEndingAllowed","apiName","ending","re","RegExp","matched","match"],"sources":["isModelEndingAllowed.ts"],"sourcesContent":["/**\n * This list is to disallow creating models that might interfere with GraphQL schema creation.\n * Add more if required.\n */\nexport const disallowedEnding: string[] = [\n \"Response\",\n \"List\",\n \"Meta\",\n \"Input\",\n \"Sorter\",\n \"RefType\"\n];\n\nexport const isModelEndingAllowed = (apiName: string): boolean => {\n for (const ending of disallowedEnding) {\n const re = new RegExp(`${ending}$`);\n const matched = apiName.match(re);\n if (matched === null) {\n continue;\n }\n return false;\n }\n return true;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,gBAA0B,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CACtC,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,CACZ;AAEM,MAAME,oBAAoB,GAAIC,OAAe,IAAc;EAC9D,KAAK,MAAMC,MAAM,IAAIJ,gBAAgB,EAAE;IACnC,MAAMK,EAAE,GAAG,IAAIC,MAAM,CAAE,GAAEF,MAAO,GAAE,CAAC;IACnC,MAAMG,OAAO,GAAGJ,OAAO,CAACK,KAAK,CAACH,EAAE,CAAC;IACjC,IAAIE,OAAO,KAAK,IAAI,EAAE;MAClB;IACJ;IACA,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC;AAACN,OAAA,CAAAC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","disallowedModelIdList","isModelIdAllowed","modelId","includes","validateModelIdAllowed","params","model","WebinyError","input","exports","validateExistingModelId","existingModel"],"sources":["modelId.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\nconst disallowedModelIdList: string[] = [\n \"contentModel\",\n \"contentModels\",\n \"contentModelGroup\",\n \"contentModelGroups\"\n];\nconst isModelIdAllowed = (modelId: string): boolean => {\n return disallowedModelIdList.includes(modelId) === false;\n};\n\ninterface ModelIdAllowedParams {\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateModelIdAllowed = (params: ModelIdAllowedParams) => {\n const { model } = params;\n if (isModelIdAllowed(model.modelId)) {\n return;\n }\n throw new WebinyError(\n `Provided model ID \"${model.modelId}\" is not allowed.`,\n \"MODEL_ID_NOT_ALLOWED\",\n {\n input: model.modelId\n }\n );\n};\n\ninterface Params {\n existingModel: Pick<CmsModel, \"modelId\">;\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateExistingModelId = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.modelId === model.modelId) {\n throw new WebinyError(\n `Content model with modelId \"${model.modelId}\" already exists.`,\n \"MODEL_ID_EXISTS\",\n {\n input: existingModel.modelId\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,MAAMC,qBAA+B,GAAG,CACpC,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,CACvB;AACD,MAAMC,gBAAgB,GAAIC,OAAe,IAAc;EACnD,OAAOF,qBAAqB,CAACG,QAAQ,CAACD,OAAO,CAAC,KAAK,KAAK;AAC5D,CAAC;AAMM,MAAME,sBAAsB,GAAIC,MAA4B,IAAK;EACpE,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAIJ,gBAAgB,CAACK,KAAK,CAACJ,OAAO,CAAC,EAAE;IACjC;EACJ;EACA,MAAM,IAAIK,cAAW,CAChB,sBAAqBD,KAAK,CAACJ,OAAQ,mBAAkB,EACtD,sBAAsB,EACtB;IACIM,KAAK,EAAEF,KAAK,CAACJ;EACjB,CACJ,CAAC;AACL,CAAC;AAACO,OAAA,CAAAL,sBAAA,GAAAA,sBAAA;AAOK,MAAMM,uBAAuB,GAAIL,MAAc,IAAW;EAC7D,MAAM;IAAEM,aAAa;IAAEL;EAAM,CAAC,GAAGD,MAAM;EAEvC,IAAIM,aAAa,CAACT,OAAO,KAAKI,KAAK,CAACJ,OAAO,EAAE;IACzC,MAAM,IAAIK,cAAW,CAChB,+BAA8BD,KAAK,CAACJ,OAAQ,mBAAkB,EAC/D,iBAAiB,EACjB;MACIM,KAAK,EAAEG,aAAa,CAACT;IACzB,CACJ,CAAC;EACL;AACJ,CAAC;AAACO,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","disallowedModelIdList","isModelIdAllowed","modelId","includes","validateModelIdAllowed","params","model","WebinyError","input","exports","validateExistingModelId","existingModel"],"sources":["modelId.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\nconst disallowedModelIdList: string[] = [\n \"contentModel\",\n \"contentModels\",\n \"contentModelGroup\",\n \"contentModelGroups\"\n];\nconst isModelIdAllowed = (modelId: string): boolean => {\n return disallowedModelIdList.includes(modelId) === false;\n};\n\ninterface ModelIdAllowedParams {\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateModelIdAllowed = (params: ModelIdAllowedParams) => {\n const { model } = params;\n if (isModelIdAllowed(model.modelId)) {\n return;\n }\n throw new WebinyError(\n `Provided model ID \"${model.modelId}\" is not allowed.`,\n \"MODEL_ID_NOT_ALLOWED\",\n {\n input: model.modelId\n }\n );\n};\n\ninterface Params {\n existingModel: Pick<CmsModel, \"modelId\">;\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateExistingModelId = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.modelId === model.modelId) {\n throw new WebinyError(\n `Content model with modelId \"${model.modelId}\" already exists.`,\n \"MODEL_ID_EXISTS\",\n {\n input: existingModel.modelId\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,MAAMC,qBAA+B,GAAG,CACpC,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,CACvB;AACD,MAAMC,gBAAgB,GAAIC,OAAe,IAAc;EACnD,OAAOF,qBAAqB,CAACG,QAAQ,CAACD,OAAO,CAAC,KAAK,KAAK;AAC5D,CAAC;AAMM,MAAME,sBAAsB,GAAIC,MAA4B,IAAK;EACpE,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAIJ,gBAAgB,CAACK,KAAK,CAACJ,OAAO,CAAC,EAAE;IACjC;EACJ;EACA,MAAM,IAAIK,cAAW,CAChB,sBAAqBD,KAAK,CAACJ,OAAQ,mBAAkB,EACtD,sBAAsB,EACtB;IACIM,KAAK,EAAEF,KAAK,CAACJ;EACjB,CACJ,CAAC;AACL,CAAC;AAACO,OAAA,CAAAL,sBAAA,GAAAA,sBAAA;AAOK,MAAMM,uBAAuB,GAAIL,MAAc,IAAW;EAC7D,MAAM;IAAEM,aAAa;IAAEL;EAAM,CAAC,GAAGD,MAAM;EAEvC,IAAIM,aAAa,CAACT,OAAO,KAAKI,KAAK,CAACJ,OAAO,EAAE;IACzC,MAAM,IAAIK,cAAW,CAChB,+BAA8BD,KAAK,CAACJ,OAAQ,mBAAkB,EAC/D,iBAAiB,EACjB;MACIM,KAAK,EAAEG,aAAa,CAACT;IACzB,CACJ,CAAC;EACL;AACJ,CAAC;AAACO,OAAA,CAAAC,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","validatePluralApiName","params","existingModel","model","singularApiName","pluralApiName","WebinyError","input","exports"],"sources":["pluralApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validatePluralApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n } else if (existingModel.pluralApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACE,aAAa,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,aAAc,mBAAkB,EAC7E,gCAAgC,EAChC;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIH,aAAa,CAACG,aAAa,KAAKF,KAAK,CAACE,aAAa,EAAE;IAC5D,MAAM,IAAIC,cAAW,CAChB,qCAAoCH,KAAK,CAACE,aAAc,mBAAkB,EAC3E,8BAA8B,EAC9B;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACG,OAAA,CAAAR,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","validatePluralApiName","params","existingModel","model","singularApiName","pluralApiName","WebinyError","input","exports"],"sources":["pluralApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validatePluralApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n } else if (existingModel.pluralApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACE,aAAa,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,aAAc,mBAAkB,EAC7E,gCAAgC,EAChC;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIH,aAAa,CAACG,aAAa,KAAKF,KAAK,CAACE,aAAa,EAAE;IAC5D,MAAM,IAAIC,cAAW,CAChB,qCAAoCH,KAAK,CAACE,aAAc,mBAAkB,EAC3E,8BAA8B,EAC9B;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACG,OAAA,CAAAR,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","validateSingularApiName","params","existingModel","model","singularApiName","WebinyError","input","pluralApiName","exports"],"sources":["singularApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateSingularApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n } else if (existingModel.pluralApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,uBAAuB,GAAIC,MAAc,IAAW;EAC7D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACC,eAAe,EAAE;IACzD,MAAM,IAAIC,cAAW,CAChB,uCAAsCF,KAAK,CAACC,eAAgB,mBAAkB,EAC/E,gCAAgC,EAChC;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIF,aAAa,CAACK,aAAa,KAAKJ,KAAK,CAACC,eAAe,EAAE;IAC9D,MAAM,IAAIC,cAAW,CAChB,qCAAoCF,KAAK,CAACC,eAAgB,mBAAkB,EAC7E,8BAA8B,EAC9B;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACI,OAAA,CAAAR,uBAAA,GAAAA,uBAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","validateSingularApiName","params","existingModel","model","singularApiName","WebinyError","input","pluralApiName","exports"],"sources":["singularApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateSingularApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n } else if (existingModel.pluralApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,uBAAuB,GAAIC,MAAc,IAAW;EAC7D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACC,eAAe,EAAE;IACzD,MAAM,IAAIC,cAAW,CAChB,uCAAsCF,KAAK,CAACC,eAAgB,mBAAkB,EAC/E,gCAAgC,EAChC;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIF,aAAa,CAACK,aAAa,KAAKJ,KAAK,CAACC,eAAe,EAAE;IAC9D,MAAM,IAAIC,cAAW,CAChB,qCAAoCF,KAAK,CAACC,eAAgB,mBAAkB,EAC7E,8BAA8B,EAC9B;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACI,OAAA,CAAAR,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsModelPlugin","_validateModelFields","validateModel","params","model","context","plugins","modelPlugin","byType","CmsModelPlugin","type","find","item","contentModel","modelId","WebinyError","validateModelFields","exports"],"sources":["validateModel.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { CmsContext, CmsModel } from \"~/types\";\nimport { validateModelFields } from \"./validateModelFields\";\n\ninterface ValidateModelParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModel = async (params: ValidateModelParams): Promise<void> => {\n const { model, context } = params;\n\n const { plugins } = context;\n\n const modelPlugin = plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n .find(item => item.contentModel.modelId === model.modelId);\n\n if (modelPlugin) {\n throw new WebinyError(\n \"Content models defined via plugins cannot be updated.\",\n \"CONTENT_MODEL_UPDATE_ERROR\",\n {\n modelId: model.modelId\n }\n );\n }\n\n await validateModelFields(params);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AASO,MAAMG,aAAa,GAAG,MAAOC,MAA2B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAEjC,MAAM;IAAEG;EAAQ,CAAC,GAAGD,OAAO;EAE3B,MAAME,WAAW,GAAGD,OAAO,CACtBE,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,YAAY,CAACC,OAAO,KAAKV,KAAK,CAACU,OAAO,CAAC;EAE9D,IAAIP,WAAW,EAAE;IACb,MAAM,IAAIQ,cAAW,CACjB,uDAAuD,EACvD,4BAA4B,EAC5B;MACID,OAAO,EAAEV,KAAK,CAACU;IACnB,CACJ,CAAC;EACL;EAEA,MAAM,IAAAE,wCAAmB,EAACb,MAAM,CAAC;AACrC,CAAC;AAACc,OAAA,CAAAf,aAAA,GAAAA,aAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsModelPlugin","_validateModelFields","validateModel","params","model","context","plugins","modelPlugin","byType","CmsModelPlugin","type","find","item","contentModel","modelId","WebinyError","validateModelFields","exports"],"sources":["validateModel.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { CmsContext, CmsModel } from \"~/types\";\nimport { validateModelFields } from \"./validateModelFields\";\n\ninterface ValidateModelParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModel = async (params: ValidateModelParams): Promise<void> => {\n const { model, context } = params;\n\n const { plugins } = context;\n\n const modelPlugin = plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n .find(item => item.contentModel.modelId === model.modelId);\n\n if (modelPlugin) {\n throw new WebinyError(\n \"Content models defined via plugins cannot be updated.\",\n \"CONTENT_MODEL_UPDATE_ERROR\",\n {\n modelId: model.modelId\n }\n );\n }\n\n await validateModelFields(params);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AASO,MAAMG,aAAa,GAAG,MAAOC,MAA2B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAEjC,MAAM;IAAEG;EAAQ,CAAC,GAAGD,OAAO;EAE3B,MAAME,WAAW,GAAGD,OAAO,CACtBE,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,YAAY,CAACC,OAAO,KAAKV,KAAK,CAACU,OAAO,CAAC;EAE9D,IAAIP,WAAW,EAAE;IACb,MAAM,IAAIQ,cAAW,CACjB,uDAAuD,EACvD,4BAA4B,EAC5B;MACID,OAAO,EAAEV,KAAK,CAACU;IACnB,CACJ,CAAC;EACL;EAEA,MAAM,IAAAE,wCAAmB,EAACb,MAAM,CAAC;AACrC,CAAC;AAACc,OAAA,CAAAf,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_error","_createManageSDL","_createFieldStorageId","_getBaseFieldType","_titleField","_descriptionField","_imageField","_plugins","_buildSchemaPlugins","_createExecutableSchema","_utils","extractInvalidField","model","err","sdl","source","body","line","lineNumber","locations","sdlLines","split","sdlLine","gqlType","i","includes","match","invalidField","undefined","Array","isArray","fieldRegex","RegExp","matched","message","data","modelId","code","join","createValidateChildFields","plugins","fields","originalFields","length","validateFields","lockedFields","params","idList","fieldIdList","storageIdList","field","baseType","getBaseFieldType","plugin","find","fieldType","Error","id","WebinyError","storageId","fieldId","push","originalField","f","isLocked","some","lockedField","createFieldStorageId","label","validateChildFields","validate","createGraphQLSchema","context","models","security","withoutAuthorization","cms","listModels","filter","isPrivate","modelPlugins","buildSchemaPlugins","concat","byType","CmsGraphQLSchemaPlugin","type","reduce","collection","name","generateAlphaNumericId","createExecutableSchema","Object","values","extractErrorObject","error","output","key","validateModelFields","original","titleFieldId","descriptionFieldId","imageFieldId","fieldTypePlugins","sorterPlugins","CmsGraphQLSchemaSorterPlugin","schema","createManageSDL","acc","pl","gql","getContentModelTitleFieldId","getContentModelDescriptionFieldId","getContentModelImageFieldId","cmsLockedFieldPlugins","existingField","item","Boolean","multipleValues","reason","lockedFieldType","existingFieldType","lockedFieldsByType","checkLockedField","exports"],"sources":["validateModelFields.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport WebinyError from \"@webiny/error\";\nimport {\n CmsModel,\n CmsContext,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldToGraphQLPluginValidateChildFieldsValidate,\n CmsModelLockedFieldPlugin,\n LockedField\n} from \"~/types\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL\";\nimport { createFieldStorageId } from \"./createFieldStorageId\";\nimport { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { getContentModelTitleFieldId } from \"./fields/titleField\";\nimport { getContentModelDescriptionFieldId } from \"./fields/descriptionField\";\nimport { getContentModelImageFieldId } from \"./fields/imageField\";\nimport { CmsGraphQLSchemaPlugin, CmsGraphQLSchemaSorterPlugin } from \"~/plugins\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n plugins: CmsModelFieldToGraphQLPlugin[]\n): CmsModelFieldToGraphQLPluginValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n plugins,\n lockedFields: []\n });\n };\n};\n\ninterface ValidateFieldsParams {\n plugins: CmsModelFieldToGraphQLPlugin[];\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n lockedFields: LockedField[];\n}\n\nconst validateFields = (params: ValidateFieldsParams) => {\n const { plugins, fields, originalFields, lockedFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const plugin = plugins.find(plugin => plugin.fieldType === baseType);\n\n if (!plugin) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n const isLocked = lockedFields.some(lockedField => {\n return lockedField.fieldId === field.storageId || lockedField.fieldId === field.fieldId;\n });\n if (!field.storageId) {\n /**\n * In case field is locked, we must set the storageId to the fieldId value.\n * This should not happen, because we upgrade all the fields in 5.33.0, but let's have a check just in case of some upgrade miss.\n */\n //\n if (isLocked) {\n field.storageId = field.fieldId;\n }\n /**\n * When having original field, just set the storageId to value from the originalField\n */\n //\n else if (originalField) {\n field.storageId = originalField.storageId;\n }\n /**\n * The last case is when no original field and not locked - so this is a completely new field.\n */\n //\n else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!plugin.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(plugins);\n plugin.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\n\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter((model): model is CmsModel => {\n return model.isPrivate !== true;\n });\n });\n\n const modelPlugins = await buildSchemaPlugins({\n context,\n models: models.concat([model])\n });\n\n const plugins = context.plugins\n .byType<CmsGraphQLSchemaPlugin>(CmsGraphQLSchemaPlugin.type)\n .reduce<Record<string, CmsGraphQLSchemaPlugin>>((collection, plugin) => {\n const name =\n plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;\n collection[name] = plugin;\n return collection;\n }, {});\n for (const plugin of modelPlugins) {\n const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;\n plugins[name] = plugin;\n }\n\n return createExecutableSchema({\n plugins: Object.values(plugins)\n });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { models, model, original, context } = params;\n const { titleFieldId, descriptionFieldId, imageFieldId } = model;\n const { plugins } = context;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [], lockedFields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldTypePlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n lockedFields,\n plugins: fieldTypePlugins\n });\n\n if (fields.length) {\n const sorterPlugins = plugins.byType<CmsGraphQLSchemaSorterPlugin>(\n CmsGraphQLSchemaSorterPlugin.type\n );\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n models,\n model,\n fieldTypePlugins: fieldTypePlugins.reduce(\n (acc, pl) => ({ ...acc, [pl.fieldType]: pl }),\n {}\n ),\n sorterPlugins\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n /**\n *\n */\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);\n model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);\n\n const cmsLockedFieldPlugins =\n plugins.byType<CmsModelLockedFieldPlugin>(\"cms-model-locked-field\");\n\n /**\n * We must not allow removal or changes in fields that are already in use in content entries.\n * Locked fields still have fieldId (should be storageId) because of the old existing locked fields in the models.\n */\n for (const lockedField of lockedFields) {\n const existingField = fields.find(item => item.storageId === lockedField.fieldId);\n\n /**\n * Starting with 5.33.0 fields can be deleted.\n * Our UI gives a warning upon locked field deletion, but if user is managing fields through API directly - we cannot do anything.\n */\n if (!existingField) {\n continue;\n }\n\n if (Boolean(lockedField.multipleValues) !== Boolean(existingField.multipleValues)) {\n throw new WebinyError(\n `Cannot change \"multipleValues\" for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"multipleValues\" changed`,\n field: existingField\n }\n );\n }\n\n const fieldType = getBaseFieldType(existingField);\n if (lockedField.type !== fieldType) {\n throw new WebinyError(\n `Cannot change field type for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"type\" changed`,\n lockedFieldType: lockedField.type,\n existingFieldType: fieldType\n }\n );\n }\n\n /**\n * Check `lockedField` invariant for specific field\n */\n const lockedFieldsByType = cmsLockedFieldPlugins.filter(\n pl => pl.fieldType === getBaseFieldType(lockedField)\n );\n for (const plugin of lockedFieldsByType) {\n if (typeof plugin.checkLockedField !== \"function\") {\n continue;\n }\n plugin.checkLockedField({\n lockedField,\n field: existingField\n });\n }\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAUA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAEA,MAAMY,mBAAmB,GAAGA,CAACC,KAAe,EAAEC,GAAiB,KAAK;EAChE,MAAMC,GAAG,GAAGD,GAAG,CAACE,MAAM,EAAEC,IAAI,IAAI,EAAE;;EAElC;AACJ;AACA;EACI,MAAM;IAAEC,IAAI,EAAEC;EAAW,CAAC,GAAGL,GAAG,CAACM,SAAS,GACpCN,GAAG,CAACM,SAAS,CAAC,CAAC,CAAC,GAChB;IACIF,IAAI,EAAE;EACV,CAAC;EACP,MAAMG,QAAQ,GAAGN,GAAG,CAACO,KAAK,CAAC,IAAI,CAAC;EAChC,IAAIC,OAAO;EAC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OAAO,CAAC;;IAEjF;AACR;AACA;AACA;IACQ,IAAI,CAACsD,aAAa,EAAE;MAChB;IACJ;IAEA,IAAIE,OAAO,CAAClD,WAAW,CAACmD,cAAc,CAAC,KAAKD,OAAO,CAACF,aAAa,CAACG,cAAc,CAAC,EAAE;MAC/E,MAAM,IAAI3D,cAAW,CAChB,2CAA0CQ,WAAW,CAACN,OAAQ,yDAAwD,EACvH,kBAAkB,EAClB;QACI0D,MAAM,EAAG,0BAAyB;QAClCpE,KAAK,EAAEgE;MACX,CACJ,CAAC;IACL;IAEA,MAAM3D,SAAS,GAAG,IAAAH,kCAAgB,EAAC8D,aAAa,CAAC;IACjD,IAAIhD,WAAW,CAACmB,IAAI,KAAK9B,SAAS,EAAE;MAChC,MAAM,IAAIG,cAAW,CAChB,qCAAoCQ,WAAW,CAACN,OAAQ,yDAAwD,EACjH,kBAAkB,EAClB;QACI0D,MAAM,EAAG,gBAAe;QACxBC,eAAe,EAAErD,WAAW,CAACmB,IAAI;QACjCmC,iBAAiB,EAAEjE;MACvB,CACJ,CAAC;IACL;;IAEA;AACR;AACA;IACQ,MAAMkE,kBAAkB,GAAGR,qBAAqB,CAACnC,MAAM,CACnD8B,EAAE,IAAIA,EAAE,CAACrD,SAAS,KAAK,IAAAH,kCAAgB,EAACc,WAAW,CACvD,CAAC;IACD,KAAK,MAAMb,MAAM,IAAIoE,kBAAkB,EAAE;MACrC,IAAI,OAAOpE,MAAM,CAACqE,gBAAgB,KAAK,UAAU,EAAE;QAC/C;MACJ;MACArE,MAAM,CAACqE,gBAAgB,CAAC;QACpBxD,WAAW;QACXhB,KAAK,EAAEgE;MACX,CAAC,CAAC;IACN;EACJ;AACJ,CAAC;AAACS,OAAA,CAAA1B,mBAAA,GAAAA,mBAAA"}
|
|
1
|
+
{"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_error","_createManageSDL","_createFieldStorageId","_getBaseFieldType","_titleField","_descriptionField","_imageField","_plugins","_buildSchemaPlugins","_createExecutableSchema","_utils","extractInvalidField","model","err","sdl","source","body","line","lineNumber","locations","sdlLines","split","sdlLine","gqlType","i","includes","match","invalidField","undefined","Array","isArray","fieldRegex","RegExp","matched","message","data","modelId","code","join","createValidateChildFields","plugins","fields","originalFields","length","validateFields","lockedFields","params","idList","fieldIdList","storageIdList","field","baseType","getBaseFieldType","plugin","find","fieldType","Error","id","WebinyError","storageId","fieldId","push","originalField","f","isLocked","some","lockedField","createFieldStorageId","label","validateChildFields","validate","createGraphQLSchema","context","models","security","withoutAuthorization","cms","listModels","filter","isPrivate","modelPlugins","buildSchemaPlugins","concat","byType","CmsGraphQLSchemaPlugin","type","reduce","collection","name","generateAlphaNumericId","createExecutableSchema","Object","values","extractErrorObject","error","output","key","validateModelFields","original","titleFieldId","descriptionFieldId","imageFieldId","fieldTypePlugins","sorterPlugins","CmsGraphQLSchemaSorterPlugin","schema","createManageSDL","acc","pl","gql","getContentModelTitleFieldId","getContentModelDescriptionFieldId","getContentModelImageFieldId","cmsLockedFieldPlugins","existingField","item","Boolean","multipleValues","reason","lockedFieldType","existingFieldType","lockedFieldsByType","checkLockedField","exports"],"sources":["validateModelFields.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport WebinyError from \"@webiny/error\";\nimport {\n CmsContext,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldToGraphQLPluginValidateChildFieldsValidate,\n CmsModelLockedFieldPlugin,\n LockedField\n} from \"~/types\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL\";\nimport { createFieldStorageId } from \"./createFieldStorageId\";\nimport { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { getContentModelTitleFieldId } from \"./fields/titleField\";\nimport { getContentModelDescriptionFieldId } from \"./fields/descriptionField\";\nimport { getContentModelImageFieldId } from \"./fields/imageField\";\nimport {\n CmsGraphQLSchemaPlugin,\n CmsGraphQLSchemaSorterPlugin,\n ICmsGraphQLSchemaPlugin\n} from \"~/plugins\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n plugins: CmsModelFieldToGraphQLPlugin[]\n): CmsModelFieldToGraphQLPluginValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n plugins,\n lockedFields: []\n });\n };\n};\n\ninterface ValidateFieldsParams {\n plugins: CmsModelFieldToGraphQLPlugin[];\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n lockedFields: LockedField[];\n}\n\nconst validateFields = (params: ValidateFieldsParams) => {\n const { plugins, fields, originalFields, lockedFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const plugin = plugins.find(plugin => plugin.fieldType === baseType);\n\n if (!plugin) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n const isLocked = lockedFields.some(lockedField => {\n return lockedField.fieldId === field.storageId || lockedField.fieldId === field.fieldId;\n });\n if (!field.storageId) {\n /**\n * In case field is locked, we must set the storageId to the fieldId value.\n * This should not happen, because we upgrade all the fields in 5.33.0, but let's have a check just in case of some upgrade miss.\n */\n //\n if (isLocked) {\n field.storageId = field.fieldId;\n }\n /**\n * When having original field, just set the storageId to value from the originalField\n */\n //\n else if (originalField) {\n field.storageId = originalField.storageId;\n }\n /**\n * The last case is when no original field and not locked - so this is a completely new field.\n */\n //\n else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!plugin.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(plugins);\n plugin.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\n\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter((model): model is CmsModel => {\n return model.isPrivate !== true;\n });\n });\n\n const modelPlugins = await buildSchemaPlugins({\n context,\n models: models.concat([model])\n });\n\n const plugins = context.plugins\n .byType<ICmsGraphQLSchemaPlugin>(CmsGraphQLSchemaPlugin.type)\n .reduce<Record<string, ICmsGraphQLSchemaPlugin>>((collection, plugin) => {\n const name =\n plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;\n collection[name] = plugin;\n return collection;\n }, {});\n for (const plugin of modelPlugins) {\n const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;\n plugins[name] = plugin;\n }\n\n return createExecutableSchema({\n plugins: Object.values(plugins)\n });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { models, model, original, context } = params;\n const { titleFieldId, descriptionFieldId, imageFieldId } = model;\n const { plugins } = context;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [], lockedFields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldTypePlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n lockedFields,\n plugins: fieldTypePlugins\n });\n\n if (fields.length) {\n const sorterPlugins = plugins.byType<CmsGraphQLSchemaSorterPlugin>(\n CmsGraphQLSchemaSorterPlugin.type\n );\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n models,\n model,\n fieldTypePlugins: fieldTypePlugins.reduce(\n (acc, pl) => ({ ...acc, [pl.fieldType]: pl }),\n {}\n ),\n sorterPlugins\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n /**\n *\n */\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);\n model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);\n\n const cmsLockedFieldPlugins =\n plugins.byType<CmsModelLockedFieldPlugin>(\"cms-model-locked-field\");\n\n /**\n * We must not allow removal or changes in fields that are already in use in content entries.\n * Locked fields still have fieldId (should be storageId) because of the old existing locked fields in the models.\n */\n for (const lockedField of lockedFields) {\n const existingField = fields.find(item => item.storageId === lockedField.fieldId);\n\n /**\n * Starting with 5.33.0 fields can be deleted.\n * Our UI gives a warning upon locked field deletion, but if user is managing fields through API directly - we cannot do anything.\n */\n if (!existingField) {\n continue;\n }\n\n if (Boolean(lockedField.multipleValues) !== Boolean(existingField.multipleValues)) {\n throw new WebinyError(\n `Cannot change \"multipleValues\" for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"multipleValues\" changed`,\n field: existingField\n }\n );\n }\n\n const fieldType = getBaseFieldType(existingField);\n if (lockedField.type !== fieldType) {\n throw new WebinyError(\n `Cannot change field type for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"type\" changed`,\n lockedFieldType: lockedField.type,\n existingFieldType: fieldType\n }\n );\n }\n\n /**\n * Check `lockedField` invariant for specific field\n */\n const lockedFieldsByType = cmsLockedFieldPlugins.filter(\n pl => pl.fieldType === getBaseFieldType(lockedField)\n );\n for (const plugin of lockedFieldsByType) {\n if (typeof plugin.checkLockedField !== \"function\") {\n continue;\n }\n plugin.checkLockedField({\n lockedField,\n field: existingField\n });\n }\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAUA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,mBAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAEA,MAAMY,mBAAmB,GAAGA,CAACC,KAAe,EAAEC,GAAiB,KAAK;EAChE,MAAMC,GAAG,GAAGD,GAAG,CAACE,MAAM,EAAEC,IA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,CAAC;QACpBxD,WAAW;QACXhB,KAAK,EAAEgE;MACX,CAAC,CAAC;IACN;EACJ;AACJ,CAAC;AAACS,OAAA,CAAA1B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateStorageId: (storageId: string) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.validateStorageId = void 0;
|
|
8
|
+
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
9
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
10
|
+
// We allow "@" because that's we use it with the `createModelField` function.
|
|
11
|
+
const VALID_STORAGE_ID_REGEX = /^([@a-zA-Z-0-9]+)$/;
|
|
12
|
+
const validateStorageId = storageId => {
|
|
13
|
+
if (!storageId.match(VALID_STORAGE_ID_REGEX)) {
|
|
14
|
+
const message = [`Invalid storageId provided ("${storageId}").`, 'Only alphanumeric characters and "@" are allowed.'].join(" ");
|
|
15
|
+
throw new _error.default(message, "STORAGE_ID_NOT_ALPHANUMERIC_ERROR");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// We must do this because in the process of camel casing, Lodash removes the `@`
|
|
19
|
+
// character from the string. For example, if we received `text@productName`, we
|
|
20
|
+
// would be doing the `text@productName` vs. `textProductName` (camel cased) comparison.
|
|
21
|
+
storageId = storageId.replace("@", "");
|
|
22
|
+
if (storageId !== (0, _camelCase.default)(storageId)) {
|
|
23
|
+
const message = [`Invalid storageId provided ("${storageId}").`, "Must be a camelCased string."].join(" ");
|
|
24
|
+
throw new _error.default(message, "STORAGE_ID_NOT_CAMEL_CASED_ERROR");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.validateStorageId = validateStorageId;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=validateStorageId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_camelCase","_interopRequireDefault","require","_error","VALID_STORAGE_ID_REGEX","validateStorageId","storageId","match","message","join","WebinyError","replace","lodashCamelCase","exports"],"sources":["validateStorageId.ts"],"sourcesContent":["import lodashCamelCase from \"lodash/camelCase\";\nimport WebinyError from \"@webiny/error\";\n\n// We allow \"@\" because that's we use it with the `createModelField` function.\nconst VALID_STORAGE_ID_REGEX = /^([@a-zA-Z-0-9]+)$/;\n\nexport const validateStorageId = (storageId: string) => {\n if (!storageId.match(VALID_STORAGE_ID_REGEX)) {\n const message = [\n `Invalid storageId provided (\"${storageId}\").`,\n 'Only alphanumeric characters and \"@\" are allowed.'\n ].join(\" \");\n\n throw new WebinyError(message, \"STORAGE_ID_NOT_ALPHANUMERIC_ERROR\");\n }\n\n // We must do this because in the process of camel casing, Lodash removes the `@`\n // character from the string. For example, if we received `text@productName`, we\n // would be doing the `text@productName` vs. `textProductName` (camel cased) comparison.\n storageId = storageId.replace(\"@\", \"\");\n\n if (storageId !== lodashCamelCase(storageId)) {\n const message = [\n `Invalid storageId provided (\"${storageId}\").`,\n \"Must be a camelCased string.\"\n ].join(\" \");\n\n throw new WebinyError(message, \"STORAGE_ID_NOT_CAMEL_CASED_ERROR\");\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA;AACA,MAAME,sBAAsB,GAAG,oBAAoB;AAE5C,MAAMC,iBAAiB,GAAIC,SAAiB,IAAK;EACpD,IAAI,CAACA,SAAS,CAACC,KAAK,CAACH,sBAAsB,CAAC,EAAE;IAC1C,MAAMI,OAAO,GAAG,CACX,gCAA+BF,SAAU,KAAI,EAC9C,mDAAmD,CACtD,CAACG,IAAI,CAAC,GAAG,CAAC;IAEX,MAAM,IAAIC,cAAW,CAACF,OAAO,EAAE,mCAAmC,CAAC;EACvE;;EAEA;EACA;EACA;EACAF,SAAS,GAAGA,SAAS,CAACK,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;EAEtC,IAAIL,SAAS,KAAK,IAAAM,kBAAe,EAACN,SAAS,CAAC,EAAE;IAC1C,MAAME,OAAO,GAAG,CACX,gCAA+BF,SAAU,KAAI,EAC9C,8BAA8B,CACjC,CAACG,IAAI,CAAC,GAAG,CAAC;IAEX,MAAM,IAAIC,cAAW,CAACF,OAAO,EAAE,kCAAkC,CAAC;EACtE;AACJ,CAAC;AAACK,OAAA,CAAAR,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -47,13 +47,16 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
|
|
|
47
47
|
selected?: boolean | undefined;
|
|
48
48
|
}[] | undefined;
|
|
49
49
|
}>>>;
|
|
50
|
-
renderer: zod.ZodOptional<zod.ZodObject<{
|
|
50
|
+
renderer: zod.ZodDefault<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{
|
|
51
51
|
name: zod.ZodString;
|
|
52
|
+
settings: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>>;
|
|
52
53
|
}, "strip", zod.ZodTypeAny, {
|
|
53
54
|
name: string;
|
|
55
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
54
56
|
}, {
|
|
55
57
|
name: string;
|
|
56
|
-
|
|
58
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
59
|
+
}>>>>;
|
|
57
60
|
validation: zod.ZodEffects<zod.ZodDefault<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodObject<{
|
|
58
61
|
name: zod.ZodString;
|
|
59
62
|
message: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
@@ -113,6 +116,10 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
|
|
|
113
116
|
label: string;
|
|
114
117
|
helpText: string | null;
|
|
115
118
|
placeholderText: string | null;
|
|
119
|
+
renderer: {
|
|
120
|
+
name: string;
|
|
121
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
122
|
+
} | null;
|
|
116
123
|
validation: {
|
|
117
124
|
name: string;
|
|
118
125
|
settings: {} & {
|
|
@@ -140,9 +147,6 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
|
|
|
140
147
|
}[];
|
|
141
148
|
enabled: boolean;
|
|
142
149
|
} | undefined;
|
|
143
|
-
renderer?: {
|
|
144
|
-
name: string;
|
|
145
|
-
} | undefined;
|
|
146
150
|
}, {
|
|
147
151
|
id: string;
|
|
148
152
|
type: string;
|
|
@@ -163,7 +167,8 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
|
|
|
163
167
|
} | undefined;
|
|
164
168
|
renderer?: {
|
|
165
169
|
name: string;
|
|
166
|
-
|
|
170
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
171
|
+
} | null | undefined;
|
|
167
172
|
validation?: {
|
|
168
173
|
name: string;
|
|
169
174
|
message?: string | undefined;
|
|
@@ -192,6 +197,10 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
|
|
|
192
197
|
label: string;
|
|
193
198
|
helpText: string | null;
|
|
194
199
|
placeholderText: string | null;
|
|
200
|
+
renderer: {
|
|
201
|
+
name: string;
|
|
202
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
203
|
+
} | null;
|
|
195
204
|
validation: {
|
|
196
205
|
name: string;
|
|
197
206
|
settings: {} & {
|
|
@@ -219,9 +228,6 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
|
|
|
219
228
|
}[];
|
|
220
229
|
enabled: boolean;
|
|
221
230
|
} | undefined;
|
|
222
|
-
renderer?: {
|
|
223
|
-
name: string;
|
|
224
|
-
} | undefined;
|
|
225
231
|
}[];
|
|
226
232
|
layout: string[][];
|
|
227
233
|
singularApiName: string;
|
|
@@ -263,7 +269,8 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
|
|
|
263
269
|
} | undefined;
|
|
264
270
|
renderer?: {
|
|
265
271
|
name: string;
|
|
266
|
-
|
|
272
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
273
|
+
} | null | undefined;
|
|
267
274
|
validation?: {
|
|
268
275
|
name: string;
|
|
269
276
|
message?: string | undefined;
|
|
@@ -331,13 +338,16 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
|
|
|
331
338
|
selected?: boolean | undefined;
|
|
332
339
|
}[] | undefined;
|
|
333
340
|
}>>>;
|
|
334
|
-
renderer: zod.ZodOptional<zod.ZodObject<{
|
|
341
|
+
renderer: zod.ZodDefault<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{
|
|
335
342
|
name: zod.ZodString;
|
|
343
|
+
settings: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>>;
|
|
336
344
|
}, "strip", zod.ZodTypeAny, {
|
|
337
345
|
name: string;
|
|
346
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
338
347
|
}, {
|
|
339
348
|
name: string;
|
|
340
|
-
|
|
349
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
350
|
+
}>>>>;
|
|
341
351
|
validation: zod.ZodEffects<zod.ZodDefault<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodObject<{
|
|
342
352
|
name: zod.ZodString;
|
|
343
353
|
message: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
@@ -397,6 +407,10 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
|
|
|
397
407
|
label: string;
|
|
398
408
|
helpText: string | null;
|
|
399
409
|
placeholderText: string | null;
|
|
410
|
+
renderer: {
|
|
411
|
+
name: string;
|
|
412
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
413
|
+
} | null;
|
|
400
414
|
validation: {
|
|
401
415
|
name: string;
|
|
402
416
|
settings: {} & {
|
|
@@ -424,9 +438,6 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
|
|
|
424
438
|
}[];
|
|
425
439
|
enabled: boolean;
|
|
426
440
|
} | undefined;
|
|
427
|
-
renderer?: {
|
|
428
|
-
name: string;
|
|
429
|
-
} | undefined;
|
|
430
441
|
}, {
|
|
431
442
|
id: string;
|
|
432
443
|
type: string;
|
|
@@ -447,7 +458,8 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
|
|
|
447
458
|
} | undefined;
|
|
448
459
|
renderer?: {
|
|
449
460
|
name: string;
|
|
450
|
-
|
|
461
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
462
|
+
} | null | undefined;
|
|
451
463
|
validation?: {
|
|
452
464
|
name: string;
|
|
453
465
|
message?: string | undefined;
|
|
@@ -475,6 +487,10 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
|
|
|
475
487
|
label: string;
|
|
476
488
|
helpText: string | null;
|
|
477
489
|
placeholderText: string | null;
|
|
490
|
+
renderer: {
|
|
491
|
+
name: string;
|
|
492
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
493
|
+
} | null;
|
|
478
494
|
validation: {
|
|
479
495
|
name: string;
|
|
480
496
|
settings: {} & {
|
|
@@ -502,9 +518,6 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
|
|
|
502
518
|
}[];
|
|
503
519
|
enabled: boolean;
|
|
504
520
|
} | undefined;
|
|
505
|
-
renderer?: {
|
|
506
|
-
name: string;
|
|
507
|
-
} | undefined;
|
|
508
521
|
}[];
|
|
509
522
|
layout: string[][];
|
|
510
523
|
singularApiName: string;
|
|
@@ -539,7 +552,8 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
|
|
|
539
552
|
} | undefined;
|
|
540
553
|
renderer?: {
|
|
541
554
|
name: string;
|
|
542
|
-
|
|
555
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
556
|
+
} | null | undefined;
|
|
543
557
|
validation?: {
|
|
544
558
|
name: string;
|
|
545
559
|
message?: string | undefined;
|
|
@@ -639,13 +653,16 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
|
|
|
639
653
|
selected?: boolean | undefined;
|
|
640
654
|
}[] | undefined;
|
|
641
655
|
}>>>;
|
|
642
|
-
renderer: zod.ZodOptional<zod.ZodObject<{
|
|
656
|
+
renderer: zod.ZodDefault<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{
|
|
643
657
|
name: zod.ZodString;
|
|
658
|
+
settings: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>>;
|
|
644
659
|
}, "strip", zod.ZodTypeAny, {
|
|
645
660
|
name: string;
|
|
661
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
646
662
|
}, {
|
|
647
663
|
name: string;
|
|
648
|
-
|
|
664
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
665
|
+
}>>>>;
|
|
649
666
|
validation: zod.ZodEffects<zod.ZodDefault<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodObject<{
|
|
650
667
|
name: zod.ZodString;
|
|
651
668
|
message: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
@@ -705,6 +722,10 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
|
|
|
705
722
|
label: string;
|
|
706
723
|
helpText: string | null;
|
|
707
724
|
placeholderText: string | null;
|
|
725
|
+
renderer: {
|
|
726
|
+
name: string;
|
|
727
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
728
|
+
} | null;
|
|
708
729
|
validation: {
|
|
709
730
|
name: string;
|
|
710
731
|
settings: {} & {
|
|
@@ -732,9 +753,6 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
|
|
|
732
753
|
}[];
|
|
733
754
|
enabled: boolean;
|
|
734
755
|
} | undefined;
|
|
735
|
-
renderer?: {
|
|
736
|
-
name: string;
|
|
737
|
-
} | undefined;
|
|
738
756
|
}, {
|
|
739
757
|
id: string;
|
|
740
758
|
type: string;
|
|
@@ -755,7 +773,8 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
|
|
|
755
773
|
} | undefined;
|
|
756
774
|
renderer?: {
|
|
757
775
|
name: string;
|
|
758
|
-
|
|
776
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
777
|
+
} | null | undefined;
|
|
759
778
|
validation?: {
|
|
760
779
|
name: string;
|
|
761
780
|
message?: string | undefined;
|
|
@@ -782,6 +801,10 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
|
|
|
782
801
|
label: string;
|
|
783
802
|
helpText: string | null;
|
|
784
803
|
placeholderText: string | null;
|
|
804
|
+
renderer: {
|
|
805
|
+
name: string;
|
|
806
|
+
settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
807
|
+
} | null;
|
|
785
808
|
validation: {
|
|
786
809
|
name: string;
|
|
787
810
|
settings: {} & {
|
|
@@ -809,9 +832,6 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
|
|
|
809
832
|
}[];
|
|
810
833
|
enabled: boolean;
|
|
811
834
|
} | undefined;
|
|
812
|
-
renderer?: {
|
|
813
|
-
name: string;
|
|
814
|
-
} | undefined;
|
|
815
835
|
}[];
|
|
816
836
|
layout: string[][];
|
|
817
837
|
name?: string | undefined;
|
|
@@ -845,7 +865,8 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
|
|
|
845
865
|
} | undefined;
|
|
846
866
|
renderer?: {
|
|
847
867
|
name: string;
|
|
848
|
-
|
|
868
|
+
settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
|
|
869
|
+
} | null | undefined;
|
|
849
870
|
validation?: {
|
|
850
871
|
name: string;
|
|
851
872
|
message?: string | undefined;
|
|
@@ -51,8 +51,9 @@ const fieldSchema = _zod.default.object({
|
|
|
51
51
|
values: []
|
|
52
52
|
}).optional(),
|
|
53
53
|
renderer: _zod.default.object({
|
|
54
|
-
name: shortString
|
|
55
|
-
|
|
54
|
+
name: shortString,
|
|
55
|
+
settings: _zod.default.object({}).passthrough().nullable().optional()
|
|
56
|
+
}).optional().nullable().default(null),
|
|
56
57
|
validation: _zod.default.array(_zod.default.object({
|
|
57
58
|
name: shortString,
|
|
58
59
|
message: optionalShortString.default("Value is required."),
|