From 682d4441e9437f437bdd8c5be7fc70ec76ca55ed Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 11:00:27 -0400 Subject: [PATCH 01/10] Run the migration script --- .github/.OwlBot.lock.yaml | 5 +- .kokoro/continuous/node14/common.cfg | 24 ------ .kokoro/continuous/node14/lint.cfg | 4 - .kokoro/continuous/node14/samples-test.cfg | 12 --- .kokoro/continuous/node14/system-test.cfg | 12 --- .kokoro/continuous/node14/test.cfg | 0 .kokoro/presubmit/node14/common.cfg | 24 ------ .kokoro/presubmit/node14/samples-test.cfg | 12 --- .kokoro/presubmit/node14/system-test.cfg | 12 --- .kokoro/presubmit/node14/test.cfg | 0 migrate-to-node-18.cjs | 89 ++++++++++++++++++++++ package.json | 54 ++++++------- samples/package.json | 4 +- 13 files changed, 120 insertions(+), 132 deletions(-) delete mode 100644 .kokoro/continuous/node14/common.cfg delete mode 100644 .kokoro/continuous/node14/lint.cfg delete mode 100644 .kokoro/continuous/node14/samples-test.cfg delete mode 100644 .kokoro/continuous/node14/system-test.cfg delete mode 100644 .kokoro/continuous/node14/test.cfg delete mode 100644 .kokoro/presubmit/node14/common.cfg delete mode 100644 .kokoro/presubmit/node14/samples-test.cfg delete mode 100644 .kokoro/presubmit/node14/system-test.cfg delete mode 100644 .kokoro/presubmit/node14/test.cfg create mode 100644 migrate-to-node-18.cjs diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 1cab9caf1..153e76717 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,4 +1,4 @@ -# Copyright 2024 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,5 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest - digest: sha256:22e41dd7cd82683fa338b647abcc3a29ddb1b17e800b089adc0bec0a3175312c -# created: 2024-10-30T16:51:59.982020867Z + digest: sha256:0d39e59663287ae929c1d4ccf8ebf7cef9946826c9b86eda7e85d8d752dbb584 diff --git a/.kokoro/continuous/node14/common.cfg b/.kokoro/continuous/node14/common.cfg deleted file mode 100644 index 4c46233e1..000000000 --- a/.kokoro/continuous/node14/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-datastore/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node14/lint.cfg b/.kokoro/continuous/node14/lint.cfg deleted file mode 100644 index 231917641..000000000 --- a/.kokoro/continuous/node14/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/.kokoro/lint.sh" -} diff --git a/.kokoro/continuous/node14/samples-test.cfg b/.kokoro/continuous/node14/samples-test.cfg deleted file mode 100644 index 252bf9e08..000000000 --- a/.kokoro/continuous/node14/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/continuous/node14/system-test.cfg b/.kokoro/continuous/node14/system-test.cfg deleted file mode 100644 index 773b10025..000000000 --- a/.kokoro/continuous/node14/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/continuous/node14/test.cfg b/.kokoro/continuous/node14/test.cfg deleted file mode 100644 index e69de29bb..000000000 diff --git a/.kokoro/presubmit/node14/common.cfg b/.kokoro/presubmit/node14/common.cfg deleted file mode 100644 index 4c46233e1..000000000 --- a/.kokoro/presubmit/node14/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-datastore/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node14/samples-test.cfg b/.kokoro/presubmit/node14/samples-test.cfg deleted file mode 100644 index 252bf9e08..000000000 --- a/.kokoro/presubmit/node14/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/presubmit/node14/system-test.cfg b/.kokoro/presubmit/node14/system-test.cfg deleted file mode 100644 index 773b10025..000000000 --- a/.kokoro/presubmit/node14/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/presubmit/node14/test.cfg b/.kokoro/presubmit/node14/test.cfg deleted file mode 100644 index e69de29bb..000000000 diff --git a/migrate-to-node-18.cjs b/migrate-to-node-18.cjs new file mode 100644 index 000000000..246c74cf8 --- /dev/null +++ b/migrate-to-node-18.cjs @@ -0,0 +1,89 @@ +const path = require('path'); +const fs = require('fs'); +const execSync = require('child_process').execSync; +const yaml = require('js-yaml'); + +const COPYRIGHT_HEADER = `# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License.` +const NODE_VERSION = '18'; +const PREV_NODE_VERSION = '14'; +const NEW_POST_PROCESSOR_SHA = "sha256:0d39e59663287ae929c1d4ccf8ebf7cef9946826c9b86eda7e85d8d752dbb584" +async function main() { + // Grab package.json + const jsonPath = path.join(__dirname, 'package.json').toString(); + let packageJson = fs.readFileSync(jsonPath, 'utf8'); + packageJson = JSON.parse(packageJson); + + console.log('updating engines field...'); + packageJson.engines.node = `>=${NODE_VERSION}`; + fs.writeFileSync(jsonPath, JSON.stringify(packageJson, null, 2)); + + console.log('updating all dependencies to latest'); + if (packageJson.dependencies) { + for (const dep of Object.keys(packageJson.dependencies)) { + if (dep === "google-auth-library" || dep === "gaxios" || dep === "google-gax") { + execSync(`npm i ${dep}@rc --engines-strict`); + } else { + console.log(`npm i ${dep}@latest --engines-strict`); + execSync(`npm i ${dep}@latest --engines-strict`); + } + } + } + if (packageJson.devDependencies) { + for (const dep of Object.keys(packageJson.devDependencies)) { + console.log(`npm i ${dep}@latest -D --engines-strict`); + execSync(`npm i ${dep}@latest -D --engines-strict`); + } + } + + console.log('updating post-processor to latest'); + const owlbotYamlPath = "./.github/.Owlbot.lock.yaml"; + const yamlData = fs.readFileSync(owlbotYamlPath, 'utf8'); + let dockerFile = (yaml.load(yamlData)); + dockerFile.docker.digest = NEW_POST_PROCESSOR_SHA; + fs.writeFileSync(owlbotYamlPath, `${COPYRIGHT_HEADER}\n${yaml.dump(dockerFile)}`); + + let samplesPackageJson; + let samplesJsonPath; + try { + samplesJsonPath = path + .join(__dirname, 'samples', 'package.json') + .toString(); + samplesPackageJson = fs.readFileSync(samplesJsonPath, 'utf8'); + samplesPackageJson = JSON.parse(samplesPackageJson); + } catch (err) { + console.log( + 'Repo does not have a samples directory; skipping updating samples' + ); + } + + if (samplesPackageJson) { + // Update engines field + console.log('updating samples engines field...'); + samplesPackageJson.engines.node = `>=${NODE_VERSION}`; + fs.writeFileSync( + samplesJsonPath, + JSON.stringify(samplesPackageJson, null, 2) + ); + } + + execSync( + `rm -rf .kokoro/continuous/node${PREV_NODE_VERSION} .kokoro/presubmit/node${PREV_NODE_VERSION}` + ); + execSync( + `npm dist-tag add ${packageJson.name}@${packageJson.version} legacy-${PREV_NODE_VERSION} --registry=https://wombat-dressing-room.appspot.com/` + ); +} + +main(); diff --git a/package.json b/package.json index 409bdfea3..0e271c253 100644 --- a/package.json +++ b/package.json @@ -41,45 +41,45 @@ "precompile": "gts clean" }, "dependencies": { - "@google-cloud/promisify": "^4.0.0", - "arrify": "^2.0.1", + "@google-cloud/promisify": "^5.0.0", + "arrify": "^3.0.0", "async-mutex": "^0.5.0", "concat-stream": "^2.0.0", "extend": "^3.0.2", - "google-gax": "^4.0.5", + "google-gax": "^5.0.0-rc.3", "is": "^3.3.0", "split-array-stream": "^2.0.0", "stream-events": "^1.0.5" }, "devDependencies": { - "@google-cloud/storage": "^7.0.1", - "@types/extend": "^3.0.1", - "@types/is": "0.0.25", - "@types/js-yaml": "^4.0.0", - "@types/mocha": "^9.0.0", - "@types/node": "^20.4.9", - "@types/proxyquire": "^1.3.28", - "@types/sinon": "^17.0.0", - "async": "^3.2.4", - "c8": "^9.0.0", - "gapic-tools": "^0.4.0", - "gts": "^5.0.0", - "js-yaml": "^4.0.0", - "jsdoc": "^4.0.0", + "@google-cloud/storage": "^7.15.2", + "@types/extend": "^3.0.4", + "@types/is": "^0.0.25", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.10", + "@types/node": "^22.13.10", + "@types/proxyquire": "^1.3.31", + "@types/sinon": "^17.0.4", + "async": "^3.2.6", + "c8": "^10.1.3", + "gapic-tools": "^1.0.1", + "gts": "^6.0.2", + "js-yaml": "^4.1.0", + "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", - "linkinator": "^3.0.0", - "mocha": "^9.2.2", - "null-loader": "^4.0.0", - "p-queue": "^6.6.1", - "pack-n-play": "^2.0.0", + "linkinator": "^6.1.2", + "mocha": "^11.1.0", + "null-loader": "^4.0.1", + "p-queue": "^8.1.0", + "pack-n-play": "^3.0.0", "proxyquire": "^2.1.3", - "sinon": "17.0.0", - "ts-loader": "^8.0.0", - "typescript": "^5.1.6", - "webpack-cli": "^5.0.0" + "sinon": "^19.0.2", + "ts-loader": "^9.5.2", + "typescript": "^5.8.2", + "webpack-cli": "^6.0.1" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } } diff --git a/samples/package.json b/samples/package.json index 44055e1df..863f02dc0 100644 --- a/samples/package.json +++ b/samples/package.json @@ -8,7 +8,7 @@ ], "repository": "googleapis/nodejs-datastore", "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "scripts": { "test": "mocha --timeout=600000" @@ -21,4 +21,4 @@ "chai": "^4.2.0", "mocha": "^8.0.0" } -} +} \ No newline at end of file From bf11da0cf341810f1eb08249c7df19ab3fdb00cd Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 11:00:47 -0400 Subject: [PATCH 02/10] Add files to include in compilation --- tsconfig.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index c78f1c884..a4b71611d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,10 @@ "src/**/*.ts", "test/*.ts", "test/**/*.ts", - "system-test/*.ts" + "system-test/*.ts", + "mock-server/datastore-server.ts", + "src/v1/datastore_client_config.json", + "protos/protos.json", + "src/v1/datastore_admin_client_config.json" ] } From cdfb68679808f8affeeee04371e55cf797ee3ea2 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 11:10:51 -0400 Subject: [PATCH 03/10] Ran the linter --- mock-server/datastore-server.ts | 6 +- protos/protos.d.ts | 74 ++-- protos/protos.js | 2 +- samples/concepts.js | 24 +- samples/queryFilterOr.js | 2 +- samples/tasks.js | 10 +- src/aggregate.ts | 4 +- src/entity.ts | 36 +- src/filter.ts | 2 +- src/index-class.ts | 14 +- src/index.ts | 44 +-- src/query.ts | 14 +- src/request.ts | 82 ++--- src/transaction.ts | 54 +-- src/utils/entity/buildEntityProto.ts | 2 +- src/utils/entity/extendExcludeFromIndexes.ts | 6 +- src/v1/datastore_admin_client.ts | 134 +++---- src/v1/datastore_client.ts | 92 ++--- system-test/datastore.ts | 144 ++++---- system-test/install.ts | 4 +- test/entity.ts | 86 ++--- test/entity/buildEntityProto.ts | 4 +- test/entity/excludeIndexesAndBuildProto.ts | 28 +- test/entity/extendExcludeFromIndexes.ts | 4 +- test/entity/findLargeProperties_.ts | 2 +- .../client-initialization-testing.ts | 10 +- test/gapic-mocks/commit.ts | 8 +- test/gapic-mocks/error-mocks.ts | 2 +- test/gapic-mocks/handwritten-errors.ts | 8 +- test/gapic-mocks/runQuery.ts | 8 +- test/gapic_datastore_admin_v1.ts | 330 +++++++++--------- test/gapic_datastore_v1.ts | 230 ++++++------ test/index.ts | 144 ++++---- test/query.ts | 47 +-- test/request.ts | 60 ++-- test/transaction.ts | 212 +++++------ 36 files changed, 968 insertions(+), 965 deletions(-) diff --git a/mock-server/datastore-server.ts b/mock-server/datastore-server.ts index 2379f525b..c2e1ee5f2 100644 --- a/mock-server/datastore-server.ts +++ b/mock-server/datastore-server.ts @@ -21,7 +21,7 @@ const GAX_PROTOS_DIR = resolve( // @ts-ignore // eslint-disable-next-line n/no-extraneous-require dirname(require.resolve('google-gax')), - '../protos' + '../protos', ); const grpc = require('@grpc/grpc-js'); @@ -42,7 +42,7 @@ const descriptor = grpc.loadPackageDefinition(packageDefinition); */ function grpcEndpoint( call: {}, - callback: (arg1: string | null, arg2: {}) => {} + callback: (arg1: string | null, arg2: {}) => {}, ) { // SET A BREAKPOINT HERE AND EXPLORE `call` TO SEE THE REQUEST. callback(null, {message: 'Hello'}); @@ -62,6 +62,6 @@ export function startServer(cb: () => void) { () => { console.log('server started'); cb(); - } + }, ); } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 4ca4f6b53..07328fe2a 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -3185,7 +3185,7 @@ export namespace google { stringValue?: (string|null); /** Value blobValue */ - blobValue?: (Uint8Array|string|null); + blobValue?: (Uint8Array|Buffer|string|null); /** Value geoPointValue */ geoPointValue?: (google.type.ILatLng|null); @@ -3234,7 +3234,7 @@ export namespace google { public stringValue?: (string|null); /** Value blobValue. */ - public blobValue?: (Uint8Array|string|null); + public blobValue?: (Uint8Array|Buffer|string|null); /** Value geoPointValue. */ public geoPointValue?: (google.type.ILatLng|null); @@ -3451,7 +3451,7 @@ export namespace google { updateTime?: (google.protobuf.ITimestamp|null); /** EntityResult cursor */ - cursor?: (Uint8Array|string|null); + cursor?: (Uint8Array|Buffer|string|null); } /** Represents an EntityResult. */ @@ -3476,7 +3476,7 @@ export namespace google { public updateTime?: (google.protobuf.ITimestamp|null); /** EntityResult cursor. */ - public cursor: (Uint8Array|string); + public cursor: (Uint8Array|Buffer|string); /** * Creates a new EntityResult instance using the specified properties. @@ -3586,10 +3586,10 @@ export namespace google { distinctOn?: (google.datastore.v1.IPropertyReference[]|null); /** Query startCursor */ - startCursor?: (Uint8Array|string|null); + startCursor?: (Uint8Array|Buffer|string|null); /** Query endCursor */ - endCursor?: (Uint8Array|string|null); + endCursor?: (Uint8Array|Buffer|string|null); /** Query offset */ offset?: (number|null); @@ -3626,10 +3626,10 @@ export namespace google { public distinctOn: google.datastore.v1.IPropertyReference[]; /** Query startCursor. */ - public startCursor: (Uint8Array|string); + public startCursor: (Uint8Array|Buffer|string); /** Query endCursor. */ - public endCursor: (Uint8Array|string); + public endCursor: (Uint8Array|Buffer|string); /** Query offset. */ public offset: number; @@ -5248,7 +5248,7 @@ export namespace google { value?: (google.datastore.v1.IValue|null); /** GqlQueryParameter cursor */ - cursor?: (Uint8Array|string|null); + cursor?: (Uint8Array|Buffer|string|null); } /** Represents a GqlQueryParameter. */ @@ -5264,7 +5264,7 @@ export namespace google { public value?: (google.datastore.v1.IValue|null); /** GqlQueryParameter cursor. */ - public cursor?: (Uint8Array|string|null); + public cursor?: (Uint8Array|Buffer|string|null); /** GqlQueryParameter parameterType. */ public parameterType?: ("value"|"cursor"); @@ -5354,7 +5354,7 @@ export namespace google { skippedResults?: (number|null); /** QueryResultBatch skippedCursor */ - skippedCursor?: (Uint8Array|string|null); + skippedCursor?: (Uint8Array|Buffer|string|null); /** QueryResultBatch entityResultType */ entityResultType?: (google.datastore.v1.EntityResult.ResultType|keyof typeof google.datastore.v1.EntityResult.ResultType|null); @@ -5363,7 +5363,7 @@ export namespace google { entityResults?: (google.datastore.v1.IEntityResult[]|null); /** QueryResultBatch endCursor */ - endCursor?: (Uint8Array|string|null); + endCursor?: (Uint8Array|Buffer|string|null); /** QueryResultBatch moreResults */ moreResults?: (google.datastore.v1.QueryResultBatch.MoreResultsType|keyof typeof google.datastore.v1.QueryResultBatch.MoreResultsType|null); @@ -5388,7 +5388,7 @@ export namespace google { public skippedResults: number; /** QueryResultBatch skippedCursor. */ - public skippedCursor: (Uint8Array|string); + public skippedCursor: (Uint8Array|Buffer|string); /** QueryResultBatch entityResultType. */ public entityResultType: (google.datastore.v1.EntityResult.ResultType|keyof typeof google.datastore.v1.EntityResult.ResultType); @@ -5397,7 +5397,7 @@ export namespace google { public entityResults: google.datastore.v1.IEntityResult[]; /** QueryResultBatch endCursor. */ - public endCursor: (Uint8Array|string); + public endCursor: (Uint8Array|Buffer|string); /** QueryResultBatch moreResults. */ public moreResults: (google.datastore.v1.QueryResultBatch.MoreResultsType|keyof typeof google.datastore.v1.QueryResultBatch.MoreResultsType); @@ -5824,7 +5824,7 @@ export namespace google { deferred?: (google.datastore.v1.IKey[]|null); /** LookupResponse transaction */ - transaction?: (Uint8Array|string|null); + transaction?: (Uint8Array|Buffer|string|null); /** LookupResponse readTime */ readTime?: (google.protobuf.ITimestamp|null); @@ -5849,7 +5849,7 @@ export namespace google { public deferred: google.datastore.v1.IKey[]; /** LookupResponse transaction. */ - public transaction: (Uint8Array|string); + public transaction: (Uint8Array|Buffer|string); /** LookupResponse readTime. */ public readTime?: (google.protobuf.ITimestamp|null); @@ -6084,7 +6084,7 @@ export namespace google { query?: (google.datastore.v1.IQuery|null); /** RunQueryResponse transaction */ - transaction?: (Uint8Array|string|null); + transaction?: (Uint8Array|Buffer|string|null); /** RunQueryResponse explainMetrics */ explainMetrics?: (google.datastore.v1.IExplainMetrics|null); @@ -6106,7 +6106,7 @@ export namespace google { public query?: (google.datastore.v1.IQuery|null); /** RunQueryResponse transaction. */ - public transaction: (Uint8Array|string); + public transaction: (Uint8Array|Buffer|string); /** RunQueryResponse explainMetrics. */ public explainMetrics?: (google.datastore.v1.IExplainMetrics|null); @@ -6335,7 +6335,7 @@ export namespace google { query?: (google.datastore.v1.IAggregationQuery|null); /** RunAggregationQueryResponse transaction */ - transaction?: (Uint8Array|string|null); + transaction?: (Uint8Array|Buffer|string|null); /** RunAggregationQueryResponse explainMetrics */ explainMetrics?: (google.datastore.v1.IExplainMetrics|null); @@ -6357,7 +6357,7 @@ export namespace google { public query?: (google.datastore.v1.IAggregationQuery|null); /** RunAggregationQueryResponse transaction. */ - public transaction: (Uint8Array|string); + public transaction: (Uint8Array|Buffer|string); /** RunAggregationQueryResponse explainMetrics. */ public explainMetrics?: (google.datastore.v1.IExplainMetrics|null); @@ -6553,7 +6553,7 @@ export namespace google { interface IBeginTransactionResponse { /** BeginTransactionResponse transaction */ - transaction?: (Uint8Array|string|null); + transaction?: (Uint8Array|Buffer|string|null); } /** Represents a BeginTransactionResponse. */ @@ -6566,7 +6566,7 @@ export namespace google { constructor(properties?: google.datastore.v1.IBeginTransactionResponse); /** BeginTransactionResponse transaction. */ - public transaction: (Uint8Array|string); + public transaction: (Uint8Array|Buffer|string); /** * Creates a new BeginTransactionResponse instance using the specified properties. @@ -6656,7 +6656,7 @@ export namespace google { databaseId?: (string|null); /** RollbackRequest transaction */ - transaction?: (Uint8Array|string|null); + transaction?: (Uint8Array|Buffer|string|null); } /** Represents a RollbackRequest. */ @@ -6675,7 +6675,7 @@ export namespace google { public databaseId: string; /** RollbackRequest transaction. */ - public transaction: (Uint8Array|string); + public transaction: (Uint8Array|Buffer|string); /** * Creates a new RollbackRequest instance using the specified properties. @@ -6859,7 +6859,7 @@ export namespace google { mode?: (google.datastore.v1.CommitRequest.Mode|keyof typeof google.datastore.v1.CommitRequest.Mode|null); /** CommitRequest transaction */ - transaction?: (Uint8Array|string|null); + transaction?: (Uint8Array|Buffer|string|null); /** CommitRequest singleUseTransaction */ singleUseTransaction?: (google.datastore.v1.ITransactionOptions|null); @@ -6887,7 +6887,7 @@ export namespace google { public mode: (google.datastore.v1.CommitRequest.Mode|keyof typeof google.datastore.v1.CommitRequest.Mode); /** CommitRequest transaction. */ - public transaction?: (Uint8Array|string|null); + public transaction?: (Uint8Array|Buffer|string|null); /** CommitRequest singleUseTransaction. */ public singleUseTransaction?: (google.datastore.v1.ITransactionOptions|null); @@ -8038,7 +8038,7 @@ export namespace google { readConsistency?: (google.datastore.v1.ReadOptions.ReadConsistency|keyof typeof google.datastore.v1.ReadOptions.ReadConsistency|null); /** ReadOptions transaction */ - transaction?: (Uint8Array|string|null); + transaction?: (Uint8Array|Buffer|string|null); /** ReadOptions newTransaction */ newTransaction?: (google.datastore.v1.ITransactionOptions|null); @@ -8060,7 +8060,7 @@ export namespace google { public readConsistency?: (google.datastore.v1.ReadOptions.ReadConsistency|keyof typeof google.datastore.v1.ReadOptions.ReadConsistency|null); /** ReadOptions transaction. */ - public transaction?: (Uint8Array|string|null); + public transaction?: (Uint8Array|Buffer|string|null); /** ReadOptions newTransaction. */ public newTransaction?: (google.datastore.v1.ITransactionOptions|null); @@ -8271,7 +8271,7 @@ export namespace google { interface IReadWrite { /** ReadWrite previousTransaction */ - previousTransaction?: (Uint8Array|string|null); + previousTransaction?: (Uint8Array|Buffer|string|null); } /** Represents a ReadWrite. */ @@ -8284,7 +8284,7 @@ export namespace google { constructor(properties?: google.datastore.v1.TransactionOptions.IReadWrite); /** ReadWrite previousTransaction. */ - public previousTransaction: (Uint8Array|string); + public previousTransaction: (Uint8Array|Buffer|string); /** * Creates a new ReadWrite instance using the specified properties. @@ -13991,7 +13991,7 @@ export namespace google { doubleValue?: (number|null); /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|string|null); + stringValue?: (Uint8Array|Buffer|string|null); /** UninterpretedOption aggregateValue */ aggregateValue?: (string|null); @@ -14022,7 +14022,7 @@ export namespace google { public doubleValue: number; /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|string); + public stringValue: (Uint8Array|Buffer|string); /** UninterpretedOption aggregateValue. */ public aggregateValue: string; @@ -15161,7 +15161,7 @@ export namespace google { type_url?: (string|null); /** Any value */ - value?: (Uint8Array|string|null); + value?: (Uint8Array|Buffer|string|null); } /** Represents an Any. */ @@ -15177,7 +15177,7 @@ export namespace google { public type_url: string; /** Any value. */ - public value: (Uint8Array|string); + public value: (Uint8Array|Buffer|string); /** * Creates a new Any instance using the specified properties. @@ -16560,7 +16560,7 @@ export namespace google { interface IBytesValue { /** BytesValue value */ - value?: (Uint8Array|string|null); + value?: (Uint8Array|Buffer|string|null); } /** Represents a BytesValue. */ @@ -16573,7 +16573,7 @@ export namespace google { constructor(properties?: google.protobuf.IBytesValue); /** BytesValue value. */ - public value: (Uint8Array|string); + public value: (Uint8Array|Buffer|string); /** * Creates a new BytesValue instance using the specified properties. diff --git a/protos/protos.js b/protos/protos.js index a6b2b37db..88799e49a 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/samples/concepts.js b/samples/concepts.js index 6543142b9..78ebb544d 100644 --- a/samples/concepts.js +++ b/samples/concepts.js @@ -491,7 +491,7 @@ class Metadata extends TestHelper { and([ new PropertyFilter('__key__', '>=', startKey), new PropertyFilter('__key__', '<', endKey), - ]) + ]), ); const [entities] = await datastore.runQuery(query); @@ -616,7 +616,7 @@ class Query extends TestHelper { and([ new PropertyFilter('done', '=', false), new PropertyFilter('priority', '>=', 4), - ]) + ]), ) .order('priority', { descending: true, @@ -684,7 +684,7 @@ class Query extends TestHelper { and([ new PropertyFilter('done', '=', false), new PropertyFilter('priority', '=', 4), - ]) + ]), ); // [END datastore_composite_filter] @@ -698,7 +698,7 @@ class Query extends TestHelper { const query = datastore .createQuery('Task') .filter( - new PropertyFilter('__key__', '>', datastore.key(['Task', 'someTask'])) + new PropertyFilter('__key__', '>', datastore.key(['Task', 'someTask'])), ); // [END datastore_key_filter] @@ -814,7 +814,7 @@ class Query extends TestHelper { and([ new PropertyFilter('tag', '>', 'learn'), new PropertyFilter('tag', '<', 'math'), - ]) + ]), ); // [END datastore_array_value_inequality_range] @@ -831,7 +831,7 @@ class Query extends TestHelper { and([ new PropertyFilter('tag', '=', 'fun'), new PropertyFilter('tag', '=', 'programming'), - ]) + ]), ); // [END datastore_array_value_equality] @@ -848,7 +848,7 @@ class Query extends TestHelper { and([ new PropertyFilter('created', '>', new Date('1990-01-01T00:00:00z')), new PropertyFilter('created', '<', new Date('2000-12-31T23:59:59z')), - ]) + ]), ); // [END datastore_inequality_range] @@ -865,7 +865,7 @@ class Query extends TestHelper { and([ new PropertyFilter('priority', '>', 3), new PropertyFilter('created', '>', new Date('1990-01-01T00:00:00z')), - ]) + ]), ); // [END datastore_inequality_invalid] @@ -884,7 +884,7 @@ class Query extends TestHelper { new PropertyFilter('done', '=', false), new PropertyFilter('created', '>', new Date('1990-01-01T00:00:00z')), new PropertyFilter('created', '<', new Date('2000-12-31T23:59:59z')), - ]) + ]), ); // [END datastore_equal_and_inequality_range] @@ -1071,11 +1071,11 @@ class Transaction extends TestHelper { datastore = datastoreMock; assert.strictEqual( accounts[0].balance, - originalBalance - amountToTransfer + originalBalance - amountToTransfer, ); assert.strictEqual( accounts[1].balance, - originalBalance + amountToTransfer + originalBalance + amountToTransfer, ); } catch (err) { datastore = datastoreMock; @@ -1201,7 +1201,7 @@ class Transaction extends TestHelper { // Restore `datastore` to the mock API. datastore = datastoreMock; return Promise.reject(err); - } + }, ); } } diff --git a/samples/queryFilterOr.js b/samples/queryFilterOr.js index 80913cd9c..deb911d77 100644 --- a/samples/queryFilterOr.js +++ b/samples/queryFilterOr.js @@ -37,7 +37,7 @@ async function main() { or([ new PropertyFilter('description', '=', 'Buy milk'), new PropertyFilter('description', '=', 'Feed cats'), - ]) + ]), ); const [entities] = await datastore.runQuery(query); diff --git a/samples/tasks.js b/samples/tasks.js index e31c82958..eca5d3be2 100644 --- a/samples/tasks.js +++ b/samples/tasks.js @@ -162,23 +162,23 @@ require(`yargs`) // eslint-disable-line 'new ', 'Adds a task with a description .', {}, - opts => addTask(opts.description) + opts => addTask(opts.description), ) .command('done ', 'Marks the specified task as done.', {}, opts => - markDone(opts.taskId) + markDone(opts.taskId), ) .command('merge ', 'Marks the specified task as done.', {}, opts => - merge(opts.taskId, opts.description) + merge(opts.taskId, opts.description), ) .command('list', 'Lists all tasks ordered by creation time.', {}, listTasks) .command('delete ', 'Deletes a task.', {}, opts => - deleteTask(opts.taskId) + deleteTask(opts.taskId), ) .example('node $0 new "Buy milk"', 'Adds a task with description "Buy milk".') .example('node $0 done 12345', 'Marks task 12345 as Done.') .example( 'node $0 merge 12345', - 'update task 12345 with description "Buy food".' + 'update task 12345 with description "Buy food".', ) .example('node $0 list', 'Lists all tasks ordered by creation time') .example('node $0 delete 12345', 'Deletes task 12345.') diff --git a/src/aggregate.ts b/src/aggregate.ts index d36172e4d..3c07aeee3 100644 --- a/src/aggregate.ts +++ b/src/aggregate.ts @@ -113,7 +113,7 @@ class AggregateQuery { */ run( optionsOrCallback?: RunQueryOptions | RequestCallback, - cb?: RequestCallback + cb?: RequestCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {}; @@ -233,7 +233,7 @@ abstract class PropertyAggregateField extends AggregateField { return Object.assign( {operator: this.operator}, this.alias_ ? {alias: this.alias_} : null, - {[this.operator]: aggregation} + {[this.operator]: aggregation}, ); } } diff --git a/src/entity.ts b/src/entity.ts index c12e4ee9c..f6c3bd55c 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -136,7 +136,7 @@ export namespace entity { private _entityPropertyName: string | undefined; constructor( value: number | string | ValueProto, - typeCastOptions?: IntegerTypeCastOptions + typeCastOptions?: IntegerTypeCastOptions, ) { super(typeof value === 'object' ? value.integerValue : value); this._entityPropertyName = @@ -158,7 +158,7 @@ export namespace entity { this.typeCastFunction = typeCastOptions.integerTypeCastFunction; if (typeof typeCastOptions.integerTypeCastFunction !== 'function') { throw new Error( - 'integerTypeCastFunction is not a function or was not provided.' + 'integerTypeCastFunction is not a function or was not provided.', ); } @@ -440,7 +440,7 @@ export namespace entity { if (this.parent) { serializedKey.path = this.parent.serialized.path.concat( - serializedKey.path + serializedKey.path, ); } @@ -479,7 +479,7 @@ export namespace entity { '{\n' + ' integerTypeCastFunction: provide \n' + ' properties: optionally specify property name(s) to be custom casted\n' + - '}\n' + '}\n', ); } return num; @@ -527,7 +527,7 @@ export namespace entity { */ export function decodeValueProto( valueProto: ValueProto, - wrapNumbers?: boolean | IntegerTypeCastOptions + wrapNumbers?: boolean | IntegerTypeCastOptions, ) { const valueType = valueProto.valueType!; const value = valueProto[valueType]; @@ -536,7 +536,7 @@ export namespace entity { case 'arrayValue': { // eslint-disable-next-line @typescript-eslint/no-explicit-any return value.values.map((val: any) => - entity.decodeValueProto(val, wrapNumbers) + entity.decodeValueProto(val, wrapNumbers), ); } @@ -617,7 +617,7 @@ export namespace entity { "the value for '" + property + "' property is outside of bounds of a JavaScript Number.\n" + - "Use 'Datastore.int()' to preserve accuracy during the upload." + "Use 'Datastore.int()' to preserve accuracy during the upload.", ); } value = new entity.Int(value); @@ -730,7 +730,7 @@ export namespace entity { // eslint-disable-next-line @typescript-eslint/no-explicit-any export function entityFromEntityProto( entityProto: EntityProto, - wrapNumbers?: boolean | IntegerTypeCastOptions + wrapNumbers?: boolean | IntegerTypeCastOptions, ) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const entityObject: any = {}; @@ -789,7 +789,7 @@ export namespace entity { return encoded; }, // eslint-disable-next-line @typescript-eslint/no-explicit-any - {} as any + {} as any, ), }; @@ -808,7 +808,7 @@ export namespace entity { */ export function addExcludeFromIndexes( excludeFromIndexes: string[] | undefined, - entityProto: EntityProto + entityProto: EntityProto, ): EntityProto { if (excludeFromIndexes && excludeFromIndexes.length > 0) { excludeFromIndexes.forEach((excludePath: string) => { @@ -889,14 +889,14 @@ export namespace entity { // (including entity values at their roots): excludePathFromEntity( value, - remainderPath // === '' + remainderPath, // === '' ); } else { // Path traversal continues at value.entityValue, // if it is an entity, or must end at value. excludePathFromEntity( value.entityValue || value, - remainderPath // !== '' + remainderPath, // !== '' ); } }); @@ -977,7 +977,7 @@ export namespace entity { */ export function formatArray( results: ResponseResult[], - wrapNumbers?: boolean | IntegerTypeCastOptions + wrapNumbers?: boolean | IntegerTypeCastOptions, ) { return results.map(result => { const ent = entity.entityFromEntityProto(result.entity!, wrapNumbers); @@ -998,7 +998,7 @@ export namespace entity { export function findLargeProperties_( entities: Entities, path: string, - properties: string[] = [] + properties: string[] = [], ) { const MAX_DATASTORE_VALUE_LENGTH = 1500; if (Array.isArray(entities)) { @@ -1011,7 +1011,7 @@ export namespace entity { findLargeProperties_( entities[key], path.concat(`${path ? '.' : ''}${key}`), - properties + properties, ); } } else if ( @@ -1259,7 +1259,7 @@ export namespace entity { if (query.filters.length > 0 || query.entityFilters.length > 0) { // Convert all legacy filters into new property filter objects const filters = query.filters.map( - filter => new PropertyFilter(filter.name, filter.op, filter.val) + filter => new PropertyFilter(filter.name, filter.op, filter.val), ); const entityFilters = query.entityFilters; const allFilters = entityFilters.concat(filters); @@ -1299,7 +1299,7 @@ export namespace entity { loadProtos_() { const root = new Protobuf.Root(); const loadedRoot = root.loadSync( - path.join(__dirname, '..', 'protos', 'app_engine_key.proto') + path.join(__dirname, '..', 'protos', 'app_engine_key.proto'), ); loadedRoot.resolveAll(); return loadedRoot.nested; @@ -1321,7 +1321,7 @@ export namespace entity { legacyEncode( projectId: string, key: entity.Key, - locationPrefix?: string + locationPrefix?: string, ): string { const elements: {}[] = []; let currentKey = key; diff --git a/src/filter.ts b/src/filter.ts index ca693549b..d3315e81a 100644 --- a/src/filter.ts +++ b/src/filter.ts @@ -92,7 +92,7 @@ export class PropertyFilter constructor( public name: T, public op: Operator, - public val: AllowedFilterValueType + public val: AllowedFilterValueType, ) { super(); } diff --git a/src/index-class.ts b/src/index-class.ts index 64decbed4..49027c990 100644 --- a/src/index-class.ts +++ b/src/index-class.ts @@ -22,7 +22,7 @@ export interface GenericIndexCallback { ( err?: ServiceError | null, index?: Index | null, - apiResponse?: T | null + apiResponse?: T | null, ): void; } @@ -31,7 +31,7 @@ export type GetIndexResponse = [Index, IIndex]; export type IndexGetMetadataCallback = ( err?: ServiceError | null, - metadata?: IIndex | null + metadata?: IIndex | null, ) => void; export type IndexGetMetadataResponse = [IIndex]; @@ -51,7 +51,7 @@ export type GetIndexesCallback = ( err?: ServiceError | null, indexes?: Index[], nextQuery?: GetIndexesOptions, - apiResponse?: google.datastore.admin.v1.IListIndexesResponse + apiResponse?: google.datastore.admin.v1.IListIndexesResponse, ) => void; export type IIndex = google.datastore.admin.v1.IIndex; @@ -93,7 +93,7 @@ export class Index { get(gaxOptions: CallOptions, callback: GetIndexCallback): void; get( gaxOptionsOrCallback?: CallOptions | GetIndexCallback, - cb?: GetIndexCallback + cb?: GetIndexCallback, ): void | Promise { const gaxOpts = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {}; @@ -118,11 +118,11 @@ export class Index { getMetadata(callback: IndexGetMetadataCallback): void; getMetadata( gaxOptions: CallOptions, - callback: IndexGetMetadataCallback + callback: IndexGetMetadataCallback, ): void; getMetadata( gaxOptionsOrCallback?: CallOptions | IndexGetMetadataCallback, - cb?: IndexGetMetadataCallback + cb?: IndexGetMetadataCallback, ): void | Promise { const gaxOpts = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {}; @@ -143,7 +143,7 @@ export class Index { this.metadata = resp; } callback(err as ServiceError, resp); - } + }, ); } diff --git a/src/index.ts b/src/index.ts index 20cad99c4..43ea58ad8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -96,7 +96,7 @@ export interface LongRunningCallback { ( err: ServiceError | null, operation?: Operation, - apiResponse?: google.longrunning.IOperation + apiResponse?: google.longrunning.IOperation, ): void; } export type LongRunningResponse = [Operation, google.longrunning.IOperation]; @@ -496,7 +496,7 @@ class Datastore extends DatastoreRequest { new Set([ ...gapic.v1.DatastoreClient.scopes, ...gapic.v1.DatastoreAdminClient.scopes, - ]) + ]), ); this.options = Object.assign( @@ -507,7 +507,7 @@ class Datastore extends DatastoreRequest { servicePath: this.baseUrl_, port: typeof this.port_ === 'number' ? this.port_ : 443, }, - options + options, ); const isUsingLocalhost = this.baseUrl_ && @@ -552,7 +552,7 @@ class Datastore extends DatastoreRequest { export(config: ExportEntitiesConfig, callback: LongRunningCallback): void; export( config: ExportEntitiesConfig, - callback?: LongRunningCallback + callback?: LongRunningCallback, ): void | Promise { const reqOpts: ExportEntitiesConfig = { entityFilter: {}, @@ -600,7 +600,7 @@ class Datastore extends DatastoreRequest { gaxOpts: config.gaxOptions, }, // eslint-disable-next-line @typescript-eslint/no-explicit-any - callback as any + callback as any, ); } @@ -622,7 +622,7 @@ class Datastore extends DatastoreRequest { getIndexes(callback: GetIndexesCallback): void; getIndexes( optionsOrCallback?: GetIndexesOptions | GetIndexesCallback, - cb?: GetIndexesCallback + cb?: GetIndexesCallback, ): void | Promise { let options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {}; @@ -674,7 +674,7 @@ class Datastore extends DatastoreRequest { const apiResp: google.datastore.admin.v1.IListIndexesResponse = resp[2]; callback(err as ServiceError, indexes, nextQuery, apiResp); - } + }, ); } @@ -702,7 +702,7 @@ class Datastore extends DatastoreRequest { next(null, indexInstance); }, }), - () => {} + () => {}, ); } @@ -740,7 +740,7 @@ class Datastore extends DatastoreRequest { import(config: ImportEntitiesConfig, callback: LongRunningCallback): void; import( config: ImportEntitiesConfig, - callback?: LongRunningCallback + callback?: LongRunningCallback, ): void | Promise { const reqOpts: ImportEntitiesConfig = { entityFilter: {}, @@ -788,7 +788,7 @@ class Datastore extends DatastoreRequest { gaxOpts: config.gaxOptions, }, // eslint-disable-next-line @typescript-eslint/no-explicit-any - callback as any + callback as any, ); } @@ -820,7 +820,7 @@ class Datastore extends DatastoreRequest { insert(entities: Entities, callback: InsertCallback): void; insert( entities: Entities, - callback?: InsertCallback + callback?: InsertCallback, ): void | Promise { entities = arrify(entities) .map(DatastoreRequest.prepareEntityObject_) @@ -1071,13 +1071,13 @@ class Datastore extends DatastoreRequest { save( entities: Entities, gaxOptions: CallOptions, - callback: SaveCallback + callback: SaveCallback, ): void; save(entities: Entities, callback: SaveCallback): void; save( entities: Entities, gaxOptionsOrCallback?: CallOptions | SaveCallback, - cb?: SaveCallback + cb?: SaveCallback, ): void | Promise { entities = arrify(entities) as SaveEntity[]; const gaxOptions = @@ -1106,7 +1106,7 @@ class Datastore extends DatastoreRequest { method = entityObject.method; } else { throw new Error( - 'Method ' + entityObject.method + ' not recognized.' + 'Method ' + entityObject.method + ' not recognized.', ); } } @@ -1130,7 +1130,7 @@ class Datastore extends DatastoreRequest { function onCommit( err?: Error | null, - resp?: google.datastore.v1.ICommitResponse + resp?: google.datastore.v1.ICommitResponse, ) { if (err || !resp) { callback(err, resp); @@ -1163,7 +1163,7 @@ class Datastore extends DatastoreRequest { reqOpts, gaxOpts: gaxOptions, }, - onCommit + onCommit, ); } @@ -1185,7 +1185,7 @@ class Datastore extends DatastoreRequest { update(entities: Entities, callback: UpdateCallback): void; update( entities: Entities, - callback?: UpdateCallback + callback?: UpdateCallback, ): void | Promise { entities = arrify(entities) .map(DatastoreRequest.prepareEntityObject_) @@ -1215,7 +1215,7 @@ class Datastore extends DatastoreRequest { upsert(entities: Entities, callback: UpsertCallback): void; upsert( entities: Entities, - callback?: UpsertCallback + callback?: UpsertCallback, ): void | Promise { entities = arrify(entities) .map(DatastoreRequest.prepareEntityObject_) @@ -1509,7 +1509,7 @@ class Datastore extends DatastoreRequest { createQuery(namespace: string, kind: string[]): Query; createQuery( namespaceOrKind?: string | string[], - kind?: string | string[] + kind?: string | string[], ): Query { let namespace = namespaceOrKind as string; if (!kind) { @@ -1688,17 +1688,17 @@ class Datastore extends DatastoreRequest { keyToLegacyUrlSafe(key: entity.Key, locationPrefix?: string): Promise; keyToLegacyUrlSafe( key: entity.Key, - callback: KeyToLegacyUrlSafeCallback + callback: KeyToLegacyUrlSafeCallback, ): void; keyToLegacyUrlSafe( key: entity.Key, locationPrefix: string, - callback: KeyToLegacyUrlSafeCallback + callback: KeyToLegacyUrlSafeCallback, ): void; keyToLegacyUrlSafe( key: entity.Key, locationPrefixOrCallback?: string | KeyToLegacyUrlSafeCallback, - callback?: KeyToLegacyUrlSafeCallback + callback?: KeyToLegacyUrlSafeCallback, ): Promise | void { const locationPrefix = typeof locationPrefixOrCallback === 'string' diff --git a/src/query.ts b/src/query.ts index 557ae12a7..86ff6ff45 100644 --- a/src/query.ts +++ b/src/query.ts @@ -91,12 +91,12 @@ class Query { constructor( scope?: Datastore | Transaction, namespace?: string | null, - kinds?: string[] + kinds?: string[], ); constructor( scope?: Datastore | Transaction, namespaceOrKinds?: string | string[] | null, - kinds?: string[] + kinds?: string[], ) { let namespace = namespaceOrKinds as string | null; if (!kinds) { @@ -212,22 +212,22 @@ class Query { filter(filter: EntityFilter): Query; filter( property: T, - value: AllowedFilterValueType + value: AllowedFilterValueType, ): Query; filter( property: T, operator: Operator, - value: AllowedFilterValueType + value: AllowedFilterValueType, ): Query; filter( propertyOrFilter: T | EntityFilter, operatorOrValue?: Operator | AllowedFilterValueType, - value?: AllowedFilterValueType + value?: AllowedFilterValueType, ): Query { if (arguments.length > 1) { gaxInstance.warn( 'filter', - 'Providing Filter objects like Composite Filter or Property Filter is recommended when using .filter' + 'Providing Filter objects like Composite Filter or Property Filter is recommended when using .filter', ); } switch (arguments.length) { @@ -524,7 +524,7 @@ class Query { run(callback: RunQueryCallback): void; run( optionsOrCallback?: RunQueryOptions | RunQueryCallback, - cb?: RunQueryCallback + cb?: RunQueryCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {}; diff --git a/src/request.ts b/src/request.ts index de04b6361..8e038f487 100644 --- a/src/request.ts +++ b/src/request.ts @@ -92,7 +92,7 @@ function decodeStruct(structValue: google.protobuf.IStruct): JSONValue { function getInfoFromStats( resp: | protos.google.datastore.v1.IRunQueryResponse - | protos.google.datastore.v1.IRunAggregationQueryResponse + | protos.google.datastore.v1.IRunAggregationQueryResponse, ): RunQueryInfo { // Decode struct values stored in planSummary and executionStats const explainMetrics: ExplainMetrics = {}; @@ -105,7 +105,7 @@ function getInfoFromStats( Object.assign(explainMetrics, { planSummary: { indexesUsed: resp.explainMetrics.planSummary.indexesUsed.map( - (index: google.protobuf.IStruct) => decodeStruct(index) + (index: google.protobuf.IStruct) => decodeStruct(index), ), }, }); @@ -329,17 +329,17 @@ class DatastoreRequest { */ allocateIds( key: entity.Key, - options: AllocateIdsOptions | number + options: AllocateIdsOptions | number, ): Promise; allocateIds( key: entity.Key, options: AllocateIdsOptions | number, - callback: AllocateIdsCallback + callback: AllocateIdsCallback, ): void; allocateIds( key: entity.Key, options: AllocateIdsOptions | number, - callback?: AllocateIdsCallback + callback?: AllocateIdsCallback, ): void | Promise { if (entity.isKeyComplete(key)) { throw new Error('An incomplete key should be provided.'); @@ -362,7 +362,7 @@ class DatastoreRequest { } const keys = arrify(resp!.keys!).map(entity.keyFromKeyProto); callback!(null, keys, resp!); - } + }, ); } @@ -404,7 +404,7 @@ class DatastoreRequest { */ createReadStream( keys: Entities, - options: CreateReadStreamOptions = {} + options: CreateReadStreamOptions = {}, ): Transform { keys = arrify(keys).map(entity.keyToKeyProto); if (keys.length === 0) { @@ -435,7 +435,7 @@ class DatastoreRequest { try { entities = entity.formatArray( resp!.found! as ResponseResult[], - options.wrapNumbers + options.wrapNumbers, ); } catch (err) { stream.destroy(err); @@ -457,7 +457,7 @@ class DatastoreRequest { stream.push(null); }); - } + }, ); }; @@ -523,12 +523,12 @@ class DatastoreRequest { delete( keys: Entities, gaxOptions: CallOptions, - callback: DeleteCallback + callback: DeleteCallback, ): void; delete( keys: entity.Key | entity.Key[], gaxOptionsOrCallback?: CallOptions | DeleteCallback, - cb?: DeleteCallback + cb?: DeleteCallback, ): void | Promise { const gaxOptions = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {}; @@ -556,7 +556,7 @@ class DatastoreRequest { reqOpts, gaxOpts: gaxOptions, }, - callback + callback, ); } @@ -655,18 +655,18 @@ class DatastoreRequest { */ get( keys: entity.Key | entity.Key[], - options?: CreateReadStreamOptions + options?: CreateReadStreamOptions, ): Promise; get(keys: entity.Key | entity.Key[], callback: GetCallback): void; get( keys: entity.Key | entity.Key[], options: CreateReadStreamOptions, - callback: GetCallback + callback: GetCallback, ): void; get( keys: entity.Key | entity.Key[], optionsOrCallback?: CreateReadStreamOptions | GetCallback, - cb?: GetCallback + cb?: GetCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' && optionsOrCallback @@ -682,7 +682,7 @@ class DatastoreRequest { concat((results: Entity[]) => { const isSingleLookup = !Array.isArray(keys); callback(null, isSingleLookup ? results[0] : results); - }) + }), ); } catch (err: any) { callback(err); @@ -722,21 +722,21 @@ class DatastoreRequest { **/ runAggregationQuery( query: AggregateQuery, - options?: RunQueryOptions + options?: RunQueryOptions, ): Promise; runAggregationQuery( query: AggregateQuery, options: RunQueryOptions, - callback: RunAggregationQueryCallback + callback: RunAggregationQueryCallback, ): void; runAggregationQuery( query: AggregateQuery, - callback: RunAggregationQueryCallback + callback: RunAggregationQueryCallback, ): void; runAggregationQuery( query: AggregateQuery, optionsOrCallback?: RunQueryOptions | RunAggregationQueryCallback, - cb?: RequestCallback + cb?: RequestCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {}; @@ -790,7 +790,7 @@ class DatastoreRequest { const results = res.batch.aggregationResults; const finalResults = results .map( - (aggregationResult: any) => aggregationResult.aggregateProperties + (aggregationResult: any) => aggregationResult.aggregateProperties, ) .map((aggregateProperties: any) => Object.fromEntries( @@ -798,15 +798,15 @@ class DatastoreRequest { Object.keys(aggregateProperties).map(key => [ key, entity.decodeValueProto(aggregateProperties[key]), - ]) - ) - ) + ]), + ), + ), ); callback(err, finalResults, info); } else { callback(err, [], info); } - } + }, ); } @@ -913,13 +913,13 @@ class DatastoreRequest { runQuery( query: Query, options: RunQueryOptions, - callback: RunQueryCallback + callback: RunQueryCallback, ): void; runQuery(query: Query, callback: RunQueryCallback): void; runQuery( query: Query, optionsOrCallback?: RunQueryOptions | RunQueryCallback, - cb?: RunQueryCallback + cb?: RunQueryCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {}; @@ -937,7 +937,7 @@ class DatastoreRequest { .pipe( concat((results: Entity[]) => { callback(null, results, info); - }) + }), ); } catch (err: any) { callback(err); @@ -1005,7 +1005,7 @@ class DatastoreRequest { reqOpts, gaxOpts: options.gaxOptions, }, - onResultSet + onResultSet, ); }; @@ -1037,7 +1037,7 @@ class DatastoreRequest { try { entities = entity.formatArray( resp.batch.entityResults, - options.wrapNumbers + options.wrapNumbers, ); } catch (err) { stream.destroy(err); @@ -1084,7 +1084,7 @@ class DatastoreRequest { * @param {RunQueryStreamOptions} [options] The RunQueryStream options configuration */ private getRequestOptions( - options: RunQueryStreamOptions + options: RunQueryStreamOptions, ): SharedQueryOptions { const sharedQueryOpts = {} as SharedQueryOptions; if (isTransaction(this)) { @@ -1094,7 +1094,7 @@ class DatastoreRequest { } sharedQueryOpts.readOptions.newTransaction = getTransactionRequest( this, - {} + {}, ); sharedQueryOpts.readOptions.consistencyType = 'newTransaction'; } @@ -1127,7 +1127,7 @@ class DatastoreRequest { */ private getQueryOptions( query: Query, - options: RunQueryStreamOptions = {} + options: RunQueryStreamOptions = {}, ): SharedQueryOptions { const sharedQueryOpts = this.getRequestOptions(options); if (options.explainOptions) { @@ -1168,7 +1168,7 @@ class DatastoreRequest { merge(entities: Entities, callback: SaveCallback): void; merge( entities: Entities, - callback?: SaveCallback + callback?: SaveCallback, ): void | Promise { const transaction = this.datastore.transaction(); transaction.run(async (err: any) => { @@ -1192,7 +1192,7 @@ class DatastoreRequest { obj.method = 'upsert'; obj.data = Object.assign({}, data, obj.data); transaction.save(obj); - }) + }), ); const [response] = await transaction.commit(); @@ -1267,7 +1267,7 @@ class DatastoreRequest { if (!datastore.clients_.has(clientName)) { datastore.clients_.set( clientName, - new gapic.v1[clientName](datastore.options) + new gapic.v1[clientName](datastore.options), ); } const gaxClient = datastore.clients_.get(clientName); @@ -1363,7 +1363,7 @@ function isTransaction(request: DatastoreRequest): request is Transaction { */ function throwOnTransactionErrors( request: DatastoreRequest, - options: SharedQueryOptions + options: SharedQueryOptions, ) { const isTransaction = request.id ? true : false; if ( @@ -1388,7 +1388,7 @@ function throwOnTransactionErrors( */ export function getTransactionRequest( transaction: Transaction, - options: RunOptions + options: RunOptions, ): TransactionRequestOptions { // If transactionOptions are provide then they will be used. // Otherwise, options passed into this function are used and when absent @@ -1422,7 +1422,7 @@ export interface AllocateIdsCallback { ( a: Error | null, b: entity.Key[] | null, - c: google.datastore.v1.IAllocateIdsResponse + c: google.datastore.v1.IAllocateIdsResponse, ): void; } export interface AllocateIdsOptions { @@ -1451,7 +1451,7 @@ export interface RequestCallback { ( a?: Error | null, // eslint-disable-next-line @typescript-eslint/no-explicit-any - b?: any + b?: any, ): void; } export interface RunAggregationQueryCallback { @@ -1459,7 +1459,7 @@ export interface RunAggregationQueryCallback { a?: Error | null, // eslint-disable-next-line @typescript-eslint/no-explicit-any b?: any, - c?: RunQueryInfo + c?: RunQueryInfo, ): void; } export interface RequestConfig { diff --git a/src/transaction.ts b/src/transaction.ts index 57a0a3a65..fe1075fd3 100644 --- a/src/transaction.ts +++ b/src/transaction.ts @@ -171,7 +171,7 @@ class Transaction extends DatastoreRequest { commit(gaxOptions: CallOptions, callback: CommitCallback): void; commit( gaxOptionsOrCallback?: CallOptions | CommitCallback, - cb?: CommitCallback + cb?: CommitCallback, ): void | Promise { const callback = typeof gaxOptionsOrCallback === 'function' @@ -191,7 +191,7 @@ class Transaction extends DatastoreRequest { () => { this.#runCommit(gaxOptions, callback); }, - callback + callback, ); } @@ -266,12 +266,12 @@ class Transaction extends DatastoreRequest { createQuery(namespace: string, kind: string[]): Query; createQuery( namespaceOrKind?: string | string[], - kind?: string | string[] + kind?: string | string[], ): Query { return this.datastore.createQuery.call( this, namespaceOrKind as string, - kind as string[] + kind as string[], ); } @@ -344,18 +344,18 @@ class Transaction extends DatastoreRequest { */ get( keys: entity.Key | entity.Key[], - options?: CreateReadStreamOptions + options?: CreateReadStreamOptions, ): Promise; get(keys: entity.Key | entity.Key[], callback: GetCallback): void; get( keys: entity.Key | entity.Key[], options: CreateReadStreamOptions, - callback: GetCallback + callback: GetCallback, ): void; get( keys: entity.Key | entity.Key[], optionsOrCallback?: CreateReadStreamOptions | GetCallback, - cb?: GetCallback + cb?: GetCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' && optionsOrCallback @@ -432,7 +432,7 @@ class Transaction extends DatastoreRequest { rollback(gaxOptions: CallOptions, callback: RollbackCallback): void; rollback( gaxOptionsOrCallback?: CallOptions | RollbackCallback, - cb?: RollbackCallback + cb?: RollbackCallback, ): void | Promise { const gaxOptions = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {}; @@ -457,7 +457,7 @@ class Transaction extends DatastoreRequest { this.skipCommit = true; this.state = TransactionState.EXPIRED; callback(err || null, resp); - } + }, ); } @@ -518,7 +518,7 @@ class Transaction extends DatastoreRequest { run(options: RunOptions, callback: RunCallback): void; run( optionsOrCallback?: RunOptions | RunCallback, - cb?: RunCallback + cb?: RunCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {}; @@ -530,7 +530,7 @@ class Transaction extends DatastoreRequest { this.#processBeginResults(runResults, callback); } else { process.emitWarning( - 'run has already been called and should not be called again.' + 'run has already been called and should not be called again.', ); callback(null, this, {transaction: this.id}); } @@ -548,7 +548,7 @@ class Transaction extends DatastoreRequest { */ #runCommit( gaxOptions: CallOptions, - callback: CommitCallback + callback: CommitCallback, ): void | Promise { if (this.skipCommit) { setImmediate(callback); @@ -600,7 +600,7 @@ class Transaction extends DatastoreRequest { acc.push(entityObject); } else { lastEntityObject.args = lastEntityObject.args.concat( - entityObject.args + entityObject.args, ); } @@ -616,7 +616,7 @@ class Transaction extends DatastoreRequest { const method = modifiedEntity.method; const args = modifiedEntity.args.reverse(); Datastore.prototype[method].call(this, args, () => {}); - } + }, ); // Take the `req` array built previously, and merge them into one request to @@ -626,7 +626,7 @@ class Transaction extends DatastoreRequest { .map((x: {mutations: google.datastore.v1.Mutation}) => x.mutations) .reduce( (a: {concat: (arg0: Entity) => void}, b: Entity) => a.concat(b), - [] + [], ), }; @@ -656,10 +656,10 @@ class Transaction extends DatastoreRequest { this.requestCallbacks_.forEach( (cb: (arg0: null, arg1: Entity) => void) => { cb(null, resp); - } + }, ); callback(null, resp); - } + }, ); } @@ -674,7 +674,7 @@ class Transaction extends DatastoreRequest { **/ #processBeginResults( runResults: BeginAsyncResponse, - callback: RunCallback + callback: RunCallback, ): void { const err = runResults.err; const resp = runResults.resp; @@ -696,7 +696,7 @@ class Transaction extends DatastoreRequest { * **/ async #beginTransactionAsync( - options: RunOptions + options: RunOptions, ): Promise { return new Promise((resolve: (value: BeginAsyncResponse) => void) => { const reqOpts = { @@ -715,7 +715,7 @@ class Transaction extends DatastoreRequest { err, resp, }); - } + }, ); }); } @@ -734,18 +734,18 @@ class Transaction extends DatastoreRequest { **/ runAggregationQuery( query: AggregateQuery, - options?: RunQueryOptions + options?: RunQueryOptions, ): Promise; runAggregationQuery( query: AggregateQuery, options: RunQueryOptions, - callback: RequestCallback + callback: RequestCallback, ): void; runAggregationQuery(query: AggregateQuery, callback: RequestCallback): void; runAggregationQuery( query: AggregateQuery, optionsOrCallback?: RunQueryOptions | RequestCallback, - cb?: RequestCallback + cb?: RequestCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' && optionsOrCallback @@ -774,13 +774,13 @@ class Transaction extends DatastoreRequest { runQuery( query: Query, options: RunQueryOptions, - callback: RunQueryCallback + callback: RunQueryCallback, ): void; runQuery(query: Query, callback: RunQueryCallback): void; runQuery( query: Query, optionsOrCallback?: RunQueryOptions | RunQueryCallback, - cb?: RunQueryCallback + cb?: RunQueryCallback, ): void | Promise { const options = typeof optionsOrCallback === 'object' && optionsOrCallback @@ -1008,7 +1008,7 @@ class Transaction extends DatastoreRequest { #withBeginTransaction( gaxOptions: CallOptions | undefined, fn: () => void, - callback: (...args: [Error | null, ...T] | [Error | null]) => void + callback: (...args: [Error | null, ...T] | [Error | null]) => void, ): void { (async () => { if (this.state === TransactionState.NOT_STARTED) { @@ -1077,7 +1077,7 @@ export interface RunCallback { ( error: Error | null, transaction: Transaction | null, - response?: google.datastore.v1.IBeginTransactionResponse + response?: google.datastore.v1.IBeginTransactionResponse, ): void; } export interface RollbackCallback { diff --git a/src/utils/entity/buildEntityProto.ts b/src/utils/entity/buildEntityProto.ts index a4bbe80bd..a334d8b47 100644 --- a/src/utils/entity/buildEntityProto.ts +++ b/src/utils/entity/buildEntityProto.ts @@ -48,7 +48,7 @@ export function buildEntityProto(entityObject: Entity) { return acc; }, - {} + {}, ); // This code adds excludeFromIndexes in the right places addExcludeFromIndexes(entityObject.excludeFromIndexes, entityProto); diff --git a/src/utils/entity/extendExcludeFromIndexes.ts b/src/utils/entity/extendExcludeFromIndexes.ts index bca29fa5b..3f3787f9e 100644 --- a/src/utils/entity/extendExcludeFromIndexes.ts +++ b/src/utils/entity/extendExcludeFromIndexes.ts @@ -37,15 +37,15 @@ export function extendExcludeFromIndexes(entityObject: Entity) { entityObject.excludeFromIndexes = entity.findLargeProperties_( data.value, data.name.toString(), - entityObject.excludeFromIndexes + entityObject.excludeFromIndexes, ); - } + }, ); } else { entityObject.excludeFromIndexes = entity.findLargeProperties_( entityObject.data, '', - entityObject.excludeFromIndexes + entityObject.excludeFromIndexes, ); } } diff --git a/src/v1/datastore_admin_client.ts b/src/v1/datastore_admin_client.ts index 66b310815..d4ec61b49 100644 --- a/src/v1/datastore_admin_client.ts +++ b/src/v1/datastore_admin_client.ts @@ -154,7 +154,7 @@ export class DatastoreAdminClient { */ constructor( opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback + gaxInstance?: typeof gax | typeof gax.fallback, ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof DatastoreAdminClient; @@ -164,7 +164,7 @@ export class DatastoreAdminClient { opts?.universe_domain !== opts?.universeDomain ) { throw new Error( - 'Please set either universe_domain or universeDomain, but not both.' + 'Please set either universe_domain or universeDomain, but not both.', ); } const universeDomainEnvVar = @@ -250,7 +250,7 @@ export class DatastoreAdminClient { listIndexes: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', - 'indexes' + 'indexes', ), }; @@ -287,50 +287,50 @@ export class DatastoreAdminClient { .lro(lroOptions) .operationsClient(opts); const exportEntitiesResponse = protoFilesRoot.lookup( - '.google.datastore.admin.v1.ExportEntitiesResponse' + '.google.datastore.admin.v1.ExportEntitiesResponse', ) as gax.protobuf.Type; const exportEntitiesMetadata = protoFilesRoot.lookup( - '.google.datastore.admin.v1.ExportEntitiesMetadata' + '.google.datastore.admin.v1.ExportEntitiesMetadata', ) as gax.protobuf.Type; const importEntitiesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty' + '.google.protobuf.Empty', ) as gax.protobuf.Type; const importEntitiesMetadata = protoFilesRoot.lookup( - '.google.datastore.admin.v1.ImportEntitiesMetadata' + '.google.datastore.admin.v1.ImportEntitiesMetadata', ) as gax.protobuf.Type; const createIndexResponse = protoFilesRoot.lookup( - '.google.datastore.admin.v1.Index' + '.google.datastore.admin.v1.Index', ) as gax.protobuf.Type; const createIndexMetadata = protoFilesRoot.lookup( - '.google.datastore.admin.v1.IndexOperationMetadata' + '.google.datastore.admin.v1.IndexOperationMetadata', ) as gax.protobuf.Type; const deleteIndexResponse = protoFilesRoot.lookup( - '.google.datastore.admin.v1.Index' + '.google.datastore.admin.v1.Index', ) as gax.protobuf.Type; const deleteIndexMetadata = protoFilesRoot.lookup( - '.google.datastore.admin.v1.IndexOperationMetadata' + '.google.datastore.admin.v1.IndexOperationMetadata', ) as gax.protobuf.Type; this.descriptors.longrunning = { exportEntities: new this._gaxModule.LongrunningDescriptor( this.operationsClient, exportEntitiesResponse.decode.bind(exportEntitiesResponse), - exportEntitiesMetadata.decode.bind(exportEntitiesMetadata) + exportEntitiesMetadata.decode.bind(exportEntitiesMetadata), ), importEntities: new this._gaxModule.LongrunningDescriptor( this.operationsClient, importEntitiesResponse.decode.bind(importEntitiesResponse), - importEntitiesMetadata.decode.bind(importEntitiesMetadata) + importEntitiesMetadata.decode.bind(importEntitiesMetadata), ), createIndex: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createIndexResponse.decode.bind(createIndexResponse), - createIndexMetadata.decode.bind(createIndexMetadata) + createIndexMetadata.decode.bind(createIndexMetadata), ), deleteIndex: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteIndexResponse.decode.bind(deleteIndexResponse), - deleteIndexMetadata.decode.bind(deleteIndexMetadata) + deleteIndexMetadata.decode.bind(deleteIndexMetadata), ), }; @@ -339,7 +339,7 @@ export class DatastoreAdminClient { 'google.datastore.admin.v1.DatastoreAdmin', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} + {'x-goog-api-client': clientHeader.join(' ')}, ); // Set up a dictionary of "inner API calls"; the core implementation @@ -373,12 +373,12 @@ export class DatastoreAdminClient { this.datastoreAdminStub = this._gaxGrpc.createStub( this._opts.fallback ? (this._protos as protobuf.Root).lookupService( - 'google.datastore.admin.v1.DatastoreAdmin' + 'google.datastore.admin.v1.DatastoreAdmin', ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.datastore.admin.v1.DatastoreAdmin, this._opts, - this._providedCustomServicePath + this._providedCustomServicePath, ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -403,7 +403,7 @@ export class DatastoreAdminClient { }, (err: Error | null | undefined) => () => { throw err; - } + }, ); const descriptor = @@ -414,7 +414,7 @@ export class DatastoreAdminClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -435,7 +435,7 @@ export class DatastoreAdminClient { ) { process.emitWarning( 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning' + 'DeprecationWarning', ); } return 'datastore.googleapis.com'; @@ -453,7 +453,7 @@ export class DatastoreAdminClient { ) { process.emitWarning( 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning' + 'DeprecationWarning', ); } return 'datastore.googleapis.com'; @@ -498,7 +498,7 @@ export class DatastoreAdminClient { * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( - callback?: Callback + callback?: Callback, ): Promise | void { if (callback) { this.auth.getProjectId(callback); @@ -530,7 +530,7 @@ export class DatastoreAdminClient { */ getIndex( request?: protos.google.datastore.admin.v1.IGetIndexRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.admin.v1.IIndex, @@ -545,7 +545,7 @@ export class DatastoreAdminClient { protos.google.datastore.admin.v1.IIndex, protos.google.datastore.admin.v1.IGetIndexRequest | null | undefined, {} | null | undefined - > + >, ): void; getIndex( request: protos.google.datastore.admin.v1.IGetIndexRequest, @@ -553,7 +553,7 @@ export class DatastoreAdminClient { protos.google.datastore.admin.v1.IIndex, protos.google.datastore.admin.v1.IGetIndexRequest | null | undefined, {} | null | undefined - > + >, ): void; getIndex( request?: protos.google.datastore.admin.v1.IGetIndexRequest, @@ -568,7 +568,7 @@ export class DatastoreAdminClient { protos.google.datastore.admin.v1.IIndex, protos.google.datastore.admin.v1.IGetIndexRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.admin.v1.IIndex, @@ -646,7 +646,7 @@ export class DatastoreAdminClient { */ exportEntities( request?: protos.google.datastore.admin.v1.IExportEntitiesRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ LROperation< @@ -667,7 +667,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; exportEntities( request: protos.google.datastore.admin.v1.IExportEntitiesRequest, @@ -678,7 +678,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; exportEntities( request?: protos.google.datastore.admin.v1.IExportEntitiesRequest, @@ -699,7 +699,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): Promise< [ LROperation< @@ -740,7 +740,7 @@ export class DatastoreAdminClient { * region_tag:datastore_v1_generated_DatastoreAdmin_ExportEntities_async */ async checkExportEntitiesProgress( - name: string + name: string, ): Promise< LROperation< protos.google.datastore.admin.v1.ExportEntitiesResponse, @@ -749,13 +749,13 @@ export class DatastoreAdminClient { > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} + {name}, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.exportEntities, - this._gaxModule.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings(), ); return decodeOperation as LROperation< protos.google.datastore.admin.v1.ExportEntitiesResponse, @@ -808,7 +808,7 @@ export class DatastoreAdminClient { */ importEntities( request?: protos.google.datastore.admin.v1.IImportEntitiesRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ LROperation< @@ -829,7 +829,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; importEntities( request: protos.google.datastore.admin.v1.IImportEntitiesRequest, @@ -840,7 +840,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; importEntities( request?: protos.google.datastore.admin.v1.IImportEntitiesRequest, @@ -861,7 +861,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): Promise< [ LROperation< @@ -902,7 +902,7 @@ export class DatastoreAdminClient { * region_tag:datastore_v1_generated_DatastoreAdmin_ImportEntities_async */ async checkImportEntitiesProgress( - name: string + name: string, ): Promise< LROperation< protos.google.protobuf.Empty, @@ -911,13 +911,13 @@ export class DatastoreAdminClient { > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} + {name}, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importEntities, - this._gaxModule.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings(), ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -960,7 +960,7 @@ export class DatastoreAdminClient { */ createIndex( request?: protos.google.datastore.admin.v1.ICreateIndexRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ LROperation< @@ -981,7 +981,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; createIndex( request: protos.google.datastore.admin.v1.ICreateIndexRequest, @@ -992,7 +992,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; createIndex( request?: protos.google.datastore.admin.v1.ICreateIndexRequest, @@ -1013,7 +1013,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): Promise< [ LROperation< @@ -1054,7 +1054,7 @@ export class DatastoreAdminClient { * region_tag:datastore_v1_generated_DatastoreAdmin_CreateIndex_async */ async checkCreateIndexProgress( - name: string + name: string, ): Promise< LROperation< protos.google.datastore.admin.v1.Index, @@ -1063,13 +1063,13 @@ export class DatastoreAdminClient { > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} + {name}, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createIndex, - this._gaxModule.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings(), ); return decodeOperation as LROperation< protos.google.datastore.admin.v1.Index, @@ -1108,7 +1108,7 @@ export class DatastoreAdminClient { */ deleteIndex( request?: protos.google.datastore.admin.v1.IDeleteIndexRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ LROperation< @@ -1129,7 +1129,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; deleteIndex( request: protos.google.datastore.admin.v1.IDeleteIndexRequest, @@ -1140,7 +1140,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): void; deleteIndex( request?: protos.google.datastore.admin.v1.IDeleteIndexRequest, @@ -1161,7 +1161,7 @@ export class DatastoreAdminClient { >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined - > + >, ): Promise< [ LROperation< @@ -1203,7 +1203,7 @@ export class DatastoreAdminClient { * region_tag:datastore_v1_generated_DatastoreAdmin_DeleteIndex_async */ async checkDeleteIndexProgress( - name: string + name: string, ): Promise< LROperation< protos.google.datastore.admin.v1.Index, @@ -1212,13 +1212,13 @@ export class DatastoreAdminClient { > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} + {name}, ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deleteIndex, - this._gaxModule.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings(), ); return decodeOperation as LROperation< protos.google.datastore.admin.v1.Index, @@ -1254,7 +1254,7 @@ export class DatastoreAdminClient { */ listIndexes( request?: protos.google.datastore.admin.v1.IListIndexesRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.admin.v1.IIndex[], @@ -1269,7 +1269,7 @@ export class DatastoreAdminClient { protos.google.datastore.admin.v1.IListIndexesRequest, protos.google.datastore.admin.v1.IListIndexesResponse | null | undefined, protos.google.datastore.admin.v1.IIndex - > + >, ): void; listIndexes( request: protos.google.datastore.admin.v1.IListIndexesRequest, @@ -1277,7 +1277,7 @@ export class DatastoreAdminClient { protos.google.datastore.admin.v1.IListIndexesRequest, protos.google.datastore.admin.v1.IListIndexesResponse | null | undefined, protos.google.datastore.admin.v1.IIndex - > + >, ): void; listIndexes( request?: protos.google.datastore.admin.v1.IListIndexesRequest, @@ -1294,7 +1294,7 @@ export class DatastoreAdminClient { protos.google.datastore.admin.v1.IListIndexesRequest, protos.google.datastore.admin.v1.IListIndexesResponse | null | undefined, protos.google.datastore.admin.v1.IIndex - > + >, ): Promise< [ protos.google.datastore.admin.v1.IIndex[], @@ -1346,7 +1346,7 @@ export class DatastoreAdminClient { */ listIndexesStream( request?: protos.google.datastore.admin.v1.IListIndexesRequest, - options?: CallOptions + options?: CallOptions, ): Transform { request = request || {}; options = options || {}; @@ -1362,7 +1362,7 @@ export class DatastoreAdminClient { return this.descriptors.page.listIndexes.createStream( this.innerApiCalls.listIndexes as GaxCall, request, - callSettings + callSettings, ); } @@ -1394,7 +1394,7 @@ export class DatastoreAdminClient { */ listIndexesAsync( request?: protos.google.datastore.admin.v1.IListIndexesRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { request = request || {}; options = options || {}; @@ -1410,7 +1410,7 @@ export class DatastoreAdminClient { return this.descriptors.page.listIndexes.asyncIterate( this.innerApiCalls['listIndexes'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } /** @@ -1456,7 +1456,7 @@ export class DatastoreAdminClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { return this.operationsClient.getOperation(request, options, callback); } @@ -1492,7 +1492,7 @@ export class DatastoreAdminClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { return this.operationsClient.listOperationsAsync(request, options); } @@ -1540,7 +1540,7 @@ export class DatastoreAdminClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { return this.operationsClient.cancelOperation(request, options, callback); } @@ -1583,7 +1583,7 @@ export class DatastoreAdminClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { return this.operationsClient.deleteOperation(request, options, callback); } diff --git a/src/v1/datastore_client.ts b/src/v1/datastore_client.ts index 58e07a3c6..89a852949 100644 --- a/src/v1/datastore_client.ts +++ b/src/v1/datastore_client.ts @@ -111,7 +111,7 @@ export class DatastoreClient { */ constructor( opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback + gaxInstance?: typeof gax | typeof gax.fallback, ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof DatastoreClient; @@ -121,7 +121,7 @@ export class DatastoreClient { opts?.universe_domain !== opts?.universeDomain ) { throw new Error( - 'Please set either universe_domain or universeDomain, but not both.' + 'Please set either universe_domain or universeDomain, but not both.', ); } const universeDomainEnvVar = @@ -240,7 +240,7 @@ export class DatastoreClient { 'google.datastore.v1.Datastore', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} + {'x-goog-api-client': clientHeader.join(' ')}, ); // Set up a dictionary of "inner API calls"; the core implementation @@ -274,12 +274,12 @@ export class DatastoreClient { this.datastoreStub = this._gaxGrpc.createStub( this._opts.fallback ? (this._protos as protobuf.Root).lookupService( - 'google.datastore.v1.Datastore' + 'google.datastore.v1.Datastore', ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.datastore.v1.Datastore, this._opts, - this._providedCustomServicePath + this._providedCustomServicePath, ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -306,7 +306,7 @@ export class DatastoreClient { }, (err: Error | null | undefined) => () => { throw err; - } + }, ); const descriptor = undefined; @@ -314,7 +314,7 @@ export class DatastoreClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -335,7 +335,7 @@ export class DatastoreClient { ) { process.emitWarning( 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning' + 'DeprecationWarning', ); } return 'datastore.googleapis.com'; @@ -353,7 +353,7 @@ export class DatastoreClient { ) { process.emitWarning( 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning' + 'DeprecationWarning', ); } return 'datastore.googleapis.com'; @@ -398,7 +398,7 @@ export class DatastoreClient { * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( - callback?: Callback + callback?: Callback, ): Promise | void { if (callback) { this.auth.getProjectId(callback); @@ -444,7 +444,7 @@ export class DatastoreClient { */ lookup( request?: protos.google.datastore.v1.ILookupRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.ILookupResponse, @@ -459,7 +459,7 @@ export class DatastoreClient { protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined - > + >, ): void; lookup( request: protos.google.datastore.v1.ILookupRequest, @@ -467,7 +467,7 @@ export class DatastoreClient { protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined - > + >, ): void; lookup( request?: protos.google.datastore.v1.ILookupRequest, @@ -482,7 +482,7 @@ export class DatastoreClient { protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.ILookupResponse, @@ -570,7 +570,7 @@ export class DatastoreClient { */ runQuery( request?: protos.google.datastore.v1.IRunQueryRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.IRunQueryResponse, @@ -585,7 +585,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined - > + >, ): void; runQuery( request: protos.google.datastore.v1.IRunQueryRequest, @@ -593,7 +593,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined - > + >, ): void; runQuery( request?: protos.google.datastore.v1.IRunQueryRequest, @@ -608,7 +608,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.IRunQueryResponse, @@ -690,7 +690,7 @@ export class DatastoreClient { */ runAggregationQuery( request?: protos.google.datastore.v1.IRunAggregationQueryRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.IRunAggregationQueryResponse, @@ -705,7 +705,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRunAggregationQueryResponse, protos.google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined - > + >, ): void; runAggregationQuery( request: protos.google.datastore.v1.IRunAggregationQueryRequest, @@ -713,7 +713,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRunAggregationQueryResponse, protos.google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined - > + >, ): void; runAggregationQuery( request?: protos.google.datastore.v1.IRunAggregationQueryRequest, @@ -730,7 +730,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRunAggregationQueryResponse, protos.google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.IRunAggregationQueryResponse, @@ -800,7 +800,7 @@ export class DatastoreClient { */ beginTransaction( request?: protos.google.datastore.v1.IBeginTransactionRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.IBeginTransactionResponse, @@ -815,7 +815,7 @@ export class DatastoreClient { protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined - > + >, ): void; beginTransaction( request: protos.google.datastore.v1.IBeginTransactionRequest, @@ -823,7 +823,7 @@ export class DatastoreClient { protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined - > + >, ): void; beginTransaction( request?: protos.google.datastore.v1.IBeginTransactionRequest, @@ -840,7 +840,7 @@ export class DatastoreClient { protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.IBeginTransactionResponse, @@ -934,7 +934,7 @@ export class DatastoreClient { */ commit( request?: protos.google.datastore.v1.ICommitRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.ICommitResponse, @@ -949,7 +949,7 @@ export class DatastoreClient { protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined - > + >, ): void; commit( request: protos.google.datastore.v1.ICommitRequest, @@ -957,7 +957,7 @@ export class DatastoreClient { protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined - > + >, ): void; commit( request?: protos.google.datastore.v1.ICommitRequest, @@ -972,7 +972,7 @@ export class DatastoreClient { protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.ICommitResponse, @@ -1043,7 +1043,7 @@ export class DatastoreClient { */ rollback( request?: protos.google.datastore.v1.IRollbackRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.IRollbackResponse, @@ -1058,7 +1058,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined - > + >, ): void; rollback( request: protos.google.datastore.v1.IRollbackRequest, @@ -1066,7 +1066,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined - > + >, ): void; rollback( request?: protos.google.datastore.v1.IRollbackRequest, @@ -1081,7 +1081,7 @@ export class DatastoreClient { protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.IRollbackResponse, @@ -1153,7 +1153,7 @@ export class DatastoreClient { */ allocateIds( request?: protos.google.datastore.v1.IAllocateIdsRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.IAllocateIdsResponse, @@ -1168,7 +1168,7 @@ export class DatastoreClient { protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined - > + >, ): void; allocateIds( request: protos.google.datastore.v1.IAllocateIdsRequest, @@ -1176,7 +1176,7 @@ export class DatastoreClient { protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined - > + >, ): void; allocateIds( request?: protos.google.datastore.v1.IAllocateIdsRequest, @@ -1191,7 +1191,7 @@ export class DatastoreClient { protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.IAllocateIdsResponse, @@ -1263,7 +1263,7 @@ export class DatastoreClient { */ reserveIds( request?: protos.google.datastore.v1.IReserveIdsRequest, - options?: CallOptions + options?: CallOptions, ): Promise< [ protos.google.datastore.v1.IReserveIdsResponse, @@ -1278,7 +1278,7 @@ export class DatastoreClient { protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined - > + >, ): void; reserveIds( request: protos.google.datastore.v1.IReserveIdsRequest, @@ -1286,7 +1286,7 @@ export class DatastoreClient { protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined - > + >, ): void; reserveIds( request?: protos.google.datastore.v1.IReserveIdsRequest, @@ -1301,7 +1301,7 @@ export class DatastoreClient { protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.IReserveIdsResponse, @@ -1390,7 +1390,7 @@ export class DatastoreClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { return this.operationsClient.getOperation(request, options, callback); } @@ -1426,7 +1426,7 @@ export class DatastoreClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { return this.operationsClient.listOperationsAsync(request, options); } @@ -1474,7 +1474,7 @@ export class DatastoreClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { return this.operationsClient.cancelOperation(request, options, callback); } @@ -1517,7 +1517,7 @@ export class DatastoreClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { return this.operationsClient.deleteOperation(request, options, callback); } diff --git a/system-test/datastore.ts b/system-test/datastore.ts index c8eeecebb..1290ccb94 100644 --- a/system-test/datastore.ts +++ b/system-test/datastore.ts @@ -57,7 +57,7 @@ async.each( }; const {indexes: DECLARED_INDEXES} = yaml.load( - readFileSync(path.join(__dirname, 'data', 'index.yaml'), 'utf8') + readFileSync(path.join(__dirname, 'data', 'index.yaml'), 'utf8'), ) as {indexes: google.datastore.admin.v1.IIndex[]}; // TODO/DX ensure indexes before testing, and maybe? cleanup indexes after @@ -471,10 +471,10 @@ async.each( key: secondaryDatastore.key(['Post', keyName]), data: postData, }; - } + }, ); await Promise.all( - secondaryData.map(async datum => secondaryDatastore.save(datum)) + secondaryData.map(async datum => secondaryDatastore.save(datum)), ); // Next, ensure that the default database has the right records const query = defaultDatastore @@ -485,7 +485,7 @@ async.each( assert.strictEqual(defaultDatastoreResults.length, 1); assert.strictEqual( defaultDatastoreResults[0].author, - defaultAuthor + defaultAuthor, ); // Next, ensure that the other database has the right records await Promise.all( @@ -496,12 +496,12 @@ async.each( const [results] = await secondaryDatastore.runQuery(query); assert.strictEqual(results.length, 1); assert.strictEqual(results[0].author, datum.data.author); - }) + }), ); // Cleanup await defaultDatastore.delete(defaultPostKey); await Promise.all( - secondaryData.map(datum => secondaryDatastore.delete(datum.key)) + secondaryData.map(datum => secondaryDatastore.delete(datum.key)), ); }); }); @@ -556,7 +556,7 @@ async.each( const data = { buf: Buffer.from( '010100000000000000000059400000000000006940', - 'hex' + 'hex', ), }; await datastore.save({key: postKey, data}); @@ -656,7 +656,7 @@ async.each( key: postKey, method: 'insert', data: post, - }) + }), ); const [entity] = await datastore.get(postKey); delete entity[datastore.KEY]; @@ -671,7 +671,7 @@ async.each( key: postKey, method: 'update', data: post, - }) + }), ); }); @@ -720,7 +720,7 @@ async.each( assert.strictEqual(numEntitiesEmitted, 2); datastore.delete([key1, key2], done); }); - } + }, ); }); @@ -1100,7 +1100,7 @@ async.each( and([ new PropertyFilter('family', '=', 'Stark'), new PropertyFilter('appearances', '>=', 20), - ]) + ]), ); const [entities] = await datastore.runQuery(q); assert.strictEqual(entities!.length, 6); @@ -1120,7 +1120,7 @@ async.each( or([ new PropertyFilter('family', '=', 'Stark'), new PropertyFilter('appearances', '>=', 20), - ]) + ]), ); const [entities] = await datastore.runQuery(q); assert.strictEqual(entities!.length, 8); @@ -1212,7 +1212,7 @@ async.each( }); } function checkAggregationQueryExecutionStats( - executionStats?: ExecutionStats + executionStats?: ExecutionStats, ) { // This function ensures the execution stats returned from the server are correct. // First fix stats values that will be different every time a query profiling @@ -1262,7 +1262,7 @@ async.each( assert(!info.explainMetrics); assert.deepStrictEqual( entities.sort(compare).map(entity => entity.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); await transaction.commit(); }); @@ -1284,7 +1284,7 @@ async.each( assert.deepStrictEqual(entities, []); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); await transaction.commit(); }); @@ -1306,7 +1306,7 @@ async.each( assert.deepStrictEqual(entities, []); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); await transaction.commit(); }); @@ -1325,13 +1325,13 @@ async.each( } assert.deepStrictEqual( entities.sort(compare).map(entity => entity.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); assert(info.explainMetrics); checkQueryExecutionStats(info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); await transaction.commit(); }); @@ -1359,7 +1359,7 @@ async.each( try { [entities, info] = await transaction.runAggregationQuery( aggregate, - {} + {}, ); } catch (e) { await transaction.rollback(); @@ -1377,7 +1377,7 @@ async.each( aggregate, { explainOptions: {}, - } + }, ); } catch (e) { await transaction.rollback(); @@ -1387,7 +1387,7 @@ async.each( assert.deepStrictEqual(entities, []); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); await transaction.commit(); }); @@ -1401,7 +1401,7 @@ async.each( explainOptions: { analyze: false, }, - } + }, ); } catch (e) { await transaction.rollback(); @@ -1411,7 +1411,7 @@ async.each( assert.deepStrictEqual(entities, []); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); await transaction.commit(); }); @@ -1423,7 +1423,7 @@ async.each( aggregate, { explainOptions: {analyze: true}, - } + }, ); } catch (e) { await transaction.rollback(); @@ -1432,11 +1432,11 @@ async.each( assert(info.explainMetrics); assert.deepStrictEqual(entities, expectedAggregationResults); checkAggregationQueryExecutionStats( - info.explainMetrics.executionStats + info.explainMetrics.executionStats, ); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); await transaction.commit(); }); @@ -1449,7 +1449,7 @@ async.each( assert(!info.explainMetrics); assert.deepStrictEqual( entities.sort(compare).map(entity => entity.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); }); it('should run a query with explain options and no analyze option specified', async () => { @@ -1461,7 +1461,7 @@ async.each( assert(!info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); }); it('should run a query with explain options and analyze set to false', async () => { @@ -1473,7 +1473,7 @@ async.each( assert(!info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); }); it('should run a query with explain options and analyze set to true', async () => { @@ -1482,13 +1482,13 @@ async.each( }); assert.deepStrictEqual( entities.sort(compare).map(entity => entity.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); assert(info.explainMetrics); checkQueryExecutionStats(info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); }); }); @@ -1499,7 +1499,7 @@ async.each( assert(!info.explainMetrics); assert.deepStrictEqual( entities.sort(compare).map(entity => entity.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); }); it('should run a query with explain options and no value set for analyze', async () => { @@ -1509,7 +1509,7 @@ async.each( assert(!info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); }); it('should run a query with explain options and analyze set to false', async () => { @@ -1521,7 +1521,7 @@ async.each( assert(!info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); }); it('should run a query with explain options and analyze set to true', async () => { @@ -1530,14 +1530,14 @@ async.each( }); assert.deepStrictEqual( entities.sort(compare).map(entity => entity.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); assert(info.explainMetrics); checkQueryExecutionStats(info.explainMetrics.executionStats); assert(info.explainMetrics.planSummary); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); }); }); @@ -1561,7 +1561,7 @@ async.each( entities .sort(compare) .map((entity: Entity) => entity?.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); assert(!savedInfo.explainMetrics); resolve(); @@ -1589,7 +1589,7 @@ async.each( assert(!savedInfo.explainMetrics.executionStats); assert.deepStrictEqual( savedInfo.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); resolve(); }); @@ -1618,7 +1618,7 @@ async.each( assert(!savedInfo.explainMetrics.executionStats); assert.deepStrictEqual( savedInfo.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); resolve(); }); @@ -1644,15 +1644,15 @@ async.each( entities .sort(compare) .map((entity: Entity) => entity?.name), - [...characters].sort(compare).map(entity => entity.name) + [...characters].sort(compare).map(entity => entity.name), ); assert(savedInfo.explainMetrics); checkQueryExecutionStats( - savedInfo.explainMetrics.executionStats + savedInfo.explainMetrics.executionStats, ); assert.deepStrictEqual( savedInfo.explainMetrics.planSummary, - expectedRunQueryPlan + expectedRunQueryPlan, ); resolve(); }); @@ -1680,14 +1680,14 @@ async.each( aggregate, { explainOptions: {}, - } + }, ); assert.deepStrictEqual(entities, []); assert(info.explainMetrics); assert(!info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); }); it('should run an aggregation query with explain options specified and analyze set to false', async () => { @@ -1695,14 +1695,14 @@ async.each( aggregate, { explainOptions: {analyze: false}, - } + }, ); assert.deepStrictEqual(entities, []); assert(info.explainMetrics); assert(!info.explainMetrics.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); }); it('should run an aggregation query with explain options and analyze set to true', async () => { @@ -1710,16 +1710,16 @@ async.each( aggregate, { explainOptions: {analyze: true}, - } + }, ); assert.deepStrictEqual(entities, expectedAggregationResults); assert(info.explainMetrics); checkAggregationQueryExecutionStats( - info.explainMetrics.executionStats + info.explainMetrics.executionStats, ); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); }); }); @@ -1747,7 +1747,7 @@ async.each( assert(!info.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); }); it('should run an aggregation query with explain options and analyze set to false', async () => { @@ -1761,7 +1761,7 @@ async.each( assert(!info.executionStats); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); }); it('should run an aggregation query with explain options specified and analyze set to true', async () => { @@ -1771,11 +1771,11 @@ async.each( assert.deepStrictEqual(entities, expectedAggregationResults); assert(info.explainMetrics); checkAggregationQueryExecutionStats( - info.explainMetrics.executionStats + info.explainMetrics.executionStats, ); assert.deepStrictEqual( info.explainMetrics.planSummary, - expectedRunAggregationQueryPlan + expectedRunAggregationQueryPlan, ); }); }); @@ -1870,7 +1870,7 @@ async.each( } catch (err: any) { assert.strictEqual( err.message, - '3 INVALID_ARGUMENT: Aggregations are not supported for the property: __key__' + '3 INVALID_ARGUMENT: Aggregations are not supported for the property: __key__', ); } }); @@ -1937,7 +1937,7 @@ async.each( const aggregate = datastore .createAggregationQuery(q) .addAggregation( - AggregateField.average('appearances').alias('avg1') + AggregateField.average('appearances').alias('avg1'), ); const [results] = await datastore.runAggregationQuery(aggregate); assert.deepStrictEqual(results, [{avg1: 28.166666666666668}]); @@ -1947,7 +1947,7 @@ async.each( const aggregate = datastore .createAggregationQuery(q) .addAggregation( - AggregateField.average('appearances').alias('avg1') + AggregateField.average('appearances').alias('avg1'), ); const [results] = await datastore.runAggregationQuery(aggregate); assert.deepStrictEqual(results, [{avg1: 23.375}]); @@ -2004,7 +2004,7 @@ async.each( } catch (err: any) { assert.strictEqual( err.message, - '3 INVALID_ARGUMENT: Aggregations are not supported for the property: __key__' + '3 INVALID_ARGUMENT: Aggregations are not supported for the property: __key__', ); } }); @@ -2170,7 +2170,7 @@ async.each( } catch (err: any) { assert.strictEqual( err.message, - '3 INVALID_ARGUMENT: The maximum number of aggregations allowed in an aggregation query is 5. Received: 6' + '3 INVALID_ARGUMENT: The maximum number of aggregations allowed in an aggregation query is 5. Received: 6', ); } }); @@ -2187,14 +2187,14 @@ async.each( .createQuery('Character') .filter('status', null) .filters.pop()?.val, - null + null, ); assert.strictEqual( datastore .createQuery('Character') .filter('status', '=', null) .filters.pop()?.val, - null + null, ); }); it('should filter by key', async () => { @@ -2605,7 +2605,7 @@ async.each( }); }); }); - } + }, ); }); describe('comparing times with and without transaction.run', async () => { @@ -2779,7 +2779,7 @@ async.each( await datastore.delete(key); }); async function doRunAggregationQueryPutCommit( - transaction: Transaction + transaction: Transaction, ) { const query = transaction.createQuery('Company'); const aggregateQuery = transaction @@ -2813,7 +2813,7 @@ async.each( await datastore.delete(key); }); async function doPutRunAggregationQueryCommit( - transaction: Transaction + transaction: Transaction, ) { transaction.save({key, data: obj}); const query = transaction.createQuery('Company'); @@ -2990,7 +2990,7 @@ async.each( const [results] = await datastore.runQuery(query); assert.deepStrictEqual( results.map(result => result.rating), - [100, 100] + [100, 100], ); }); it('should aggregate query within a count transaction', async () => { @@ -3139,7 +3139,7 @@ async.each( const [indexes] = await datastore.getIndexes(); assert.ok( indexes.length >= DECLARED_INDEXES.length, - 'has at least the number of indexes per system-test/data/index.yaml' + 'has at least the number of indexes per system-test/data/index.yaml', ); // Comparing index.yaml and the actual defined index in Datastore requires @@ -3150,11 +3150,11 @@ async.each( assert.ok(firstIndex, 'first index is readable'); assert.ok( firstIndex.metadata!.properties, - 'has properties collection' + 'has properties collection', ); assert.ok( firstIndex.metadata!.properties.length, - 'with properties inside' + 'with properties inside', ); assert.ok(firstIndex.metadata!.ancestor, 'has the ancestor property'); }); @@ -3183,7 +3183,7 @@ async.each( assert.deepStrictEqual( metadata, firstIndex.metadata, - 'asked index is the same as received index' + 'asked index is the same as received index', ); }); }); @@ -3203,7 +3203,7 @@ async.each( const ms = Math.pow(2, retries) * 500 + Math.random() * 1000; return new Promise(done => { console.info( - `retrying "${test.test?.title}" after attempt ${currentAttempt} in ${ms}ms` + `retrying "${test.test?.title}" after attempt ${currentAttempt} in ${ms}ms`, ); setTimeout(done, ms); }); @@ -3233,7 +3233,7 @@ async.each( // Throw an error on every retry except the last one if (currentAttempt <= numberOfRetries) { throw Error( - 'This is not the last retry so throw an error to force the test to run again' + 'This is not the last retry so throw an error to force the test to run again', ); } // Check that the attempt number and the number of times console.info is called is correct. @@ -3267,7 +3267,7 @@ async.each( ( importOperation.metadata as google.datastore.admin.v1.IImportEntitiesMetadata ).inputUrl, - `gs://${exportedFile.bucket.name}/${exportedFile.name}` + `gs://${exportedFile.bucket.name}/${exportedFile.name}`, ); await importOperation.cancel(); @@ -3296,5 +3296,5 @@ async.each( }); }); }); - } + }, ); diff --git a/system-test/install.ts b/system-test/install.ts index 83b83f332..22bbd8336 100644 --- a/system-test/install.ts +++ b/system-test/install.ts @@ -28,7 +28,7 @@ describe('📦 pack-n-play test', () => { sample: { description: 'TypeScript user can use the type definitions', ts: readFileSync( - './system-test/fixtures/sample/src/index.ts' + './system-test/fixtures/sample/src/index.ts', ).toString(), }, }; @@ -42,7 +42,7 @@ describe('📦 pack-n-play test', () => { sample: { description: 'JavaScript user can use the library', ts: readFileSync( - './system-test/fixtures/sample/src/index.js' + './system-test/fixtures/sample/src/index.js', ).toString(), }, }; diff --git a/test/entity.ts b/test/entity.ts index 88b4c1d10..2d4060573 100644 --- a/test/entity.ts +++ b/test/entity.ts @@ -40,7 +40,7 @@ export function outOfBoundsError(opts: { '{\n' + ' integerTypeCastFunction: provide \n' + ' properties: optionally specify property name(s) to be custom casted\n' + - '}\n' + '}\n', ); } @@ -127,7 +127,7 @@ describe('entity', () => { it('should throw if integerTypeCastOptions is provided but integerTypeCastFunction is not', () => { assert.throws( () => new testEntity.Int(valueProto, {}).valueOf(), - /integerTypeCastFunction is not a function or was not provided\./ + /integerTypeCastFunction is not a function or was not provided\./, ); }); @@ -163,7 +163,7 @@ describe('entity', () => { () => { new testEntity.Int(largeIntegerValue).valueOf(); }, - outOfBoundsError({integerValue: largeIntegerValue}) + outOfBoundsError({integerValue: largeIntegerValue}), ); // should throw when string is passed @@ -171,7 +171,7 @@ describe('entity', () => { () => { new testEntity.Int(smallIntegerValue.toString()).valueOf(); }, - outOfBoundsError({integerValue: smallIntegerValue}) + outOfBoundsError({integerValue: smallIntegerValue}), ); }); @@ -187,7 +187,7 @@ describe('entity', () => { () => { new testEntity.Int(valueProto); }, - new RegExp(`Integer value ${largeIntegerValue} is out of bounds.`) + new RegExp(`Integer value ${largeIntegerValue} is out of bounds.`), ); }); }); @@ -199,7 +199,7 @@ describe('entity', () => { new testEntity.Int(valueProto, { integerTypeCastFunction: {}, }).valueOf(), - /integerTypeCastFunction is not a function or was not provided\./ + /integerTypeCastFunction is not a function or was not provided\./, ); }); @@ -459,7 +459,7 @@ describe('entity', () => { assert.deepStrictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); @@ -467,7 +467,7 @@ describe('entity', () => { const decodeValueProto = testEntity.decodeValueProto; testEntity.decodeValueProto = ( valueProto: {}, - wrapNumbers?: boolean | {} + wrapNumbers?: boolean | {}, ) => { assert.strictEqual(wrapNumbers, undefined); @@ -486,7 +486,7 @@ describe('entity', () => { let run = false; testEntity.decodeValueProto = ( valueProto: {}, - wrapNumbers?: boolean | {} + wrapNumbers?: boolean | {}, ) => { if (!run) { run = true; @@ -500,14 +500,14 @@ describe('entity', () => { assert.deepStrictEqual( testEntity.decodeValueProto(valueProto, wrapNumbersBoolean), - expectedValue + expectedValue, ); // reset the run flag. run = false; assert.deepStrictEqual( testEntity.decodeValueProto(valueProto, wrapNumbersObject), - expectedValue + expectedValue, ); }); }); @@ -528,7 +528,7 @@ describe('entity', () => { assert.strictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); @@ -542,7 +542,7 @@ describe('entity', () => { testEntity.entityFromEntityProto = ( entityProto: {}, - wrapNumbers?: boolean | {} + wrapNumbers?: boolean | {}, ) => { assert.strictEqual(wrapNumbers, undefined); assert.strictEqual(entityProto, expectedValue); @@ -551,7 +551,7 @@ describe('entity', () => { assert.strictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); @@ -567,7 +567,7 @@ describe('entity', () => { testEntity.entityFromEntityProto = ( entityProto: {}, - wrapNumbers?: boolean | {} + wrapNumbers?: boolean | {}, ) => { // verify that `wrapNumbers`param is passed (boolean or object) assert.ok(wrapNumbers); @@ -577,12 +577,12 @@ describe('entity', () => { assert.strictEqual( testEntity.decodeValueProto(valueProto, wrapNumbersBoolean), - expectedValue + expectedValue, ); assert.strictEqual( testEntity.decodeValueProto(valueProto, wrapNumbersObject), - expectedValue + expectedValue, ); }); }); @@ -597,7 +597,7 @@ describe('entity', () => { it('should not wrap ints by default', () => { assert.strictEqual( typeof testEntity.decodeValueProto(valueProto), - 'number' + 'number', ); }); @@ -653,7 +653,7 @@ describe('entity', () => { assert.strictEqual( testEntity.decodeValueProto(valueProto, wrapNumbers), - takeFirstTen(Number.MAX_SAFE_INTEGER) + takeFirstTen(Number.MAX_SAFE_INTEGER), ); assert.strictEqual(takeFirstTen.called, true); }); @@ -671,9 +671,9 @@ describe('entity', () => { .valueOf(), (err: Error) => { return new RegExp( - `integerTypeCastFunction threw an error:\n\n - ${errorMessage}` + `integerTypeCastFunction threw an error:\n\n - ${errorMessage}`, ).test(err.message); - } + }, ); }); }); @@ -689,7 +689,7 @@ describe('entity', () => { assert.deepStrictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); @@ -715,7 +715,7 @@ describe('entity', () => { assert.strictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); @@ -734,7 +734,7 @@ describe('entity', () => { assert.strictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); @@ -756,7 +756,7 @@ describe('entity', () => { assert.deepStrictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); @@ -770,7 +770,7 @@ describe('entity', () => { assert.strictEqual( testEntity.decodeValueProto(valueProto), - expectedValue + expectedValue, ); }); }); @@ -1035,7 +1035,7 @@ describe('entity', () => { assert.deepStrictEqual( testEntity.entityFromEntityProto(entityProto), - expectedEntity + expectedEntity, ); }); @@ -1106,14 +1106,14 @@ describe('entity', () => { assert.deepStrictEqual( testEntity.entityToEntityProto(entityObject), - expectedEntityProto + expectedEntityProto, ); }); it('should respect excludeFromIndexes', () => { assert.deepStrictEqual( testEntity.entityToEntityProto(entityObject), - expectedEntityProto + expectedEntityProto, ); }); @@ -1155,7 +1155,7 @@ describe('entity', () => { assert.deepStrictEqual( testEntity.entityToEntityProto(entityObject), - expectedEntityProto + expectedEntityProto, ); }); }); @@ -1355,7 +1355,7 @@ describe('entity', () => { assert.strictEqual((e as Error).name, 'InvalidKey'); assert.strictEqual( (e as Error).message, - 'Ancestor keys require an id or name.' + 'Ancestor keys require an id or name.', ); done(); } @@ -1439,7 +1439,7 @@ describe('entity', () => { assert.strictEqual((e as Error).name, 'InvalidKey'); assert.strictEqual( (e as Error).message, - 'A key should contain at least a kind.' + 'A key should contain at least a kind.', ); done(); } @@ -1457,7 +1457,7 @@ describe('entity', () => { assert.strictEqual((e as Error).name, 'InvalidKey'); assert.strictEqual( (e as Error).message, - 'Ancestor keys require an id or name.' + 'Ancestor keys require an id or name.', ); done(); } @@ -1618,12 +1618,12 @@ describe('entity', () => { .filter( new PropertyFilter('__key__', 'IN', [ new entity.Key({path: ['Kind1', 'key1']}), - ]) + ]), ); assert.deepStrictEqual( testEntity.queryToQueryProto(query), - keyWithInQuery + keyWithInQuery, ); }); @@ -1661,7 +1661,7 @@ describe('entity', () => { and([ new PropertyFilter('name', '=', 'John'), new PropertyFilter('__key__', 'HAS_ANCESTOR', ancestorKey), - ]) + ]), ) .start('start') .end('end') @@ -1705,7 +1705,7 @@ describe('entity', () => { assert.strictEqual( urlSafeKey.convertToBase64_(buffer), - 'SGVsbG8gV29ybGQ' + 'SGVsbG8gV29ybGQ', ); }); }); @@ -1714,7 +1714,7 @@ describe('entity', () => { it('should convert encoded url safe key to buffer', () => { assert.deepStrictEqual( urlSafeKey.convertToBuffer_('aGVsbG8gd29ybGQgZnJvbSBkYXRhc3RvcmU'), - Buffer.from('hello world from datastore') + Buffer.from('hello world from datastore'), ); }); }); @@ -1732,7 +1732,7 @@ describe('entity', () => { 'ahFzfmdyYXNzLWNsdW1wLTQ3OXIVCxIEVGFzayILc2FtcGxldGFzazEMogECTlM'; assert.strictEqual( urlSafeKey.legacyEncode(PROJECT_ID, key, LOCATION_PREFIX), - encodedKey + encodedKey, ); }); @@ -1747,7 +1747,7 @@ describe('entity', () => { 'ag9ncmFzcy1jbHVtcC00NzlyFQsSBFRhc2siC3NhbXBsZXRhc2sxDA'; assert.strictEqual( urlSafeKey.legacyEncode(PROJECT_ID, key), - encodedKey + encodedKey, ); }); @@ -1761,7 +1761,7 @@ describe('entity', () => { const encodedKey = 'ag9ncmFzcy1jbHVtcC00NzlyEQsSBFRhc2sYgICA3NWunAoM'; assert.strictEqual( urlSafeKey.legacyEncode(PROJECT_ID, key), - encodedKey + encodedKey, ); }); @@ -1775,7 +1775,7 @@ describe('entity', () => { const encodedKey = 'ag9ncmFzcy1jbHVtcC00NzlyEQsSBFRhc2sYgICA3NWunAoM'; assert.strictEqual( urlSafeKey.legacyEncode(PROJECT_ID, key), - encodedKey + encodedKey, ); }); @@ -1788,7 +1788,7 @@ describe('entity', () => { 'ahFzfmdyYXNzLWNsdW1wLTQ3OXIqCxIEVGFzayILc2FtcGxldGFzazEMCxIEVGFzayILc2FtcGxldGFzazIM'; assert.strictEqual( urlSafeKey.legacyEncode(PROJECT_ID, key, LOCATION_PREFIX), - encodedKey + encodedKey, ); }); }); diff --git a/test/entity/buildEntityProto.ts b/test/entity/buildEntityProto.ts index 3f646bc0f..2d2c868df 100644 --- a/test/entity/buildEntityProto.ts +++ b/test/entity/buildEntityProto.ts @@ -81,9 +81,9 @@ describe('buildEntityProto', () => { } assert.deepStrictEqual( buildEntityProto(test.entityObject), - test.expectedProto + test.expectedProto, ); }); - } + }, ); }); diff --git a/test/entity/excludeIndexesAndBuildProto.ts b/test/entity/excludeIndexesAndBuildProto.ts index 9526c1ee9..56ce08231 100644 --- a/test/entity/excludeIndexesAndBuildProto.ts +++ b/test/entity/excludeIndexesAndBuildProto.ts @@ -44,13 +44,13 @@ describe('excludeIndexesAndBuildProto', () => { if (entityProtoSubset.stringValue === longString) { if (entityProtoSubset.excludeFromIndexes !== true) { assert.fail( - `The entity proto at ${path} should excludeFromIndexes` + `The entity proto at ${path} should excludeFromIndexes`, ); } } else { if (entityProtoSubset.excludeFromIndexes === true) { assert.fail( - `The entity proto at ${path} should not excludeFromIndexes` + `The entity proto at ${path} should not excludeFromIndexes`, ); } } @@ -82,7 +82,7 @@ describe('excludeIndexesAndBuildProto', () => { }, }, }, - '' + '', ); }); it('should not throw an assertion error for long strings in the top level', () => { @@ -99,7 +99,7 @@ describe('excludeIndexesAndBuildProto', () => { }, }, }, - '' + '', ); }); it('should throw an assertion error for a missing excludeFromIndexes: true', () => { @@ -116,13 +116,13 @@ describe('excludeIndexesAndBuildProto', () => { }, }, }, - '' + '', ); assert.fail('checkEntityProto should have failed'); } catch (e) { assert.strictEqual( (e as ServiceError).message, - 'The entity proto at .properties.name should excludeFromIndexes' + 'The entity proto at .properties.name should excludeFromIndexes', ); } }); @@ -141,13 +141,13 @@ describe('excludeIndexesAndBuildProto', () => { }, }, }, - '' + '', ); assert.fail('checkEntityProto should have failed'); } catch (e) { assert.strictEqual( (e as ServiceError).message, - 'The entity proto at .properties.name should not excludeFromIndexes' + 'The entity proto at .properties.name should not excludeFromIndexes', ); } }); @@ -181,13 +181,13 @@ describe('excludeIndexesAndBuildProto', () => { }, }, }, - '' + '', ); assert.fail('checkEntityProto should have failed'); } catch (e) { assert.strictEqual( (e as ServiceError).message, - 'The entity proto at .properties.name.arrayValue.values.[1].entityValue.properties.metadata should not excludeFromIndexes' + 'The entity proto at .properties.name.arrayValue.values.[1].entityValue.properties.metadata should not excludeFromIndexes', ); } }); @@ -262,7 +262,7 @@ describe('excludeIndexesAndBuildProto', () => { */ function getGeneratedTestComponents( baseElement: {}, - baseTestName: string + baseTestName: string, ): GeneratedTestCase[] { const maxDepth = 5; const generatedTestCasesByDepth: GeneratedTestCase[][] = [ @@ -315,7 +315,7 @@ describe('excludeIndexesAndBuildProto', () => { value: longString, otherProperty: longString, }, - 'with long string properties and path ' + 'with long string properties and path ', ), getGeneratedTestComponents( { @@ -323,7 +323,7 @@ describe('excludeIndexesAndBuildProto', () => { value: 'short value', otherProperty: longString, }, - 'with long name property and path ' + 'with long name property and path ', ), ] .flat() @@ -375,6 +375,6 @@ describe('excludeIndexesAndBuildProto', () => { const entityProto = buildEntityProto(entityObject); checkEntityProto(entityProto, ''); }); - } + }, ); }); diff --git a/test/entity/extendExcludeFromIndexes.ts b/test/entity/extendExcludeFromIndexes.ts index 77c7f3d80..936dbaa48 100644 --- a/test/entity/extendExcludeFromIndexes.ts +++ b/test/entity/extendExcludeFromIndexes.ts @@ -165,9 +165,9 @@ describe('extendExcludeFromIndexes', () => { extendExcludeFromIndexes(entityObject); assert.deepStrictEqual( entityObject.excludeFromIndexes, - test.expectedOutput + test.expectedOutput, ); }); - } + }, ); }); diff --git a/test/entity/findLargeProperties_.ts b/test/entity/findLargeProperties_.ts index ed99df75e..028955baf 100644 --- a/test/entity/findLargeProperties_.ts +++ b/test/entity/findLargeProperties_.ts @@ -160,6 +160,6 @@ describe('findLargeProperties_', () => { const output = findLargeProperties_(test.entities, '', []); assert.deepStrictEqual(output, test.expectedOutput); }); - } + }, ); }); diff --git a/test/gapic-mocks/client-initialization-testing.ts b/test/gapic-mocks/client-initialization-testing.ts index d0be6c437..de5230ae3 100644 --- a/test/gapic-mocks/client-initialization-testing.ts +++ b/test/gapic-mocks/client-initialization-testing.ts @@ -59,7 +59,7 @@ class FakeDatastoreClient extends DatastoreClient { protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.datastore.v1.ILookupResponse, @@ -97,7 +97,7 @@ describe('Client Initialization Testing', () => { function compareRequest( request: DatastoreRequest, expectedFallback: Fallback, - done: mocha.Done + done: mocha.Done, ) { try { const client = request.datastore.clients_.get(clientName); @@ -138,7 +138,7 @@ describe('Client Initialization Testing', () => { // The CI environment can't fetch project id so the function that // fetches the project id needs to be mocked out. request.datastore.auth.getProjectId = ( - callback: (err: any, projectId: string) => void + callback: (err: any, projectId: string) => void, ) => { callback(null, 'some-project-id'); }; @@ -149,7 +149,7 @@ describe('Client Initialization Testing', () => { {client: clientName, method: 'lookup'}, () => { compareRequest(request, testParameters.expectedFallback, done); - } + }, ); }); it('should set the rest parameter in the data client when calling request_', done => { @@ -159,7 +159,7 @@ describe('Client Initialization Testing', () => { }); }); }); - } + }, ); }); }); diff --git a/test/gapic-mocks/commit.ts b/test/gapic-mocks/commit.ts index 796776230..3ef17096b 100644 --- a/test/gapic-mocks/commit.ts +++ b/test/gapic-mocks/commit.ts @@ -531,7 +531,7 @@ describe('Commit', () => { * strings replaced. */ function replaceLongStrings( - input?: google.datastore.v1.IMutation[] | null + input?: google.datastore.v1.IMutation[] | null, ) { const stringifiedInput = JSON.stringify(input); const replacedInput = stringifiedInput @@ -553,8 +553,8 @@ describe('Commit', () => { options: CallOptions, callback: ( err?: unknown, - res?: protos.google.datastore.v1.ICommitResponse - ) => void + res?: protos.google.datastore.v1.ICommitResponse, + ) => void, ) => { try { const actual = replaceLongStrings(request.mutations); @@ -578,7 +578,7 @@ describe('Commit', () => { excludeLargeProperties: test.excludeLargeProperties, }); }); - } + }, ); }); }); diff --git a/test/gapic-mocks/error-mocks.ts b/test/gapic-mocks/error-mocks.ts index 226859e6c..507c795ee 100644 --- a/test/gapic-mocks/error-mocks.ts +++ b/test/gapic-mocks/error-mocks.ts @@ -56,7 +56,7 @@ export function getCallbackExpectingError(done: mocha.Done, message: string) { export function errorOnGapicCall( datastore: Datastore, clientName: string, - done: mocha.Done + done: mocha.Done, ) { const dataClient = datastore.clients_.get(clientName); if (dataClient) { diff --git a/test/gapic-mocks/handwritten-errors.ts b/test/gapic-mocks/handwritten-errors.ts index 59c743ee5..bba7952e2 100644 --- a/test/gapic-mocks/handwritten-errors.ts +++ b/test/gapic-mocks/handwritten-errors.ts @@ -60,7 +60,7 @@ describe('HandwrittenLayerErrors', () => { transaction.runQuery( query, testParameters.options, - getCallbackExpectingError(done, testParameters.expectedError) + getCallbackExpectingError(done, testParameters.expectedError), ); }); it('should error when runQueryStream is used', done => { @@ -85,7 +85,7 @@ describe('HandwrittenLayerErrors', () => { transaction.runAggregationQuery( aggregate, testParameters.options, - getCallbackExpectingError(done, testParameters.expectedError) + getCallbackExpectingError(done, testParameters.expectedError), ); }); it('should error when get is used', done => { @@ -95,7 +95,7 @@ describe('HandwrittenLayerErrors', () => { transaction.get( keys, testParameters.options, - getCallbackExpectingError(done, testParameters.expectedError) + getCallbackExpectingError(done, testParameters.expectedError), ); }); it('should error when createReadStream is used', done => { @@ -111,7 +111,7 @@ describe('HandwrittenLayerErrors', () => { } }); }); - } + }, ); }); }); diff --git a/test/gapic-mocks/runQuery.ts b/test/gapic-mocks/runQuery.ts index d54d8649f..1710d2a63 100644 --- a/test/gapic-mocks/runQuery.ts +++ b/test/gapic-mocks/runQuery.ts @@ -25,7 +25,7 @@ describe('Run Query', () => { // This function is used for doing assertion checks. // The idea is to check that the right request gets passed to the commit function in the Gapic layer. function setRunQueryComparison( - compareFn: (request: protos.google.datastore.v1.IRunQueryRequest) => void + compareFn: (request: protos.google.datastore.v1.IRunQueryRequest) => void, ) { const dataClient = datastore.clients_.get(clientName); if (dataClient) { @@ -34,8 +34,8 @@ describe('Run Query', () => { options: any, callback: ( err?: unknown, - res?: protos.google.datastore.v1.IRunQueryResponse - ) => void + res?: protos.google.datastore.v1.IRunQueryResponse, + ) => void, ) => { try { compareFn(request); @@ -72,7 +72,7 @@ describe('Run Query', () => { }, projectId: 'project-id', }); - } + }, ); const transaction = datastore.transaction(); const query = datastore.createQuery('Task'); diff --git a/test/gapic_datastore_admin_v1.ts b/test/gapic_datastore_admin_v1.ts index eb73aadb9..ef12892e7 100644 --- a/test/gapic_datastore_admin_v1.ts +++ b/test/gapic_datastore_admin_v1.ts @@ -30,7 +30,7 @@ import {protobuf, LROperation, operationsProtos} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects const root = protobuf.Root.fromJSON( - require('../protos/protos.json') + require('../protos/protos.json'), ).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -47,7 +47,7 @@ function generateSampleMessage(instance: T) { instance.constructor as typeof protobuf.Message ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject + filledObject, ) as T; } @@ -59,7 +59,7 @@ function stubSimpleCall(response?: ResponseType, error?: Error) { function stubSimpleCallWithCallback( response?: ResponseType, - error?: Error + error?: Error, ) { return error ? sinon.stub().callsArgWith(2, error) @@ -69,7 +69,7 @@ function stubSimpleCallWithCallback( function stubLongRunningCall( response?: ResponseType, callError?: Error, - lroError?: Error + lroError?: Error, ) { const innerStub = lroError ? sinon.stub().rejects(lroError) @@ -85,7 +85,7 @@ function stubLongRunningCall( function stubLongRunningCallWithCallback( response?: ResponseType, callError?: Error, - lroError?: Error + lroError?: Error, ) { const innerStub = lroError ? sinon.stub().rejects(lroError) @@ -100,7 +100,7 @@ function stubLongRunningCallWithCallback( function stubPageStreamingCall( responses?: ResponseType[], - error?: Error + error?: Error, ) { const pagingStub = sinon.stub(); if (responses) { @@ -138,7 +138,7 @@ function stubPageStreamingCall( function stubAsyncIterationCall( responses?: ResponseType[], - error?: Error + error?: Error, ) { let counter = 0; const asyncIterable = { @@ -345,21 +345,21 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.GetIndexRequest() + new protos.google.datastore.admin.v1.GetIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedHeaderRequestParams = `project_id=${defaultValue1}&index_id=${defaultValue2}`; const expectedResponse = generateSampleMessage( - new protos.google.datastore.admin.v1.Index() + new protos.google.datastore.admin.v1.Index(), ); client.innerApiCalls.getIndex = stubSimpleCall(expectedResponse); const [response] = await client.getIndex(request); @@ -381,21 +381,21 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.GetIndexRequest() + new protos.google.datastore.admin.v1.GetIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedHeaderRequestParams = `project_id=${defaultValue1}&index_id=${defaultValue2}`; const expectedResponse = generateSampleMessage( - new protos.google.datastore.admin.v1.Index() + new protos.google.datastore.admin.v1.Index(), ); client.innerApiCalls.getIndex = stubSimpleCallWithCallback(expectedResponse); @@ -404,14 +404,14 @@ describe('v1.DatastoreAdminClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.admin.v1.IIndex | null + result?: protos.google.datastore.admin.v1.IIndex | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -433,16 +433,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.GetIndexRequest() + new protos.google.datastore.admin.v1.GetIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedHeaderRequestParams = `project_id=${defaultValue1}&index_id=${defaultValue2}`; @@ -466,16 +466,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.GetIndexRequest() + new protos.google.datastore.admin.v1.GetIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.GetIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedError = new Error('The client has already been closed.'); @@ -492,16 +492,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ExportEntitiesRequest() + new protos.google.datastore.admin.v1.ExportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ExportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.exportEntities = stubLongRunningCall(expectedResponse); @@ -525,16 +525,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ExportEntitiesRequest() + new protos.google.datastore.admin.v1.ExportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ExportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.exportEntities = stubLongRunningCallWithCallback(expectedResponse); @@ -546,14 +546,14 @@ describe('v1.DatastoreAdminClient', () => { result?: LROperation< protos.google.datastore.admin.v1.IExportEntitiesResponse, protos.google.datastore.admin.v1.IExportEntitiesMetadata - > | null + > | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const operation = (await promise) as LROperation< @@ -579,18 +579,18 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ExportEntitiesRequest() + new protos.google.datastore.admin.v1.ExportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ExportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.exportEntities = stubLongRunningCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.exportEntities(request), expectedError); const actualRequest = ( @@ -610,11 +610,11 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ExportEntitiesRequest() + new protos.google.datastore.admin.v1.ExportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ExportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; @@ -622,7 +622,7 @@ describe('v1.DatastoreAdminClient', () => { client.innerApiCalls.exportEntities = stubLongRunningCall( undefined, undefined, - expectedError + expectedError, ); const [operation] = await client.exportEntities(request); await assert.rejects(operation.promise(), expectedError); @@ -643,7 +643,7 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); expectedResponse.name = 'test'; expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; @@ -651,7 +651,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall(expectedResponse); const decodedOperation = await client.checkExportEntitiesProgress( - expectedResponse.name + expectedResponse.name, ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); @@ -668,11 +668,11 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects( client.checkExportEntitiesProgress(''), - expectedError + expectedError, ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); @@ -686,16 +686,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ImportEntitiesRequest() + new protos.google.datastore.admin.v1.ImportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ImportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.importEntities = stubLongRunningCall(expectedResponse); @@ -719,16 +719,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ImportEntitiesRequest() + new protos.google.datastore.admin.v1.ImportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ImportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.importEntities = stubLongRunningCallWithCallback(expectedResponse); @@ -740,14 +740,14 @@ describe('v1.DatastoreAdminClient', () => { result?: LROperation< protos.google.protobuf.IEmpty, protos.google.datastore.admin.v1.IImportEntitiesMetadata - > | null + > | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const operation = (await promise) as LROperation< @@ -773,18 +773,18 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ImportEntitiesRequest() + new protos.google.datastore.admin.v1.ImportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ImportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importEntities = stubLongRunningCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.importEntities(request), expectedError); const actualRequest = ( @@ -804,11 +804,11 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ImportEntitiesRequest() + new protos.google.datastore.admin.v1.ImportEntitiesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ImportEntitiesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; @@ -816,7 +816,7 @@ describe('v1.DatastoreAdminClient', () => { client.innerApiCalls.importEntities = stubLongRunningCall( undefined, undefined, - expectedError + expectedError, ); const [operation] = await client.importEntities(request); await assert.rejects(operation.promise(), expectedError); @@ -837,7 +837,7 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); expectedResponse.name = 'test'; expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; @@ -845,7 +845,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall(expectedResponse); const decodedOperation = await client.checkImportEntitiesProgress( - expectedResponse.name + expectedResponse.name, ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); @@ -862,11 +862,11 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects( client.checkImportEntitiesProgress(''), - expectedError + expectedError, ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); @@ -880,16 +880,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.CreateIndexRequest() + new protos.google.datastore.admin.v1.CreateIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.CreateIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.createIndex = stubLongRunningCall(expectedResponse); const [operation] = await client.createIndex(request); @@ -912,16 +912,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.CreateIndexRequest() + new protos.google.datastore.admin.v1.CreateIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.CreateIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.createIndex = stubLongRunningCallWithCallback(expectedResponse); @@ -933,14 +933,14 @@ describe('v1.DatastoreAdminClient', () => { result?: LROperation< protos.google.datastore.admin.v1.IIndex, protos.google.datastore.admin.v1.IIndexOperationMetadata - > | null + > | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const operation = (await promise) as LROperation< @@ -966,18 +966,18 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.CreateIndexRequest() + new protos.google.datastore.admin.v1.CreateIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.CreateIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createIndex = stubLongRunningCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.createIndex(request), expectedError); const actualRequest = ( @@ -997,11 +997,11 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.CreateIndexRequest() + new protos.google.datastore.admin.v1.CreateIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.CreateIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; @@ -1009,7 +1009,7 @@ describe('v1.DatastoreAdminClient', () => { client.innerApiCalls.createIndex = stubLongRunningCall( undefined, undefined, - expectedError + expectedError, ); const [operation] = await client.createIndex(request); await assert.rejects(operation.promise(), expectedError); @@ -1030,7 +1030,7 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); expectedResponse.name = 'test'; expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; @@ -1038,7 +1038,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall(expectedResponse); const decodedOperation = await client.checkCreateIndexProgress( - expectedResponse.name + expectedResponse.name, ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); @@ -1055,7 +1055,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.checkCreateIndexProgress(''), expectedError); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -1070,21 +1070,21 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.DeleteIndexRequest() + new protos.google.datastore.admin.v1.DeleteIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedHeaderRequestParams = `project_id=${defaultValue1}&index_id=${defaultValue2}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.deleteIndex = stubLongRunningCall(expectedResponse); const [operation] = await client.deleteIndex(request); @@ -1107,21 +1107,21 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.DeleteIndexRequest() + new protos.google.datastore.admin.v1.DeleteIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedHeaderRequestParams = `project_id=${defaultValue1}&index_id=${defaultValue2}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.longrunning.Operation(), ); client.innerApiCalls.deleteIndex = stubLongRunningCallWithCallback(expectedResponse); @@ -1133,14 +1133,14 @@ describe('v1.DatastoreAdminClient', () => { result?: LROperation< protos.google.datastore.admin.v1.IIndex, protos.google.datastore.admin.v1.IIndexOperationMetadata - > | null + > | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const operation = (await promise) as LROperation< @@ -1166,23 +1166,23 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.DeleteIndexRequest() + new protos.google.datastore.admin.v1.DeleteIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedHeaderRequestParams = `project_id=${defaultValue1}&index_id=${defaultValue2}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteIndex = stubLongRunningCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.deleteIndex(request), expectedError); const actualRequest = ( @@ -1202,16 +1202,16 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.DeleteIndexRequest() + new protos.google.datastore.admin.v1.DeleteIndexRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const defaultValue2 = getTypeDefaultValue( '.google.datastore.admin.v1.DeleteIndexRequest', - ['indexId'] + ['indexId'], ); request.indexId = defaultValue2; const expectedHeaderRequestParams = `project_id=${defaultValue1}&index_id=${defaultValue2}`; @@ -1219,7 +1219,7 @@ describe('v1.DatastoreAdminClient', () => { client.innerApiCalls.deleteIndex = stubLongRunningCall( undefined, undefined, - expectedError + expectedError, ); const [operation] = await client.deleteIndex(request); await assert.rejects(operation.promise(), expectedError); @@ -1240,7 +1240,7 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); expectedResponse.name = 'test'; expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; @@ -1248,7 +1248,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall(expectedResponse); const decodedOperation = await client.checkDeleteIndexProgress( - expectedResponse.name + expectedResponse.name, ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); @@ -1265,7 +1265,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.getOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.checkDeleteIndexProgress(''), expectedError); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -1280,11 +1280,11 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ListIndexesRequest() + new protos.google.datastore.admin.v1.ListIndexesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ListIndexesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; @@ -1313,11 +1313,11 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ListIndexesRequest() + new protos.google.datastore.admin.v1.ListIndexesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ListIndexesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; @@ -1333,14 +1333,14 @@ describe('v1.DatastoreAdminClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.admin.v1.IIndex[] | null + result?: protos.google.datastore.admin.v1.IIndex[] | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1362,18 +1362,18 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ListIndexesRequest() + new protos.google.datastore.admin.v1.ListIndexesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ListIndexesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listIndexes = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.listIndexes(request), expectedError); const actualRequest = ( @@ -1393,11 +1393,11 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ListIndexesRequest() + new protos.google.datastore.admin.v1.ListIndexesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ListIndexesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; @@ -1415,7 +1415,7 @@ describe('v1.DatastoreAdminClient', () => { 'data', (response: protos.google.datastore.admin.v1.Index) => { responses.push(response); - } + }, ); stream.on('end', () => { resolve(responses); @@ -1429,14 +1429,14 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listIndexes, request) + .calledWith(client.innerApiCalls.listIndexes, request), ); assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + ].includes(expectedHeaderRequestParams), ); }); @@ -1447,18 +1447,18 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ListIndexesRequest() + new protos.google.datastore.admin.v1.ListIndexesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ListIndexesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listIndexes.createStream = stubPageStreamingCall( undefined, - expectedError + expectedError, ); const stream = client.listIndexesStream(request); const promise = new Promise((resolve, reject) => { @@ -1467,7 +1467,7 @@ describe('v1.DatastoreAdminClient', () => { 'data', (response: protos.google.datastore.admin.v1.Index) => { responses.push(response); - } + }, ); stream.on('end', () => { resolve(responses); @@ -1480,14 +1480,14 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listIndexes, request) + .calledWith(client.innerApiCalls.listIndexes, request), ); assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + ].includes(expectedHeaderRequestParams), ); }); @@ -1498,11 +1498,11 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ListIndexesRequest() + new protos.google.datastore.admin.v1.ListIndexesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ListIndexesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; @@ -1521,16 +1521,16 @@ describe('v1.DatastoreAdminClient', () => { assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( (client.descriptors.page.listIndexes.asyncIterate as SinonStub).getCall( - 0 + 0, ).args[1], - request + request, ); assert( (client.descriptors.page.listIndexes.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + ].includes(expectedHeaderRequestParams), ); }); @@ -1541,18 +1541,18 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.admin.v1.ListIndexesRequest() + new protos.google.datastore.admin.v1.ListIndexesRequest(), ); const defaultValue1 = getTypeDefaultValue( '.google.datastore.admin.v1.ListIndexesRequest', - ['projectId'] + ['projectId'], ); request.projectId = defaultValue1; const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listIndexes.asyncIterate = stubAsyncIterationCall( undefined, - expectedError + expectedError, ); const iterable = client.listIndexesAsync(request); await assert.rejects(async () => { @@ -1563,16 +1563,16 @@ describe('v1.DatastoreAdminClient', () => { }); assert.deepStrictEqual( (client.descriptors.page.listIndexes.asyncIterate as SinonStub).getCall( - 0 + 0, ).args[1], - request + request, ); assert( (client.descriptors.page.listIndexes.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + ].includes(expectedHeaderRequestParams), ); }); }); @@ -1584,10 +1584,10 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() + new operationsProtos.google.longrunning.GetOperationRequest(), ); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); client.operationsClient.getOperation = stubSimpleCall(expectedResponse); const response = await client.getOperation(request); @@ -1595,7 +1595,7 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.operationsClient.getOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); it('invokes getOperation without error using callback', async () => { @@ -1604,10 +1604,10 @@ describe('v1.DatastoreAdminClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() + new operationsProtos.google.longrunning.GetOperationRequest(), ); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); client.operationsClient.getOperation = sinon .stub() @@ -1618,14 +1618,14 @@ describe('v1.DatastoreAdminClient', () => { undefined, ( err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null + result?: operationsProtos.google.longrunning.Operation | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1638,12 +1638,12 @@ describe('v1.DatastoreAdminClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() + new operationsProtos.google.longrunning.GetOperationRequest(), ); const expectedError = new Error('expected'); client.operationsClient.getOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(async () => { await client.getOperation(request); @@ -1651,7 +1651,7 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.operationsClient.getOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); }); @@ -1663,10 +1663,10 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() + new operationsProtos.google.longrunning.CancelOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); @@ -1675,7 +1675,7 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.operationsClient.cancelOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); it('invokes cancelOperation without error using callback', async () => { @@ -1684,10 +1684,10 @@ describe('v1.DatastoreAdminClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() + new operationsProtos.google.longrunning.CancelOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.cancelOperation = sinon .stub() @@ -1698,14 +1698,14 @@ describe('v1.DatastoreAdminClient', () => { undefined, ( err?: Error | null, - result?: protos.google.protobuf.Empty | null + result?: protos.google.protobuf.Empty | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1718,12 +1718,12 @@ describe('v1.DatastoreAdminClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() + new operationsProtos.google.longrunning.CancelOperationRequest(), ); const expectedError = new Error('expected'); client.operationsClient.cancelOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(async () => { await client.cancelOperation(request); @@ -1731,7 +1731,7 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.operationsClient.cancelOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); }); @@ -1743,10 +1743,10 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); @@ -1755,7 +1755,7 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.operationsClient.deleteOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); it('invokes deleteOperation without error using callback', async () => { @@ -1764,10 +1764,10 @@ describe('v1.DatastoreAdminClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.deleteOperation = sinon .stub() @@ -1778,14 +1778,14 @@ describe('v1.DatastoreAdminClient', () => { undefined, ( err?: Error | null, - result?: protos.google.protobuf.Empty | null + result?: protos.google.protobuf.Empty | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1798,12 +1798,12 @@ describe('v1.DatastoreAdminClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest(), ); const expectedError = new Error('expected'); client.operationsClient.deleteOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(async () => { await client.deleteOperation(request); @@ -1811,7 +1811,7 @@ describe('v1.DatastoreAdminClient', () => { assert( (client.operationsClient.deleteOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); }); @@ -1822,17 +1822,17 @@ describe('v1.DatastoreAdminClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() + new operationsProtos.google.longrunning.ListOperationsRequest(), ); const expectedResponse = [ generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() + new operationsProtos.google.longrunning.ListOperationsResponse(), ), generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() + new operationsProtos.google.longrunning.ListOperationsResponse(), ), generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() + new operationsProtos.google.longrunning.ListOperationsResponse(), ), ]; client.operationsClient.descriptor.listOperations.asyncIterate = @@ -1849,7 +1849,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.descriptor.listOperations .asyncIterate as SinonStub ).getCall(0).args[1], - request + request, ); }); it('uses async iteration with listOperations with error', async () => { @@ -1859,7 +1859,7 @@ describe('v1.DatastoreAdminClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() + new operationsProtos.google.longrunning.ListOperationsRequest(), ); const expectedError = new Error('expected'); client.operationsClient.descriptor.listOperations.asyncIterate = @@ -1877,7 +1877,7 @@ describe('v1.DatastoreAdminClient', () => { client.operationsClient.descriptor.listOperations .asyncIterate as SinonStub ).getCall(0).args[1], - request + request, ); }); }); diff --git a/test/gapic_datastore_v1.ts b/test/gapic_datastore_v1.ts index 7a23ec7d9..3e31f4aae 100644 --- a/test/gapic_datastore_v1.ts +++ b/test/gapic_datastore_v1.ts @@ -28,7 +28,7 @@ import {protobuf, operationsProtos} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects const root = protobuf.Root.fromJSON( - require('../protos/protos.json') + require('../protos/protos.json'), ).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -45,7 +45,7 @@ function generateSampleMessage(instance: T) { instance.constructor as typeof protobuf.Message ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject + filledObject, ) as T; } @@ -57,7 +57,7 @@ function stubSimpleCall(response?: ResponseType, error?: Error) { function stubSimpleCallWithCallback( response?: ResponseType, - error?: Error + error?: Error, ) { return error ? sinon.stub().callsArgWith(2, error) @@ -66,7 +66,7 @@ function stubSimpleCallWithCallback( function stubAsyncIterationCall( responses?: ResponseType[], - error?: Error + error?: Error, ) { let counter = 0; const asyncIterable = { @@ -271,19 +271,19 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.LookupRequest() + new protos.google.datastore.v1.LookupRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.LookupResponse() + new protos.google.datastore.v1.LookupResponse(), ); client.innerApiCalls.lookup = stubSimpleCall(expectedResponse); const [response] = await client.lookup(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = (client.innerApiCalls.lookup as SinonStub).getCall( - 0 + 0, ).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( @@ -299,13 +299,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.LookupRequest() + new protos.google.datastore.v1.LookupRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.LookupResponse() + new protos.google.datastore.v1.LookupResponse(), ); client.innerApiCalls.lookup = stubSimpleCallWithCallback(expectedResponse); @@ -314,20 +314,20 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.ILookupResponse | null + result?: protos.google.datastore.v1.ILookupResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = (client.innerApiCalls.lookup as SinonStub).getCall( - 0 + 0, ).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( @@ -343,7 +343,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.LookupRequest() + new protos.google.datastore.v1.LookupRequest(), ); // path template is empty request.databaseId = 'value'; @@ -352,7 +352,7 @@ describe('v1.DatastoreClient', () => { client.innerApiCalls.lookup = stubSimpleCall(undefined, expectedError); await assert.rejects(client.lookup(request), expectedError); const actualRequest = (client.innerApiCalls.lookup as SinonStub).getCall( - 0 + 0, ).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( @@ -368,7 +368,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.LookupRequest() + new protos.google.datastore.v1.LookupRequest(), ); // path template is empty request.databaseId = 'value'; @@ -386,13 +386,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunQueryRequest() + new protos.google.datastore.v1.RunQueryRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.RunQueryResponse() + new protos.google.datastore.v1.RunQueryResponse(), ); client.innerApiCalls.runQuery = stubSimpleCall(expectedResponse); const [response] = await client.runQuery(request); @@ -414,13 +414,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunQueryRequest() + new protos.google.datastore.v1.RunQueryRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.RunQueryResponse() + new protos.google.datastore.v1.RunQueryResponse(), ); client.innerApiCalls.runQuery = stubSimpleCallWithCallback(expectedResponse); @@ -429,14 +429,14 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.IRunQueryResponse | null + result?: protos.google.datastore.v1.IRunQueryResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -458,7 +458,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunQueryRequest() + new protos.google.datastore.v1.RunQueryRequest(), ); // path template is empty request.databaseId = 'value'; @@ -483,7 +483,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunQueryRequest() + new protos.google.datastore.v1.RunQueryRequest(), ); // path template is empty request.databaseId = 'value'; @@ -501,13 +501,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunAggregationQueryRequest() + new protos.google.datastore.v1.RunAggregationQueryRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.RunAggregationQueryResponse() + new protos.google.datastore.v1.RunAggregationQueryResponse(), ); client.innerApiCalls.runAggregationQuery = stubSimpleCall(expectedResponse); @@ -530,13 +530,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunAggregationQueryRequest() + new protos.google.datastore.v1.RunAggregationQueryRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.RunAggregationQueryResponse() + new protos.google.datastore.v1.RunAggregationQueryResponse(), ); client.innerApiCalls.runAggregationQuery = stubSimpleCallWithCallback(expectedResponse); @@ -545,14 +545,14 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.IRunAggregationQueryResponse | null + result?: protos.google.datastore.v1.IRunAggregationQueryResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -574,7 +574,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunAggregationQueryRequest() + new protos.google.datastore.v1.RunAggregationQueryRequest(), ); // path template is empty request.databaseId = 'value'; @@ -582,7 +582,7 @@ describe('v1.DatastoreClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.runAggregationQuery = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.runAggregationQuery(request), expectedError); const actualRequest = ( @@ -602,7 +602,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RunAggregationQueryRequest() + new protos.google.datastore.v1.RunAggregationQueryRequest(), ); // path template is empty request.databaseId = 'value'; @@ -620,13 +620,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.BeginTransactionRequest() + new protos.google.datastore.v1.BeginTransactionRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.BeginTransactionResponse() + new protos.google.datastore.v1.BeginTransactionResponse(), ); client.innerApiCalls.beginTransaction = stubSimpleCall(expectedResponse); const [response] = await client.beginTransaction(request); @@ -648,13 +648,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.BeginTransactionRequest() + new protos.google.datastore.v1.BeginTransactionRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.BeginTransactionResponse() + new protos.google.datastore.v1.BeginTransactionResponse(), ); client.innerApiCalls.beginTransaction = stubSimpleCallWithCallback(expectedResponse); @@ -663,14 +663,14 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.IBeginTransactionResponse | null + result?: protos.google.datastore.v1.IBeginTransactionResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -692,7 +692,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.BeginTransactionRequest() + new protos.google.datastore.v1.BeginTransactionRequest(), ); // path template is empty request.databaseId = 'value'; @@ -700,7 +700,7 @@ describe('v1.DatastoreClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.beginTransaction = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.beginTransaction(request), expectedError); const actualRequest = ( @@ -720,7 +720,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.BeginTransactionRequest() + new protos.google.datastore.v1.BeginTransactionRequest(), ); // path template is empty request.databaseId = 'value'; @@ -738,19 +738,19 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.CommitRequest() + new protos.google.datastore.v1.CommitRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.CommitResponse() + new protos.google.datastore.v1.CommitResponse(), ); client.innerApiCalls.commit = stubSimpleCall(expectedResponse); const [response] = await client.commit(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( - 0 + 0, ).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( @@ -766,13 +766,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.CommitRequest() + new protos.google.datastore.v1.CommitRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.CommitResponse() + new protos.google.datastore.v1.CommitResponse(), ); client.innerApiCalls.commit = stubSimpleCallWithCallback(expectedResponse); @@ -781,20 +781,20 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.ICommitResponse | null + result?: protos.google.datastore.v1.ICommitResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( - 0 + 0, ).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( @@ -810,7 +810,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.CommitRequest() + new protos.google.datastore.v1.CommitRequest(), ); // path template is empty request.databaseId = 'value'; @@ -819,7 +819,7 @@ describe('v1.DatastoreClient', () => { client.innerApiCalls.commit = stubSimpleCall(undefined, expectedError); await assert.rejects(client.commit(request), expectedError); const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( - 0 + 0, ).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( @@ -835,7 +835,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.CommitRequest() + new protos.google.datastore.v1.CommitRequest(), ); // path template is empty request.databaseId = 'value'; @@ -853,13 +853,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RollbackRequest() + new protos.google.datastore.v1.RollbackRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.RollbackResponse() + new protos.google.datastore.v1.RollbackResponse(), ); client.innerApiCalls.rollback = stubSimpleCall(expectedResponse); const [response] = await client.rollback(request); @@ -881,13 +881,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RollbackRequest() + new protos.google.datastore.v1.RollbackRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.RollbackResponse() + new protos.google.datastore.v1.RollbackResponse(), ); client.innerApiCalls.rollback = stubSimpleCallWithCallback(expectedResponse); @@ -896,14 +896,14 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.IRollbackResponse | null + result?: protos.google.datastore.v1.IRollbackResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -925,7 +925,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RollbackRequest() + new protos.google.datastore.v1.RollbackRequest(), ); // path template is empty request.databaseId = 'value'; @@ -950,7 +950,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.RollbackRequest() + new protos.google.datastore.v1.RollbackRequest(), ); // path template is empty request.databaseId = 'value'; @@ -968,13 +968,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.AllocateIdsRequest() + new protos.google.datastore.v1.AllocateIdsRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.AllocateIdsResponse() + new protos.google.datastore.v1.AllocateIdsResponse(), ); client.innerApiCalls.allocateIds = stubSimpleCall(expectedResponse); const [response] = await client.allocateIds(request); @@ -996,13 +996,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.AllocateIdsRequest() + new protos.google.datastore.v1.AllocateIdsRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.AllocateIdsResponse() + new protos.google.datastore.v1.AllocateIdsResponse(), ); client.innerApiCalls.allocateIds = stubSimpleCallWithCallback(expectedResponse); @@ -1011,14 +1011,14 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.IAllocateIdsResponse | null + result?: protos.google.datastore.v1.IAllocateIdsResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1040,7 +1040,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.AllocateIdsRequest() + new protos.google.datastore.v1.AllocateIdsRequest(), ); // path template is empty request.databaseId = 'value'; @@ -1048,7 +1048,7 @@ describe('v1.DatastoreClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.allocateIds = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.allocateIds(request), expectedError); const actualRequest = ( @@ -1068,7 +1068,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.AllocateIdsRequest() + new protos.google.datastore.v1.AllocateIdsRequest(), ); // path template is empty request.databaseId = 'value'; @@ -1086,13 +1086,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.ReserveIdsRequest() + new protos.google.datastore.v1.ReserveIdsRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.ReserveIdsResponse() + new protos.google.datastore.v1.ReserveIdsResponse(), ); client.innerApiCalls.reserveIds = stubSimpleCall(expectedResponse); const [response] = await client.reserveIds(request); @@ -1114,13 +1114,13 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.ReserveIdsRequest() + new protos.google.datastore.v1.ReserveIdsRequest(), ); // path template is empty request.databaseId = 'value'; const expectedHeaderRequestParams = 'database_id=value'; const expectedResponse = generateSampleMessage( - new protos.google.datastore.v1.ReserveIdsResponse() + new protos.google.datastore.v1.ReserveIdsResponse(), ); client.innerApiCalls.reserveIds = stubSimpleCallWithCallback(expectedResponse); @@ -1129,14 +1129,14 @@ describe('v1.DatastoreClient', () => { request, ( err?: Error | null, - result?: protos.google.datastore.v1.IReserveIdsResponse | null + result?: protos.google.datastore.v1.IReserveIdsResponse | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1158,7 +1158,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.ReserveIdsRequest() + new protos.google.datastore.v1.ReserveIdsRequest(), ); // path template is empty request.databaseId = 'value'; @@ -1166,7 +1166,7 @@ describe('v1.DatastoreClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.reserveIds = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(client.reserveIds(request), expectedError); const actualRequest = ( @@ -1186,7 +1186,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.datastore.v1.ReserveIdsRequest() + new protos.google.datastore.v1.ReserveIdsRequest(), ); // path template is empty request.databaseId = 'value'; @@ -1203,10 +1203,10 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() + new operationsProtos.google.longrunning.GetOperationRequest(), ); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); client.operationsClient.getOperation = stubSimpleCall(expectedResponse); const response = await client.getOperation(request); @@ -1214,7 +1214,7 @@ describe('v1.DatastoreClient', () => { assert( (client.operationsClient.getOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); it('invokes getOperation without error using callback', async () => { @@ -1223,10 +1223,10 @@ describe('v1.DatastoreClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() + new operationsProtos.google.longrunning.GetOperationRequest(), ); const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new operationsProtos.google.longrunning.Operation(), ); client.operationsClient.getOperation = sinon .stub() @@ -1237,14 +1237,14 @@ describe('v1.DatastoreClient', () => { undefined, ( err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null + result?: operationsProtos.google.longrunning.Operation | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1257,12 +1257,12 @@ describe('v1.DatastoreClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() + new operationsProtos.google.longrunning.GetOperationRequest(), ); const expectedError = new Error('expected'); client.operationsClient.getOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(async () => { await client.getOperation(request); @@ -1270,7 +1270,7 @@ describe('v1.DatastoreClient', () => { assert( (client.operationsClient.getOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); }); @@ -1282,10 +1282,10 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() + new operationsProtos.google.longrunning.CancelOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); @@ -1294,7 +1294,7 @@ describe('v1.DatastoreClient', () => { assert( (client.operationsClient.cancelOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); it('invokes cancelOperation without error using callback', async () => { @@ -1303,10 +1303,10 @@ describe('v1.DatastoreClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() + new operationsProtos.google.longrunning.CancelOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.cancelOperation = sinon .stub() @@ -1317,14 +1317,14 @@ describe('v1.DatastoreClient', () => { undefined, ( err?: Error | null, - result?: protos.google.protobuf.Empty | null + result?: protos.google.protobuf.Empty | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1337,12 +1337,12 @@ describe('v1.DatastoreClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() + new operationsProtos.google.longrunning.CancelOperationRequest(), ); const expectedError = new Error('expected'); client.operationsClient.cancelOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(async () => { await client.cancelOperation(request); @@ -1350,7 +1350,7 @@ describe('v1.DatastoreClient', () => { assert( (client.operationsClient.cancelOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); }); @@ -1362,10 +1362,10 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); @@ -1374,7 +1374,7 @@ describe('v1.DatastoreClient', () => { assert( (client.operationsClient.deleteOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); it('invokes deleteOperation without error using callback', async () => { @@ -1383,10 +1383,10 @@ describe('v1.DatastoreClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest(), ); const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() + new protos.google.protobuf.Empty(), ); client.operationsClient.deleteOperation = sinon .stub() @@ -1397,14 +1397,14 @@ describe('v1.DatastoreClient', () => { undefined, ( err?: Error | null, - result?: protos.google.protobuf.Empty | null + result?: protos.google.protobuf.Empty | null, ) => { if (err) { reject(err); } else { resolve(result); } - } + }, ); }); const response = await promise; @@ -1417,12 +1417,12 @@ describe('v1.DatastoreClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest(), ); const expectedError = new Error('expected'); client.operationsClient.deleteOperation = stubSimpleCall( undefined, - expectedError + expectedError, ); await assert.rejects(async () => { await client.deleteOperation(request); @@ -1430,7 +1430,7 @@ describe('v1.DatastoreClient', () => { assert( (client.operationsClient.deleteOperation as SinonStub) .getCall(0) - .calledWith(request) + .calledWith(request), ); }); }); @@ -1441,17 +1441,17 @@ describe('v1.DatastoreClient', () => { projectId: 'bogus', }); const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() + new operationsProtos.google.longrunning.ListOperationsRequest(), ); const expectedResponse = [ generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() + new operationsProtos.google.longrunning.ListOperationsResponse(), ), generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() + new operationsProtos.google.longrunning.ListOperationsResponse(), ), generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() + new operationsProtos.google.longrunning.ListOperationsResponse(), ), ]; client.operationsClient.descriptor.listOperations.asyncIterate = @@ -1468,7 +1468,7 @@ describe('v1.DatastoreClient', () => { client.operationsClient.descriptor.listOperations .asyncIterate as SinonStub ).getCall(0).args[1], - request + request, ); }); it('uses async iteration with listOperations with error', async () => { @@ -1478,7 +1478,7 @@ describe('v1.DatastoreClient', () => { }); client.initialize(); const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() + new operationsProtos.google.longrunning.ListOperationsRequest(), ); const expectedError = new Error('expected'); client.operationsClient.descriptor.listOperations.asyncIterate = @@ -1496,7 +1496,7 @@ describe('v1.DatastoreClient', () => { client.operationsClient.descriptor.listOperations .asyncIterate as SinonStub ).getCall(0).args[1], - request + request, ); }); }); diff --git a/test/index.ts b/test/index.ts index abd9c487f..a0074bd7f 100644 --- a/test/index.ts +++ b/test/index.ts @@ -188,7 +188,7 @@ async.each( '../src/utils/entity/buildEntityProto.js', { '../../entity.js': {entity: fakeEntity}, - } + }, ); Datastore = proxyquire('../src', { './entity.js': {entity: fakeEntity}, @@ -266,7 +266,7 @@ async.each( it('should set the default base URL', () => { assert.strictEqual( datastore.defaultBaseUrl_, - 'datastore.googleapis.com' + 'datastore.googleapis.com', ); }); @@ -306,8 +306,8 @@ async.each( port: 443, projectId: undefined, }, - options - ) + options, + ), ); }); @@ -374,7 +374,7 @@ async.each( }); assert.strictEqual( datastore.options.sslCreds, - fakeInsecureCreds + fakeInsecureCreds, ); }); }); @@ -428,7 +428,7 @@ async.each( }); assert.strictEqual( datastore.options.sslCreds, - fakeInsecureCreds + fakeInsecureCreds, ); }); }); @@ -456,7 +456,7 @@ async.each( }); assert.strictEqual( datastore.options.sslCreds, - fakeInsecureCreds + fakeInsecureCreds, ); }); }); @@ -623,14 +623,14 @@ async.each( it('should expose a MORE_RESULTS_AFTER_CURSOR helper', () => { assert.strictEqual( Datastore.MORE_RESULTS_AFTER_CURSOR, - 'MORE_RESULTS_AFTER_CURSOR' + 'MORE_RESULTS_AFTER_CURSOR', ); }); it('should also be on the prototype', () => { assert.strictEqual( datastore.MORE_RESULTS_AFTER_CURSOR, - Datastore.MORE_RESULTS_AFTER_CURSOR + Datastore.MORE_RESULTS_AFTER_CURSOR, ); }); }); @@ -639,14 +639,14 @@ async.each( it('should expose a MORE_RESULTS_AFTER_LIMIT helper', () => { assert.strictEqual( Datastore.MORE_RESULTS_AFTER_LIMIT, - 'MORE_RESULTS_AFTER_LIMIT' + 'MORE_RESULTS_AFTER_LIMIT', ); }); it('should also be on the prototype', () => { assert.strictEqual( datastore.MORE_RESULTS_AFTER_LIMIT, - Datastore.MORE_RESULTS_AFTER_LIMIT + Datastore.MORE_RESULTS_AFTER_LIMIT, ); }); }); @@ -659,7 +659,7 @@ async.each( it('should also be on the prototype', () => { assert.strictEqual( datastore.NO_MORE_RESULTS, - Datastore.NO_MORE_RESULTS + Datastore.NO_MORE_RESULTS, ); }); }); @@ -704,7 +704,7 @@ async.each( datastore.request_ = (config: any) => { assert.strictEqual( config.reqOpts.outputUrlPrefix, - `gs://${bucket}` + `gs://${bucket}`, ); done(); }; @@ -731,7 +731,7 @@ async.each( datastore.request_ = (config: any) => { assert.strictEqual( config.reqOpts.outputUrlPrefix, - `gs://${bucket.name}` + `gs://${bucket.name}`, ); done(); }; @@ -752,7 +752,7 @@ async.each( bucket: 'bucket', outputUrlPrefix: 'output-url-prefix', }, - assert.ifError + assert.ifError, ); }, /Both `bucket` and `outputUrlPrefix` were provided\./); }); @@ -778,7 +778,7 @@ async.each( kinds: ['kind1', 'kind2'], entityFilter: {}, }, - assert.ifError + assert.ifError, ); }, /Both `entityFilter` and `kinds` were provided\./); }); @@ -791,7 +791,7 @@ async.each( datastore.request_ = (config: any) => { assert.deepStrictEqual( config.reqOpts.entityFilter.namespaceIds, - namespaces + namespaces, ); done(); }; @@ -807,7 +807,7 @@ async.each( namespaces: ['ns1', 'ns2'], entityFilter: {}, }, - assert.ifError + assert.ifError, ); }, /Both `entityFilter` and `namespaces` were provided\./); }); @@ -906,11 +906,11 @@ async.each( datastore.request_ = (config: any) => { assert.strictEqual( config.reqOpts.pageSize, - options.gaxOptions.pageSize + options.gaxOptions.pageSize, ); assert.strictEqual( config.reqOpts.pageToken, - options.gaxOptions.pageToken + options.gaxOptions.pageToken, ); done(); }; @@ -981,7 +981,7 @@ async.each( // eslint-disable-next-line @typescript-eslint/no-explicit-any datastore.request_ = (config: any) => { assert( - Object.keys(options.gaxOptions).every(k => !config.reqOpts[k]) + Object.keys(options.gaxOptions).every(k => !config.reqOpts[k]), ); done(); }; @@ -998,7 +998,7 @@ async.each( datastore.request_ = (config: any) => { assert.strictEqual( config.gaxOpts.autoPaginate, - options.autoPaginate + options.autoPaginate, ); done(); }; @@ -1039,7 +1039,7 @@ async.each( assert.strictEqual(nextQuery, null); assert.strictEqual(apiResp, apiResponse); done(); - } + }, ); }); @@ -1082,7 +1082,7 @@ async.each( assert.ifError(err); assert.deepStrictEqual(_nextQuery, nextQuery); done(); - } + }, ); }); }); @@ -1158,7 +1158,7 @@ async.each( file: 'file', inputUrl: 'gs://file', }, - assert.ifError + assert.ifError, ); }, /Both `file` and `inputUrl` were provided\./); }); @@ -1194,7 +1194,7 @@ async.each( datastore.request_ = (config: any) => { assert.strictEqual( config.reqOpts.inputUrl, - `gs://${file.bucket.name}/${file.name}` + `gs://${file.bucket.name}/${file.name}`, ); done(); }; @@ -1229,7 +1229,7 @@ async.each( kinds: ['kind1', 'kind2'], entityFilter: {}, }, - assert.ifError + assert.ifError, ); }, /Both `entityFilter` and `kinds` were provided\./); }); @@ -1242,7 +1242,7 @@ async.each( datastore.request_ = (config: any) => { assert.deepStrictEqual( config.reqOpts.entityFilter.namespaceIds, - namespaces + namespaces, ); done(); }; @@ -1258,7 +1258,7 @@ async.each( namespaces: ['ns1', 'ns2'], entityFilter: {}, }, - assert.ifError + assert.ifError, ); }, /Both `entityFilter` and `namespaces` were provided\./); }); @@ -1476,7 +1476,7 @@ async.each( {key, data: {k: 'v'}}, {key, data: {k: 'v'}}, ], - done + done, ); }); @@ -1508,7 +1508,7 @@ async.each( datastore.request_ = (config: RequestConfig, callback: Function) => { assert.deepStrictEqual( config.reqOpts!.mutations![0].upsert!.properties, - expectedProperties + expectedProperties, ); callback(); }; @@ -1540,7 +1540,7 @@ async.each( data: {}, }, gaxOptions, - assert.ifError + assert.ifError, ); }); @@ -1561,12 +1561,12 @@ async.each( }, () => { done('Should not reach callback'); - } + }, ); } catch (err: unknown) { assert.strictEqual( (err as {message: string}).message, - 'Unsupported field value, undefined, was provided.' + 'Unsupported field value, undefined, was provided.', ); done(); return; @@ -1591,14 +1591,14 @@ async.each( }, () => { done('Should not reach callback'); - } + }, ); } catch (err: unknown) { assert( [ "Cannot read properties of null (reading 'toString')", // Later Node versions "Cannot read property 'toString' of null", // Node 14 - ].includes((err as {message: string}).message) + ].includes((err as {message: string}).message), ); done(); return; @@ -1655,7 +1655,7 @@ async.each( {key, method: 'update', data: {k2: 'v2'}}, {key, method: 'upsert', data: {k3: 'v3'}}, ], - done + done, ); }); @@ -1669,7 +1669,7 @@ async.each( k: 'v', }, }, - assert.ifError + assert.ifError, ); }, /Method auto_insert_id not recognized/); }); @@ -1712,7 +1712,7 @@ async.each( assert.ifError(err); assert.strictEqual(mockCommitResponse, apiResponse); done(); - } + }, ); }); @@ -1736,7 +1736,7 @@ async.each( }, ], }, - assert.ifError + assert.ifError, ); }); @@ -1763,7 +1763,7 @@ async.each( }, ], }, - assert.ifError + assert.ifError, ); }); @@ -1837,7 +1837,7 @@ async.each( data, excludeFromIndexes: ['.*'], }, - assert.ifError + assert.ifError, ); }); @@ -1919,7 +1919,7 @@ async.each( 'metadata.longStringArray[].*', ], }, - assert.ifError + assert.ifError, ); }); @@ -1946,7 +1946,7 @@ async.each( }, ], }, - assert.ifError + assert.ifError, ); }); @@ -2009,12 +2009,12 @@ async.each( assert.strictEqual( (config.reqOpts!.mutations![0].upsert! as Entity) .excludeLargeProperties, - true + true, ); assert.deepStrictEqual( (config.reqOpts!.mutations![0].upsert! as Entity) .excludeFromIndexes, - excludeFromIndexes + excludeFromIndexes, ); done(); }; @@ -2025,7 +2025,7 @@ async.each( data, excludeLargeProperties: true, }, - assert.ifError + assert.ifError, ); }); @@ -2046,7 +2046,7 @@ async.each( assert.deepStrictEqual( config.reqOpts!.mutations![0].upsert!.properties!.name .excludeFromIndexes, - true + true, ); done(); }; @@ -2057,7 +2057,7 @@ async.each( data, excludeLargeProperties: true, }, - assert.ifError + assert.ifError, ); }); @@ -2109,7 +2109,7 @@ async.each( assert.strictEqual(keyProtos[1], response.mutationResults[1].key); done(); - } + }, ); }); @@ -2129,7 +2129,7 @@ async.each( assert.strictEqual( typeof datastore.requestCallbacks_[0], - 'function' + 'function', ); assert.strictEqual(typeof datastore.requests_[0], 'object'); }); @@ -2349,7 +2349,7 @@ async.each( (err: Error | null | undefined, urlSafeKey: string) => { assert.ifError(err); assert.strictEqual(urlSafeKey, base64EndocdedUrlSafeKey); - } + }, ); }); @@ -2370,7 +2370,7 @@ async.each( (err: Error | null | undefined, urlSafeKey: string) => { assert.ifError(err); assert.strictEqual(urlSafeKey, base64EndocdedUrlSafeKey); - } + }, ); }); @@ -2385,7 +2385,7 @@ async.each( (err: Error | null | undefined, urlSafeKey: string) => { assert.strictEqual(err, error); assert.strictEqual(urlSafeKey, undefined); - } + }, ); }); }); @@ -2495,7 +2495,7 @@ async.each( // Mock out the request function to compare config passed into it. datastore.request_ = ( config: RequestConfig, - callback: RequestCallback + callback: RequestCallback, ) => { try { assert.deepStrictEqual(config, expectedConfig); @@ -2510,13 +2510,13 @@ async.each( const key = datastore.key(['Post', 'Post1']); const entities = Object.assign( {key}, - onSaveTest.entitiesWithoutKey + onSaveTest.entitiesWithoutKey, ); const results = await datastore.save(entities); assert.deepStrictEqual(results, ['some-data']); } }); - } + }, ); }); }); @@ -2529,7 +2529,7 @@ async.each( }); assert.strictEqual( otherDatastore.getDatabaseId(), - SECOND_DATABASE_ID + SECOND_DATABASE_ID, ); }); }); @@ -2661,13 +2661,13 @@ async.each( // Mock out the request function to compare config passed into it. datastore.request_ = ( config: RequestConfig, - callback: RequestCallback + callback: RequestCallback, ) => { assert.deepStrictEqual(config.client, 'DatastoreClient'); assert.deepStrictEqual(config.method, 'runQuery'); assert.deepStrictEqual( config.reqOpts?.explainOptions, - modeOptions.expectedExplainOptions + modeOptions.expectedExplainOptions, ); callback( null, @@ -2678,8 +2678,8 @@ async.each( moreResults: 'NO_MORE_RESULTS', }, }, - modeOptions.explainMetrics - ) + modeOptions.explainMetrics, + ), ); }; const ancestor = datastore.key(['Book', 'GoT']); @@ -2688,28 +2688,28 @@ async.each( .hasAncestor(ancestor); const [entities, info] = await datastore.runQuery( q, - modeOptions.options + modeOptions.options, ); assert.deepStrictEqual(entities, []); assert.deepStrictEqual( info, Object.assign( {moreResults: 'NO_MORE_RESULTS'}, - modeOptions.expectedInfo - ) + modeOptions.expectedInfo, + ), ); }); it('should provide correct request/response data for runAggregationQuery', async () => { // Mock out the request function to compare config passed into it. datastore.request_ = ( config: RequestConfig, - callback: RequestCallback + callback: RequestCallback, ) => { assert.deepStrictEqual(config.client, 'DatastoreClient'); assert.deepStrictEqual(config.method, 'runAggregationQuery'); assert.deepStrictEqual( config.reqOpts?.explainOptions, - modeOptions.expectedExplainOptions + modeOptions.expectedExplainOptions, ); callback( null, @@ -2720,8 +2720,8 @@ async.each( moreResults: 'NO_MORE_RESULTS', }, }, - modeOptions.explainMetrics - ) + modeOptions.explainMetrics, + ), ); }; const ancestor = datastore.key(['Book', 'GoT']); @@ -2733,15 +2733,15 @@ async.each( .addAggregation(AggregateField.sum('appearances')); const [entities, info] = await datastore.runAggregationQuery( aggregate, - modeOptions.options + modeOptions.options, ); assert.deepStrictEqual(entities, []); assert.deepStrictEqual(info, modeOptions.expectedInfo); }); }); - } + }, ); }); }); - } + }, ); diff --git a/test/query.ts b/test/query.ts index a6d32f696..7238a4433 100644 --- a/test/query.ts +++ b/test/query.ts @@ -86,7 +86,7 @@ describe('Query', () => { { alias: 'alias1', count: {}, - } + }, ); }); it('should produce the right proto with a sum aggregation', () => { @@ -100,7 +100,7 @@ describe('Query', () => { name: 'property1', }, }, - } + }, ); }); it('should produce the right proto with an average aggregation', () => { @@ -114,7 +114,7 @@ describe('Query', () => { }, }, operator: 'avg', - } + }, ); }); }); @@ -126,21 +126,21 @@ describe('Query', () => { function compareAggregations( aggregateQuery: AggregateQuery, - aggregateFields: AggregateField[] + aggregateFields: AggregateField[], ) { const addAggregationsAggregate = generateAggregateQuery(); addAggregationsAggregate.addAggregations(aggregateFields); const addAggregationAggregate = generateAggregateQuery(); aggregateFields.forEach(aggregateField => - addAggregationAggregate.addAggregation(aggregateField) + addAggregationAggregate.addAggregation(aggregateField), ); assert.deepStrictEqual( aggregateQuery.aggregations, - addAggregationsAggregate.aggregations + addAggregationsAggregate.aggregations, ); assert.deepStrictEqual( aggregateQuery.aggregations, - addAggregationAggregate.aggregations + addAggregationAggregate.aggregations, ); assert.deepStrictEqual(aggregateQuery.aggregations, aggregateFields); } @@ -149,8 +149,8 @@ describe('Query', () => { compareAggregations( generateAggregateQuery().count('total1').count('total2'), ['total1', 'total2'].map(alias => - AggregateField.count().alias(alias) - ) + AggregateField.count().alias(alias), + ), ); }); it('should compare equivalent sum aggregation queries', () => { @@ -161,7 +161,7 @@ describe('Query', () => { [ AggregateField.sum('property1').alias('alias1'), AggregateField.sum('property2').alias('alias2'), - ] + ], ); }); it('should compare equivalent average aggregation queries', () => { @@ -172,7 +172,7 @@ describe('Query', () => { [ AggregateField.average('property1').alias('alias1'), AggregateField.average('property2').alias('alias2'), - ] + ], ); }); }); @@ -180,13 +180,16 @@ describe('Query', () => { it('should compare equivalent count aggregation queries', () => { compareAggregations( generateAggregateQuery().count().count(), - ['total1', 'total2'].map(() => AggregateField.count()) + ['total1', 'total2'].map(() => AggregateField.count()), ); }); it('should compare equivalent sum aggregation queries', () => { compareAggregations( generateAggregateQuery().sum('property1').sum('property2'), - [AggregateField.sum('property1'), AggregateField.sum('property2')] + [ + AggregateField.sum('property1'), + AggregateField.sum('property2'), + ], ); }); it('should compare equivalent average aggregation queries', () => { @@ -197,7 +200,7 @@ describe('Query', () => { [ AggregateField.average('property1'), AggregateField.average('property2'), - ] + ], ); }); }); @@ -210,7 +213,7 @@ describe('Query', () => { const onWarning = (warning: {message: unknown}) => { assert.strictEqual( warning.message, - 'Providing Filter objects like Composite Filter or Property Filter is recommended when using .filter' + 'Providing Filter objects like Composite Filter or Property Filter is recommended when using .filter', ); process.removeListener('warning', onWarning); done(); @@ -294,7 +297,7 @@ describe('Query', () => { const query = new Query(['kind1']).filter( 'count', ' < ', - 123 + 123, ); assert.strictEqual(query.filters[0].op, '<'); @@ -331,7 +334,7 @@ describe('Query', () => { it('should support filter with Filter', () => { const now = new Date(); const query = new Query(['kind1']).filter( - new PropertyFilter('date', '<=', now) + new PropertyFilter('date', '<=', now), ); const filter = query.entityFilters[0]; @@ -345,7 +348,7 @@ describe('Query', () => { or([ new PropertyFilter('date', '<=', now), new PropertyFilter('name', '=', 'Stephen'), - ]) + ]), ); const filter = query.entityFilters[0]; assert.strictEqual(filter.op, 'OR'); @@ -362,11 +365,11 @@ describe('Query', () => { it('should accept null as value', () => { assert.strictEqual( new Query(['kind1']).filter('status', null).filters.pop()?.val, - null + null, ); assert.strictEqual( new Query(['kind1']).filter('status', '=', null).filters.pop()?.val, - null + null, ); }); }); @@ -603,14 +606,14 @@ describe('Query', () => { dataClient['commit'] = ( request: any, options: any, - callback: (err?: unknown) => void + callback: (err?: unknown) => void, ) => { try { assert.strictEqual(request.databaseId, SECOND_DATABASE_ID); assert.strictEqual(request.projectId, projectId); assert.strictEqual( options.headers['google-cloud-resource-prefix'], - `projects/${projectId}` + `projects/${projectId}`, ); } catch (e) { callback(e); diff --git a/test/request.ts b/test/request.ts index 532966420..f8ab0613d 100644 --- a/test/request.ts +++ b/test/request.ts @@ -113,7 +113,7 @@ describe('Request', () => { assert.notStrictEqual(preparedEntityObject.data.nested, obj.data.nested); assert.deepStrictEqual( preparedEntityObject, - expectedPreparedEntityObject + expectedPreparedEntityObject, ); }); @@ -123,7 +123,7 @@ describe('Request', () => { const entityObject: any = {data: true}; entityObject[entity.KEY_SYMBOL] = key; const preparedEntityObject = Request.prepareEntityObject_( - entityObject + entityObject, ) as Any; assert.strictEqual(preparedEntityObject.key, key); assert.strictEqual(preparedEntityObject.data.data, entityObject.data); @@ -218,7 +218,7 @@ describe('Request', () => { assert.strictEqual(keys, null); assert.strictEqual(resp, API_RESPONSE); done(); - } + }, ); }); }); @@ -251,7 +251,7 @@ describe('Request', () => { assert.deepStrictEqual(keys, [key]); assert.strictEqual(resp, API_RESPONSE); done(); - } + }, ); }); }); @@ -284,7 +284,7 @@ describe('Request', () => { assert.strictEqual(config.method, 'lookup'); assert.deepStrictEqual( config.reqOpts!.keys[0], - entity.keyToKeyProto(key) + entity.keyToKeyProto(key), ); done(); }; @@ -390,7 +390,7 @@ describe('Request', () => { .on('error', (err: Error) => { assert.deepStrictEqual( err, - outOfBoundsError({integerValue: largeInt, propertyName}) + outOfBoundsError({integerValue: largeInt, propertyName}), ); setImmediate(() => { assert.strictEqual(stream.destroyed, true); @@ -637,7 +637,7 @@ describe('Request', () => { assert.ifError(err); assert.deepStrictEqual(resp, apiResponse); done(); - } + }, ); }); @@ -786,7 +786,7 @@ describe('Request', () => { request.createReadStream.getCall(0).args[1]; assert.strictEqual( typeof createReadStreamOptions.wrapNumbers, - 'boolean' + 'boolean', ); done(); }); @@ -808,14 +808,14 @@ describe('Request', () => { request.createReadStream.getCall(0).args[1]; assert.strictEqual( createReadStreamOptions.wrapNumbers, - integerTypeCastOptions + integerTypeCastOptions, ); assert.deepStrictEqual( createReadStreamOptions.wrapNumbers, - integerTypeCastOptions + integerTypeCastOptions, ); done(); - } + }, ); }); }); @@ -876,7 +876,7 @@ describe('Request', () => { assert.strictEqual(config.reqOpts!.query, queryProto); assert.strictEqual( config.reqOpts!.partitionId!.namespaceId, - query.namespace + query.namespace, ); assert.strictEqual(config.gaxOpts, undefined); @@ -988,7 +988,7 @@ describe('Request', () => { .on('error', (err: Error) => { assert.deepStrictEqual( err, - outOfBoundsError({integerValue: largeInt, propertyName}) + outOfBoundsError({integerValue: largeInt, propertyName}), ); setImmediate(() => { assert.strictEqual(stream.destroyed, true); @@ -1122,7 +1122,7 @@ describe('Request', () => { sandbox.stub(entity, 'formatArray').callsFake(array => { assert.strictEqual( array, - entityResultsPerApiCall[timesRequestCalled] + entityResultsPerApiCall[timesRequestCalled], ); return entityResultsPerApiCall[timesRequestCalled]; }); @@ -1151,7 +1151,7 @@ describe('Request', () => { FakeQuery.prototype.start = function (endCursor) { assert.strictEqual( endCursor, - apiResponse.batch.endCursor.toString('base64') + apiResponse.batch.endCursor.toString('base64'), ); startCalled = true; return this; @@ -1168,7 +1168,7 @@ describe('Request', () => { if (timesRequestCalled === 1) { assert.strictEqual( limit_, - entityResultsPerApiCall[1].length - query.limitVal + entityResultsPerApiCall[1].length - query.limitVal, ); } else { // Should restore the original limit. @@ -1340,7 +1340,7 @@ describe('Request', () => { assert.strictEqual(spy.args[0], query); assert.strictEqual(spy.args[1], options); done(); - } + }, ); }); @@ -1380,14 +1380,14 @@ describe('Request', () => { const runQueryOptions = request.runQueryStream.getCall(0).args[1]; assert.strictEqual( runQueryOptions.wrapNumbers, - integerTypeCastOptions + integerTypeCastOptions, ); assert.deepStrictEqual( runQueryOptions.wrapNumbers, - integerTypeCastOptions + integerTypeCastOptions, ); done(); - } + }, ); }); }); @@ -1494,7 +1494,7 @@ describe('Request', () => { transaction.save = (modifiedData: PrepareEntityObjectResponse) => { assert.deepStrictEqual( modifiedData.data, - Object.assign({}, entityObject, updatedEntityObject) + Object.assign({}, entityObject, updatedEntityObject), ); }; @@ -1517,7 +1517,7 @@ describe('Request', () => { transaction.modifiedEntities_.forEach((entity, index) => { assert.deepStrictEqual( entity.args[0].data, - Object.assign({}, entityObject, updatedEntityObject[index]) + Object.assign({}, entityObject, updatedEntityObject[index]), ); }); return [{}] as CommitResponse; @@ -1528,7 +1528,7 @@ describe('Request', () => { {key, data: updatedEntityObject[0]}, {key, data: updatedEntityObject[1]}, ], - done + done, ); }); @@ -1725,7 +1725,7 @@ describe('Request', () => { (err: Error, requestFn: Function) => { assert.ifError(err); requestFn(); - } + }, ); }); }); @@ -1755,7 +1755,7 @@ describe('Request', () => { (err: Error, requestFn: Function) => { assert.ifError(err); requestFn(); - } + }, ); }); @@ -1776,7 +1776,7 @@ describe('Request', () => { (err: Error, requestFn: Function) => { assert.ifError(err); requestFn(); - } + }, ); }); @@ -1790,7 +1790,7 @@ describe('Request', () => { lookup(reqOpts: RequestOptions) { assert.strictEqual( reqOpts.readOptions!.transaction, - TRANSACTION_ID + TRANSACTION_ID, ); done(); }, @@ -1801,7 +1801,7 @@ describe('Request', () => { (err: Error, requestFn: Function) => { assert.ifError(err); requestFn(); - } + }, ); }); @@ -1815,7 +1815,7 @@ describe('Request', () => { runQuery(reqOpts: RequestOptions) { assert.strictEqual( reqOpts.readOptions!.transaction, - TRANSACTION_ID + TRANSACTION_ID, ); done(); }, @@ -1826,7 +1826,7 @@ describe('Request', () => { (err: Error, requestFn: Function) => { assert.ifError(err); requestFn(); - } + }, ); }); diff --git a/test/transaction.ts b/test/transaction.ts index 4d4a1ebdf..dca9acebc 100644 --- a/test/transaction.ts +++ b/test/transaction.ts @@ -197,12 +197,12 @@ async.each( // This is useful for tests that need to know when the mocked function is called. callBackSignaler: ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => void = () => {}; constructor( err: Error | null = null, - resp: google.datastore.v1.IBeginTransactionResponse = testRunResp + resp: google.datastore.v1.IBeginTransactionResponse = testRunResp, ) { const namespace = 'run-without-mock'; const projectId = 'project-id'; @@ -223,7 +223,7 @@ async.each( // Datastore Gapic clients haven't been initialized yet, so we initialize them here. datastore.clients_.set( dataClientName, - new gapic.v1[dataClientName](options) + new gapic.v1[dataClientName](options), ); const dataClient = datastore.clients_.get(dataClientName); // Mock begin transaction @@ -241,13 +241,13 @@ async.each( | null | undefined, {} | null | undefined - > + >, ) => { // Calls a user provided function that will receive this string // Usually used to track when this code was reached relative to other code this.callBackSignaler( GapicFunctionName.BEGIN_TRANSACTION, - request + request, ); callback(err, resp); }; @@ -262,7 +262,7 @@ async.each( mockGapicFunction( functionName: GapicFunctionName, response: ResponseType, - error: Error | null + error: Error | null, ) { const dataClient = this.dataClient; // Check here that function hasn't been mocked out already @@ -286,7 +286,7 @@ async.each( ResponseType, RequestType | null | undefined, {} | null | undefined - > + >, ) => { this.callBackSignaler(functionName, request); callback(error, response); @@ -327,7 +327,7 @@ async.each( beforeEach(async () => { transactionWrapper = new MockedTransactionWrapper( new Error(testErrorMessage), - undefined + undefined, ); }); it('should send back the error when awaiting a promise', async () => { @@ -341,7 +341,7 @@ async.each( it('should send back the error when using a callback', done => { const commitCallback: CommitCallback = ( error: Error | null | undefined, - response?: google.datastore.v1.ICommitResponse + response?: google.datastore.v1.ICommitResponse, ) => { try { assert(error); @@ -382,7 +382,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.COMMIT, testCommitResp, - new Error(testErrorMessage) + new Error(testErrorMessage), ); }); @@ -398,7 +398,7 @@ async.each( it('should send back the error when using a callback', done => { const commitCallback: CommitCallback = ( error: Error | null | undefined, - response?: google.datastore.v1.ICommitResponse + response?: google.datastore.v1.ICommitResponse, ) => { try { assert(error); @@ -419,7 +419,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.COMMIT, testCommitResp, - null + null, ); }); it('should send back the response when awaiting a promise', async () => { @@ -431,7 +431,7 @@ async.each( it('should send back the response when using a callback', done => { const commitCallback: CommitCallback = ( error: Error | null | undefined, - response?: google.datastore.v1.ICommitResponse + response?: google.datastore.v1.ICommitResponse, ) => { try { assert.strictEqual(error, null); @@ -489,7 +489,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_AGGREGATION_QUERY, runAggregationQueryResp, - new Error(testErrorMessage) + new Error(testErrorMessage), ); }); @@ -505,7 +505,7 @@ async.each( it('should send back the error when using a callback', done => { const runAggregateQueryCallback: RequestCallback = ( error: Error | null | undefined, - response?: unknown + response?: unknown, ) => { try { assert(error); @@ -519,7 +519,7 @@ async.each( transaction.run(() => { transaction.runAggregationQuery( aggregate, - runAggregateQueryCallback + runAggregateQueryCallback, ); }); }); @@ -529,7 +529,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_AGGREGATION_QUERY, runAggregationQueryResp, - null + null, ); }); it('should send back the response when awaiting a promise', async () => { @@ -539,13 +539,13 @@ async.each( const [runAggregateQueryResults] = allResults; assert.deepStrictEqual( runAggregateQueryResults, - runAggregationQueryUserResp + runAggregationQueryUserResp, ); }); it('should send back the response when using a callback', done => { const runAggregateQueryCallback: CommitCallback = ( error: Error | null | undefined, - response?: unknown + response?: unknown, ) => { try { assert.strictEqual(error, null); @@ -558,7 +558,7 @@ async.each( transaction.run(() => { transaction.runAggregationQuery( aggregate, - runAggregateQueryCallback + runAggregateQueryCallback, ); }); }); @@ -594,7 +594,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_QUERY, runQueryResp, - new Error(testErrorMessage) + new Error(testErrorMessage), ); }); @@ -611,7 +611,7 @@ async.each( const callback: RunQueryCallback = ( error: Error | null | undefined, entities?: Entity[], - info?: RunQueryInfo + info?: RunQueryInfo, ) => { try { assert(error); @@ -633,7 +633,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_QUERY, runQueryResp, - null + null, ); }); it('should send back the response when awaiting a promise', async () => { @@ -646,7 +646,7 @@ async.each( const callback: RunQueryCallback = ( error: Error | null | undefined, entities?: Entity[], - info?: RunQueryInfo + info?: RunQueryInfo, ) => { try { assert.strictEqual(error, null); @@ -711,7 +711,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.LOOKUP, getResp, - new Error(testErrorMessage) + new Error(testErrorMessage), ); }); @@ -727,7 +727,7 @@ async.each( it('should send back the error when using a callback', done => { const callback: GetCallback = ( err?: Error | null, - entity?: Entities + entity?: Entities, ) => { try { assert(err); @@ -748,7 +748,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.LOOKUP, getResp, - null + null, ); }); it('should send back the response when awaiting a promise', async () => { @@ -760,7 +760,7 @@ async.each( it('should send back the response when using a callback', done => { const callback: GetCallback = ( err?: Error | null, - entity?: Entities + entity?: Entities, ) => { try { const result = entity[transactionWrapper.datastore.KEY]; @@ -938,12 +938,12 @@ async.each( try { assert.deepStrictEqual( this.eventOrder, - this.expectedEventOrder + this.expectedEventOrder, ); if (this.expectedRequests) { assert.deepStrictEqual( this.requests, - this.expectedRequests + this.expectedRequests, ); } this.#done(); @@ -960,14 +960,14 @@ async.each( expectedRequests?: { call: GapicFunctionName; request?: RequestType; - }[] + }[], ) { this.expectedEventOrder = expectedOrder; this.expectedRequests = expectedRequests; this.#done = done; transactionWrapper.callBackSignaler = ( call: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { this.requests.push({call, request}); @@ -1003,7 +1003,7 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.COMMIT, testCommitResp, - null + null, ); }); @@ -1017,7 +1017,7 @@ async.each( UserCodeEvent.RUN_CALLBACK, GapicFunctionName.COMMIT, UserCodeEvent.COMMIT_CALLBACK, - ] + ], ); transaction.run(tester.push(UserCodeEvent.RUN_CALLBACK)); transaction.commit(tester.push(UserCodeEvent.COMMIT_CALLBACK)); @@ -1032,7 +1032,7 @@ async.each( GapicFunctionName.BEGIN_TRANSACTION, GapicFunctionName.COMMIT, UserCodeEvent.COMMIT_CALLBACK, - ] + ], ); transaction.commit(tester.push(UserCodeEvent.COMMIT_CALLBACK)); tester.push(UserCodeEvent.CUSTOM_EVENT)(); @@ -1046,7 +1046,7 @@ async.each( GapicFunctionName.BEGIN_TRANSACTION, UserCodeEvent.RUN_CALLBACK, UserCodeEvent.RUN_CALLBACK, - ] + ], ); transaction.run(tester.push(UserCodeEvent.RUN_CALLBACK)); transaction.run(tester.push(UserCodeEvent.RUN_CALLBACK)); @@ -1062,7 +1062,7 @@ async.each( UserCodeEvent.RUN_CALLBACK, GapicFunctionName.COMMIT, UserCodeEvent.COMMIT_CALLBACK, - ] + ], ); transaction.commit(tester.push(UserCodeEvent.COMMIT_CALLBACK)); transaction.run(tester.push(UserCodeEvent.RUN_CALLBACK)); @@ -1076,22 +1076,22 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.COMMIT, testCommitResp, - null + null, ); transactionWrapper.mockGapicFunction( GapicFunctionName.LOOKUP, testLookupResp, - null + null, ); transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_QUERY, testRunQueryResp, - null + null, ); transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_AGGREGATION_QUERY, testRunAggregationQueryResp, - null + null, ); }); const beginTransactionRequest = { @@ -1181,7 +1181,7 @@ async.each( GapicFunctionName.COMMIT, UserCodeEvent.COMMIT_CALLBACK, ], - expectedRequests + expectedRequests, ); transaction.save({ key, @@ -1199,7 +1199,7 @@ async.each( GapicFunctionName.COMMIT, UserCodeEvent.COMMIT_CALLBACK, ], - expectedRequests + expectedRequests, ); transaction.save({ key, @@ -1241,7 +1241,7 @@ async.each( UserCodeEvent.GET_CALLBACK, UserCodeEvent.GET_CALLBACK, ], - expectedRequests + expectedRequests, ); transaction.get(key, tester.push(UserCodeEvent.GET_CALLBACK)); transaction.get(key, tester.push(UserCodeEvent.GET_CALLBACK)); @@ -1283,7 +1283,7 @@ async.each( UserCodeEvent.GET_CALLBACK, UserCodeEvent.GET_CALLBACK, ], - expectedRequests + expectedRequests, ); transaction.run(tester.push(UserCodeEvent.RUN_CALLBACK)); transaction.get(key, tester.push(UserCodeEvent.GET_CALLBACK)); @@ -1385,22 +1385,22 @@ async.each( transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_AGGREGATION_QUERY, runAggregationQueryResp, - null + null, ); transactionWrapper.mockGapicFunction( GapicFunctionName.LOOKUP, getResp, - null + null, ); transactionWrapper.mockGapicFunction( GapicFunctionName.RUN_QUERY, runQueryResp, - null + null, ); transactionWrapper.mockGapicFunction( GapicFunctionName.COMMIT, testCommitResp, - null + null, ); }); describe('lookup, lookup, put, commit', () => { @@ -1410,13 +1410,13 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { case GapicFunctionName.BEGIN_TRANSACTION: throw Error( - 'BeginTransaction should not have been called' + 'BeginTransaction should not have been called', ); case GapicFunctionName.LOOKUP: { const lookupRequest = @@ -1444,18 +1444,18 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); done(); break; } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1480,7 +1480,7 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { @@ -1504,11 +1504,11 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); assert.strictEqual(beginCount, 1); done(); @@ -1516,7 +1516,7 @@ async.each( } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1543,13 +1543,13 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { case GapicFunctionName.BEGIN_TRANSACTION: throw Error( - 'BeginTransaction should not have been called' + 'BeginTransaction should not have been called', ); case GapicFunctionName.LOOKUP: { const lookupRequest = @@ -1573,18 +1573,18 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); done(); break; } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1611,7 +1611,7 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { @@ -1643,11 +1643,11 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); assert.strictEqual(beginCount, 1); done(); @@ -1655,7 +1655,7 @@ async.each( } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1684,13 +1684,13 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { case GapicFunctionName.BEGIN_TRANSACTION: throw Error( - 'BeginTransaction should not have been called' + 'BeginTransaction should not have been called', ); case GapicFunctionName.LOOKUP: { const lookupRequest = @@ -1708,7 +1708,7 @@ async.each( { newTransaction: {}, consistencyType: 'newTransaction', - } + }, ); break; } @@ -1717,18 +1717,18 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); done(); break; } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1758,7 +1758,7 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { @@ -1784,7 +1784,7 @@ async.each( runAggregationQueryRequest.readOptions, { transaction: testRunResp.transaction, - } + }, ); break; } @@ -1793,11 +1793,11 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); assert.strictEqual(beginCount, 1); done(); @@ -1805,7 +1805,7 @@ async.each( } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1837,13 +1837,13 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { case GapicFunctionName.BEGIN_TRANSACTION: throw Error( - 'BeginTransaction should not have been called' + 'BeginTransaction should not have been called', ); case GapicFunctionName.LOOKUP: { const lookupRequest = @@ -1859,18 +1859,18 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); done(); break; } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1895,7 +1895,7 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { @@ -1919,11 +1919,11 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); assert.strictEqual(beginCount, 1); done(); @@ -1931,7 +1931,7 @@ async.each( } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -1959,7 +1959,7 @@ async.each( // It ensures the data that reaches the gapic layer is correct. transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { @@ -1975,11 +1975,11 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); assert.strictEqual(beginCount, 1); done(); @@ -1987,7 +1987,7 @@ async.each( } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -2010,7 +2010,7 @@ async.each( let beginCount = 0; transactionWrapper.callBackSignaler = ( callbackReached: GapicFunctionName, - request?: RequestType + request?: RequestType, ) => { try { switch (callbackReached) { @@ -2034,11 +2034,11 @@ async.each( request as protos.google.datastore.v1.ICommitRequest; assert.deepStrictEqual( commitRequest.mode, - 'TRANSACTIONAL' + 'TRANSACTIONAL', ); assert.deepStrictEqual( commitRequest.transaction, - testRunResp.transaction + testRunResp.transaction, ); assert.strictEqual(beginCount, 1); done(); @@ -2046,7 +2046,7 @@ async.each( } default: throw Error( - 'A gapic function was called that should not have been called' + 'A gapic function was called that should not have been called', ); } } catch (err: any) { @@ -2097,7 +2097,7 @@ async.each( // Datastore Gapic clients haven't been initialized yet, so we initialize them here. datastore.clients_.set( dataClientName, - new gapic.v1[dataClientName](options) + new gapic.v1[dataClientName](options), ); dataClient = datastore.clients_.get(dataClientName); if (dataClient && dataClient.beginTransaction) { @@ -2124,7 +2124,7 @@ async.each( | null | undefined, {} | null | undefined - > + >, ) => { callback(err, testRunResp); }; @@ -2150,7 +2150,7 @@ async.each( const runCallback: RunCallback = ( error: Error | null, transaction: Transaction | null, - response?: google.datastore.v1.IBeginTransactionResponse + response?: google.datastore.v1.IBeginTransactionResponse, ) => { try { assert(error); @@ -2180,7 +2180,7 @@ async.each( const runCallback: RunCallback = ( error: Error | null, transaction: Transaction | null, - response?: google.datastore.v1.IBeginTransactionResponse + response?: google.datastore.v1.IBeginTransactionResponse, ) => { try { assert.strictEqual(error, null); @@ -2496,7 +2496,7 @@ async.each( // the rollback function to reach request_. transaction.request_ = ( config: RequestConfig, - callback: RequestCallback + callback: RequestCallback, ) => { callback(null, {transaction: Buffer.from(TRANSACTION_ID)}); }; @@ -2603,7 +2603,7 @@ async.each( transaction.request_ = (config: Any) => { assert.deepStrictEqual( config.reqOpts.transactionOptions.readOnly, - {} + {}, ); done(); }; @@ -2617,7 +2617,7 @@ async.each( transaction.request_ = config => { assert.deepStrictEqual( config.reqOpts!.transactionOptions!.readOnly, - {} + {}, ); done(); }; @@ -2637,7 +2637,7 @@ async.each( config.reqOpts!.transactionOptions!.readWrite, { previousTransaction: options.transactionId, - } + }, ); done(); }; @@ -2653,7 +2653,7 @@ async.each( config.reqOpts!.transactionOptions!.readWrite, { previousTransaction: transaction.id, - } + }, ); done(); }; @@ -2749,7 +2749,7 @@ async.each( transaction.save(entities); assert.strictEqual( transaction.modifiedEntities_.length, - entities.length + entities.length, ); transaction.modifiedEntities_.forEach((queuedEntity: Entity) => { assert.strictEqual(queuedEntity.method, 'save'); @@ -2855,7 +2855,7 @@ async.each( }); }); }); - } + }, ); describe('getTransactionRequest', () => { From 1a6b9d7dc7e5617aafb2c056a568ac4dc7fe1e34 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 11:16:44 -0400 Subject: [PATCH 04/10] Add void in front of a bunch of promises --- system-test/datastore.ts | 2 +- test/transaction.ts | 42 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/system-test/datastore.ts b/system-test/datastore.ts index 1290ccb94..8b32fa92f 100644 --- a/system-test/datastore.ts +++ b/system-test/datastore.ts @@ -3249,7 +3249,7 @@ async.each( it('should export, then import entities', async function () { setupForDelay(); this.retries(3); - delay(this); + await delay(this); const [exportOperation] = await datastore.export({bucket}); await exportOperation.promise(); diff --git a/test/transaction.ts b/test/transaction.ts index dca9acebc..4da7bdb17 100644 --- a/test/transaction.ts +++ b/test/transaction.ts @@ -1462,7 +1462,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; await transaction.get(key); @@ -1523,7 +1523,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; await transaction.run(); @@ -1591,7 +1591,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; const query = @@ -1662,7 +1662,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; await transaction.run(); @@ -1735,7 +1735,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; const query = @@ -1812,7 +1812,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; await transaction.run(); @@ -1877,7 +1877,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; transaction.save({key, data: ''}); @@ -1938,7 +1938,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; await transaction.run(); @@ -1994,7 +1994,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; transaction.save({key, data: ''}); @@ -2053,7 +2053,7 @@ async.each( done(err); } }; - (async () => { + void (async () => { try { transaction = transactionWrapper.transaction; await transaction.run(); @@ -2208,7 +2208,7 @@ async.each( done(); }); }; - transaction.run(); + void transaction.run(); }); afterEach(() => { @@ -2222,7 +2222,7 @@ async.each( assert.deepStrictEqual(config.gaxOpts, {}); done(); }; - transaction.commit(); + void transaction.commit(); }); it('should accept gaxOptions', done => { @@ -2233,7 +2233,7 @@ async.each( done(); }; - transaction.commit(gaxOptions); + void transaction.commit(gaxOptions); }); it('should skip the commit', done => { @@ -2311,7 +2311,7 @@ async.each( transaction.request_ = () => {}; - transaction.commit(); + void transaction.commit(); assert.strictEqual(deleteStub.calledOnce, true); assert.strictEqual(saveStub.calledOnce, true); @@ -2339,7 +2339,7 @@ async.each( transaction.request_ = () => {}; - transaction.commit(); + void transaction.commit(); assert.strictEqual(deleteSpy.notCalled, true); assert.strictEqual(saveStub.calledOnce, true); }); @@ -2357,7 +2357,7 @@ async.each( transaction.request_ = () => {}; - transaction.commit(); + void transaction.commit(); }); it('should send the built request object', done => { @@ -2377,7 +2377,7 @@ async.each( done(); }; - transaction.commit(); + void transaction.commit(); }); it('should execute the queued callbacks', () => { @@ -2397,7 +2397,7 @@ async.each( cb(); }; - transaction.commit(); + void transaction.commit(); assert(cb1Called); assert(cb2Called); @@ -2512,7 +2512,7 @@ async.each( assert.deepStrictEqual(config.gaxOpts, {}); done(); }; - transaction.rollback(); + void transaction.rollback(); }); it('should allow setting gaxOptions', done => { @@ -2523,7 +2523,7 @@ async.each( done(); }; - transaction.rollback(gaxOptions); + void transaction.rollback(gaxOptions); }); it('should pass error to callback', done => { @@ -2591,7 +2591,7 @@ async.each( done(); }; - transaction.run({gaxOptions}); + void transaction.run({gaxOptions}); }); describe('options.readOnly', () => { From 307fea13e42c52b3b090ce800a16764e98cf1df1 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 11:32:52 -0400 Subject: [PATCH 05/10] Downgrade arrify --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e271c253..da204f0c9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ }, "dependencies": { "@google-cloud/promisify": "^5.0.0", - "arrify": "^3.0.0", + "arrify": "^2.0.0", "async-mutex": "^0.5.0", "concat-stream": "^2.0.0", "extend": "^3.0.2", From 0a471befa9fc8c960b96daa6b4bfaa8cabde6080 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 11:33:39 -0400 Subject: [PATCH 06/10] Initialize GAX_STREAM This addresses the compile time errors. --- test/request.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/request.ts b/test/request.ts index f8ab0613d..f82348c89 100644 --- a/test/request.ts +++ b/test/request.ts @@ -1886,7 +1886,7 @@ describe('Request', () => { }); describe('requestStream_', () => { - let GAX_STREAM: gax.CancellableStream; + let GAX_STREAM = new PassThrough(); const CONFIG = {}; beforeEach(() => { @@ -1898,7 +1898,7 @@ describe('Request', () => { }); it('should expose an abort function', done => { - GAX_STREAM.cancel = done; + (GAX_STREAM as unknown as gax.CancellableStream).cancel = done; const requestStream = request.requestStream_(CONFIG); requestStream.emit('reading'); From 727058d6387f9a3f5fdd785aa77a20e697cabfe9 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Wed, 12 Mar 2025 11:42:52 -0400 Subject: [PATCH 07/10] Remove the migrate to node script --- migrate-to-node-18.cjs | 89 ------------------------------------------ 1 file changed, 89 deletions(-) delete mode 100644 migrate-to-node-18.cjs diff --git a/migrate-to-node-18.cjs b/migrate-to-node-18.cjs deleted file mode 100644 index 246c74cf8..000000000 --- a/migrate-to-node-18.cjs +++ /dev/null @@ -1,89 +0,0 @@ -const path = require('path'); -const fs = require('fs'); -const execSync = require('child_process').execSync; -const yaml = require('js-yaml'); - -const COPYRIGHT_HEADER = `# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License.` -const NODE_VERSION = '18'; -const PREV_NODE_VERSION = '14'; -const NEW_POST_PROCESSOR_SHA = "sha256:0d39e59663287ae929c1d4ccf8ebf7cef9946826c9b86eda7e85d8d752dbb584" -async function main() { - // Grab package.json - const jsonPath = path.join(__dirname, 'package.json').toString(); - let packageJson = fs.readFileSync(jsonPath, 'utf8'); - packageJson = JSON.parse(packageJson); - - console.log('updating engines field...'); - packageJson.engines.node = `>=${NODE_VERSION}`; - fs.writeFileSync(jsonPath, JSON.stringify(packageJson, null, 2)); - - console.log('updating all dependencies to latest'); - if (packageJson.dependencies) { - for (const dep of Object.keys(packageJson.dependencies)) { - if (dep === "google-auth-library" || dep === "gaxios" || dep === "google-gax") { - execSync(`npm i ${dep}@rc --engines-strict`); - } else { - console.log(`npm i ${dep}@latest --engines-strict`); - execSync(`npm i ${dep}@latest --engines-strict`); - } - } - } - if (packageJson.devDependencies) { - for (const dep of Object.keys(packageJson.devDependencies)) { - console.log(`npm i ${dep}@latest -D --engines-strict`); - execSync(`npm i ${dep}@latest -D --engines-strict`); - } - } - - console.log('updating post-processor to latest'); - const owlbotYamlPath = "./.github/.Owlbot.lock.yaml"; - const yamlData = fs.readFileSync(owlbotYamlPath, 'utf8'); - let dockerFile = (yaml.load(yamlData)); - dockerFile.docker.digest = NEW_POST_PROCESSOR_SHA; - fs.writeFileSync(owlbotYamlPath, `${COPYRIGHT_HEADER}\n${yaml.dump(dockerFile)}`); - - let samplesPackageJson; - let samplesJsonPath; - try { - samplesJsonPath = path - .join(__dirname, 'samples', 'package.json') - .toString(); - samplesPackageJson = fs.readFileSync(samplesJsonPath, 'utf8'); - samplesPackageJson = JSON.parse(samplesPackageJson); - } catch (err) { - console.log( - 'Repo does not have a samples directory; skipping updating samples' - ); - } - - if (samplesPackageJson) { - // Update engines field - console.log('updating samples engines field...'); - samplesPackageJson.engines.node = `>=${NODE_VERSION}`; - fs.writeFileSync( - samplesJsonPath, - JSON.stringify(samplesPackageJson, null, 2) - ); - } - - execSync( - `rm -rf .kokoro/continuous/node${PREV_NODE_VERSION} .kokoro/presubmit/node${PREV_NODE_VERSION}` - ); - execSync( - `npm dist-tag add ${packageJson.name}@${packageJson.version} legacy-${PREV_NODE_VERSION} --registry=https://wombat-dressing-room.appspot.com/` - ); -} - -main(); From 2497a31e1683bf4e6920aed415f88dc0f4f29901 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Tue, 29 Apr 2025 17:06:28 -0400 Subject: [PATCH 08/10] Set a variable to Protobuf --- package.json | 1 + src/entity.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a01cca399..2f4ae74d7 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "extend": "^3.0.2", "google-gax": "^5.0.0-rc.3", "is": "^3.3.0", + "protobufjs": "7.0.0", "split-array-stream": "^2.0.0", "stream-events": "^1.0.5" }, diff --git a/src/entity.ts b/src/entity.ts index f6c3bd55c..ef593126c 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -18,7 +18,8 @@ import * as extend from 'extend'; import * as is from 'is'; import {Query, QueryProto, IntegerTypeCastOptions} from './query'; import {PathType} from '.'; -import {protobuf as Protobuf} from 'google-gax'; +const Protobuf = require('protobufjs'); +import {protobuf as Protobuf2} from 'google-gax'; import * as path from 'path'; import {google} from '../protos/protos'; import {and, PropertyFilter} from './filter'; From 0a0530a3462960c62177c12e9dcbe16fa39df69d Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Tue, 29 Apr 2025 17:07:27 -0400 Subject: [PATCH 09/10] Remove the protobuf import --- src/entity.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/entity.ts b/src/entity.ts index ef593126c..ad9e51242 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -19,7 +19,6 @@ import * as is from 'is'; import {Query, QueryProto, IntegerTypeCastOptions} from './query'; import {PathType} from '.'; const Protobuf = require('protobufjs'); -import {protobuf as Protobuf2} from 'google-gax'; import * as path from 'path'; import {google} from '../protos/protos'; import {and, PropertyFilter} from './filter'; From 1c5fb67f3111a6c082d0b67b169c9f44e9ba84a2 Mon Sep 17 00:00:00 2001 From: Daniel Bruce Date: Tue, 29 Apr 2025 17:22:18 -0400 Subject: [PATCH 10/10] Add a test comment --- src/entity.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/entity.ts b/src/entity.ts index ad9e51242..f06f909e3 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -23,6 +23,8 @@ import * as path from 'path'; import {google} from '../protos/protos'; import {and, PropertyFilter} from './filter'; +// Test comment + // eslint-disable-next-line @typescript-eslint/no-namespace export namespace entity { export interface InvalidKeyErrorOptions {