@yozz.app/imap 0.1.1 → 0.1.2

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.md CHANGED
@@ -8,8 +8,9 @@ pnpm add @yozz.app/imap
8
8
 
9
9
  ## The seam
10
10
 
11
- `@yozz.app/imap` speaks IMAP over any `ByteDuplex` (`{ read(): Promise<Uint8Array | null>; write(bytes): Promise<void> }`)
12
- from `@yozz.app/tls`. It knows protocol lines, `{n}` literals, command state, and RFC 2047 header
11
+ `@yozz.app/imap` speaks IMAP over any `ByteDuplex` (`{ read(): Promise<Uint8Array | null>; write(bytes): Promise<void> }`),
12
+ a type it declares itself; a `@yozz.app/tls` connection satisfies it, and so does anything else with
13
+ those two methods. The package has no runtime dependencies. It knows protocol lines, `{n}` literals, command state, and RFC 2047 header
13
14
  decoding. It **never knows** TLS records, certificates, session keys, or vault storage.
14
15
 
15
16
  In the browser, the duplex wraps `@yozz.app/tls` over the production WebSocket relay. In tests, it
package/dist/index.d.mts CHANGED
@@ -1,5 +1,3 @@
1
- import { ByteDuplex } from "@yozz.app/tls";
2
-
3
1
  //#region src/tokenizer.d.ts
4
2
  /**
5
3
  * Hand-written tokenizer over byte offsets for IMAP4rev2/rev1 stream.
@@ -194,6 +192,17 @@ type ImapResponse = ImapTagged | {
194
192
  } | ImapContinuation;
195
193
  declare const parseResponse: (tokens: readonly ImapToken[]) => ImapResult<ImapResponse>;
196
194
  //#endregion
195
+ //#region src/transport.d.ts
196
+ /**
197
+ * What this client needs from a transport: bytes in, bytes out. Declared here rather than
198
+ * imported from `@yozz.app/tls` so the package has no runtime dependency at all; it is the same
199
+ * two-method shape, so a `TlsConnection` satisfies it structurally.
200
+ */
201
+ type ByteDuplex = {
202
+ readonly read: () => Promise<Uint8Array | null>;
203
+ readonly write: (bytes: Uint8Array) => Promise<void>;
204
+ };
205
+ //#endregion
197
206
  //#region src/client.d.ts
198
207
  type ImapMessageSummary = {
199
208
  readonly seq: number;
@@ -282,4 +291,4 @@ declare const createImapClient: (transport: ByteDuplex, options?: ImapClientOpti
282
291
  */
283
292
  declare const decodeRfc2047: (header: string) => string;
284
293
  //#endregion
285
- export { DEFAULT_MAX_LITERAL_BYTES, type ImapAddress, type ImapClient, type ImapClientOptions, type ImapContinuation, type ImapEnvelope, type ImapFailure, type ImapFetchItem, type ImapIdle, type ImapMailbox, type ImapMessageSummary, type ImapResponse, type ImapResponseCode, type ImapResult, type ImapSelected, type ImapTagged, type ImapToken, type ImapUntagged, createImapClient, decodeRfc2047, parseResponse };
294
+ export { type ByteDuplex, DEFAULT_MAX_LITERAL_BYTES, type ImapAddress, type ImapClient, type ImapClientOptions, type ImapContinuation, type ImapEnvelope, type ImapFailure, type ImapFetchItem, type ImapIdle, type ImapMailbox, type ImapMessageSummary, type ImapResponse, type ImapResponseCode, type ImapResult, type ImapSelected, type ImapTagged, type ImapToken, type ImapUntagged, createImapClient, decodeRfc2047, parseResponse };
package/dist/index.mjs CHANGED
@@ -1392,6 +1392,16 @@ const tokenizeLogicalLine = (line) => {
1392
1392
  //#endregion
1393
1393
  //#region src/client.ts
1394
1394
  /**
1395
+ * IMAP client state machine over ByteDuplex.
1396
+ *
1397
+ * Invariants:
1398
+ * - One IMAP connection object per device (no connection pool).
1399
+ * - Transport is ByteDuplex from @yozz.app/tls.
1400
+ * - Parsing is total: parser never throws, returns typed ImapFailure and closes.
1401
+ * - Commands are serialised: one in-flight command at a time, queued in order (no pipelining in this slice).
1402
+ * - Greeting is captured immediately upon creation.
1403
+ */
1404
+ /**
1395
1405
  * The msg-ids out of a `HEADER.FIELDS (REFERENCES)` section: the header unfolded, then every
1396
1406
  * `<...>` in order. A truncated or absent header is simply fewer ids.
1397
1407
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yozz.app/imap",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Transport-agnostic IMAP4rev2/rev1 client core: literals, total parsing, RFC 2047, SASL PLAIN/LOGIN, IDLE, UID MOVE.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/fishballapp/yozz",
@@ -28,13 +28,11 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "dependencies": {
32
- "@yozz.app/tls": "0.1.1"
33
- },
34
31
  "devDependencies": {
35
32
  "@types/node": "^24.0.0",
36
33
  "tsdown": "^0.22.3",
37
- "@yozz.app/x509": "0.1.1"
34
+ "@yozz.app/tls": "0.1.2",
35
+ "@yozz.app/x509": "0.1.2"
38
36
  },
39
37
  "scripts": {
40
38
  "build": "tsdown src/index.ts --format esm --dts",