@bobfrankston/iflow-direct 0.1.56 → 0.1.57

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 +28 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -11,19 +11,25 @@ and the desktop/browser architecture diagram.
11
11
 
12
12
  ```bash
13
13
  npm install @bobfrankston/iflow-direct
14
- # desktop TCP transport:
15
- npm install @bobfrankston/tcp-transport
14
+ # desktop (Node) TCP transport implementation:
15
+ npm install @bobfrankston/node-tcp-transport
16
16
  ```
17
17
 
18
- ## Quick start (desktop)
18
+ `@bobfrankston/tcp-transport` is the *interface* package (`TcpTransport` is a
19
+ type, plus the browser/Android `BridgeTcpTransport`); the class you instantiate
20
+ in Node is `NodeTcpTransport` from `@bobfrankston/node-tcp-transport`
21
+ (node:net/tls). `@bobfrankston/iflow-node` is a back-compat shim re-exporting
22
+ it as `NodeTransport` — new code should not use it.
23
+
24
+ ## Quick start (Node)
19
25
 
20
26
  ```typescript
21
27
  import { NativeImapClient } from "@bobfrankston/iflow-direct";
22
- import { TcpTransport } from "@bobfrankston/tcp-transport";
28
+ import { NodeTcpTransport } from "@bobfrankston/node-tcp-transport";
23
29
 
24
30
  const client = new NativeImapClient(
25
31
  { server: "imap.example.com", port: 993, username: "me", password: "..." },
26
- () => new TcpTransport(),
32
+ () => new NodeTcpTransport(),
27
33
  );
28
34
  await client.connect();
29
35
  await client.select("INBOX");
@@ -31,6 +37,23 @@ const msgs = await client.fetchMessages("1:50", { source: false });
31
37
  await client.logout();
32
38
  ```
33
39
 
40
+ For OAuth (Gmail, Office 365), omit `password` and supply a `tokenProvider` —
41
+ an async function returning a current access token; the client calls it at
42
+ authentication time, so refresh logic lives in the provider:
43
+
44
+ ```typescript
45
+ const client = new NativeImapClient(
46
+ {
47
+ server: "imap.gmail.com", port: 993, username: "me@gmail.com",
48
+ tokenProvider: async () => myOauth.getFreshAccessToken(),
49
+ },
50
+ () => new NodeTcpTransport(),
51
+ );
52
+ ```
53
+
54
+ (mailx pairs this with `@bobfrankston/oauthsupport`, but any source of a valid
55
+ token works.)
56
+
34
57
  For the legacy API shape (`getFolderList`, etc.) use `CompatImapClient` from the
35
58
  same package.
36
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/iflow-direct",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "description": "Direct IMAP client — transport-agnostic, no Node.js dependencies, browser-ready",
5
5
  "main": "index.js",
6
6
  "types": "index.ts",
@@ -19,7 +19,7 @@
19
19
  "author": "Bob Frankston",
20
20
  "license": "ISC",
21
21
  "dependencies": {
22
- "@bobfrankston/tcp-transport": "^0.1.7"
22
+ "@bobfrankston/tcp-transport": "^0.1.8"
23
23
  },
24
24
  "exports": {
25
25
  ".": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  ".transformedSnapshot": {
52
52
  "dependencies": {
53
- "@bobfrankston/tcp-transport": "^0.1.7"
53
+ "@bobfrankston/tcp-transport": "^0.1.8"
54
54
  }
55
55
  }
56
56
  }