@mtcute/web 0.16.9 → 0.16.13

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.
@@ -5,7 +5,7 @@ export declare class IdbPeersRepository implements IPeersRepository {
5
5
  constructor(_driver: IdbStorageDriver);
6
6
  store(peer: IPeersRepository.PeerInfo): void;
7
7
  private os;
8
- getById(id: number): Promise<IPeersRepository.PeerInfo | null>;
8
+ getById(id: number, allowMin: boolean): Promise<IPeersRepository.PeerInfo | null>;
9
9
  getByUsername(username: string): Promise<IPeersRepository.PeerInfo | null>;
10
10
  getByPhone(phone: string): Promise<IPeersRepository.PeerInfo | null>;
11
11
  deleteAll(): Promise<void>;
package/index.cjs CHANGED
@@ -343,19 +343,23 @@ class IdbPeersRepository {
343
343
  os(mode) {
344
344
  return this._driver.db.transaction(TABLE$1, mode).objectStore(TABLE$1);
345
345
  }
346
- async getById(id) {
346
+ async getById(id, allowMin) {
347
347
  const it = await reqToPromise(this.os().get(id));
348
- return it ?? null;
348
+ if (!it) return null;
349
+ if (it.isMin && !allowMin) return null;
350
+ return it;
349
351
  }
350
352
  async getByUsername(username) {
351
353
  const it = await reqToPromise(
352
354
  this.os().index("by_username").get(username)
353
355
  );
354
- return it ?? null;
356
+ if (!it || it.isMin) return null;
357
+ return it;
355
358
  }
356
359
  async getByPhone(phone) {
357
360
  const it = await reqToPromise(this.os().index("by_phone").get(phone));
358
- return it ?? null;
361
+ if (!it || it.isMin) return null;
362
+ return it;
359
363
  }
360
364
  deleteAll() {
361
365
  return reqToPromise(this.os("readwrite").clear());
package/index.js CHANGED
@@ -337,19 +337,23 @@ class IdbPeersRepository {
337
337
  os(mode) {
338
338
  return this._driver.db.transaction(TABLE$1, mode).objectStore(TABLE$1);
339
339
  }
340
- async getById(id) {
340
+ async getById(id, allowMin) {
341
341
  const it = await reqToPromise(this.os().get(id));
342
- return it ?? null;
342
+ if (!it) return null;
343
+ if (it.isMin && !allowMin) return null;
344
+ return it;
343
345
  }
344
346
  async getByUsername(username) {
345
347
  const it = await reqToPromise(
346
348
  this.os().index("by_username").get(username)
347
349
  );
348
- return it ?? null;
350
+ if (!it || it.isMin) return null;
351
+ return it;
349
352
  }
350
353
  async getByPhone(phone) {
351
354
  const it = await reqToPromise(this.os().index("by_phone").get(phone));
352
- return it ?? null;
355
+ if (!it || it.isMin) return null;
356
+ return it;
353
357
  }
354
358
  deleteAll() {
355
359
  return reqToPromise(this.os("readwrite").clear());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtcute/web",
3
3
  "type": "module",
4
- "version": "0.16.9",
4
+ "version": "0.16.13",
5
5
  "description": "Meta-package for the web platform",
6
6
  "author": "alina sireneva <alina@tei.su>",
7
7
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "scripts": {},
42
42
  "dependencies": {
43
- "@mtcute/core": "^0.16.9",
44
- "@mtcute/wasm": "^0.16.9",
43
+ "@mtcute/core": "^0.16.13",
44
+ "@mtcute/wasm": "^0.16.11",
45
45
  "events": "3.2.0"
46
46
  },
47
47
  "denoJson": {