@naturalcycles/datastore-lib 4.18.1 → 4.18.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.js
CHANGED
|
@@ -503,11 +503,14 @@ export class DatastoreDB extends BaseCommonDB {
|
|
|
503
503
|
getRunQueryOptions(opt) {
|
|
504
504
|
if (!opt.readAt)
|
|
505
505
|
return {};
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
506
|
+
// Datastore expects UnixTimestamp in milliseconds
|
|
507
|
+
// Datastore requires the timestamp to be rounded to the whole minutes
|
|
508
|
+
const readTime = _round(opt.readAt, 60) * 1000;
|
|
509
|
+
if (readTime >= Date.now() - 1000) {
|
|
510
|
+
// To avoid the error of: The requested 'read_time' cannot be in the future
|
|
511
|
+
return {};
|
|
512
|
+
}
|
|
513
|
+
return { readTime };
|
|
511
514
|
}
|
|
512
515
|
}
|
|
513
516
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/datastore-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.18.
|
|
4
|
+
"version": "4.18.3",
|
|
5
5
|
"description": "Opinionated library to work with Google Datastore, implements CommonDB",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@google-cloud/datastore": "^10",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@naturalcycles/nodejs-lib": "^15"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/node": "^
|
|
14
|
-
"@naturalcycles/dev-lib": "
|
|
13
|
+
"@types/node": "^25",
|
|
14
|
+
"@naturalcycles/dev-lib": "18.4.2"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js"
|
package/src/datastore.db.ts
CHANGED
|
@@ -684,11 +684,15 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
|
684
684
|
private getRunQueryOptions(opt: DatastoreDBReadOptions): RunQueryOptions {
|
|
685
685
|
if (!opt.readAt) return {}
|
|
686
686
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
687
|
+
// Datastore expects UnixTimestamp in milliseconds
|
|
688
|
+
// Datastore requires the timestamp to be rounded to the whole minutes
|
|
689
|
+
const readTime = _round(opt.readAt, 60) * 1000
|
|
690
|
+
if (readTime >= Date.now() - 1000) {
|
|
691
|
+
// To avoid the error of: The requested 'read_time' cannot be in the future
|
|
692
|
+
return {}
|
|
691
693
|
}
|
|
694
|
+
|
|
695
|
+
return { readTime }
|
|
692
696
|
}
|
|
693
697
|
}
|
|
694
698
|
|
package/src/datastore.model.ts
CHANGED
|
@@ -113,8 +113,9 @@ export interface DatastoreDBOptions extends CommonDBOptions {}
|
|
|
113
113
|
|
|
114
114
|
export interface DatastoreDBReadOptions extends CommonDBReadOptions {}
|
|
115
115
|
|
|
116
|
-
export interface DatastoreDBSaveOptions<
|
|
117
|
-
extends
|
|
116
|
+
export interface DatastoreDBSaveOptions<
|
|
117
|
+
ROW extends ObjectWithId,
|
|
118
|
+
> extends CommonDBSaveOptions<ROW> {}
|
|
118
119
|
|
|
119
120
|
export interface DatastoreStats {
|
|
120
121
|
composite_index_count: number
|