@bobfrankston/rmfmail 1.2.123 → 1.2.124

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 (47) hide show
  1. package/README.md +6 -0
  2. package/bin/mailx.js +31 -0
  3. package/bin/mailx.js.map +1 -1
  4. package/bin/mailx.ts +29 -0
  5. package/client/android-bootstrap.bundle.js +29 -21
  6. package/client/android-bootstrap.bundle.js.map +3 -3
  7. package/client/app.bundle.js +18 -1
  8. package/client/app.bundle.js.map +3 -3
  9. package/client/app.js +16 -0
  10. package/client/app.js.map +1 -1
  11. package/client/app.ts +15 -0
  12. package/client/components/message-viewer.js +1 -1
  13. package/client/components/message-viewer.js.map +1 -1
  14. package/client/components/message-viewer.ts +1 -1
  15. package/client/compose/compose.bundle.js +7 -0
  16. package/client/compose/compose.bundle.js.map +2 -2
  17. package/client/index.html +2 -0
  18. package/client/lib/api-client.js +8 -0
  19. package/client/lib/api-client.js.map +1 -1
  20. package/client/lib/api-client.ts +8 -0
  21. package/client/lib/mailxapi.js +4 -0
  22. package/package.json +5 -5
  23. package/packages/mailx-imap/index.js +1 -1
  24. package/packages/mailx-imap/index.js.map +1 -1
  25. package/packages/mailx-imap/index.ts +1 -1
  26. package/packages/mailx-imap/package-lock.json +2 -2
  27. package/packages/mailx-imap/package.json +1 -1
  28. package/packages/mailx-service/index.d.ts +13 -0
  29. package/packages/mailx-service/index.d.ts.map +1 -1
  30. package/packages/mailx-service/index.js +28 -2
  31. package/packages/mailx-service/index.js.map +1 -1
  32. package/packages/mailx-service/index.ts +28 -2
  33. package/packages/mailx-service/jsonrpc.js +2 -0
  34. package/packages/mailx-service/jsonrpc.js.map +1 -1
  35. package/packages/mailx-service/jsonrpc.ts +2 -0
  36. package/packages/mailx-service/sync-queue.d.ts +8 -0
  37. package/packages/mailx-service/sync-queue.d.ts.map +1 -1
  38. package/packages/mailx-service/sync-queue.js +10 -0
  39. package/packages/mailx-service/sync-queue.js.map +1 -1
  40. package/packages/mailx-service/sync-queue.ts +11 -0
  41. package/packages/mailx-settings/package.json +1 -1
  42. package/packages/mailx-store-web/package.json +1 -1
  43. package/packages/mailx-store-web/web-service.d.ts.map +1 -1
  44. package/packages/mailx-store-web/web-service.js +9 -2
  45. package/packages/mailx-store-web/web-service.js.map +1 -1
  46. package/packages/mailx-store-web/web-service.ts +9 -2
  47. package/packages/mailx-types/package.json +1 -1
