@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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/relatedRecordModel.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n firstSafeDocumentsDisplayLabel,\n sanitizeDocumentsDisplayLabel,\n} from '../../../lib/displayLabels'\nimport {\n getEntityTokenFieldNames,\n type DocumentEntityType,\n} from '../../../lib/entityRegistry'\nimport { readBoolean, readRecord, readString } from '../documentUi'\n\nexport type RelatedRecord = {\n id: string\n entityType: DocumentEntityType\n label: string\n href: string | null\n canOpen: boolean\n source: 'chip' | 'template' | 'related-panel'\n updatedAt: string\n values: Record<string, string | null>\n}\n\nexport function normalizeRelatedRecord(value: unknown, fallbackLabel: string): RelatedRecord | null {\n const record = readRecord(value)\n if (!record) return null\n const id = readString(record, 'id')\n const entityType = readString(record, 'entityType', 'entity_type') as DocumentEntityType | null\n const label = firstSafeDocumentsDisplayLabel(readString(record, 'label'), fallbackLabel)\n const updatedAt = readString(record, 'updatedAt', 'updated_at')\n const source = readString(record, 'source') as RelatedRecord['source'] | null\n if (!id || !entityType || !label || !updatedAt || !source) return null\n const canOpen = readBoolean(record, 'canOpen', 'can_open') ?? false\n const rawValues = canOpen ? readRecord(record.values) : null\n const values = rawValues\n ? Object.fromEntries(Array.from(getEntityTokenFieldNames(entityType), (field) => [\n field,\n sanitizeDocumentsDisplayLabel(rawValues[field]),\n ]))\n : {}\n return {\n id,\n entityType,\n label,\n updatedAt,\n source,\n href: readString(record, 'href'),\n canOpen,\n values,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AACP,SAAS,aAAa,YAAY,kBAAkB;AAa7C,SAAS,uBAAuB,OAAgB,eAA6C;AAClG,QAAM,SAAS,WAAW,KAAK;AAC/B,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,KAAK,WAAW,QAAQ,IAAI;AAClC,QAAM,aAAa,WAAW,QAAQ,cAAc,aAAa;AACjE,QAAM,QAAQ,+BAA+B,WAAW,QAAQ,OAAO,GAAG,aAAa;AACvF,QAAM,YAAY,WAAW,QAAQ,aAAa,YAAY;AAC9D,QAAM,SAAS,WAAW,QAAQ,QAAQ;AAC1C,MAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC,OAAQ,QAAO;AAClE,QAAM,UAAU,YAAY,QAAQ,WAAW,UAAU,KAAK;AAC9D,QAAM,YAAY,UAAU,WAAW,OAAO,MAAM,IAAI;AACxD,QAAM,SAAS,YACX,OAAO,YAAY,MAAM,KAAK,yBAAyB,UAAU,GAAG,CAAC,UAAU;AAAA,IAC7E;AAAA,IACA,8BAA8B,UAAU,KAAK,CAAC;AAAA,EAChD,CAAC,CAAC,IACF,CAAC;AACL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,WAAW,QAAQ,MAAM;AAAA,IAC/B;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiCallOrThrow,
|
|
3
|
+
withScopedApiRequestHeaders
|
|
4
|
+
} from "@open-mercato/ui/backend/utils/apiCall";
|
|
5
|
+
import { buildOptimisticLockHeader } from "@open-mercato/ui/backend/utils/optimisticLock";
|
|
6
|
+
import { normalizeDocumentContent } from "../documentUi.js";
|
|
7
|
+
async function restoreVersionWithCurrentContentToken({
|
|
8
|
+
documentId,
|
|
9
|
+
versionId,
|
|
10
|
+
errorMessage
|
|
11
|
+
}) {
|
|
12
|
+
const contentCall = await apiCallOrThrow(
|
|
13
|
+
`/api/documents/${encodeURIComponent(documentId)}/content`,
|
|
14
|
+
void 0,
|
|
15
|
+
{ errorMessage }
|
|
16
|
+
);
|
|
17
|
+
const contentUpdatedAt = normalizeDocumentContent(contentCall.result).updatedAt;
|
|
18
|
+
if (!contentUpdatedAt || !Number.isFinite(Date.parse(contentUpdatedAt))) {
|
|
19
|
+
throw new Error(errorMessage);
|
|
20
|
+
}
|
|
21
|
+
return withScopedApiRequestHeaders(
|
|
22
|
+
buildOptimisticLockHeader(contentUpdatedAt),
|
|
23
|
+
() => apiCallOrThrow(
|
|
24
|
+
`/api/documents/${encodeURIComponent(documentId)}/versions/${encodeURIComponent(versionId)}/restore`,
|
|
25
|
+
{ method: "POST" },
|
|
26
|
+
{ errorMessage }
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
restoreVersionWithCurrentContentToken
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=restoreVersion.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/restoreVersion.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n apiCallOrThrow,\n withScopedApiRequestHeaders,\n} from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { normalizeDocumentContent } from '../documentUi'\n\ntype RestoreVersionWithCurrentContentTokenInput = {\n documentId: string\n versionId: string\n errorMessage: string\n}\n\n/**\n * Restore a version against the content row's CURRENT optimistic-lock token.\n *\n * The token observed when the page loaded is unusable here: every keystroke\n * the caller made since (materialized by the collaboration sidecar, or saved\n * by the single-user autosave) advanced `updated_at`, so restoring after any\n * edit answered a spurious 409, and a document opened before its content row\n * existed had no token at all. Reading the token immediately before the\n * restore keeps the lock meaningful for the concurrent-write race it exists\n * for, while the server-side pre-restore snapshot preserves whatever\n * collaborators wrote in between.\n */\nexport async function restoreVersionWithCurrentContentToken({\n documentId,\n versionId,\n errorMessage,\n}: RestoreVersionWithCurrentContentTokenInput) {\n const contentCall = await apiCallOrThrow<unknown>(\n `/api/documents/${encodeURIComponent(documentId)}/content`,\n undefined,\n { errorMessage },\n )\n const contentUpdatedAt = normalizeDocumentContent(contentCall.result).updatedAt\n if (!contentUpdatedAt || !Number.isFinite(Date.parse(contentUpdatedAt))) {\n throw new Error(errorMessage)\n }\n\n return withScopedApiRequestHeaders(\n buildOptimisticLockHeader(contentUpdatedAt),\n () => apiCallOrThrow(\n `/api/documents/${encodeURIComponent(documentId)}/versions/${encodeURIComponent(versionId)}/restore`,\n { method: 'POST' },\n { errorMessage },\n ),\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,iCAAiC;AAC1C,SAAS,gCAAgC;AAoBzC,eAAsB,sCAAsC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AACF,GAA+C;AAC7C,QAAM,cAAc,MAAM;AAAA,IACxB,kBAAkB,mBAAmB,UAAU,CAAC;AAAA,IAChD;AAAA,IACA,EAAE,aAAa;AAAA,EACjB;AACA,QAAM,mBAAmB,yBAAyB,YAAY,MAAM,EAAE;AACtE,MAAI,CAAC,oBAAoB,CAAC,OAAO,SAAS,KAAK,MAAM,gBAAgB,CAAC,GAAG;AACvE,UAAM,IAAI,MAAM,YAAY;AAAA,EAC9B;AAEA,SAAO;AAAA,IACL,0BAA0B,gBAAgB;AAAA,IAC1C,MAAM;AAAA,MACJ,kBAAkB,mBAAmB,UAAU,CAAC,aAAa,mBAAmB,SAAS,CAAC;AAAA,MAC1F,EAAE,QAAQ,OAAO;AAAA,MACjB,EAAE,aAAa;AAAA,IACjB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { HocuspocusProvider } from "@hocuspocus/provider";
|
|
4
|
+
import * as Y from "yjs";
|
|
5
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
6
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
7
|
+
import {
|
|
8
|
+
sanitizeDocumentsDisplayLabel
|
|
9
|
+
} from "../../../lib/displayLabels.js";
|
|
10
|
+
import {
|
|
11
|
+
firstSafeCollaborationAwarenessName,
|
|
12
|
+
normalizeCollaborationColor,
|
|
13
|
+
resolveCollaborationUserColor
|
|
14
|
+
} from "../../../lib/collaborationAwareness.js";
|
|
15
|
+
import { isCollabContentResetCloseEvent } from "../../../lib/collabCloseEvents.js";
|
|
16
|
+
import {
|
|
17
|
+
readNumber,
|
|
18
|
+
readRecord,
|
|
19
|
+
readString
|
|
20
|
+
} from "./editorTypes.js";
|
|
21
|
+
const COLLABORATION_INITIAL_TIMEOUT_MS = 6e3;
|
|
22
|
+
const COLLABORATION_RECONNECT_GRACE_MS = 750;
|
|
23
|
+
const COLLABORATION_OFFLINE_AFTER_MS = 6e3;
|
|
24
|
+
const COLLABORATION_PROVIDER_RETRY = {
|
|
25
|
+
delay: 250,
|
|
26
|
+
initialDelay: 0,
|
|
27
|
+
factor: 1.5,
|
|
28
|
+
minDelay: 200,
|
|
29
|
+
maxDelay: 2e3,
|
|
30
|
+
maxAttempts: 0,
|
|
31
|
+
jitter: true
|
|
32
|
+
};
|
|
33
|
+
function classifyCollabTokenResponse(call, fallbackUserLabel) {
|
|
34
|
+
if (call.ok) {
|
|
35
|
+
const token = normalizeCollabTokenPayload(call.result, fallbackUserLabel);
|
|
36
|
+
return token ? { kind: "ok", token } : { kind: "fatal" };
|
|
37
|
+
}
|
|
38
|
+
const retryableClientStatus = call.status === 408 || call.status === 425 || call.status === 429;
|
|
39
|
+
if (call.status >= 400 && call.status < 500 && !retryableClientStatus) {
|
|
40
|
+
return { kind: "fatal" };
|
|
41
|
+
}
|
|
42
|
+
return { kind: "transient" };
|
|
43
|
+
}
|
|
44
|
+
async function fetchCollabTokenAttempt(documentId, fallbackUserLabel, call = (path, init) => apiCall(path, init)) {
|
|
45
|
+
try {
|
|
46
|
+
const response = await call(
|
|
47
|
+
`/api/documents/${encodeURIComponent(documentId)}/collab-token`,
|
|
48
|
+
{
|
|
49
|
+
headers: {
|
|
50
|
+
"x-om-forbidden-redirect": "0",
|
|
51
|
+
"x-om-unauthorized-redirect": "0"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
return classifyCollabTokenResponse(response, fallbackUserLabel);
|
|
56
|
+
} catch {
|
|
57
|
+
return { kind: "transient" };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function createCollaborationStatusController(options) {
|
|
61
|
+
let disposed = false;
|
|
62
|
+
let hasSynced = false;
|
|
63
|
+
let outageActive = false;
|
|
64
|
+
let reconnectingTimer = null;
|
|
65
|
+
let offlineTimer = null;
|
|
66
|
+
const clearOutageTimers = () => {
|
|
67
|
+
if (reconnectingTimer !== null) clearTimeout(reconnectingTimer);
|
|
68
|
+
if (offlineTimer !== null) clearTimeout(offlineTimer);
|
|
69
|
+
reconnectingTimer = null;
|
|
70
|
+
offlineTimer = null;
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
connected() {
|
|
74
|
+
if (disposed) return;
|
|
75
|
+
hasSynced = true;
|
|
76
|
+
outageActive = false;
|
|
77
|
+
clearOutageTimers();
|
|
78
|
+
options.onStatus("connected");
|
|
79
|
+
},
|
|
80
|
+
disconnected() {
|
|
81
|
+
if (disposed || !hasSynced || outageActive) return;
|
|
82
|
+
outageActive = true;
|
|
83
|
+
reconnectingTimer = setTimeout(() => {
|
|
84
|
+
reconnectingTimer = null;
|
|
85
|
+
if (!disposed) options.onStatus("reconnecting");
|
|
86
|
+
}, COLLABORATION_RECONNECT_GRACE_MS);
|
|
87
|
+
offlineTimer = setTimeout(() => {
|
|
88
|
+
offlineTimer = null;
|
|
89
|
+
if (!disposed) options.onStatus("offline");
|
|
90
|
+
}, COLLABORATION_OFFLINE_AFTER_MS);
|
|
91
|
+
},
|
|
92
|
+
dispose() {
|
|
93
|
+
disposed = true;
|
|
94
|
+
clearOutageTimers();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function applyCollaborationProviderStatus(controller, payload) {
|
|
99
|
+
const record = readRecord(payload);
|
|
100
|
+
if (readString(record ?? {}, "status") !== "connected") controller.disconnected();
|
|
101
|
+
}
|
|
102
|
+
function restartConnectedCollaborationSocket(websocket) {
|
|
103
|
+
if (websocket.status !== "connected" || !websocket.webSocket) return false;
|
|
104
|
+
websocket.webSocket.close();
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
function createCollaborationSocketLifecycle(websocket) {
|
|
108
|
+
let disposed = false;
|
|
109
|
+
let reconnectInFlight = false;
|
|
110
|
+
const ensureConnected = () => {
|
|
111
|
+
if (disposed || reconnectInFlight || websocket.status !== "disconnected" || typeof websocket.connect !== "function") return false;
|
|
112
|
+
reconnectInFlight = true;
|
|
113
|
+
void Promise.resolve(websocket.connect()).catch(() => void 0).finally(() => {
|
|
114
|
+
reconnectInFlight = false;
|
|
115
|
+
});
|
|
116
|
+
return true;
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
connected() {
|
|
120
|
+
reconnectInFlight = false;
|
|
121
|
+
},
|
|
122
|
+
disconnected() {
|
|
123
|
+
reconnectInFlight = false;
|
|
124
|
+
return ensureConnected();
|
|
125
|
+
},
|
|
126
|
+
logicalClose() {
|
|
127
|
+
return restartConnectedCollaborationSocket(websocket) || ensureConnected();
|
|
128
|
+
},
|
|
129
|
+
ensureConnected,
|
|
130
|
+
dispose() {
|
|
131
|
+
disposed = true;
|
|
132
|
+
reconnectInFlight = false;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function normalizeCollabTokenPayload(payload, fallbackUserLabel) {
|
|
137
|
+
const root = readRecord(payload);
|
|
138
|
+
const user = readRecord(root?.user);
|
|
139
|
+
if (!root || !user) return null;
|
|
140
|
+
const token = readString(root, "token");
|
|
141
|
+
const collaborationDisabled = root.url === null;
|
|
142
|
+
const documentId = readString(root, "documentId", "document_id");
|
|
143
|
+
const tier = readString(root, "tier");
|
|
144
|
+
const expiresInSec = readNumber(root, "expiresInSec", "expires_in_sec");
|
|
145
|
+
const id = readString(user, "id");
|
|
146
|
+
const name = firstSafeCollaborationAwarenessName(
|
|
147
|
+
readString(user, "name"),
|
|
148
|
+
readString(root, "userName", "user_name"),
|
|
149
|
+
fallbackUserLabel
|
|
150
|
+
);
|
|
151
|
+
const color = readString(user, "color") ?? readString(root, "userColor", "user_color");
|
|
152
|
+
if (!token && !collaborationDisabled || !documentId || !tier || !expiresInSec || !id || !name || !color) return null;
|
|
153
|
+
return {
|
|
154
|
+
token: token ?? "",
|
|
155
|
+
documentId,
|
|
156
|
+
tier,
|
|
157
|
+
expiresInSec,
|
|
158
|
+
user: { id, name, color: resolveCollaborationUserColor(id) },
|
|
159
|
+
url: collaborationDisabled ? null : readString(root, "url"),
|
|
160
|
+
canEdit: root.canEdit === true,
|
|
161
|
+
readOnly: root.readOnly !== false
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function readCollaborationPresence(provider, fallbackUserLabel) {
|
|
165
|
+
const states = provider.awareness?.getStates();
|
|
166
|
+
if (!states) return [];
|
|
167
|
+
const seen = /* @__PURE__ */ new Set();
|
|
168
|
+
const users = [];
|
|
169
|
+
states.forEach((value, clientId) => {
|
|
170
|
+
if (clientId === provider.document.clientID) return;
|
|
171
|
+
const state = readRecord(value);
|
|
172
|
+
const user = readRecord(state?.user);
|
|
173
|
+
const name = firstSafeCollaborationAwarenessName(
|
|
174
|
+
user ? readString(user, "name") : null,
|
|
175
|
+
fallbackUserLabel
|
|
176
|
+
);
|
|
177
|
+
const id = user ? readString(user, "id") : null;
|
|
178
|
+
const suppliedColor = user ? readString(user, "color") : null;
|
|
179
|
+
if (!name || !suppliedColor) return;
|
|
180
|
+
const color = id ? resolveCollaborationUserColor(id) : normalizeCollaborationColor(suppliedColor);
|
|
181
|
+
const key = id ? `user:${id}` : `${name}:${color}`;
|
|
182
|
+
if (!seen.has(key)) {
|
|
183
|
+
seen.add(key);
|
|
184
|
+
users.push({ key, name, color });
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
return users;
|
|
188
|
+
}
|
|
189
|
+
function destroy(resources) {
|
|
190
|
+
try {
|
|
191
|
+
resources.provider.destroy();
|
|
192
|
+
} finally {
|
|
193
|
+
resources.ydoc.destroy();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function useDocumentCollaboration(documentId) {
|
|
197
|
+
const t = useT();
|
|
198
|
+
const fallbackUserLabel = sanitizeDocumentsDisplayLabel(t("documents.users.unknown"));
|
|
199
|
+
const resourcesRef = React.useRef(null);
|
|
200
|
+
const [state, setState] = React.useState({ mode: "connecting" });
|
|
201
|
+
const [sessionEpoch, setSessionEpoch] = React.useState(0);
|
|
202
|
+
React.useEffect(() => {
|
|
203
|
+
let active = true;
|
|
204
|
+
let terminal = false;
|
|
205
|
+
let local = null;
|
|
206
|
+
let initialTimer = null;
|
|
207
|
+
let initialRetryTimer = null;
|
|
208
|
+
let tokenRetryTimer = null;
|
|
209
|
+
let statusController = null;
|
|
210
|
+
let socketLifecycle = null;
|
|
211
|
+
let removeResumeListeners = null;
|
|
212
|
+
let lastTokenFailure = null;
|
|
213
|
+
const clearInitialTimers = () => {
|
|
214
|
+
if (initialTimer !== null) clearTimeout(initialTimer);
|
|
215
|
+
if (initialRetryTimer !== null) clearTimeout(initialRetryTimer);
|
|
216
|
+
initialTimer = null;
|
|
217
|
+
initialRetryTimer = null;
|
|
218
|
+
};
|
|
219
|
+
const clearTokenRetryTimer = () => {
|
|
220
|
+
if (tokenRetryTimer !== null) clearTimeout(tokenRetryTimer);
|
|
221
|
+
tokenRetryTimer = null;
|
|
222
|
+
};
|
|
223
|
+
const fallback = (readOnly = false) => {
|
|
224
|
+
if (!active || terminal) return;
|
|
225
|
+
terminal = true;
|
|
226
|
+
clearInitialTimers();
|
|
227
|
+
clearTokenRetryTimer();
|
|
228
|
+
statusController?.dispose();
|
|
229
|
+
socketLifecycle?.dispose();
|
|
230
|
+
removeResumeListeners?.();
|
|
231
|
+
removeResumeListeners = null;
|
|
232
|
+
if (local && resourcesRef.current === local) {
|
|
233
|
+
resourcesRef.current = null;
|
|
234
|
+
destroy(local);
|
|
235
|
+
}
|
|
236
|
+
local = null;
|
|
237
|
+
setState({ mode: "fallback", readOnly });
|
|
238
|
+
};
|
|
239
|
+
const fetchToken = async () => {
|
|
240
|
+
return fetchCollabTokenAttempt(documentId, fallbackUserLabel);
|
|
241
|
+
};
|
|
242
|
+
const freshToken = async () => {
|
|
243
|
+
const next = await fetchToken();
|
|
244
|
+
if (next.kind === "ok") {
|
|
245
|
+
lastTokenFailure = null;
|
|
246
|
+
if (active && !terminal && local && resourcesRef.current === local) {
|
|
247
|
+
const serverReadOnly = next.token.readOnly || !next.token.canEdit;
|
|
248
|
+
setState((current) => current.mode === "collab" && current.resources === local ? { ...current, serverReadOnly } : current);
|
|
249
|
+
}
|
|
250
|
+
return next.token.token;
|
|
251
|
+
}
|
|
252
|
+
lastTokenFailure = next.kind;
|
|
253
|
+
throw new Error(`[internal] Collaboration token refresh ${next.kind}`);
|
|
254
|
+
};
|
|
255
|
+
const start = async () => {
|
|
256
|
+
const initial = await fetchToken();
|
|
257
|
+
if (!active || terminal) return;
|
|
258
|
+
if (initial.kind === "transient") {
|
|
259
|
+
initialRetryTimer = setTimeout(() => {
|
|
260
|
+
initialRetryTimer = null;
|
|
261
|
+
void start();
|
|
262
|
+
}, COLLABORATION_PROVIDER_RETRY.delay);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (initial.kind === "fatal") {
|
|
266
|
+
fallback(true);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
if (!initial.token.url) {
|
|
270
|
+
fallback(initial.token.readOnly || !initial.token.canEdit);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const ydoc = new Y.Doc();
|
|
274
|
+
const provider = new HocuspocusProvider({
|
|
275
|
+
url: initial.token.url,
|
|
276
|
+
name: documentId,
|
|
277
|
+
document: ydoc,
|
|
278
|
+
token: freshToken,
|
|
279
|
+
...COLLABORATION_PROVIDER_RETRY
|
|
280
|
+
});
|
|
281
|
+
const resources = { ydoc, provider, user: initial.token.user };
|
|
282
|
+
local = resources;
|
|
283
|
+
resourcesRef.current = resources;
|
|
284
|
+
const update = (connectionStatus) => {
|
|
285
|
+
if (!active || resourcesRef.current !== resources) return;
|
|
286
|
+
setState((current) => current.mode === "collab" && current.resources === resources ? { ...current, connectionStatus } : current);
|
|
287
|
+
};
|
|
288
|
+
statusController = createCollaborationStatusController({
|
|
289
|
+
onStatus: update
|
|
290
|
+
});
|
|
291
|
+
const websocket = provider.configuration.websocketProvider;
|
|
292
|
+
socketLifecycle = createCollaborationSocketLifecycle(websocket);
|
|
293
|
+
const resume = () => socketLifecycle?.ensureConnected();
|
|
294
|
+
const resumeWhenVisible = () => {
|
|
295
|
+
if (document.visibilityState === "visible") resume();
|
|
296
|
+
};
|
|
297
|
+
window.addEventListener("online", resume);
|
|
298
|
+
window.addEventListener("pageshow", resume);
|
|
299
|
+
document.addEventListener("visibilitychange", resumeWhenVisible);
|
|
300
|
+
removeResumeListeners = () => {
|
|
301
|
+
window.removeEventListener("online", resume);
|
|
302
|
+
window.removeEventListener("pageshow", resume);
|
|
303
|
+
document.removeEventListener("visibilitychange", resumeWhenVisible);
|
|
304
|
+
};
|
|
305
|
+
const updatePresence = () => setState((current) => current.mode === "collab" && current.resources === resources ? { ...current, presenceUsers: readCollaborationPresence(provider, fallbackUserLabel) } : current);
|
|
306
|
+
provider.on("status", (payload) => {
|
|
307
|
+
const record = readRecord(payload);
|
|
308
|
+
if (readString(record ?? {}, "status") === "connected") socketLifecycle?.connected();
|
|
309
|
+
if (statusController) applyCollaborationProviderStatus(statusController, payload);
|
|
310
|
+
});
|
|
311
|
+
provider.on("synced", () => {
|
|
312
|
+
lastTokenFailure = null;
|
|
313
|
+
clearInitialTimers();
|
|
314
|
+
clearTokenRetryTimer();
|
|
315
|
+
statusController?.connected();
|
|
316
|
+
});
|
|
317
|
+
provider.on("authenticationFailed", () => {
|
|
318
|
+
const tokenFailure = lastTokenFailure;
|
|
319
|
+
lastTokenFailure = null;
|
|
320
|
+
if (tokenFailure === "fatal") {
|
|
321
|
+
fallback(true);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
statusController?.disconnected();
|
|
325
|
+
clearTokenRetryTimer();
|
|
326
|
+
tokenRetryTimer = setTimeout(() => {
|
|
327
|
+
tokenRetryTimer = null;
|
|
328
|
+
if (!active || terminal || resourcesRef.current !== resources) return;
|
|
329
|
+
const websocket2 = provider.configuration.websocketProvider;
|
|
330
|
+
websocket2.webSocket?.close();
|
|
331
|
+
}, COLLABORATION_PROVIDER_RETRY.delay);
|
|
332
|
+
});
|
|
333
|
+
provider.on("disconnect", () => {
|
|
334
|
+
statusController?.disconnected();
|
|
335
|
+
socketLifecycle?.disconnected();
|
|
336
|
+
});
|
|
337
|
+
provider.on("close", (payload) => {
|
|
338
|
+
const closeEvent = readRecord(payload)?.event;
|
|
339
|
+
if (isCollabContentResetCloseEvent(closeEvent)) {
|
|
340
|
+
if (!active || terminal || resourcesRef.current !== resources) return;
|
|
341
|
+
terminal = true;
|
|
342
|
+
socketLifecycle?.dispose();
|
|
343
|
+
statusController?.dispose();
|
|
344
|
+
provider.configuration.websocketProvider.disconnect();
|
|
345
|
+
setSessionEpoch((current) => current + 1);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
statusController?.disconnected();
|
|
349
|
+
socketLifecycle?.logicalClose();
|
|
350
|
+
});
|
|
351
|
+
provider.awareness?.on("change", updatePresence);
|
|
352
|
+
setState({
|
|
353
|
+
mode: "collab",
|
|
354
|
+
resources,
|
|
355
|
+
connectionStatus: "connecting",
|
|
356
|
+
presenceUsers: readCollaborationPresence(provider, fallbackUserLabel),
|
|
357
|
+
serverReadOnly: initial.token.readOnly || !initial.token.canEdit
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
setState({ mode: "connecting" });
|
|
361
|
+
initialTimer = setTimeout(fallback, COLLABORATION_INITIAL_TIMEOUT_MS);
|
|
362
|
+
void start().catch(() => fallback(false));
|
|
363
|
+
return () => {
|
|
364
|
+
active = false;
|
|
365
|
+
terminal = true;
|
|
366
|
+
clearInitialTimers();
|
|
367
|
+
clearTokenRetryTimer();
|
|
368
|
+
statusController?.dispose();
|
|
369
|
+
socketLifecycle?.dispose();
|
|
370
|
+
removeResumeListeners?.();
|
|
371
|
+
if (local) destroy(local);
|
|
372
|
+
if (resourcesRef.current === local) resourcesRef.current = null;
|
|
373
|
+
};
|
|
374
|
+
}, [documentId, fallbackUserLabel, sessionEpoch]);
|
|
375
|
+
return state;
|
|
376
|
+
}
|
|
377
|
+
export {
|
|
378
|
+
COLLABORATION_INITIAL_TIMEOUT_MS,
|
|
379
|
+
COLLABORATION_OFFLINE_AFTER_MS,
|
|
380
|
+
COLLABORATION_PROVIDER_RETRY,
|
|
381
|
+
COLLABORATION_RECONNECT_GRACE_MS,
|
|
382
|
+
applyCollaborationProviderStatus,
|
|
383
|
+
classifyCollabTokenResponse,
|
|
384
|
+
createCollaborationSocketLifecycle,
|
|
385
|
+
createCollaborationStatusController,
|
|
386
|
+
fetchCollabTokenAttempt,
|
|
387
|
+
normalizeCollabTokenPayload,
|
|
388
|
+
readCollaborationPresence,
|
|
389
|
+
restartConnectedCollaborationSocket,
|
|
390
|
+
useDocumentCollaboration
|
|
391
|
+
};
|
|
392
|
+
//# sourceMappingURL=useDocumentCollaboration.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/useDocumentCollaboration.ts"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { HocuspocusProvider } from '@hocuspocus/provider'\nimport * as Y from 'yjs'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n sanitizeDocumentsDisplayLabel,\n} from '../../../lib/displayLabels'\nimport {\n firstSafeCollaborationAwarenessName,\n normalizeCollaborationColor,\n resolveCollaborationUserColor,\n} from '../../../lib/collaborationAwareness'\nimport { isCollabContentResetCloseEvent } from '../../../lib/collabCloseEvents'\nimport {\n readNumber,\n readRecord,\n readString,\n type CollabResources,\n type CollabState,\n type CollabTokenUser,\n type ConnectionStatus,\n type PresenceUser,\n} from './editorTypes'\n\nexport const COLLABORATION_INITIAL_TIMEOUT_MS = 6000\nexport const COLLABORATION_RECONNECT_GRACE_MS = 750\nexport const COLLABORATION_OFFLINE_AFTER_MS = 6000\nexport const COLLABORATION_PROVIDER_RETRY = {\n delay: 250,\n initialDelay: 0,\n factor: 1.5,\n minDelay: 200,\n maxDelay: 2000,\n maxAttempts: 0,\n jitter: true,\n} as const\n\ntype CollabTokenResponse = {\n token: string\n url: string | null\n documentId: string\n tier: string\n expiresInSec: number\n user: CollabTokenUser\n canEdit: boolean\n readOnly: boolean\n}\n\ntype CollabTokenAttempt =\n | { kind: 'ok'; token: CollabTokenResponse }\n | { kind: 'fatal' }\n | { kind: 'transient' }\n\ntype TimeoutHandle = ReturnType<typeof setTimeout>\ntype CollabApiCall = (\n path: string,\n init: RequestInit,\n) => Promise<{ ok: boolean; status: number; result: unknown }>\n\nexport function classifyCollabTokenResponse(\n call: { ok: boolean; status: number; result: unknown },\n fallbackUserLabel: string | null,\n): CollabTokenAttempt {\n if (call.ok) {\n const token = normalizeCollabTokenPayload(call.result, fallbackUserLabel)\n return token ? { kind: 'ok', token } : { kind: 'fatal' }\n }\n\n const retryableClientStatus = call.status === 408 || call.status === 425 || call.status === 429\n if (call.status >= 400 && call.status < 500 && !retryableClientStatus) {\n return { kind: 'fatal' }\n }\n return { kind: 'transient' }\n}\n\nexport async function fetchCollabTokenAttempt(\n documentId: string,\n fallbackUserLabel: string | null,\n call: CollabApiCall = (path, init) => apiCall<unknown>(path, init),\n): Promise<CollabTokenAttempt> {\n try {\n const response = await call(\n `/api/documents/${encodeURIComponent(documentId)}/collab-token`,\n {\n headers: {\n 'x-om-forbidden-redirect': '0',\n 'x-om-unauthorized-redirect': '0',\n },\n },\n )\n return classifyCollabTokenResponse(response, fallbackUserLabel)\n } catch {\n return { kind: 'transient' }\n }\n}\n\nexport function createCollaborationStatusController(options: {\n onStatus: (status: ConnectionStatus) => void\n}) {\n let disposed = false\n let hasSynced = false\n let outageActive = false\n let reconnectingTimer: TimeoutHandle | null = null\n let offlineTimer: TimeoutHandle | null = null\n\n const clearOutageTimers = () => {\n if (reconnectingTimer !== null) clearTimeout(reconnectingTimer)\n if (offlineTimer !== null) clearTimeout(offlineTimer)\n reconnectingTimer = null\n offlineTimer = null\n }\n\n return {\n connected() {\n if (disposed) return\n hasSynced = true\n outageActive = false\n clearOutageTimers()\n options.onStatus('connected')\n },\n disconnected() {\n if (disposed || !hasSynced || outageActive) return\n outageActive = true\n reconnectingTimer = setTimeout(() => {\n reconnectingTimer = null\n if (!disposed) options.onStatus('reconnecting')\n }, COLLABORATION_RECONNECT_GRACE_MS)\n offlineTimer = setTimeout(() => {\n offlineTimer = null\n if (!disposed) options.onStatus('offline')\n }, COLLABORATION_OFFLINE_AFTER_MS)\n },\n dispose() {\n disposed = true\n clearOutageTimers()\n },\n }\n}\n\nexport function applyCollaborationProviderStatus(\n controller: Pick<ReturnType<typeof createCollaborationStatusController>, 'disconnected'>,\n payload: unknown,\n): void {\n const record = readRecord(payload)\n // A physical WebSocket can report `connected` before Hocuspocus has\n // authenticated and synchronized the document. Only the provider's `synced`\n // event may restore the user-facing Live state; otherwise an auth failure can\n // leave the UI claiming Live while the server is rejecting the room.\n if (readString(record ?? {}, 'status') !== 'connected') controller.disconnected()\n}\n\nexport function restartConnectedCollaborationSocket(websocket: {\n status: string\n webSocket?: { close: () => void } | null\n}): boolean {\n if (websocket.status !== 'connected' || !websocket.webSocket) return false\n websocket.webSocket.close()\n return true\n}\n\ntype CollaborationWebsocketLifecycle = {\n status: string\n webSocket?: { close: () => void } | null\n connect?: () => unknown\n}\n\nexport function createCollaborationSocketLifecycle(\n websocket: CollaborationWebsocketLifecycle,\n) {\n let disposed = false\n let reconnectInFlight = false\n\n const ensureConnected = (): boolean => {\n if (\n disposed\n || reconnectInFlight\n || websocket.status !== 'disconnected'\n || typeof websocket.connect !== 'function'\n ) return false\n\n reconnectInFlight = true\n void Promise.resolve(websocket.connect()).catch(() => undefined).finally(() => {\n reconnectInFlight = false\n })\n return true\n }\n\n return {\n connected() {\n reconnectInFlight = false\n },\n disconnected() {\n reconnectInFlight = false\n return ensureConnected()\n },\n logicalClose() {\n return restartConnectedCollaborationSocket(websocket) || ensureConnected()\n },\n ensureConnected,\n dispose() {\n disposed = true\n reconnectInFlight = false\n },\n }\n}\n\nexport function normalizeCollabTokenPayload(\n payload: unknown,\n fallbackUserLabel: string | null,\n): CollabTokenResponse | null {\n const root = readRecord(payload)\n const user = readRecord(root?.user)\n if (!root || !user) return null\n const token = readString(root, 'token')\n const collaborationDisabled = root.url === null\n const documentId = readString(root, 'documentId', 'document_id')\n const tier = readString(root, 'tier')\n const expiresInSec = readNumber(root, 'expiresInSec', 'expires_in_sec')\n const id = readString(user, 'id')\n const name = firstSafeCollaborationAwarenessName(\n readString(user, 'name'),\n readString(root, 'userName', 'user_name'),\n fallbackUserLabel,\n )\n const color = readString(user, 'color') ?? readString(root, 'userColor', 'user_color')\n if ((!token && !collaborationDisabled) || !documentId || !tier || !expiresInSec || !id || !name || !color) return null\n return {\n token: token ?? '',\n documentId,\n tier,\n expiresInSec,\n user: { id, name, color: resolveCollaborationUserColor(id) },\n url: collaborationDisabled ? null : readString(root, 'url'),\n canEdit: root.canEdit === true,\n readOnly: root.readOnly !== false,\n }\n}\n\nexport function readCollaborationPresence(\n provider: HocuspocusProvider,\n fallbackUserLabel: string | null,\n): PresenceUser[] {\n const states = provider.awareness?.getStates() as Map<number, unknown> | undefined\n if (!states) return []\n const seen = new Set<string>()\n const users: PresenceUser[] = []\n states.forEach((value, clientId) => {\n if (clientId === provider.document.clientID) return\n const state = readRecord(value)\n const user = readRecord(state?.user)\n const name = firstSafeCollaborationAwarenessName(\n user ? readString(user, 'name') : null,\n fallbackUserLabel,\n )\n const id = user ? readString(user, 'id') : null\n const suppliedColor = user ? readString(user, 'color') : null\n if (!name || !suppliedColor) return\n const color = id\n ? resolveCollaborationUserColor(id)\n : normalizeCollaborationColor(suppliedColor)\n const key = id ? `user:${id}` : `${name}:${color}`\n if (!seen.has(key)) { seen.add(key); users.push({ key, name, color }) }\n })\n return users\n}\n\nfunction destroy(resources: CollabResources) {\n try { resources.provider.destroy() } finally { resources.ydoc.destroy() }\n}\n\nexport function useDocumentCollaboration(documentId: string): CollabState {\n const t = useT()\n const fallbackUserLabel = sanitizeDocumentsDisplayLabel(t('documents.users.unknown'))\n const resourcesRef = React.useRef<CollabResources | null>(null)\n const [state, setState] = React.useState<CollabState>({ mode: 'connecting' })\n // Bumped when the sidecar closes the room because its content was replaced\n // (version restore). Re-running the effect discards the local Y.Doc and\n // provider and joins the reloaded room from scratch; reconnecting with the\n // stale document would sync the pre-restore state back into it.\n const [sessionEpoch, setSessionEpoch] = React.useState(0)\n React.useEffect(() => {\n let active = true\n let terminal = false\n let local: CollabResources | null = null\n let initialTimer: TimeoutHandle | null = null\n let initialRetryTimer: TimeoutHandle | null = null\n let tokenRetryTimer: TimeoutHandle | null = null\n let statusController: ReturnType<typeof createCollaborationStatusController> | null = null\n let socketLifecycle: ReturnType<typeof createCollaborationSocketLifecycle> | null = null\n let removeResumeListeners: (() => void) | null = null\n let lastTokenFailure: 'fatal' | 'transient' | null = null\n const clearInitialTimers = () => {\n if (initialTimer !== null) clearTimeout(initialTimer)\n if (initialRetryTimer !== null) clearTimeout(initialRetryTimer)\n initialTimer = null\n initialRetryTimer = null\n }\n const clearTokenRetryTimer = () => {\n if (tokenRetryTimer !== null) clearTimeout(tokenRetryTimer)\n tokenRetryTimer = null\n }\n const fallback = (readOnly = false) => {\n if (!active || terminal) return\n terminal = true\n clearInitialTimers()\n clearTokenRetryTimer()\n statusController?.dispose()\n socketLifecycle?.dispose()\n removeResumeListeners?.()\n removeResumeListeners = null\n if (local && resourcesRef.current === local) { resourcesRef.current = null; destroy(local) }\n local = null\n setState({ mode: 'fallback', readOnly })\n }\n const fetchToken = async (): Promise<CollabTokenAttempt> => {\n return fetchCollabTokenAttempt(documentId, fallbackUserLabel)\n }\n const freshToken = async () => {\n const next = await fetchToken()\n if (next.kind === 'ok') {\n lastTokenFailure = null\n if (active && !terminal && local && resourcesRef.current === local) {\n const serverReadOnly = next.token.readOnly || !next.token.canEdit\n setState((current) => current.mode === 'collab' && current.resources === local\n ? { ...current, serverReadOnly }\n : current)\n }\n return next.token.token\n }\n lastTokenFailure = next.kind\n throw new Error(`[internal] Collaboration token refresh ${next.kind}`)\n }\n const start = async (): Promise<void> => {\n const initial = await fetchToken()\n if (!active || terminal) return\n if (initial.kind === 'transient') {\n initialRetryTimer = setTimeout(() => {\n initialRetryTimer = null\n void start()\n }, COLLABORATION_PROVIDER_RETRY.delay)\n return\n }\n if (initial.kind === 'fatal') { fallback(true); return }\n if (!initial.token.url) {\n fallback(initial.token.readOnly || !initial.token.canEdit)\n return\n }\n const ydoc = new Y.Doc()\n const provider = new HocuspocusProvider({\n url: initial.token.url,\n name: documentId,\n document: ydoc,\n token: freshToken,\n ...COLLABORATION_PROVIDER_RETRY,\n })\n const resources = { ydoc, provider, user: initial.token.user }\n local = resources\n resourcesRef.current = resources\n const update = (connectionStatus: ConnectionStatus) => {\n if (!active || resourcesRef.current !== resources) return\n setState((current) => current.mode === 'collab' && current.resources === resources ? { ...current, connectionStatus } : current)\n }\n statusController = createCollaborationStatusController({\n onStatus: update,\n })\n const websocket = provider.configuration.websocketProvider\n socketLifecycle = createCollaborationSocketLifecycle(websocket)\n const resume = () => socketLifecycle?.ensureConnected()\n const resumeWhenVisible = () => {\n if (document.visibilityState === 'visible') resume()\n }\n window.addEventListener('online', resume)\n window.addEventListener('pageshow', resume)\n document.addEventListener('visibilitychange', resumeWhenVisible)\n removeResumeListeners = () => {\n window.removeEventListener('online', resume)\n window.removeEventListener('pageshow', resume)\n document.removeEventListener('visibilitychange', resumeWhenVisible)\n }\n const updatePresence = () => setState((current) => current.mode === 'collab' && current.resources === resources ? { ...current, presenceUsers: readCollaborationPresence(provider, fallbackUserLabel) } : current)\n provider.on('status', (payload: unknown) => {\n const record = readRecord(payload)\n if (readString(record ?? {}, 'status') === 'connected') socketLifecycle?.connected()\n if (statusController) applyCollaborationProviderStatus(statusController, payload)\n })\n provider.on('synced', () => {\n lastTokenFailure = null\n clearInitialTimers()\n clearTokenRetryTimer()\n statusController?.connected()\n })\n provider.on('authenticationFailed', () => {\n const tokenFailure = lastTokenFailure\n lastTokenFailure = null\n // A freshly minted token can still hit the sidecar's short-lived room\n // drain fence after a share/unshare rollover. Only a definitive token\n // endpoint rejection is fatal; sidecar auth rejection with a valid\n // token must keep retrying until the old room has drained.\n if (tokenFailure === 'fatal') { fallback(true); return }\n statusController?.disconnected()\n clearTokenRetryTimer()\n tokenRetryTimer = setTimeout(() => {\n tokenRetryTimer = null\n if (!active || terminal || resourcesRef.current !== resources) return\n const websocket = provider.configuration.websocketProvider\n websocket.webSocket?.close()\n }, COLLABORATION_PROVIDER_RETRY.delay)\n })\n provider.on('disconnect', () => {\n statusController?.disconnected()\n socketLifecycle?.disconnected()\n })\n provider.on('close', (payload: unknown) => {\n const closeEvent = readRecord(payload)?.event\n if (isCollabContentResetCloseEvent(closeEvent)) {\n if (!active || terminal || resourcesRef.current !== resources) return\n // Stop every reconnect path for this session first: the provider's\n // own retry and the socket lifecycle would otherwise rejoin the\n // room with the stale document before the fresh session starts.\n terminal = true\n socketLifecycle?.dispose()\n statusController?.dispose()\n provider.configuration.websocketProvider.disconnect()\n setSessionEpoch((current) => current + 1)\n return\n }\n statusController?.disconnected()\n socketLifecycle?.logicalClose()\n })\n provider.awareness?.on('change', updatePresence)\n setState({\n mode: 'collab',\n resources,\n connectionStatus: 'connecting',\n presenceUsers: readCollaborationPresence(provider, fallbackUserLabel),\n serverReadOnly: initial.token.readOnly || !initial.token.canEdit,\n })\n }\n setState({ mode: 'connecting' })\n initialTimer = setTimeout(fallback, COLLABORATION_INITIAL_TIMEOUT_MS)\n void start().catch(() => fallback(false))\n return () => {\n active = false\n terminal = true\n clearInitialTimers()\n clearTokenRetryTimer()\n statusController?.dispose()\n socketLifecycle?.dispose()\n removeResumeListeners?.()\n if (local) destroy(local)\n if (resourcesRef.current === local) resourcesRef.current = null\n }\n }, [documentId, fallbackUserLabel, sessionEpoch])\n return state\n}\n"],
|
|
5
|
+
"mappings": ";AAEA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,YAAY,OAAO;AACnB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sCAAsC;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AAEA,MAAM,mCAAmC;AACzC,MAAM,mCAAmC;AACzC,MAAM,iCAAiC;AACvC,MAAM,+BAA+B;AAAA,EAC1C,OAAO;AAAA,EACP,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,aAAa;AAAA,EACb,QAAQ;AACV;AAwBO,SAAS,4BACd,MACA,mBACoB;AACpB,MAAI,KAAK,IAAI;AACX,UAAM,QAAQ,4BAA4B,KAAK,QAAQ,iBAAiB;AACxE,WAAO,QAAQ,EAAE,MAAM,MAAM,MAAM,IAAI,EAAE,MAAM,QAAQ;AAAA,EACzD;AAEA,QAAM,wBAAwB,KAAK,WAAW,OAAO,KAAK,WAAW,OAAO,KAAK,WAAW;AAC5F,MAAI,KAAK,UAAU,OAAO,KAAK,SAAS,OAAO,CAAC,uBAAuB;AACrE,WAAO,EAAE,MAAM,QAAQ;AAAA,EACzB;AACA,SAAO,EAAE,MAAM,YAAY;AAC7B;AAEA,eAAsB,wBACpB,YACA,mBACA,OAAsB,CAAC,MAAM,SAAS,QAAiB,MAAM,IAAI,GACpC;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