@mtcute/web 0.17.0 → 0.18.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 (58) hide show
  1. package/client.cjs +39 -0
  2. package/client.d.cts +23 -0
  3. package/client.d.ts +1 -8
  4. package/client.js +34 -0
  5. package/common-internals-web/logging.cjs +48 -0
  6. package/common-internals-web/logging.d.cts +2 -0
  7. package/common-internals-web/logging.js +43 -0
  8. package/crypto.cjs +84 -0
  9. package/crypto.d.cts +21 -0
  10. package/crypto.js +79 -0
  11. package/exit-hook.cjs +28 -0
  12. package/exit-hook.d.cts +1 -0
  13. package/exit-hook.js +23 -0
  14. package/idb/driver.cjs +123 -0
  15. package/idb/driver.d.cts +18 -0
  16. package/idb/driver.js +118 -0
  17. package/idb/index.cjs +29 -0
  18. package/idb/index.d.cts +22 -0
  19. package/idb/index.js +24 -0
  20. package/idb/repository/auth-keys.cjs +70 -0
  21. package/idb/repository/auth-keys.d.cts +14 -0
  22. package/idb/repository/auth-keys.js +65 -0
  23. package/idb/repository/kv.cjs +36 -0
  24. package/idb/repository/kv.d.cts +11 -0
  25. package/idb/repository/kv.js +31 -0
  26. package/idb/repository/peers.cjs +47 -0
  27. package/idb/repository/peers.d.cts +12 -0
  28. package/idb/repository/peers.js +42 -0
  29. package/idb/repository/ref-messages.cjs +62 -0
  30. package/idb/repository/ref-messages.d.cts +12 -0
  31. package/idb/repository/ref-messages.js +57 -0
  32. package/idb/utils.cjs +21 -0
  33. package/idb/utils.d.cts +2 -0
  34. package/idb/utils.js +16 -0
  35. package/index.cjs +18 -953
  36. package/index.js +7 -943
  37. package/methods.cjs +2 -2
  38. package/package.json +12 -11
  39. package/platform.cjs +41 -0
  40. package/platform.d.cts +11 -0
  41. package/platform.d.ts +1 -11
  42. package/platform.js +36 -0
  43. package/utils.cjs +2 -2
  44. package/wasm.cjs +38 -0
  45. package/wasm.d.cts +2 -0
  46. package/wasm.js +33 -0
  47. package/websocket.cjs +50 -0
  48. package/websocket.d.cts +18 -0
  49. package/websocket.d.ts +6 -34
  50. package/websocket.js +45 -0
  51. package/worker.cjs +116 -0
  52. package/worker.d.cts +12 -0
  53. package/worker.d.ts +5 -3
  54. package/worker.js +111 -0
  55. package/common-internals-web/base64.d.ts +0 -2
  56. package/common-internals-web/hex.d.ts +0 -2
  57. package/common-internals-web/utf8.d.ts +0 -3
  58. /package/{websocket.test.d.ts → idb/idb.test.d.cts} +0 -0
package/idb/utils.cjs ADDED
@@ -0,0 +1,21 @@
1
+ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
2
+ globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
3
+ console.warn("[mtcute-workspace] CommonJS support is deprecated and will be removed in 0.20.0. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
4
+ console.warn("[mtcute-workspace] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
5
+ }
6
+ "use strict";
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ function txToPromise(tx) {
9
+ return new Promise((resolve, reject) => {
10
+ tx.oncomplete = () => resolve();
11
+ tx.onerror = () => reject(tx.error);
12
+ });
13
+ }
14
+ function reqToPromise(req) {
15
+ return new Promise((resolve, reject) => {
16
+ req.onsuccess = () => resolve(req.result);
17
+ req.onerror = () => reject(req.error);
18
+ });
19
+ }
20
+ exports.reqToPromise = reqToPromise;
21
+ exports.txToPromise = txToPromise;
@@ -0,0 +1,2 @@
1
+ export declare function txToPromise(tx: IDBTransaction): Promise<void>;
2
+ export declare function reqToPromise<T>(req: IDBRequest<T>): Promise<T>;
package/idb/utils.js ADDED
@@ -0,0 +1,16 @@
1
+ function txToPromise(tx) {
2
+ return new Promise((resolve, reject) => {
3
+ tx.oncomplete = () => resolve();
4
+ tx.onerror = () => reject(tx.error);
5
+ });
6
+ }
7
+ function reqToPromise(req) {
8
+ return new Promise((resolve, reject) => {
9
+ req.onsuccess = () => resolve(req.result);
10
+ req.onerror = () => reject(req.error);
11
+ });
12
+ }
13
+ export {
14
+ reqToPromise,
15
+ txToPromise
16
+ };