@open-wa/integration-s3 5.1.0 → 5.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.
Files changed (2) hide show
  1. package/README.md +8 -2
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -8,7 +8,7 @@ Part of the [@open-wa v5 monorepo](https://github.com/open-wa/wa-automate-nodejs
8
8
 
9
9
  `@open-wa/integration-s3` handles `message.received` events that contain decryptable media. It uploads media through `pico-s3` to S3-compatible storage. It adds the resulting `cloudUrl` to the message object.
10
10
 
11
- Use this integration so downstream message handlers receive a cloud URL instead of only the original WhatsApp media reference.
11
+ The plugin assigns `cloudUrl` to the received message after asynchronous decryption and upload finish. It does not emit an upload-complete event, and other `message.received` listeners run independently, so they must not assume the field is present during that event callback. For an awaited completion result in application code, use the exported `S3Uploader.uploadMedia()` helper instead of the plugin hook.
12
12
 
13
13
  ## Configuration
14
14
 
@@ -38,14 +38,20 @@ The configuration type is `S3Config` in `src/config.ts`.
38
38
  - Duplicate file names are tracked in memory and return the existing cloud URL instead of uploading again.
39
39
  - Uploads run through a bounded Effect queue with concurrency 2 and a two-per-second rate limit.
40
40
  - After a successful queue upload, `getCloudUrl` is used to compute the URL and the plugin assigns it to `message.cloudUrl`.
41
+ - The mutation happens after `decryptMedia` and the queued upload resolve. There is no separate completion event for consumers.
42
+ - Decryption or upload failures are logged and return `null`; the message is left without `cloudUrl` and no durable retry record is created.
41
43
  - On `dispose`, the plugin waits for the upload queue to become idle and logs that the queue drained.
42
44
 
43
45
  ## Exports
44
46
 
45
47
  - `s3Plugin` from `src/plugin.ts`.
46
- - `S3Uploader` from `src/uploader.ts`.
48
+ - `S3Uploader` from `src/uploader.ts`; `uploadMedia(message, client)` resolves to a generated URL on success or `null` when there is no URL or upload fails.
47
49
  - `S3Config`, `CloudProvider`, and `DirectoryStrategy` from `src/config.ts`.
48
50
 
51
+ `S3Uploader` accepts the same `S3Config` as `s3Plugin`. Its `client` argument supplies `decryptMedia(message)` as a base64 string. The high-level `Client.decryptMedia()` method returns a data URL, so an application adapting that facade should pass only the base64 portion to `uploadMedia`.
52
+
53
+ `public` is passed through to `pico-s3`; it does not prove that a bucket or object is private, public, signed, or available for a particular duration. Provider-specific access and lifecycle behavior must be checked against the selected provider's configuration and policy.
54
+
49
55
  ## Development
50
56
 
51
57
  - `pnpm --filter @open-wa/integration-s3 build`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/integration-s3",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "S3/Cloud storage integration plugin for open-wa",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -13,8 +13,8 @@
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "@open-wa/core": "5.1.0",
17
- "@open-wa/logger": "5.1.0",
16
+ "@open-wa/core": "5.3.0",
17
+ "@open-wa/logger": "5.3.0",
18
18
  "@open-wa/runtime-core": "5.0.1",
19
19
  "effect": "4.0.0-beta.100",
20
20
  "mime": "^4.1.0",