@ddd-ts-kit/s3 0.113.2 → 0.115.0
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.fr.md +4 -4
- package/README.md +3 -3
- package/dist/is-missing.d.ts +5 -1
- package/dist/is-missing.d.ts.map +1 -1
- package/dist/is-missing.js +6 -3
- package/dist/is-missing.js.map +1 -1
- package/dist/s3-file-storage.js +2 -2
- package/dist/s3-file-storage.js.map +1 -1
- package/dist/upload-settled.d.ts +8 -0
- package/dist/upload-settled.d.ts.map +1 -0
- package/dist/upload-settled.js +17 -0
- package/dist/upload-settled.js.map +1 -0
- package/package.json +10 -10
- package/dist/settled-first.d.ts +0 -6
- package/dist/settled-first.d.ts.map +0 -1
- package/dist/settled-first.js +0 -14
- package/dist/settled-first.js.map +0 -1
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:46d9d69c3de1c98f -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/s3
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ npm i @ddd-ts-kit/s3 @aws-sdk/client-s3 @aws-sdk/lib-storage @aws-sdk/s3-request
|
|
|
16
16
|
Les trois *packages* du SDK AWS v3 officiel sont des dépendances *peer* optionnelles, écrites pour
|
|
17
17
|
la version 3.1150.
|
|
18
18
|
|
|
19
|
-

