From feba866be528785e3b9048eb3cf0f67f121fd4ee Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 15 Jun 2020 11:12:54 -0700 Subject: [PATCH] fix: proper fallback option handling (#684) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore: set Ruby namespace in proto options PiperOrigin-RevId: 316124477 Source-Author: Google APIs Source-Date: Fri Jun 12 10:06:09 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: c829fa0bfa725adaf20d82e86cbc1220e3ffd784 Source-Link: https://github.com/googleapis/googleapis/commit/c829fa0bfa725adaf20d82e86cbc1220e3ffd784 --- protos/google/datastore/v1/datastore.proto | 1 + protos/google/datastore/v1/entity.proto | 1 + protos/google/datastore/v1/query.proto | 1 + protos/protos.json | 3 ++- src/v1/datastore_client.ts | 13 +++++-------- synth.metadata | 6 +++--- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/protos/google/datastore/v1/datastore.proto b/protos/google/datastore/v1/datastore.proto index 0df65c447..ad016194a 100644 --- a/protos/google/datastore/v1/datastore.proto +++ b/protos/google/datastore/v1/datastore.proto @@ -28,6 +28,7 @@ option java_multiple_files = true; option java_outer_classname = "DatastoreProto"; option java_package = "com.google.datastore.v1"; option php_namespace = "Google\\Cloud\\Datastore\\V1"; +option ruby_package = "Google::Cloud::Datastore::V1"; // Each RPC normalizes the partition IDs of the keys in its input entities, // and always returns entities with keys with normalized partition IDs. diff --git a/protos/google/datastore/v1/entity.proto b/protos/google/datastore/v1/entity.proto index dc3a60120..61286cd7a 100644 --- a/protos/google/datastore/v1/entity.proto +++ b/protos/google/datastore/v1/entity.proto @@ -27,6 +27,7 @@ option java_multiple_files = true; option java_outer_classname = "EntityProto"; option java_package = "com.google.datastore.v1"; option php_namespace = "Google\\Cloud\\Datastore\\V1"; +option ruby_package = "Google::Cloud::Datastore::V1"; // A partition ID identifies a grouping of entities. The grouping is always // by project and namespace, however the namespace ID may be empty. diff --git a/protos/google/datastore/v1/query.proto b/protos/google/datastore/v1/query.proto index ef9f1c658..4cb3ef99b 100644 --- a/protos/google/datastore/v1/query.proto +++ b/protos/google/datastore/v1/query.proto @@ -27,6 +27,7 @@ option java_multiple_files = true; option java_outer_classname = "QueryProto"; option java_package = "com.google.datastore.v1"; option php_namespace = "Google\\Cloud\\Datastore\\V1"; +option ruby_package = "Google::Cloud::Datastore::V1"; // The result of fetching an entity from Datastore. message EntityResult { diff --git a/protos/protos.json b/protos/protos.json index 59169d34a..6896bb4c9 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -11,7 +11,8 @@ "java_multiple_files": true, "java_outer_classname": "QueryProto", "java_package": "com.google.datastore.v1", - "php_namespace": "Google\\Cloud\\Datastore\\V1" + "php_namespace": "Google\\Cloud\\Datastore\\V1", + "ruby_package": "Google::Cloud::Datastore::V1" }, "nested": { "Datastore": { diff --git a/src/v1/datastore_client.ts b/src/v1/datastore_client.ts index 0f90a1611..9097242b6 100644 --- a/src/v1/datastore_client.ts +++ b/src/v1/datastore_client.ts @@ -104,14 +104,11 @@ export class DatastoreClient { // const showcaseClient = new showcaseClient({ projectId, customConfig }); opts.clientConfig = opts.clientConfig || {}; - const isBrowser = typeof window !== 'undefined'; - if (isBrowser) { - opts.fallback = true; - } - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the DatastoreClient constructor. + this._gaxModule = opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. diff --git a/synth.metadata b/synth.metadata index e888726b3..0c1a1e61b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-datastore.git", - "sha": "d90b7331a96a2cca5f8bc51281b4e22648b40007" + "sha": "c60fe437c8e3ce1bdebb191b5623b099bf43dc58" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "a3a0bf0f6291d69f2ff3df7fcd63d28ee20ac727", - "internalRef": "310060413" + "sha": "c829fa0bfa725adaf20d82e86cbc1220e3ffd784", + "internalRef": "316124477" } }, {