Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/bigquery

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/bigquery - npm Package Compare versions

Comparing version 5.9.2 to 5.9.3

90

build/src/bigquery.d.ts

@@ -16,3 +16,3 @@ /*!

*/
import * as common from '@google-cloud/common';
import { Service, GoogleAuthOptions } from '@google-cloud/common';
import { ResourceStream } from '@google-cloud/paginator';

@@ -103,6 +103,27 @@ import { Dataset, DatasetOptions } from './dataset';

export declare type QueryParameter = bigquery.IQueryParameter;
export interface BigQueryOptions extends common.GoogleAuthOptions {
export interface BigQueryOptions extends GoogleAuthOptions {
/**
* Automatically retry requests if the
* response is related to rate limits or certain intermittent server errors.
* We will exponentially backoff subsequent requests by default.
*
* Defaults to `true`.
*/
autoRetry?: boolean;
/**
* Maximum number of automatic retries
* attempted before returning the error.
*
* Defaults to 3.
*/
maxRetries?: number;
/**
* The geographic location of all datasets and
* jobs referenced and created through the client.
*/
location?: string;
/**
* The value to be prepended to the User-Agent
* header in API requests.
*/
userAgent?: string;

@@ -144,17 +165,7 @@ /**

* @property {string} [credentials.private_key]
* @property {boolean} [autoRetry=true] Automatically retry requests if the
* response is related to rate limits or certain intermittent server errors.
* We will exponentially backoff subsequent requests by default.
* @property {number} [maxRetries=3] Maximum number of automatic retries
* attempted before returning the error.
* @property {Constructor} [promise] Custom promise module to use instead of
* native Promises.
* @property {string} [location] The geographic location of all datasets and
* jobs referenced and created through the client.
* @property {string} [userAgent] The value to be prepended to the User-Agent
* header in API requests.
* @property {string[]} [scopes] Additional OAuth scopes to use in requests. For
* example, to access an external data source, you may need the
* `https://www.googleapis.com/auth/drive.readonly` scope.
* @property {string=} apiEndpoint The API endpoint of the service used to make requests. Defaults to `bigquery.googleapis.com`.
*/

@@ -202,7 +213,7 @@ /**

*/
export declare class BigQuery extends common.Service {
export declare class BigQuery extends Service {
location?: string;
createQueryStream: (options?: Query | string) => ResourceStream<RowMetadata>;
getDatasetsStream: (options?: GetDatasetsOptions) => ResourceStream<Dataset>;
getJobsStream: (options?: GetJobsOptions) => ResourceStream<Job>;
createQueryStream(options?: Query | string): ResourceStream<RowMetadata>;
getDatasetsStream(options?: GetDatasetsOptions): ResourceStream<Dataset>;
getJobsStream(options?: GetJobsOptions): ResourceStream<Job>;
constructor(options?: BigQueryOptions);

@@ -225,3 +236,3 @@ private static sanitizeEndpoint;

* If unspecified, all fields are returned.
* @returns {array} Fields using their matching names from the table's schema.
* @returns Fields using their matching names from the table's schema.
*/

@@ -267,3 +278,2 @@ static mergeSchemaWithRows_(schema: TableSchema | TableField, rows: TableRow[], wrapIntegers: boolean | IntegerTypeCastOptions, selectedFields?: string[]): any[];

* @param {string|number} value.day One or two digits.
* @returns {BigQueryDate}
*

@@ -303,3 +313,2 @@ * @example

* precision.
* @returns {BigQueryDatetime}
*

@@ -329,3 +338,2 @@ * @example

*
* @method BigQuery#datetime
* @param {object|string} value The time. If a string, this should be in the

@@ -376,3 +384,2 @@ * format the API describes: `YYYY-[M]M-[D]D[ [H]H:[M]M:[S]S[.DDDDDD]]`.

* precision.
* @returns {BigQueryTime}
*

@@ -397,3 +404,2 @@ * @example

*
* @method BigQuery#time
* @param {object|string} value The time. If a string, this should be in the

@@ -443,5 +449,3 @@ * format the API describes: `[H]H:[M]M:[S]S[.DDDDDD]`. Otherwise, provide

*
* @method BigQuery#timestamp
* @param {Date|string} value The time.
* @returns {BigQueryTimestamp}
*

@@ -460,3 +464,2 @@ * @example

*
* @method BigQuery#int
* @param {string|number|IntegerTypeCastValue} value The INT64 value to convert.

@@ -490,3 +493,2 @@ * @param {IntegerTypeCastOptions} typeCastOptions Configuration to convert

*
* @method BigQuery.geography
* @param {string} value The geospatial data.

@@ -497,16 +499,2 @@ *

* const {BigQuery} = require('@google-cloud/bigquery');
* const geography = BigQuery.geography('POINT(1, 2)');
* ```
*/
/**
* A geography value represents a surface area on the Earth
* in Well-known Text (WKT) format.
*
* @method BigQuery#geography
* @param {string} value The geospatial data.
* @returns {Geography}
*
* @example
* ```
* const {BigQuery} = require('@google-cloud/bigquery');
* const bigquery = new BigQuery();

@@ -584,3 +572,2 @@ * const geography = bigquery.geography('POINT(1, 2)');

* @param {object} callback.apiResponse The full API response.
* @returns {Promise<Dataset>}
*

@@ -650,3 +637,2 @@ * @example

* @param {object} callback.apiResponse The full API response.
* @returns {Promise<JobResponse>}
*

@@ -709,3 +695,3 @@ * @throws {Error} If a query is not specified.

*
* - {@link BigQuery#createQueryJob}
* - {@link BigQuery.createQueryJob}
* - {@link Table#createCopyJob}

@@ -732,3 +718,2 @@ * - {@link Table#createCopyFromJob}

* @param {object} callback.apiResponse The full API response.
* @returns {Promise<JobResponse>}
*

@@ -775,3 +760,2 @@ * @example

* Required except for US and EU.
* @returns {Dataset}
*

@@ -802,3 +786,2 @@ * @example

* @param {Dataset[]} callback.datasets The list of datasets in your project.
* @returns {Promise<DatasetsResponse>}
*

@@ -873,3 +856,2 @@ * @example

* project.
* @returns {Promise<GetJobsResponse>}
*

@@ -920,3 +902,2 @@ * @example

* Required except for US and EU.
* @returns {Job}
*

@@ -934,3 +915,3 @@ * @example

* Run a query scoped to your project. For manual pagination please refer to
* {@link BigQuery#createQueryJob}.
* {@link BigQuery.createQueryJob}.
*

@@ -949,4 +930,4 @@ * See {@link https://cloud.google.com/bigquery/docs/reference/v2/jobs/query| Jobs: query API Documentation}

* maps each named parameter to its value. The supported types are
* integers, floats, {@link BigQuery#date} objects, {@link BigQuery#datetime}
* objects, {@link BigQuery#time} objects, {@link BigQuery#timestamp}
* integers, floats, {@link BigQuery.date} objects, {@link BigQuery.datetime}
* objects, {@link BigQuery.time} objects, {@link BigQuery.timestamp}
* objects, Strings, Booleans, and Objects.

@@ -975,3 +956,2 @@ * @param {string} query.query A query string, following the BigQuery query

* @param {array} callback.rows The list of results from your query.
* @returns {Promise}
*

@@ -1040,4 +1020,4 @@ * @example

* // If you need to use a `DATE`, `DATETIME`, `TIME`, or `TIMESTAMP` type in
* // your query, see {@link BigQuery#date}, {@link BigQuery#datetime},
* // {@link BigQuery#time}, and {@link BigQuery#timestamp}.
* // your query, see {@link BigQuery.date}, {@link BigQuery.datetime},
* // {@link BigQuery.time}, and {@link BigQuery.timestamp}.
* //-

@@ -1065,3 +1045,3 @@ *

*/
queryAsStream_(query: Query, optionsOrCallback?: QueryStreamOptions, cb?: SimpleQueryRowsCallback): void;
queryAsStream_(query: Query, callback?: SimpleQueryRowsCallback): void;
}

@@ -1068,0 +1048,0 @@ /**

@@ -19,3 +19,3 @@ "use strict";

exports.BigQueryInt = exports.BigQueryTime = exports.BigQueryDatetime = exports.BigQueryTimestamp = exports.Geography = exports.BigQueryDate = exports.BigQuery = exports.PROTOCOL_REGEX = void 0;
const common = require("@google-cloud/common");
const common_1 = require("@google-cloud/common");
const paginator_1 = require("@google-cloud/paginator");

@@ -52,17 +52,7 @@ const promisify_1 = require("@google-cloud/promisify");

* @property {string} [credentials.private_key]
* @property {boolean} [autoRetry=true] Automatically retry requests if the
* response is related to rate limits or certain intermittent server errors.
* We will exponentially backoff subsequent requests by default.
* @property {number} [maxRetries=3] Maximum number of automatic retries
* attempted before returning the error.
* @property {Constructor} [promise] Custom promise module to use instead of
* native Promises.
* @property {string} [location] The geographic location of all datasets and
* jobs referenced and created through the client.
* @property {string} [userAgent] The value to be prepended to the User-Agent
* header in API requests.
* @property {string[]} [scopes] Additional OAuth scopes to use in requests. For
* example, to access an external data source, you may need the
* `https://www.googleapis.com/auth/drive.readonly` scope.
* @property {string=} apiEndpoint The API endpoint of the service used to make requests. Defaults to `bigquery.googleapis.com`.
*/

@@ -110,3 +100,3 @@ /**

*/
class BigQuery extends common.Service {
class BigQuery extends common_1.Service {
constructor(options = {}) {

@@ -135,6 +125,2 @@ let apiEndpoint = 'https://bigquery.googleapis.com';

super(config, options);
/**
* @name BigQuery#location
* @type {string}
*/
this.location = options.location;

@@ -145,5 +131,4 @@ /**

* @method
* @param {object} query Configuration object. See {@link BigQuery#query} for a complete
* @param {object} query Configuration object. See {@link BigQuery.query} for a complete
* list of options.
* @returns {stream}
*

@@ -183,4 +168,3 @@ * @example

* @param {object} [options] Configuration object. See
* {@link BigQuery#getDatasets} for a complete list of options.
* @returns {stream}
* {@link BigQuery.getDatasets} for a complete list of options.
*

@@ -217,4 +201,3 @@ * @example

* @param {object} [options] Configuration object. See
* {@link BigQuery#getJobs} for a complete list of options.
* @returns {stream}
* {@link BigQuery.getJobs} for a complete list of options.
*

@@ -254,2 +237,14 @@ * @example

}
createQueryStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
getDatasetsStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
getJobsStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
static sanitizeEndpoint(url) {

@@ -276,3 +271,3 @@ if (!exports.PROTOCOL_REGEX.test(url)) {

* If unspecified, all fields are returned.
* @returns {array} Fields using their matching names from the table's schema.
* @returns Fields using their matching names from the table's schema.
*/

@@ -431,3 +426,2 @@ static mergeSchemaWithRows_(schema, rows, wrapIntegers, selectedFields) {

* @param {string|number} value.day One or two digits.
* @returns {BigQueryDate}
*

@@ -469,3 +463,2 @@ * @example

* precision.
* @returns {BigQueryDatetime}
*

@@ -495,3 +488,2 @@ * @example

*
* @method BigQuery#datetime
* @param {object|string} value The time. If a string, this should be in the

@@ -546,3 +538,2 @@ * format the API describes: `YYYY-[M]M-[D]D[ [H]H:[M]M:[S]S[.DDDDDD]]`.

* precision.
* @returns {BigQueryTime}
*

@@ -567,3 +558,2 @@ * @example

*
* @method BigQuery#time
* @param {object|string} value The time. If a string, this should be in the

@@ -617,5 +607,3 @@ * format the API describes: `[H]H:[M]M:[S]S[.DDDDDD]`. Otherwise, provide

*
* @method BigQuery#timestamp
* @param {Date|string} value The time.
* @returns {BigQueryTimestamp}
*

@@ -638,3 +626,2 @@ * @example

*
* @method BigQuery#int
* @param {string|number|IntegerTypeCastValue} value The INT64 value to convert.

@@ -672,3 +659,2 @@ * @param {IntegerTypeCastOptions} typeCastOptions Configuration to convert

*
* @method BigQuery.geography
* @param {string} value The geospatial data.

@@ -679,16 +665,2 @@ *

* const {BigQuery} = require('@google-cloud/bigquery');
* const geography = BigQuery.geography('POINT(1, 2)');
* ```
*/
/**
* A geography value represents a surface area on the Earth
* in Well-known Text (WKT) format.
*
* @method BigQuery#geography
* @param {string} value The geospatial data.
* @returns {Geography}
*
* @example
* ```
* const {BigQuery} = require('@google-cloud/bigquery');
* const bigquery = new BigQuery();

@@ -1117,3 +1089,3 @@ * const geography = bigquery.geography('POINT(1, 2)');

if (resp.status.errors) {
err = new common.util.ApiError({
err = new common_1.util.ApiError({
errors: resp.status.errors,

@@ -1136,3 +1108,2 @@ response: resp,

* Required except for US and EU.
* @returns {Dataset}
*

@@ -1218,3 +1189,2 @@ * @example

* Required except for US and EU.
* @returns {Job}
*

@@ -1259,16 +1229,20 @@ * @example

*/
queryAsStream_(query, optionsOrCallback, cb) {
let options =
// Default to using query as options to ensure the options set
// in a Query type are passed through to the query() method.
typeof optionsOrCallback === 'object' ? optionsOrCallback : query;
const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
options = query.job
? extend(query, options)
: extend(options, { autoPaginate: false });
queryAsStream_(query, callback) {
if (query.job) {
query.job.getQueryResults(options, callback);
query.job.getQueryResults(query, callback);
return;
}
this.query(query, options, callback);
const { location, maxResults, pageToken, wrapIntegers } = query;
const opts = {
location,
maxResults,
pageToken,
wrapIntegers,
autoPaginate: false,
};
delete query.location;
delete query.maxResults;
delete query.pageToken;
delete query.wrapIntegers;
this.query(query, opts, callback);
}

@@ -1275,0 +1249,0 @@ }

@@ -67,5 +67,5 @@ /*!

location?: string;
getModelsStream: (options?: GetModelsOptions) => ResourceStream<Model>;
getRoutinesStream: (options?: GetRoutinesOptions) => ResourceStream<Routine>;
getTablesStream: (options?: GetTablesOptions) => ResourceStream<Table>;
getModelsStream(options?: GetModelsOptions): ResourceStream<Model>;
getRoutinesStream(options?: GetRoutinesOptions): ResourceStream<Routine>;
getTablesStream(options?: GetTablesOptions): ResourceStream<Table>;
constructor(bigQuery: BigQuery, id: string, options?: DatasetOptions);

@@ -72,0 +72,0 @@ /**

@@ -387,2 +387,14 @@ "use strict";

}
getModelsStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
getRoutinesStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
getTablesStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
createQueryJob(options, callback) {

@@ -389,0 +401,0 @@ if (typeof options === 'string') {

@@ -104,3 +104,3 @@ /*!

location?: string;
getQueryResultsStream: (options?: QueryResultsOptions) => ResourceStream<RowMetadata>;
getQueryResultsStream(options?: QueryResultsOptions): ResourceStream<RowMetadata>;
constructor(bigQuery: BigQuery, id: string, options?: JobOptions);

@@ -107,0 +107,0 @@ /**

@@ -280,2 +280,6 @@ "use strict";

}
getQueryResultsStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
cancel(callback) {

@@ -282,0 +286,0 @@ let qs;

@@ -16,3 +16,3 @@ /*!

*/
import * as common from '@google-cloud/common';
import { ServiceObject } from '@google-cloud/common';
import { BigQuery, Job, Dataset, ResourceCallback, RequestCallback, JobRequest } from '.';

@@ -52,3 +52,3 @@ import { JobMetadata } from './job';

*/
declare class Model extends common.ServiceObject {
declare class Model extends ServiceObject {
dataset: Dataset;

@@ -55,0 +55,0 @@ bigQuery: BigQuery;

@@ -19,3 +19,3 @@ "use strict";

exports.Model = void 0;
const common = require("@google-cloud/common");
const common_1 = require("@google-cloud/common");
const promisify_1 = require("@google-cloud/promisify");

@@ -48,3 +48,3 @@ const arrify = require("arrify");

*/
class Model extends common.ServiceObject {
class Model extends common_1.ServiceObject {
constructor(dataset, id) {

@@ -265,3 +265,3 @@ const methods = {

destinationUris: arrify(destination).map(dest => {
if (common.util.isCustomType(dest, 'storage/file')) {
if (common_1.util.isCustomType(dest, 'storage/file')) {
return ('gs://' + dest.bucket.name + '/' + dest.name);

@@ -268,0 +268,0 @@ }

@@ -16,3 +16,3 @@ /*!

*/
import * as common from '@google-cloud/common';
import { ServiceObject, ResponseCallback, SetMetadataResponse } from '@google-cloud/common';
import { Dataset, RoutineMetadata } from './dataset';

@@ -37,7 +37,7 @@ /**

*/
declare class Routine extends common.ServiceObject {
declare class Routine extends ServiceObject {
constructor(dataset: Dataset, id: string);
setMetadata(metadata: RoutineMetadata): Promise<common.SetMetadataResponse>;
setMetadata(metadata: RoutineMetadata, callback: common.ResponseCallback): void;
setMetadata(metadata: RoutineMetadata): Promise<SetMetadataResponse>;
setMetadata(metadata: RoutineMetadata, callback: ResponseCallback): void;
}
export { Routine };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Routine = void 0;
/*!

@@ -17,5 +19,3 @@ * Copyright 2020 Google LLC

*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Routine = void 0;
const common = require("@google-cloud/common");
const common_1 = require("@google-cloud/common");
const promisify_1 = require("@google-cloud/promisify");

@@ -41,3 +41,3 @@ const extend = require("extend");

*/
class Routine extends common.ServiceObject {
class Routine extends common_1.ServiceObject {
constructor(dataset, id) {

@@ -44,0 +44,0 @@ const methods = {

@@ -17,3 +17,3 @@ /*!

/// <reference types="node" />
import * as common from '@google-cloud/common';
import { ServiceObject, ResponseCallback, SetMetadataResponse } from '@google-cloud/common';
import { ResourceStream } from '@google-cloud/paginator';

@@ -118,7 +118,7 @@ import { BigQuery, Job, Dataset, Query, SimpleQueryRowsResponse, SimpleQueryRowsCallback, ResourceCallback, RequestCallback, PagedResponse, PagedCallback, JobRequest, PagedRequest } from '.';

*/
declare class Table extends common.ServiceObject {
declare class Table extends ServiceObject {
dataset: Dataset;
bigQuery: BigQuery;
location?: string;
createReadStream: (options?: GetRowsOptions) => ResourceStream<RowMetadata>;
createReadStream(options?: GetRowsOptions): ResourceStream<RowMetadata>;
constructor(dataset: Dataset, id: string, options?: TableOptions);

@@ -1089,4 +1089,4 @@ /**

*/
setMetadata(metadata: SetTableMetadataOptions): Promise<common.SetMetadataResponse>;
setMetadata(metadata: SetTableMetadataOptions, callback: common.ResponseCallback): void;
setMetadata(metadata: SetTableMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: SetTableMetadataOptions, callback: ResponseCallback): void;
/**

@@ -1093,0 +1093,0 @@ * Run a query scoped to your dataset.

@@ -19,3 +19,3 @@ "use strict";

exports.Table = void 0;
const common = require("@google-cloud/common");
const common_1 = require("@google-cloud/common");
const paginator_1 = require("@google-cloud/paginator");

@@ -74,3 +74,3 @@ const promisify_1 = require("@google-cloud/promisify");

*/
class Table extends common.ServiceObject {
class Table extends common_1.ServiceObject {
constructor(dataset, id, options) {

@@ -357,2 +357,6 @@ const methods = {

}
createReadStream(options) {
// placeholder body, overwritten in constructor
return new paginator_1.ResourceStream({}, () => { });
}
/**

@@ -574,3 +578,3 @@ * Convert a comma-separated name:type string to a table schema object.

destinationUris: arrify(destination).map(dest => {
if (!common.util.isCustomType(dest, 'storage/file')) {
if (!common_1.util.isCustomType(dest, 'storage/file')) {
throw new Error('Destination must be a File object.');

@@ -692,3 +696,3 @@ }

sourceUris: arrify(source).map(src => {
if (!common.util.isCustomType(src, 'storage/file')) {
if (!common_1.util.isCustomType(src, 'storage/file')) {
throw new Error('Source must be a File object.');

@@ -770,3 +774,3 @@ }

dup.once('writing', () => {
common.util.makeWritableStream(dup, {
common_1.util.makeWritableStream(dup, {
makeAuthenticatedRequest: this.bigQuery.makeAuthenticatedRequest,

@@ -1115,3 +1119,3 @@ metadata: {

if (partialFailures.length > 0) {
throw new common.util.PartialFailureError({
throw new common_1.util.PartialFailureError({
errors: partialFailures,

@@ -1118,0 +1122,0 @@ response: resp,

@@ -7,2 +7,9 @@ # Changelog

### [5.9.3](https://www.github.com/googleapis/nodejs-bigquery/compare/v5.9.2...v5.9.3) (2021-12-13)
### Bug Fixes
* refactor to extract options from query ([#1045](https://www.github.com/googleapis/nodejs-bigquery/issues/1045)) ([4afed77](https://www.github.com/googleapis/nodejs-bigquery/commit/4afed77c0e21568546bb6363936b10d15c9c93db))
### [5.9.2](https://www.github.com/googleapis/nodejs-bigquery/compare/v5.9.1...v5.9.2) (2021-11-16)

@@ -9,0 +16,0 @@

{
"name": "@google-cloud/bigquery",
"description": "Google BigQuery Client Library for Node.js",
"version": "5.9.2",
"version": "5.9.3",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "author": "Google LLC",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc