@naturalcycles/datastore-lib 3.16.4 → 3.17.2
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/DatastoreStreamReadable.d.ts +3 -2
- package/dist/DatastoreStreamReadable.js +8 -11
- package/dist/datastore.db.d.ts +4 -2
- package/dist/datastore.db.js +14 -12
- package/dist/datastore.model.d.ts +5 -1
- package/dist/datastoreKeyValueDB.d.ts +1 -0
- package/dist/datastoreKeyValueDB.js +4 -0
- package/package.json +2 -2
- package/src/DatastoreStreamReadable.ts +8 -13
- package/src/datastore.db.ts +29 -12
- package/src/datastore.model.ts +6 -1
- package/src/datastoreKeyValueDB.ts +5 -0
- package/CHANGELOG.md +0 -581
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Readable } from 'stream';
|
|
3
3
|
import { Query } from '@google-cloud/datastore';
|
|
4
|
+
import { CommonLogger } from '@naturalcycles/js-lib';
|
|
4
5
|
import type { ReadableTyped } from '@naturalcycles/nodejs-lib';
|
|
5
6
|
import type { DatastoreDBStreamOptions } from './datastore.model';
|
|
6
7
|
export declare class DatastoreStreamReadable<T = any> extends Readable implements ReadableTyped<T> {
|
|
7
8
|
private q;
|
|
9
|
+
private logger;
|
|
8
10
|
private originalLimit;
|
|
9
11
|
private rowsRetrieved;
|
|
10
12
|
private endCursor?;
|
|
@@ -12,9 +14,8 @@ export declare class DatastoreStreamReadable<T = any> extends Readable implement
|
|
|
12
14
|
private done;
|
|
13
15
|
private lastQueryDone?;
|
|
14
16
|
private totalWait;
|
|
15
|
-
private log;
|
|
16
17
|
private opt;
|
|
17
|
-
constructor(q: Query, opt: DatastoreDBStreamOptions);
|
|
18
|
+
constructor(q: Query, opt: DatastoreDBStreamOptions, logger: CommonLogger);
|
|
18
19
|
private runNextQuery;
|
|
19
20
|
count: number;
|
|
20
21
|
_read(): void;
|
|
@@ -4,25 +4,22 @@ exports.DatastoreStreamReadable = void 0;
|
|
|
4
4
|
const stream_1 = require("stream");
|
|
5
5
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
6
6
|
class DatastoreStreamReadable extends stream_1.Readable {
|
|
7
|
-
constructor(q, opt) {
|
|
7
|
+
constructor(q, opt, logger) {
|
|
8
8
|
super({ objectMode: true });
|
|
9
9
|
this.q = q;
|
|
10
|
+
this.logger = logger;
|
|
10
11
|
this.rowsRetrieved = 0;
|
|
11
12
|
this.running = false;
|
|
12
13
|
this.done = false;
|
|
13
14
|
this.totalWait = 0;
|
|
14
|
-
// private log = (...args: any[]): void => console.log(...args)
|
|
15
|
-
this.log = console.log.bind(console);
|
|
16
15
|
this.count = 0; // use for debugging
|
|
17
16
|
this.opt = {
|
|
18
17
|
rssLimitMB: 1000,
|
|
19
18
|
batchSize: 1000,
|
|
20
19
|
...opt,
|
|
21
20
|
};
|
|
22
|
-
if (!opt.debug)
|
|
23
|
-
this.log = () => { };
|
|
24
21
|
this.originalLimit = q.limitVal;
|
|
25
|
-
|
|
22
|
+
logger.log(`!! using experimentalCursorStream !! batchSize: ${opt.batchSize}`);
|
|
26
23
|
}
|
|
27
24
|
async runNextQuery() {
|
|
28
25
|
if (this.done)
|
|
@@ -45,7 +42,7 @@ class DatastoreStreamReadable extends stream_1.Readable {
|
|
|
45
42
|
try {
|
|
46
43
|
const [rows, info] = await q.run();
|
|
47
44
|
this.rowsRetrieved += rows.length;
|
|
48
|
-
this.log(`got ${rows.length} rows, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${(0, js_lib_1._ms)(this.totalWait)}`, info.moreResults);
|
|
45
|
+
this.logger.log(`got ${rows.length} rows, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${(0, js_lib_1._ms)(this.totalWait)}`, info.moreResults);
|
|
49
46
|
this.endCursor = info.endCursor;
|
|
50
47
|
this.running = false; // ready to take more _reads
|
|
51
48
|
this.lastQueryDone = Date.now();
|
|
@@ -53,7 +50,7 @@ class DatastoreStreamReadable extends stream_1.Readable {
|
|
|
53
50
|
if (!info.endCursor ||
|
|
54
51
|
info.moreResults === 'NO_MORE_RESULTS' ||
|
|
55
52
|
(this.originalLimit && this.rowsRetrieved >= this.originalLimit)) {
|
|
56
|
-
this.log(`!!!! DONE! ${this.rowsRetrieved} rowsRetrieved, totalWait: ${(0, js_lib_1._ms)(this.totalWait)}`);
|
|
53
|
+
this.logger.log(`!!!! DONE! ${this.rowsRetrieved} rowsRetrieved, totalWait: ${(0, js_lib_1._ms)(this.totalWait)}`);
|
|
57
54
|
this.push(null);
|
|
58
55
|
this.done = true;
|
|
59
56
|
}
|
|
@@ -63,7 +60,7 @@ class DatastoreStreamReadable extends stream_1.Readable {
|
|
|
63
60
|
void this.runNextQuery();
|
|
64
61
|
}
|
|
65
62
|
else {
|
|
66
|
-
this.log(`rssLimitMB reached ${rssMB} > ${this.opt.rssLimitMB}, pausing stream`);
|
|
63
|
+
this.logger.log(`rssLimitMB reached ${rssMB} > ${this.opt.rssLimitMB}, pausing stream`);
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
}
|
|
@@ -76,10 +73,10 @@ class DatastoreStreamReadable extends stream_1.Readable {
|
|
|
76
73
|
// console.log(`_read called ${++this.count}, wasRunning: ${this.running}`) // debugging
|
|
77
74
|
this.count++;
|
|
78
75
|
if (this.running) {
|
|
79
|
-
this.log(`_read ${this.count}, wasRunning: true`);
|
|
76
|
+
this.logger.log(`_read ${this.count}, wasRunning: true`);
|
|
80
77
|
}
|
|
81
78
|
if (this.done) {
|
|
82
|
-
|
|
79
|
+
this.logger.warn(`!!! _read was called, but done==true`);
|
|
83
80
|
return;
|
|
84
81
|
}
|
|
85
82
|
if (!this.running) {
|
package/dist/datastore.db.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Datastore, Key, Query } from '@google-cloud/datastore';
|
|
2
2
|
import { BaseCommonDB, CommonDB, DBQuery, DBTransaction, RunQueryResult } from '@naturalcycles/db-lib';
|
|
3
|
-
import { ObjectWithId, JsonSchemaRootObject } from '@naturalcycles/js-lib';
|
|
3
|
+
import { ObjectWithId, JsonSchemaRootObject, CommonLogger } from '@naturalcycles/js-lib';
|
|
4
4
|
import { ReadableTyped } from '@naturalcycles/nodejs-lib';
|
|
5
5
|
import { DatastoreDBCfg, DatastoreDBOptions, DatastoreDBSaveOptions, DatastoreDBStreamOptions, DatastorePayload, DatastorePropertyStats, DatastoreStats } from './datastore.model';
|
|
6
6
|
/**
|
|
@@ -9,8 +9,10 @@ import { DatastoreDBCfg, DatastoreDBOptions, DatastoreDBSaveOptions, DatastoreDB
|
|
|
9
9
|
* https://cloud.google.com/datastore/docs/datastore-api-tutorial
|
|
10
10
|
*/
|
|
11
11
|
export declare class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
12
|
-
cfg: DatastoreDBCfg;
|
|
13
12
|
constructor(cfg?: DatastoreDBCfg);
|
|
13
|
+
cfg: DatastoreDBCfg & {
|
|
14
|
+
logger: CommonLogger;
|
|
15
|
+
};
|
|
14
16
|
private cachedDatastore?;
|
|
15
17
|
/**
|
|
16
18
|
* Datastore.KEY
|
package/dist/datastore.db.js
CHANGED
|
@@ -21,27 +21,27 @@ const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN'];
|
|
|
21
21
|
class DatastoreDB extends db_lib_1.BaseCommonDB {
|
|
22
22
|
constructor(cfg = {}) {
|
|
23
23
|
super();
|
|
24
|
-
this.cfg =
|
|
24
|
+
this.cfg = {
|
|
25
|
+
logger: console,
|
|
26
|
+
...cfg,
|
|
27
|
+
};
|
|
25
28
|
}
|
|
26
29
|
// @memo() // not used to be able to connect to many DBs in the same server instance
|
|
27
30
|
ds() {
|
|
31
|
+
var _a;
|
|
28
32
|
if (!this.cachedDatastore) {
|
|
29
|
-
|
|
30
|
-
throw new Error('DatastoreDB cannot be used in Test env, please use InMemoryDB');
|
|
31
|
-
}
|
|
33
|
+
(0, js_lib_1._assert)(process.env['APP_ENV'] !== 'test', 'DatastoreDB cannot be used in Test env, please use InMemoryDB');
|
|
32
34
|
// Lazy-loading
|
|
33
35
|
const datastoreLib = require('@google-cloud/datastore');
|
|
34
36
|
const DS = datastoreLib.Datastore;
|
|
35
|
-
this.cfg.projectId =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
process.env['GOOGLE_CLOUD_PROJECT'];
|
|
39
|
-
console.log(`DatastoreDB connected to ${(0, colors_1.boldWhite)(this.cfg.projectId)}`);
|
|
37
|
+
(_a = this.cfg).projectId || (_a.projectId = this.cfg.credentials?.project_id || process.env['GOOGLE_CLOUD_PROJECT']);
|
|
38
|
+
(0, js_lib_1._assert)(this.cfg.projectId, '"projectId" is not set for DatastoreDB');
|
|
39
|
+
this.cfg.logger.log(`DatastoreDB connected to ${(0, colors_1.boldWhite)(this.cfg.projectId)}`);
|
|
40
40
|
if (this.cfg.useLegacyGRPC) {
|
|
41
41
|
this.cfg.grpc = require('grpc');
|
|
42
42
|
}
|
|
43
43
|
if (this.cfg.grpc) {
|
|
44
|
-
|
|
44
|
+
this.cfg.logger.log('!!! DatastoreDB using custom grpc !!!');
|
|
45
45
|
}
|
|
46
46
|
this.cachedDatastore = new DS(this.cfg);
|
|
47
47
|
this.KEY = this.cachedDatastore.KEY;
|
|
@@ -95,7 +95,7 @@ class DatastoreDB extends db_lib_1.BaseCommonDB {
|
|
|
95
95
|
..._opt,
|
|
96
96
|
};
|
|
97
97
|
return (opt.experimentalCursorStream
|
|
98
|
-
? new DatastoreStreamReadable_1.DatastoreStreamReadable(q, opt)
|
|
98
|
+
? new DatastoreStreamReadable_1.DatastoreStreamReadable(q, opt, (0, js_lib_1.commonLoggerMinLevel)(this.cfg.logger, opt.debug ? 'log' : 'warn'))
|
|
99
99
|
: this.ds().runQueryStream(q)).pipe(new stream_1.Transform({
|
|
100
100
|
objectMode: true,
|
|
101
101
|
transform: (chunk, _enc, cb) => {
|
|
@@ -119,19 +119,21 @@ class DatastoreDB extends db_lib_1.BaseCommonDB {
|
|
|
119
119
|
// Here we retry the GOAWAY errors that are somewhat common for Datastore
|
|
120
120
|
// Currently only retrying them here in .saveBatch(), cause probably they're only thrown when saving
|
|
121
121
|
predicate: err => RETRY_ON.some(s => err?.message.includes(s)),
|
|
122
|
+
name: `DatastoreLib.saveBatch(${table})`,
|
|
122
123
|
maxAttempts: 5,
|
|
123
124
|
delay: 5000,
|
|
124
125
|
delayMultiplier: 2,
|
|
125
126
|
logFirstAttempt: false,
|
|
126
127
|
logFailures: true,
|
|
127
128
|
// logAll: true,
|
|
129
|
+
logger: this.cfg.logger,
|
|
128
130
|
});
|
|
129
131
|
try {
|
|
130
132
|
await (0, js_lib_1.pMap)((0, js_lib_1._chunk)(entities, MAX_ITEMS), async (batch) => await save(batch));
|
|
131
133
|
}
|
|
132
134
|
catch (err) {
|
|
133
135
|
// console.log(`datastore.save ${kind}`, { obj, entity })
|
|
134
|
-
|
|
136
|
+
this.cfg.logger.error(`error in DatastoreLib.saveBatch for ${table} (${rows.length} rows)`, err);
|
|
135
137
|
// don't throw, because datastore SDK makes it in separate thread, so exception will be unhandled otherwise
|
|
136
138
|
return await Promise.reject(err);
|
|
137
139
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DatastoreOptions, Key, Transaction } from '@google-cloud/datastore';
|
|
2
2
|
import { CommonDBOptions, CommonDBSaveOptions } from '@naturalcycles/db-lib';
|
|
3
|
-
import { AnyObjectWithId, ObjectWithId } from '@naturalcycles/js-lib';
|
|
3
|
+
import { AnyObjectWithId, CommonLogger, ObjectWithId } from '@naturalcycles/js-lib';
|
|
4
4
|
export interface DatastorePayload<T = any> {
|
|
5
5
|
key: Key;
|
|
6
6
|
data: T;
|
|
@@ -30,6 +30,10 @@ export interface DatastoreDBCfg extends DatastoreOptions {
|
|
|
30
30
|
* e.g you can globally enable `experimentalCursorStream` here, set the batchSize, etc.
|
|
31
31
|
*/
|
|
32
32
|
streamOptions?: DatastoreDBStreamOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Default to `console`
|
|
35
|
+
*/
|
|
36
|
+
logger?: CommonLogger;
|
|
33
37
|
}
|
|
34
38
|
export interface DatastoreCredentials {
|
|
35
39
|
type?: string;
|
|
@@ -17,4 +17,5 @@ export declare class DatastoreKeyValueDB implements CommonKeyValueDB {
|
|
|
17
17
|
streamIds(table: string, limit?: number): ReadableTyped<string>;
|
|
18
18
|
streamValues(table: string, limit?: number): ReadableTyped<Buffer>;
|
|
19
19
|
streamEntries(table: string, limit?: number): ReadableTyped<KeyValueDBTuple>;
|
|
20
|
+
count(_table: string): Promise<number>;
|
|
20
21
|
}
|
|
@@ -47,5 +47,9 @@ class DatastoreKeyValueDB {
|
|
|
47
47
|
errorMode: js_lib_1.ErrorMode.SUPPRESS, // cause .pipe() cannot propagate errors
|
|
48
48
|
}));
|
|
49
49
|
}
|
|
50
|
+
async count(_table) {
|
|
51
|
+
this.db.cfg.logger.warn(`DatastoreKeyValueDB.count is not supported`);
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
exports.DatastoreKeyValueDB = DatastoreKeyValueDB;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/datastore-lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.2",
|
|
4
4
|
"description": "Opinionated library to work with Google Datastore",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "husky install"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"main": "dist/index.js",
|
|
32
32
|
"types": "dist/index.d.ts",
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
34
|
+
"node": ">=14.15.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'stream'
|
|
2
2
|
import { Query } from '@google-cloud/datastore'
|
|
3
|
-
import { _ms } from '@naturalcycles/js-lib'
|
|
3
|
+
import { _ms, CommonLogger } from '@naturalcycles/js-lib'
|
|
4
4
|
import type { ReadableTyped } from '@naturalcycles/nodejs-lib'
|
|
5
5
|
import type { DatastoreDBStreamOptions } from './datastore.model'
|
|
6
6
|
|
|
@@ -13,12 +13,9 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
13
13
|
private lastQueryDone?: number
|
|
14
14
|
private totalWait = 0
|
|
15
15
|
|
|
16
|
-
// private log = (...args: any[]): void => console.log(...args)
|
|
17
|
-
private log = console.log.bind(console)
|
|
18
|
-
|
|
19
16
|
private opt: DatastoreDBStreamOptions & { batchSize: number }
|
|
20
17
|
|
|
21
|
-
constructor(private q: Query, opt: DatastoreDBStreamOptions) {
|
|
18
|
+
constructor(private q: Query, opt: DatastoreDBStreamOptions, private logger: CommonLogger) {
|
|
22
19
|
super({ objectMode: true })
|
|
23
20
|
|
|
24
21
|
this.opt = {
|
|
@@ -27,11 +24,9 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
27
24
|
...opt,
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
if (!opt.debug) this.log = () => {}
|
|
31
|
-
|
|
32
27
|
this.originalLimit = q.limitVal
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
logger.log(`!! using experimentalCursorStream !! batchSize: ${opt.batchSize}`)
|
|
35
30
|
}
|
|
36
31
|
|
|
37
32
|
private async runNextQuery(): Promise<void> {
|
|
@@ -61,7 +56,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
61
56
|
const [rows, info] = await q.run()
|
|
62
57
|
|
|
63
58
|
this.rowsRetrieved += rows.length
|
|
64
|
-
this.log(
|
|
59
|
+
this.logger.log(
|
|
65
60
|
`got ${rows.length} rows, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(
|
|
66
61
|
this.totalWait,
|
|
67
62
|
)}`,
|
|
@@ -79,7 +74,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
79
74
|
info.moreResults === 'NO_MORE_RESULTS' ||
|
|
80
75
|
(this.originalLimit && this.rowsRetrieved >= this.originalLimit)
|
|
81
76
|
) {
|
|
82
|
-
this.log(
|
|
77
|
+
this.logger.log(
|
|
83
78
|
`!!!! DONE! ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(this.totalWait)}`,
|
|
84
79
|
)
|
|
85
80
|
this.push(null)
|
|
@@ -90,7 +85,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
90
85
|
if (rssMB <= this.opt.rssLimitMB) {
|
|
91
86
|
void this.runNextQuery()
|
|
92
87
|
} else {
|
|
93
|
-
this.log(`rssLimitMB reached ${rssMB} > ${this.opt.rssLimitMB}, pausing stream`)
|
|
88
|
+
this.logger.log(`rssLimitMB reached ${rssMB} > ${this.opt.rssLimitMB}, pausing stream`)
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
91
|
} catch (err) {
|
|
@@ -105,11 +100,11 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
105
100
|
// console.log(`_read called ${++this.count}, wasRunning: ${this.running}`) // debugging
|
|
106
101
|
this.count++
|
|
107
102
|
if (this.running) {
|
|
108
|
-
this.log(`_read ${this.count}, wasRunning: true`)
|
|
103
|
+
this.logger.log(`_read ${this.count}, wasRunning: true`)
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
if (this.done) {
|
|
112
|
-
|
|
107
|
+
this.logger.warn(`!!! _read was called, but done==true`)
|
|
113
108
|
return
|
|
114
109
|
}
|
|
115
110
|
|
package/src/datastore.db.ts
CHANGED
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
_chunk,
|
|
23
23
|
_omit,
|
|
24
24
|
JsonSchemaRootObject,
|
|
25
|
+
CommonLogger,
|
|
26
|
+
commonLoggerMinLevel,
|
|
25
27
|
} from '@naturalcycles/js-lib'
|
|
26
28
|
import { ReadableTyped } from '@naturalcycles/nodejs-lib'
|
|
27
29
|
import { boldWhite } from '@naturalcycles/nodejs-lib/dist/colors'
|
|
@@ -51,10 +53,16 @@ const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN']
|
|
|
51
53
|
* https://cloud.google.com/datastore/docs/datastore-api-tutorial
|
|
52
54
|
*/
|
|
53
55
|
export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
54
|
-
constructor(
|
|
56
|
+
constructor(cfg: DatastoreDBCfg = {}) {
|
|
55
57
|
super()
|
|
58
|
+
this.cfg = {
|
|
59
|
+
logger: console,
|
|
60
|
+
...cfg,
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
public cfg: DatastoreDBCfg & { logger: CommonLogger }
|
|
65
|
+
|
|
58
66
|
private cachedDatastore?: Datastore
|
|
59
67
|
|
|
60
68
|
/**
|
|
@@ -65,26 +73,26 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
|
65
73
|
// @memo() // not used to be able to connect to many DBs in the same server instance
|
|
66
74
|
ds(): Datastore {
|
|
67
75
|
if (!this.cachedDatastore) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
_assert(
|
|
77
|
+
process.env['APP_ENV'] !== 'test',
|
|
78
|
+
'DatastoreDB cannot be used in Test env, please use InMemoryDB',
|
|
79
|
+
)
|
|
71
80
|
|
|
72
81
|
// Lazy-loading
|
|
73
82
|
const datastoreLib = require('@google-cloud/datastore')
|
|
74
83
|
const DS = datastoreLib.Datastore as typeof Datastore
|
|
75
|
-
this.cfg.projectId
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
process.env['GOOGLE_CLOUD_PROJECT']!
|
|
84
|
+
this.cfg.projectId ||= this.cfg.credentials?.project_id || process.env['GOOGLE_CLOUD_PROJECT']
|
|
85
|
+
|
|
86
|
+
_assert(this.cfg.projectId, '"projectId" is not set for DatastoreDB')
|
|
79
87
|
|
|
80
|
-
|
|
88
|
+
this.cfg.logger.log(`DatastoreDB connected to ${boldWhite(this.cfg.projectId)}`)
|
|
81
89
|
|
|
82
90
|
if (this.cfg.useLegacyGRPC) {
|
|
83
91
|
this.cfg.grpc = require('grpc')
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
if (this.cfg.grpc) {
|
|
87
|
-
|
|
95
|
+
this.cfg.logger.log('!!! DatastoreDB using custom grpc !!!')
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
this.cachedDatastore = new DS(this.cfg)
|
|
@@ -167,7 +175,11 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
|
167
175
|
|
|
168
176
|
return (
|
|
169
177
|
opt.experimentalCursorStream
|
|
170
|
-
? new DatastoreStreamReadable(
|
|
178
|
+
? new DatastoreStreamReadable(
|
|
179
|
+
q,
|
|
180
|
+
opt,
|
|
181
|
+
commonLoggerMinLevel(this.cfg.logger, opt.debug ? 'log' : 'warn'),
|
|
182
|
+
)
|
|
171
183
|
: this.ds().runQueryStream(q)
|
|
172
184
|
).pipe(
|
|
173
185
|
new Transform({
|
|
@@ -209,12 +221,14 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
|
209
221
|
// Here we retry the GOAWAY errors that are somewhat common for Datastore
|
|
210
222
|
// Currently only retrying them here in .saveBatch(), cause probably they're only thrown when saving
|
|
211
223
|
predicate: err => RETRY_ON.some(s => (err as Error)?.message.includes(s)),
|
|
224
|
+
name: `DatastoreLib.saveBatch(${table})`,
|
|
212
225
|
maxAttempts: 5,
|
|
213
226
|
delay: 5000,
|
|
214
227
|
delayMultiplier: 2,
|
|
215
228
|
logFirstAttempt: false,
|
|
216
229
|
logFailures: true,
|
|
217
230
|
// logAll: true,
|
|
231
|
+
logger: this.cfg.logger,
|
|
218
232
|
},
|
|
219
233
|
)
|
|
220
234
|
|
|
@@ -222,7 +236,10 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
|
222
236
|
await pMap(_chunk(entities, MAX_ITEMS), async batch => await save(batch))
|
|
223
237
|
} catch (err) {
|
|
224
238
|
// console.log(`datastore.save ${kind}`, { obj, entity })
|
|
225
|
-
|
|
239
|
+
this.cfg.logger.error(
|
|
240
|
+
`error in DatastoreLib.saveBatch for ${table} (${rows.length} rows)`,
|
|
241
|
+
err,
|
|
242
|
+
)
|
|
226
243
|
// don't throw, because datastore SDK makes it in separate thread, so exception will be unhandled otherwise
|
|
227
244
|
return await Promise.reject(err)
|
|
228
245
|
}
|
package/src/datastore.model.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DatastoreOptions, Key, Transaction } from '@google-cloud/datastore'
|
|
2
2
|
import { CommonDBOptions, CommonDBSaveOptions } from '@naturalcycles/db-lib'
|
|
3
|
-
import { AnyObjectWithId, ObjectWithId } from '@naturalcycles/js-lib'
|
|
3
|
+
import { AnyObjectWithId, CommonLogger, ObjectWithId } from '@naturalcycles/js-lib'
|
|
4
4
|
|
|
5
5
|
export interface DatastorePayload<T = any> {
|
|
6
6
|
key: Key
|
|
@@ -36,6 +36,11 @@ export interface DatastoreDBCfg extends DatastoreOptions {
|
|
|
36
36
|
* e.g you can globally enable `experimentalCursorStream` here, set the batchSize, etc.
|
|
37
37
|
*/
|
|
38
38
|
streamOptions?: DatastoreDBStreamOptions
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Default to `console`
|
|
42
|
+
*/
|
|
43
|
+
logger?: CommonLogger
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
export interface DatastoreCredentials {
|
package/CHANGELOG.md
DELETED
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
## [3.16.4](https://github.com/NaturalCycles/datastore-lib/compare/v3.16.3...v3.16.4) (2021-10-19)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* adapt to db-lib ([04cc097](https://github.com/NaturalCycles/datastore-lib/commit/04cc097f8c9894e803d15d3ef4c73ca3150855c5))
|
|
7
|
-
|
|
8
|
-
## [3.16.3](https://github.com/NaturalCycles/datastore-lib/compare/v3.16.2...v3.16.3) (2021-10-17)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
* types ([8ee6857](https://github.com/NaturalCycles/datastore-lib/commit/8ee6857ed14739413c7df0e9b7395fb6c9b6b85d))
|
|
14
|
-
|
|
15
|
-
## [3.16.2](https://github.com/NaturalCycles/datastore-lib/compare/v3.16.1...v3.16.2) (2021-10-17)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Bug Fixes
|
|
19
|
-
|
|
20
|
-
* adapt to latest db-lib with typed queries ([21d31ea](https://github.com/NaturalCycles/datastore-lib/commit/21d31ea7343ca0b2590950c067f6ce472dc82501))
|
|
21
|
-
|
|
22
|
-
## [3.16.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.16.0...v3.16.1) (2021-10-07)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Bug Fixes
|
|
26
|
-
|
|
27
|
-
* logging ([961b485](https://github.com/NaturalCycles/datastore-lib/commit/961b485a0ff1c0268bfc491e9f7a608a1b2b77da))
|
|
28
|
-
|
|
29
|
-
# [3.16.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.15.0...v3.16.0) (2021-10-07)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Features
|
|
33
|
-
|
|
34
|
-
* allow to set streamOptions in DatastoreCfg ([c9fb5f0](https://github.com/NaturalCycles/datastore-lib/commit/c9fb5f08760f113d3b563ce80579df189d06b7b1))
|
|
35
|
-
|
|
36
|
-
# [3.15.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.14.1...v3.15.0) (2021-10-07)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Features
|
|
40
|
-
|
|
41
|
-
* experimentalCursorStream mode to fix backpressure ([419f8e1](https://github.com/NaturalCycles/datastore-lib/commit/419f8e16ccb9722771a01b90001ae19f2a7a8595))
|
|
42
|
-
|
|
43
|
-
## [3.14.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.14.0...v3.14.1) (2021-10-04)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Bug Fixes
|
|
47
|
-
|
|
48
|
-
* adapt to db-lib ([78f7a81](https://github.com/NaturalCycles/datastore-lib/commit/78f7a81b3fc2bf263e9164a6478fb2d0c0ea9869))
|
|
49
|
-
|
|
50
|
-
# [3.14.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.13.0...v3.14.0) (2021-10-04)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### Features
|
|
54
|
-
|
|
55
|
-
* support $id=`${table}.schema.json` ([afe235d](https://github.com/NaturalCycles/datastore-lib/commit/afe235d2c1e556a34391f241517f87f6c52f57de))
|
|
56
|
-
|
|
57
|
-
# [3.13.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.12.2...v3.13.0) (2021-10-01)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Features
|
|
61
|
-
|
|
62
|
-
* adapt to db-lib (return jsonSchema instead of CommonSchema) ([8065764](https://github.com/NaturalCycles/datastore-lib/commit/8065764e2f93ee981c1bbb5b98b50a2a965fb0c7))
|
|
63
|
-
|
|
64
|
-
## [3.12.2](https://github.com/NaturalCycles/datastore-lib/compare/v3.12.1...v3.12.2) (2021-08-24)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Bug Fixes
|
|
68
|
-
|
|
69
|
-
* deps, adapt KeyValueDB implementation ([6ef0538](https://github.com/NaturalCycles/datastore-lib/commit/6ef0538873f9e02b1b7fc5e380b6be10ea38e436))
|
|
70
|
-
|
|
71
|
-
## [3.12.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.12.0...v3.12.1) (2021-08-05)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### Bug Fixes
|
|
75
|
-
|
|
76
|
-
* throw explicit error on missing `id` when doing saveBatch ([1a2f29e](https://github.com/NaturalCycles/datastore-lib/commit/1a2f29e57f20d95004d2cd6a79f9f9eafe26cf56))
|
|
77
|
-
|
|
78
|
-
# [3.12.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.11.1...v3.12.0) (2021-07-04)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
### Features
|
|
82
|
-
|
|
83
|
-
* DatastoreKeyValueDB ([d03ac8c](https://github.com/NaturalCycles/datastore-lib/commit/d03ac8c6a8febba6b5b43fe373433f15ac2659d6))
|
|
84
|
-
|
|
85
|
-
## [3.11.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.11.0...v3.11.1) (2021-05-22)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
### Bug Fixes
|
|
89
|
-
|
|
90
|
-
* adopt eslint ([123f16c](https://github.com/NaturalCycles/datastore-lib/commit/123f16cb913e0df0f45c5c3266af01463c467217))
|
|
91
|
-
|
|
92
|
-
# [3.11.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.10.0...v3.11.0) (2021-03-18)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Features
|
|
96
|
-
|
|
97
|
-
* also retry on UNKNOWN errors ([a916386](https://github.com/NaturalCycles/datastore-lib/commit/a9163866e3d87963c0c2b389079e05af4c6d56a6))
|
|
98
|
-
|
|
99
|
-
# [3.10.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.9.2...v3.10.0) (2021-03-01)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
### Features
|
|
103
|
-
|
|
104
|
-
* also retry on UNAVAILABLE ([fb4bfdc](https://github.com/NaturalCycles/datastore-lib/commit/fb4bfdc57224f9753ef40e1db682615f172c19d7))
|
|
105
|
-
|
|
106
|
-
## [3.9.2](https://github.com/NaturalCycles/datastore-lib/compare/v3.9.1...v3.9.2) (2021-02-23)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
### Bug Fixes
|
|
110
|
-
|
|
111
|
-
* tune pRetry options for .saveBatch, GOAWAY test passes now! ([cac1ece](https://github.com/NaturalCycles/datastore-lib/commit/cac1ecec29afaf3bb38e382d481b09a2977c1eea))
|
|
112
|
-
|
|
113
|
-
## [3.9.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.9.0...v3.9.1) (2021-02-23)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Bug Fixes
|
|
117
|
-
|
|
118
|
-
* unnecessary await in .saveBatch ([12b1b75](https://github.com/NaturalCycles/datastore-lib/commit/12b1b7528383fbf9406d91515008c51d4a08a807))
|
|
119
|
-
|
|
120
|
-
# [3.9.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.8.6...v3.9.0) (2021-02-23)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
### Bug Fixes
|
|
124
|
-
|
|
125
|
-
* modernize ([2a4eac5](https://github.com/NaturalCycles/datastore-lib/commit/2a4eac5e521a6dc7da073e0f0d8df17df776a03d))
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
### Features
|
|
129
|
-
|
|
130
|
-
* retry on GOAWAY in .saveBatch (experimental) ([e381ed5](https://github.com/NaturalCycles/datastore-lib/commit/e381ed58d2999b86f2035479bfbc9b759a07aa05))
|
|
131
|
-
|
|
132
|
-
## [3.8.6](https://github.com/NaturalCycles/datastore-lib/compare/v3.8.5...v3.8.6) (2020-11-10)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
### Bug Fixes
|
|
136
|
-
|
|
137
|
-
* use Key type from Datastore that is properly exported now ([931e978](https://github.com/NaturalCycles/datastore-lib/commit/931e97861f5075971fc3d1a5fa971f64197fefcc))
|
|
138
|
-
|
|
139
|
-
## [3.8.5](https://github.com/NaturalCycles/datastore-lib/compare/v3.8.4...v3.8.5) (2020-11-05)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
### Bug Fixes
|
|
143
|
-
|
|
144
|
-
* adapt to db-lib ([f0e6da9](https://github.com/NaturalCycles/datastore-lib/commit/f0e6da9b93111caec0a0178c936a16dbeacf04e2))
|
|
145
|
-
|
|
146
|
-
## [3.8.4](https://github.com/NaturalCycles/datastore-lib/compare/v3.8.3...v3.8.4) (2020-10-25)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
### Bug Fixes
|
|
150
|
-
|
|
151
|
-
* adapt to recent db-lib (map '==' operator to '=') ([8e36412](https://github.com/NaturalCycles/datastore-lib/commit/8e36412abbc15ed6ec0132124fa811b8393de06f))
|
|
152
|
-
|
|
153
|
-
## [3.8.3](https://github.com/NaturalCycles/datastore-lib/compare/v3.8.2...v3.8.3) (2020-10-12)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
### Bug Fixes
|
|
157
|
-
|
|
158
|
-
* support db-lib@8 ([f46a5bd](https://github.com/NaturalCycles/datastore-lib/commit/f46a5bdc14dbff7c062292a45f93829b1d4c4cb9))
|
|
159
|
-
|
|
160
|
-
## [3.8.2](https://github.com/NaturalCycles/datastore-lib/compare/v3.8.1...v3.8.2) (2020-09-21)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
### Bug Fixes
|
|
164
|
-
|
|
165
|
-
* deps ([a751b4c](https://github.com/NaturalCycles/datastore-lib/commit/a751b4c74472c2159c584de04eaf086d22a0d558))
|
|
166
|
-
|
|
167
|
-
## [3.8.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.8.0...v3.8.1) (2020-08-17)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
### Bug Fixes
|
|
171
|
-
|
|
172
|
-
* deps ([7200862](https://github.com/NaturalCycles/datastore-lib/commit/7200862a52e07dd86d01bbea351db36b2d5fce92))
|
|
173
|
-
|
|
174
|
-
# [3.8.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.7.2...v3.8.0) (2020-08-14)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
### Features
|
|
178
|
-
|
|
179
|
-
* allow > 500 items in save/delete by chunking the array ([c552d3a](https://github.com/NaturalCycles/datastore-lib/commit/c552d3a5ffd217690342ade090eaf2ba35855c3d))
|
|
180
|
-
|
|
181
|
-
## [3.7.2](https://github.com/NaturalCycles/datastore-lib/compare/v3.7.1...v3.7.2) (2020-08-10)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
### Bug Fixes
|
|
185
|
-
|
|
186
|
-
* deps ([633825d](https://github.com/NaturalCycles/datastore-lib/commit/633825d0a6be01c7f0f9755a06e08aa2281fa5dd))
|
|
187
|
-
|
|
188
|
-
## [3.7.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.7.0...v3.7.1) (2020-06-03)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
### Bug Fixes
|
|
192
|
-
|
|
193
|
-
* deps ([9c8e024](https://github.com/NaturalCycles/datastore-lib/commit/9c8e02497a5d924edcdac779826b9a16c44a201d))
|
|
194
|
-
|
|
195
|
-
# [3.7.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.6.1...v3.7.0) (2020-05-31)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
### Features
|
|
199
|
-
|
|
200
|
-
* adapt to db-lib@7 ([2d34fb4](https://github.com/NaturalCycles/datastore-lib/commit/2d34fb4a170b1d92c0fd23cfdd18ac3521b4a50b))
|
|
201
|
-
|
|
202
|
-
## [3.6.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.6.0...v3.6.1) (2020-05-24)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
### Bug Fixes
|
|
206
|
-
|
|
207
|
-
* adapt to CommonDB ([abafb97](https://github.com/NaturalCycles/datastore-lib/commit/abafb9739455b0466a09920c07e23e30253f8220))
|
|
208
|
-
|
|
209
|
-
# [3.6.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.7...v3.6.0) (2020-05-24)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
### Features
|
|
213
|
-
|
|
214
|
-
* CommonDB@6 (transactions) ([f44f8a4](https://github.com/NaturalCycles/datastore-lib/commit/f44f8a4e2aa7b8f405f944490aabc978c9117527))
|
|
215
|
-
|
|
216
|
-
## [3.5.7](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.6...v3.5.7) (2020-04-25)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
### Bug Fixes
|
|
220
|
-
|
|
221
|
-
* deps ([7614462](https://github.com/NaturalCycles/datastore-lib/commit/7614462b87942eaf5bb390f67daf9a3f63add477))
|
|
222
|
-
|
|
223
|
-
## [3.5.6](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.5...v3.5.6) (2020-04-23)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
### Bug Fixes
|
|
227
|
-
|
|
228
|
-
* deps ([44c147f](https://github.com/NaturalCycles/datastore-lib/commit/44c147fc166e183e7ae9490e8be0bd6ed3c566b6))
|
|
229
|
-
|
|
230
|
-
## [3.5.5](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.4...v3.5.5) (2020-04-19)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
### Bug Fixes
|
|
234
|
-
|
|
235
|
-
* deps ([081b037](https://github.com/NaturalCycles/datastore-lib/commit/081b03700a2f4f286d471a3d5c30682743d68e1e))
|
|
236
|
-
|
|
237
|
-
## [3.5.4](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.3...v3.5.4) (2020-04-11)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
### Bug Fixes
|
|
241
|
-
|
|
242
|
-
* support projection queries without 'id' field ([699191a](https://github.com/NaturalCycles/datastore-lib/commit/699191a103be78c22b07d4df97af3068d2e05d9d))
|
|
243
|
-
|
|
244
|
-
## [3.5.3](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.2...v3.5.3) (2020-04-01)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
### Bug Fixes
|
|
248
|
-
|
|
249
|
-
* ping method, getByIds sorting ([16f5d15](https://github.com/NaturalCycles/datastore-lib/commit/16f5d15c6d283757fcf950c23654669c8e2c4746))
|
|
250
|
-
|
|
251
|
-
## [3.5.2](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.1...v3.5.2) (2020-03-31)
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
### Bug Fixes
|
|
255
|
-
|
|
256
|
-
* deps ([25b7e93](https://github.com/NaturalCycles/datastore-lib/commit/25b7e93d60abb9a858db1f3ca23c89211d62fdb3))
|
|
257
|
-
|
|
258
|
-
## [3.5.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.5.0...v3.5.1) (2020-03-31)
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
### Bug Fixes
|
|
262
|
-
|
|
263
|
-
* deps ([1cdd926](https://github.com/NaturalCycles/datastore-lib/commit/1cdd926d7afc0461b4a6056f9d115cfda40d3311))
|
|
264
|
-
|
|
265
|
-
# [3.5.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.4.1...v3.5.0) (2020-03-22)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
### Features
|
|
269
|
-
|
|
270
|
-
* bump nodejs-lib (joi 17) ([ba337ac](https://github.com/NaturalCycles/datastore-lib/commit/ba337ac61ac2a291cd544c4dfa68fd7abc124ba9))
|
|
271
|
-
|
|
272
|
-
## [3.4.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.4.0...v3.4.1) (2020-03-16)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
### Bug Fixes
|
|
276
|
-
|
|
277
|
-
* deps ([bdf3fe1](https://github.com/NaturalCycles/datastore-lib/commit/bdf3fe1bfeeec9649de552293bccb8c3bafb0f4e))
|
|
278
|
-
|
|
279
|
-
# [3.4.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.3.1...v3.4.0) (2020-03-01)
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
### Features
|
|
283
|
-
|
|
284
|
-
* deps ([8c8c1f2](https://github.com/NaturalCycles/datastore-lib/commit/8c8c1f2abd4b67a26ab3f775cf41f290018d99f6))
|
|
285
|
-
|
|
286
|
-
## [3.3.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.3.0...v3.3.1) (2019-11-19)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
### Bug Fixes
|
|
290
|
-
|
|
291
|
-
* support @google-cloud/datastore@5 ([2ffd5d1](https://github.com/NaturalCycles/datastore-lib/commit/2ffd5d10f50d743c037e5bbab7e8cfcddf3f824c))
|
|
292
|
-
|
|
293
|
-
# [3.3.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.2.5...v3.3.0) (2019-11-09)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
### Features
|
|
297
|
-
|
|
298
|
-
* getDBAdapter(), changed DatastoreDBCfg format ([0794bc2](https://github.com/NaturalCycles/datastore-lib/commit/0794bc2abf4bb25897ca73ec798dd2a3a09de513))
|
|
299
|
-
|
|
300
|
-
## [3.2.5](https://github.com/NaturalCycles/datastore-lib/compare/v3.2.4...v3.2.5) (2019-11-09)
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
### Bug Fixes
|
|
304
|
-
|
|
305
|
-
* **schema:** order id first ([3899334](https://github.com/NaturalCycles/datastore-lib/commit/389933485f2450ed58175edd7d257664b4b5af17))
|
|
306
|
-
|
|
307
|
-
## [3.2.4](https://github.com/NaturalCycles/datastore-lib/compare/v3.2.3...v3.2.4) (2019-11-09)
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
### Bug Fixes
|
|
311
|
-
|
|
312
|
-
* exclude dot-properties from schema ([8865867](https://github.com/NaturalCycles/datastore-lib/commit/8865867b94b77188d6c38fda1ca08292083d09d7))
|
|
313
|
-
|
|
314
|
-
## [3.2.3](https://github.com/NaturalCycles/datastore-lib/compare/v3.2.2...v3.2.3) (2019-11-09)
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
### Bug Fixes
|
|
318
|
-
|
|
319
|
-
* createTable ([c509e75](https://github.com/NaturalCycles/datastore-lib/commit/c509e758de4acac3e2416857f166107a434505b6))
|
|
320
|
-
|
|
321
|
-
## [3.2.2](https://github.com/NaturalCycles/datastore-lib/compare/v3.2.1...v3.2.2) (2019-11-08)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
### Bug Fixes
|
|
325
|
-
|
|
326
|
-
* getTableSchema was missing `id` ([e080b28](https://github.com/NaturalCycles/datastore-lib/commit/e080b281635f182290312219fc7655288e05a682))
|
|
327
|
-
|
|
328
|
-
## [3.2.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.2.0...v3.2.1) (2019-11-08)
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
### Bug Fixes
|
|
332
|
-
|
|
333
|
-
* getTableSchema type merging ([3c41101](https://github.com/NaturalCycles/datastore-lib/commit/3c41101bece3f65499c19a4b8e9884dab6f5ec1e))
|
|
334
|
-
|
|
335
|
-
# [3.2.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.1.0...v3.2.0) (2019-11-07)
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
### Features
|
|
339
|
-
|
|
340
|
-
* implement getTables(), getTableSchema() ([1e5aa6b](https://github.com/NaturalCycles/datastore-lib/commit/1e5aa6b435217075c503aab243c140bef4af4feb))
|
|
341
|
-
|
|
342
|
-
# [3.1.0](https://github.com/NaturalCycles/datastore-lib/compare/v3.0.1...v3.1.0) (2019-11-04)
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
### Features
|
|
346
|
-
|
|
347
|
-
* allow passing custom grpc object to constructor ([a9e08e3](https://github.com/NaturalCycles/datastore-lib/commit/a9e08e3f382bd0ce15ae11a6d1878072bf497acf)), closes [/github.com/googleapis/nodejs-pubsub/issues/770#issuecomment-541226361](https://github.com//github.com/googleapis/nodejs-pubsub/issues/770/issues/issuecomment-541226361)
|
|
348
|
-
|
|
349
|
-
## [3.0.1](https://github.com/NaturalCycles/datastore-lib/compare/v3.0.0...v3.0.1) (2019-11-04)
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
### Bug Fixes
|
|
353
|
-
|
|
354
|
-
* provide empty getTable() implementation ([1b3658b](https://github.com/NaturalCycles/datastore-lib/commit/1b3658bcf45f8cf10e07b274dab7023cf499d579))
|
|
355
|
-
|
|
356
|
-
# [3.0.0](https://github.com/NaturalCycles/datastore-lib/compare/v2.0.2...v3.0.0) (2019-11-02)
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
### Features
|
|
360
|
-
|
|
361
|
-
* adapt to db-lib@3 ([aa78fd1](https://github.com/NaturalCycles/datastore-lib/commit/aa78fd1240e9de1fef8ce52e4ec0c7f16ecfc114))
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
### BREAKING CHANGES
|
|
365
|
-
|
|
366
|
-
* ^^^
|
|
367
|
-
|
|
368
|
-
## [2.0.2](https://github.com/NaturalCycles/datastore-lib/compare/v2.0.1...v2.0.2) (2019-10-20)
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
### Bug Fixes
|
|
372
|
-
|
|
373
|
-
* adapt to db-lib ([22949ca](https://github.com/NaturalCycles/datastore-lib/commit/22949ca))
|
|
374
|
-
|
|
375
|
-
## [2.0.1](https://github.com/NaturalCycles/datastore-lib/compare/v2.0.0...v2.0.1) (2019-10-19)
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
### Bug Fixes
|
|
379
|
-
|
|
380
|
-
* use Readable ([0935cb0](https://github.com/NaturalCycles/datastore-lib/commit/0935cb0))
|
|
381
|
-
|
|
382
|
-
# [2.0.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.12.2...v2.0.0) (2019-10-19)
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
### Features
|
|
386
|
-
|
|
387
|
-
* implement CommonDB 2.0 ([dfe0992](https://github.com/NaturalCycles/datastore-lib/commit/dfe0992))
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
### BREAKING CHANGES
|
|
391
|
-
|
|
392
|
-
* ^^^
|
|
393
|
-
|
|
394
|
-
## [1.12.2](https://github.com/NaturalCycles/datastore-lib/compare/v1.12.1...v1.12.2) (2019-09-21)
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
### Bug Fixes
|
|
398
|
-
|
|
399
|
-
* adapt db-lib ([c12a6df](https://github.com/NaturalCycles/datastore-lib/commit/c12a6df))
|
|
400
|
-
|
|
401
|
-
## [1.12.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.12.0...v1.12.1) (2019-09-21)
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
### Bug Fixes
|
|
405
|
-
|
|
406
|
-
* adapt db-lib ([7b316e1](https://github.com/NaturalCycles/datastore-lib/commit/7b316e1))
|
|
407
|
-
|
|
408
|
-
# [1.12.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.11.1...v1.12.0) (2019-09-19)
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
### Features
|
|
412
|
-
|
|
413
|
-
* adapt to db-lib ([2b38927](https://github.com/NaturalCycles/datastore-lib/commit/2b38927))
|
|
414
|
-
|
|
415
|
-
## [1.11.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.11.0...v1.11.1) (2019-09-19)
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
### Bug Fixes
|
|
419
|
-
|
|
420
|
-
* make runQueryStream public ([f8f18ed](https://github.com/NaturalCycles/datastore-lib/commit/f8f18ed))
|
|
421
|
-
|
|
422
|
-
# [1.11.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.10.1...v1.11.0) (2019-09-19)
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
### Bug Fixes
|
|
426
|
-
|
|
427
|
-
* return await ([ce1b4d4](https://github.com/NaturalCycles/datastore-lib/commit/ce1b4d4))
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
### Features
|
|
431
|
-
|
|
432
|
-
* adopt to CommonDB RunQueryResult ([188c935](https://github.com/NaturalCycles/datastore-lib/commit/188c935))
|
|
433
|
-
* move getStats to Dao ([2851c4f](https://github.com/NaturalCycles/datastore-lib/commit/2851c4f))
|
|
434
|
-
* use db-lib ([f6826cd](https://github.com/NaturalCycles/datastore-lib/commit/f6826cd))
|
|
435
|
-
|
|
436
|
-
## [1.10.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.10.0...v1.10.1) (2019-07-29)
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
### Bug Fixes
|
|
440
|
-
|
|
441
|
-
* allow empty datastoreOptions (for GAE env) ([2ca8464](https://github.com/NaturalCycles/datastore-lib/commit/2ca8464))
|
|
442
|
-
|
|
443
|
-
# [1.10.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.9.2...v1.10.0) (2019-07-16)
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
### Features
|
|
447
|
-
|
|
448
|
-
* deps ([fb42b87](https://github.com/NaturalCycles/datastore-lib/commit/fb42b87))
|
|
449
|
-
|
|
450
|
-
## [1.9.2](https://github.com/NaturalCycles/datastore-lib/compare/v1.9.1...v1.9.2) (2019-07-04)
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
### Bug Fixes
|
|
454
|
-
|
|
455
|
-
* anonymize only DBM ([9897ea6](https://github.com/NaturalCycles/datastore-lib/commit/9897ea6))
|
|
456
|
-
|
|
457
|
-
## [1.9.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.9.0...v1.9.1) (2019-07-03)
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
### Bug Fixes
|
|
461
|
-
|
|
462
|
-
* anonymize signature ([4ed12bd](https://github.com/NaturalCycles/datastore-lib/commit/4ed12bd))
|
|
463
|
-
|
|
464
|
-
# [1.9.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.8.0...v1.9.0) (2019-07-03)
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
### Features
|
|
468
|
-
|
|
469
|
-
* allow to anonymize all ModelTypes ([a87480e](https://github.com/NaturalCycles/datastore-lib/commit/a87480e))
|
|
470
|
-
|
|
471
|
-
# [1.8.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.7.0...v1.8.0) (2019-07-03)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
### Features
|
|
475
|
-
|
|
476
|
-
* dao anonymization hook ([3160ca0](https://github.com/NaturalCycles/datastore-lib/commit/3160ca0))
|
|
477
|
-
|
|
478
|
-
# [1.7.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.6.1...v1.7.0) (2019-06-25)
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
### Features
|
|
482
|
-
|
|
483
|
-
* implements runQueryStream in MemoryService ([0ececa4](https://github.com/NaturalCycles/datastore-lib/commit/0ececa4))
|
|
484
|
-
|
|
485
|
-
## [1.6.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.6.0...v1.6.1) (2019-06-20)
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
### Bug Fixes
|
|
489
|
-
|
|
490
|
-
* allow null to be used in filters as negation ([93b971b](https://github.com/NaturalCycles/datastore-lib/commit/93b971b))
|
|
491
|
-
|
|
492
|
-
# [1.6.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.5.1...v1.6.0) (2019-06-17)
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
### Features
|
|
496
|
-
|
|
497
|
-
* adds support for multiple filters ([dbfaa83](https://github.com/NaturalCycles/datastore-lib/commit/dbfaa83))
|
|
498
|
-
|
|
499
|
-
## [1.5.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.5.0...v1.5.1) (2019-05-27)
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
### Bug Fixes
|
|
503
|
-
|
|
504
|
-
* console.log ([4a29620](https://github.com/NaturalCycles/datastore-lib/commit/4a29620))
|
|
505
|
-
|
|
506
|
-
# [1.5.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.4.0...v1.5.0) (2019-05-27)
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
### Features
|
|
510
|
-
|
|
511
|
-
* MemoryService to support streamQuery, select, limit ([9ac0610](https://github.com/NaturalCycles/datastore-lib/commit/9ac0610))
|
|
512
|
-
|
|
513
|
-
# [1.4.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.3.0...v1.4.0) (2019-05-19)
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
### Features
|
|
517
|
-
|
|
518
|
-
* bump deps, adopt ([68ab3fd](https://github.com/NaturalCycles/datastore-lib/commit/68ab3fd))
|
|
519
|
-
|
|
520
|
-
# [1.3.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.2.1...v1.3.0) (2019-05-02)
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
### Features
|
|
524
|
-
|
|
525
|
-
* update deps ([8ec7a82](https://github.com/NaturalCycles/datastore-lib/commit/8ec7a82))
|
|
526
|
-
|
|
527
|
-
## [1.2.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.2.0...v1.2.1) (2019-04-25)
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
### Bug Fixes
|
|
531
|
-
|
|
532
|
-
* remove redundant try/catch that had a bug with window.name ([1e3cf48](https://github.com/NaturalCycles/datastore-lib/commit/1e3cf48))
|
|
533
|
-
|
|
534
|
-
# [1.2.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.1.1...v1.2.0) (2019-04-22)
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
### Features
|
|
538
|
-
|
|
539
|
-
* upgrade ([7e6ea9f](https://github.com/NaturalCycles/datastore-lib/commit/7e6ea9f))
|
|
540
|
-
|
|
541
|
-
## [1.1.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.1.0...v1.1.1) (2019-03-23)
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
### Bug Fixes
|
|
545
|
-
|
|
546
|
-
* export DBRelation ([bde321b](https://github.com/NaturalCycles/datastore-lib/commit/bde321b))
|
|
547
|
-
|
|
548
|
-
# [1.1.0](https://github.com/NaturalCycles/datastore-lib/compare/v1.0.3...v1.1.0) (2019-03-23)
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
### Features
|
|
552
|
-
|
|
553
|
-
* DBRelation ([23bd5ce](https://github.com/NaturalCycles/datastore-lib/commit/23bd5ce))
|
|
554
|
-
|
|
555
|
-
## [1.0.3](https://github.com/NaturalCycles/datastore-lib/compare/v1.0.2...v1.0.3) (2019-03-09)
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
### Bug Fixes
|
|
559
|
-
|
|
560
|
-
* upgrade js-lib, nodejs-lib ([cc92227](https://github.com/NaturalCycles/datastore-lib/commit/cc92227))
|
|
561
|
-
|
|
562
|
-
## [1.0.2](https://github.com/NaturalCycles/datastore-lib/compare/v1.0.1...v1.0.2) (2019-03-08)
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
### Bug Fixes
|
|
566
|
-
|
|
567
|
-
* types ([b0afeaa](https://github.com/NaturalCycles/datastore-lib/commit/b0afeaa))
|
|
568
|
-
|
|
569
|
-
## [1.0.1](https://github.com/NaturalCycles/datastore-lib/compare/v1.0.0...v1.0.1) (2019-03-08)
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
### Bug Fixes
|
|
573
|
-
|
|
574
|
-
* export types and src ([d64878c](https://github.com/NaturalCycles/datastore-lib/commit/d64878c))
|
|
575
|
-
|
|
576
|
-
# 1.0.0 (2019-03-08)
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
### Features
|
|
580
|
-
|
|
581
|
-
* initial version ([0b61708](https://github.com/NaturalCycles/datastore-lib/commit/0b61708))
|