@bobfrankston/rmfmail 1.0.467
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 +429 -0
- package/bin/build-icon-ico.js +283 -0
- package/bin/lean-accounts.js +172 -0
- package/bin/mailx.js +1580 -0
- package/bin/mailx.js.map +1 -0
- package/bin/mailx.ts +1549 -0
- package/bin/postinstall.js +39 -0
- package/bin/postinstall.js.map +1 -0
- package/bin/postinstall.ts +41 -0
- package/bin/tsconfig.json +10 -0
- package/client/.gitattributes +10 -0
- package/client/.msger-window.json +1 -0
- package/client/android.html +226 -0
- package/client/app.js +3400 -0
- package/client/app.js.map +1 -0
- package/client/app.ts +3190 -0
- package/client/components/address-book.js +199 -0
- package/client/components/address-book.js.map +1 -0
- package/client/components/address-book.ts +204 -0
- package/client/components/alarms.js +299 -0
- package/client/components/alarms.js.map +1 -0
- package/client/components/alarms.ts +276 -0
- package/client/components/calendar-sidebar.js +508 -0
- package/client/components/calendar-sidebar.js.map +1 -0
- package/client/components/calendar-sidebar.ts +474 -0
- package/client/components/calendar.js +217 -0
- package/client/components/calendar.js.map +1 -0
- package/client/components/calendar.ts +211 -0
- package/client/components/context-menu.js +80 -0
- package/client/components/context-menu.js.map +1 -0
- package/client/components/context-menu.ts +95 -0
- package/client/components/folder-picker.js +119 -0
- package/client/components/folder-picker.js.map +1 -0
- package/client/components/folder-picker.ts +127 -0
- package/client/components/folder-tree.js +1093 -0
- package/client/components/folder-tree.js.map +1 -0
- package/client/components/folder-tree.ts +1069 -0
- package/client/components/message-list.js +1140 -0
- package/client/components/message-list.js.map +1 -0
- package/client/components/message-list.ts +1129 -0
- package/client/components/message-viewer.js +1291 -0
- package/client/components/message-viewer.js.map +1 -0
- package/client/components/message-viewer.ts +1257 -0
- package/client/components/outbox-view.js +104 -0
- package/client/components/outbox-view.js.map +1 -0
- package/client/components/outbox-view.ts +102 -0
- package/client/components/tasks.js +261 -0
- package/client/components/tasks.js.map +1 -0
- package/client/components/tasks.ts +234 -0
- package/client/compose/compose.css +560 -0
- package/client/compose/compose.html +52 -0
- package/client/compose/compose.js +1289 -0
- package/client/compose/compose.js.map +1 -0
- package/client/compose/compose.ts +1231 -0
- package/client/compose/editor.js +616 -0
- package/client/compose/editor.js.map +1 -0
- package/client/compose/editor.ts +599 -0
- package/client/compose/ghost-text.js +122 -0
- package/client/compose/ghost-text.js.map +1 -0
- package/client/compose/ghost-text.ts +140 -0
- package/client/favicon.svg +11 -0
- package/client/icon.ico +0 -0
- package/client/icon.png +0 -0
- package/client/index.html +230 -0
- package/client/lib/android-bootstrap.js +9 -0
- package/client/lib/android-bootstrap.js.map +1 -0
- package/client/lib/android-bootstrap.ts +9 -0
- package/client/lib/api-client.js +378 -0
- package/client/lib/api-client.js.map +1 -0
- package/client/lib/api-client.ts +439 -0
- package/client/lib/local-service.js +603 -0
- package/client/lib/local-service.js.map +1 -0
- package/client/lib/local-service.ts +646 -0
- package/client/lib/local-store.js +214 -0
- package/client/lib/local-store.js.map +1 -0
- package/client/lib/local-store.ts +283 -0
- package/client/lib/mailxapi.js +304 -0
- package/client/lib/message-state.js +132 -0
- package/client/lib/message-state.js.map +1 -0
- package/client/lib/message-state.ts +160 -0
- package/client/package.json +16 -0
- package/client/styles/components.css +2049 -0
- package/client/styles/layout.css +332 -0
- package/client/styles/variables.css +85 -0
- package/client/tsconfig.json +19 -0
- package/package.json +124 -0
- package/packages/mailx-api/.gitattributes +10 -0
- package/packages/mailx-api/index.d.ts +10 -0
- package/packages/mailx-api/index.d.ts.map +1 -0
- package/packages/mailx-api/index.js +322 -0
- package/packages/mailx-api/index.js.map +1 -0
- package/packages/mailx-api/index.ts +283 -0
- package/packages/mailx-api/package.json +27 -0
- package/packages/mailx-api/tsconfig.json +9 -0
- package/packages/mailx-api/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-compose/.gitattributes +10 -0
- package/packages/mailx-compose/index.d.ts +21 -0
- package/packages/mailx-compose/index.d.ts.map +1 -0
- package/packages/mailx-compose/index.js +61 -0
- package/packages/mailx-compose/index.js.map +1 -0
- package/packages/mailx-compose/index.ts +85 -0
- package/packages/mailx-compose/package.json +18 -0
- package/packages/mailx-compose/tsconfig.json +9 -0
- package/packages/mailx-core/index.d.ts +139 -0
- package/packages/mailx-core/index.d.ts.map +1 -0
- package/packages/mailx-core/index.js +403 -0
- package/packages/mailx-core/index.js.map +1 -0
- package/packages/mailx-core/index.ts +424 -0
- package/packages/mailx-core/ipc.d.ts +13 -0
- package/packages/mailx-core/ipc.d.ts.map +1 -0
- package/packages/mailx-core/ipc.js +56 -0
- package/packages/mailx-core/ipc.js.map +1 -0
- package/packages/mailx-core/ipc.ts +62 -0
- package/packages/mailx-core/package.json +18 -0
- package/packages/mailx-core/tsconfig.json +9 -0
- package/packages/mailx-host/.gitattributes +10 -0
- package/packages/mailx-host/index.d.ts +21 -0
- package/packages/mailx-host/index.d.ts.map +1 -0
- package/packages/mailx-host/index.js +29 -0
- package/packages/mailx-host/index.js.map +1 -0
- package/packages/mailx-host/index.ts +38 -0
- package/packages/mailx-host/package.json +23 -0
- package/packages/mailx-host/tsconfig.json +9 -0
- package/packages/mailx-host/types-shim.d.ts +14 -0
- package/packages/mailx-imap/.gitattributes +10 -0
- package/packages/mailx-imap/index.d.ts +442 -0
- package/packages/mailx-imap/index.d.ts.map +1 -0
- package/packages/mailx-imap/index.js +3684 -0
- package/packages/mailx-imap/index.js.map +1 -0
- package/packages/mailx-imap/index.ts +3652 -0
- package/packages/mailx-imap/package-lock.json +131 -0
- package/packages/mailx-imap/package.json +28 -0
- package/packages/mailx-imap/providers/gmail-api.d.ts +8 -0
- package/packages/mailx-imap/providers/gmail-api.d.ts.map +1 -0
- package/packages/mailx-imap/providers/gmail-api.js +8 -0
- package/packages/mailx-imap/providers/gmail-api.js.map +1 -0
- package/packages/mailx-imap/providers/gmail-api.ts +8 -0
- package/packages/mailx-imap/providers/outlook-api.ts +7 -0
- package/packages/mailx-imap/providers/types.d.ts +9 -0
- package/packages/mailx-imap/providers/types.d.ts.map +1 -0
- package/packages/mailx-imap/providers/types.js +9 -0
- package/packages/mailx-imap/providers/types.js.map +1 -0
- package/packages/mailx-imap/providers/types.ts +9 -0
- package/packages/mailx-imap/tsconfig.json +9 -0
- package/packages/mailx-imap/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-send/.gitattributes +10 -0
- package/packages/mailx-send/README.md +217 -0
- package/packages/mailx-send/cli-queue.d.ts +11 -0
- package/packages/mailx-send/cli-queue.d.ts.map +1 -0
- package/packages/mailx-send/cli-queue.js +59 -0
- package/packages/mailx-send/cli-queue.js.map +1 -0
- package/packages/mailx-send/cli-queue.ts +62 -0
- package/packages/mailx-send/cli-send.d.ts +17 -0
- package/packages/mailx-send/cli-send.d.ts.map +1 -0
- package/packages/mailx-send/cli-send.js +75 -0
- package/packages/mailx-send/cli-send.js.map +1 -0
- package/packages/mailx-send/cli-send.ts +83 -0
- package/packages/mailx-send/cli.d.ts +22 -0
- package/packages/mailx-send/cli.d.ts.map +1 -0
- package/packages/mailx-send/cli.js +115 -0
- package/packages/mailx-send/cli.js.map +1 -0
- package/packages/mailx-send/cli.ts +126 -0
- package/packages/mailx-send/index.d.ts +77 -0
- package/packages/mailx-send/index.d.ts.map +1 -0
- package/packages/mailx-send/index.js +264 -0
- package/packages/mailx-send/index.js.map +1 -0
- package/packages/mailx-send/index.ts +333 -0
- package/packages/mailx-send/mailsend/README.md +133 -0
- package/packages/mailx-send/mailsend/cli.d.ts +12 -0
- package/packages/mailx-send/mailsend/cli.d.ts.map +1 -0
- package/packages/mailx-send/mailsend/cli.js +70 -0
- package/packages/mailx-send/mailsend/cli.js.map +1 -0
- package/packages/mailx-send/mailsend/cli.ts +81 -0
- package/packages/mailx-send/mailsend/index.d.ts +77 -0
- package/packages/mailx-send/mailsend/index.d.ts.map +1 -0
- package/packages/mailx-send/mailsend/index.js +264 -0
- package/packages/mailx-send/mailsend/index.js.map +1 -0
- package/packages/mailx-send/mailsend/index.ts +333 -0
- package/packages/mailx-send/mailsend/package-lock.json +65 -0
- package/packages/mailx-send/mailsend/package.json +26 -0
- package/packages/mailx-send/mailsend/tsconfig.json +21 -0
- package/packages/mailx-send/package-lock.json +65 -0
- package/packages/mailx-send/package.json +37 -0
- package/packages/mailx-send/tsconfig.json +21 -0
- package/packages/mailx-server/.gitattributes +10 -0
- package/packages/mailx-server/index.d.ts +8 -0
- package/packages/mailx-server/index.d.ts.map +1 -0
- package/packages/mailx-server/index.js +397 -0
- package/packages/mailx-server/index.js.map +1 -0
- package/packages/mailx-server/index.ts +429 -0
- package/packages/mailx-server/package.json +28 -0
- package/packages/mailx-server/tsconfig.json +9 -0
- package/packages/mailx-server/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-service/google-sync.d.ts +96 -0
- package/packages/mailx-service/google-sync.d.ts.map +1 -0
- package/packages/mailx-service/google-sync.js +153 -0
- package/packages/mailx-service/google-sync.js.map +1 -0
- package/packages/mailx-service/google-sync.ts +238 -0
- package/packages/mailx-service/index.d.ts +366 -0
- package/packages/mailx-service/index.d.ts.map +1 -0
- package/packages/mailx-service/index.js +2589 -0
- package/packages/mailx-service/index.js.map +1 -0
- package/packages/mailx-service/index.ts +2512 -0
- package/packages/mailx-service/jsonrpc.d.ts +25 -0
- package/packages/mailx-service/jsonrpc.d.ts.map +1 -0
- package/packages/mailx-service/jsonrpc.js +238 -0
- package/packages/mailx-service/jsonrpc.js.map +1 -0
- package/packages/mailx-service/jsonrpc.ts +268 -0
- package/packages/mailx-service/package.json +22 -0
- package/packages/mailx-service/tsconfig.json +9 -0
- package/packages/mailx-settings/.gitattributes +10 -0
- package/packages/mailx-settings/cloud.d.ts +47 -0
- package/packages/mailx-settings/cloud.d.ts.map +1 -0
- package/packages/mailx-settings/cloud.js +408 -0
- package/packages/mailx-settings/cloud.js.map +1 -0
- package/packages/mailx-settings/cloud.ts +393 -0
- package/packages/mailx-settings/index.d.ts +140 -0
- package/packages/mailx-settings/index.d.ts.map +1 -0
- package/packages/mailx-settings/index.js +872 -0
- package/packages/mailx-settings/index.js.map +1 -0
- package/packages/mailx-settings/index.ts +908 -0
- package/packages/mailx-settings/package.json +20 -0
- package/packages/mailx-settings/tsconfig.json +9 -0
- package/packages/mailx-settings/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-store/.gitattributes +10 -0
- package/packages/mailx-store/db.d.ts +346 -0
- package/packages/mailx-store/db.d.ts.map +1 -0
- package/packages/mailx-store/db.js +1796 -0
- package/packages/mailx-store/db.js.map +1 -0
- package/packages/mailx-store/db.ts +2007 -0
- package/packages/mailx-store/file-store.d.ts +36 -0
- package/packages/mailx-store/file-store.d.ts.map +1 -0
- package/packages/mailx-store/file-store.js +80 -0
- package/packages/mailx-store/file-store.js.map +1 -0
- package/packages/mailx-store/file-store.ts +82 -0
- package/packages/mailx-store/index.d.ts +7 -0
- package/packages/mailx-store/index.d.ts.map +1 -0
- package/packages/mailx-store/index.js +7 -0
- package/packages/mailx-store/index.js.map +1 -0
- package/packages/mailx-store/index.ts +7 -0
- package/packages/mailx-store/package.json +19 -0
- package/packages/mailx-store/tsconfig.json +9 -0
- package/packages/mailx-store/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-store-web/android-bootstrap.d.ts +16 -0
- package/packages/mailx-store-web/android-bootstrap.d.ts.map +1 -0
- package/packages/mailx-store-web/android-bootstrap.js +1247 -0
- package/packages/mailx-store-web/android-bootstrap.js.map +1 -0
- package/packages/mailx-store-web/android-bootstrap.ts +1262 -0
- package/packages/mailx-store-web/db.d.ts +132 -0
- package/packages/mailx-store-web/db.d.ts.map +1 -0
- package/packages/mailx-store-web/db.js +642 -0
- package/packages/mailx-store-web/db.js.map +1 -0
- package/packages/mailx-store-web/db.ts +756 -0
- package/packages/mailx-store-web/gmail-api-web.d.ts +11 -0
- package/packages/mailx-store-web/gmail-api-web.d.ts.map +1 -0
- package/packages/mailx-store-web/gmail-api-web.js +11 -0
- package/packages/mailx-store-web/gmail-api-web.js.map +1 -0
- package/packages/mailx-store-web/gmail-api-web.ts +11 -0
- package/packages/mailx-store-web/imap-web-provider.d.ts +33 -0
- package/packages/mailx-store-web/imap-web-provider.d.ts.map +1 -0
- package/packages/mailx-store-web/imap-web-provider.js +140 -0
- package/packages/mailx-store-web/imap-web-provider.js.map +1 -0
- package/packages/mailx-store-web/imap-web-provider.ts +156 -0
- package/packages/mailx-store-web/index.d.ts +10 -0
- package/packages/mailx-store-web/index.d.ts.map +1 -0
- package/packages/mailx-store-web/index.js +10 -0
- package/packages/mailx-store-web/index.js.map +1 -0
- package/packages/mailx-store-web/index.ts +10 -0
- package/packages/mailx-store-web/main-thread-host.d.ts +15 -0
- package/packages/mailx-store-web/main-thread-host.d.ts.map +1 -0
- package/packages/mailx-store-web/main-thread-host.js +292 -0
- package/packages/mailx-store-web/main-thread-host.js.map +1 -0
- package/packages/mailx-store-web/main-thread-host.ts +322 -0
- package/packages/mailx-store-web/package.json +23 -0
- package/packages/mailx-store-web/provider-types.d.ts +7 -0
- package/packages/mailx-store-web/provider-types.d.ts.map +1 -0
- package/packages/mailx-store-web/provider-types.js +7 -0
- package/packages/mailx-store-web/provider-types.js.map +1 -0
- package/packages/mailx-store-web/provider-types.ts +7 -0
- package/packages/mailx-store-web/sql-wasm-esm.js +10 -0
- package/packages/mailx-store-web/sql.js.d.ts +29 -0
- package/packages/mailx-store-web/sync-manager.d.ts +68 -0
- package/packages/mailx-store-web/sync-manager.d.ts.map +1 -0
- package/packages/mailx-store-web/sync-manager.js +506 -0
- package/packages/mailx-store-web/sync-manager.js.map +1 -0
- package/packages/mailx-store-web/sync-manager.ts +508 -0
- package/packages/mailx-store-web/tsconfig.json +10 -0
- package/packages/mailx-store-web/web-jsonrpc.d.ts +20 -0
- package/packages/mailx-store-web/web-jsonrpc.d.ts.map +1 -0
- package/packages/mailx-store-web/web-jsonrpc.js +102 -0
- package/packages/mailx-store-web/web-jsonrpc.js.map +1 -0
- package/packages/mailx-store-web/web-jsonrpc.ts +116 -0
- package/packages/mailx-store-web/web-message-store.d.ts +16 -0
- package/packages/mailx-store-web/web-message-store.d.ts.map +1 -0
- package/packages/mailx-store-web/web-message-store.js +89 -0
- package/packages/mailx-store-web/web-message-store.js.map +1 -0
- package/packages/mailx-store-web/web-message-store.ts +97 -0
- package/packages/mailx-store-web/web-service.d.ts +111 -0
- package/packages/mailx-store-web/web-service.d.ts.map +1 -0
- package/packages/mailx-store-web/web-service.js +542 -0
- package/packages/mailx-store-web/web-service.js.map +1 -0
- package/packages/mailx-store-web/web-service.ts +616 -0
- package/packages/mailx-store-web/web-settings.d.ts +83 -0
- package/packages/mailx-store-web/web-settings.d.ts.map +1 -0
- package/packages/mailx-store-web/web-settings.js +491 -0
- package/packages/mailx-store-web/web-settings.js.map +1 -0
- package/packages/mailx-store-web/web-settings.ts +522 -0
- package/packages/mailx-store-web/worker-bundle.js +6838 -0
- package/packages/mailx-store-web/worker-entry.d.ts +8 -0
- package/packages/mailx-store-web/worker-entry.d.ts.map +1 -0
- package/packages/mailx-store-web/worker-entry.js +187 -0
- package/packages/mailx-store-web/worker-entry.js.map +1 -0
- package/packages/mailx-store-web/worker-entry.ts +215 -0
- package/packages/mailx-store-web/worker-tcp-transport.d.ts +28 -0
- package/packages/mailx-store-web/worker-tcp-transport.d.ts.map +1 -0
- package/packages/mailx-store-web/worker-tcp-transport.js +98 -0
- package/packages/mailx-store-web/worker-tcp-transport.js.map +1 -0
- package/packages/mailx-store-web/worker-tcp-transport.ts +101 -0
- package/packages/mailx-types/.gitattributes +10 -0
- package/packages/mailx-types/index.d.ts +319 -0
- package/packages/mailx-types/index.d.ts.map +1 -0
- package/packages/mailx-types/index.js +243 -0
- package/packages/mailx-types/index.js.map +1 -0
- package/packages/mailx-types/index.ts +498 -0
- package/packages/mailx-types/package.json +16 -0
- package/packages/mailx-types/tsconfig.json +9 -0
- package/packages/mailx-types/tsconfig.tsbuildinfo +1 -0
- package/todo.json +13 -0
- package/tsconfig.base.json +31 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-per-message body storage backend.
|
|
3
|
+
*
|
|
4
|
+
* Disk layout: {basePath}/{accountId}/<xx>/<uuid>.eml
|
|
5
|
+
* Filename is an opaque UUID. Two-char prefix dir for filesystem fan-out.
|
|
6
|
+
*
|
|
7
|
+
* CRITICAL: the on-disk filename carries NO semantic meaning — not folder
|
|
8
|
+
* id, not UID, not Message-ID. A new UUID is minted on every `putMessage`.
|
|
9
|
+
* Moves, UID renumbers, UIDVALIDITY bumps cannot shadow a body because no
|
|
10
|
+
* filename is ever reused. DB's `body_path` column is the sole authority
|
|
11
|
+
* on where a given message's body lives.
|
|
12
|
+
*/
|
|
13
|
+
import type { MessageStore } from "@bobfrankston/mailx-types";
|
|
14
|
+
export declare class FileMessageStore implements MessageStore {
|
|
15
|
+
private basePath;
|
|
16
|
+
constructor(basePath: string);
|
|
17
|
+
/** Fresh opaque path per call. No inputs from the caller affect the name. */
|
|
18
|
+
private newMessagePath;
|
|
19
|
+
/** Verify a given path resolves inside this store's basePath — refuses
|
|
20
|
+
* any value that doesn't (cheap directory-traversal guard). */
|
|
21
|
+
private inStore;
|
|
22
|
+
/** Write a new body. Always a fresh UUID path. Caller MUST persist the
|
|
23
|
+
* returned path in the DB (`body_path`) and use it for all reads. The
|
|
24
|
+
* (folderId, uid) args are kept for interface compatibility; they do
|
|
25
|
+
* NOT affect the filename. */
|
|
26
|
+
putMessage(accountId: string, _folderId: number, _uid: number, raw: Buffer): Promise<string>;
|
|
27
|
+
/** Read by absolute path (DB `body_path`). The primary read API. */
|
|
28
|
+
readByPath(fullPath: string): Promise<Buffer>;
|
|
29
|
+
hasByPath(fullPath: string): Promise<boolean>;
|
|
30
|
+
unlinkByPath(fullPath: string): Promise<void>;
|
|
31
|
+
getMessagePath(_accountId: string, _folderId: number, _uid: number): string;
|
|
32
|
+
getMessage(_accountId: string, _folderId: number, _uid: number): Promise<Buffer>;
|
|
33
|
+
hasMessage(_accountId: string, _folderId: number, _uid: number): Promise<boolean>;
|
|
34
|
+
deleteMessage(_accountId: string, _folderId: number, _uid: number): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=file-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-store.d.ts","sourceRoot":"","sources":["file-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,qBAAa,gBAAiB,YAAW,YAAY;IACrC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,MAAM;IAIpC,6EAA6E;IAC7E,OAAO,CAAC,cAAc;IAMtB;oEACgE;IAChE,OAAO,CAAC,OAAO;IAMf;;;mCAG+B;IACzB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOlG,oEAAoE;IAC9D,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK7C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK7C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAGrE,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAGhF,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGjF,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1F"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-per-message body storage backend.
|
|
3
|
+
*
|
|
4
|
+
* Disk layout: {basePath}/{accountId}/<xx>/<uuid>.eml
|
|
5
|
+
* Filename is an opaque UUID. Two-char prefix dir for filesystem fan-out.
|
|
6
|
+
*
|
|
7
|
+
* CRITICAL: the on-disk filename carries NO semantic meaning — not folder
|
|
8
|
+
* id, not UID, not Message-ID. A new UUID is minted on every `putMessage`.
|
|
9
|
+
* Moves, UID renumbers, UIDVALIDITY bumps cannot shadow a body because no
|
|
10
|
+
* filename is ever reused. DB's `body_path` column is the sole authority
|
|
11
|
+
* on where a given message's body lives.
|
|
12
|
+
*/
|
|
13
|
+
import * as fs from "node:fs";
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
import { randomUUID } from "node:crypto";
|
|
16
|
+
export class FileMessageStore {
|
|
17
|
+
basePath;
|
|
18
|
+
constructor(basePath) {
|
|
19
|
+
this.basePath = basePath;
|
|
20
|
+
fs.mkdirSync(basePath, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
/** Fresh opaque path per call. No inputs from the caller affect the name. */
|
|
23
|
+
newMessagePath(accountId) {
|
|
24
|
+
const uuid = randomUUID().replace(/-/g, "");
|
|
25
|
+
const prefix = uuid.slice(0, 2);
|
|
26
|
+
return path.join(this.basePath, accountId, prefix, `${uuid}.eml`);
|
|
27
|
+
}
|
|
28
|
+
/** Verify a given path resolves inside this store's basePath — refuses
|
|
29
|
+
* any value that doesn't (cheap directory-traversal guard). */
|
|
30
|
+
inStore(fullPath) {
|
|
31
|
+
if (!fullPath)
|
|
32
|
+
return false;
|
|
33
|
+
const rel = path.relative(path.resolve(this.basePath), path.resolve(fullPath));
|
|
34
|
+
return !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
35
|
+
}
|
|
36
|
+
/** Write a new body. Always a fresh UUID path. Caller MUST persist the
|
|
37
|
+
* returned path in the DB (`body_path`) and use it for all reads. The
|
|
38
|
+
* (folderId, uid) args are kept for interface compatibility; they do
|
|
39
|
+
* NOT affect the filename. */
|
|
40
|
+
async putMessage(accountId, _folderId, _uid, raw) {
|
|
41
|
+
const filePath = this.newMessagePath(accountId);
|
|
42
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
43
|
+
fs.writeFileSync(filePath, raw);
|
|
44
|
+
return filePath;
|
|
45
|
+
}
|
|
46
|
+
/** Read by absolute path (DB `body_path`). The primary read API. */
|
|
47
|
+
async readByPath(fullPath) {
|
|
48
|
+
if (!this.inStore(fullPath))
|
|
49
|
+
throw new Error(`refusing to read outside store: ${fullPath}`);
|
|
50
|
+
return fs.readFileSync(fullPath);
|
|
51
|
+
}
|
|
52
|
+
async hasByPath(fullPath) {
|
|
53
|
+
if (!this.inStore(fullPath))
|
|
54
|
+
return false;
|
|
55
|
+
return fs.existsSync(fullPath);
|
|
56
|
+
}
|
|
57
|
+
async unlinkByPath(fullPath) {
|
|
58
|
+
if (!this.inStore(fullPath))
|
|
59
|
+
return;
|
|
60
|
+
if (fs.existsSync(fullPath))
|
|
61
|
+
fs.unlinkSync(fullPath);
|
|
62
|
+
}
|
|
63
|
+
// MessageStore interface compatibility (unused once all callers migrate to
|
|
64
|
+
// path-based reads). These used to compose {folderId}/{uid}.eml and they
|
|
65
|
+
// would resurrect the comingling bug if restored. Kept as throwing stubs
|
|
66
|
+
// so any accidental caller surfaces loudly rather than silently misbehave.
|
|
67
|
+
getMessagePath(_accountId, _folderId, _uid) {
|
|
68
|
+
throw new Error("FileMessageStore.getMessagePath is retired — read body_path from DB");
|
|
69
|
+
}
|
|
70
|
+
async getMessage(_accountId, _folderId, _uid) {
|
|
71
|
+
throw new Error("FileMessageStore.getMessage(folder,uid) is retired — use readByPath(body_path)");
|
|
72
|
+
}
|
|
73
|
+
async hasMessage(_accountId, _folderId, _uid) {
|
|
74
|
+
throw new Error("FileMessageStore.hasMessage(folder,uid) is retired — use hasByPath(body_path)");
|
|
75
|
+
}
|
|
76
|
+
async deleteMessage(_accountId, _folderId, _uid) {
|
|
77
|
+
throw new Error("FileMessageStore.deleteMessage(folder,uid) is retired — use unlinkByPath(body_path)");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=file-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-store.js","sourceRoot":"","sources":["file-store.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-per-message body storage backend.
|
|
3
|
+
*
|
|
4
|
+
* Disk layout: {basePath}/{accountId}/<xx>/<uuid>.eml
|
|
5
|
+
* Filename is an opaque UUID. Two-char prefix dir for filesystem fan-out.
|
|
6
|
+
*
|
|
7
|
+
* CRITICAL: the on-disk filename carries NO semantic meaning — not folder
|
|
8
|
+
* id, not UID, not Message-ID. A new UUID is minted on every `putMessage`.
|
|
9
|
+
* Moves, UID renumbers, UIDVALIDITY bumps cannot shadow a body because no
|
|
10
|
+
* filename is ever reused. DB's `body_path` column is the sole authority
|
|
11
|
+
* on where a given message's body lives.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import * as fs from "node:fs";
|
|
15
|
+
import * as path from "node:path";
|
|
16
|
+
import { randomUUID } from "node:crypto";
|
|
17
|
+
import type { MessageStore } from "@bobfrankston/mailx-types";
|
|
18
|
+
|
|
19
|
+
export class FileMessageStore implements MessageStore {
|
|
20
|
+
constructor(private basePath: string) {
|
|
21
|
+
fs.mkdirSync(basePath, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Fresh opaque path per call. No inputs from the caller affect the name. */
|
|
25
|
+
private newMessagePath(accountId: string): string {
|
|
26
|
+
const uuid = randomUUID().replace(/-/g, "");
|
|
27
|
+
const prefix = uuid.slice(0, 2);
|
|
28
|
+
return path.join(this.basePath, accountId, prefix, `${uuid}.eml`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Verify a given path resolves inside this store's basePath — refuses
|
|
32
|
+
* any value that doesn't (cheap directory-traversal guard). */
|
|
33
|
+
private inStore(fullPath: string): boolean {
|
|
34
|
+
if (!fullPath) return false;
|
|
35
|
+
const rel = path.relative(path.resolve(this.basePath), path.resolve(fullPath));
|
|
36
|
+
return !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Write a new body. Always a fresh UUID path. Caller MUST persist the
|
|
40
|
+
* returned path in the DB (`body_path`) and use it for all reads. The
|
|
41
|
+
* (folderId, uid) args are kept for interface compatibility; they do
|
|
42
|
+
* NOT affect the filename. */
|
|
43
|
+
async putMessage(accountId: string, _folderId: number, _uid: number, raw: Buffer): Promise<string> {
|
|
44
|
+
const filePath = this.newMessagePath(accountId);
|
|
45
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
46
|
+
fs.writeFileSync(filePath, raw);
|
|
47
|
+
return filePath;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Read by absolute path (DB `body_path`). The primary read API. */
|
|
51
|
+
async readByPath(fullPath: string): Promise<Buffer> {
|
|
52
|
+
if (!this.inStore(fullPath)) throw new Error(`refusing to read outside store: ${fullPath}`);
|
|
53
|
+
return fs.readFileSync(fullPath);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async hasByPath(fullPath: string): Promise<boolean> {
|
|
57
|
+
if (!this.inStore(fullPath)) return false;
|
|
58
|
+
return fs.existsSync(fullPath);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async unlinkByPath(fullPath: string): Promise<void> {
|
|
62
|
+
if (!this.inStore(fullPath)) return;
|
|
63
|
+
if (fs.existsSync(fullPath)) fs.unlinkSync(fullPath);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// MessageStore interface compatibility (unused once all callers migrate to
|
|
67
|
+
// path-based reads). These used to compose {folderId}/{uid}.eml and they
|
|
68
|
+
// would resurrect the comingling bug if restored. Kept as throwing stubs
|
|
69
|
+
// so any accidental caller surfaces loudly rather than silently misbehave.
|
|
70
|
+
getMessagePath(_accountId: string, _folderId: number, _uid: number): string {
|
|
71
|
+
throw new Error("FileMessageStore.getMessagePath is retired — read body_path from DB");
|
|
72
|
+
}
|
|
73
|
+
async getMessage(_accountId: string, _folderId: number, _uid: number): Promise<Buffer> {
|
|
74
|
+
throw new Error("FileMessageStore.getMessage(folder,uid) is retired — use readByPath(body_path)");
|
|
75
|
+
}
|
|
76
|
+
async hasMessage(_accountId: string, _folderId: number, _uid: number): Promise<boolean> {
|
|
77
|
+
throw new Error("FileMessageStore.hasMessage(folder,uid) is retired — use hasByPath(body_path)");
|
|
78
|
+
}
|
|
79
|
+
async deleteMessage(_accountId: string, _folderId: number, _uid: number): Promise<void> {
|
|
80
|
+
throw new Error("FileMessageStore.deleteMessage(folder,uid) is retired — use unlinkByPath(body_path)");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bobfrankston/mailx-store",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@bobfrankston/mailx-types": "file:../mailx-types",
|
|
13
|
+
"@bobfrankston/mailx-settings": "file:../mailx-settings"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/BobFrankston/mailx-store.git"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./db.ts","./file-store.ts","./index.ts"],"version":"5.9.2"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Android bootstrap — wires WebMailxDB + WebMessageStore + GmailApiWebProvider + WebMailxService
|
|
3
|
+
* into the mailxapi bridge. This replaces Node.js backend for Android WebView.
|
|
4
|
+
*
|
|
5
|
+
* On Android, everything runs in the same JavaScript context:
|
|
6
|
+
* - wa-sqlite for metadata (via WebMailxDB)
|
|
7
|
+
* - IndexedDB for message bodies (via WebMessageStore)
|
|
8
|
+
* - Gmail/Outlook sync via REST APIs (plain fetch — no native bridge needed)
|
|
9
|
+
* - IMAP accounts use BridgeTransport (via MAUI TCP bridge) — not yet implemented
|
|
10
|
+
*
|
|
11
|
+
* The existing client UI (app.ts, components/) is completely unchanged —
|
|
12
|
+
* it calls window.mailxapi.* which this module provides.
|
|
13
|
+
*/
|
|
14
|
+
export declare function initAndroid(): Promise<void>;
|
|
15
|
+
export declare function resetStore(): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=android-bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android-bootstrap.d.ts","sourceRoot":"","sources":["android-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAw7BH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAkJjD;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAIhD"}
|