Skip to content

Commit eecf7ac

Browse files
build!: update library to use Node 12 (#945)
* build!: Update library to use Node 12 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent e117702 commit eecf7ac

File tree

17 files changed

+34
-134
lines changed

17 files changed

+34
-134
lines changed

.github/sync-repo-settings.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ branchProtectionRules:
99
- "ci/kokoro: System test"
1010
- docs
1111
- lint
12-
- test (10)
1312
- test (12)
1413
- test (14)
14+
- test (16)
1515
- cla/google
1616
- windows
1717
- OwlBot Post Processor

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
node: [10, 12, 14]
12+
node: [12, 14, 16]
1313
steps:
1414
- uses: actions/checkout@v3
1515
- uses: actions/setup-node@v3

.kokoro/continuous/node10/common.cfg

-34
This file was deleted.

.kokoro/continuous/node10/docs.cfg

-4
This file was deleted.

.kokoro/continuous/node10/test.cfg

-9
This file was deleted.

.kokoro/continuous/node8/common.cfg

-24
This file was deleted.

.kokoro/continuous/node8/test.cfg

Whitespace-only changes.

.kokoro/presubmit/node10/common.cfg

-34
This file was deleted.

.kokoro/presubmit/node10/docs.cfg

-4
This file was deleted.

.kokoro/presubmit/node10/lint.cfg

-4
This file was deleted.

.kokoro/presubmit/node10/test.cfg

Whitespace-only changes.

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"arrify": "^2.0.1",
4646
"concat-stream": "^2.0.0",
4747
"extend": "^3.0.2",
48-
"google-gax": "^2.24.1",
48+
"google-gax": "^3.0.1",
4949
"is": "^3.3.0",
5050
"split-array-stream": "^2.0.0",
5151
"stream-events": "^1.0.5"
@@ -60,23 +60,23 @@
6060
"@types/proxyquire": "^1.3.28",
6161
"@types/sinon": "^10.0.0",
6262
"c8": "^7.1.0",
63-
"gts": "^3.0.0",
63+
"gts": "^3.1.0",
6464
"js-yaml": "^4.0.0",
6565
"jsdoc": "^3.6.3",
6666
"jsdoc-fresh": "^1.0.2",
6767
"jsdoc-region-tag": "^1.0.4",
6868
"linkinator": "^2.0.3",
69-
"mocha": "^8.0.0",
69+
"mocha": "^9.2.2",
7070
"null-loader": "^4.0.0",
7171
"p-queue": "^6.6.1",
7272
"pack-n-play": "^1.0.0-2",
7373
"proxyquire": "^2.1.3",
7474
"sinon": "^14.0.0",
7575
"ts-loader": "^8.0.0",
76-
"typescript": "^3.8.3",
76+
"typescript": "^4.6.4",
7777
"webpack-cli": "^4.0.0"
7878
},
7979
"engines": {
80-
"node": ">=10"
80+
"node": ">=12.0.0"
8181
}
8282
}

samples/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"repository": "googleapis/nodejs-datastore",
1010
"engines": {
11-
"node": ">=10"
11+
"node": ">=12.0.0"
1212
},
1313
"scripts": {
1414
"test": "mocha --timeout=600000"

src/entity.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ export namespace entity {
180180
try {
181181
return this.typeCastFunction!(this.value);
182182
} catch (error) {
183-
error.message = `integerTypeCastFunction threw an error:\n\n - ${error.message}`;
183+
(
184+
error as Error
185+
).message = `integerTypeCastFunction threw an error:\n\n - ${
186+
(error as Error).message
187+
}`;
184188
throw error;
185189
}
186190
} else {

src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -611,13 +611,13 @@ class Datastore extends DatastoreRequest {
611611
const gaxOpts = options.gaxOptions || {};
612612

613613
const reqOpts = {
614-
pageSize: gaxOpts.pageSize,
615-
pageToken: gaxOpts.pageToken,
614+
pageSize: (gaxOpts as GetIndexesOptions).pageSize,
615+
pageToken: (gaxOpts as GetIndexesOptions).pageToken,
616616
...options,
617617
};
618618

619-
delete gaxOpts.pageSize;
620-
delete gaxOpts.pageToken;
619+
delete (gaxOpts as GetIndexesOptions).pageSize;
620+
delete (gaxOpts as GetIndexesOptions).pageToken;
621621
delete (reqOpts as CallOptions).autoPaginate;
622622
delete (reqOpts as GetIndexesOptions).gaxOptions;
623623

src/request.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ class DatastoreRequest {
727727
} catch (e) {
728728
// using setImmediate here to make sure this doesn't throw a
729729
// synchronous error
730-
setImmediate(onResultSet, e);
730+
setImmediate(onResultSet, e as Error);
731731
return;
732732
}
733733

@@ -880,7 +880,7 @@ class DatastoreRequest {
880880
// Even a failed rollback should be transparent.
881881
// RE: https://github.com/GoogleCloudPlatform/gcloud-node/pull/1369#discussion_r66833976
882882
}
883-
callback!(err);
883+
callback!(err as Error);
884884
}
885885
});
886886
}

test/entity.ts

+15-6
Original file line numberDiff line numberDiff line change
@@ -1675,8 +1675,11 @@ describe('entity', () => {
16751675
try {
16761676
entity.keyFromKeyProto(keyProtoInvalid);
16771677
} catch (e) {
1678-
assert.strictEqual(e.name, 'InvalidKey');
1679-
assert.strictEqual(e.message, 'Ancestor keys require an id or name.');
1678+
assert.strictEqual((e as Error).name, 'InvalidKey');
1679+
assert.strictEqual(
1680+
(e as Error).message,
1681+
'Ancestor keys require an id or name.'
1682+
);
16801683
done();
16811684
}
16821685
});
@@ -1756,8 +1759,11 @@ describe('entity', () => {
17561759
try {
17571760
entity.keyToKeyProto(key);
17581761
} catch (e) {
1759-
assert.strictEqual(e.name, 'InvalidKey');
1760-
assert.strictEqual(e.message, 'A key should contain at least a kind.');
1762+
assert.strictEqual((e as Error).name, 'InvalidKey');
1763+
assert.strictEqual(
1764+
(e as Error).message,
1765+
'A key should contain at least a kind.'
1766+
);
17611767
done();
17621768
}
17631769
});
@@ -1771,8 +1777,11 @@ describe('entity', () => {
17711777
try {
17721778
entity.keyToKeyProto(key);
17731779
} catch (e) {
1774-
assert.strictEqual(e.name, 'InvalidKey');
1775-
assert.strictEqual(e.message, 'Ancestor keys require an id or name.');
1780+
assert.strictEqual((e as Error).name, 'InvalidKey');
1781+
assert.strictEqual(
1782+
(e as Error).message,
1783+
'Ancestor keys require an id or name.'
1784+
);
17761785
done();
17771786
}
17781787
});

0 commit comments

Comments
 (0)