@google-cloud/bigquery
Advanced tools
Comparing version 5.2.0 to 5.3.0
@@ -51,2 +51,5 @@ /*! | ||
dryRun?: boolean; | ||
labels?: { | ||
[label: string]: string; | ||
}; | ||
types?: string[] | string[][] | { | ||
@@ -107,2 +110,3 @@ [type: string]: string[]; | ||
} | ||
export declare const PROTOCOL_REGEX: RegExp; | ||
/** | ||
@@ -183,2 +187,3 @@ * @typedef {object} BigQueryOptions | ||
constructor(options?: BigQueryOptions); | ||
private static sanitizeEndpoint; | ||
/** | ||
@@ -185,0 +190,0 @@ * Merge a rowset returned from the API with a table schema. |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BigQueryTime = exports.BigQueryDatetime = exports.BigQueryTimestamp = exports.Geography = exports.BigQueryDate = exports.BigQuery = void 0; | ||
exports.BigQueryTime = exports.BigQueryDatetime = exports.BigQueryTimestamp = exports.Geography = exports.BigQueryDate = exports.BigQuery = exports.PROTOCOL_REGEX = void 0; | ||
const common = require("@google-cloud/common"); | ||
@@ -31,2 +31,3 @@ const paginator_1 = require("@google-cloud/paginator"); | ||
const table_1 = require("./table"); | ||
exports.PROTOCOL_REGEX = /^(\w*):\/\//; | ||
/** | ||
@@ -103,8 +104,17 @@ * @typedef {object} BigQueryOptions | ||
constructor(options = {}) { | ||
let apiEndpoint = 'https://bigquery.googleapis.com'; | ||
const EMULATOR_HOST = process.env.BIGQUERY_EMULATOR_HOST; | ||
if (typeof EMULATOR_HOST === 'string') { | ||
apiEndpoint = BigQuery.sanitizeEndpoint(EMULATOR_HOST); | ||
} | ||
if (options.apiEndpoint) { | ||
apiEndpoint = BigQuery.sanitizeEndpoint(options.apiEndpoint); | ||
} | ||
options = Object.assign({}, options, { | ||
apiEndpoint: options.apiEndpoint || 'bigquery.googleapis.com', | ||
apiEndpoint, | ||
}); | ||
const baseUrl = EMULATOR_HOST || `${options.apiEndpoint}/bigquery/v2`; | ||
const config = { | ||
apiEndpoint: options.apiEndpoint, | ||
baseUrl: `https://${options.apiEndpoint}/bigquery/v2`, | ||
baseUrl, | ||
scopes: ['https://www.googleapis.com/auth/bigquery'], | ||
@@ -217,3 +227,16 @@ packageJson: require('../../package.json'), | ||
this.getJobsStream = paginator_1.paginator.streamify('getJobs'); | ||
// Disable `prettyPrint` for better performance. | ||
// https://github.com/googleapis/nodejs-bigquery/issues/858 | ||
this.interceptors.push({ | ||
request: (reqOpts) => { | ||
return extend(true, {}, reqOpts, { qs: { prettyPrint: false } }); | ||
}, | ||
}); | ||
} | ||
static sanitizeEndpoint(url) { | ||
if (!exports.PROTOCOL_REGEX.test(url)) { | ||
url = `https://${url}`; | ||
} | ||
return url.replace(/\/+$/, ''); // Remove trailing slashes | ||
} | ||
/** | ||
@@ -846,2 +869,4 @@ * Merge a rowset returned from the API with a table schema. | ||
* be accessed via `job.metadata`. | ||
* @param {object} [options.labels] String key/value pairs to be attached as | ||
* labels to the newly created Job. | ||
* @param {string} [options.location] The geographic location of the job. | ||
@@ -989,2 +1014,6 @@ * Required except for US and EU. | ||
} | ||
if (query.labels) { | ||
reqOpts.configuration.labels = query.labels; | ||
delete query.labels; | ||
} | ||
if (query.jobPrefix) { | ||
@@ -991,0 +1020,0 @@ reqOpts.jobPrefix = query.jobPrefix; |
@@ -16,3 +16,3 @@ /*! | ||
*/ | ||
export { BigQuery, BigQueryDate, BigQueryDateOptions, BigQueryDatetime, BigQueryDatetimeOptions, BigQueryOptions, BigQueryTime, BigQueryTimeOptions, BigQueryTimestamp, DatasetCallback, DatasetResource, DatasetResponse, DatasetsCallback, DatasetsResponse, Geography, GetDatasetsOptions, GetJobsCallback, GetJobsOptions, GetJobsResponse, JobRequest, PagedCallback, PagedRequest, PagedResponse, Query, QueryOptions, QueryParameter, QueryRowsCallback, QueryRowsResponse, RequestCallback, ResourceCallback, SimpleQueryRowsCallback, SimpleQueryRowsResponse, ValueType, } from './bigquery'; | ||
export { BigQuery, BigQueryDate, BigQueryDateOptions, BigQueryDatetime, BigQueryDatetimeOptions, BigQueryOptions, BigQueryTime, BigQueryTimeOptions, BigQueryTimestamp, DatasetCallback, DatasetResource, DatasetResponse, DatasetsCallback, DatasetsResponse, Geography, GetDatasetsOptions, GetJobsCallback, GetJobsOptions, GetJobsResponse, JobRequest, PagedCallback, PagedRequest, PagedResponse, PROTOCOL_REGEX, Query, QueryOptions, QueryParameter, QueryRowsCallback, QueryRowsResponse, RequestCallback, ResourceCallback, SimpleQueryRowsCallback, SimpleQueryRowsResponse, ValueType, } from './bigquery'; | ||
export { CreateDatasetOptions, Dataset, DatasetDeleteOptions, DatasetOptions, GetModelsCallback, GetModelsOptions, GetModelsResponse, GetRoutinesCallback, GetRoutinesOptions, GetRoutinesResponse, GetTablesCallback, GetTablesOptions, GetTablesResponse, RoutineCallback, RoutineMetadata, RoutineResponse, TableCallback, TableResponse, } from './dataset'; | ||
@@ -19,0 +19,0 @@ export { CancelCallback, CancelResponse, Job, JobMetadata, JobOptions, QueryResultsOptions, } from './job'; |
@@ -25,2 +25,3 @@ "use strict"; | ||
Object.defineProperty(exports, "Geography", { enumerable: true, get: function () { return bigquery_1.Geography; } }); | ||
Object.defineProperty(exports, "PROTOCOL_REGEX", { enumerable: true, get: function () { return bigquery_1.PROTOCOL_REGEX; } }); | ||
var dataset_1 = require("./dataset"); | ||
@@ -27,0 +28,0 @@ Object.defineProperty(exports, "Dataset", { enumerable: true, get: function () { return dataset_1.Dataset; } }); |
@@ -7,2 +7,16 @@ # Changelog | ||
## [5.3.0](https://www.github.com/googleapis/nodejs-bigquery/compare/v5.2.0...v5.3.0) (2020-09-30) | ||
### Features | ||
* **constructor:** add option to set baseUrl using environment variable ([#849](https://www.github.com/googleapis/nodejs-bigquery/issues/849)) ([8c54f20](https://www.github.com/googleapis/nodejs-bigquery/commit/8c54f20777a902a343035fcf09e63978d71135ad)) | ||
* allow setting BigQuery Job labels in createQueryJob method ([#865](https://www.github.com/googleapis/nodejs-bigquery/issues/865)) ([be074e7](https://www.github.com/googleapis/nodejs-bigquery/commit/be074e72ae1907f0649fbc5e085e22a31c3a6393)) | ||
### Bug Fixes | ||
* **deps:** update dependency yargs to v16 ([#854](https://www.github.com/googleapis/nodejs-bigquery/issues/854)) ([58dcf34](https://www.github.com/googleapis/nodejs-bigquery/commit/58dcf34d8d22b4b5c9e488935b75eeaf8c8fd69e)) | ||
* **perf:** disable prettyPrint for slimmer API responses ([#860](https://www.github.com/googleapis/nodejs-bigquery/issues/860)) ([1e56383](https://www.github.com/googleapis/nodejs-bigquery/commit/1e56383da5e6d8ce1335a711b32fea1155bddada)) | ||
## [5.2.0](https://www.github.com/googleapis/nodejs-bigquery/compare/v5.1.0...v5.2.0) (2020-08-13) | ||
@@ -9,0 +23,0 @@ |
{ | ||
"name": "@google-cloud/bigquery", | ||
"description": "Google BigQuery Client Library for Node.js", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google LLC", |
@@ -95,2 +95,5 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
| Create Job | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/createJob.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/createJob.js,samples/README.md) | | ||
| Create Model | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/createModel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/createModel.js,samples/README.md) | | ||
| Create Routine | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/createRoutine.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/createRoutine.js,samples/README.md) | | ||
| Create Routine DDL | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/createRoutineDDL.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/createRoutineDDL.js,samples/README.md) | | ||
| Create Table | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/createTable.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/createTable.js,samples/README.md) | | ||
@@ -105,2 +108,3 @@ | Create Table Partitioned | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/createTablePartitioned.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/createTablePartitioned.js,samples/README.md) | | ||
| Delete Model | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/deleteModel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/deleteModel.js,samples/README.md) | | ||
| Delete Routine | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/deleteRoutine.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/deleteRoutine.js,samples/README.md) | | ||
| Delete Table | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/deleteTable.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/deleteTable.js,samples/README.md) | | ||
@@ -114,2 +118,3 @@ | Extract Table Compressed | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/extractTableCompressed.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/extractTableCompressed.js,samples/README.md) | | ||
| BigQuery Get Model | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/getModel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/getModel.js,samples/README.md) | | ||
| Get Routine | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/getRoutine.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/getRoutine.js,samples/README.md) | | ||
| BigQuery Get Table | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/getTable.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/getTable.js,samples/README.md) | | ||
@@ -127,2 +132,3 @@ | Get Table Labels | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/getTableLabels.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/getTableLabels.js,samples/README.md) | | ||
| BigQuery List Models Streaming | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/listModelsStreaming.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/listModelsStreaming.js,samples/README.md) | | ||
| List Routines | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/listRoutines.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/listRoutines.js,samples/README.md) | | ||
| List Tables | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/listTables.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/listTables.js,samples/README.md) | | ||
@@ -164,2 +170,3 @@ | Load CSV From GCS | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/loadCSVFromGCS.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/loadCSVFromGCS.js,samples/README.md) | | ||
| Relax Column Query Append | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/relaxColumnQueryAppend.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/relaxColumnQueryAppend.js,samples/README.md) | | ||
| Set User Agent | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/setUserAgent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/setUserAgent.js,samples/README.md) | | ||
| Undelete Table | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/undeleteTable.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/undeleteTable.js,samples/README.md) | | ||
@@ -170,2 +177,3 @@ | Update Dataset Access | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/updateDatasetAccess.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/updateDatasetAccess.js,samples/README.md) | | ||
| BigQuery Update Model | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/updateModel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/updateModel.js,samples/README.md) | | ||
| Update Routine | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/updateRoutine.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/updateRoutine.js,samples/README.md) | | ||
| Update Table Description | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/updateTableDescription.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/updateTableDescription.js,samples/README.md) | | ||
@@ -172,0 +180,0 @@ | Update Table Expiration | [source code](https://github.com/googleapis/nodejs-bigquery/blob/master/samples/updateTableExpiration.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-bigquery&page=editor&open_in_editor=samples/updateTableExpiration.js,samples/README.md) | |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
486799
9924
245
3