@procedures/s3 0.2.3 → 0.4.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 CHANGED
@@ -1,5 +1,63 @@
1
1
  # @procedures/s3
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d919678]
8
+ - Updated dependencies [057d69a]
9
+ - Updated dependencies [b2a1a1e]
10
+ - Updated dependencies [057d69a]
11
+ - Updated dependencies [057d69a]
12
+ - Updated dependencies [057d69a]
13
+ - Updated dependencies [057d69a]
14
+ - Updated dependencies [057d69a]
15
+ - Updated dependencies [afd6a19]
16
+ - Updated dependencies [057d69a]
17
+ - Updated dependencies [4e751da]
18
+ - @procedures/client@0.4.0
19
+
20
+ ## 0.3.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 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`.
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [ddea529]
29
+ - Updated dependencies [b2a3e3a]
30
+ - Updated dependencies [a8c47f1]
31
+ - Updated dependencies [381ce3a]
32
+ - Updated dependencies [0c627f8]
33
+ - Updated dependencies [ae7f05f]
34
+ - Updated dependencies [7873940]
35
+ - Updated dependencies [a70d445]
36
+ - Updated dependencies [bc70357]
37
+ - Updated dependencies [07cc998]
38
+ - Updated dependencies [a6b01a9]
39
+ - Updated dependencies [c799cdd]
40
+ - Updated dependencies [540f8d9]
41
+ - Updated dependencies [b6daaec]
42
+ - Updated dependencies [5b9264e]
43
+ - Updated dependencies [956e88b]
44
+ - Updated dependencies [ff62281]
45
+ - Updated dependencies [d81d0ed]
46
+ - Updated dependencies [aa67cc7]
47
+ - Updated dependencies [061fa22]
48
+ - Updated dependencies [cfb9d69]
49
+ - Updated dependencies [43f7de5]
50
+ - Updated dependencies [b07bb50]
51
+ - Updated dependencies [4a3bfa1]
52
+ - Updated dependencies [bd0b626]
53
+ - Updated dependencies [a6be873]
54
+ - Updated dependencies [fb30718]
55
+ - Updated dependencies [c5528e4]
56
+ - Updated dependencies [fee5d9c]
57
+ - Updated dependencies [21f7743]
58
+ - Updated dependencies [31a0b46]
59
+ - @procedures/client@0.3.0
60
+
3
61
  ## 0.2.3
4
62
 
5
63
  ### 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 9 procedures. Its register entry (`import "@procedures/s3/register"`) registers them:
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