@naturalcycles/firestore-lib 2.20.0 → 2.21.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.
@@ -10,17 +10,17 @@ export declare class FirestoreDB extends BaseCommonDB implements CommonDB {
10
10
  logger: CommonLogger;
11
11
  };
12
12
  support: CommonDBSupport;
13
- getByIds<ROW extends ObjectWithId>(table: string, ids: string[], opt?: FirestoreDBReadOptions): Promise<ROW[]>;
13
+ getByIds<ROW extends ObjectWithId>(table: string, ids: readonly string[], opt?: FirestoreDBReadOptions): Promise<ROW[]>;
14
14
  multiGet<ROW extends ObjectWithId>(map: StringMap<string[]>, opt?: CommonDBReadOptions): Promise<StringMap<ROW[]>>;
15
15
  runQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: FirestoreDBReadOptions): Promise<RunQueryResult<ROW>>;
16
16
  runFirestoreQuery<ROW extends ObjectWithId>(q: Query, opt?: FirestoreDBReadOptions): Promise<ROW[]>;
17
17
  runQueryCount<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: FirestoreDBReadOptions): Promise<number>;
18
18
  streamQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt_?: FirestoreDBStreamOptions): Pipeline<ROW>;
19
- saveBatch<ROW extends ObjectWithId>(table: string, rows: ROW[], opt?: FirestoreDBSaveOptions<ROW>): Promise<void>;
19
+ saveBatch<ROW extends ObjectWithId>(table: string, rows: readonly ROW[], opt?: FirestoreDBSaveOptions<ROW>): Promise<void>;
20
20
  multiSave<ROW extends ObjectWithId>(map: StringMap<ROW[]>, opt?: FirestoreDBSaveOptions<ROW>): Promise<void>;
21
21
  patchById<ROW extends ObjectWithId>(table: string, id: string, patch: Partial<ROW>, opt?: FirestoreDBOptions): Promise<void>;
22
22
  deleteByQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: FirestoreDBOptions): Promise<number>;
23
- deleteByIds(table: string, ids: string[], opt?: FirestoreDBOptions): Promise<number>;
23
+ deleteByIds(table: string, ids: readonly string[], opt?: FirestoreDBOptions): Promise<number>;
24
24
  multiDelete(map: StringMap<string[]>, opt?: FirestoreDBOptions): Promise<number>;
25
25
  querySnapshotToArray<T = any>(qs: QuerySnapshot): T[];
26
26
  runInTransaction(fn: DBTransactionFn, opt?: CommonDBTransactionOptions): Promise<void>;
@@ -40,9 +40,9 @@ export declare class FirestoreDBTransaction implements DBTransaction {
40
40
  constructor(db: FirestoreDB, tx: Transaction);
41
41
  commit(): Promise<void>;
42
42
  rollback(): Promise<void>;
43
- getByIds<ROW extends ObjectWithId>(table: string, ids: string[], opt?: CommonDBOptions): Promise<ROW[]>;
44
- saveBatch<ROW extends ObjectWithId>(table: string, rows: ROW[], opt?: CommonDBSaveOptions<ROW>): Promise<void>;
45
- deleteByIds(table: string, ids: string[], opt?: CommonDBOptions): Promise<number>;
43
+ getByIds<ROW extends ObjectWithId>(table: string, ids: readonly string[], opt?: CommonDBOptions): Promise<ROW[]>;
44
+ saveBatch<ROW extends ObjectWithId>(table: string, rows: readonly ROW[], opt?: CommonDBSaveOptions<ROW>): Promise<void>;
45
+ deleteByIds(table: string, ids: readonly string[], opt?: CommonDBOptions): Promise<number>;
46
46
  }
47
47
  export interface FirestoreDBCfg {
48
48
  firestore: Firestore;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "tslib": "^2"
10
10
  },
11
11
  "devDependencies": {
12
- "@naturalcycles/dev-lib": "20.66.0",
12
+ "@naturalcycles/dev-lib": "20.68.0",
13
13
  "@types/node": "^26",
14
14
  "typescript": "^7",
15
15
  "firebase-admin": "^14"
@@ -38,7 +38,7 @@
38
38
  "engines": {
39
39
  "node": ">=26.12.1"
40
40
  },
41
- "version": "2.20.0",
41
+ "version": "2.21.0",
42
42
  "description": "Firestore implementation of CommonDB interface",
43
43
  "author": "Natural Cycles Team",
44
44
  "license": "MIT",
@@ -59,7 +59,7 @@ export class FirestoreDB extends BaseCommonDB implements CommonDB {
59
59
  // GET
60
60
  override async getByIds<ROW extends ObjectWithId>(
61
61
  table: string,
62
- ids: string[],
62
+ ids: readonly string[],
63
63
  opt: FirestoreDBReadOptions = {},
64
64
  ): Promise<ROW[]> {
65
65
  if (!ids.length) return []
@@ -218,7 +218,7 @@ export class FirestoreDB extends BaseCommonDB implements CommonDB {
218
218
  // SAVE
219
219
  override async saveBatch<ROW extends ObjectWithId>(
220
220
  table: string,
221
- rows: ROW[],
221
+ rows: readonly ROW[],
222
222
  opt: FirestoreDBSaveOptions<ROW> = {},
223
223
  ): Promise<void> {
224
224
  const { firestore } = this.cfg
@@ -371,7 +371,7 @@ export class FirestoreDB extends BaseCommonDB implements CommonDB {
371
371
 
372
372
  override async deleteByIds(
373
373
  table: string,
374
- ids: string[],
374
+ ids: readonly string[],
375
375
  opt: FirestoreDBOptions = {},
376
376
  ): Promise<number> {
377
377
  const { firestore } = this.cfg
@@ -524,7 +524,7 @@ export class FirestoreDBTransaction implements DBTransaction {
524
524
 
525
525
  async getByIds<ROW extends ObjectWithId>(
526
526
  table: string,
527
- ids: string[],
527
+ ids: readonly string[],
528
528
  opt?: CommonDBOptions,
529
529
  ): Promise<ROW[]> {
530
530
  return await this.db.getByIds(table, ids, { ...opt, tx: this })
@@ -532,13 +532,13 @@ export class FirestoreDBTransaction implements DBTransaction {
532
532
 
533
533
  async saveBatch<ROW extends ObjectWithId>(
534
534
  table: string,
535
- rows: ROW[],
535
+ rows: readonly ROW[],
536
536
  opt?: CommonDBSaveOptions<ROW>,
537
537
  ): Promise<void> {
538
538
  await this.db.saveBatch(table, rows, { ...opt, tx: this })
539
539
  }
540
540
 
541
- async deleteByIds(table: string, ids: string[], opt?: CommonDBOptions): Promise<number> {
541
+ async deleteByIds(table: string, ids: readonly string[], opt?: CommonDBOptions): Promise<number> {
542
542
  return await this.db.deleteByIds(table, ids, { ...opt, tx: this })
543
543
  }
544
544
  }