Skip to content

build!: update library to use Node 12 #945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.
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.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"arrify": "^2.0.1",
"concat-stream": "^2.0.0",
"extend": "^3.0.2",
"google-gax": "^2.24.1",
"google-gax": "^3.0.1",
"is": "^3.3.0",
"split-array-stream": "^2.0.0",
"stream-events": "^1.0.5"
Expand All @@ -60,23 +60,23 @@
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^10.0.0",
"c8": "^7.1.0",
"gts": "^3.0.0",
"gts": "^3.1.0",
"js-yaml": "^4.0.0",
"jsdoc": "^3.6.3",
"jsdoc-fresh": "^1.0.2",
"jsdoc-region-tag": "^1.0.4",
"linkinator": "^2.0.3",
"mocha": "^8.0.0",
"mocha": "^9.2.2",
"null-loader": "^4.0.0",
"p-queue": "^6.6.1",
"pack-n-play": "^1.0.0-2",
"proxyquire": "^2.1.3",
"sinon": "^14.0.0",
"ts-loader": "^8.0.0",
"typescript": "^3.8.3",
"typescript": "^4.6.4",
"webpack-cli": "^4.0.0"
},
"engines": {
"node": ">=10"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"repository": "googleapis/nodejs-datastore",
"engines": {
"node": ">=10"
"node": ">=12.0.0"
},
"scripts": {
"test": "mocha --timeout=600000"
Expand Down
6 changes: 5 additions & 1 deletion src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ export namespace entity {
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
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,13 @@ class Datastore extends DatastoreRequest {
const gaxOpts = options.gaxOptions || {};

const reqOpts = {
pageSize: gaxOpts.pageSize,
pageToken: gaxOpts.pageToken,
pageSize: (gaxOpts as GetIndexesOptions).pageSize,
pageToken: (gaxOpts as GetIndexesOptions).pageToken,
...options,
};

delete gaxOpts.pageSize;
delete gaxOpts.pageToken;
delete (gaxOpts as GetIndexesOptions).pageSize;
delete (gaxOpts as GetIndexesOptions).pageToken;
delete (reqOpts as CallOptions).autoPaginate;
delete (reqOpts as GetIndexesOptions).gaxOptions;

Expand Down
4 changes: 2 additions & 2 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class DatastoreRequest {
} catch (e) {
// using setImmediate here to make sure this doesn't throw a
// synchronous error
setImmediate(onResultSet, e);
setImmediate(onResultSet, e as Error);
return;
}

Expand Down Expand Up @@ -880,7 +880,7 @@ class DatastoreRequest {
// Even a failed rollback should be transparent.
// RE: https://github.com/GoogleCloudPlatform/gcloud-node/pull/1369#discussion_r66833976
}
callback!(err);
callback!(err as Error);
}
});
}
Expand Down
21 changes: 15 additions & 6 deletions test/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,11 @@ describe('entity', () => {
try {
entity.keyFromKeyProto(keyProtoInvalid);
} catch (e) {
assert.strictEqual(e.name, 'InvalidKey');
assert.strictEqual(e.message, 'Ancestor keys require an id or name.');
assert.strictEqual((e as Error).name, 'InvalidKey');
assert.strictEqual(
(e as Error).message,
'Ancestor keys require an id or name.'
);
done();
}
});
Expand Down Expand Up @@ -1756,8 +1759,11 @@ describe('entity', () => {
try {
entity.keyToKeyProto(key);
} catch (e) {
assert.strictEqual(e.name, 'InvalidKey');
assert.strictEqual(e.message, 'A key should contain at least a kind.');
assert.strictEqual((e as Error).name, 'InvalidKey');
assert.strictEqual(
(e as Error).message,
'A key should contain at least a kind.'
);
done();
}
});
Expand All @@ -1771,8 +1777,11 @@ describe('entity', () => {
try {
entity.keyToKeyProto(key);
} catch (e) {
assert.strictEqual(e.name, 'InvalidKey');
assert.strictEqual(e.message, 'Ancestor keys require an id or name.');
assert.strictEqual((e as Error).name, 'InvalidKey');
assert.strictEqual(
(e as Error).message,
'Ancestor keys require an id or name.'
);
done();
}
});
Expand Down