@google-cloud/spanner 6.16.0 → 7.1.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 +33 -0
- package/README.md +1 -1
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +80 -4
- package/build/protos/google/spanner/v1/spanner.proto +318 -142
- package/build/protos/google/spanner/v1/type.proto +6 -1
- package/build/protos/protos.d.ts +1721 -81
- package/build/protos/protos.js +7232 -2691
- package/build/protos/protos.json +520 -7
- package/build/src/transaction.d.ts +4 -3
- package/build/src/transaction.js +20 -7
- package/build/src/v1/database_admin_client.d.ts +184 -221
- package/build/src/v1/database_admin_client.js +77 -94
- package/build/src/v1/instance_admin_client.d.ts +118 -143
- package/build/src/v1/instance_admin_client.js +41 -52
- package/build/src/v1/spanner_client.d.ts +245 -180
- package/build/src/v1/spanner_client.js +118 -59
- package/build/src/v1/spanner_client_config.json +5 -0
- package/package.json +19 -17
|
@@ -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
|
|
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
|
*
|
package/build/src/transaction.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
-
|
|
814
|
-
|
|
815
|
-
|
|
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
|