@naturalcycles/datastore-lib 3.32.1 → 3.32.3

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.
@@ -1,7 +1,7 @@
1
1
  import { Transaction } from '@google-cloud/datastore';
2
2
  import type { Datastore, Key, Query } from '@google-cloud/datastore';
3
3
  import { BaseCommonDB, CommonDB, CommonDBOptions, CommonDBSaveOptions, CommonDBSupport, DBQuery, DBTransaction, DBTransactionFn, RunQueryResult, CommonDBTransactionOptions } from '@naturalcycles/db-lib';
4
- import { ObjectWithId, JsonSchemaObject, JsonSchemaRootObject, CommonLogger } from '@naturalcycles/js-lib';
4
+ import { JsonSchemaObject, JsonSchemaRootObject, CommonLogger, ObjectWithId } from '@naturalcycles/js-lib';
5
5
  import { ReadableTyped } from '@naturalcycles/nodejs-lib';
6
6
  import { DatastoreDBCfg, DatastoreDBOptions, DatastoreDBSaveOptions, DatastoreDBStreamOptions, DatastorePayload, DatastorePropertyStats, DatastoreStats } from './datastore.model';
7
7
  /**
@@ -31,7 +31,7 @@ export declare class DatastoreDB extends BaseCommonDB implements CommonDB {
31
31
  /**
32
32
  * Returns saved entities with generated id/updated/created (non-mutating!)
33
33
  */
34
- saveBatch<ROW extends Partial<ObjectWithId>>(table: string, rows: ROW[], opt?: DatastoreDBSaveOptions<ROW>): Promise<void>;
34
+ saveBatch<ROW extends ObjectWithId>(table: string, rows: ROW[], opt?: DatastoreDBSaveOptions<ROW>): Promise<void>;
35
35
  deleteByQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: DatastoreDBOptions): Promise<number>;
36
36
  /**
37
37
  * Limitation: Datastore's delete returns void, so we always return all ids here as "deleted"
@@ -67,6 +67,6 @@ export declare class DatastoreDBTransaction implements DBTransaction {
67
67
  constructor(db: DatastoreDB, tx: Transaction);
68
68
  rollback(): Promise<void>;
69
69
  getByIds<ROW extends ObjectWithId>(table: string, ids: string[], opt?: CommonDBOptions | undefined): Promise<ROW[]>;
70
- saveBatch<ROW extends Partial<ObjectWithId>>(table: string, rows: ROW[], opt?: CommonDBSaveOptions<ROW> | undefined): Promise<void>;
70
+ saveBatch<ROW extends ObjectWithId>(table: string, rows: ROW[], opt?: CommonDBSaveOptions<ROW> | undefined): Promise<void>;
71
71
  deleteByIds(table: string, ids: string[], opt?: CommonDBOptions | undefined): Promise<number>;
72
72
  }
@@ -101,7 +101,7 @@ export interface DatastoreDBStreamOptions extends DatastoreDBOptions {
101
101
  }
102
102
  export interface DatastoreDBOptions extends CommonDBOptions {
103
103
  }
104
- export interface DatastoreDBSaveOptions<ROW extends Partial<ObjectWithId> = any> extends CommonDBSaveOptions<ROW> {
104
+ export interface DatastoreDBSaveOptions<ROW extends ObjectWithId> extends CommonDBSaveOptions<ROW> {
105
105
  }
106
106
  export interface DatastoreStats {
107
107
  composite_index_count: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/datastore-lib",
3
- "version": "3.32.1",
3
+ "version": "3.32.3",
4
4
  "description": "Opinionated library to work with Google Datastore",
5
5
  "scripts": {
6
6
  "prepare": "husky install"
@@ -16,7 +16,6 @@ import {
16
16
  CommonDBTransactionOptions,
17
17
  } from '@naturalcycles/db-lib'
18
18
  import {
19
- ObjectWithId,
20
19
  JsonSchemaAny,
21
20
  JsonSchemaBoolean,
22
21
  JsonSchemaNull,
@@ -34,6 +33,7 @@ import {
34
33
  pRetryFn,
35
34
  pRetry,
36
35
  PRetryOptions,
36
+ ObjectWithId,
37
37
  } from '@naturalcycles/js-lib'
38
38
  import { ReadableTyped, boldWhite } from '@naturalcycles/nodejs-lib'
39
39
  import { DatastoreStreamReadable } from './DatastoreStreamReadable'
@@ -287,7 +287,7 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
287
287
  /**
288
288
  * Returns saved entities with generated id/updated/created (non-mutating!)
289
289
  */
290
- override async saveBatch<ROW extends Partial<ObjectWithId>>(
290
+ override async saveBatch<ROW extends ObjectWithId>(
291
291
  table: string,
292
292
  rows: ROW[],
293
293
  opt: DatastoreDBSaveOptions<ROW> = {},
@@ -580,7 +580,7 @@ export class DatastoreDBTransaction implements DBTransaction {
580
580
  return await this.db.getByIds(table, ids, { ...opt, tx: this })
581
581
  }
582
582
 
583
- async saveBatch<ROW extends Partial<ObjectWithId>>(
583
+ async saveBatch<ROW extends ObjectWithId>(
584
584
  table: string,
585
585
  rows: ROW[],
586
586
  opt?: CommonDBSaveOptions<ROW> | undefined,
@@ -116,7 +116,7 @@ export interface DatastoreDBStreamOptions extends DatastoreDBOptions {
116
116
 
117
117
  export interface DatastoreDBOptions extends CommonDBOptions {}
118
118
 
119
- export interface DatastoreDBSaveOptions<ROW extends Partial<ObjectWithId> = any>
119
+ export interface DatastoreDBSaveOptions<ROW extends ObjectWithId>
120
120
  extends CommonDBSaveOptions<ROW> {}
121
121
 
122
122
  export interface DatastoreStats {