Skip to content

Commit

Permalink
fix: proper fallback option handling (#684)
Browse files Browse the repository at this point in the history
* 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 <noreply@google.com>
Source-Date: Fri Jun 12 10:06:09 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: c829fa0bfa725adaf20d82e86cbc1220e3ffd784
Source-Link: googleapis/googleapis@c829fa0
  • Loading branch information
yoshi-automation committed Jun 15, 2020
1 parent c60fe43 commit feba866
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions protos/google/datastore/v1/datastore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions protos/google/datastore/v1/entity.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions protos/google/datastore/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion protos/protos.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
13 changes: 5 additions & 8 deletions src/v1/datastore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down

0 comments on commit feba866

Please sign in to comment.