@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.
package/dist/datastore.db.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
|
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
|
|
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
package/src/datastore.db.ts
CHANGED
|
@@ -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
|
|
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
|
|
583
|
+
async saveBatch<ROW extends ObjectWithId>(
|
|
584
584
|
table: string,
|
|
585
585
|
rows: ROW[],
|
|
586
586
|
opt?: CommonDBSaveOptions<ROW> | undefined,
|
package/src/datastore.model.ts
CHANGED
|
@@ -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
|
|
119
|
+
export interface DatastoreDBSaveOptions<ROW extends ObjectWithId>
|
|
120
120
|
extends CommonDBSaveOptions<ROW> {}
|
|
121
121
|
|
|
122
122
|
export interface DatastoreStats {
|