refactor: stricer domain: notifications

This commit is contained in:
2026-04-11 14:23:50 +02:00
parent 98ed8eeb68
commit db7e683504
30 changed files with 953 additions and 71 deletions

View File

@@ -7,7 +7,8 @@ Handles file sharing between peers over WebRTC data channels. Files are announce
```
attachment/
├── application/
│ ├── attachment.facade.ts Thin entry point, delegates to manager
│ ├── facades/
│ │ └── attachment.facade.ts Thin entry point, delegates to manager
│ └── services/
│ ├── attachment-manager.service.ts Orchestrates lifecycle, auto-download, peer listeners
│ ├── attachment-transfer.service.ts P2P file transfer protocol (announce/request/chunk/cancel)
@@ -16,17 +17,20 @@ attachment/
│ └── attachment-runtime.store.ts In-memory signal-based state (Maps for attachments, chunks, pending)
├── domain/
│ ├── attachment.logic.ts isAttachmentMedia, shouldAutoRequestWhenWatched, shouldPersistDownloadedAttachment
│ ├── logic/
│ │ └── attachment.logic.ts isAttachmentMedia, shouldAutoRequestWhenWatched, shouldPersistDownloadedAttachment
│ ├── models/
│ │ ├── attachment.models.ts Attachment type extending AttachmentMeta with runtime state
│ │ └── attachment-transfer.models.ts Protocol event types (file-announce, file-chunk, file-request, ...)
│ │ ├── attachment.model.ts Attachment type extending AttachmentMeta with runtime state
│ │ └── attachment-transfer.model.ts Protocol event types (file-announce, file-chunk, file-request, ...)
│ └── constants/
│ ├── attachment.constants.ts MAX_AUTO_SAVE_SIZE_BYTES = 10 MB
│ └── attachment-transfer.constants.ts FILE_CHUNK_SIZE_BYTES = 64 KB, EWMA weights, error messages
├── infrastructure/
│ ├── attachment-storage.service.ts Electron filesystem access (save / read / delete)
│ └── attachment-storage.util.ts sanitizeAttachmentRoomName, resolveAttachmentStorageBucket
│ ├── services/
│ └── attachment-storage.service.ts Electron filesystem access (save / read / delete)
│ └── util/
│ └── attachment-storage.util.ts sanitizeAttachmentRoomName, resolveAttachmentStorageBucket
└── index.ts Barrel exports
```
@@ -57,15 +61,15 @@ graph TD
Persistence --> Store
Storage --> Helpers[attachment-storage.util]
click Facade "application/attachment.facade.ts" "Thin entry point" _blank
click Facade "application/facades/attachment.facade.ts" "Thin entry point" _blank
click Manager "application/services/attachment-manager.service.ts" "Orchestrates lifecycle" _blank
click Transfer "application/services/attachment-transfer.service.ts" "P2P file transfer protocol" _blank
click Transport "application/services/attachment-transfer-transport.service.ts" "Base64 encode/decode, chunked streaming" _blank
click Persistence "application/services/attachment-persistence.service.ts" "DB + filesystem persistence" _blank
click Store "application/services/attachment-runtime.store.ts" "In-memory signal-based state" _blank
click Storage "infrastructure/attachment-storage.service.ts" "Electron filesystem access" _blank
click Helpers "infrastructure/attachment-storage.util.ts" "Path helpers" _blank
click Logic "domain/attachment.logic.ts" "Pure decision functions" _blank
click Storage "infrastructure/services/attachment-storage.service.ts" "Electron filesystem access" _blank
click Helpers "infrastructure/util/attachment-storage.util.ts" "Path helpers" _blank
click Logic "domain/logic/attachment.logic.ts" "Pure decision functions" _blank
```
## File transfer protocol