@webiny/api-headless-cms-workflows 0.0.0-unstable.c27f4d8a31 → 0.0.0-unstable.d0f34a8194
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/CmsWorkflowsFeature.d.ts +4 -0
- package/CmsWorkflowsFeature.js +28 -0
- package/CmsWorkflowsFeature.js.map +1 -0
- package/domain/errors.d.ts +27 -0
- package/domain/errors.js +14 -0
- package/domain/errors.js.map +1 -0
- package/features/Workflows/feature.d.ts +4 -1
- package/features/Workflows/feature.js +8 -5
- package/features/Workflows/feature.js.map +1 -1
- package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.d.ts +18 -6
- package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.js +36 -24
- package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.js.map +1 -1
- package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeUpdate.d.ts +23 -0
- package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeUpdate.js +44 -0
- package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeUpdate.js.map +1 -0
- package/features/Workflows/index.js +0 -2
- package/features/hooks/BlockDeleteMultipleWhileInReview.d.ts +22 -0
- package/features/hooks/BlockDeleteMultipleWhileInReview.js +64 -0
- package/features/hooks/BlockDeleteMultipleWhileInReview.js.map +1 -0
- package/features/hooks/BlockDeleteWhileInReview.d.ts +18 -0
- package/features/hooks/BlockDeleteWhileInReview.js +45 -0
- package/features/hooks/BlockDeleteWhileInReview.js.map +1 -0
- package/features/hooks/BlockFolderChangeWhileInReview.d.ts +21 -0
- package/features/hooks/BlockFolderChangeWhileInReview.js +44 -0
- package/features/hooks/BlockFolderChangeWhileInReview.js.map +1 -0
- package/features/hooks/BlockMoveWhileInReview.d.ts +19 -0
- package/features/hooks/BlockMoveWhileInReview.js +46 -0
- package/features/hooks/BlockMoveWhileInReview.js.map +1 -0
- package/features/hooks/BlockRevisionDeleteWhileInReview.d.ts +17 -0
- package/features/hooks/BlockRevisionDeleteWhileInReview.js +46 -0
- package/features/hooks/BlockRevisionDeleteWhileInReview.js.map +1 -0
- package/features/hooks/BlockUpdateWhileInReview.d.ts +25 -0
- package/features/hooks/BlockUpdateWhileInReview.js +43 -0
- package/features/hooks/BlockUpdateWhileInReview.js.map +1 -0
- package/features/hooks/DeleteModelBoundToWorkflowDecorator.d.ts +22 -0
- package/features/hooks/DeleteModelBoundToWorkflowDecorator.js +52 -0
- package/features/hooks/DeleteModelBoundToWorkflowDecorator.js.map +1 -0
- package/features/hooks/DeleteModelTaskBoundToWorkflowDecorator.d.ts +27 -0
- package/features/hooks/DeleteModelTaskBoundToWorkflowDecorator.js +64 -0
- package/features/hooks/DeleteModelTaskBoundToWorkflowDecorator.js.map +1 -0
- package/features/hooks/DeleteReviewsOnEntriesDeleteMultiple.d.ts +19 -0
- package/features/hooks/DeleteReviewsOnEntriesDeleteMultiple.js +47 -0
- package/features/hooks/DeleteReviewsOnEntriesDeleteMultiple.js.map +1 -0
- package/features/hooks/DeleteReviewsOnEntryDelete.d.ts +19 -0
- package/features/hooks/DeleteReviewsOnEntryDelete.js +46 -0
- package/features/hooks/DeleteReviewsOnEntryDelete.js.map +1 -0
- package/features/hooks/DeleteReviewsOnRevisionDelete.d.ts +18 -0
- package/features/hooks/DeleteReviewsOnRevisionDelete.js +46 -0
- package/features/hooks/DeleteReviewsOnRevisionDelete.js.map +1 -0
- package/features/hooks/FullyDeleteModelBoundToWorkflowDecorator.d.ts +28 -0
- package/features/hooks/FullyDeleteModelBoundToWorkflowDecorator.js +63 -0
- package/features/hooks/FullyDeleteModelBoundToWorkflowDecorator.js.map +1 -0
- package/features/hooks/NullReviewStateOnRevisionCreate.d.ts +15 -0
- package/features/hooks/NullReviewStateOnRevisionCreate.js +17 -0
- package/features/hooks/NullReviewStateOnRevisionCreate.js.map +1 -0
- package/features/hooks/RequireApprovedReviewOnPublish.d.ts +22 -0
- package/features/hooks/RequireApprovedReviewOnPublish.js +43 -0
- package/features/hooks/RequireApprovedReviewOnPublish.js.map +1 -0
- package/features/hooks/RequireApprovedReviewOnRepublish.d.ts +23 -0
- package/features/hooks/RequireApprovedReviewOnRepublish.js +49 -0
- package/features/hooks/RequireApprovedReviewOnRepublish.js.map +1 -0
- package/features/hooks/feature.d.ts +8 -0
- package/features/hooks/feature.js +39 -0
- package/features/hooks/feature.js.map +1 -0
- package/features/target/CandidateFolderReadRules/CandidateFolderReadRules.d.ts +18 -0
- package/features/target/CandidateFolderReadRules/CandidateFolderReadRules.js +97 -0
- package/features/target/CandidateFolderReadRules/CandidateFolderReadRules.js.map +1 -0
- package/features/target/CandidateFolderReadRules/abstractions.d.ts +35 -0
- package/features/target/CandidateFolderReadRules/abstractions.js +5 -0
- package/features/target/CandidateFolderReadRules/abstractions.js.map +1 -0
- package/features/target/CandidateFolderReadRules/index.d.ts +1 -0
- package/features/target/CandidateFolderReadRules/index.js +1 -0
- package/features/target/CmsEntryAccess/CmsEntryAccess.d.ts +32 -0
- package/features/target/CmsEntryAccess/CmsEntryAccess.js +141 -0
- package/features/target/CmsEntryAccess/CmsEntryAccess.js.map +1 -0
- package/features/target/CmsEntryAccess/abstractions.d.ts +48 -0
- package/features/target/CmsEntryAccess/abstractions.js +5 -0
- package/features/target/CmsEntryAccess/abstractions.js.map +1 -0
- package/features/target/CmsEntryAccess/index.d.ts +2 -0
- package/features/target/CmsEntryAccess/index.js +2 -0
- package/features/target/CmsEntryAccess/unreadableCodes.d.ts +1 -0
- package/features/target/CmsEntryAccess/unreadableCodes.js +9 -0
- package/features/target/CmsEntryAccess/unreadableCodes.js.map +1 -0
- package/features/target/CmsEntryDeniedFolders/CmsEntryDeniedFolders.d.ts +21 -0
- package/features/target/CmsEntryDeniedFolders/CmsEntryDeniedFolders.js +66 -0
- package/features/target/CmsEntryDeniedFolders/CmsEntryDeniedFolders.js.map +1 -0
- package/features/target/CmsEntryDeniedFolders/abstractions.d.ts +23 -0
- package/features/target/CmsEntryDeniedFolders/abstractions.js +5 -0
- package/features/target/CmsEntryDeniedFolders/abstractions.js.map +1 -0
- package/features/target/CmsEntryDeniedFolders/index.d.ts +1 -0
- package/features/target/CmsEntryDeniedFolders/index.js +1 -0
- package/features/target/CmsEntryFolderExistsService/CmsEntryFolderExistsService.d.ts +18 -0
- package/features/target/CmsEntryFolderExistsService/CmsEntryFolderExistsService.js +43 -0
- package/features/target/CmsEntryFolderExistsService/CmsEntryFolderExistsService.js.map +1 -0
- package/features/target/CmsEntryFolderExistsService/abstractions.d.ts +23 -0
- package/features/target/CmsEntryFolderExistsService/abstractions.js +5 -0
- package/features/target/CmsEntryFolderExistsService/abstractions.js.map +1 -0
- package/features/target/CmsEntryFolderExistsService/index.d.ts +1 -0
- package/features/target/CmsEntryFolderExistsService/index.js +1 -0
- package/features/target/CmsEntryReviewNamespace/CmsModelReviewNamespace.d.ts +10 -0
- package/features/target/CmsEntryReviewNamespace/CmsModelReviewNamespace.js +14 -0
- package/features/target/CmsEntryReviewNamespace/CmsModelReviewNamespace.js.map +1 -0
- package/features/target/CmsEntryReviewNamespace/abstractions.d.ts +17 -0
- package/features/target/CmsEntryReviewNamespace/abstractions.js +5 -0
- package/features/target/CmsEntryReviewNamespace/abstractions.js.map +1 -0
- package/features/target/CmsEntryReviewNamespace/index.d.ts +1 -0
- package/features/target/CmsEntryReviewNamespace/index.js +1 -0
- package/features/target/CmsEntryReviewReadFilter/CmsEntryReviewReadFilter.d.ts +20 -0
- package/features/target/CmsEntryReviewReadFilter/CmsEntryReviewReadFilter.js +80 -0
- package/features/target/CmsEntryReviewReadFilter/CmsEntryReviewReadFilter.js.map +1 -0
- package/features/target/CmsEntryReviewReadFilter/abstractions.d.ts +24 -0
- package/features/target/CmsEntryReviewReadFilter/abstractions.js +5 -0
- package/features/target/CmsEntryReviewReadFilter/abstractions.js.map +1 -0
- package/features/target/CmsEntryReviewReadFilter/index.d.ts +1 -0
- package/features/target/CmsEntryReviewReadFilter/index.js +1 -0
- package/features/target/CmsEntryReviewTargetEditor.d.ts +28 -0
- package/features/target/CmsEntryReviewTargetEditor.js +128 -0
- package/features/target/CmsEntryReviewTargetEditor.js.map +1 -0
- package/features/target/CmsEntryReviewTargetFolderChain.d.ts +22 -0
- package/features/target/CmsEntryReviewTargetFolderChain.js +37 -0
- package/features/target/CmsEntryReviewTargetFolderChain.js.map +1 -0
- package/features/target/CmsEntryReviewTargetLink.d.ts +17 -0
- package/features/target/CmsEntryReviewTargetLink.js +18 -0
- package/features/target/CmsEntryReviewTargetLink.js.map +1 -0
- package/features/target/CmsEntryReviewTargetLoader.d.ts +16 -0
- package/features/target/CmsEntryReviewTargetLoader.js +29 -0
- package/features/target/CmsEntryReviewTargetLoader.js.map +1 -0
- package/features/target/CmsEntryReviewTargetReadAccess.d.ts +41 -0
- package/features/target/CmsEntryReviewTargetReadAccess.js +91 -0
- package/features/target/CmsEntryReviewTargetReadAccess.js.map +1 -0
- package/features/target/CmsEntryReviewTargetSync.d.ts +23 -0
- package/features/target/CmsEntryReviewTargetSync.js +42 -0
- package/features/target/CmsEntryReviewTargetSync.js.map +1 -0
- package/features/target/CmsEntryTargetReader/CmsEntryTargetReader.d.ts +27 -0
- package/features/target/CmsEntryTargetReader/CmsEntryTargetReader.js +81 -0
- package/features/target/CmsEntryTargetReader/CmsEntryTargetReader.js.map +1 -0
- package/features/target/CmsEntryTargetReader/abstractions.d.ts +40 -0
- package/features/target/CmsEntryTargetReader/abstractions.js +5 -0
- package/features/target/CmsEntryTargetReader/abstractions.js.map +1 -0
- package/features/target/CmsEntryTargetReader/index.d.ts +1 -0
- package/features/target/CmsEntryTargetReader/index.js +1 -0
- package/features/target/CmsModelGroupService/CmsModelGroupService.d.ts +12 -0
- package/features/target/CmsModelGroupService/CmsModelGroupService.js +25 -0
- package/features/target/CmsModelGroupService/CmsModelGroupService.js.map +1 -0
- package/features/target/CmsModelGroupService/abstractions.d.ts +24 -0
- package/features/target/CmsModelGroupService/abstractions.js +5 -0
- package/features/target/CmsModelGroupService/abstractions.js.map +1 -0
- package/features/target/CmsModelGroupService/index.d.ts +1 -0
- package/features/target/CmsModelGroupService/index.js +1 -0
- package/features/target/CmsWorkflowModelParser.d.ts +9 -0
- package/features/target/CmsWorkflowModelParser.js +18 -0
- package/features/target/CmsWorkflowModelParser.js.map +1 -0
- package/features/target/FolderReadRule.d.ts +9 -0
- package/features/target/FolderReadRule.js +0 -0
- package/features/target/WorkflowEntrySystemField.d.ts +13 -0
- package/features/target/WorkflowEntrySystemField.js +35 -0
- package/features/target/WorkflowEntrySystemField.js.map +1 -0
- package/features/target/feature.d.ts +5 -0
- package/features/target/feature.js +41 -0
- package/features/target/feature.js.map +1 -0
- package/features/target/getModelSafeValidationMessage.d.ts +11 -0
- package/features/target/getModelSafeValidationMessage.js +28 -0
- package/features/target/getModelSafeValidationMessage.js.map +1 -0
- package/features/target/isEditorFieldValue.d.ts +9 -0
- package/features/target/isEditorFieldValue.js +30 -0
- package/features/target/isEditorFieldValue.js.map +1 -0
- package/features/target/toCmsReviewTarget.d.ts +4 -0
- package/features/target/toCmsReviewTarget.js +26 -0
- package/features/target/toCmsReviewTarget.js.map +1 -0
- package/features/target/toEditorFields.d.ts +9 -0
- package/features/target/toEditorFields.js +48 -0
- package/features/target/toEditorFields.js.map +1 -0
- package/features/target/toEntryValuesPatch.d.ts +9 -0
- package/features/target/toEntryValuesPatch.js +31 -0
- package/features/target/toEntryValuesPatch.js.map +1 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/ApproveCmsEntryReviewStepUseCase.d.ts +13 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/ApproveCmsEntryReviewStepUseCase.js +35 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/ApproveCmsEntryReviewStepUseCase.js.map +1 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/abstractions.d.ts +26 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/abstractions.js +5 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/abstractions.js.map +1 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/feature.d.ts +4 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/feature.js +11 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/feature.js.map +1 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/index.d.ts +1 -0
- package/features/wrappers/ApproveCmsEntryReviewStep/index.js +1 -0
- package/features/wrappers/CancelCmsEntryReview/CancelCmsEntryReviewUseCase.d.ts +13 -0
- package/features/wrappers/CancelCmsEntryReview/CancelCmsEntryReviewUseCase.js +37 -0
- package/features/wrappers/CancelCmsEntryReview/CancelCmsEntryReviewUseCase.js.map +1 -0
- package/features/wrappers/CancelCmsEntryReview/abstractions.d.ts +30 -0
- package/features/wrappers/CancelCmsEntryReview/abstractions.js +5 -0
- package/features/wrappers/CancelCmsEntryReview/abstractions.js.map +1 -0
- package/features/wrappers/CancelCmsEntryReview/feature.d.ts +4 -0
- package/features/wrappers/CancelCmsEntryReview/feature.js +11 -0
- package/features/wrappers/CancelCmsEntryReview/feature.js.map +1 -0
- package/features/wrappers/CancelCmsEntryReview/index.d.ts +1 -0
- package/features/wrappers/CancelCmsEntryReview/index.js +1 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/CancelCmsEntryReviewsForDeleteUseCase.d.ts +19 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/CancelCmsEntryReviewsForDeleteUseCase.js +85 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/CancelCmsEntryReviewsForDeleteUseCase.js.map +1 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/abstractions.d.ts +41 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/abstractions.js +5 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/abstractions.js.map +1 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/feature.d.ts +4 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/feature.js +11 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/feature.js.map +1 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/index.d.ts +1 -0
- package/features/wrappers/CancelCmsEntryReviewsForDelete/index.js +1 -0
- package/features/wrappers/CmsEntryFolderExists/CmsEntryFolderExistsUseCase.d.ts +15 -0
- package/features/wrappers/CmsEntryFolderExists/CmsEntryFolderExistsUseCase.js +46 -0
- package/features/wrappers/CmsEntryFolderExists/CmsEntryFolderExistsUseCase.js.map +1 -0
- package/features/wrappers/CmsEntryFolderExists/abstractions.d.ts +29 -0
- package/features/wrappers/CmsEntryFolderExists/abstractions.js +5 -0
- package/features/wrappers/CmsEntryFolderExists/abstractions.js.map +1 -0
- package/features/wrappers/CmsEntryFolderExists/feature.d.ts +4 -0
- package/features/wrappers/CmsEntryFolderExists/feature.js +11 -0
- package/features/wrappers/CmsEntryFolderExists/feature.js.map +1 -0
- package/features/wrappers/CmsEntryFolderExists/index.d.ts +1 -0
- package/features/wrappers/CmsEntryFolderExists/index.js +1 -0
- package/features/wrappers/CmsEntryReviewGuardService/CmsEntryReviewGuardService.d.ts +17 -0
- package/features/wrappers/CmsEntryReviewGuardService/CmsEntryReviewGuardService.js +63 -0
- package/features/wrappers/CmsEntryReviewGuardService/CmsEntryReviewGuardService.js.map +1 -0
- package/features/wrappers/CmsEntryReviewGuardService/abstractions.d.ts +37 -0
- package/features/wrappers/CmsEntryReviewGuardService/abstractions.js +5 -0
- package/features/wrappers/CmsEntryReviewGuardService/abstractions.js.map +1 -0
- package/features/wrappers/CmsEntryReviewGuardService/index.d.ts +1 -0
- package/features/wrappers/CmsEntryReviewGuardService/index.js +1 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/DeleteCmsEntryWorkflowUseCase.d.ts +25 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/DeleteCmsEntryWorkflowUseCase.js +98 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/DeleteCmsEntryWorkflowUseCase.js.map +1 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/abstractions.d.ts +32 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/abstractions.js +5 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/abstractions.js.map +1 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/feature.d.ts +4 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/feature.js +11 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/feature.js.map +1 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/index.d.ts +1 -0
- package/features/wrappers/DeleteCmsEntryWorkflow/index.js +1 -0
- package/features/wrappers/GetCmsEntryReview/GetCmsEntryReviewUseCase.d.ts +13 -0
- package/features/wrappers/GetCmsEntryReview/GetCmsEntryReviewUseCase.js +40 -0
- package/features/wrappers/GetCmsEntryReview/GetCmsEntryReviewUseCase.js.map +1 -0
- package/features/wrappers/GetCmsEntryReview/abstractions.d.ts +28 -0
- package/features/wrappers/GetCmsEntryReview/abstractions.js +5 -0
- package/features/wrappers/GetCmsEntryReview/abstractions.js.map +1 -0
- package/features/wrappers/GetCmsEntryReview/feature.d.ts +4 -0
- package/features/wrappers/GetCmsEntryReview/feature.js +11 -0
- package/features/wrappers/GetCmsEntryReview/feature.js.map +1 -0
- package/features/wrappers/GetCmsEntryReview/index.d.ts +1 -0
- package/features/wrappers/GetCmsEntryReview/index.js +1 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/GetCmsEntryReviewStepRunUseCase.d.ts +13 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/GetCmsEntryReviewStepRunUseCase.js +39 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/GetCmsEntryReviewStepRunUseCase.js.map +1 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/abstractions.d.ts +33 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/abstractions.js +5 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/abstractions.js.map +1 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/feature.d.ts +4 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/feature.js +11 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/feature.js.map +1 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/index.d.ts +1 -0
- package/features/wrappers/GetCmsEntryReviewStepRun/index.js +1 -0
- package/features/wrappers/GetCmsEntryTargetReview/GetCmsEntryTargetReviewUseCase.d.ts +19 -0
- package/features/wrappers/GetCmsEntryTargetReview/GetCmsEntryTargetReviewUseCase.js +76 -0
- package/features/wrappers/GetCmsEntryTargetReview/GetCmsEntryTargetReviewUseCase.js.map +1 -0
- package/features/wrappers/GetCmsEntryTargetReview/abstractions.d.ts +36 -0
- package/features/wrappers/GetCmsEntryTargetReview/abstractions.js +5 -0
- package/features/wrappers/GetCmsEntryTargetReview/abstractions.js.map +1 -0
- package/features/wrappers/GetCmsEntryTargetReview/feature.d.ts +4 -0
- package/features/wrappers/GetCmsEntryTargetReview/feature.js +11 -0
- package/features/wrappers/GetCmsEntryTargetReview/feature.js.map +1 -0
- package/features/wrappers/GetCmsEntryTargetReview/index.d.ts +1 -0
- package/features/wrappers/GetCmsEntryTargetReview/index.js +1 -0
- package/features/wrappers/GetCmsEntryWorkflow/GetCmsEntryWorkflowUseCase.d.ts +13 -0
- package/features/wrappers/GetCmsEntryWorkflow/GetCmsEntryWorkflowUseCase.js +34 -0
- package/features/wrappers/GetCmsEntryWorkflow/GetCmsEntryWorkflowUseCase.js.map +1 -0
- package/features/wrappers/GetCmsEntryWorkflow/abstractions.d.ts +24 -0
- package/features/wrappers/GetCmsEntryWorkflow/abstractions.js +5 -0
- package/features/wrappers/GetCmsEntryWorkflow/abstractions.js.map +1 -0
- package/features/wrappers/GetCmsEntryWorkflow/feature.d.ts +4 -0
- package/features/wrappers/GetCmsEntryWorkflow/feature.js +11 -0
- package/features/wrappers/GetCmsEntryWorkflow/feature.js.map +1 -0
- package/features/wrappers/GetCmsEntryWorkflow/index.d.ts +1 -0
- package/features/wrappers/GetCmsEntryWorkflow/index.js +1 -0
- package/features/wrappers/InspectCmsEntryRouting/InspectCmsEntryRoutingUseCase.d.ts +19 -0
- package/features/wrappers/InspectCmsEntryRouting/InspectCmsEntryRoutingUseCase.js +54 -0
- package/features/wrappers/InspectCmsEntryRouting/InspectCmsEntryRoutingUseCase.js.map +1 -0
- package/features/wrappers/InspectCmsEntryRouting/abstractions.d.ts +37 -0
- package/features/wrappers/InspectCmsEntryRouting/abstractions.js +5 -0
- package/features/wrappers/InspectCmsEntryRouting/abstractions.js.map +1 -0
- package/features/wrappers/InspectCmsEntryRouting/feature.d.ts +4 -0
- package/features/wrappers/InspectCmsEntryRouting/feature.js +11 -0
- package/features/wrappers/InspectCmsEntryRouting/feature.js.map +1 -0
- package/features/wrappers/InspectCmsEntryRouting/index.d.ts +1 -0
- package/features/wrappers/InspectCmsEntryRouting/index.js +1 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/ListCmsEntryBlockingReviewsUseCase.d.ts +25 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/ListCmsEntryBlockingReviewsUseCase.js +109 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/ListCmsEntryBlockingReviewsUseCase.js.map +1 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/abstractions.d.ts +36 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/abstractions.js +6 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/abstractions.js.map +1 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/feature.d.ts +4 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/feature.js +11 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/feature.js.map +1 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/index.d.ts +1 -0
- package/features/wrappers/ListCmsEntryBlockingReviews/index.js +1 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/ListCmsEntryReviewStepCandidatesUseCase.d.ts +13 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/ListCmsEntryReviewStepCandidatesUseCase.js +41 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/ListCmsEntryReviewStepCandidatesUseCase.js.map +1 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/abstractions.d.ts +30 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/abstractions.js +5 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/abstractions.js.map +1 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/feature.d.ts +4 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/feature.js +11 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/feature.js.map +1 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/index.d.ts +1 -0
- package/features/wrappers/ListCmsEntryReviewStepCandidates/index.js +1 -0
- package/features/wrappers/ListCmsEntryReviews/ListCmsEntryReviewsUseCase.d.ts +17 -0
- package/features/wrappers/ListCmsEntryReviews/ListCmsEntryReviewsUseCase.js +85 -0
- package/features/wrappers/ListCmsEntryReviews/ListCmsEntryReviewsUseCase.js.map +1 -0
- package/features/wrappers/ListCmsEntryReviews/abstractions.d.ts +50 -0
- package/features/wrappers/ListCmsEntryReviews/abstractions.js +5 -0
- package/features/wrappers/ListCmsEntryReviews/abstractions.js.map +1 -0
- package/features/wrappers/ListCmsEntryReviews/feature.d.ts +4 -0
- package/features/wrappers/ListCmsEntryReviews/feature.js +11 -0
- package/features/wrappers/ListCmsEntryReviews/feature.js.map +1 -0
- package/features/wrappers/ListCmsEntryReviews/index.d.ts +1 -0
- package/features/wrappers/ListCmsEntryReviews/index.js +1 -0
- package/features/wrappers/ListCmsEntryStepCandidates/ListCmsEntryStepCandidatesUseCase.d.ts +25 -0
- package/features/wrappers/ListCmsEntryStepCandidates/ListCmsEntryStepCandidatesUseCase.js +83 -0
- package/features/wrappers/ListCmsEntryStepCandidates/ListCmsEntryStepCandidatesUseCase.js.map +1 -0
- package/features/wrappers/ListCmsEntryStepCandidates/abstractions.d.ts +41 -0
- package/features/wrappers/ListCmsEntryStepCandidates/abstractions.js +5 -0
- package/features/wrappers/ListCmsEntryStepCandidates/abstractions.js.map +1 -0
- package/features/wrappers/ListCmsEntryStepCandidates/feature.d.ts +4 -0
- package/features/wrappers/ListCmsEntryStepCandidates/feature.js +11 -0
- package/features/wrappers/ListCmsEntryStepCandidates/feature.js.map +1 -0
- package/features/wrappers/ListCmsEntryStepCandidates/index.d.ts +1 -0
- package/features/wrappers/ListCmsEntryStepCandidates/index.js +1 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/ListCmsEntryWorkflowModelsUseCase.d.ts +17 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/ListCmsEntryWorkflowModelsUseCase.js +106 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/ListCmsEntryWorkflowModelsUseCase.js.map +1 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/abstractions.d.ts +58 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/abstractions.js +5 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/abstractions.js.map +1 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/feature.d.ts +4 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/feature.js +11 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/feature.js.map +1 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/index.d.ts +2 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/index.js +1 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/modelListCursor.d.ts +8 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/modelListCursor.js +20 -0
- package/features/wrappers/ListCmsEntryWorkflowModels/modelListCursor.js.map +1 -0
- package/features/wrappers/ListCmsEntryWorkflows/ListCmsEntryWorkflowsUseCase.d.ts +17 -0
- package/features/wrappers/ListCmsEntryWorkflows/ListCmsEntryWorkflowsUseCase.js +43 -0
- package/features/wrappers/ListCmsEntryWorkflows/ListCmsEntryWorkflowsUseCase.js.map +1 -0
- package/features/wrappers/ListCmsEntryWorkflows/abstractions.d.ts +24 -0
- package/features/wrappers/ListCmsEntryWorkflows/abstractions.js +5 -0
- package/features/wrappers/ListCmsEntryWorkflows/abstractions.js.map +1 -0
- package/features/wrappers/ListCmsEntryWorkflows/feature.d.ts +4 -0
- package/features/wrappers/ListCmsEntryWorkflows/feature.js +11 -0
- package/features/wrappers/ListCmsEntryWorkflows/feature.js.map +1 -0
- package/features/wrappers/ListCmsEntryWorkflows/index.d.ts +1 -0
- package/features/wrappers/ListCmsEntryWorkflows/index.js +1 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/ReassignCmsEntryReviewStepUseCase.d.ts +13 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/ReassignCmsEntryReviewStepUseCase.js +40 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/ReassignCmsEntryReviewStepUseCase.js.map +1 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/abstractions.d.ts +32 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/abstractions.js +5 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/abstractions.js.map +1 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/feature.d.ts +4 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/feature.js +11 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/feature.js.map +1 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/index.d.ts +1 -0
- package/features/wrappers/ReassignCmsEntryReviewStep/index.js +1 -0
- package/features/wrappers/RejectCmsEntryReviewStep/RejectCmsEntryReviewStepUseCase.d.ts +13 -0
- package/features/wrappers/RejectCmsEntryReviewStep/RejectCmsEntryReviewStepUseCase.js +35 -0
- package/features/wrappers/RejectCmsEntryReviewStep/RejectCmsEntryReviewStepUseCase.js.map +1 -0
- package/features/wrappers/RejectCmsEntryReviewStep/abstractions.d.ts +26 -0
- package/features/wrappers/RejectCmsEntryReviewStep/abstractions.js +5 -0
- package/features/wrappers/RejectCmsEntryReviewStep/abstractions.js.map +1 -0
- package/features/wrappers/RejectCmsEntryReviewStep/feature.d.ts +4 -0
- package/features/wrappers/RejectCmsEntryReviewStep/feature.js +11 -0
- package/features/wrappers/RejectCmsEntryReviewStep/feature.js.map +1 -0
- package/features/wrappers/RejectCmsEntryReviewStep/index.d.ts +1 -0
- package/features/wrappers/RejectCmsEntryReviewStep/index.js +1 -0
- package/features/wrappers/RequestCmsEntryReview/RequestCmsEntryReviewUseCase.d.ts +21 -0
- package/features/wrappers/RequestCmsEntryReview/RequestCmsEntryReviewUseCase.js +63 -0
- package/features/wrappers/RequestCmsEntryReview/RequestCmsEntryReviewUseCase.js.map +1 -0
- package/features/wrappers/RequestCmsEntryReview/abstractions.d.ts +38 -0
- package/features/wrappers/RequestCmsEntryReview/abstractions.js +5 -0
- package/features/wrappers/RequestCmsEntryReview/abstractions.js.map +1 -0
- package/features/wrappers/RequestCmsEntryReview/feature.d.ts +4 -0
- package/features/wrappers/RequestCmsEntryReview/feature.js +11 -0
- package/features/wrappers/RequestCmsEntryReview/feature.js.map +1 -0
- package/features/wrappers/RequestCmsEntryReview/index.d.ts +1 -0
- package/features/wrappers/RequestCmsEntryReview/index.js +1 -0
- package/features/wrappers/RestartCmsEntryReviewStep/RestartCmsEntryReviewStepUseCase.d.ts +13 -0
- package/features/wrappers/RestartCmsEntryReviewStep/RestartCmsEntryReviewStepUseCase.js +39 -0
- package/features/wrappers/RestartCmsEntryReviewStep/RestartCmsEntryReviewStepUseCase.js.map +1 -0
- package/features/wrappers/RestartCmsEntryReviewStep/abstractions.d.ts +30 -0
- package/features/wrappers/RestartCmsEntryReviewStep/abstractions.js +5 -0
- package/features/wrappers/RestartCmsEntryReviewStep/abstractions.js.map +1 -0
- package/features/wrappers/RestartCmsEntryReviewStep/feature.d.ts +4 -0
- package/features/wrappers/RestartCmsEntryReviewStep/feature.js +11 -0
- package/features/wrappers/RestartCmsEntryReviewStep/feature.js.map +1 -0
- package/features/wrappers/RestartCmsEntryReviewStep/index.d.ts +1 -0
- package/features/wrappers/RestartCmsEntryReviewStep/index.js +1 -0
- package/features/wrappers/StartCmsEntryReviewStep/StartCmsEntryReviewStepUseCase.d.ts +13 -0
- package/features/wrappers/StartCmsEntryReviewStep/StartCmsEntryReviewStepUseCase.js +34 -0
- package/features/wrappers/StartCmsEntryReviewStep/StartCmsEntryReviewStepUseCase.js.map +1 -0
- package/features/wrappers/StartCmsEntryReviewStep/abstractions.d.ts +25 -0
- package/features/wrappers/StartCmsEntryReviewStep/abstractions.js +5 -0
- package/features/wrappers/StartCmsEntryReviewStep/abstractions.js.map +1 -0
- package/features/wrappers/StartCmsEntryReviewStep/feature.d.ts +4 -0
- package/features/wrappers/StartCmsEntryReviewStep/feature.js +11 -0
- package/features/wrappers/StartCmsEntryReviewStep/feature.js.map +1 -0
- package/features/wrappers/StartCmsEntryReviewStep/index.d.ts +1 -0
- package/features/wrappers/StartCmsEntryReviewStep/index.js +1 -0
- package/features/wrappers/StoreCmsEntryWorkflow/StoreCmsEntryWorkflowUseCase.d.ts +17 -0
- package/features/wrappers/StoreCmsEntryWorkflow/StoreCmsEntryWorkflowUseCase.js +57 -0
- package/features/wrappers/StoreCmsEntryWorkflow/StoreCmsEntryWorkflowUseCase.js.map +1 -0
- package/features/wrappers/StoreCmsEntryWorkflow/abstractions.d.ts +32 -0
- package/features/wrappers/StoreCmsEntryWorkflow/abstractions.js +5 -0
- package/features/wrappers/StoreCmsEntryWorkflow/abstractions.js.map +1 -0
- package/features/wrappers/StoreCmsEntryWorkflow/feature.d.ts +4 -0
- package/features/wrappers/StoreCmsEntryWorkflow/feature.js +11 -0
- package/features/wrappers/StoreCmsEntryWorkflow/feature.js.map +1 -0
- package/features/wrappers/StoreCmsEntryWorkflow/index.d.ts +1 -0
- package/features/wrappers/StoreCmsEntryWorkflow/index.js +1 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/TakeOverCmsEntryReviewStepUseCase.d.ts +13 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/TakeOverCmsEntryReviewStepUseCase.js +35 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/TakeOverCmsEntryReviewStepUseCase.js.map +1 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/abstractions.d.ts +27 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/abstractions.js +5 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/abstractions.js.map +1 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/feature.d.ts +4 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/feature.js +11 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/feature.js.map +1 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/index.d.ts +1 -0
- package/features/wrappers/TakeOverCmsEntryReviewStep/index.js +1 -0
- package/features/wrappers/feature.d.ts +9 -0
- package/features/wrappers/feature.js +57 -0
- package/features/wrappers/feature.js.map +1 -0
- package/features/wrappers/shared/cmsWorkflows.d.ts +6 -0
- package/features/wrappers/shared/cmsWorkflows.js +8 -0
- package/features/wrappers/shared/cmsWorkflows.js.map +1 -0
- package/graphql/CmsWorkflowsSchemaFactory.d.ts +14 -0
- package/graphql/CmsWorkflowsSchemaFactory.js +695 -0
- package/graphql/CmsWorkflowsSchemaFactory.js.map +1 -0
- package/graphql/entrySystemSchema.d.ts +6 -0
- package/graphql/entrySystemSchema.js +19 -0
- package/graphql/entrySystemSchema.js.map +1 -0
- package/graphql/isValidRevisionId.d.ts +6 -0
- package/graphql/isValidRevisionId.js +9 -0
- package/graphql/isValidRevisionId.js.map +1 -0
- package/index.d.ts +2 -1
- package/index.js +1 -20
- package/package.json +31 -18
- package/types.d.ts +24 -0
- package/types.js +0 -0
- package/utils/appName.d.ts +9 -5
- package/utils/appName.js +8 -11
- package/utils/appName.js.map +1 -1
- package/utils/folderType.d.ts +4 -0
- package/utils/folderType.js +9 -0
- package/utils/folderType.js.map +1 -0
- package/utils/isBindableModel.d.ts +9 -0
- package/utils/isBindableModel.js +8 -0
- package/utils/isBindableModel.js.map +1 -0
- package/features/EntryWorkflows/feature.d.ts +0 -1
- package/features/EntryWorkflows/feature.js +0 -20
- package/features/EntryWorkflows/feature.js.map +0 -1
- package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateAfterDelete.d.ts +0 -13
- package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateAfterDelete.js +0 -35
- package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateAfterDelete.js.map +0 -1
- package/features/EntryWorkflows/handlers/DeleteWorkflowStateOnEntryAfterDelete.d.ts +0 -11
- package/features/EntryWorkflows/handlers/DeleteWorkflowStateOnEntryAfterDelete.js +0 -29
- package/features/EntryWorkflows/handlers/DeleteWorkflowStateOnEntryAfterDelete.js.map +0 -1
- package/features/EntryWorkflows/handlers/DeleteWorkflowsOnModelAfterDelete.d.ts +0 -13
- package/features/EntryWorkflows/handlers/DeleteWorkflowsOnModelAfterDelete.js +0 -45
- package/features/EntryWorkflows/handlers/DeleteWorkflowsOnModelAfterDelete.js.map +0 -1
- package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterCreate.d.ts +0 -13
- package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterCreate.js +0 -37
- package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterCreate.js.map +0 -1
- package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterUpdate.d.ts +0 -13
- package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterUpdate.js +0 -37
- package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterUpdate.js.map +0 -1
- package/features/EntryWorkflows/handlers/ValidateWorkflowStateOnEntryBeforePublish.d.ts +0 -11
- package/features/EntryWorkflows/handlers/ValidateWorkflowStateOnEntryBeforePublish.js +0 -51
- package/features/EntryWorkflows/handlers/ValidateWorkflowStateOnEntryBeforePublish.js.map +0 -1
- package/features/EntryWorkflows/index.d.ts +0 -1
- package/features/EntryWorkflows/index.js +0 -3
- package/features/EntryWorkflows/index.js.map +0 -1
- package/features/Workflows/index.js.map +0 -1
- package/index.js.map +0 -1
- package/utils/modelAllowed.d.ts +0 -2
- package/utils/modelAllowed.js +0 -13
- package/utils/modelAllowed.js.map +0 -1
- package/utils/state.d.ts +0 -3
- package/utils/state.js +0 -11
- package/utils/state.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { CmsGraphQLSchemaFactory } from "@webiny/api-headless-cms";
|
|
3
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
4
|
+
import { WorkflowsFeature } from "./features/Workflows/index.js";
|
|
5
|
+
import { CmsTargetFeature } from "./features/target/feature.js";
|
|
6
|
+
import { CmsHooksFeature } from "./features/hooks/feature.js";
|
|
7
|
+
import { CmsWrappersFeature } from "./features/wrappers/feature.js";
|
|
8
|
+
import { createEntrySystemSchemaExtension } from "./graphql/entrySystemSchema.js";
|
|
9
|
+
import { CmsWorkflowsSchemaFactory } from "./graphql/CmsWorkflowsSchemaFactory.js";
|
|
10
|
+
const CmsWorkflowsFeature = createFeature({
|
|
11
|
+
name: "CmsWorkflows",
|
|
12
|
+
register (container) {
|
|
13
|
+
if (!container.resolve(FeatureFlags).get().isEnabled("advancedPublishingWorkflow")) return;
|
|
14
|
+
WorkflowsFeature.register(container);
|
|
15
|
+
CmsTargetFeature.register(container);
|
|
16
|
+
CmsHooksFeature.register(container);
|
|
17
|
+
CmsWrappersFeature.register(container);
|
|
18
|
+
container.register(CmsWorkflowsSchemaFactory);
|
|
19
|
+
container.registerInstance(CmsGraphQLSchemaFactory, {
|
|
20
|
+
execute: ()=>[
|
|
21
|
+
createEntrySystemSchemaExtension()
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export { CmsWorkflowsFeature };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=CmsWorkflowsFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsWorkflowsFeature.js","sources":["../src/CmsWorkflowsFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CmsGraphQLSchemaFactory } from \"@webiny/api-headless-cms\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { WorkflowsFeature as CmsLocalWorkflowsFeature } from \"./features/Workflows/index.js\";\nimport { CmsTargetFeature } from \"./features/target/feature.js\";\nimport { CmsHooksFeature } from \"./features/hooks/feature.js\";\nimport { CmsWrappersFeature } from \"./features/wrappers/feature.js\";\nimport { createEntrySystemSchemaExtension } from \"./graphql/entrySystemSchema.js\";\nimport { CmsWorkflowsSchemaFactory } from \"./graphql/CmsWorkflowsSchemaFactory.js\";\n\nexport const CmsWorkflowsFeature = createFeature({\n name: \"CmsWorkflows\",\n register(container) {\n // Advanced publishing workflow is license-gated — check at register time (license is fresh\n // pre-register) so nothing wires up without the entitlement.\n if (!container.resolve(FeatureFlags).get().isEnabled(\"advancedPublishingWorkflow\")) {\n return;\n }\n\n // Bindable-model checks on the engine's workflow before-save events.\n CmsLocalWorkflowsFeature.register(container);\n\n // The `cms.*` target adapter (spec 9.3).\n CmsTargetFeature.register(container);\n\n // Workflow handlers on CMS events (spec 9.2).\n CmsHooksFeature.register(container);\n\n // Wrapper use cases (identity, permission and target checks around the engine).\n CmsWrappersFeature.register(container);\n\n // Every CMS workflow and review operation on the `cms` root of `/graphql` (R88).\n container.register(CmsWorkflowsSchemaFactory);\n\n // Add the `workflow` field to CmsEntrySystem on the CMS endpoint, which is served from the\n // separate CMS schema and needs its own CmsGraphQLSchemaFactory entry.\n container.registerInstance(CmsGraphQLSchemaFactory, {\n execute: () => [createEntrySystemSchemaExtension()]\n });\n }\n});\n"],"names":["CmsWorkflowsFeature","createFeature","container","FeatureFlags","CmsLocalWorkflowsFeature","CmsTargetFeature","CmsHooksFeature","CmsWrappersFeature","CmsWorkflowsSchemaFactory","CmsGraphQLSchemaFactory","createEntrySystemSchemaExtension"],"mappings":";;;;;;;;;AAUO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QAGd,IAAI,CAACA,UAAU,OAAO,CAACC,cAAc,GAAG,GAAG,SAAS,CAAC,+BACjD;QAIJC,iBAAAA,QAAiC,CAACF;QAGlCG,iBAAiB,QAAQ,CAACH;QAG1BI,gBAAgB,QAAQ,CAACJ;QAGzBK,mBAAmB,QAAQ,CAACL;QAG5BA,UAAU,QAAQ,CAACM;QAInBN,UAAU,gBAAgB,CAACO,yBAAyB;YAChD,SAAS,IAAM;oBAACC;iBAAmC;QACvD;IACJ;AACJ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseError } from "@webiny/feature/api";
|
|
2
|
+
import type { WorkflowPersistenceError } from "@webiny/api-workflows/domain/workflow/errors.js";
|
|
3
|
+
export interface BoundWorkflow {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ModelBoundToWorkflowErrorData {
|
|
8
|
+
modelId: string;
|
|
9
|
+
workflows: BoundWorkflow[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A model bound to a workflow cannot be deleted, neither through `DeleteModelUseCase` nor the
|
|
13
|
+
* "fully delete model" task (D41, D64, D134); the workflow must be deleted or the model removed
|
|
14
|
+
* from it first.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ModelBoundToWorkflowError extends BaseError<ModelBoundToWorkflowErrorData> {
|
|
17
|
+
readonly code: "Workflows/Model/BoundToWorkflow";
|
|
18
|
+
constructor(data: ModelBoundToWorkflowErrorData);
|
|
19
|
+
}
|
|
20
|
+
declare module "@webiny/api-headless-cms/features/contentModel/DeleteModel/abstractions.js" {
|
|
21
|
+
interface IDeleteModelUseCaseErrors {
|
|
22
|
+
/** Added by the CMS workflows package (R64). */
|
|
23
|
+
boundToWorkflow: ModelBoundToWorkflowError;
|
|
24
|
+
/** The bound-workflow lookup failed; the delete is blocked (R64). */
|
|
25
|
+
workflowPersistence: WorkflowPersistenceError;
|
|
26
|
+
}
|
|
27
|
+
}
|
package/domain/errors.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseError } from "@webiny/feature/api";
|
|
2
|
+
class ModelBoundToWorkflowError extends BaseError {
|
|
3
|
+
constructor(data){
|
|
4
|
+
const names = data.workflows.map((workflow)=>`"${workflow.name}"`).join(", ");
|
|
5
|
+
const noun = 1 === data.workflows.length ? "workflow" : "workflows";
|
|
6
|
+
super({
|
|
7
|
+
message: `The model "${data.modelId}" is used by the ${noun} ${names}. Delete the ${noun} or remove the model from it first.`,
|
|
8
|
+
data
|
|
9
|
+
}), this.code = "Workflows/Model/BoundToWorkflow";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export { ModelBoundToWorkflowError };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain/errors.js","sources":["../../src/domain/errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\nimport type { WorkflowPersistenceError } from \"@webiny/api-workflows/domain/workflow/errors.js\";\n\nexport interface BoundWorkflow {\n id: string;\n name: string;\n}\n\nexport interface ModelBoundToWorkflowErrorData {\n modelId: string;\n workflows: BoundWorkflow[];\n}\n\n/**\n * A model bound to a workflow cannot be deleted, neither through `DeleteModelUseCase` nor the\n * \"fully delete model\" task (D41, D64, D134); the workflow must be deleted or the model removed\n * from it first.\n */\nexport class ModelBoundToWorkflowError extends BaseError<ModelBoundToWorkflowErrorData> {\n override readonly code = \"Workflows/Model/BoundToWorkflow\" as const;\n\n constructor(data: ModelBoundToWorkflowErrorData) {\n const names = data.workflows.map(workflow => `\"${workflow.name}\"`).join(\", \");\n const noun = data.workflows.length === 1 ? \"workflow\" : \"workflows\";\n super({\n message: `The model \"${data.modelId}\" is used by the ${noun} ${names}. Delete the ${noun} or remove the model from it first.`,\n data\n });\n }\n}\n\ndeclare module \"@webiny/api-headless-cms/features/contentModel/DeleteModel/abstractions.js\" {\n interface IDeleteModelUseCaseErrors {\n /** Added by the CMS workflows package (R64). */\n boundToWorkflow: ModelBoundToWorkflowError;\n /** The bound-workflow lookup failed; the delete is blocked (R64). */\n workflowPersistence: WorkflowPersistenceError;\n }\n}\n"],"names":["ModelBoundToWorkflowError","BaseError","data","names","workflow","noun"],"mappings":";AAkBO,MAAMA,kCAAkCC;IAG3C,YAAYC,IAAmC,CAAE;QAC7C,MAAMC,QAAQD,KAAK,SAAS,CAAC,GAAG,CAACE,CAAAA,WAAY,CAAC,CAAC,EAAEA,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QACxE,MAAMC,OAAOH,AAA0B,MAA1BA,KAAK,SAAS,CAAC,MAAM,GAAS,aAAa;QACxD,KAAK,CAAC;YACF,SAAS,CAAC,WAAW,EAAEA,KAAK,OAAO,CAAC,iBAAiB,EAAEG,KAAK,CAAC,EAAEF,MAAM,aAAa,EAAEE,KAAK,mCAAmC,CAAC;YAC7HH;QACJ,SARc,IAAI,GAAG;IASzB;AACJ"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { DisallowUnpublishableModelsOnBeforeCreate } from "./handlers/DisallowUnpublishableModelsOnBeforeCreate.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { DisallowUnpublishableModelsOnBeforeUpdate } from "./handlers/DisallowUnpublishableModelsOnBeforeUpdate.js";
|
|
4
|
+
const WorkflowsFeature = createFeature({
|
|
5
|
+
name: "CmsWorkflows",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(DisallowUnpublishableModelsOnBeforeCreate);
|
|
8
|
+
container.register(DisallowUnpublishableModelsOnBeforeUpdate);
|
|
9
|
+
}
|
|
8
10
|
});
|
|
11
|
+
export { WorkflowsFeature };
|
|
9
12
|
|
|
10
13
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/Workflows/feature.js","sources":["../../../src/features/Workflows/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DisallowUnpublishableModelsOnBeforeCreate } from \"./handlers/DisallowUnpublishableModelsOnBeforeCreate.js\";\nimport { DisallowUnpublishableModelsOnBeforeUpdate } from \"./handlers/DisallowUnpublishableModelsOnBeforeUpdate.js\";\n\nexport const WorkflowsFeature = createFeature({\n name: \"CmsWorkflows\",\n register(container) {\n container.register(DisallowUnpublishableModelsOnBeforeCreate);\n container.register(DisallowUnpublishableModelsOnBeforeUpdate);\n }\n});\n"],"names":["WorkflowsFeature","createFeature","container","DisallowUnpublishableModelsOnBeforeCreate","DisallowUnpublishableModelsOnBeforeUpdate"],"mappings":";;;AAIO,MAAMA,mBAAmBC,cAAc;IAC1C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WorkflowBeforeCreateEventHandler } from "@webiny/api-workflows/features/workflow/StoreWorkflow/index.js";
|
|
2
2
|
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Spec 4.1, D41: a workflow can only bind an existing, public, publishable CMS model. Throws
|
|
5
|
+
* `WorkflowValidationError`, which `StoreWorkflowUseCase` returns as a failed result. Non-CMS
|
|
6
|
+
* namespaces (`wb.page`) are skipped; the namespace format itself is checked by
|
|
7
|
+
* `WorkflowValidator` before any event is published. Other model read errors propagate.
|
|
8
|
+
*
|
|
9
|
+
* Binding requires read access to the model (R38): a model the caller cannot access fails
|
|
10
|
+
* validation instead of throwing `Cms/Model/NotAuthorized` out of `StoreWorkflowUseCase`. The CMS
|
|
11
|
+
* hides code-defined models the caller cannot access, so those report as not found. The read stays
|
|
12
|
+
* access-controlled on purpose: `GetModelRepository` or an elevated identity would fill the CMS
|
|
13
|
+
* tenant-keyed model cache with a list other callers must not see.
|
|
14
|
+
*/
|
|
15
|
+
declare class DisallowUnpublishableModelsOnBeforeCreateImpl implements WorkflowBeforeCreateEventHandler.Interface {
|
|
16
|
+
private getModel;
|
|
17
|
+
constructor(getModel: GetModelUseCase.Interface);
|
|
18
|
+
handle(event: WorkflowBeforeCreateEventHandler.Event): Promise<void>;
|
|
7
19
|
}
|
|
8
20
|
export declare const DisallowUnpublishableModelsOnBeforeCreate: typeof DisallowUnpublishableModelsOnBeforeCreateImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-workflows/features/workflow/StoreWorkflow/events").WorkflowBeforeCreateEvent>>;
|
|
10
22
|
};
|
|
11
23
|
export {};
|
|
@@ -1,32 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getModelIdFromAppName } from "../../../utils/appName.js";
|
|
1
|
+
import { WorkflowBeforeCreateEventHandler } from "@webiny/api-workflows/features/workflow/StoreWorkflow/index.js";
|
|
3
2
|
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
3
|
+
import { WorkflowValidationError } from "@webiny/api-workflows/domain/workflow/errors.js";
|
|
4
|
+
import { getModelIdFromAppName } from "../../../utils/appName.js";
|
|
5
|
+
import { UNPUBLISHABLE_MODEL_TAG } from "../../../utils/isBindableModel.js";
|
|
6
|
+
const MODEL_NOT_FOUND = "Cms/Model/NotFound";
|
|
7
|
+
const MODEL_NOT_AUTHORIZED = "Cms/Model/NotAuthorized";
|
|
4
8
|
class DisallowUnpublishableModelsOnBeforeCreateImpl {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
async handle(event) {
|
|
9
|
-
const {
|
|
10
|
-
workflow
|
|
11
|
-
} = event.payload;
|
|
12
|
-
const modelId = getModelIdFromAppName(workflow.app);
|
|
13
|
-
if (!modelId) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const model = await this.getModelUseCase.execute(modelId);
|
|
17
|
-
if (model.isFail()) {
|
|
18
|
-
return;
|
|
9
|
+
constructor(getModel){
|
|
10
|
+
this.getModel = getModel;
|
|
19
11
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
async handle(event) {
|
|
13
|
+
for (const namespaceId of event.payload.workflow.models){
|
|
14
|
+
const modelId = getModelIdFromAppName(namespaceId);
|
|
15
|
+
if (!modelId) continue;
|
|
16
|
+
const model = await this.getModel.execute(modelId);
|
|
17
|
+
if (model.isFail()) {
|
|
18
|
+
if (model.error.code === MODEL_NOT_FOUND) throw new WorkflowValidationError(`The model "${modelId}" does not exist.`, {
|
|
19
|
+
field: "models"
|
|
20
|
+
});
|
|
21
|
+
if (model.error.code === MODEL_NOT_AUTHORIZED) throw new WorkflowValidationError(`You don't have access to the model "${modelId}".`, {
|
|
22
|
+
field: "models"
|
|
23
|
+
});
|
|
24
|
+
throw model.error;
|
|
25
|
+
}
|
|
26
|
+
if (model.value.isPrivate) throw new WorkflowValidationError(`Cannot bind a workflow to the model "${modelId}" because it is a private model.`, {
|
|
27
|
+
field: "models"
|
|
28
|
+
});
|
|
29
|
+
const tags = model.value.tags || [];
|
|
30
|
+
if (tags.includes(UNPUBLISHABLE_MODEL_TAG)) throw new WorkflowValidationError(`Cannot bind a workflow to the model "${modelId}" because it is marked as unpublishable.`, {
|
|
31
|
+
field: "models"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
23
34
|
}
|
|
24
|
-
throw new Error(`Cannot create a workflow for the model "${modelId}" because it is marked as unpublishable.`);
|
|
25
|
-
}
|
|
26
35
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
const DisallowUnpublishableModelsOnBeforeCreate = WorkflowBeforeCreateEventHandler.createImplementation({
|
|
37
|
+
implementation: DisallowUnpublishableModelsOnBeforeCreateImpl,
|
|
38
|
+
dependencies: [
|
|
39
|
+
GetModelUseCase
|
|
40
|
+
]
|
|
30
41
|
});
|
|
42
|
+
export { DisallowUnpublishableModelsOnBeforeCreate };
|
|
31
43
|
|
|
32
44
|
//# sourceMappingURL=DisallowUnpublishableModelsOnBeforeCreate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.js","sources":["../../../../src/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.ts"],"sourcesContent":["import { WorkflowBeforeCreateEventHandler } from \"@webiny/api-workflows/features/workflow/StoreWorkflow/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { WorkflowValidationError } from \"@webiny/api-workflows/domain/workflow/errors.js\";\nimport { getModelIdFromAppName } from \"~/utils/appName.js\";\nimport { UNPUBLISHABLE_MODEL_TAG } from \"~/utils/isBindableModel.js\";\n\nconst MODEL_NOT_FOUND = \"Cms/Model/NotFound\";\nconst MODEL_NOT_AUTHORIZED = \"Cms/Model/NotAuthorized\";\n\n/**\n * Spec 4.1, D41: a workflow can only bind an existing, public, publishable CMS model. Throws\n * `WorkflowValidationError`, which `StoreWorkflowUseCase` returns as a failed result. Non-CMS\n * namespaces (`wb.page`) are skipped; the namespace format itself is checked by\n * `WorkflowValidator` before any event is published. Other model read errors propagate.\n *\n * Binding requires read access to the model (R38): a model the caller cannot access fails\n * validation instead of throwing `Cms/Model/NotAuthorized` out of `StoreWorkflowUseCase`. The CMS\n * hides code-defined models the caller cannot access, so those report as not found. The read stays\n * access-controlled on purpose: `GetModelRepository` or an elevated identity would fill the CMS\n * tenant-keyed model cache with a list other callers must not see.\n */\nclass DisallowUnpublishableModelsOnBeforeCreateImpl\n implements WorkflowBeforeCreateEventHandler.Interface\n{\n public constructor(private getModel: GetModelUseCase.Interface) {}\n\n public async handle(event: WorkflowBeforeCreateEventHandler.Event): Promise<void> {\n for (const namespaceId of event.payload.workflow.models) {\n const modelId = getModelIdFromAppName(namespaceId);\n if (!modelId) {\n continue;\n }\n // oxlint-disable-next-line no-await-in-loop -- per-request cached model read, one per bound model.\n const model = await this.getModel.execute(modelId);\n if (model.isFail()) {\n if (model.error.code === MODEL_NOT_FOUND) {\n throw new WorkflowValidationError(`The model \"${modelId}\" does not exist.`, {\n field: \"models\"\n });\n }\n if (model.error.code === MODEL_NOT_AUTHORIZED) {\n throw new WorkflowValidationError(\n `You don't have access to the model \"${modelId}\".`,\n { field: \"models\" }\n );\n }\n throw model.error;\n }\n if (model.value.isPrivate) {\n throw new WorkflowValidationError(\n `Cannot bind a workflow to the model \"${modelId}\" because it is a private model.`,\n { field: \"models\" }\n );\n }\n const tags = model.value.tags || [];\n if (!tags.includes(UNPUBLISHABLE_MODEL_TAG)) {\n continue;\n }\n throw new WorkflowValidationError(\n `Cannot bind a workflow to the model \"${modelId}\" because it is marked as unpublishable.`,\n { field: \"models\" }\n );\n }\n }\n}\n\nexport const DisallowUnpublishableModelsOnBeforeCreate =\n WorkflowBeforeCreateEventHandler.createImplementation({\n implementation: DisallowUnpublishableModelsOnBeforeCreateImpl,\n dependencies: [GetModelUseCase]\n });\n"],"names":["MODEL_NOT_FOUND","MODEL_NOT_AUTHORIZED","DisallowUnpublishableModelsOnBeforeCreateImpl","getModel","event","namespaceId","modelId","getModelIdFromAppName","model","WorkflowValidationError","tags","UNPUBLISHABLE_MODEL_TAG","DisallowUnpublishableModelsOnBeforeCreate","WorkflowBeforeCreateEventHandler","GetModelUseCase"],"mappings":";;;;;AAMA,MAAMA,kBAAkB;AACxB,MAAMC,uBAAuB;AAc7B,MAAMC;IAGF,YAA2BC,QAAmC,CAAE;aAArCA,QAAQ,GAARA;IAAsC;IAEjE,MAAa,OAAOC,KAA6C,EAAiB;QAC9E,KAAK,MAAMC,eAAeD,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAE;YACrD,MAAME,UAAUC,sBAAsBF;YACtC,IAAI,CAACC,SACD;YAGJ,MAAME,QAAQ,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACF;YAC1C,IAAIE,MAAM,MAAM,IAAI;gBAChB,IAAIA,MAAM,KAAK,CAAC,IAAI,KAAKR,iBACrB,MAAM,IAAIS,wBAAwB,CAAC,WAAW,EAAEH,QAAQ,iBAAiB,CAAC,EAAE;oBACxE,OAAO;gBACX;gBAEJ,IAAIE,MAAM,KAAK,CAAC,IAAI,KAAKP,sBACrB,MAAM,IAAIQ,wBACN,CAAC,oCAAoC,EAAEH,QAAQ,EAAE,CAAC,EAClD;oBAAE,OAAO;gBAAS;gBAG1B,MAAME,MAAM,KAAK;YACrB;YACA,IAAIA,MAAM,KAAK,CAAC,SAAS,EACrB,MAAM,IAAIC,wBACN,CAAC,qCAAqC,EAAEH,QAAQ,gCAAgC,CAAC,EACjF;gBAAE,OAAO;YAAS;YAG1B,MAAMI,OAAOF,MAAM,KAAK,CAAC,IAAI,IAAI,EAAE;YACnC,IAAKE,KAAK,QAAQ,CAACC,0BAGnB,MAAM,IAAIF,wBACN,CAAC,qCAAqC,EAAEH,QAAQ,wCAAwC,CAAC,EACzF;gBAAE,OAAO;YAAS;QAE1B;IACJ;AACJ;AAEO,MAAMM,4CACTC,iCAAiC,oBAAoB,CAAC;IAClD,gBAAgBX;IAChB,cAAc;QAACY;KAAgB;AACnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WorkflowBeforeUpdateEventHandler } from "@webiny/api-workflows/features/workflow/StoreWorkflow/index.js";
|
|
2
|
+
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Spec 4.1, D41: a workflow can only bind an existing, public, publishable CMS model. Throws
|
|
5
|
+
* `WorkflowValidationError`, which `StoreWorkflowUseCase` returns as a failed result. Non-CMS
|
|
6
|
+
* namespaces (`wb.page`) are skipped; the namespace format itself is checked by
|
|
7
|
+
* `WorkflowValidator` before any event is published. Other model read errors propagate.
|
|
8
|
+
*
|
|
9
|
+
* Binding requires read access to the model (R38): a model the caller cannot access fails
|
|
10
|
+
* validation instead of throwing `Cms/Model/NotAuthorized` out of `StoreWorkflowUseCase`. The CMS
|
|
11
|
+
* hides code-defined models the caller cannot access, so those report as not found. The read stays
|
|
12
|
+
* access-controlled on purpose: `GetModelRepository` or an elevated identity would fill the CMS
|
|
13
|
+
* tenant-keyed model cache with a list other callers must not see.
|
|
14
|
+
*/
|
|
15
|
+
declare class DisallowUnpublishableModelsOnBeforeUpdateImpl implements WorkflowBeforeUpdateEventHandler.Interface {
|
|
16
|
+
private getModel;
|
|
17
|
+
constructor(getModel: GetModelUseCase.Interface);
|
|
18
|
+
handle(event: WorkflowBeforeUpdateEventHandler.Event): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare const DisallowUnpublishableModelsOnBeforeUpdate: typeof DisallowUnpublishableModelsOnBeforeUpdateImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-workflows/features/workflow/StoreWorkflow/events").WorkflowBeforeUpdateEvent>>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { WorkflowBeforeUpdateEventHandler } from "@webiny/api-workflows/features/workflow/StoreWorkflow/index.js";
|
|
2
|
+
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
3
|
+
import { WorkflowValidationError } from "@webiny/api-workflows/domain/workflow/errors.js";
|
|
4
|
+
import { getModelIdFromAppName } from "../../../utils/appName.js";
|
|
5
|
+
import { UNPUBLISHABLE_MODEL_TAG } from "../../../utils/isBindableModel.js";
|
|
6
|
+
const MODEL_NOT_FOUND = "Cms/Model/NotFound";
|
|
7
|
+
const MODEL_NOT_AUTHORIZED = "Cms/Model/NotAuthorized";
|
|
8
|
+
class DisallowUnpublishableModelsOnBeforeUpdateImpl {
|
|
9
|
+
constructor(getModel){
|
|
10
|
+
this.getModel = getModel;
|
|
11
|
+
}
|
|
12
|
+
async handle(event) {
|
|
13
|
+
for (const namespaceId of event.payload.workflow.models){
|
|
14
|
+
const modelId = getModelIdFromAppName(namespaceId);
|
|
15
|
+
if (!modelId) continue;
|
|
16
|
+
const model = await this.getModel.execute(modelId);
|
|
17
|
+
if (model.isFail()) {
|
|
18
|
+
if (model.error.code === MODEL_NOT_FOUND) throw new WorkflowValidationError(`The model "${modelId}" does not exist.`, {
|
|
19
|
+
field: "models"
|
|
20
|
+
});
|
|
21
|
+
if (model.error.code === MODEL_NOT_AUTHORIZED) throw new WorkflowValidationError(`You don't have access to the model "${modelId}".`, {
|
|
22
|
+
field: "models"
|
|
23
|
+
});
|
|
24
|
+
throw model.error;
|
|
25
|
+
}
|
|
26
|
+
if (model.value.isPrivate) throw new WorkflowValidationError(`Cannot bind a workflow to the model "${modelId}" because it is a private model.`, {
|
|
27
|
+
field: "models"
|
|
28
|
+
});
|
|
29
|
+
const tags = model.value.tags || [];
|
|
30
|
+
if (tags.includes(UNPUBLISHABLE_MODEL_TAG)) throw new WorkflowValidationError(`Cannot bind a workflow to the model "${modelId}" because it is marked as unpublishable.`, {
|
|
31
|
+
field: "models"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const DisallowUnpublishableModelsOnBeforeUpdate = WorkflowBeforeUpdateEventHandler.createImplementation({
|
|
37
|
+
implementation: DisallowUnpublishableModelsOnBeforeUpdateImpl,
|
|
38
|
+
dependencies: [
|
|
39
|
+
GetModelUseCase
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
export { DisallowUnpublishableModelsOnBeforeUpdate };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=DisallowUnpublishableModelsOnBeforeUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeUpdate.js","sources":["../../../../src/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeUpdate.ts"],"sourcesContent":["import { WorkflowBeforeUpdateEventHandler } from \"@webiny/api-workflows/features/workflow/StoreWorkflow/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { WorkflowValidationError } from \"@webiny/api-workflows/domain/workflow/errors.js\";\nimport { getModelIdFromAppName } from \"~/utils/appName.js\";\nimport { UNPUBLISHABLE_MODEL_TAG } from \"~/utils/isBindableModel.js\";\n\nconst MODEL_NOT_FOUND = \"Cms/Model/NotFound\";\nconst MODEL_NOT_AUTHORIZED = \"Cms/Model/NotAuthorized\";\n\n/**\n * Spec 4.1, D41: a workflow can only bind an existing, public, publishable CMS model. Throws\n * `WorkflowValidationError`, which `StoreWorkflowUseCase` returns as a failed result. Non-CMS\n * namespaces (`wb.page`) are skipped; the namespace format itself is checked by\n * `WorkflowValidator` before any event is published. Other model read errors propagate.\n *\n * Binding requires read access to the model (R38): a model the caller cannot access fails\n * validation instead of throwing `Cms/Model/NotAuthorized` out of `StoreWorkflowUseCase`. The CMS\n * hides code-defined models the caller cannot access, so those report as not found. The read stays\n * access-controlled on purpose: `GetModelRepository` or an elevated identity would fill the CMS\n * tenant-keyed model cache with a list other callers must not see.\n */\nclass DisallowUnpublishableModelsOnBeforeUpdateImpl\n implements WorkflowBeforeUpdateEventHandler.Interface\n{\n public constructor(private getModel: GetModelUseCase.Interface) {}\n\n public async handle(event: WorkflowBeforeUpdateEventHandler.Event): Promise<void> {\n for (const namespaceId of event.payload.workflow.models) {\n const modelId = getModelIdFromAppName(namespaceId);\n if (!modelId) {\n continue;\n }\n // oxlint-disable-next-line no-await-in-loop -- per-request cached model read, one per bound model.\n const model = await this.getModel.execute(modelId);\n if (model.isFail()) {\n if (model.error.code === MODEL_NOT_FOUND) {\n throw new WorkflowValidationError(`The model \"${modelId}\" does not exist.`, {\n field: \"models\"\n });\n }\n if (model.error.code === MODEL_NOT_AUTHORIZED) {\n throw new WorkflowValidationError(\n `You don't have access to the model \"${modelId}\".`,\n { field: \"models\" }\n );\n }\n throw model.error;\n }\n if (model.value.isPrivate) {\n throw new WorkflowValidationError(\n `Cannot bind a workflow to the model \"${modelId}\" because it is a private model.`,\n { field: \"models\" }\n );\n }\n const tags = model.value.tags || [];\n if (!tags.includes(UNPUBLISHABLE_MODEL_TAG)) {\n continue;\n }\n throw new WorkflowValidationError(\n `Cannot bind a workflow to the model \"${modelId}\" because it is marked as unpublishable.`,\n { field: \"models\" }\n );\n }\n }\n}\n\nexport const DisallowUnpublishableModelsOnBeforeUpdate =\n WorkflowBeforeUpdateEventHandler.createImplementation({\n implementation: DisallowUnpublishableModelsOnBeforeUpdateImpl,\n dependencies: [GetModelUseCase]\n });\n"],"names":["MODEL_NOT_FOUND","MODEL_NOT_AUTHORIZED","DisallowUnpublishableModelsOnBeforeUpdateImpl","getModel","event","namespaceId","modelId","getModelIdFromAppName","model","WorkflowValidationError","tags","UNPUBLISHABLE_MODEL_TAG","DisallowUnpublishableModelsOnBeforeUpdate","WorkflowBeforeUpdateEventHandler","GetModelUseCase"],"mappings":";;;;;AAMA,MAAMA,kBAAkB;AACxB,MAAMC,uBAAuB;AAc7B,MAAMC;IAGF,YAA2BC,QAAmC,CAAE;aAArCA,QAAQ,GAARA;IAAsC;IAEjE,MAAa,OAAOC,KAA6C,EAAiB;QAC9E,KAAK,MAAMC,eAAeD,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAE;YACrD,MAAME,UAAUC,sBAAsBF;YACtC,IAAI,CAACC,SACD;YAGJ,MAAME,QAAQ,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACF;YAC1C,IAAIE,MAAM,MAAM,IAAI;gBAChB,IAAIA,MAAM,KAAK,CAAC,IAAI,KAAKR,iBACrB,MAAM,IAAIS,wBAAwB,CAAC,WAAW,EAAEH,QAAQ,iBAAiB,CAAC,EAAE;oBACxE,OAAO;gBACX;gBAEJ,IAAIE,MAAM,KAAK,CAAC,IAAI,KAAKP,sBACrB,MAAM,IAAIQ,wBACN,CAAC,oCAAoC,EAAEH,QAAQ,EAAE,CAAC,EAClD;oBAAE,OAAO;gBAAS;gBAG1B,MAAME,MAAM,KAAK;YACrB;YACA,IAAIA,MAAM,KAAK,CAAC,SAAS,EACrB,MAAM,IAAIC,wBACN,CAAC,qCAAqC,EAAEH,QAAQ,gCAAgC,CAAC,EACjF;gBAAE,OAAO;YAAS;YAG1B,MAAMI,OAAOF,MAAM,KAAK,CAAC,IAAI,IAAI,EAAE;YACnC,IAAKE,KAAK,QAAQ,CAACC,0BAGnB,MAAM,IAAIF,wBACN,CAAC,qCAAqC,EAAEH,QAAQ,wCAAwC,CAAC,EACzF;gBAAE,OAAO;YAAS;QAE1B;IACJ;AACJ;AAEO,MAAMM,4CACTC,iCAAiC,oBAAoB,CAAC;IAClD,gBAAgBX;IAChB,cAAc;QAACY;KAAgB;AACnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EntryBeforeDeleteMultipleEventHandler } from "@webiny/api-headless-cms/features/contentEntry/DeleteMultipleEntries/index.js";
|
|
2
|
+
import { AccessControl } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
3
|
+
import { GetBoundWorkflowUseCase } from "@webiny/api-workflows/features/workflow/GetBoundWorkflow/index.js";
|
|
4
|
+
import { ListReviewsByTargetsUseCase } from "@webiny/api-workflows/features/review/ListReviewsByTargets/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* `deleteMultiple` (permanent, up to 50 entries) is refused while any entry it would delete has an
|
|
7
|
+
* in-progress review (D134, R73). Only the entries the caller may access are considered, with the
|
|
8
|
+
* same check `DeleteMultipleEntriesUseCase` applies, so the error never names a review of content
|
|
9
|
+
* the caller cannot see. Bound models only; the binding is looked up once, the reviews of all
|
|
10
|
+
* accessible entries with one engine call (Q79).
|
|
11
|
+
*/
|
|
12
|
+
declare class BlockDeleteMultipleWhileInReviewImpl implements EntryBeforeDeleteMultipleEventHandler.Interface {
|
|
13
|
+
private accessControl;
|
|
14
|
+
private getBoundWorkflow;
|
|
15
|
+
private listReviewsByTargets;
|
|
16
|
+
constructor(accessControl: AccessControl.Interface, getBoundWorkflow: GetBoundWorkflowUseCase.Interface, listReviewsByTargets: ListReviewsByTargetsUseCase.Interface);
|
|
17
|
+
handle(event: EntryBeforeDeleteMultipleEventHandler.Event): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare const BlockDeleteMultipleWhileInReview: typeof BlockDeleteMultipleWhileInReviewImpl & {
|
|
20
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-headless-cms/features/contentEntry/DeleteMultipleEntries/events").EntryBeforeDeleteMultipleEvent>>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { EntryBeforeDeleteMultipleEventHandler } from "@webiny/api-headless-cms/features/contentEntry/DeleteMultipleEntries/index.js";
|
|
2
|
+
import { AccessControl } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
3
|
+
import { GetBoundWorkflowUseCase } from "@webiny/api-workflows/features/workflow/GetBoundWorkflow/index.js";
|
|
4
|
+
import { ListReviewsByTargetsUseCase } from "@webiny/api-workflows/features/review/ListReviewsByTargets/index.js";
|
|
5
|
+
import { ReviewActiveOnTrashError } from "@webiny/api-workflows/domain/review/errors.js";
|
|
6
|
+
import { toBlockingReview } from "@webiny/api-workflows/domain/review/toBlockingReview.js";
|
|
7
|
+
import { getCmsNamespace } from "../../utils/appName.js";
|
|
8
|
+
class BlockDeleteMultipleWhileInReviewImpl {
|
|
9
|
+
constructor(accessControl, getBoundWorkflow, listReviewsByTargets){
|
|
10
|
+
this.accessControl = accessControl;
|
|
11
|
+
this.getBoundWorkflow = getBoundWorkflow;
|
|
12
|
+
this.listReviewsByTargets = listReviewsByTargets;
|
|
13
|
+
}
|
|
14
|
+
async handle(event) {
|
|
15
|
+
const { model, entries } = event.payload;
|
|
16
|
+
const namespace = getCmsNamespace(model);
|
|
17
|
+
if (!namespace) return;
|
|
18
|
+
const bound = await this.getBoundWorkflow.execute({
|
|
19
|
+
model: namespace
|
|
20
|
+
});
|
|
21
|
+
if (bound.isFail()) throw bound.error;
|
|
22
|
+
if (!bound.value) return;
|
|
23
|
+
const entryIds = [];
|
|
24
|
+
for (const entry of entries)if (await this.accessControl.canAccessEntry({
|
|
25
|
+
model,
|
|
26
|
+
entry
|
|
27
|
+
})) entryIds.push(entry.entryId);
|
|
28
|
+
if (0 === entryIds.length) return;
|
|
29
|
+
const listed = await this.listReviewsByTargets.execute({
|
|
30
|
+
model: namespace,
|
|
31
|
+
targetIds: entryIds,
|
|
32
|
+
state: "inProgress"
|
|
33
|
+
});
|
|
34
|
+
if (listed.isFail()) throw listed.error;
|
|
35
|
+
const inProgress = new Map();
|
|
36
|
+
for (const review of listed.value){
|
|
37
|
+
const reviews = inProgress.get(review.targetId) ?? [];
|
|
38
|
+
reviews.push(review);
|
|
39
|
+
inProgress.set(review.targetId, reviews);
|
|
40
|
+
}
|
|
41
|
+
const blocking = [];
|
|
42
|
+
for (const entryId of entryIds){
|
|
43
|
+
const reviews = inProgress.get(entryId) ?? [];
|
|
44
|
+
for (const review of reviews)blocking.push(toBlockingReview(review));
|
|
45
|
+
}
|
|
46
|
+
if (0 === blocking.length) return;
|
|
47
|
+
throw new ReviewActiveOnTrashError({
|
|
48
|
+
model: namespace,
|
|
49
|
+
action: "delete",
|
|
50
|
+
reviews: blocking
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const BlockDeleteMultipleWhileInReview = EntryBeforeDeleteMultipleEventHandler.createImplementation({
|
|
55
|
+
implementation: BlockDeleteMultipleWhileInReviewImpl,
|
|
56
|
+
dependencies: [
|
|
57
|
+
AccessControl,
|
|
58
|
+
GetBoundWorkflowUseCase,
|
|
59
|
+
ListReviewsByTargetsUseCase
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
export { BlockDeleteMultipleWhileInReview };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=BlockDeleteMultipleWhileInReview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/hooks/BlockDeleteMultipleWhileInReview.js","sources":["../../../src/features/hooks/BlockDeleteMultipleWhileInReview.ts"],"sourcesContent":["import { EntryBeforeDeleteMultipleEventHandler } from \"@webiny/api-headless-cms/features/contentEntry/DeleteMultipleEntries/index.js\";\nimport { AccessControl } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { GetBoundWorkflowUseCase } from \"@webiny/api-workflows/features/workflow/GetBoundWorkflow/index.js\";\nimport { ListReviewsByTargetsUseCase } from \"@webiny/api-workflows/features/review/ListReviewsByTargets/index.js\";\nimport { ReviewActiveOnTrashError } from \"@webiny/api-workflows/domain/review/errors.js\";\nimport { toBlockingReview } from \"@webiny/api-workflows/domain/review/toBlockingReview.js\";\nimport type { ReviewData } from \"@webiny/api-workflows/domain/review/types.js\";\nimport type { WorkflowBlockingReview } from \"@webiny/api-workflows/domain/workflow/types.js\";\nimport { getCmsNamespace } from \"~/utils/appName.js\";\n\n/**\n * `deleteMultiple` (permanent, up to 50 entries) is refused while any entry it would delete has an\n * in-progress review (D134, R73). Only the entries the caller may access are considered, with the\n * same check `DeleteMultipleEntriesUseCase` applies, so the error never names a review of content\n * the caller cannot see. Bound models only; the binding is looked up once, the reviews of all\n * accessible entries with one engine call (Q79).\n */\nclass BlockDeleteMultipleWhileInReviewImpl\n implements EntryBeforeDeleteMultipleEventHandler.Interface\n{\n public constructor(\n private accessControl: AccessControl.Interface,\n private getBoundWorkflow: GetBoundWorkflowUseCase.Interface,\n private listReviewsByTargets: ListReviewsByTargetsUseCase.Interface\n ) {}\n\n public async handle(event: EntryBeforeDeleteMultipleEventHandler.Event): Promise<void> {\n const { model, entries } = event.payload;\n const namespace = getCmsNamespace(model);\n if (!namespace) {\n return;\n }\n\n const bound = await this.getBoundWorkflow.execute({ model: namespace });\n if (bound.isFail()) {\n throw bound.error;\n }\n if (!bound.value) {\n return;\n }\n\n // In memory: the caller's permissions are already loaded.\n const entryIds: string[] = [];\n for (const entry of entries) {\n // oxlint-disable-next-line no-await-in-loop -- in memory: the caller's permissions are already loaded.\n if (await this.accessControl.canAccessEntry({ model, entry })) {\n entryIds.push(entry.entryId);\n }\n }\n if (entryIds.length === 0) {\n return;\n }\n\n // Any failure throws, so the delete is refused.\n const listed = await this.listReviewsByTargets.execute({\n model: namespace,\n targetIds: entryIds,\n state: \"inProgress\"\n });\n if (listed.isFail()) {\n throw listed.error;\n }\n const inProgress = new Map<string, ReviewData[]>();\n for (const review of listed.value) {\n const reviews = inProgress.get(review.targetId) ?? [];\n reviews.push(review);\n inProgress.set(review.targetId, reviews);\n }\n // In the order of the entries, each entry's reviews in list order.\n const blocking: WorkflowBlockingReview[] = [];\n for (const entryId of entryIds) {\n const reviews = inProgress.get(entryId) ?? [];\n for (const review of reviews) {\n blocking.push(toBlockingReview(review));\n }\n }\n if (blocking.length === 0) {\n return;\n }\n\n throw new ReviewActiveOnTrashError({\n model: namespace,\n action: \"delete\",\n reviews: blocking\n });\n }\n}\n\nexport const BlockDeleteMultipleWhileInReview =\n EntryBeforeDeleteMultipleEventHandler.createImplementation({\n implementation: BlockDeleteMultipleWhileInReviewImpl,\n dependencies: [AccessControl, GetBoundWorkflowUseCase, ListReviewsByTargetsUseCase]\n });\n"],"names":["BlockDeleteMultipleWhileInReviewImpl","accessControl","getBoundWorkflow","listReviewsByTargets","event","model","entries","namespace","getCmsNamespace","bound","entryIds","entry","listed","inProgress","Map","review","reviews","blocking","entryId","toBlockingReview","ReviewActiveOnTrashError","BlockDeleteMultipleWhileInReview","EntryBeforeDeleteMultipleEventHandler","AccessControl","GetBoundWorkflowUseCase","ListReviewsByTargetsUseCase"],"mappings":";;;;;;;AAiBA,MAAMA;IAGF,YACYC,aAAsC,EACtCC,gBAAmD,EACnDC,oBAA2D,CACrE;aAHUF,aAAa,GAAbA;aACAC,gBAAgB,GAAhBA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAa,OAAOC,KAAkD,EAAiB;QACnF,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGF,MAAM,OAAO;QACxC,MAAMG,YAAYC,gBAAgBH;QAClC,IAAI,CAACE,WACD;QAGJ,MAAME,QAAQ,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,OAAOF;QAAU;QACrE,IAAIE,MAAM,MAAM,IACZ,MAAMA,MAAM,KAAK;QAErB,IAAI,CAACA,MAAM,KAAK,EACZ;QAIJ,MAAMC,WAAqB,EAAE;QAC7B,KAAK,MAAMC,SAASL,QAEhB,IAAI,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;YAAED;YAAOM;QAAM,IACvDD,SAAS,IAAI,CAACC,MAAM,OAAO;QAGnC,IAAID,AAAoB,MAApBA,SAAS,MAAM,EACf;QAIJ,MAAME,SAAS,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;YACnD,OAAOL;YACP,WAAWG;YACX,OAAO;QACX;QACA,IAAIE,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;QAEtB,MAAMC,aAAa,IAAIC;QACvB,KAAK,MAAMC,UAAUH,OAAO,KAAK,CAAE;YAC/B,MAAMI,UAAUH,WAAW,GAAG,CAACE,OAAO,QAAQ,KAAK,EAAE;YACrDC,QAAQ,IAAI,CAACD;YACbF,WAAW,GAAG,CAACE,OAAO,QAAQ,EAAEC;QACpC;QAEA,MAAMC,WAAqC,EAAE;QAC7C,KAAK,MAAMC,WAAWR,SAAU;YAC5B,MAAMM,UAAUH,WAAW,GAAG,CAACK,YAAY,EAAE;YAC7C,KAAK,MAAMH,UAAUC,QACjBC,SAAS,IAAI,CAACE,iBAAiBJ;QAEvC;QACA,IAAIE,AAAoB,MAApBA,SAAS,MAAM,EACf;QAGJ,MAAM,IAAIG,yBAAyB;YAC/B,OAAOb;YACP,QAAQ;YACR,SAASU;QACb;IACJ;AACJ;AAEO,MAAMI,mCACTC,sCAAsC,oBAAoB,CAAC;IACvD,gBAAgBtB;IAChB,cAAc;QAACuB;QAAeC;QAAyBC;KAA4B;AACvF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EntryBeforeDeleteEventHandler } from "@webiny/api-headless-cms/features/contentEntry/DeleteEntry/index.js";
|
|
2
|
+
import { GetBoundWorkflowUseCase } from "@webiny/api-workflows/features/workflow/GetBoundWorkflow/index.js";
|
|
3
|
+
import { ListTargetReviewsUseCase } from "@webiny/api-workflows/features/review/ListTargetReviews/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Trash and permanent delete of a CMS entry are refused while any revision has an in-progress
|
|
6
|
+
* review (D134, R73): `permanent: false` is the trash, `true` the delete. The admin confirms by
|
|
7
|
+
* calling `CancelCmsEntryReviewsForDelete` and repeating the action. Bound models only.
|
|
8
|
+
*/
|
|
9
|
+
declare class BlockDeleteWhileInReviewImpl implements EntryBeforeDeleteEventHandler.Interface {
|
|
10
|
+
private getBoundWorkflow;
|
|
11
|
+
private listTargetReviews;
|
|
12
|
+
constructor(getBoundWorkflow: GetBoundWorkflowUseCase.Interface, listTargetReviews: ListTargetReviewsUseCase.Interface);
|
|
13
|
+
handle(event: EntryBeforeDeleteEventHandler.Event): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const BlockDeleteWhileInReview: typeof BlockDeleteWhileInReviewImpl & {
|
|
16
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-headless-cms/features/contentEntry/DeleteEntry/events").EntryBeforeDeleteEvent>>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { EntryBeforeDeleteEventHandler } from "@webiny/api-headless-cms/features/contentEntry/DeleteEntry/index.js";
|
|
2
|
+
import { GetBoundWorkflowUseCase } from "@webiny/api-workflows/features/workflow/GetBoundWorkflow/index.js";
|
|
3
|
+
import { ListTargetReviewsUseCase } from "@webiny/api-workflows/features/review/ListTargetReviews/index.js";
|
|
4
|
+
import { ReviewActiveOnTrashError } from "@webiny/api-workflows/domain/review/errors.js";
|
|
5
|
+
import { toBlockingReview } from "@webiny/api-workflows/domain/review/toBlockingReview.js";
|
|
6
|
+
import { getCmsNamespace } from "../../utils/appName.js";
|
|
7
|
+
class BlockDeleteWhileInReviewImpl {
|
|
8
|
+
constructor(getBoundWorkflow, listTargetReviews){
|
|
9
|
+
this.getBoundWorkflow = getBoundWorkflow;
|
|
10
|
+
this.listTargetReviews = listTargetReviews;
|
|
11
|
+
}
|
|
12
|
+
async handle(event) {
|
|
13
|
+
const { model, entry, permanent } = event.payload;
|
|
14
|
+
const namespace = getCmsNamespace(model);
|
|
15
|
+
if (!namespace) return;
|
|
16
|
+
const bound = await this.getBoundWorkflow.execute({
|
|
17
|
+
model: namespace
|
|
18
|
+
});
|
|
19
|
+
if (bound.isFail()) throw bound.error;
|
|
20
|
+
if (!bound.value) return;
|
|
21
|
+
const reviews = await this.listTargetReviews.execute({
|
|
22
|
+
model: namespace,
|
|
23
|
+
targetId: entry.entryId,
|
|
24
|
+
state: "inProgress"
|
|
25
|
+
});
|
|
26
|
+
if (reviews.isFail()) throw reviews.error;
|
|
27
|
+
const inProgress = reviews.value;
|
|
28
|
+
if (0 === inProgress.length) return;
|
|
29
|
+
throw new ReviewActiveOnTrashError({
|
|
30
|
+
model: namespace,
|
|
31
|
+
action: permanent ? "delete" : "trash",
|
|
32
|
+
reviews: inProgress.map(toBlockingReview)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const BlockDeleteWhileInReview = EntryBeforeDeleteEventHandler.createImplementation({
|
|
37
|
+
implementation: BlockDeleteWhileInReviewImpl,
|
|
38
|
+
dependencies: [
|
|
39
|
+
GetBoundWorkflowUseCase,
|
|
40
|
+
ListTargetReviewsUseCase
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
export { BlockDeleteWhileInReview };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=BlockDeleteWhileInReview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/hooks/BlockDeleteWhileInReview.js","sources":["../../../src/features/hooks/BlockDeleteWhileInReview.ts"],"sourcesContent":["import { EntryBeforeDeleteEventHandler } from \"@webiny/api-headless-cms/features/contentEntry/DeleteEntry/index.js\";\nimport { GetBoundWorkflowUseCase } from \"@webiny/api-workflows/features/workflow/GetBoundWorkflow/index.js\";\nimport { ListTargetReviewsUseCase } from \"@webiny/api-workflows/features/review/ListTargetReviews/index.js\";\nimport { ReviewActiveOnTrashError } from \"@webiny/api-workflows/domain/review/errors.js\";\nimport { toBlockingReview } from \"@webiny/api-workflows/domain/review/toBlockingReview.js\";\nimport { getCmsNamespace } from \"~/utils/appName.js\";\n\n/**\n * Trash and permanent delete of a CMS entry are refused while any revision has an in-progress\n * review (D134, R73): `permanent: false` is the trash, `true` the delete. The admin confirms by\n * calling `CancelCmsEntryReviewsForDelete` and repeating the action. Bound models only.\n */\nclass BlockDeleteWhileInReviewImpl implements EntryBeforeDeleteEventHandler.Interface {\n public constructor(\n private getBoundWorkflow: GetBoundWorkflowUseCase.Interface,\n private listTargetReviews: ListTargetReviewsUseCase.Interface\n ) {}\n\n public async handle(event: EntryBeforeDeleteEventHandler.Event): Promise<void> {\n const { model, entry, permanent } = event.payload;\n const namespace = getCmsNamespace(model);\n if (!namespace) {\n return;\n }\n\n const bound = await this.getBoundWorkflow.execute({ model: namespace });\n if (bound.isFail()) {\n throw bound.error;\n }\n if (!bound.value) {\n return;\n }\n\n const reviews = await this.listTargetReviews.execute({\n model: namespace,\n targetId: entry.entryId,\n state: \"inProgress\"\n });\n if (reviews.isFail()) {\n throw reviews.error;\n }\n const inProgress = reviews.value;\n if (inProgress.length === 0) {\n return;\n }\n\n throw new ReviewActiveOnTrashError({\n model: namespace,\n action: permanent ? \"delete\" : \"trash\",\n reviews: inProgress.map(toBlockingReview)\n });\n }\n}\n\nexport const BlockDeleteWhileInReview = EntryBeforeDeleteEventHandler.createImplementation({\n implementation: BlockDeleteWhileInReviewImpl,\n dependencies: [GetBoundWorkflowUseCase, ListTargetReviewsUseCase]\n});\n"],"names":["BlockDeleteWhileInReviewImpl","getBoundWorkflow","listTargetReviews","event","model","entry","permanent","namespace","getCmsNamespace","bound","reviews","inProgress","ReviewActiveOnTrashError","toBlockingReview","BlockDeleteWhileInReview","EntryBeforeDeleteEventHandler","GetBoundWorkflowUseCase","ListTargetReviewsUseCase"],"mappings":";;;;;;AAYA,MAAMA;IACF,YACYC,gBAAmD,EACnDC,iBAAqD,CAC/D;aAFUD,gBAAgB,GAAhBA;aACAC,iBAAiB,GAAjBA;IACT;IAEH,MAAa,OAAOC,KAA0C,EAAiB;QAC3E,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAGH,MAAM,OAAO;QACjD,MAAMI,YAAYC,gBAAgBJ;QAClC,IAAI,CAACG,WACD;QAGJ,MAAME,QAAQ,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,OAAOF;QAAU;QACrE,IAAIE,MAAM,MAAM,IACZ,MAAMA,MAAM,KAAK;QAErB,IAAI,CAACA,MAAM,KAAK,EACZ;QAGJ,MAAMC,UAAU,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;YACjD,OAAOH;YACP,UAAUF,MAAM,OAAO;YACvB,OAAO;QACX;QACA,IAAIK,QAAQ,MAAM,IACd,MAAMA,QAAQ,KAAK;QAEvB,MAAMC,aAAaD,QAAQ,KAAK;QAChC,IAAIC,AAAsB,MAAtBA,WAAW,MAAM,EACjB;QAGJ,MAAM,IAAIC,yBAAyB;YAC/B,OAAOL;YACP,QAAQD,YAAY,WAAW;YAC/B,SAASK,WAAW,GAAG,CAACE;QAC5B;IACJ;AACJ;AAEO,MAAMC,2BAA2BC,8BAA8B,oBAAoB,CAAC;IACvF,gBAAgBf;IAChB,cAAc;QAACgB;QAAyBC;KAAyB;AACrE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EntryBeforeUpdateEventHandler } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js";
|
|
2
|
+
import { ReviewTargetFolderChangeGuard } from "@webiny/api-workflows/features/review/ReviewTargetFolderChangeGuard/index.js";
|
|
3
|
+
import { CmsEntryReviewNamespace } from "../../features/target/CmsEntryReviewNamespace/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Move rule of the `cms.*` adapter applied to updates (D84, R55, A24). An update can relocate the
|
|
6
|
+
* entry (`UpdateEntryDataFactory` sets `location` from `wbyAco_location`) without publishing
|
|
7
|
+
* `EntryBeforeMove`, and the save block only checks the updated revision. So when an update changes
|
|
8
|
+
* the folder of an entry of a bound model with a review namespace (R51), any in-progress review of
|
|
9
|
+
* the entry (any revision) refuses it like a move. Updates that keep the folder are left to the save block. The
|
|
10
|
+
* rule itself is `ReviewTargetFolderChangeGuard`, shared with the Website Builder page handler.
|
|
11
|
+
*/
|
|
12
|
+
declare class BlockFolderChangeWhileInReviewImpl implements EntryBeforeUpdateEventHandler.Interface {
|
|
13
|
+
private namespaces;
|
|
14
|
+
private folderChangeGuard;
|
|
15
|
+
constructor(namespaces: CmsEntryReviewNamespace.Interface[], folderChangeGuard: ReviewTargetFolderChangeGuard.Interface);
|
|
16
|
+
handle(event: EntryBeforeUpdateEventHandler.Event): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare const BlockFolderChangeWhileInReview: typeof BlockFolderChangeWhileInReviewImpl & {
|
|
19
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-headless-cms/features/contentEntry/UpdateEntry/events").EntryBeforeUpdateEvent>>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EntryBeforeUpdateEventHandler } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js";
|
|
2
|
+
import { ReviewTargetFolderChangeGuard } from "@webiny/api-workflows/features/review/ReviewTargetFolderChangeGuard/index.js";
|
|
3
|
+
import { CmsEntryReviewNamespace } from "../target/CmsEntryReviewNamespace/index.js";
|
|
4
|
+
class BlockFolderChangeWhileInReviewImpl {
|
|
5
|
+
constructor(namespaces, folderChangeGuard){
|
|
6
|
+
this.namespaces = namespaces;
|
|
7
|
+
this.folderChangeGuard = folderChangeGuard;
|
|
8
|
+
}
|
|
9
|
+
async handle(event) {
|
|
10
|
+
const { model, entry, original } = event.payload;
|
|
11
|
+
if (entry.location?.folderId === original.location?.folderId) return;
|
|
12
|
+
let namespace = null;
|
|
13
|
+
for (const candidate of [
|
|
14
|
+
...this.namespaces
|
|
15
|
+
].reverse()){
|
|
16
|
+
const resolved = candidate.resolve(model);
|
|
17
|
+
if (resolved) {
|
|
18
|
+
namespace = resolved;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!namespace) return;
|
|
23
|
+
const checked = await this.folderChangeGuard.check({
|
|
24
|
+
model: namespace,
|
|
25
|
+
targetId: original.entryId
|
|
26
|
+
});
|
|
27
|
+
if (checked.isFail()) throw checked.error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const BlockFolderChangeWhileInReview = EntryBeforeUpdateEventHandler.createImplementation({
|
|
31
|
+
implementation: BlockFolderChangeWhileInReviewImpl,
|
|
32
|
+
dependencies: [
|
|
33
|
+
[
|
|
34
|
+
CmsEntryReviewNamespace,
|
|
35
|
+
{
|
|
36
|
+
multiple: true
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
ReviewTargetFolderChangeGuard
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
export { BlockFolderChangeWhileInReview };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=BlockFolderChangeWhileInReview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/hooks/BlockFolderChangeWhileInReview.js","sources":["../../../src/features/hooks/BlockFolderChangeWhileInReview.ts"],"sourcesContent":["import { EntryBeforeUpdateEventHandler } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { ReviewTargetFolderChangeGuard } from \"@webiny/api-workflows/features/review/ReviewTargetFolderChangeGuard/index.js\";\nimport { CmsEntryReviewNamespace } from \"~/features/target/CmsEntryReviewNamespace/index.js\";\n\n/**\n * Move rule of the `cms.*` adapter applied to updates (D84, R55, A24). An update can relocate the\n * entry (`UpdateEntryDataFactory` sets `location` from `wbyAco_location`) without publishing\n * `EntryBeforeMove`, and the save block only checks the updated revision. So when an update changes\n * the folder of an entry of a bound model with a review namespace (R51), any in-progress review of\n * the entry (any revision) refuses it like a move. Updates that keep the folder are left to the save block. The\n * rule itself is `ReviewTargetFolderChangeGuard`, shared with the Website Builder page handler.\n */\nclass BlockFolderChangeWhileInReviewImpl implements EntryBeforeUpdateEventHandler.Interface {\n public constructor(\n private namespaces: CmsEntryReviewNamespace.Interface[],\n private folderChangeGuard: ReviewTargetFolderChangeGuard.Interface\n ) {}\n\n public async handle(event: EntryBeforeUpdateEventHandler.Event): Promise<void> {\n const { model, entry, original } = event.payload;\n if (entry.location?.folderId === original.location?.folderId) {\n return;\n }\n // The last registered non-null namespace for the model wins (R51).\n let namespace: string | null = null;\n for (const candidate of [...this.namespaces].reverse()) {\n const resolved = candidate.resolve(model);\n if (resolved) {\n namespace = resolved;\n break;\n }\n }\n if (!namespace) {\n return;\n }\n\n const checked = await this.folderChangeGuard.check({\n model: namespace,\n targetId: original.entryId\n });\n if (checked.isFail()) {\n throw checked.error;\n }\n }\n}\n\nexport const BlockFolderChangeWhileInReview = EntryBeforeUpdateEventHandler.createImplementation({\n implementation: BlockFolderChangeWhileInReviewImpl,\n dependencies: [[CmsEntryReviewNamespace, { multiple: true }], ReviewTargetFolderChangeGuard]\n});\n"],"names":["BlockFolderChangeWhileInReviewImpl","namespaces","folderChangeGuard","event","model","entry","original","namespace","candidate","resolved","checked","BlockFolderChangeWhileInReview","EntryBeforeUpdateEventHandler","CmsEntryReviewNamespace","ReviewTargetFolderChangeGuard"],"mappings":";;;AAYA,MAAMA;IACF,YACYC,UAA+C,EAC/CC,iBAA0D,CACpE;aAFUD,UAAU,GAAVA;aACAC,iBAAiB,GAAjBA;IACT;IAEH,MAAa,OAAOC,KAA0C,EAAiB;QAC3E,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGH,MAAM,OAAO;QAChD,IAAIE,MAAM,QAAQ,EAAE,aAAaC,SAAS,QAAQ,EAAE,UAChD;QAGJ,IAAIC,YAA2B;QAC/B,KAAK,MAAMC,aAAa;eAAI,IAAI,CAAC,UAAU;SAAC,CAAC,OAAO,GAAI;YACpD,MAAMC,WAAWD,UAAU,OAAO,CAACJ;YACnC,IAAIK,UAAU;gBACVF,YAAYE;gBACZ;YACJ;QACJ;QACA,IAAI,CAACF,WACD;QAGJ,MAAMG,UAAU,MAAM,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;YAC/C,OAAOH;YACP,UAAUD,SAAS,OAAO;QAC9B;QACA,IAAII,QAAQ,MAAM,IACd,MAAMA,QAAQ,KAAK;IAE3B;AACJ;AAEO,MAAMC,iCAAiCC,8BAA8B,oBAAoB,CAAC;IAC7F,gBAAgBZ;IAChB,cAAc;QAAC;YAACa;YAAyB;gBAAE,UAAU;YAAK;SAAE;QAAEC;KAA8B;AAChG"}
|