@@ -5822,13 +5822,13 @@ var WebMailxService = class _WebMailxService {
5822
5822
  raw = await this.syncManager.fetchMessageBody(accountId, envelope.folderId, envelope.uid);
5823
5823
  } catch (fetchErr) {
5824
5824
  const rawErr = fetchErr.message || "fetch failed";
5825
- const isTransient = /connection|Too many|UNAVAILABLE|rate|429|5\d\d|timeout|ENOTFOUND|ECONNRESET|ETIMEDOUT/i.test(rawErr);
5825
+ const serverSaysGone = /no such message|not found|does not exist|nonexistent|expunged|invalid uid/i.test(rawErr);
5826
5826
  return {
5827
5827
  ...envelope,
5828
5828
  bodyHtml: "",
5829
5829
  bodyText: "",
5830
5830
  bodyError: rawErr,
5831
- bodyErrorTransient: isTransient,
5831
+ bodyErrorTransient: !serverSaysGone,
5832
5832
  hasRemoteContent: false,
5833
5833
  remoteAllowed: false,
5834
5834
  attachments: [],
@@ -7226,6 +7226,13 @@ Accept: application/json\r
7226
7226
  };
7227
7227
 
7228
7228
  // ../../MailApps/tcp-transport/bridge-tcp-transport.js
7229
+ function bridge() {
7230
+ const g = globalThis;
7231
+ const api = g.msgapi || g._nativeBridge;
7232
+ if (!api?.tcp)
7233
+ throw new Error("TCP bridge not available \u2014 host has not injected msgapi/_nativeBridge (yet)");
7234
+ return api;
7235
+ }
7229
7236
  var BridgeTcpTransport = class {
7230
7237
  streamId = null;
7231
7238
  dataHandler = null;
@@ -7237,18 +7244,19 @@ var BridgeTcpTransport = class {
7237
7244
  return this._connected;
7238
7245
  }
7239
7246
  async connect(host, port, tls, _servername) {
7240
- this.streamId = await msgapi.tcp.connect(host, port, tls);
7247
+ const api = bridge();
7248
+ this.streamId = await api.tcp.connect(host, port, tls);
7241
7249
  this._connected = true;
7242
- msgapi.tcp.onData(this.streamId, (data) => {
7250
+ api.tcp.onData(this.streamId, (data) => {
7243
7251
  if (this.dataHandler)
7244
7252
  this.dataHandler(this.encoder.encode(data));
7245
7253
  });
7246
- msgapi.tcp.onClose(this.streamId, (hadError) => {
7254
+ api.tcp.onClose(this.streamId, (hadError) => {
7247
7255
  this._connected = false;
7248
7256
  if (this.closeHandler)
7249
7257
  this.closeHandler(hadError);
7250
7258
  });
7251
- msgapi.tcp.onError(this.streamId, (message) => {
7259
+ api.tcp.onError(this.streamId, (message) => {
7252
7260
  if (this.errorHandler)
7253
7261
  this.errorHandler(new Error(message));
7254
7262
  });
@@ -7256,13 +7264,13 @@ var BridgeTcpTransport = class {
7256
7264
  async upgradeTLS(servername) {
7257
7265
  if (this.streamId == null)
7258
7266
  throw new Error("Not connected");
7259
- await msgapi.tcp.upgradeTLS(this.streamId, servername || "");
7267
+ await bridge().tcp.upgradeTLS(this.streamId, servername || "");
7260
7268
  }
7261
7269
  async write(data) {
7262
7270
  if (this.streamId == null)
7263
7271
  throw new Error("Not connected");
7264
7272
  const s = typeof data === "string" ? data : new TextDecoder().decode(data);
7265
- await msgapi.tcp.write(this.streamId, s);
7273
+ await bridge().tcp.write(this.streamId, s);
7266
7274
  }
7267
7275
  onData(handler) {
7268
7276
  this.dataHandler = handler;
@@ -7276,7 +7284,7 @@ var BridgeTcpTransport = class {
7276
7284
  close() {
7277
7285
  if (this.streamId != null) {
7278
7286
  try {
7279
- msgapi.tcp.close(this.streamId);
7287
+ bridge().tcp.close(this.streamId);
7280
7288
  } catch {
7281
7289
  }
7282
7290
  this.streamId = null;
@@ -10736,8 +10744,8 @@ function createNativeTokenProvider(email) {
10736
10744
  }
10737
10745
  }
10738
10746
  }
10739
- const bridge = window._nativeBridge;
10740
- if (!bridge?.app?.startOAuth) {
10747
+ const bridge2 = window._nativeBridge;
10748
+ if (!bridge2?.app?.startOAuth) {
10741
10749
  throw new Error("No native OAuth bridge");
10742
10750
  }
10743
10751
  const authUrl = `${OAUTH_CLIENT.authUri}?` + new URLSearchParams({
@@ -10750,7 +10758,7 @@ function createNativeTokenProvider(email) {
10750
10758
  login_hint: email
10751
10759
  }).toString();
10752
10760
  console.log(`[oauth] Starting browser consent for ${email}`);
10753
- const code = await bridge.app.startOAuth(authUrl);
10761
+ const code = await bridge2.app.startOAuth(authUrl);
10754
10762
  const tokens = await exchangeCodeForTokens(code);
10755
10763
  const token = {
10756
10764
  access_token: tokens.access_token,
@@ -10765,11 +10773,11 @@ function createNativeTokenProvider(email) {
10765
10773
  async function registerDeviceInGDrive(tokenProvider2, folderId, accountIds) {
10766
10774
  try {
10767
10775
  const token = await tokenProvider2();
10768
- const bridge = window._nativeBridge;
10776
+ const bridge2 = window._nativeBridge;
10769
10777
  let deviceId = "android-unknown";
10770
- if (bridge?.app?.getAndroidId) {
10778
+ if (bridge2?.app?.getAndroidId) {
10771
10779
  try {
10772
- const androidId = await bridge.app.getAndroidId();
10780
+ const androidId = await bridge2.app.getAndroidId();
10773
10781
  deviceId = `android-${androidId.substring(0, 12)}`;
10774
10782
  } catch {
10775
10783
  deviceId = `android-${getDeviceId().substring(0, 8)}`;
@@ -11282,9 +11290,9 @@ function installBridge() {
11282
11290
  return { ok: true };
11283
11291
  },
11284
11292
  getDeviceAccounts: async () => {
11285
- const bridge = window._nativeBridge;
11286
- if (bridge?.app?.getDeviceAccounts) {
11287
- return bridge.app.getDeviceAccounts();
11293
+ const bridge2 = window._nativeBridge;
11294
+ if (bridge2?.app?.getDeviceAccounts) {
11295
+ return bridge2.app.getDeviceAccounts();
11288
11296
  }
11289
11297
  return [];
11290
11298
  },
@@ -11329,9 +11337,9 @@ function installBridge() {
11329
11337
  repairAccounts: async () => ({ ok: false, error: "Use desktop for repair" }),
11330
11338
  resetStore: () => resetStore(),
11331
11339
  resetAll: async () => {
11332
- const bridge = window._nativeBridge;
11333
- if (bridge?.app?.resetAll) {
11334
- await bridge.app.resetAll();
11340
+ const bridge2 = window._nativeBridge;
11341
+ if (bridge2?.app?.resetAll) {
11342
+ await bridge2.app.resetAll();
11335
11343
  } else {
11336
11344
  await resetStore();
11337
11345
  location.reload();