Skip to content

Commit 2834e93

Browse files
feat!: drop node8 support, support for async iterators (#682)
1 parent e4d9506 commit 2834e93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+10243
-4628
lines changed

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/gts"
3+
}

.eslintrc.yml

-15
This file was deleted.

.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: [8, 10, 12, 13]
12+
node: [10, 12, 13]
1313
steps:
1414
- uses: actions/checkout@v2
1515
- uses: actions/setup-node@v1

.prettierrc

-8
This file was deleted.

.prettierrc.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
module.exports = {
16+
...require('gts/.prettierrc.json')
17+
}

package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"dot-prop": "^5.0.0",
5252
"escape-string-regexp": "^2.0.0",
5353
"extend": "^3.0.2",
54-
"google-gax": "^1.14.2",
54+
"google-gax": "^2.0.1",
5555
"is": "^3.0.1",
5656
"is-utf8": "^0.2.1",
5757
"lodash.snakecase": "^4.1.1",
@@ -63,6 +63,7 @@
6363
"through2": "^3.0.0"
6464
},
6565
"devDependencies": {
66+
"@grpc/grpc-js": "^0.7.5",
6667
"@types/escape-string-regexp": "^1.0.0",
6768
"@types/extend": "^3.0.1",
6869
"@types/is": "0.0.21",
@@ -82,7 +83,8 @@
8283
"eslint-config-prettier": "^6.10.0",
8384
"eslint-plugin-node": "^11.0.0",
8485
"eslint-plugin-prettier": "^3.1.2",
85-
"gts": "^1.1.2",
86+
"google-auth-library": "^6.0.0",
87+
"gts": "2.0.0-alpha.9",
8688
"jsdoc": "^3.6.3",
8789
"jsdoc-fresh": "^1.0.2",
8890
"jsdoc-region-tag": "^1.0.4",
@@ -97,9 +99,9 @@
9799
"power-assert": "^1.6.1",
98100
"prettier": "^1.19.1",
99101
"proxyquire": "^2.0.0",
100-
"sinon": "^9.0.0",
102+
"sinon": "^9.0.1",
101103
"ts-loader": "^6.2.1",
102-
"typescript": "^3.7.0",
104+
"typescript": "^3.8.3",
103105
"uuid": "^7.0.0",
104106
"webpack": "^4.42.0",
105107
"webpack-cli": "^3.3.11"

samples/instances.js

+27-27
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ async function runInstanceOperations(instanceID, clusterID) {
2121
const bigtable = Bigtable();
2222
const instance = bigtable.instance(instanceID);
2323

24-
console.log(`Check Instance Exists`);
24+
console.log('Check Instance Exists');
2525
// [START bigtable_check_instance_exists]
2626
const [instanceExists] = await instance.exists();
2727
// [END bigtable_check_instance_exists]
2828

2929
// Create instance if does not exists
3030
if (!instanceExists) {
31-
console.log(`Creating a PRODUCTION Instance`);
31+
console.log('Creating a PRODUCTION Instance');
3232
// [START bigtable_create_prod_instance]
3333
// Creates a Production Instance with the ID "ssd-instance"
3434
// with cluster id "ssd-cluster", 3 nodes and location us-central1-f
@@ -55,7 +55,7 @@ async function runInstanceOperations(instanceID, clusterID) {
5555
}
5656

5757
console.log(); //for just a new-line
58-
console.log(`Listing Instances:`);
58+
console.log('Listing Instances:');
5959
// [START bigtable_list_instances]
6060
const [instances] = await bigtable.getInstances();
6161
instances.forEach(instance => {
@@ -64,15 +64,15 @@ async function runInstanceOperations(instanceID, clusterID) {
6464
// [END bigtable_list_instances]
6565

6666
console.log(); //for just a new-line
67-
console.log(`Get Instance`);
67+
console.log('Get Instance');
6868
// [START bigtable_get_instance]
6969
const [instances2] = await bigtable.instance(instanceID).get();
7070
console.log(`Instance ID: ${instances2.id}`);
7171
console.log(`Instance Meta: ${JSON.stringify(instances2.metadata)}`);
7272
// [END bigtable_get_instance]
7373

7474
console.log(); //for just a new-line
75-
console.log(`Listing Clusters...`);
75+
console.log('Listing Clusters...');
7676
// [START bigtable_get_clusters]
7777
const instance3 = bigtable.instance(instanceID);
7878
const [clusters] = await instance3.getClusters();
@@ -90,7 +90,7 @@ async function createDevInstance(instanceID, clusterID) {
9090

9191
// [START bigtable_create_dev_instance]
9292
console.log(); //for just a new-line
93-
console.log(`Creating a DEVELOPMENT Instance`);
93+
console.log('Creating a DEVELOPMENT Instance');
9494
// Set options to create an Instance
9595
const options = {
9696
clusters: [
@@ -118,7 +118,7 @@ async function deleteInstance(instanceID) {
118118

119119
console.log(); //for just a new-line
120120
// [START bigtable_delete_instance]
121-
console.log(`Deleting Instance`);
121+
console.log('Deleting Instance');
122122
await instance.delete();
123123
console.log(`Instance deleted: ${instance.id}`);
124124
// [END bigtable_delete_instance]
@@ -130,7 +130,7 @@ async function addCluster(instanceID, clusterID) {
130130
const instance = bigtable.instance(instanceID);
131131
const [instanceExists] = await instance.exists();
132132
if (!instanceExists) {
133-
console.log(`Instance does not exists`);
133+
console.log('Instance does not exists');
134134
} else {
135135
console.log(); //for just a new-line
136136
console.log(`Adding Cluster to Instance ${instance.id}`);
@@ -155,58 +155,58 @@ async function deleteCluster(instanceID, clusterID) {
155155

156156
// [START bigtable_delete_cluster]
157157
console.log(); //for just a new-line
158-
console.log(`Deleting Cluster`);
158+
console.log('Deleting Cluster');
159159
await cluster.delete();
160160
console.log(`Cluster deleted: ${cluster.id}`);
161161
// [END bigtable_delete_cluster]
162162
}
163163

164-
require(`yargs`)
164+
require('yargs')
165165
.demand(1)
166166
.command(
167-
`run`,
168-
`Creates an Instance(type: PRODUCTION) and run basic instance-operations`,
167+
'run',
168+
'Creates an Instance(type: PRODUCTION) and run basic instance-operations',
169169
{},
170170
argv => runInstanceOperations(argv.instance, argv.cluster)
171171
)
172172
.example(
173-
`node $0 run --instance [instanceID] --cluster [clusterID]`,
174-
`Run instance operations`
173+
'node $0 run --instance [instanceID] --cluster [clusterID]',
174+
'Run instance operations'
175175
)
176-
.command(`dev-instance`, `Create Development Instance`, {}, argv =>
176+
.command('dev-instance', 'Create Development Instance', {}, argv =>
177177
createDevInstance(argv.instance, argv.cluster)
178178
)
179179
.example(
180-
`node $0 dev-instance --instance [instanceID]`,
181-
`Create Development Instance`
180+
'node $0 dev-instance --instance [instanceID]',
181+
'Create Development Instance'
182182
)
183-
.command(`del-instance`, `Delete the Instance`, {}, argv =>
183+
.command('del-instance', 'Delete the Instance', {}, argv =>
184184
deleteInstance(argv.instance)
185185
)
186186
.example(
187-
`node $0 del-instance --instance [instanceID]`,
188-
`Delete the Instance.`
187+
'node $0 del-instance --instance [instanceID]',
188+
'Delete the Instance.'
189189
)
190-
.command(`add-cluster`, `Add Cluster`, {}, argv =>
190+
.command('add-cluster', 'Add Cluster', {}, argv =>
191191
addCluster(argv.instance, argv.cluster)
192192
)
193193
.example(
194-
`node $0 add-cluster --instance [instanceID] --cluster [clusterID]`,
195-
`Add Cluster`
194+
'node $0 add-cluster --instance [instanceID] --cluster [clusterID]',
195+
'Add Cluster'
196196
)
197-
.command(`del-cluster`, `Delete the Cluster`, {}, argv =>
197+
.command('del-cluster', 'Delete the Cluster', {}, argv =>
198198
deleteCluster(argv.instance, argv.cluster)
199199
)
200200
.example(
201-
`node $0 del-cluster --instance [instanceID] --cluster [clusterID]`,
202-
`Delete the Cluster`
201+
'node $0 del-cluster --instance [instanceID] --cluster [clusterID]',
202+
'Delete the Cluster'
203203
)
204204
.wrap(120)
205205
.nargs('instance', 1)
206206
.nargs('cluster', 1)
207207
.describe('instance', 'Cloud Bigtable Instance ID')
208208
.describe('cluster', 'Cloud Bigtable Cluster ID')
209209
.recommendCommands()
210-
.epilogue(`For more information, see https://cloud.google.com/bigtable/docs`)
210+
.epilogue('For more information, see https://cloud.google.com/bigtable/docs')
211211
.help()
212212
.strict().argv;

samples/tableadmin.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async function runTableOperations(instanceID, tableID) {
2929
console.log(`Table does not exist. Creating table ${tableID}`);
3030
await table.create();
3131
} else {
32-
console.log(`Table exists.`);
32+
console.log('Table exists.');
3333
}
3434

3535
console.log();
@@ -228,22 +228,22 @@ async function deleteTable(instanceID, tableID) {
228228
require('yargs')
229229
.demand(1)
230230
.command(
231-
`run`,
232-
`Create a table (if does not exist) and run basic table operations.`,
231+
'run',
232+
'Create a table (if does not exist) and run basic table operations.',
233233
{},
234234
argv => runTableOperations(argv.instance, argv.table)
235235
)
236236
.example(
237-
`node $0 run --instance [instanceID] --table [tableID]`,
238-
`Create a table (if does not exist) and run basic table operations.`
237+
'node $0 run --instance [instanceID] --table [tableID]',
238+
'Create a table (if does not exist) and run basic table operations.'
239239
)
240240
.wrap(120)
241-
.command(`delete`, `Delete table.`, {}, argv =>
241+
.command('delete', 'Delete table.', {}, argv =>
242242
deleteTable(argv.instance, argv.table)
243243
)
244244
.example(
245-
`node $0 delete --instance [instanceID] --table [tableID]`,
246-
`Delete a table.`
245+
'node $0 delete --instance [instanceID] --table [tableID]',
246+
'Delete a table.'
247247
)
248248
.wrap(120)
249249
.nargs('instance', 1)
@@ -252,6 +252,6 @@ require('yargs')
252252
.describe('table', 'Cloud Bigtable Table ID')
253253
.demandOption(['instance', 'table'])
254254
.recommendCommands()
255-
.epilogue(`For more information, see https://cloud.google.com/bigtable/docs`)
255+
.epilogue('For more information, see https://cloud.google.com/bigtable/docs')
256256
.help()
257257
.strict().argv;

samples/test/app-profile.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
'use strict';
1616

17-
const uuid = require(`uuid`);
17+
const uuid = require('uuid');
1818
const {describe, it, before, after} = require('mocha');
19-
const Bigtable = require(`@google-cloud/bigtable`);
19+
const Bigtable = require('@google-cloud/bigtable');
2020
const bigtable = new Bigtable();
2121

2222
const INSTANCE_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules
2323
const CLUSTER_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules
24-
const APP_PROFILE_ID = `my-app-profile`;
24+
const APP_PROFILE_ID = 'my-app-profile';
2525

2626
const appProfileSnippets = require('./app-profile.js');
2727

samples/test/cluster.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
'use strict';
1616

17-
const uuid = require(`uuid`);
17+
const uuid = require('uuid');
1818
const {describe, it, before, after} = require('mocha');
19-
const Bigtable = require(`@google-cloud/bigtable`);
19+
const Bigtable = require('@google-cloud/bigtable');
2020
const bigtable = new Bigtable();
2121

2222
const INSTANCE_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules

samples/test/family.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
'use strict';
1616

17-
const uuid = require(`uuid`);
17+
const uuid = require('uuid');
1818
const {describe, it, before, after} = require('mocha');
19-
const Bigtable = require(`@google-cloud/bigtable`);
19+
const Bigtable = require('@google-cloud/bigtable');
2020
const bigtable = new Bigtable();
2121

2222
const INSTANCE_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules

samples/test/filters.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const uuid = require(`uuid`);
17+
const uuid = require('uuid');
1818
const snapshot = require('snap-shot-it');
1919
const {assert} = require('chai');
2020
const {describe, it, before, after} = require('mocha');
@@ -23,7 +23,7 @@ const {Bigtable} = require('@google-cloud/bigtable');
2323

2424
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2525

26-
const INSTANCE_ID = `nodejs-bigtable-samples-keepme`;
26+
const INSTANCE_ID = 'nodejs-bigtable-samples-keepme';
2727
const TABLE_ID = `mobile-time-series-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules
2828

2929
describe('filters', async () => {
@@ -284,7 +284,7 @@ describe('filters', async () => {
284284
const stdout = execSync(
285285
`node filterSnippets ${INSTANCE_ID} ${TABLE_ID} filterBlockAll`
286286
);
287-
const result = ``;
287+
const result = '';
288288
assert.equal(stdout, result);
289289
});
290290

samples/test/instance.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
'use strict';
1616

17-
const uuid = require(`uuid`);
17+
const uuid = require('uuid');
1818
const {describe, it, after} = require('mocha');
19-
const Bigtable = require(`@google-cloud/bigtable`);
19+
const Bigtable = require('@google-cloud/bigtable');
2020
const bigtable = new Bigtable();
2121

2222
const INSTANCE_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules

samples/test/reads.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
'use strict';
1616

17-
const uuid = require(`uuid`);
17+
const uuid = require('uuid');
1818
const snapshot = require('snap-shot-it');
1919
const {describe, it, before, after} = require('mocha');
2020
const cp = require('child_process');
2121
const {Bigtable} = require('@google-cloud/bigtable');
2222

2323
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2424

25-
const INSTANCE_ID = `nodejs-bigtable-samples-keepme`;
25+
const INSTANCE_ID = 'nodejs-bigtable-samples-keepme';
2626
const TABLE_ID = `mobile-time-series-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules
2727

2828
describe('reads', async () => {

0 commit comments

Comments
 (0)