@open-mercato/documents 0.6.8-develop.7016.1.4ed7b1e49d
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/README.md +88 -0
- package/build.mjs +23 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/dist/modules/documents/acl.js +15 -0
- package/dist/modules/documents/acl.js.map +7 -0
- package/dist/modules/documents/api/[id]/archive/route.js +116 -0
- package/dist/modules/documents/api/[id]/archive/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/attachments/[attachmentId]/route.js +155 -0
- package/dist/modules/documents/api/[id]/attachments/[attachmentId]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/attachments/route.js +153 -0
- package/dist/modules/documents/api/[id]/attachments/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/collab-token/route.js +180 -0
- package/dist/modules/documents/api/[id]/collab-token/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/comments/access-check/route.js +86 -0
- package/dist/modules/documents/api/[id]/comments/access-check/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/comments/route.js +387 -0
- package/dist/modules/documents/api/[id]/comments/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/content/route.js +143 -0
- package/dist/modules/documents/api/[id]/content/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/duplicate/route.js +200 -0
- package/dist/modules/documents/api/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/export/route.js +421 -0
- package/dist/modules/documents/api/[id]/export/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/favorite/route.js +96 -0
- package/dist/modules/documents/api/[id]/favorite/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/links/[linkId]/route.js +85 -0
- package/dist/modules/documents/api/[id]/links/[linkId]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/links/route.js +257 -0
- package/dist/modules/documents/api/[id]/links/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/principals/route.js +299 -0
- package/dist/modules/documents/api/[id]/principals/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/route.js +246 -0
- package/dist/modules/documents/api/[id]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/shares/route.js +335 -0
- package/dist/modules/documents/api/[id]/shares/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/unarchive/route.js +39 -0
- package/dist/modules/documents/api/[id]/unarchive/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/restore/route.js +133 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/restore/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/route.js +93 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/versions/route.js +193 -0
- package/dist/modules/documents/api/[id]/versions/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/watch/route.js +97 -0
- package/dist/modules/documents/api/[id]/watch/route.js.map +7 -0
- package/dist/modules/documents/api/_commands.js +34 -0
- package/dist/modules/documents/api/_commands.js.map +7 -0
- package/dist/modules/documents/api/_shared.js +490 -0
- package/dist/modules/documents/api/_shared.js.map +7 -0
- package/dist/modules/documents/api/folders/route.js +256 -0
- package/dist/modules/documents/api/folders/route.js.map +7 -0
- package/dist/modules/documents/api/instantiate/route.js +108 -0
- package/dist/modules/documents/api/instantiate/route.js.map +7 -0
- package/dist/modules/documents/api/route.js +322 -0
- package/dist/modules/documents/api/route.js.map +7 -0
- package/dist/modules/documents/api/templates/[templateId]/preview/route.js +94 -0
- package/dist/modules/documents/api/templates/[templateId]/preview/route.js.map +7 -0
- package/dist/modules/documents/api/templates/[templateId]/route.js +82 -0
- package/dist/modules/documents/api/templates/[templateId]/route.js.map +7 -0
- package/dist/modules/documents/api/templates/route.js +344 -0
- package/dist/modules/documents/api/templates/route.js.map +7 -0
- package/dist/modules/documents/backend/documents/DocumentsPageClient.js +160 -0
- package/dist/modules/documents/backend/documents/DocumentsPageClient.js.map +7 -0
- package/dist/modules/documents/backend/documents/DocumentsTable.js +143 -0
- package/dist/modules/documents/backend/documents/DocumentsTable.js.map +7 -0
- package/dist/modules/documents/backend/documents/FolderDialog.js +55 -0
- package/dist/modules/documents/backend/documents/FolderDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/FolderTree.js +40 -0
- package/dist/modules/documents/backend/documents/FolderTree.js.map +7 -0
- package/dist/modules/documents/backend/documents/MoveDocumentDialog.js +64 -0
- package/dist/modules/documents/backend/documents/MoveDocumentDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentAnchorNavigation.js +77 -0
- package/dist/modules/documents/backend/documents/[id]/CommentAnchorNavigation.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentComposer.js +126 -0
- package/dist/modules/documents/backend/documents/[id]/CommentComposer.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentThreadList.js +88 -0
- package/dist/modules/documents/backend/documents/[id]/CommentThreadList.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentsRail.js +123 -0
- package/dist/modules/documents/backend/documents/[id]/CommentsRail.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentCanvas.js +91 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentCanvas.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorErrorBoundary.js +27 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorErrorBoundary.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorIsland.js +50 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorIsland.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorSurface.js +168 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorSurface.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentNavigator.js +129 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentNavigator.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentPageClient.js +429 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentPageClient.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/EditorColorTools.js +68 -0
- package/dist/modules/documents/backend/documents/[id]/EditorColorTools.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/EditorStatusPresence.js +69 -0
- package/dist/modules/documents/backend/documents/[id]/EditorStatusPresence.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/EditorToolbar.js +151 -0
- package/dist/modules/documents/backend/documents/[id]/EditorToolbar.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/ExportMenu.js +121 -0
- package/dist/modules/documents/backend/documents/[id]/ExportMenu.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/MentionPicker.js +114 -0
- package/dist/modules/documents/backend/documents/[id]/MentionPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/OutlinePane.js +70 -0
- package/dist/modules/documents/backend/documents/[id]/OutlinePane.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/RecordFieldsDialog.js +157 -0
- package/dist/modules/documents/backend/documents/[id]/RecordFieldsDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/RelatedRecordsPanel.js +266 -0
- package/dist/modules/documents/backend/documents/[id]/RelatedRecordsPanel.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/VersionHistoryPanel.js +227 -0
- package/dist/modules/documents/backend/documents/[id]/VersionHistoryPanel.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/VersionPreviewDialog.js +157 -0
- package/dist/modules/documents/backend/documents/[id]/VersionPreviewDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/commentTypes.js +150 -0
- package/dist/modules/documents/backend/documents/[id]/commentTypes.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/componentCapabilities.js +13 -0
- package/dist/modules/documents/backend/documents/[id]/componentCapabilities.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/documentPagination.js +295 -0
- package/dist/modules/documents/backend/documents/[id]/documentPagination.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/editorPresenceStyles.js +81 -0
- package/dist/modules/documents/backend/documents/[id]/editorPresenceStyles.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/editorTypes.js +52 -0
- package/dist/modules/documents/backend/documents/[id]/editorTypes.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/page.js +10 -0
- package/dist/modules/documents/backend/documents/[id]/page.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/page.meta.js +16 -0
- package/dist/modules/documents/backend/documents/[id]/page.meta.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/relatedRecordModel.js +38 -0
- package/dist/modules/documents/backend/documents/[id]/relatedRecordModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/restoreVersion.js +33 -0
- package/dist/modules/documents/backend/documents/[id]/restoreVersion.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentCollaboration.js +392 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentCollaboration.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentComments.js +253 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentComments.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentEditor.js +149 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentEditor.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentTitle.js +82 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentTitle.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useEditorInsertions.js +144 -0
- package/dist/modules/documents/backend/documents/[id]/useEditorInsertions.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useFallbackContentPersistence.js +237 -0
- package/dist/modules/documents/backend/documents/[id]/useFallbackContentPersistence.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useMentionPicker.js +216 -0
- package/dist/modules/documents/backend/documents/[id]/useMentionPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/versionHistoryModel.js +25 -0
- package/dist/modules/documents/backend/documents/[id]/versionHistoryModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/EntityPicker.js +156 -0
- package/dist/modules/documents/backend/documents/components/EntityPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/EntityPickerResults.js +46 -0
- package/dist/modules/documents/backend/documents/components/EntityPickerResults.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/NewFromTemplateDialog.js +127 -0
- package/dist/modules/documents/backend/documents/components/NewFromTemplateDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/PrincipalPicker.js +84 -0
- package/dist/modules/documents/backend/documents/components/PrincipalPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/ShareDialog.js +77 -0
- package/dist/modules/documents/backend/documents/components/ShareDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogAddForm.js +93 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogAddForm.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogList.js +82 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogList.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateBodyEditor.js +96 -0
- package/dist/modules/documents/backend/documents/components/TemplateBodyEditor.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateEditorDialog.js +169 -0
- package/dist/modules/documents/backend/documents/components/TemplateEditorDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplatePreview.js +38 -0
- package/dist/modules/documents/backend/documents/components/TemplatePreview.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotFields.js +69 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotFields.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotsEditor.js +71 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotsEditor.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/principalPickerModel.js +63 -0
- package/dist/modules/documents/backend/documents/components/principalPickerModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/shareDialogModel.js +68 -0
- package/dist/modules/documents/backend/documents/components/shareDialogModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/templateUi.js +89 -0
- package/dist/modules/documents/backend/documents/components/templateUi.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useAvailableEntityRegistry.js +30 -0
- package/dist/modules/documents/backend/documents/components/useAvailableEntityRegistry.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useEntitySearch.js +191 -0
- package/dist/modules/documents/backend/documents/components/useEntitySearch.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/usePrincipalPicker.js +221 -0
- package/dist/modules/documents/backend/documents/components/usePrincipalPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useShareDialog.js +236 -0
- package/dist/modules/documents/backend/documents/components/useShareDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useTemplateDetail.js +49 -0
- package/dist/modules/documents/backend/documents/components/useTemplateDetail.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useTemplateInstantiation.js +234 -0
- package/dist/modules/documents/backend/documents/components/useTemplateInstantiation.js.map +7 -0
- package/dist/modules/documents/backend/documents/documentUi.js +106 -0
- package/dist/modules/documents/backend/documents/documentUi.js.map +7 -0
- package/dist/modules/documents/backend/documents/documentsListTypes.js +132 -0
- package/dist/modules/documents/backend/documents/documentsListTypes.js.map +7 -0
- package/dist/modules/documents/backend/documents/page.js +9 -0
- package/dist/modules/documents/backend/documents/page.js.map +7 -0
- package/dist/modules/documents/backend/documents/page.meta.js +26 -0
- package/dist/modules/documents/backend/documents/page.meta.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesPageClient.js +91 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesPageClient.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesTable.js +58 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesTable.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/page.js +9 -0
- package/dist/modules/documents/backend/documents/templates/page.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/page.meta.js +34 -0
- package/dist/modules/documents/backend/documents/templates/page.meta.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/useTemplatesPage.js +139 -0
- package/dist/modules/documents/backend/documents/templates/useTemplatesPage.js.map +7 -0
- package/dist/modules/documents/backend/documents/useDocumentsList.js +314 -0
- package/dist/modules/documents/backend/documents/useDocumentsList.js.map +7 -0
- package/dist/modules/documents/ce.js +8 -0
- package/dist/modules/documents/ce.js.map +7 -0
- package/dist/modules/documents/commands/aggregate.js +99 -0
- package/dist/modules/documents/commands/aggregate.js.map +7 -0
- package/dist/modules/documents/commands/attachments.js +252 -0
- package/dist/modules/documents/commands/attachments.js.map +7 -0
- package/dist/modules/documents/commands/comments.js +782 -0
- package/dist/modules/documents/commands/comments.js.map +7 -0
- package/dist/modules/documents/commands/content.js +238 -0
- package/dist/modules/documents/commands/content.js.map +7 -0
- package/dist/modules/documents/commands/document-crud.js +505 -0
- package/dist/modules/documents/commands/document-crud.js.map +7 -0
- package/dist/modules/documents/commands/documents.js +473 -0
- package/dist/modules/documents/commands/documents.js.map +7 -0
- package/dist/modules/documents/commands/duplicate.js +640 -0
- package/dist/modules/documents/commands/duplicate.js.map +7 -0
- package/dist/modules/documents/commands/favorites.js +150 -0
- package/dist/modules/documents/commands/favorites.js.map +7 -0
- package/dist/modules/documents/commands/folders.js +420 -0
- package/dist/modules/documents/commands/folders.js.map +7 -0
- package/dist/modules/documents/commands/index.js +64 -0
- package/dist/modules/documents/commands/index.js.map +7 -0
- package/dist/modules/documents/commands/interceptors.js +300 -0
- package/dist/modules/documents/commands/interceptors.js.map +7 -0
- package/dist/modules/documents/commands/lifecycle.js +249 -0
- package/dist/modules/documents/commands/lifecycle.js.map +7 -0
- package/dist/modules/documents/commands/links.js +410 -0
- package/dist/modules/documents/commands/links.js.map +7 -0
- package/dist/modules/documents/commands/mutation-helpers.js +42 -0
- package/dist/modules/documents/commands/mutation-helpers.js.map +7 -0
- package/dist/modules/documents/commands/projection-types.js +1 -0
- package/dist/modules/documents/commands/projection-types.js.map +7 -0
- package/dist/modules/documents/commands/shared.js +143 -0
- package/dist/modules/documents/commands/shared.js.map +7 -0
- package/dist/modules/documents/commands/shares.js +527 -0
- package/dist/modules/documents/commands/shares.js.map +7 -0
- package/dist/modules/documents/commands/side-effects.js +103 -0
- package/dist/modules/documents/commands/side-effects.js.map +7 -0
- package/dist/modules/documents/commands/templates.js +461 -0
- package/dist/modules/documents/commands/templates.js.map +7 -0
- package/dist/modules/documents/commands/versions.js +432 -0
- package/dist/modules/documents/commands/versions.js.map +7 -0
- package/dist/modules/documents/commands/watchers.js +164 -0
- package/dist/modules/documents/commands/watchers.js.map +7 -0
- package/dist/modules/documents/data/entities.js +653 -0
- package/dist/modules/documents/data/entities.js.map +7 -0
- package/dist/modules/documents/data/extensions.js +44 -0
- package/dist/modules/documents/data/extensions.js.map +7 -0
- package/dist/modules/documents/data/validators.js +219 -0
- package/dist/modules/documents/data/validators.js.map +7 -0
- package/dist/modules/documents/di.js +35 -0
- package/dist/modules/documents/di.js.map +7 -0
- package/dist/modules/documents/encryption.js +12 -0
- package/dist/modules/documents/encryption.js.map +7 -0
- package/dist/modules/documents/events.js +27 -0
- package/dist/modules/documents/events.js.map +7 -0
- package/dist/modules/documents/index.js +19 -0
- package/dist/modules/documents/index.js.map +7 -0
- package/dist/modules/documents/lib/attachmentServicePort.js +30 -0
- package/dist/modules/documents/lib/attachmentServicePort.js.map +7 -0
- package/dist/modules/documents/lib/capabilities.js +32 -0
- package/dist/modules/documents/lib/capabilities.js.map +7 -0
- package/dist/modules/documents/lib/collabCloseEvents.js +17 -0
- package/dist/modules/documents/lib/collabCloseEvents.js.map +7 -0
- package/dist/modules/documents/lib/collabEndpoint.js +22 -0
- package/dist/modules/documents/lib/collabEndpoint.js.map +7 -0
- package/dist/modules/documents/lib/collabMaterializer.js +107 -0
- package/dist/modules/documents/lib/collabMaterializer.js.map +7 -0
- package/dist/modules/documents/lib/collabToken.js +120 -0
- package/dist/modules/documents/lib/collabToken.js.map +7 -0
- package/dist/modules/documents/lib/collaborationAwareness.js +68 -0
- package/dist/modules/documents/lib/collaborationAwareness.js.map +7 -0
- package/dist/modules/documents/lib/commentAnchors.js +15 -0
- package/dist/modules/documents/lib/commentAnchors.js.map +7 -0
- package/dist/modules/documents/lib/constants.js +25 -0
- package/dist/modules/documents/lib/constants.js.map +7 -0
- package/dist/modules/documents/lib/contentService.js +248 -0
- package/dist/modules/documents/lib/contentService.js.map +7 -0
- package/dist/modules/documents/lib/displayLabels.js +23 -0
- package/dist/modules/documents/lib/displayLabels.js.map +7 -0
- package/dist/modules/documents/lib/docxRenderer.js +601 -0
- package/dist/modules/documents/lib/docxRenderer.js.map +7 -0
- package/dist/modules/documents/lib/duplicateContent.js +22 -0
- package/dist/modules/documents/lib/duplicateContent.js.map +7 -0
- package/dist/modules/documents/lib/editorConfig.js +287 -0
- package/dist/modules/documents/lib/editorConfig.js.map +7 -0
- package/dist/modules/documents/lib/entityLinks.js +148 -0
- package/dist/modules/documents/lib/entityLinks.js.map +7 -0
- package/dist/modules/documents/lib/entityRegistry.js +258 -0
- package/dist/modules/documents/lib/entityRegistry.js.map +7 -0
- package/dist/modules/documents/lib/entityRegistry.server.js +189 -0
- package/dist/modules/documents/lib/entityRegistry.server.js.map +7 -0
- package/dist/modules/documents/lib/entityRegistryAvailability.server.js +9 -0
- package/dist/modules/documents/lib/entityRegistryAvailability.server.js.map +7 -0
- package/dist/modules/documents/lib/entitySuggestion.js +50 -0
- package/dist/modules/documents/lib/entitySuggestion.js.map +7 -0
- package/dist/modules/documents/lib/favorites.js +22 -0
- package/dist/modules/documents/lib/favorites.js.map +7 -0
- package/dist/modules/documents/lib/folderHierarchySerialization.js +19 -0
- package/dist/modules/documents/lib/folderHierarchySerialization.js.map +7 -0
- package/dist/modules/documents/lib/historyLimits.js +100 -0
- package/dist/modules/documents/lib/historyLimits.js.map +7 -0
- package/dist/modules/documents/lib/historyPolicy.js +14 -0
- package/dist/modules/documents/lib/historyPolicy.js.map +7 -0
- package/dist/modules/documents/lib/organizationAccess.js +17 -0
- package/dist/modules/documents/lib/organizationAccess.js.map +7 -0
- package/dist/modules/documents/lib/pdfHtml.js +62 -0
- package/dist/modules/documents/lib/pdfHtml.js.map +7 -0
- package/dist/modules/documents/lib/pdfRenderer.js +284 -0
- package/dist/modules/documents/lib/pdfRenderer.js.map +7 -0
- package/dist/modules/documents/lib/permissions.js +222 -0
- package/dist/modules/documents/lib/permissions.js.map +7 -0
- package/dist/modules/documents/lib/platformServices.js +35 -0
- package/dist/modules/documents/lib/platformServices.js.map +7 -0
- package/dist/modules/documents/lib/recordFieldInsertion.js +58 -0
- package/dist/modules/documents/lib/recordFieldInsertion.js.map +7 -0
- package/dist/modules/documents/lib/requestBody.js +80 -0
- package/dist/modules/documents/lib/requestBody.js.map +7 -0
- package/dist/modules/documents/lib/resourceLimits.js +62 -0
- package/dist/modules/documents/lib/resourceLimits.js.map +7 -0
- package/dist/modules/documents/lib/shareCounts.js +25 -0
- package/dist/modules/documents/lib/shareCounts.js.map +7 -0
- package/dist/modules/documents/lib/templateFill.js +84 -0
- package/dist/modules/documents/lib/templateFill.js.map +7 -0
- package/dist/modules/documents/lib/templateInstantiation.js +147 -0
- package/dist/modules/documents/lib/templateInstantiation.js.map +7 -0
- package/dist/modules/documents/lib/templatePreviewDigest.js +82 -0
- package/dist/modules/documents/lib/templatePreviewDigest.js.map +7 -0
- package/dist/modules/documents/lib/templateSeeds.js +201 -0
- package/dist/modules/documents/lib/templateSeeds.js.map +7 -0
- package/dist/modules/documents/lib/userLabels.js +37 -0
- package/dist/modules/documents/lib/userLabels.js.map +7 -0
- package/dist/modules/documents/lib/versionContent.js +131 -0
- package/dist/modules/documents/lib/versionContent.js.map +7 -0
- package/dist/modules/documents/lib/versionLabels.js +12 -0
- package/dist/modules/documents/lib/versionLabels.js.map +7 -0
- package/dist/modules/documents/lib/versioning.js +14 -0
- package/dist/modules/documents/lib/versioning.js.map +7 -0
- package/dist/modules/documents/lib/visibility.js +422 -0
- package/dist/modules/documents/lib/visibility.js.map +7 -0
- package/dist/modules/documents/lib/watchers.js +106 -0
- package/dist/modules/documents/lib/watchers.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260708163836_documents.js +44 -0
- package/dist/modules/documents/migrations/Migration20260708163836_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260709164720_documents.js +17 -0
- package/dist/modules/documents/migrations/Migration20260709164720_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260710002318_documents.js +32 -0
- package/dist/modules/documents/migrations/Migration20260710002318_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260710071003_documents.js +13 -0
- package/dist/modules/documents/migrations/Migration20260710071003_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260712120000_documents.js +13 -0
- package/dist/modules/documents/migrations/Migration20260712120000_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260712183000_documents.js +14 -0
- package/dist/modules/documents/migrations/Migration20260712183000_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260713092156_documents.js +29 -0
- package/dist/modules/documents/migrations/Migration20260713092156_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260717000000_documents.js +37 -0
- package/dist/modules/documents/migrations/Migration20260717000000_documents.js.map +7 -0
- package/dist/modules/documents/notifications.js +47 -0
- package/dist/modules/documents/notifications.js.map +7 -0
- package/dist/modules/documents/search.js +101 -0
- package/dist/modules/documents/search.js.map +7 -0
- package/dist/modules/documents/setup.js +19 -0
- package/dist/modules/documents/setup.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/LinkDocumentDialog.js +214 -0
- package/dist/modules/documents/widgets/injection/related-documents/LinkDocumentDialog.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/context.js +84 -0
- package/dist/modules/documents/widgets/injection/related-documents/context.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/useRelatedDocuments.js +98 -0
- package/dist/modules/documents/widgets/injection/related-documents/useRelatedDocuments.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.client.js +83 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.client.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.js +19 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.js.map +7 -0
- package/dist/modules/documents/widgets/injection-table.js +21 -0
- package/dist/modules/documents/widgets/injection-table.js.map +7 -0
- package/dist/server/documents-collab-server.js +2260 -0
- package/dist/server/documents-collab-server.js.map +7 -0
- package/generated/entities/document/index.ts +12 -0
- package/generated/entities/document_attachment/index.ts +9 -0
- package/generated/entities/document_comment/index.ts +14 -0
- package/generated/entities/document_content/index.ts +11 -0
- package/generated/entities/document_entity_link/index.ts +19 -0
- package/generated/entities/document_favorite/index.ts +7 -0
- package/generated/entities/document_folder/index.ts +9 -0
- package/generated/entities/document_share/index.ts +11 -0
- package/generated/entities/document_template/index.ts +13 -0
- package/generated/entities/document_version/index.ts +9 -0
- package/generated/entities/document_watcher/index.ts +7 -0
- package/generated/entities.ids.generated.ts +21 -0
- package/generated/entity-fields-registry.ts +151 -0
- package/jest.config.cjs +34 -0
- package/package.json +149 -0
- package/server/documents-collab-server.ts +3416 -0
- package/src/index.ts +1 -0
- package/src/modules/documents/acl.ts +11 -0
- package/src/modules/documents/api/[id]/archive/route.ts +132 -0
- package/src/modules/documents/api/[id]/attachments/[attachmentId]/route.ts +166 -0
- package/src/modules/documents/api/[id]/attachments/route.ts +173 -0
- package/src/modules/documents/api/[id]/collab-token/route.ts +203 -0
- package/src/modules/documents/api/[id]/comments/access-check/route.ts +96 -0
- package/src/modules/documents/api/[id]/comments/route.ts +442 -0
- package/src/modules/documents/api/[id]/content/route.ts +156 -0
- package/src/modules/documents/api/[id]/duplicate/route.ts +231 -0
- package/src/modules/documents/api/[id]/export/route.ts +535 -0
- package/src/modules/documents/api/[id]/favorite/route.ts +110 -0
- package/src/modules/documents/api/[id]/links/[linkId]/route.ts +92 -0
- package/src/modules/documents/api/[id]/links/route.ts +301 -0
- package/src/modules/documents/api/[id]/principals/route.ts +375 -0
- package/src/modules/documents/api/[id]/route.ts +267 -0
- package/src/modules/documents/api/[id]/shares/route.ts +372 -0
- package/src/modules/documents/api/[id]/unarchive/route.ts +42 -0
- package/src/modules/documents/api/[id]/versions/[versionId]/restore/route.ts +152 -0
- package/src/modules/documents/api/[id]/versions/[versionId]/route.ts +100 -0
- package/src/modules/documents/api/[id]/versions/route.ts +207 -0
- package/src/modules/documents/api/[id]/watch/route.ts +111 -0
- package/src/modules/documents/api/_commands.ts +53 -0
- package/src/modules/documents/api/_shared.ts +676 -0
- package/src/modules/documents/api/folders/route.ts +287 -0
- package/src/modules/documents/api/instantiate/route.ts +114 -0
- package/src/modules/documents/api/route.ts +362 -0
- package/src/modules/documents/api/templates/[templateId]/preview/route.ts +97 -0
- package/src/modules/documents/api/templates/[templateId]/route.ts +92 -0
- package/src/modules/documents/api/templates/route.ts +370 -0
- package/src/modules/documents/backend/documents/DocumentsPageClient.tsx +150 -0
- package/src/modules/documents/backend/documents/DocumentsTable.tsx +168 -0
- package/src/modules/documents/backend/documents/FolderDialog.tsx +62 -0
- package/src/modules/documents/backend/documents/FolderTree.tsx +72 -0
- package/src/modules/documents/backend/documents/MoveDocumentDialog.tsx +70 -0
- package/src/modules/documents/backend/documents/[id]/CommentAnchorNavigation.ts +88 -0
- package/src/modules/documents/backend/documents/[id]/CommentComposer.tsx +136 -0
- package/src/modules/documents/backend/documents/[id]/CommentThreadList.tsx +131 -0
- package/src/modules/documents/backend/documents/[id]/CommentsRail.tsx +138 -0
- package/src/modules/documents/backend/documents/[id]/DocumentCanvas.tsx +111 -0
- package/src/modules/documents/backend/documents/[id]/DocumentEditorErrorBoundary.tsx +39 -0
- package/src/modules/documents/backend/documents/[id]/DocumentEditorIsland.tsx +50 -0
- package/src/modules/documents/backend/documents/[id]/DocumentEditorSurface.tsx +162 -0
- package/src/modules/documents/backend/documents/[id]/DocumentNavigator.tsx +129 -0
- package/src/modules/documents/backend/documents/[id]/DocumentPageClient.tsx +463 -0
- package/src/modules/documents/backend/documents/[id]/EditorColorTools.tsx +71 -0
- package/src/modules/documents/backend/documents/[id]/EditorStatusPresence.tsx +78 -0
- package/src/modules/documents/backend/documents/[id]/EditorToolbar.tsx +108 -0
- package/src/modules/documents/backend/documents/[id]/ExportMenu.tsx +144 -0
- package/src/modules/documents/backend/documents/[id]/MentionPicker.tsx +137 -0
- package/src/modules/documents/backend/documents/[id]/OutlinePane.tsx +98 -0
- package/src/modules/documents/backend/documents/[id]/RecordFieldsDialog.tsx +185 -0
- package/src/modules/documents/backend/documents/[id]/RelatedRecordsPanel.tsx +320 -0
- package/src/modules/documents/backend/documents/[id]/VersionHistoryPanel.tsx +244 -0
- package/src/modules/documents/backend/documents/[id]/VersionPreviewDialog.tsx +197 -0
- package/src/modules/documents/backend/documents/[id]/commentTypes.ts +192 -0
- package/src/modules/documents/backend/documents/[id]/componentCapabilities.ts +17 -0
- package/src/modules/documents/backend/documents/[id]/documentPagination.ts +352 -0
- package/src/modules/documents/backend/documents/[id]/editorPresenceStyles.ts +77 -0
- package/src/modules/documents/backend/documents/[id]/editorTypes.ts +84 -0
- package/src/modules/documents/backend/documents/[id]/page.meta.ts +12 -0
- package/src/modules/documents/backend/documents/[id]/page.tsx +6 -0
- package/src/modules/documents/backend/documents/[id]/relatedRecordModel.ts +49 -0
- package/src/modules/documents/backend/documents/[id]/restoreVersion.ts +49 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentCollaboration.ts +458 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentComments.ts +286 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentEditor.ts +157 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentTitle.ts +77 -0
- package/src/modules/documents/backend/documents/[id]/useEditorInsertions.ts +147 -0
- package/src/modules/documents/backend/documents/[id]/useFallbackContentPersistence.ts +277 -0
- package/src/modules/documents/backend/documents/[id]/useMentionPicker.ts +259 -0
- package/src/modules/documents/backend/documents/[id]/versionHistoryModel.ts +29 -0
- package/src/modules/documents/backend/documents/components/EntityPicker.tsx +171 -0
- package/src/modules/documents/backend/documents/components/EntityPickerResults.tsx +64 -0
- package/src/modules/documents/backend/documents/components/NewFromTemplateDialog.tsx +136 -0
- package/src/modules/documents/backend/documents/components/PrincipalPicker.tsx +90 -0
- package/src/modules/documents/backend/documents/components/ShareDialog.tsx +88 -0
- package/src/modules/documents/backend/documents/components/ShareDialogAddForm.tsx +113 -0
- package/src/modules/documents/backend/documents/components/ShareDialogList.tsx +117 -0
- package/src/modules/documents/backend/documents/components/TemplateBodyEditor.tsx +96 -0
- package/src/modules/documents/backend/documents/components/TemplateEditorDialog.tsx +171 -0
- package/src/modules/documents/backend/documents/components/TemplatePreview.tsx +43 -0
- package/src/modules/documents/backend/documents/components/TemplateSlotFields.tsx +72 -0
- package/src/modules/documents/backend/documents/components/TemplateSlotsEditor.tsx +72 -0
- package/src/modules/documents/backend/documents/components/principalPickerModel.ts +86 -0
- package/src/modules/documents/backend/documents/components/shareDialogModel.ts +94 -0
- package/src/modules/documents/backend/documents/components/templateUi.ts +128 -0
- package/src/modules/documents/backend/documents/components/useAvailableEntityRegistry.ts +43 -0
- package/src/modules/documents/backend/documents/components/useEntitySearch.ts +197 -0
- package/src/modules/documents/backend/documents/components/usePrincipalPicker.ts +165 -0
- package/src/modules/documents/backend/documents/components/useShareDialog.ts +267 -0
- package/src/modules/documents/backend/documents/components/useTemplateDetail.ts +54 -0
- package/src/modules/documents/backend/documents/components/useTemplateInstantiation.ts +252 -0
- package/src/modules/documents/backend/documents/documentUi.ts +134 -0
- package/src/modules/documents/backend/documents/documentsListTypes.ts +163 -0
- package/src/modules/documents/backend/documents/page.meta.ts +24 -0
- package/src/modules/documents/backend/documents/page.tsx +5 -0
- package/src/modules/documents/backend/documents/templates/TemplatesPageClient.tsx +93 -0
- package/src/modules/documents/backend/documents/templates/TemplatesTable.tsx +71 -0
- package/src/modules/documents/backend/documents/templates/page.meta.ts +32 -0
- package/src/modules/documents/backend/documents/templates/page.tsx +5 -0
- package/src/modules/documents/backend/documents/templates/useTemplatesPage.tsx +148 -0
- package/src/modules/documents/backend/documents/useDocumentsList.tsx +305 -0
- package/src/modules/documents/ce.ts +6 -0
- package/src/modules/documents/commands/aggregate.ts +128 -0
- package/src/modules/documents/commands/attachments.ts +309 -0
- package/src/modules/documents/commands/comments.ts +966 -0
- package/src/modules/documents/commands/content.ts +294 -0
- package/src/modules/documents/commands/document-crud.ts +609 -0
- package/src/modules/documents/commands/documents.ts +581 -0
- package/src/modules/documents/commands/duplicate.ts +772 -0
- package/src/modules/documents/commands/favorites.ts +171 -0
- package/src/modules/documents/commands/folders.ts +506 -0
- package/src/modules/documents/commands/index.ts +33 -0
- package/src/modules/documents/commands/interceptors.ts +402 -0
- package/src/modules/documents/commands/lifecycle.ts +333 -0
- package/src/modules/documents/commands/links.ts +486 -0
- package/src/modules/documents/commands/mutation-helpers.ts +48 -0
- package/src/modules/documents/commands/projection-types.ts +77 -0
- package/src/modules/documents/commands/shared.ts +219 -0
- package/src/modules/documents/commands/shares.ts +612 -0
- package/src/modules/documents/commands/side-effects.ts +130 -0
- package/src/modules/documents/commands/templates.ts +522 -0
- package/src/modules/documents/commands/versions.ts +537 -0
- package/src/modules/documents/commands/watchers.ts +181 -0
- package/src/modules/documents/data/entities.ts +631 -0
- package/src/modules/documents/data/extensions.ts +42 -0
- package/src/modules/documents/data/validators.ts +248 -0
- package/src/modules/documents/di.ts +33 -0
- package/src/modules/documents/encryption.ts +14 -0
- package/src/modules/documents/events.ts +23 -0
- package/src/modules/documents/i18n/.hardcoded-allowlist.json +9 -0
- package/src/modules/documents/i18n/de.json +522 -0
- package/src/modules/documents/i18n/en.json +522 -0
- package/src/modules/documents/i18n/es.json +522 -0
- package/src/modules/documents/i18n/ko.json +522 -0
- package/src/modules/documents/i18n/pl.json +522 -0
- package/src/modules/documents/index.ts +17 -0
- package/src/modules/documents/lib/attachmentServicePort.ts +94 -0
- package/src/modules/documents/lib/capabilities.ts +57 -0
- package/src/modules/documents/lib/collabCloseEvents.ts +26 -0
- package/src/modules/documents/lib/collabEndpoint.ts +43 -0
- package/src/modules/documents/lib/collabMaterializer.ts +140 -0
- package/src/modules/documents/lib/collabToken.ts +170 -0
- package/src/modules/documents/lib/collaborationAwareness.ts +102 -0
- package/src/modules/documents/lib/commentAnchors.ts +19 -0
- package/src/modules/documents/lib/constants.ts +39 -0
- package/src/modules/documents/lib/contentService.ts +340 -0
- package/src/modules/documents/lib/displayLabels.ts +31 -0
- package/src/modules/documents/lib/docxRenderer.ts +685 -0
- package/src/modules/documents/lib/duplicateContent.ts +32 -0
- package/src/modules/documents/lib/editorConfig.ts +371 -0
- package/src/modules/documents/lib/entityLinks.ts +250 -0
- package/src/modules/documents/lib/entityRegistry.server.ts +267 -0
- package/src/modules/documents/lib/entityRegistry.ts +345 -0
- package/src/modules/documents/lib/entityRegistryAvailability.server.ts +19 -0
- package/src/modules/documents/lib/entitySuggestion.ts +61 -0
- package/src/modules/documents/lib/favorites.ts +35 -0
- package/src/modules/documents/lib/folderHierarchySerialization.ts +34 -0
- package/src/modules/documents/lib/historyLimits.ts +154 -0
- package/src/modules/documents/lib/historyPolicy.ts +7 -0
- package/src/modules/documents/lib/organizationAccess.ts +44 -0
- package/src/modules/documents/lib/pdfHtml.ts +65 -0
- package/src/modules/documents/lib/pdfRenderer.ts +367 -0
- package/src/modules/documents/lib/permissions.ts +299 -0
- package/src/modules/documents/lib/platformServices.ts +70 -0
- package/src/modules/documents/lib/recordFieldInsertion.ts +72 -0
- package/src/modules/documents/lib/requestBody.ts +97 -0
- package/src/modules/documents/lib/resourceLimits.ts +94 -0
- package/src/modules/documents/lib/shareCounts.ts +44 -0
- package/src/modules/documents/lib/templateFill.ts +138 -0
- package/src/modules/documents/lib/templateInstantiation.ts +206 -0
- package/src/modules/documents/lib/templatePreviewDigest.ts +122 -0
- package/src/modules/documents/lib/templateSeeds.ts +248 -0
- package/src/modules/documents/lib/userLabels.ts +58 -0
- package/src/modules/documents/lib/versionContent.ts +163 -0
- package/src/modules/documents/lib/versionLabels.ts +9 -0
- package/src/modules/documents/lib/versioning.ts +29 -0
- package/src/modules/documents/lib/visibility.ts +610 -0
- package/src/modules/documents/lib/watchers.ts +129 -0
- package/src/modules/documents/migrations/.snapshot-open-mercato.json +2892 -0
- package/src/modules/documents/migrations/Migration20260708163836_documents.ts +50 -0
- package/src/modules/documents/migrations/Migration20260709164720_documents.ts +19 -0
- package/src/modules/documents/migrations/Migration20260710002318_documents.ts +35 -0
- package/src/modules/documents/migrations/Migration20260710071003_documents.ts +13 -0
- package/src/modules/documents/migrations/Migration20260712120000_documents.ts +13 -0
- package/src/modules/documents/migrations/Migration20260712183000_documents.ts +12 -0
- package/src/modules/documents/migrations/Migration20260713092156_documents.ts +43 -0
- package/src/modules/documents/migrations/Migration20260717000000_documents.ts +40 -0
- package/src/modules/documents/notifications.ts +45 -0
- package/src/modules/documents/search.ts +118 -0
- package/src/modules/documents/setup.ts +19 -0
- package/src/modules/documents/widgets/injection/related-documents/LinkDocumentDialog.tsx +224 -0
- package/src/modules/documents/widgets/injection/related-documents/context.ts +101 -0
- package/src/modules/documents/widgets/injection/related-documents/useRelatedDocuments.ts +112 -0
- package/src/modules/documents/widgets/injection/related-documents/widget.client.tsx +76 -0
- package/src/modules/documents/widgets/injection/related-documents/widget.ts +19 -0
- package/src/modules/documents/widgets/injection-table.ts +20 -0
- package/tsconfig.json +9 -0
- package/watch.mjs +6 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import './links'
|
|
2
|
+
import './documents'
|
|
3
|
+
import './versions'
|
|
4
|
+
import './document-crud'
|
|
5
|
+
import './folders'
|
|
6
|
+
import './shares'
|
|
7
|
+
import './comments'
|
|
8
|
+
import './templates'
|
|
9
|
+
import './content'
|
|
10
|
+
import './attachments'
|
|
11
|
+
import './lifecycle'
|
|
12
|
+
import './favorites'
|
|
13
|
+
import './watchers'
|
|
14
|
+
import './duplicate'
|
|
15
|
+
|
|
16
|
+
export { createLinkCommand, deleteLinkCommand } from './links'
|
|
17
|
+
export { instantiateDocumentCommand } from './documents'
|
|
18
|
+
export { createVersionCommand, restoreVersionCommand } from './versions'
|
|
19
|
+
export {
|
|
20
|
+
createDocumentCommand,
|
|
21
|
+
updateDocumentCommand,
|
|
22
|
+
deleteDocumentCommand,
|
|
23
|
+
} from './document-crud'
|
|
24
|
+
export { createFolderCommand, updateFolderCommand, deleteFolderCommand } from './folders'
|
|
25
|
+
export { createShareCommand, updateShareCommand, deleteShareCommand } from './shares'
|
|
26
|
+
export { createCommentCommand, resolveCommentCommand } from './comments'
|
|
27
|
+
export { createTemplateCommand, updateTemplateCommand, deleteTemplateCommand } from './templates'
|
|
28
|
+
export { replaceDocumentContentCommand } from './content'
|
|
29
|
+
export { createDocumentAttachmentCommand, deleteDocumentAttachmentCommand } from './attachments'
|
|
30
|
+
export { archiveDocumentCommand, unarchiveDocumentCommand } from './lifecycle'
|
|
31
|
+
export { createFavoriteCommand, deleteFavoriteCommand } from './favorites'
|
|
32
|
+
export { createWatchCommand, deleteWatchCommand } from './watchers'
|
|
33
|
+
export { duplicateDocumentCommand } from './duplicate'
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
2
|
+
import type {
|
|
3
|
+
CommandInterceptor,
|
|
4
|
+
CommandInterceptorContext,
|
|
5
|
+
CommandInterceptorUndoContext,
|
|
6
|
+
} from '@open-mercato/shared/lib/commands/command-interceptor'
|
|
7
|
+
import { extractUndoPayload } from '@open-mercato/shared/lib/commands/undo'
|
|
8
|
+
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
10
|
+
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
11
|
+
import { Document } from '../data/entities'
|
|
12
|
+
import { DOCUMENTS_ENTITY_IDS } from '../lib/constants'
|
|
13
|
+
import { resolveWatcherRecipients } from '../lib/watchers'
|
|
14
|
+
import type { DocumentsServiceContainer } from '../lib/platformServices'
|
|
15
|
+
import { emitDocumentsEvent } from '../events'
|
|
16
|
+
import type {
|
|
17
|
+
DocumentsProjectedCommandResult,
|
|
18
|
+
DocumentsProjectionDescriptor,
|
|
19
|
+
DocumentsProjectionUndoPayload,
|
|
20
|
+
} from './projection-types'
|
|
21
|
+
|
|
22
|
+
const logger = createLogger('documents').child({ component: 'command-projections' })
|
|
23
|
+
|
|
24
|
+
const PROJECTED_COMMAND_IDS = [
|
|
25
|
+
'documents.content.replace',
|
|
26
|
+
'documents.share.create',
|
|
27
|
+
'documents.share.update',
|
|
28
|
+
'documents.share.delete',
|
|
29
|
+
'documents.comment.create',
|
|
30
|
+
'documents.comment.resolve',
|
|
31
|
+
'documents.version.restore',
|
|
32
|
+
'documents.document.archive',
|
|
33
|
+
'documents.document.unarchive',
|
|
34
|
+
'documents.document.duplicate',
|
|
35
|
+
] as const
|
|
36
|
+
|
|
37
|
+
type DocumentsNotificationService = {
|
|
38
|
+
create: (
|
|
39
|
+
input: Record<string, unknown>,
|
|
40
|
+
scope: { tenantId: string; organizationId: string },
|
|
41
|
+
) => Promise<unknown>
|
|
42
|
+
deleteBySource: (
|
|
43
|
+
sourceEntityType: string,
|
|
44
|
+
sourceEntityId: string,
|
|
45
|
+
scope: { tenantId: string; organizationId: string },
|
|
46
|
+
) => Promise<unknown>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function resolveDocumentsNotificationService(
|
|
50
|
+
container: CommandInterceptorContext['container'],
|
|
51
|
+
): DocumentsNotificationService {
|
|
52
|
+
const service = container.resolve('notificationService') as Partial<DocumentsNotificationService> | null
|
|
53
|
+
if (!service || typeof service.create !== 'function' || typeof service.deleteBySource !== 'function') {
|
|
54
|
+
throw new Error('[internal] Notification service is unavailable')
|
|
55
|
+
}
|
|
56
|
+
return service as DocumentsNotificationService
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function readResultProjections(result: unknown): DocumentsProjectionDescriptor[] {
|
|
60
|
+
if (!result || typeof result !== 'object' || Array.isArray(result)) return []
|
|
61
|
+
const projections = (result as DocumentsProjectedCommandResult).projections
|
|
62
|
+
return Array.isArray(projections) ? projections : []
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function emitProjectedEvent(
|
|
66
|
+
descriptor: Extract<DocumentsProjectionDescriptor, { kind: 'event' }>,
|
|
67
|
+
context: CommandInterceptorContext,
|
|
68
|
+
options: { overrideActor?: boolean } = {},
|
|
69
|
+
): Promise<void> {
|
|
70
|
+
const currentActorUserId = context.auth?.userId ?? context.auth?.sub ?? null
|
|
71
|
+
const payload = {
|
|
72
|
+
...descriptor.payload,
|
|
73
|
+
...(currentActorUserId && (options.overrideActor || !('userId' in descriptor.payload))
|
|
74
|
+
? { userId: currentActorUserId }
|
|
75
|
+
: {}),
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
await emitDocumentsEvent(descriptor.eventId, payload, {
|
|
79
|
+
tenantId: descriptor.tenantId,
|
|
80
|
+
organizationId: descriptor.organizationId,
|
|
81
|
+
})
|
|
82
|
+
} catch (error) {
|
|
83
|
+
logger.error('Command event projection failed', {
|
|
84
|
+
commandId: context.commandId,
|
|
85
|
+
eventId: descriptor.eventId,
|
|
86
|
+
err: error,
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function emitMentionProjection(
|
|
92
|
+
descriptor: Extract<DocumentsProjectionDescriptor, { kind: 'mention-notification' }>,
|
|
93
|
+
context: CommandInterceptorContext,
|
|
94
|
+
): Promise<void> {
|
|
95
|
+
try {
|
|
96
|
+
const notificationService = resolveDocumentsNotificationService(context.container)
|
|
97
|
+
await notificationService.create(
|
|
98
|
+
{
|
|
99
|
+
recipientUserId: descriptor.recipientUserId,
|
|
100
|
+
type: 'documents.comment.mentioned',
|
|
101
|
+
titleKey: 'documents.notifications.comment.mentioned.title',
|
|
102
|
+
bodyKey: 'documents.notifications.comment.mentioned.body',
|
|
103
|
+
severity: 'info',
|
|
104
|
+
titleVariables: { documentTitle: descriptor.documentTitle },
|
|
105
|
+
bodyVariables: {
|
|
106
|
+
documentTitle: descriptor.documentTitle,
|
|
107
|
+
authorUserId: descriptor.authorUserId,
|
|
108
|
+
},
|
|
109
|
+
sourceEntityType: DOCUMENTS_ENTITY_IDS.documentComment,
|
|
110
|
+
sourceEntityId: descriptor.commentId,
|
|
111
|
+
linkHref: `/backend/documents/${encodeURIComponent(descriptor.documentId)}?commentId=${encodeURIComponent(descriptor.commentId)}`,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
tenantId: descriptor.tenantId,
|
|
115
|
+
organizationId: descriptor.organizationId,
|
|
116
|
+
},
|
|
117
|
+
)
|
|
118
|
+
} catch (error) {
|
|
119
|
+
logger.error('Mention notification projection failed', {
|
|
120
|
+
commandId: context.commandId,
|
|
121
|
+
commentId: descriptor.commentId,
|
|
122
|
+
recipientUserId: descriptor.recipientUserId,
|
|
123
|
+
err: error,
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const WATCH_NOTIFICATION_TITLE_KEYS: Record<string, string> = {
|
|
129
|
+
'documents.watch.commented': 'documents.notifications.watch.commented.title',
|
|
130
|
+
'documents.watch.changed': 'documents.notifications.watch.changed.title',
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function emitWatchProjection(
|
|
134
|
+
descriptor: Extract<DocumentsProjectionDescriptor, { kind: 'watch-notification' }>,
|
|
135
|
+
context: CommandInterceptorContext,
|
|
136
|
+
): Promise<void> {
|
|
137
|
+
try {
|
|
138
|
+
const notificationService = resolveDocumentsNotificationService(context.container)
|
|
139
|
+
await notificationService.create(
|
|
140
|
+
{
|
|
141
|
+
recipientUserId: descriptor.recipientUserId,
|
|
142
|
+
type: descriptor.notificationType,
|
|
143
|
+
titleKey: WATCH_NOTIFICATION_TITLE_KEYS[descriptor.notificationType],
|
|
144
|
+
bodyKey: descriptor.bodyKey,
|
|
145
|
+
severity: 'info',
|
|
146
|
+
titleVariables: { documentTitle: descriptor.documentTitle },
|
|
147
|
+
bodyVariables: { documentTitle: descriptor.documentTitle },
|
|
148
|
+
sourceEntityType: descriptor.sourceEntityType,
|
|
149
|
+
sourceEntityId: descriptor.sourceEntityId,
|
|
150
|
+
linkHref: descriptor.linkHref,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
tenantId: descriptor.tenantId,
|
|
154
|
+
organizationId: descriptor.organizationId,
|
|
155
|
+
},
|
|
156
|
+
)
|
|
157
|
+
} catch (error) {
|
|
158
|
+
logger.error('Watch notification projection failed', {
|
|
159
|
+
commandId: context.commandId,
|
|
160
|
+
documentId: descriptor.documentId,
|
|
161
|
+
recipientUserId: descriptor.recipientUserId,
|
|
162
|
+
err: error,
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function emitWatchFanoutProjection(
|
|
168
|
+
descriptor: Extract<DocumentsProjectionDescriptor, { kind: 'watch-notification-fanout' }>,
|
|
169
|
+
context: CommandInterceptorContext,
|
|
170
|
+
): Promise<void> {
|
|
171
|
+
try {
|
|
172
|
+
const em = context.container.resolve('em') as EntityManager
|
|
173
|
+
const scope = { tenantId: descriptor.tenantId, organizationId: descriptor.organizationId }
|
|
174
|
+
const document = await findOneWithDecryption(
|
|
175
|
+
em,
|
|
176
|
+
Document,
|
|
177
|
+
{ id: descriptor.documentId, tenantId: scope.tenantId, organizationId: scope.organizationId, deletedAt: null },
|
|
178
|
+
{ fields: ['id', 'title'] },
|
|
179
|
+
scope,
|
|
180
|
+
)
|
|
181
|
+
if (!document) return
|
|
182
|
+
const recipientUserIds = await resolveWatcherRecipients({
|
|
183
|
+
em,
|
|
184
|
+
container: context.container as unknown as DocumentsServiceContainer,
|
|
185
|
+
scope,
|
|
186
|
+
documentId: descriptor.documentId,
|
|
187
|
+
actorUserId: context.auth?.userId ?? context.auth?.sub ?? descriptor.actorUserId,
|
|
188
|
+
})
|
|
189
|
+
for (const recipientUserId of recipientUserIds) {
|
|
190
|
+
await emitWatchProjection(
|
|
191
|
+
{
|
|
192
|
+
kind: 'watch-notification',
|
|
193
|
+
recipientUserId,
|
|
194
|
+
tenantId: descriptor.tenantId,
|
|
195
|
+
organizationId: descriptor.organizationId,
|
|
196
|
+
documentId: descriptor.documentId,
|
|
197
|
+
documentTitle: document.title,
|
|
198
|
+
notificationType: descriptor.notificationType,
|
|
199
|
+
bodyKey: descriptor.bodyKey,
|
|
200
|
+
sourceEntityType: descriptor.sourceEntityType,
|
|
201
|
+
sourceEntityId: descriptor.sourceEntityId,
|
|
202
|
+
linkHref: descriptor.linkHref,
|
|
203
|
+
},
|
|
204
|
+
context,
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
} catch (error) {
|
|
208
|
+
logger.error('Watch notification fanout projection failed', {
|
|
209
|
+
commandId: context.commandId,
|
|
210
|
+
documentId: descriptor.documentId,
|
|
211
|
+
err: error,
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async function emitDocumentIndexProjection(
|
|
217
|
+
descriptor: Extract<DocumentsProjectionDescriptor, { kind: 'document-index' }>,
|
|
218
|
+
context: CommandInterceptorContext,
|
|
219
|
+
): Promise<void> {
|
|
220
|
+
try {
|
|
221
|
+
const searchIndexer = context.container.resolve('searchIndexer') as {
|
|
222
|
+
indexRecordById: (input: {
|
|
223
|
+
entityId: string
|
|
224
|
+
recordId: string
|
|
225
|
+
tenantId: string
|
|
226
|
+
organizationId: string
|
|
227
|
+
}) => Promise<unknown>
|
|
228
|
+
}
|
|
229
|
+
await searchIndexer.indexRecordById({
|
|
230
|
+
entityId: DOCUMENTS_ENTITY_IDS.document,
|
|
231
|
+
recordId: descriptor.documentId,
|
|
232
|
+
tenantId: descriptor.tenantId,
|
|
233
|
+
organizationId: descriptor.organizationId,
|
|
234
|
+
})
|
|
235
|
+
} catch (error) {
|
|
236
|
+
logger.error('Document index projection failed', {
|
|
237
|
+
commandId: context.commandId,
|
|
238
|
+
documentId: descriptor.documentId,
|
|
239
|
+
err: error,
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async function deleteMentionNotificationProjection(
|
|
245
|
+
descriptor: Extract<DocumentsProjectionDescriptor, { kind: 'mention-notification-delete' }>,
|
|
246
|
+
context: CommandInterceptorContext,
|
|
247
|
+
): Promise<void> {
|
|
248
|
+
try {
|
|
249
|
+
const notificationService = resolveDocumentsNotificationService(context.container)
|
|
250
|
+
await notificationService.deleteBySource(
|
|
251
|
+
DOCUMENTS_ENTITY_IDS.documentComment,
|
|
252
|
+
descriptor.commentId,
|
|
253
|
+
{
|
|
254
|
+
tenantId: descriptor.tenantId,
|
|
255
|
+
organizationId: descriptor.organizationId,
|
|
256
|
+
},
|
|
257
|
+
)
|
|
258
|
+
} catch (error) {
|
|
259
|
+
logger.error('Mention notification cleanup projection failed', {
|
|
260
|
+
commandId: context.commandId,
|
|
261
|
+
commentId: descriptor.commentId,
|
|
262
|
+
err: error,
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
async function projectDescriptors(
|
|
268
|
+
projections: readonly DocumentsProjectionDescriptor[],
|
|
269
|
+
context: CommandInterceptorContext,
|
|
270
|
+
options: { overrideEventActor?: boolean } = {},
|
|
271
|
+
): Promise<void> {
|
|
272
|
+
for (const projection of projections) {
|
|
273
|
+
if (projection.kind === 'event') {
|
|
274
|
+
await emitProjectedEvent(projection, context, { overrideActor: options.overrideEventActor })
|
|
275
|
+
}
|
|
276
|
+
else if (projection.kind === 'mention-notification') await emitMentionProjection(projection, context)
|
|
277
|
+
else if (projection.kind === 'watch-notification') await emitWatchProjection(projection, context)
|
|
278
|
+
else if (projection.kind === 'watch-notification-fanout') await emitWatchFanoutProjection(projection, context)
|
|
279
|
+
else if (projection.kind === 'document-index') await emitDocumentIndexProjection(projection, context)
|
|
280
|
+
else await deleteMentionNotificationProjection(projection, context)
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function buildProjectionInterceptor(commandId: typeof PROJECTED_COMMAND_IDS[number]): CommandInterceptor {
|
|
285
|
+
return {
|
|
286
|
+
id: `documents.${commandId.slice('documents.'.length).replaceAll('.', '-')}-projections`,
|
|
287
|
+
targetCommand: commandId,
|
|
288
|
+
priority: 90,
|
|
289
|
+
async afterExecute(_input, result, context): Promise<void> {
|
|
290
|
+
await projectDescriptors(readResultProjections(result), context)
|
|
291
|
+
},
|
|
292
|
+
async afterUndo(
|
|
293
|
+
undoContext: CommandInterceptorUndoContext,
|
|
294
|
+
context: CommandInterceptorContext,
|
|
295
|
+
): Promise<void> {
|
|
296
|
+
const undo = extractUndoPayload<DocumentsProjectionUndoPayload>(
|
|
297
|
+
undoContext.logEntry as Parameters<typeof extractUndoPayload>[0],
|
|
298
|
+
)
|
|
299
|
+
await projectDescriptors(
|
|
300
|
+
undo?.projectionsAfterUndo ?? [],
|
|
301
|
+
context,
|
|
302
|
+
{ overrideEventActor: true },
|
|
303
|
+
)
|
|
304
|
+
},
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const ARCHIVED_UNDO_GUARDED_COMMAND_IDS = [
|
|
309
|
+
'documents.document.update',
|
|
310
|
+
'documents.share.create',
|
|
311
|
+
'documents.share.update',
|
|
312
|
+
'documents.share.delete',
|
|
313
|
+
'documents.comment.create',
|
|
314
|
+
'documents.comment.resolve',
|
|
315
|
+
'documents.link.create',
|
|
316
|
+
'documents.link.delete',
|
|
317
|
+
'documents.version.restore',
|
|
318
|
+
] as const
|
|
319
|
+
|
|
320
|
+
type UndoLogEntryShape = {
|
|
321
|
+
resourceKind?: string | null
|
|
322
|
+
resourceId?: string | null
|
|
323
|
+
parentResourceKind?: string | null
|
|
324
|
+
parentResourceId?: string | null
|
|
325
|
+
tenantId?: string | null
|
|
326
|
+
organizationId?: string | null
|
|
327
|
+
commandPayload?: unknown
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function resolveUndoDocumentId(logEntry: UndoLogEntryShape): string | null {
|
|
331
|
+
if (logEntry.parentResourceKind === DOCUMENTS_ENTITY_IDS.document && logEntry.parentResourceId) {
|
|
332
|
+
return logEntry.parentResourceId
|
|
333
|
+
}
|
|
334
|
+
if (logEntry.resourceKind === DOCUMENTS_ENTITY_IDS.document && logEntry.resourceId) {
|
|
335
|
+
return logEntry.resourceId
|
|
336
|
+
}
|
|
337
|
+
const payload = logEntry.commandPayload
|
|
338
|
+
if (payload && typeof payload === 'object') {
|
|
339
|
+
const redoInput = (payload as { __redoInput?: unknown }).__redoInput
|
|
340
|
+
if (redoInput && typeof redoInput === 'object') {
|
|
341
|
+
const documentId = (redoInput as { documentId?: unknown }).documentId
|
|
342
|
+
if (typeof documentId === 'string' && documentId.length > 0) return documentId
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return null
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Read-only means the undo path too: reversing a pre-archive share, comment,
|
|
350
|
+
* link, or restore would mutate an archived document, so the guard refuses
|
|
351
|
+
* with the same error the execute path uses. Delete-like undos (duplicate,
|
|
352
|
+
* instantiate) stay allowed, matching delete-of-archived semantics.
|
|
353
|
+
*/
|
|
354
|
+
function buildArchivedUndoGuard(commandId: typeof ARCHIVED_UNDO_GUARDED_COMMAND_IDS[number]): CommandInterceptor {
|
|
355
|
+
return {
|
|
356
|
+
id: `documents.${commandId.slice('documents.'.length).replaceAll('.', '-')}-archived-undo-guard`,
|
|
357
|
+
targetCommand: commandId,
|
|
358
|
+
priority: 100,
|
|
359
|
+
async beforeUndo(
|
|
360
|
+
undoContext: CommandInterceptorUndoContext,
|
|
361
|
+
context: CommandInterceptorContext,
|
|
362
|
+
): Promise<void> {
|
|
363
|
+
const logEntry = undoContext.logEntry as UndoLogEntryShape
|
|
364
|
+
const documentId = resolveUndoDocumentId(logEntry)
|
|
365
|
+
if (!documentId || !logEntry.tenantId || !logEntry.organizationId) {
|
|
366
|
+
// Every guarded command records the document and its scope. Without
|
|
367
|
+
// them the archived state cannot be read, so refuse the undo instead of
|
|
368
|
+
// waving through a mutation this guard was unable to check.
|
|
369
|
+
logger.error('Archived-undo guard could not resolve the guarded document scope', {
|
|
370
|
+
commandId,
|
|
371
|
+
resourceKind: logEntry.resourceKind ?? null,
|
|
372
|
+
resourceId: logEntry.resourceId ?? null,
|
|
373
|
+
})
|
|
374
|
+
throw new CrudHttpError(403, { error: 'api.errors.forbidden' })
|
|
375
|
+
}
|
|
376
|
+
const em = context.container.resolve('em') as EntityManager
|
|
377
|
+
const scope = { tenantId: logEntry.tenantId, organizationId: logEntry.organizationId }
|
|
378
|
+
const document = await findOneWithDecryption(
|
|
379
|
+
em,
|
|
380
|
+
Document,
|
|
381
|
+
{ id: documentId, tenantId: scope.tenantId, organizationId: scope.organizationId },
|
|
382
|
+
{ fields: ['id', 'archivedAt'], filters: false },
|
|
383
|
+
scope,
|
|
384
|
+
)
|
|
385
|
+
if (document?.archivedAt) {
|
|
386
|
+
throw new CrudHttpError(403, { error: 'documents.errors.documentArchived' })
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Projection hooks are deliberately post-command. CommandBus persists the
|
|
394
|
+
* ActionLog (or marks it undone) before these hooks run, so a flaky event bus
|
|
395
|
+
* or notification store can never roll back an acknowledged document write.
|
|
396
|
+
*/
|
|
397
|
+
export const interceptors: CommandInterceptor[] = [
|
|
398
|
+
...PROJECTED_COMMAND_IDS.map(buildProjectionInterceptor),
|
|
399
|
+
...ARCHIVED_UNDO_GUARDED_COMMAND_IDS.map(buildArchivedUndoGuard),
|
|
400
|
+
]
|
|
401
|
+
|
|
402
|
+
export default interceptors
|