@naturalcycles/datastore-lib 4.18.2 → 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
|
|