Skip to content

Commit

Permalink
build!: update library to use Node 12 (#1114)
Browse files Browse the repository at this point in the history
* build!: Update library to use Node 12

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix error logging

* delete must refer to optional value

* dep: update gts

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
sofisl and gcf-owl-bot[bot] committed May 18, 2022
1 parent 1d93af9 commit b49fc4d
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Expand Up @@ -9,9 +9,9 @@ branchProtectionRules:
- "ci/kokoro: System test"
- docs
- lint
- test (10)
- test (12)
- test (14)
- test (16)
- cla/google
- windows
- OwlBot Post Processor
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [10, 12, 14]
node: [12, 14, 16]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
34 changes: 0 additions & 34 deletions .kokoro/continuous/node10/common.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .kokoro/continuous/node10/docs.cfg

This file was deleted.

9 changes: 0 additions & 9 deletions .kokoro/continuous/node10/test.cfg

This file was deleted.

24 changes: 0 additions & 24 deletions .kokoro/continuous/node8/common.cfg

This file was deleted.

Empty file removed .kokoro/continuous/node8/test.cfg
Empty file.
34 changes: 0 additions & 34 deletions .kokoro/presubmit/node10/common.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .kokoro/presubmit/node10/docs.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .kokoro/presubmit/node10/lint.cfg

This file was deleted.

Empty file removed .kokoro/presubmit/node10/test.cfg
Empty file.
24 changes: 0 additions & 24 deletions .kokoro/presubmit/node8/common.cfg

This file was deleted.

Empty file removed .kokoro/presubmit/node8/test.cfg
Empty file.
2 changes: 1 addition & 1 deletion benchmark/bench.ts
Expand Up @@ -35,7 +35,7 @@ Promise.all(
).catch(console.error);

async function doQuery(queryTxt: string) {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
const startMilli = new Date().getTime();
let numRows = 0;
let numCols: number;
Expand Down
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=10"
"node": ">=12.0.0"
},
"repository": "googleapis/nodejs-bigquery",
"main": "./build/src/index.js",
Expand Down Expand Up @@ -79,17 +79,17 @@
"codecov": "^3.5.0",
"discovery-tsd": "^0.3.0",
"execa": "^5.0.0",
"gts": "^3.0.0",
"gts": "^3.1.0",
"jsdoc": "^3.6.3",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
"linkinator": "^2.0.0",
"mocha": "^8.0.0",
"mocha": "^9.2.2",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"proxyquire": "^2.1.0",
"sinon": "^14.0.0",
"tmp": "0.2.1",
"typescript": "^3.8.3"
"typescript": "^4.6.4"
}
}
4 changes: 2 additions & 2 deletions samples/package.json
Expand Up @@ -10,7 +10,7 @@
"author": "Google LLC",
"repository": "googleapis/nodejs-bigquery",
"engines": {
"node": ">=8"
"node": ">=12.0.0"
},
"scripts": {
"test": "mocha --timeout 200000"
Expand All @@ -30,4 +30,4 @@
"sinon": "^14.0.0",
"uuid": "^8.0.0"
}
}
}
4 changes: 3 additions & 1 deletion src/bigquery.ts
Expand Up @@ -2240,7 +2240,9 @@ export class BigQueryInt extends Number {
try {
return this.typeCastFunction!(this.value);
} catch (error) {
error.message = `integerTypeCastFunction threw an error:\n\n - ${error.message}`;
(error as Error).message = `integerTypeCastFunction threw an error:\n\n - ${
(error as Error).message
}`;
throw error;
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/table.ts
Expand Up @@ -2118,16 +2118,16 @@ class Table extends ServiceObject {
options: InsertRowsOptions
): Promise<bigquery.ITableDataInsertAllResponse> {
const {partialRetries = 3} = options;
let error: Error;
let error: GoogleErrorBody;

const maxAttempts = Math.max(partialRetries, 0) + 1;

for (let attempts = 0; attempts < maxAttempts; attempts++) {
try {
return await this._insert(rows, options);
} catch (e) {
error = e;
rows = ((e.errors || []) as PartialInsertFailure[])
error = e as GoogleErrorBody;
rows = (((e as GoogleErrorBody).errors || []) as PartialInsertFailure[])
.filter(err => !!err.row)
.map(err => err.row);

Expand Down
12 changes: 11 additions & 1 deletion test/bigquery.ts
Expand Up @@ -52,6 +52,16 @@ class FakeApiError {
}
}

interface InputObject {
year?: number;
month?: number;
day?: number;
hours?: number;
minutes?: number;
seconds?: number;
fractional?: number;
}

interface CalledWithService extends Service {
calledWith_: Array<{
baseUrl: string;
Expand Down Expand Up @@ -763,7 +773,7 @@ describe('BigQuery', () => {
});

it('should not include fractional digits if not provided', () => {
const input = Object.assign({}, INPUT_OBJ);
const input = Object.assign({}, INPUT_OBJ) as InputObject;
delete input.fractional;

const time = bq.time(input);
Expand Down

0 comments on commit b49fc4d

Please sign in to comment.