@google-cloud/bigquery-storage
Advanced tools
Comparing version 2.2.1 to 2.2.2
import * as v1 from './v1'; | ||
import * as v1beta1 from './v1beta1'; | ||
declare const BigQueryReadClient: typeof v1.BigQueryReadClient; | ||
declare type BigQueryReadClient = v1.BigQueryReadClient; | ||
declare const BigQueryStorageClient: typeof v1beta1.BigQueryStorageClient; | ||
declare type BigQueryStorageClient = v1beta1.BigQueryStorageClient; | ||
export { v1, BigQueryReadClient, v1beta1, BigQueryStorageClient }; | ||
@@ -6,0 +8,0 @@ declare const _default: { |
@@ -32,4 +32,6 @@ import * as gax from 'google-gax'; | ||
* | ||
* @param {object} [options] - The configuration object. See the subsequent | ||
* parameters for more details. | ||
* @param {object} [options] - The configuration object. | ||
* The options accepted by the constructor are described in detail | ||
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). | ||
* The common options are: | ||
* @param {object} [options.credentials] - Credentials object. | ||
@@ -54,2 +56,9 @@ * @param {string} [options.credentials.client_email] | ||
* API remote host. | ||
* @param {gax.ClientConfig} [options.clientConfig] - client configuration override. | ||
* TODO(@alexander-fenster): link to gax documentation. | ||
* @param {boolean} fallback - Use HTTP fallback mode. | ||
* In fallback mode, a special browser-compatible transport implementation is used | ||
* instead of gRPC transport. In browser context (if the `window` object is defined) | ||
* the fallback mode is enabled automatically; set `options.fallback` to `false` | ||
* if you need to override this behavior. | ||
*/ | ||
@@ -73,2 +82,3 @@ constructor(opts?: ClientOptions); | ||
* The DNS address for this API service. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -79,2 +89,3 @@ static get servicePath(): string; | ||
* exists for compatibility reasons. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -84,2 +95,3 @@ static get apiEndpoint(): string; | ||
* The port for this API service. | ||
* @returns {number} The default port for this service. | ||
*/ | ||
@@ -90,2 +102,3 @@ static get port(): number; | ||
* in this service. | ||
* @returns {string[]} List of default scopes. | ||
*/ | ||
@@ -122,2 +135,9 @@ static get scopes(): string[]; | ||
* An object stream which emits [ReadRowsResponse]{@link google.cloud.bigquery.storage.v1.ReadRowsResponse} on 'data' event. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) | ||
* for more details and examples. | ||
* @example | ||
* const stream = client.readRows(request); | ||
* stream.on('data', (response) => { ... }); | ||
* stream.on('end', () => { ... }); | ||
*/ | ||
@@ -216,7 +236,8 @@ readRows(request?: protos.google.cloud.bigquery.storage.v1.IReadRowsRequest, options?: gax.CallOptions): gax.CancellableStream; | ||
/** | ||
* Terminate the GRPC channel and close the client. | ||
* Terminate the gRPC channel and close the client. | ||
* | ||
* The client will no longer be usable and all future behavior is undefined. | ||
* @returns {Promise} A promise that resolves when the client is closed. | ||
*/ | ||
close(): Promise<void>; | ||
} |
@@ -36,4 +36,6 @@ "use strict"; | ||
* | ||
* @param {object} [options] - The configuration object. See the subsequent | ||
* parameters for more details. | ||
* @param {object} [options] - The configuration object. | ||
* The options accepted by the constructor are described in detail | ||
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). | ||
* The common options are: | ||
* @param {object} [options.credentials] - Credentials object. | ||
@@ -58,4 +60,12 @@ * @param {string} [options.credentials.client_email] | ||
* API remote host. | ||
* @param {gax.ClientConfig} [options.clientConfig] - client configuration override. | ||
* TODO(@alexander-fenster): link to gax documentation. | ||
* @param {boolean} fallback - Use HTTP fallback mode. | ||
* In fallback mode, a special browser-compatible transport implementation is used | ||
* instead of gRPC transport. In browser context (if the `window` object is defined) | ||
* the fallback mode is enabled automatically; set `options.fallback` to `false` | ||
* if you need to override this behavior. | ||
*/ | ||
constructor(opts) { | ||
var _a, _b; | ||
this._terminated = false; | ||
@@ -68,30 +78,16 @@ this.descriptors = { | ||
}; | ||
// Ensure that options include the service address and port. | ||
// Ensure that options include all the required fields. | ||
const staticMembers = this.constructor; | ||
const servicePath = opts && opts.servicePath | ||
? opts.servicePath | ||
: opts && opts.apiEndpoint | ||
? opts.apiEndpoint | ||
: staticMembers.servicePath; | ||
const port = opts && opts.port ? opts.port : staticMembers.port; | ||
if (!opts) { | ||
opts = { servicePath, port }; | ||
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath; | ||
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; | ||
const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {}; | ||
const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : typeof window !== 'undefined'; | ||
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); | ||
// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. | ||
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { | ||
opts['scopes'] = staticMembers.scopes; | ||
} | ||
opts.servicePath = opts.servicePath || servicePath; | ||
opts.port = opts.port || port; | ||
// users can override the config from client side, like retry codes name. | ||
// The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 | ||
// The way to override client config for Showcase API: | ||
// | ||
// const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} | ||
// const showcaseClient = new showcaseClient({ projectId, customConfig }); | ||
opts.clientConfig = opts.clientConfig || {}; | ||
// If we're running in browser, it's OK to omit `fallback` since | ||
// google-gax has `browser` field in its `package.json`. | ||
// For Electron (which does not respect `browser` field), | ||
// pass `{fallback: true}` to the BigQueryReadClient constructor. | ||
// Choose either gRPC or proto-over-HTTP implementation of google-gax. | ||
this._gaxModule = opts.fallback ? gax.fallback : gax; | ||
// Create a `gaxGrpc` object, with any grpc-specific options | ||
// sent to the client. | ||
opts.scopes = this.constructor.scopes; | ||
// Create a `gaxGrpc` object, with any grpc-specific options sent to the client. | ||
this._gaxGrpc = new this._gaxModule.GrpcClient(opts); | ||
@@ -102,2 +98,6 @@ // Save options to use in initialize() method. | ||
this.auth = this._gaxGrpc.auth; | ||
// Set the default scopes in auth client if needed. | ||
if (servicePath === staticMembers.servicePath) { | ||
this.auth.defaultScopes = staticMembers.scopes; | ||
} | ||
// Determine the client header string. | ||
@@ -184,5 +184,4 @@ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; | ||
}); | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], this.descriptors.page[methodName] || | ||
this.descriptors.stream[methodName] || | ||
this.descriptors.longrunning[methodName]); | ||
const descriptor = this.descriptors.stream[methodName] || undefined; | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor); | ||
this.innerApiCalls[methodName] = apiCall; | ||
@@ -194,2 +193,3 @@ } | ||
* The DNS address for this API service. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -202,2 +202,3 @@ static get servicePath() { | ||
* exists for compatibility reasons. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -209,2 +210,3 @@ static get apiEndpoint() { | ||
* The port for this API service. | ||
* @returns {number} The default port for this service. | ||
*/ | ||
@@ -217,2 +219,3 @@ static get port() { | ||
* in this service. | ||
* @returns {string[]} List of default scopes. | ||
*/ | ||
@@ -228,4 +231,3 @@ static get scopes() { | ||
* Return the project ID used by this class. | ||
* @param {function(Error, string)} callback - the callback to | ||
* be called with the current project Id. | ||
* @returns {Promise} A promise that resolves to string containing the project ID. | ||
*/ | ||
@@ -280,3 +282,7 @@ getProjectId(callback) { | ||
* The first element of the array is an object representing [ReadSession]{@link google.cloud.bigquery.storage.v1.ReadSession}. | ||
* The promise has a method named "cancel" which cancels the ongoing API call. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) | ||
* for more details and examples. | ||
* @example | ||
* const [response] = await client.createReadSession(request); | ||
*/ | ||
@@ -332,3 +338,7 @@ createReadSession(request, optionsOrCallback, callback) { | ||
* The first element of the array is an object representing [SplitReadStreamResponse]{@link google.cloud.bigquery.storage.v1.SplitReadStreamResponse}. | ||
* The promise has a method named "cancel" which cancels the ongoing API call. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) | ||
* for more details and examples. | ||
* @example | ||
* const [response] = await client.splitReadStream(request); | ||
*/ | ||
@@ -375,2 +385,9 @@ splitReadStream(request, optionsOrCallback, callback) { | ||
* An object stream which emits [ReadRowsResponse]{@link google.cloud.bigquery.storage.v1.ReadRowsResponse} on 'data' event. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) | ||
* for more details and examples. | ||
* @example | ||
* const stream = client.readRows(request); | ||
* stream.on('data', (response) => { ... }); | ||
* stream.on('end', () => { ... }); | ||
*/ | ||
@@ -522,5 +539,6 @@ readRows(request, options) { | ||
/** | ||
* Terminate the GRPC channel and close the client. | ||
* Terminate the gRPC channel and close the client. | ||
* | ||
* The client will no longer be usable and all future behavior is undefined. | ||
* @returns {Promise} A promise that resolves when the client is closed. | ||
*/ | ||
@@ -527,0 +545,0 @@ close() { |
@@ -32,4 +32,6 @@ import * as gax from 'google-gax'; | ||
* | ||
* @param {object} [options] - The configuration object. See the subsequent | ||
* parameters for more details. | ||
* @param {object} [options] - The configuration object. | ||
* The options accepted by the constructor are described in detail | ||
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). | ||
* The common options are: | ||
* @param {object} [options.credentials] - Credentials object. | ||
@@ -54,2 +56,9 @@ * @param {string} [options.credentials.client_email] | ||
* API remote host. | ||
* @param {gax.ClientConfig} [options.clientConfig] - client configuration override. | ||
* TODO(@alexander-fenster): link to gax documentation. | ||
* @param {boolean} fallback - Use HTTP fallback mode. | ||
* In fallback mode, a special browser-compatible transport implementation is used | ||
* instead of gRPC transport. In browser context (if the `window` object is defined) | ||
* the fallback mode is enabled automatically; set `options.fallback` to `false` | ||
* if you need to override this behavior. | ||
*/ | ||
@@ -73,2 +82,3 @@ constructor(opts?: ClientOptions); | ||
* The DNS address for this API service. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -79,2 +89,3 @@ static get servicePath(): string; | ||
* exists for compatibility reasons. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -84,2 +95,3 @@ static get apiEndpoint(): string; | ||
* The port for this API service. | ||
* @returns {number} The default port for this service. | ||
*/ | ||
@@ -90,2 +102,3 @@ static get port(): number; | ||
* in this service. | ||
* @returns {string[]} List of default scopes. | ||
*/ | ||
@@ -128,2 +141,9 @@ static get scopes(): string[]; | ||
* An object stream which emits [ReadRowsResponse]{@link google.cloud.bigquery.storage.v1beta1.ReadRowsResponse} on 'data' event. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) | ||
* for more details and examples. | ||
* @example | ||
* const stream = client.readRows(request); | ||
* stream.on('data', (response) => { ... }); | ||
* stream.on('end', () => { ... }); | ||
*/ | ||
@@ -213,7 +233,8 @@ readRows(request?: protos.google.cloud.bigquery.storage.v1beta1.IReadRowsRequest, options?: gax.CallOptions): gax.CancellableStream; | ||
/** | ||
* Terminate the GRPC channel and close the client. | ||
* Terminate the gRPC channel and close the client. | ||
* | ||
* The client will no longer be usable and all future behavior is undefined. | ||
* @returns {Promise} A promise that resolves when the client is closed. | ||
*/ | ||
close(): Promise<void>; | ||
} |
@@ -36,4 +36,6 @@ "use strict"; | ||
* | ||
* @param {object} [options] - The configuration object. See the subsequent | ||
* parameters for more details. | ||
* @param {object} [options] - The configuration object. | ||
* The options accepted by the constructor are described in detail | ||
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). | ||
* The common options are: | ||
* @param {object} [options.credentials] - Credentials object. | ||
@@ -58,4 +60,12 @@ * @param {string} [options.credentials.client_email] | ||
* API remote host. | ||
* @param {gax.ClientConfig} [options.clientConfig] - client configuration override. | ||
* TODO(@alexander-fenster): link to gax documentation. | ||
* @param {boolean} fallback - Use HTTP fallback mode. | ||
* In fallback mode, a special browser-compatible transport implementation is used | ||
* instead of gRPC transport. In browser context (if the `window` object is defined) | ||
* the fallback mode is enabled automatically; set `options.fallback` to `false` | ||
* if you need to override this behavior. | ||
*/ | ||
constructor(opts) { | ||
var _a, _b; | ||
this._terminated = false; | ||
@@ -68,30 +78,16 @@ this.descriptors = { | ||
}; | ||
// Ensure that options include the service address and port. | ||
// Ensure that options include all the required fields. | ||
const staticMembers = this.constructor; | ||
const servicePath = opts && opts.servicePath | ||
? opts.servicePath | ||
: opts && opts.apiEndpoint | ||
? opts.apiEndpoint | ||
: staticMembers.servicePath; | ||
const port = opts && opts.port ? opts.port : staticMembers.port; | ||
if (!opts) { | ||
opts = { servicePath, port }; | ||
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath; | ||
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; | ||
const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {}; | ||
const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : typeof window !== 'undefined'; | ||
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); | ||
// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. | ||
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { | ||
opts['scopes'] = staticMembers.scopes; | ||
} | ||
opts.servicePath = opts.servicePath || servicePath; | ||
opts.port = opts.port || port; | ||
// users can override the config from client side, like retry codes name. | ||
// The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 | ||
// The way to override client config for Showcase API: | ||
// | ||
// const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} | ||
// const showcaseClient = new showcaseClient({ projectId, customConfig }); | ||
opts.clientConfig = opts.clientConfig || {}; | ||
// If we're running in browser, it's OK to omit `fallback` since | ||
// google-gax has `browser` field in its `package.json`. | ||
// For Electron (which does not respect `browser` field), | ||
// pass `{fallback: true}` to the BigQueryStorageClient constructor. | ||
// Choose either gRPC or proto-over-HTTP implementation of google-gax. | ||
this._gaxModule = opts.fallback ? gax.fallback : gax; | ||
// Create a `gaxGrpc` object, with any grpc-specific options | ||
// sent to the client. | ||
opts.scopes = this.constructor.scopes; | ||
// Create a `gaxGrpc` object, with any grpc-specific options sent to the client. | ||
this._gaxGrpc = new this._gaxModule.GrpcClient(opts); | ||
@@ -102,2 +98,6 @@ // Save options to use in initialize() method. | ||
this.auth = this._gaxGrpc.auth; | ||
// Set the default scopes in auth client if needed. | ||
if (servicePath === staticMembers.servicePath) { | ||
this.auth.defaultScopes = staticMembers.scopes; | ||
} | ||
// Determine the client header string. | ||
@@ -187,5 +187,4 @@ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; | ||
}); | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], this.descriptors.page[methodName] || | ||
this.descriptors.stream[methodName] || | ||
this.descriptors.longrunning[methodName]); | ||
const descriptor = this.descriptors.stream[methodName] || undefined; | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor); | ||
this.innerApiCalls[methodName] = apiCall; | ||
@@ -197,2 +196,3 @@ } | ||
* The DNS address for this API service. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -205,2 +205,3 @@ static get servicePath() { | ||
* exists for compatibility reasons. | ||
* @returns {string} The DNS address for this service. | ||
*/ | ||
@@ -212,2 +213,3 @@ static get apiEndpoint() { | ||
* The port for this API service. | ||
* @returns {number} The default port for this service. | ||
*/ | ||
@@ -220,2 +222,3 @@ static get port() { | ||
* in this service. | ||
* @returns {string[]} List of default scopes. | ||
*/ | ||
@@ -231,4 +234,3 @@ static get scopes() { | ||
* Return the project ID used by this class. | ||
* @param {function(Error, string)} callback - the callback to | ||
* be called with the current project Id. | ||
* @returns {Promise} A promise that resolves to string containing the project ID. | ||
*/ | ||
@@ -285,3 +287,7 @@ getProjectId(callback) { | ||
* The first element of the array is an object representing [ReadSession]{@link google.cloud.bigquery.storage.v1beta1.ReadSession}. | ||
* The promise has a method named "cancel" which cancels the ongoing API call. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) | ||
* for more details and examples. | ||
* @example | ||
* const [response] = await client.createReadSession(request); | ||
*/ | ||
@@ -326,3 +332,7 @@ createReadSession(request, optionsOrCallback, callback) { | ||
* The first element of the array is an object representing [BatchCreateReadSessionStreamsResponse]{@link google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse}. | ||
* The promise has a method named "cancel" which cancels the ongoing API call. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) | ||
* for more details and examples. | ||
* @example | ||
* const [response] = await client.batchCreateReadSessionStreams(request); | ||
*/ | ||
@@ -372,3 +382,7 @@ batchCreateReadSessionStreams(request, optionsOrCallback, callback) { | ||
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. | ||
* The promise has a method named "cancel" which cancels the ongoing API call. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) | ||
* for more details and examples. | ||
* @example | ||
* const [response] = await client.finalizeStream(request); | ||
*/ | ||
@@ -425,3 +439,7 @@ finalizeStream(request, optionsOrCallback, callback) { | ||
* The first element of the array is an object representing [SplitReadStreamResponse]{@link google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse}. | ||
* The promise has a method named "cancel" which cancels the ongoing API call. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) | ||
* for more details and examples. | ||
* @example | ||
* const [response] = await client.splitReadStream(request); | ||
*/ | ||
@@ -468,2 +486,9 @@ splitReadStream(request, optionsOrCallback, callback) { | ||
* An object stream which emits [ReadRowsResponse]{@link google.cloud.bigquery.storage.v1beta1.ReadRowsResponse} on 'data' event. | ||
* Please see the | ||
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) | ||
* for more details and examples. | ||
* @example | ||
* const stream = client.readRows(request); | ||
* stream.on('data', (response) => { ... }); | ||
* stream.on('end', () => { ... }); | ||
*/ | ||
@@ -599,5 +624,6 @@ readRows(request, options) { | ||
/** | ||
* Terminate the GRPC channel and close the client. | ||
* Terminate the gRPC channel and close the client. | ||
* | ||
* The client will no longer be usable and all future behavior is undefined. | ||
* @returns {Promise} A promise that resolves when the client is closed. | ||
*/ | ||
@@ -604,0 +630,0 @@ close() { |
# Changelog | ||
### [2.2.2](https://www.github.com/googleapis/nodejs-bigquery-storage/compare/v2.2.1...v2.2.2) (2020-11-07) | ||
### Bug Fixes | ||
* do not modify options object, use defaultScopes ([#126](https://www.github.com/googleapis/nodejs-bigquery-storage/issues/126)) ([6f8eb24](https://www.github.com/googleapis/nodejs-bigquery-storage/commit/6f8eb244b1b06a928641550b2390e03964a14981)) | ||
### [2.2.1](https://www.github.com/googleapis/nodejs-bigquery-storage/compare/v2.2.0...v2.2.1) (2020-07-09) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@google-cloud/bigquery-storage", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Client for the BigQuery Storage API", | ||
@@ -27,9 +27,11 @@ "repository": "googleapis/nodejs-bigquery-storage", | ||
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../", | ||
"precompile": "gts clean" | ||
"precompile": "gts clean", | ||
"api-extractor": "api-extractor run --local", | ||
"api-documenter": "api-documenter yaml --input-folder=temp" | ||
}, | ||
"dependencies": { | ||
"google-gax": "^2.1.0" | ||
"google-gax": "^2.9.2" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^7.0.1", | ||
"@types/mocha": "^8.0.0", | ||
"@types/node": "^13.7.1", | ||
@@ -47,6 +49,8 @@ "@types/sinon": "^9.0.0", | ||
"sinon": "^9.0.1", | ||
"ts-loader": "^7.0.0", | ||
"ts-loader": "^8.0.0", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.41.6", | ||
"webpack-cli": "^3.3.11" | ||
"webpack": "^5.0.0", | ||
"webpack-cli": "^4.0.0", | ||
"@microsoft/api-documenter": "^7.8.10", | ||
"@microsoft/api-extractor": "^7.8.10" | ||
}, | ||
@@ -53,0 +57,0 @@ "engines": { |
@@ -17,2 +17,5 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
A comprehensive list of changes in each version may be found in | ||
[the CHANGELOG](https://github.com/googleapis/nodejs-bigquery-storage/blob/master/CHANGELOG.md). | ||
* [Google BigQuery Storage Node.js Client API Reference][client-docs] | ||
@@ -67,5 +70,5 @@ * [Google BigQuery Storage Documentation][product-docs] | ||
// https://cloud.google.com/bigquery/docs/reference/storage | ||
const {BigQueryStorageClient} = require('@google-cloud/bigquery-storage'); | ||
const {BigQueryReadClient} = require('@google-cloud/bigquery-storage'); | ||
const client = new BigQueryStorageClient(); | ||
const client = new BigQueryReadClient(); | ||
@@ -82,7 +85,3 @@ async function bigqueryStorageQuickstart() { | ||
const tableReference = { | ||
projectId, | ||
datasetId, | ||
tableId, | ||
}; | ||
const tableReference = `projects/${projectId}/datasets/${datasetId}/tables/${tableId}`; | ||
@@ -110,14 +109,11 @@ const parent = `projects/${myProjectId}`; | ||
const request = { | ||
tableReference, | ||
parent, | ||
readOptions, | ||
tableModifiers, | ||
// This API can also deliver data serialized in Apache Arrow format. | ||
// This example leverages Apache Avro. | ||
format: 'AVRO', | ||
/* We use a LIQUID strategy in this example because we only read from a | ||
* single stream. Consider BALANCED if you're consuming multiple streams | ||
* concurrently and want more consistent stream sizes. | ||
*/ | ||
shardingStrategy: 'LIQUID', | ||
readSession: { | ||
table: tableReference, | ||
// This API can also deliver data serialized in Apache Arrow format. | ||
// This example leverages Apache Avro. | ||
dataFormat: 'AVRO', | ||
readOptions, | ||
tableModifiers, | ||
}, | ||
}; | ||
@@ -138,12 +134,10 @@ | ||
const readRowsRequest = { | ||
// Optional stream name or offset. Offset requested must be less than the last | ||
// row read from readRows(). Requesting a larger offset is undefined. | ||
readPosition: { | ||
stream: session.streams[0], | ||
offset, | ||
}, | ||
// Required stream name and optional offset. Offset requested must be less than | ||
// the last row read from readRows(). Requesting a larger offset is undefined. | ||
readStream: session.streams[0].name, | ||
offset, | ||
}; | ||
const names = new Set(); | ||
const states = {}; | ||
const states = []; | ||
@@ -159,14 +153,23 @@ /* We'll use only a single stream for reading data from the table. Because | ||
.on('data', data => { | ||
offset = data.avroRows.serializedBinaryRows.offset; | ||
try { | ||
const decodedData = avroType.decode( | ||
data.avroRows.serializedBinaryRows | ||
); | ||
// Decode all rows in buffer | ||
let pos; | ||
do { | ||
const decodedData = avroType.decode( | ||
data.avroRows.serializedBinaryRows, | ||
pos | ||
); | ||
names.add(decodedData.value.name); | ||
if (decodedData.value) { | ||
names.add(decodedData.value.name); | ||
if (!states[decodedData.value.state]) { | ||
states[decodedData.value.state] = true; | ||
} | ||
if (!states.includes(decodedData.value.state)) { | ||
states.push(decodedData.value.state); | ||
} | ||
} | ||
offset = decodedData.offset; | ||
pos = decodedData.offset; | ||
} while (pos > 0); | ||
} catch (error) { | ||
@@ -177,5 +180,3 @@ console.log(error); | ||
.on('end', () => { | ||
console.log( | ||
`Got ${names.size} unique names in states: ${Object.keys(states)}` | ||
); | ||
console.log(`Got ${names.size} unique names in states: ${states}`); | ||
console.log(`Last offset: ${offset}`); | ||
@@ -182,0 +183,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1853827
28640
260
19
Updatedgoogle-gax@^2.9.2