@google-cloud/spanner 6.16.0 → 7.0.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/nodejs-spanner?activeTab=versions
6
6
 
7
+ ## [7.0.0](https://github.com/googleapis/nodejs-spanner/compare/v6.16.0...v7.0.0) (2023-08-30)
8
+
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+
12
+ * upgrade to Node 14 ([#1890](https://github.com/googleapis/nodejs-spanner/issues/1890))
13
+
14
+ ### Bug Fixes
15
+
16
+ * Idwaiter with multiple requests ([#1910](https://github.com/googleapis/nodejs-spanner/issues/1910)) ([83dd1f8](https://github.com/googleapis/nodejs-spanner/commit/83dd1f8201d07898bd3ddff9e339dfbcef7d7ace))
17
+
18
+
19
+ ### Miscellaneous Chores
20
+
21
+ * Upgrade to Node 14 ([#1890](https://github.com/googleapis/nodejs-spanner/issues/1890)) ([0024772](https://github.com/googleapis/nodejs-spanner/commit/0024772b750de404cd44771e320fe89cd430f064))
22
+
7
23
  ## [6.16.0](https://github.com/googleapis/nodejs-spanner/compare/v6.15.0...v6.16.0) (2023-08-07)
8
24
 
9
25
 
package/README.md CHANGED
@@ -193,7 +193,7 @@ also contains samples.
193
193
 
194
194
  ## Supported Node.js Versions
195
195
 
196
- Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
196
+ Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule).
197
197
  Libraries are compatible with all current _active_ and _maintenance_ versions of
198
198
  Node.js.
199
199
  If you are using an end-of-life version of Node.js, we recommend that you update
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /// <reference types="long" />
17
16
  /// <reference types="node" />
18
17
  /// <reference types="node" />
19
18
  import { PreciseDate } from '@google-cloud/precise-date';
19
+ import Long = require('long');
20
20
  import { EventEmitter } from 'events';
21
21
  import { grpc, CallOptions } from 'google-gax';
22
22
  import { common as p } from 'protobufjs';
@@ -82,7 +82,7 @@ export interface ReadRequest extends RequestOptions {
82
82
  keys?: string[] | string[][];
83
83
  ranges?: KeyRange[];
84
84
  keySet?: spannerClient.spanner.v1.IKeySet | null;
85
- limit?: number | Long | null;
85
+ limit?: number | Long | string | null;
86
86
  resumeToken?: Uint8Array | null;
87
87
  partitionToken?: Uint8Array | null;
88
88
  requestOptions?: Omit<IRequestOptions, 'transactionTag'>;
@@ -182,7 +182,7 @@ export type CommitCallback = NormalCallback<spannerClient.spanner.v1.ICommitResp
182
182
  export declare class Snapshot extends EventEmitter {
183
183
  protected _options: spannerClient.spanner.v1.ITransactionOptions;
184
184
  protected _seqno: number;
185
- protected _idWaiter: Readable;
185
+ protected _waitingRequests: Array<() => void>;
186
186
  protected _inlineBeginStarted: any;
187
187
  protected _useInRunner: boolean;
188
188
  id?: Uint8Array | string;
@@ -857,6 +857,7 @@ export declare class Snapshot extends EventEmitter {
857
857
  * @private
858
858
  */
859
859
  private _wrapWithIdWaiter;
860
+ _releaseWaitingRequests(): void;
860
861
  /**
861
862
  * Gets the Spanner object
862
863
  *
@@ -142,9 +142,7 @@ class Snapshot extends events_1.EventEmitter {
142
142
  this.resourceHeader_ = {
143
143
  [common_1.CLOUD_RESOURCE_HEADER]: this.session.parent.formattedName_,
144
144
  };
145
- this._idWaiter = new stream_1.Readable({
146
- read() { },
147
- });
145
+ this._waitingRequests = [];
148
146
  this._inlineBeginStarted = false;
149
147
  }
150
148
  begin(gaxOptionsOrCallback, cb) {
@@ -793,7 +791,7 @@ class Snapshot extends events_1.EventEmitter {
793
791
  this.readTimestampProto = readTimestamp;
794
792
  this.readTimestamp = new precise_date_1.PreciseDate(readTimestamp);
795
793
  }
796
- this._idWaiter.emit('notify');
794
+ this._releaseWaitingRequests();
797
795
  }
798
796
  /**
799
797
  * Wrap `makeRequest` function with the lock to make sure the inline begin
@@ -810,9 +808,24 @@ class Snapshot extends events_1.EventEmitter {
810
808
  this._inlineBeginStarted = true;
811
809
  return makeRequest;
812
810
  }
813
- return (resumeToken) => this._idWaiter.once('notify', () => makeRequest(resumeToken)
814
- .on('data', chunk => this._idWaiter.emit('data', chunk))
815
- .once('end', () => this._idWaiter.emit('end')));
811
+ // Queue subsequent requests.
812
+ return (resumeToken) => {
813
+ const streamProxy = new stream_1.Readable({
814
+ read() { },
815
+ });
816
+ this._waitingRequests.push(() => {
817
+ makeRequest(resumeToken)
818
+ .on('data', chunk => streamProxy.emit('data', chunk))
819
+ .on('end', () => streamProxy.emit('end'));
820
+ });
821
+ return streamProxy;
822
+ };
823
+ }
824
+ _releaseWaitingRequests() {
825
+ while (this._waitingRequests.length > 0) {
826
+ const request = this._waitingRequests.shift();
827
+ request === null || request === void 0 ? void 0 : request();
828
+ }
816
829
  }
817
830
  /**
818
831
  * Gets the Spanner object
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@google-cloud/spanner",
3
3
  "description": "Cloud Spanner Client Library for Node.js",
4
- "version": "6.16.0",
4
+ "version": "7.0.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Google Inc.",
7
7
  "engines": {
8
- "node": ">=12.0.0"
8
+ "node": ">=14.0.0"
9
9
  },
10
10
  "repository": "googleapis/nodejs-spanner",
11
11
  "main": "./build/src/index.js",
@@ -33,7 +33,7 @@
33
33
  "samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
34
34
  "system-test": "mocha build/system-test --timeout 1600000",
35
35
  "cleanup": "mocha scripts/cleanup.js --timeout 30000",
36
- "test": "c8 mocha build/test build/test/common",
36
+ "test": "mocha build/test build/test/common",
37
37
  "ycsb": "node ./benchmark/ycsb.js run -P ./benchmark/workloada -p table=usertable -p cloudspanner.instance=ycsb-instance -p operationcount=100 -p cloudspanner.database=ycsb",
38
38
  "fix": "gts fix",
39
39
  "clean": "gts clean",
@@ -47,13 +47,14 @@
47
47
  "benchwrapper": "node bin/benchwrapper.js",
48
48
  "prelint": "cd samples; npm link ../; npm install",
49
49
  "precompile": "gts clean",
50
- "compile-protos": "compileProtos src"
50
+ "compile-protos": "compileProtos src",
51
+ "coverage": "c8 mocha build/test build/test/common && c8 report --check-coverage"
51
52
  },
52
53
  "dependencies": {
53
- "@google-cloud/common": "^4.0.0",
54
+ "@google-cloud/common": "^5.0.0",
54
55
  "@google-cloud/precise-date": "^3.0.0",
55
- "@google-cloud/projectify": "^3.0.0",
56
- "@google-cloud/promisify": "^3.0.0",
56
+ "@google-cloud/projectify": "^4.0.0",
57
+ "@google-cloud/promisify": "^4.0.0",
57
58
  "@grpc/proto-loader": "^0.7.0",
58
59
  "@types/big.js": "^6.0.0",
59
60
  "@types/stack-trace": "0.0.29",
@@ -63,19 +64,19 @@
63
64
  "duplexify": "^4.1.1",
64
65
  "events-intercept": "^2.0.0",
65
66
  "extend": "^3.0.2",
66
- "google-auth-library": "^8.0.2",
67
- "google-gax": "^3.5.2",
67
+ "google-auth-library": "^9.0.0",
68
+ "google-gax": "^4.0.3",
68
69
  "grpc-gcp": "^1.0.0",
69
70
  "is": "^3.2.1",
70
71
  "lodash.snakecase": "^4.1.1",
71
72
  "merge-stream": "^2.0.0",
72
73
  "p-queue": "^6.0.2",
73
74
  "protobufjs": "^7.0.0",
74
- "retry-request": "^5.0.0",
75
+ "retry-request": "^6.0.0",
75
76
  "split-array-stream": "^2.0.0",
76
77
  "stack-trace": "0.0.10",
77
78
  "stream-events": "^1.0.4",
78
- "teeny-request": "^8.0.0",
79
+ "teeny-request": "^9.0.0",
79
80
  "through2": "^4.0.0"
80
81
  },
81
82
  "devDependencies": {
@@ -93,15 +94,16 @@
93
94
  "@types/through2": "^2.0.34",
94
95
  "@types/uuid": "^9.0.0",
95
96
  "binary-search-bounds": "^2.0.4",
96
- "c8": "^8.0.0",
97
+ "c8": "^8.0.1",
97
98
  "codecov": "^3.0.2",
98
99
  "concat-stream": "^2.0.0",
99
100
  "dedent": "^0.7.0",
100
101
  "execa": "^5.0.0",
101
- "gts": "^3.1.0",
102
+ "gapic-tools": "^0.1.8",
103
+ "gts": "^5.0.0",
102
104
  "jsdoc": "^4.0.0",
103
105
  "jsdoc-fresh": "^2.0.0",
104
- "jsdoc-region-tag": "^2.0.0",
106
+ "jsdoc-region-tag": "^3.0.0",
105
107
  "linkinator": "^4.0.0",
106
108
  "lodash.random": "^3.2.0",
107
109
  "mocha": "^9.2.2",
@@ -113,7 +115,7 @@
113
115
  "stats-lite": "^2.1.1",
114
116
  "time-span": "^4.0.0",
115
117
  "tmp": "^0.2.0",
116
- "typescript": "^4.6.4",
118
+ "typescript": "^5.1.6",
117
119
  "uuid": "^9.0.0",
118
120
  "yargs": "^17.0.0"
119
121
  }