@procedures/s3 0.2.2 → 0.3.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/CHANGELOG.md +48 -0
- package/README.md +47 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +51 -1
- package/dist/module.js.map +1 -1
- package/dist/procedures/s3/copy.d.ts +21 -0
- package/dist/procedures/s3/copy.d.ts.map +1 -0
- package/dist/procedures/s3/copy.js +46 -0
- package/dist/procedures/s3/copy.js.map +1 -0
- package/dist/procedures/s3/head.d.ts +13 -0
- package/dist/procedures/s3/head.d.ts.map +1 -0
- package/dist/procedures/s3/head.js +45 -0
- package/dist/procedures/s3/head.js.map +1 -0
- package/dist/procedures/s3/index.d.ts +3 -0
- package/dist/procedures/s3/index.d.ts.map +1 -1
- package/dist/procedures/s3/index.js +3 -0
- package/dist/procedures/s3/index.js.map +1 -1
- package/dist/procedures/s3/presign.d.ts +25 -0
- package/dist/procedures/s3/presign.d.ts.map +1 -0
- package/dist/procedures/s3/presign.js +51 -0
- package/dist/procedures/s3/presign.js.map +1 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +54 -0
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +13 -0
- package/src/module.ts +68 -1
- package/src/procedures/s3/copy.ts +48 -0
- package/src/procedures/s3/head.ts +39 -0
- package/src/procedures/s3/index.ts +3 -0
- package/src/procedures/s3/presign.ts +60 -0
- package/src/types.ts +145 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @procedures/s3
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ffb35f3: Three object procedures (roadmap R44). `s3.head` gives the metadata of an object without its content, and `exists: false` for a 404. `s3.copy` copies an object inside S3. It replaces the destination, unless `overwrite` is false. `s3.presign` gives a presigned URL for a `GET` or a `PUT`, with an expiry in seconds. It sends no request to S3. A call whose capability does not permit the writes of `s3.upload` gets no `PUT` URL. The new dependency is `@aws-sdk/s3-request-presigner`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [ddea529]
|
|
12
|
+
- Updated dependencies [b2a3e3a]
|
|
13
|
+
- Updated dependencies [a8c47f1]
|
|
14
|
+
- Updated dependencies [381ce3a]
|
|
15
|
+
- Updated dependencies [0c627f8]
|
|
16
|
+
- Updated dependencies [ae7f05f]
|
|
17
|
+
- Updated dependencies [7873940]
|
|
18
|
+
- Updated dependencies [a70d445]
|
|
19
|
+
- Updated dependencies [bc70357]
|
|
20
|
+
- Updated dependencies [07cc998]
|
|
21
|
+
- Updated dependencies [a6b01a9]
|
|
22
|
+
- Updated dependencies [c799cdd]
|
|
23
|
+
- Updated dependencies [540f8d9]
|
|
24
|
+
- Updated dependencies [b6daaec]
|
|
25
|
+
- Updated dependencies [5b9264e]
|
|
26
|
+
- Updated dependencies [956e88b]
|
|
27
|
+
- Updated dependencies [ff62281]
|
|
28
|
+
- Updated dependencies [d81d0ed]
|
|
29
|
+
- Updated dependencies [aa67cc7]
|
|
30
|
+
- Updated dependencies [061fa22]
|
|
31
|
+
- Updated dependencies [cfb9d69]
|
|
32
|
+
- Updated dependencies [43f7de5]
|
|
33
|
+
- Updated dependencies [b07bb50]
|
|
34
|
+
- Updated dependencies [4a3bfa1]
|
|
35
|
+
- Updated dependencies [bd0b626]
|
|
36
|
+
- Updated dependencies [a6be873]
|
|
37
|
+
- Updated dependencies [fb30718]
|
|
38
|
+
- Updated dependencies [c5528e4]
|
|
39
|
+
- Updated dependencies [fee5d9c]
|
|
40
|
+
- Updated dependencies [21f7743]
|
|
41
|
+
- Updated dependencies [31a0b46]
|
|
42
|
+
- @procedures/client@0.3.0
|
|
43
|
+
|
|
44
|
+
## 0.2.3
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [15e48cf]
|
|
49
|
+
- @procedures/client@0.2.3
|
|
50
|
+
|
|
3
51
|
## 0.2.2
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -17,8 +17,9 @@ AWS S3 operations as RPC procedures. Upload, download, list, delete, and perform
|
|
|
17
17
|
- **Zod validation**: Runtime type safety on all inputs
|
|
18
18
|
- **MinIO/LocalStack support**: Custom S3 endpoints for testing
|
|
19
19
|
|
|
20
|
-
The package has
|
|
20
|
+
The package has 12 procedures. Its register entry (`import "@procedures/s3/register"`) registers them:
|
|
21
21
|
- **Standard**: `s3.upload`, `s3.download`, `s3.list`, `s3.listAll`, `s3.delete`
|
|
22
|
+
- **Metadata, copies and URLs**: `s3.head`, `s3.copy`, `s3.presign`
|
|
22
23
|
- **Multipart**: `s3.multipart.init`, `s3.multipart.upload`, `s3.multipart.complete`, `s3.multipart.abort`
|
|
23
24
|
|
|
24
25
|
## Architecture
|
|
@@ -373,6 +374,47 @@ interface S3DeleteOutput {
|
|
|
373
374
|
}
|
|
374
375
|
```
|
|
375
376
|
|
|
377
|
+
#### `s3.head`
|
|
378
|
+
|
|
379
|
+
The procedure gives the metadata of an object without its content. The metadata is the size, the content type, the ETag, the time of the last change and the user metadata. A 404 gives `exists: false`. S3 gives no body with a 404 to a HEAD request, so a missing bucket also gives `exists: false`.
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
const head = await client.exec(["s3", "head"], { bucket: "my-bucket", key: "files/report.pdf" });
|
|
383
|
+
if (head.exists) console.log(head.contentLength, head.etag);
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
#### `s3.copy`
|
|
387
|
+
|
|
388
|
+
The procedure copies an object inside S3. The bytes do not go through the host. The copy replaces the object of the destination key. With `overwrite: false`, S3 refuses the copy when the destination key exists. One request copies an object of 5 GiB or less.
|
|
389
|
+
|
|
390
|
+
The source bucket is the destination bucket when the input does not give `sourceBucket`. With `contentType` or `metadata`, the copy gets new metadata. Without them, it keeps the metadata of the source.
|
|
391
|
+
|
|
392
|
+
```typescript
|
|
393
|
+
await client.exec(["s3", "copy"], {
|
|
394
|
+
sourceBucket: "my-bucket",
|
|
395
|
+
sourceKey: "files/report.pdf",
|
|
396
|
+
bucket: "my-archive",
|
|
397
|
+
key: "2026/report.pdf",
|
|
398
|
+
overwrite: false,
|
|
399
|
+
});
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
#### `s3.presign`
|
|
403
|
+
|
|
404
|
+
The procedure gives a presigned URL for a `GET` (the default) or a `PUT` of one object. `expiresIn` is the life of the URL in seconds: 900 by default, and 604800 (7 days) or less. The procedure sends no request to S3. It reads the credentials and calculates a Signature Version 4.
|
|
405
|
+
|
|
406
|
+
Its effects are `reads: ["fs", "network"]` and `writes: []`. The default credential chain can read the AWS files of the host or the instance metadata service. A `PUT` URL lets its holder write the object. Thus a call whose capability does not permit the writes of `s3.upload` gets `FORBIDDEN` for a `PUT` URL.
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
const { url, expiresAt } = await client.exec(["s3", "presign"], {
|
|
410
|
+
bucket: "my-bucket",
|
|
411
|
+
key: "uploads/photo.jpg",
|
|
412
|
+
method: "PUT",
|
|
413
|
+
expiresIn: 300,
|
|
414
|
+
contentType: "image/jpeg",
|
|
415
|
+
});
|
|
416
|
+
```
|
|
417
|
+
|
|
376
418
|
### Multipart Upload Operations
|
|
377
419
|
|
|
378
420
|
For large files (>5MB), use multipart upload:
|
|
@@ -808,6 +850,7 @@ import "@procedures/fs/register"; // registers its procedures
|
|
|
808
850
|
|
|
809
851
|
- **@procedures/client** - Core client procedure system
|
|
810
852
|
- **@aws-sdk/client-s3** (^3.705.0) - AWS SDK for S3
|
|
853
|
+
- **@aws-sdk/s3-request-presigner** (3.1147.0) - The signature of the URLs of `s3.presign`
|
|
811
854
|
- **zod** (^3.24.0) - Runtime type validation
|
|
812
855
|
|
|
813
856
|
### Development Dependencies
|
|
@@ -832,6 +875,9 @@ client-s3/
|
|
|
832
875
|
│ │ ├── download.ts # s3.download
|
|
833
876
|
│ │ ├── list.ts # s3.list
|
|
834
877
|
│ │ ├── delete.ts # s3.delete
|
|
878
|
+
│ │ ├── head.ts # s3.head
|
|
879
|
+
│ │ ├── copy.ts # s3.copy
|
|
880
|
+
│ │ ├── presign.ts # s3.presign
|
|
835
881
|
│ │ ├── multipart-init.ts # s3.multipart.init
|
|
836
882
|
│ │ ├── multipart-upload.ts # s3.multipart.upload
|
|
837
883
|
│ │ ├── multipart-complete.ts # s3.multipart.complete
|