@volontariapp/domain-storage 0.14.21 → 0.14.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.22
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @volontariapp/outbox@0.11.3
9
+
3
10
  ## 0.14.21
4
11
 
5
12
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @volontariapp/domain-storage
2
+
3
+ Domain package for **file storage** (uploads, antivirus scan, attachment to an entity, cleanup). It
4
+ holds the enums, value objects, validation policies, object key and URL helpers, exceptions, and the
5
+ TypeORM models and Postgres repository of the `ms-storage` database.
6
+
7
+ Consumers: `ms-storage`, `worker-storage`, `post-processor-storage`, `@volontariapp/storage-pipeline`,
8
+ and `api-gateway` (sub-paths only, see below).
9
+
10
+ ## Entry points
11
+
12
+ | Import path | Content | Loads TypeORM |
13
+ | :--- | :--- | :--- |
14
+ | `@volontariapp/domain-storage` | everything below | yes |
15
+ | `@volontariapp/domain-storage/enums` | enums only | no |
16
+ | `@volontariapp/domain-storage/helpers` | object key and public URL helpers | no |
17
+ | `@volontariapp/domain-storage/models` | TypeORM models; importing it calls `registerStorageMappings()` | yes |
18
+ | `@volontariapp/domain-storage/repositories` | `PostgresFileRepository`, outbox builders, repository types | yes |
19
+
20
+ A process that has no TypeORM (such as `api-gateway`) must import from `./enums` and `./helpers`
21
+ only, for example:
22
+
23
+ ```typescript
24
+ import { EntityType } from '@volontariapp/domain-storage/enums';
25
+ import { buildPublicFileUrl } from '@volontariapp/domain-storage/helpers';
26
+ ```
27
+
28
+ ## What it exports
29
+
30
+ | Area | Exports |
31
+ | :--- | :--- |
32
+ | Enums | `FileStatus` (`PENDING`, `RESERVED`, `ATTACHED`, `ORPHANED`, `DELETED`), `EntityType` (`POST`, `USER_AVATAR`, `BADGE_ICON`, `EVENT_COVER`), `ScanStatus`, `ValidationMode`, `RejectionReason`, `AttachmentRefusalReason`, `FileAttachmentOutcome` |
33
+ | Value objects | `FileId`, `MimeType`, `AllowedMimeType`, allowed MIME type lists (`GLOBAL_ALLOWED_MIME_TYPES`, `ALLOWED_MIME_TYPES_BY_ENTITY`...) |
34
+ | Policies | `getValidationPolicy`, `VALIDATION_POLICY_BY_ENTITY`, `resolveValidationMode`, `classifyFileForAttachment`, `classifyFileForConfirmation` |
35
+ | Helpers | `buildQuarantineObjectKey`, `buildPublicObjectKey`, `buildPublicFileUrl`, `QUARANTINE_KEY_PREFIX` |
36
+ | Entities and models | `FileEntity`, `ReleasedEntityEntity`, `FileModel`, `ReleasedEntityModel`, `registerStorageMappings` |
37
+ | Repository | `IFileRepository`, `PostgresFileRepository` |
38
+ | Outbox builders | `buildScanFileJob`, `buildCleanupFilesJob`, `buildFileScannedEvent`, `buildFileRejectedEvent`, `buildAttachmentRejectedEvent`, `FILE_OUTBOX_EMITTER` |
39
+ | Exceptions | `FileNotFoundException`, `TooManyFilesException`, `FileSizeNotAllowedException`, `InvalidEntityTypeException`, `InvalidFileExtensionException`, `FileAttachmentRefusedException` |
40
+
41
+ See `docs/stockage-fichiers/` in the `docs` repository for the full storage flow.
42
+
43
+ ## Scripts
44
+
45
+ ```bash
46
+ yarn build # compile to dist/
47
+ yarn test # unit tests
48
+ yarn test:integration # integration tests against a real PostgreSQL
49
+ yarn migration:run # run the test migrations (src/test/data-source.ts)
50
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/domain-storage",
3
- "version": "0.14.21",
3
+ "version": "0.14.22",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -60,7 +60,7 @@
60
60
  "@volontariapp/errors": "0.7.2",
61
61
  "@volontariapp/logger": "0.6.0",
62
62
  "@volontariapp/messaging": "2.35.1",
63
- "@volontariapp/outbox": "0.11.2",
63
+ "@volontariapp/outbox": "0.11.3",
64
64
  "@volontariapp/shared": "0.20.0"
65
65
  },
66
66
  "peerDependencies": {