diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 1b3626833..d1e8b5e6e 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 25251dbb7..f447b84ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg deleted file mode 100644 index 4a5e7f9f1..000000000 --- a/.kokoro/continuous/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-bigtable/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node10/docs.cfg b/.kokoro/continuous/node10/docs.cfg deleted file mode 100644 index b9ce13b56..000000000 --- a/.kokoro/continuous/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/.kokoro/docs.sh" -} diff --git a/.kokoro/continuous/node10/test.cfg b/.kokoro/continuous/node10/test.cfg deleted file mode 100644 index 609c0cf0a..000000000 --- a/.kokoro/continuous/node10/test.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} diff --git a/.kokoro/continuous/node8/common.cfg b/.kokoro/continuous/node8/common.cfg deleted file mode 100644 index ecd9bac21..000000000 --- a/.kokoro/continuous/node8/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-bigtable/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node8/test.cfg b/.kokoro/continuous/node8/test.cfg deleted file mode 100644 index e69de29bb..000000000 diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg deleted file mode 100644 index 4a5e7f9f1..000000000 --- a/.kokoro/presubmit/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-bigtable/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node10/docs.cfg b/.kokoro/presubmit/node10/docs.cfg deleted file mode 100644 index b9ce13b56..000000000 --- a/.kokoro/presubmit/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/.kokoro/docs.sh" -} diff --git a/.kokoro/presubmit/node10/lint.cfg b/.kokoro/presubmit/node10/lint.cfg deleted file mode 100644 index fe841af51..000000000 --- a/.kokoro/presubmit/node10/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/.kokoro/lint.sh" -} diff --git a/.kokoro/presubmit/node10/test.cfg b/.kokoro/presubmit/node10/test.cfg deleted file mode 100644 index e69de29bb..000000000 diff --git a/.kokoro/presubmit/node8/common.cfg b/.kokoro/presubmit/node8/common.cfg deleted file mode 100644 index ecd9bac21..000000000 --- a/.kokoro/presubmit/node8/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-bigtable/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node8/test.cfg b/.kokoro/presubmit/node8/test.cfg deleted file mode 100644 index e69de29bb..000000000 diff --git a/package.json b/package.json index c48f6543c..5238bccd4 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "dot-prop": "^6.0.0", "escape-string-regexp": "^4.0.0", "extend": "^3.0.2", - "google-gax": "^2.29.5", + "google-gax": "^3.0.1", "grpc-gcp": "0.4.2", "is": "^3.0.1", "is-utf8": "^0.2.1", @@ -75,24 +75,24 @@ "@types/uuid": "^8.0.0", "c8": "^7.1.0", "codecov": "^3.6.5", - "gts": "^3.0.0", + "gts": "^3.1.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.0.2", "pack-n-play": "^1.0.0-2", "proxyquire": "^2.0.0", "sinon": "^14.0.0", "ts-loader": "^9.0.0", - "typescript": "^3.8.3", + "typescript": "^4.6.4", "uuid": "^8.0.0", "webpack": "^5.0.0", "webpack-cli": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=12.0.0" } } diff --git a/samples/package.json b/samples/package.json index abbbbf654..99aa8a40e 100644 --- a/samples/package.json +++ b/samples/package.json @@ -11,7 +11,7 @@ "api-reference-doc-snippets/*.js" ], "engines": { - "node": ">=12" + "node": ">=12.0.0" }, "dependencies": { "@google-cloud/bigtable": "^3.12.0", diff --git a/src/cluster.ts b/src/cluster.ts index 11479e699..9235bf7e8 100644 --- a/src/cluster.ts +++ b/src/cluster.ts @@ -89,7 +89,7 @@ export interface BasicClusterConfig { } export interface CreateBackupConfig extends ModifiableBackupFields { - table: string | Table; + table?: string | Table; gaxOptions?: CallOptions; } @@ -487,13 +487,13 @@ Please use the format 'my-cluster' or '${instance.name}/clusters/my-cluster'.`); const reqOpts: google.bigtable.admin.v2.IListBackupsRequest = { parent: this.name, - pageSize: gaxOpts.pageSize, - pageToken: gaxOpts.pageToken, + pageSize: (gaxOpts as GetBackupsOptions).pageSize, + pageToken: (gaxOpts as GetBackupsOptions).pageToken, ...options, }; - delete gaxOpts.pageSize; - delete gaxOpts.pageToken; + delete (gaxOpts as GetBackupsOptions).pageSize; + delete (gaxOpts as GetBackupsOptions).pageToken; delete (reqOpts as CallOptions).autoPaginate; delete (reqOpts as GetBackupsOptions).gaxOptions; diff --git a/src/instance.ts b/src/instance.ts index 337262b6e..c54c59790 100644 --- a/src/instance.ts +++ b/src/instance.ts @@ -703,15 +703,15 @@ Please use the format 'my-instance' or '${bigtable.projectName}/instances/my-ins parent: this.name, }; - if (is.number(gaxOpts.pageSize)) { - reqOpts.pageSize = gaxOpts.pageSize; + if (is.number((gaxOpts as GetBackupsOptions).pageSize)) { + reqOpts.pageSize = (gaxOpts as GetBackupsOptions).pageSize; } - delete gaxOpts.pageSize; + delete (gaxOpts as GetBackupsOptions).pageSize; - if (gaxOpts.pageToken) { - reqOpts.pageToken = gaxOpts.pageToken; + if ((gaxOpts as GetBackupsOptions).pageToken) { + reqOpts.pageToken = (gaxOpts as GetBackupsOptions).pageToken; } - delete gaxOpts.pageToken; + delete (gaxOpts as GetBackupsOptions).pageToken; this.bigtable.request( { @@ -777,15 +777,15 @@ Please use the format 'my-instance' or '${bigtable.projectName}/instances/my-ins }; const gaxOpts = extend(true, {}, gaxOptions); - if (is.number(gaxOpts.pageSize)) { - reqOpts.pageSize = gaxOpts.pageSize; + if (is.number((gaxOpts as GetBackupsOptions).pageSize)) { + reqOpts.pageSize = (gaxOpts as GetBackupsOptions).pageSize; } - delete gaxOpts.pageSize; + delete (gaxOpts as GetBackupsOptions).pageSize; - if (gaxOpts.pageToken) { - reqOpts.pageToken = gaxOpts.pageToken; + if ((gaxOpts as GetBackupsOptions).pageToken) { + reqOpts.pageToken = (gaxOpts as GetBackupsOptions).pageToken; } - delete gaxOpts.pageToken; + delete (gaxOpts as GetBackupsOptions).pageToken; // eslint-disable-next-line @typescript-eslint/no-this-alias const self = this; @@ -1103,13 +1103,13 @@ Please use the format 'my-instance' or '${bigtable.projectName}/instances/my-ins reqOpts = extend( {}, { - pageSize: gaxOpts.pageSize, - pageToken: gaxOpts.pageToken, + pageSize: (gaxOpts as GetBackupsOptions).pageSize, + pageToken: (gaxOpts as GetBackupsOptions).pageToken, }, reqOpts ); - delete gaxOpts.pageSize; - delete gaxOpts.pageToken; + delete (gaxOpts as GetBackupsOptions).pageSize; + delete (gaxOpts as GetBackupsOptions).pageToken; } delete (reqOpts as GetTablesOptions).gaxOptions; @@ -1184,13 +1184,13 @@ Please use the format 'my-instance' or '${bigtable.projectName}/instances/my-ins reqOpts = extend( {}, { - pageSize: gaxOpts.pageSize, - pageToken: gaxOpts.pageToken, + pageSize: (gaxOpts as GetBackupsOptions).pageSize, + pageToken: (gaxOpts as GetBackupsOptions).pageToken, }, reqOpts ); - delete gaxOpts.pageSize; - delete gaxOpts.pageToken; + delete (gaxOpts as GetBackupsOptions).pageSize; + delete (gaxOpts as GetBackupsOptions).pageToken; } // eslint-disable-next-line @typescript-eslint/no-this-alias diff --git a/system-test/bigtable.ts b/system-test/bigtable.ts index 5ea0c5a5b..7d1d9be59 100644 --- a/system-test/bigtable.ts +++ b/system-test/bigtable.ts @@ -279,7 +279,11 @@ describe('Bigtable', () => { await operation.promise(); throw new Error('Cluster creation should not have succeeded'); } catch (e) { - assert(e.message.includes('default keys and CMEKs are not allowed')); + assert( + (e as Error).message.includes( + 'default keys and CMEKs are not allowed' + ) + ); } }); }); @@ -913,7 +917,7 @@ describe('Bigtable', () => { ]; await TABLE.insert(entries); const rows: Row[] = []; - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const stream = TABLE.createReadStream() .on('error', reject) .on('data', row => { diff --git a/system-test/install.ts b/system-test/install.ts index 5ff2e2ad9..9beb2ba62 100644 --- a/system-test/install.ts +++ b/system-test/install.ts @@ -50,8 +50,8 @@ describe('📦 pack-n-play test', () => { await packNTest(options); } catch (e) { // all of the actionable information is on the output attribute - if (e.output) { - e.message += 'output: ' + e.output; + if ((e as any).output) { + (e as any).message += 'output: ' + (e as any).output; } throw e; } diff --git a/test/cluster.ts b/test/cluster.ts index 90c36a5e2..ebd96061d 100644 --- a/test/cluster.ts +++ b/test/cluster.ts @@ -20,6 +20,13 @@ import {PassThrough, Readable} from 'stream'; import {CallOptions} from 'google-gax'; import {PreciseDate} from '@google-cloud/precise-date'; +export interface Options { + nodes?: Number; + gaxOptions?: { + timeout: number; + }; +} + let promisified = false; const fakePromisify = Object.assign({}, promisify, { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -987,7 +994,7 @@ describe('Bigtable/Cluster', () => { defaultStorageType: 'exellent_type', }; - const expectedReqOpts = Object.assign( + const expectedReqOpts: Options = Object.assign( {}, {name: CLUSTER_NAME, serveNodes: options.nodes}, options diff --git a/test/instance.ts b/test/instance.ts index 0f93d949a..163cf2706 100644 --- a/test/instance.ts +++ b/test/instance.ts @@ -34,6 +34,7 @@ import {PassThrough} from 'stream'; import * as pumpify from 'pumpify'; import {FakeCluster} from '../system-test/common'; import {RestoreTableConfig} from '../src/backup'; +import {Options} from './cluster'; const sandbox = sinon.createSandbox(); @@ -904,7 +905,7 @@ describe('Bigtable/Instance', () => { const pageToken = 'token'; const gaxOptions = {pageToken, timeout: 1000}; const expectedGaxOpts = {timeout: 1000}; - const expectedReqOpts = Object.assign( + const expectedReqOpts: Options = Object.assign( {}, {gaxOptions}, {parent: instance.name}, @@ -926,7 +927,7 @@ describe('Bigtable/Instance', () => { const pageSize = 3; const gaxOptions = {pageSize, timeout: 1000}; const expectedGaxOpts = {timeout: 1000}; - const expectedReqOpts = Object.assign( + const expectedReqOpts: Options = Object.assign( {}, {gaxOptions}, {parent: instance.name}, @@ -1010,7 +1011,7 @@ describe('Bigtable/Instance', () => { const pageToken = 'token'; const gaxOptions = {pageToken, timeout: 1000}; const expectedGaxOpts = {timeout: 1000}; - const expectedReqOpts = Object.assign( + const expectedReqOpts: Options = Object.assign( {}, {gaxOptions}, {parent: instance.name}, @@ -1033,7 +1034,7 @@ describe('Bigtable/Instance', () => { const pageSize = 3; const gaxOptions = {pageSize, timeout: 1000}; const expectedGaxOpts = {timeout: 1000}; - const expectedReqOpts = Object.assign( + const expectedReqOpts: Options = Object.assign( {}, {gaxOptions}, {parent: instance.name}, @@ -1436,7 +1437,7 @@ describe('Bigtable/Instance', () => { const pageToken = 'token'; const gaxOptions = {pageSize, pageToken, timeout: 1000}; const expectedGaxOpts = {timeout: 1000}; - const expectedReqOpts = Object.assign( + const expectedReqOpts: Options = Object.assign( {}, {gaxOptions}, {