|
|
20
20
|
|
|
21
21
|
Les cas d'usage parlent au port avec des clés comme `appointment-documents/2026/10/7f3c`,
|
|
22
22
|
générées par `TenantFileKeys`, le `FileKeys` du noyau : la zone, l'année, le mois, puis un
|
|
@@ -112,7 +112,7 @@ export class ExportAppointments {
|
|
|
112
112
|
| Méthode du port | Sur le bucket |
|
|
113
113
|
|---|---|
|
|
114
114
|
| `put(key, stream, { mediaType, maxBytes })` | un envoi *multipart* en parties de `partSize` (8 Mio par défaut, une seule en mémoire à la fois), ou un seul `PutObject` quand le contenu tient dans une partie ; le contenu est compté et haché au passage, et refusé avec `FILE_TOO_LARGE` au-delà de `maxBytes`, ce qui abandonne l'envoi et laisse l'objet précédent |
|
|
115
|
-
| `get`, `stat` | `GetObject` en flux, `HeadObject` ; `undefined` quand l'objet n'existe pas, un rejet quand le service est injoignable |
|
|
115
|
+
| `get`, `stat` | `GetObject` en flux, `HeadObject` ; `undefined` quand l'objet n'existe pas (`NoSuchKey`, le `NotFound` d'un head), un rejet quand le service est injoignable ou répond autre chose, un bucket qui n'existe pas compris (`NoSuchBucket`) |
|
|
116
116
|
| `delete` | `DeleteObject`, idempotent |
|
|
117
117
|
| `copy`, `move` | `CopyObject`, fait par le service (et `DeleteObject` pour un déplacement), jusqu'à 5 Gio par objet |
|
|
118
118
|
| `list(prefix)` | `ListObjectsV2`, page après page |
|
|
@@ -128,7 +128,7 @@ pour plus d'une heure avec `INVALID_FILE_URL_EXPIRY`, avant toute requête. La s
|
|
|
128
128
|
demande pas de requête non plus : un lien signé est calculé à partir des identifiants d'accès, et
|
|
129
129
|
seul le fournisseur le vérifie, quand le client l'utilise.
|
|
130
130
|
|
|
131
|
-

|
|
132
132
|
|
|
133
133
|
Le client envoie le fichier exactement comme le dit le lien, avec les en-têtes qu'il a reçus :
|
|
134
134
|
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm i @ddd-ts-kit/s3 @aws-sdk/client-s3 @aws-sdk/lib-storage @aws-sdk/s3-request
|
|
|
14
14
|
|
|
15
15
|
The three packages of the official AWS SDK v3 are optional peers, written against 3.1150.
|
|
16
16
|
|
|
17
|
-

|
|
18
18
|
|
|
19
19
|
The use cases speak to the port with keys such as `appointment-documents/2026/10/7f3c`,
|
|
20
20
|
generated by `TenantFileKeys`, the `FileKeys` of the kernel: the area, the year, the month, then
|
|
@@ -109,7 +109,7 @@ export class ExportAppointments {
|
|
|
109
109
|
| Port method | On the bucket |
|
|
110
110
|
|---|---|
|
|
111
111
|
| `put(key, stream, { mediaType, maxBytes })` | a multipart upload of `partSize` parts (8 MiB by default, one in memory at a time), or a single `PutObject` when the content fits in one part; the content is counted and hashed on its way, and refused with `FILE_TOO_LARGE` beyond `maxBytes`, which aborts the upload and leaves the previous object |
|
|
112
|
-
| `get`, `stat` | `GetObject` as a stream, `HeadObject`; `undefined` when the object does not exist, a rejection when the service cannot be reached |
|
|
112
|
+
| `get`, `stat` | `GetObject` as a stream, `HeadObject`; `undefined` when the object does not exist (`NoSuchKey`, the `NotFound` of a head), a rejection when the service cannot be reached or answers anything else, a bucket that does not exist included (`NoSuchBucket`) |
|
|
113
113
|
| `delete` | `DeleteObject`, idempotent |
|
|
114
114
|
| `copy`, `move` | `CopyObject` done by the service (and `DeleteObject` for a move), up to 5 GiB per object |
|
|
115
115
|
| `list(prefix)` | `ListObjectsV2`, page after page |
|
|
@@ -125,7 +125,7 @@ more than an hour with `INVALID_FILE_URL_EXPIRY`, before any request. Signing ne
|
|
|
125
125
|
either: a signed link is computed from the credentials, and only the provider checks it, when
|
|
126
126
|
the client uses it.
|
|
127
127
|
|
|
128
|
-

|
|
129
129
|
|
|
130
130
|
The client sends the file exactly as the link says, with the headers it was given:
|
|
131
131
|
|
package/dist/is-missing.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Whether the service answered that the object does not exist: `NoSuchKey` on a read, `NotFound`
|
|
3
|
+
* on a head. By name, never by status: a bucket that does not exist is a 404 too (`NoSuchBucket`),
|
|
4
|
+
* and a deployment to fix must not read as an absent file.
|
|
5
|
+
*/
|
|
2
6
|
export declare function isMissing(error: unknown): boolean;
|
|
3
7
|
//# sourceMappingURL=is-missing.d.ts.map
|
package/dist/is-missing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-missing.d.ts","sourceRoot":"","sources":["../src/is-missing.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"is-missing.d.ts","sourceRoot":"","sources":["../src/is-missing.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEjD"}
|
package/dist/is-missing.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { S3ServiceException } from '@aws-sdk/client-s3';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Whether the service answered that the object does not exist: `NoSuchKey` on a read, `NotFound`
|
|
4
|
+
* on a head. By name, never by status: a bucket that does not exist is a 404 too (`NoSuchBucket`),
|
|
5
|
+
* and a deployment to fix must not read as an absent file.
|
|
6
|
+
*/
|
|
3
7
|
export function isMissing(error) {
|
|
4
|
-
return
|
|
5
|
-
(error.name === 'NoSuchKey' || error.name === 'NotFound' || error.$metadata.httpStatusCode === 404));
|
|
8
|
+
return error instanceof S3ServiceException && (error.name === 'NoSuchKey' || error.name === 'NotFound');
|
|
6
9
|
}
|
|
7
10
|
//# sourceMappingURL=is-missing.js.map
|
package/dist/is-missing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-missing.js","sourceRoot":"","sources":["../src/is-missing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"is-missing.js","sourceRoot":"","sources":["../src/is-missing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,KAAK,YAAY,kBAAkB,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;AAC1G,CAAC"}
|
package/dist/s3-file-storage.js
CHANGED
|
@@ -7,7 +7,7 @@ import { FileError, FileInspection, FileStorage, SystemClock, assertExpiry, cont
|
|
|
7
7
|
import { BucketKeys } from './bucket-keys.js';
|
|
8
8
|
import { isMissing } from './is-missing.js';
|
|
9
9
|
import { listObjects } from './list-objects.js';
|
|
10
|
-
import {
|
|
10
|
+
import { uploadSettled } from './upload-settled.js';
|
|
11
11
|
const MEBIBYTE = 1_024 * 1_024;
|
|
12
12
|
/**
|
|
13
13
|
* The `FileStorage` of a deployment: one bucket of any provider of the S3 protocol. An upload
|
|
@@ -44,7 +44,7 @@ export class S3FileStorage extends FileStorage {
|
|
|
44
44
|
queueSize: 1,
|
|
45
45
|
leavePartsOnError: false,
|
|
46
46
|
});
|
|
47
|
-
await
|
|
47
|
+
await uploadSettled(pipeline(content, inspection), upload.done());
|
|
48
48
|
return { key, size: inspection.size, mediaType, checksum: inspection.checksum };
|
|
49
49
|
}
|
|
50
50
|
async get(key) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-file-storage.js","sourceRoot":"","sources":["../src/s3-file-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,WAAW,GAYZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAA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,CAAC;QAEhH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;IAC3G,CAAC;IAEO,MAAM,CAAC,OAAe;QAC5B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;IAChE,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,CAAC;AACd,CAAC;AAQD,SAAS,UAAU,CAAC,GAAW,EAAE,IAAgB;IAC/C,OAAO;QACL,GAAG;QACH,IAAI,EAAE,IAAI,CAAC,aAAa,IAAI,CAAC;QAC7B,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,WAAW,IAAI,0BAA0B,CAAC;QACtE,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;KAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waits for the stream that feeds an upload and for the upload, and rejects with the failure
|
|
3
|
+
* that says why. A content refused on its way cut the upload: its refusal comes first. Any
|
|
4
|
+
* other failure is the one of the upload: a service that fails destroys the stream that feeds
|
|
5
|
+
* it, which then only says it was aborted.
|
|
6
|
+
*/
|
|
7
|
+
export declare function uploadSettled(feeding: Promise<void>, uploading: Promise<unknown>): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=upload-settled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-settled.d.ts","sourceRoot":"","sources":["../src/upload-settled.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FileError } from '@ddd-ts-kit/kernel';
|
|
2
|
+
/**
|
|
3
|
+
* Waits for the stream that feeds an upload and for the upload, and rejects with the failure
|
|
4
|
+
* that says why. A content refused on its way cut the upload: its refusal comes first. Any
|
|
5
|
+
* other failure is the one of the upload: a service that fails destroys the stream that feeds
|
|
6
|
+
* it, which then only says it was aborted.
|
|
7
|
+
*/
|
|
8
|
+
export async function uploadSettled(feeding, uploading) {
|
|
9
|
+
const [fed, uploaded] = await Promise.allSettled([feeding, uploading]);
|
|
10
|
+
if (fed.status === 'rejected' && (FileError.is(fed.reason) || uploaded.status === 'fulfilled')) {
|
|
11
|
+
throw fed.reason;
|
|
12
|
+
}
|
|
13
|
+
if (uploaded.status === 'rejected') {
|
|
14
|
+
throw uploaded.reason;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=upload-settled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-settled.js","sourceRoot":"","sources":["../src/upload-settled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAsB,EAAE,SAA2B;IACrF,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvE,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW,CAAC,EAAE,CAAC;QAC/F,MAAM,GAAG,CAAC,MAAM,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACnC,MAAM,QAAQ,CAAC,MAAM,CAAC;IACxB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/s3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.115.0",
|
|
4
4
|
"description": "Adapter of the kernel FileStorage port on the S3 protocol (AWS S3, MinIO, OVHcloud, Scaleway, Cloudflare R2): streamed uploads, signed links, copy, move, listing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/
|
|
20
|
+
"url": "git+https://github.com/ddd-ts-kit/ddd-ts-kit.git",
|
|
21
21
|
"directory": "packages/s3"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "https://
|
|
24
|
-
"bugs": "https://github.com/
|
|
23
|
+
"homepage": "https://ddd-ts-kit.github.io/ddd-ts-kit/packages/s3/",
|
|
24
|
+
"bugs": "https://github.com/ddd-ts-kit/ddd-ts-kit/issues",
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public",
|
|
27
27
|
"provenance": true
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ddd-ts-kit/kernel": "0.
|
|
48
|
+
"@ddd-ts-kit/kernel": "0.115.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@aws-sdk/client-s3": "^3.1152.0",
|
|
52
52
|
"@aws-sdk/lib-storage": "^3.1152.0",
|
|
53
53
|
"@aws-sdk/s3-request-presigner": "^3.1152.0",
|
|
54
|
-
"@ddd-ts-kit/testing": "0.
|
|
54
|
+
"@ddd-ts-kit/testing": "0.115.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"@aws-sdk/client-s3": {
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@aws-sdk/client-s3": "3.
|
|
72
|
-
"@aws-sdk/lib-storage": "3.
|
|
73
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
74
|
-
"@ddd-ts-kit/testing": "0.
|
|
71
|
+
"@aws-sdk/client-s3": "3.1169.0",
|
|
72
|
+
"@aws-sdk/lib-storage": "3.1169.0",
|
|
73
|
+
"@aws-sdk/s3-request-presigner": "3.1169.0",
|
|
74
|
+
"@ddd-ts-kit/testing": "0.115.0"
|
|
75
75
|
}
|
|
76
76
|
}
|
package/dist/settled-first.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Waits for the stream that feeds an upload and for the upload, and rejects with the failure of
|
|
3
|
-
* the stream first: when the content was refused on its way, the upload only says it was cut.
|
|
4
|
-
*/
|
|
5
|
-
export declare function settledFirst(feeding: Promise<void>, uploading: Promise<unknown>): Promise<void>;
|
|
6
|
-
//# sourceMappingURL=settled-first.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settled-first.d.ts","sourceRoot":"","sources":["../src/settled-first.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUrG"}
|
package/dist/settled-first.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Waits for the stream that feeds an upload and for the upload, and rejects with the failure of
|
|
3
|
-
* the stream first: when the content was refused on its way, the upload only says it was cut.
|
|
4
|
-
*/
|
|
5
|
-
export async function settledFirst(feeding, uploading) {
|
|
6
|
-
const [fed, uploaded] = await Promise.allSettled([feeding, uploading]);
|
|
7
|
-
if (fed.status === 'rejected') {
|
|
8
|
-
throw fed.reason;
|
|
9
|
-
}
|
|
10
|
-
if (uploaded.status === 'rejected') {
|
|
11
|
-
throw uploaded.reason;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=settled-first.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settled-first.js","sourceRoot":"","sources":["../src/settled-first.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAsB,EAAE,SAA2B;IACpF,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvE,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QAC9B,MAAM,GAAG,CAAC,MAAM,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACnC,MAAM,QAAQ,CAAC,MAAM,CAAC;IACxB,CAAC;AACH,CAAC"}
|