Skip to content

Commit

Permalink
fix: better support for fallback mode (#1756)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 468790263

Source-Link: googleapis/googleapis@873ab45

Source-Link: googleapis/googleapis-gen@cb6f37a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9
  • Loading branch information
gcf-owl-bot[bot] committed Aug 23, 2022
1 parent fd7002d commit a029a6e
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 258 deletions.
22 changes: 11 additions & 11 deletions dev/src/v1/firestore_admin_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
} from 'google-gax';

import {Transform} from 'stream';
import {RequestType} from 'google-gax/build/src/apitypes';
import * as protos from '../../protos/firestore_admin_v1_proto_api';
import jsonProtos = require('../../protos/admin_v1.json');
/**
Expand Down Expand Up @@ -407,7 +406,8 @@ export class FirestoreAdminClient {
const apiCall = this._gaxModule.createApiCall(
callPromise,
this._defaults[methodName],
descriptor
descriptor,
this._opts.fallback
);

this.innerApiCalls[methodName] = apiCall;
Expand Down Expand Up @@ -1034,7 +1034,7 @@ export class FirestoreAdminClient {
const decodeOperation = new gax.Operation(
operation,
this.descriptors.longrunning.createIndex,
gax.createDefaultBackoffSettings()
this._gaxModule.createDefaultBackoffSettings()
);
return decodeOperation as LROperation<
protos.google.firestore.admin.v1.Index,
Expand Down Expand Up @@ -1186,7 +1186,7 @@ export class FirestoreAdminClient {
const decodeOperation = new gax.Operation(
operation,
this.descriptors.longrunning.updateField,
gax.createDefaultBackoffSettings()
this._gaxModule.createDefaultBackoffSettings()
);
return decodeOperation as LROperation<
protos.google.firestore.admin.v1.Field,
Expand Down Expand Up @@ -1345,7 +1345,7 @@ export class FirestoreAdminClient {
const decodeOperation = new gax.Operation(
operation,
this.descriptors.longrunning.exportDocuments,
gax.createDefaultBackoffSettings()
this._gaxModule.createDefaultBackoffSettings()
);
return decodeOperation as LROperation<
protos.google.firestore.admin.v1.ExportDocumentsResponse,
Expand Down Expand Up @@ -1496,7 +1496,7 @@ export class FirestoreAdminClient {
const decodeOperation = new gax.Operation(
operation,
this.descriptors.longrunning.importDocuments,
gax.createDefaultBackoffSettings()
this._gaxModule.createDefaultBackoffSettings()
);
return decodeOperation as LROperation<
protos.google.protobuf.Empty,
Expand Down Expand Up @@ -1635,7 +1635,7 @@ export class FirestoreAdminClient {
const decodeOperation = new gax.Operation(
operation,
this.descriptors.longrunning.updateDatabase,
gax.createDefaultBackoffSettings()
this._gaxModule.createDefaultBackoffSettings()
);
return decodeOperation as LROperation<
protos.google.firestore.admin.v1.Database,
Expand Down Expand Up @@ -1783,7 +1783,7 @@ export class FirestoreAdminClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listIndexes.createStream(
this.innerApiCalls.listIndexes as gax.GaxCall,
this.innerApiCalls.listIndexes as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -1836,7 +1836,7 @@ export class FirestoreAdminClient {
this.initialize();
return this.descriptors.page.listIndexes.asyncIterate(
this.innerApiCalls['listIndexes'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<protos.google.firestore.admin.v1.IIndex>;
}
Expand Down Expand Up @@ -1994,7 +1994,7 @@ export class FirestoreAdminClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listFields.createStream(
this.innerApiCalls.listFields as gax.GaxCall,
this.innerApiCalls.listFields as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -2051,7 +2051,7 @@ export class FirestoreAdminClient {
this.initialize();
return this.descriptors.page.listFields.asyncIterate(
this.innerApiCalls['listFields'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<protos.google.firestore.admin.v1.IField>;
}
Expand Down
16 changes: 8 additions & 8 deletions dev/src/v1/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
} from 'google-gax';

import {Transform} from 'stream';
import {RequestType} from 'google-gax/build/src/apitypes';
import {PassThrough} from 'stream';
import * as protos from '../../protos/firestore_v1_proto_api';
import jsonProtos = require('../../protos/v1.json');
Expand Down Expand Up @@ -307,7 +306,8 @@ export class FirestoreClient {
const apiCall = this._gaxModule.createApiCall(
callPromise,
this._defaults[methodName],
descriptor
descriptor,
this._opts.fallback
);

this.innerApiCalls[methodName] = apiCall;
Expand Down Expand Up @@ -1454,7 +1454,7 @@ export class FirestoreClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listDocuments.createStream(
this.innerApiCalls.listDocuments as gax.GaxCall,
this.innerApiCalls.listDocuments as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -1531,7 +1531,7 @@ export class FirestoreClient {
this.initialize();
return this.descriptors.page.listDocuments.asyncIterate(
this.innerApiCalls['listDocuments'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<protos.google.firestore.v1.IDocument>;
}
Expand Down Expand Up @@ -1742,7 +1742,7 @@ export class FirestoreClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.partitionQuery.createStream(
this.innerApiCalls.partitionQuery as gax.GaxCall,
this.innerApiCalls.partitionQuery as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -1828,7 +1828,7 @@ export class FirestoreClient {
this.initialize();
return this.descriptors.page.partitionQuery.asyncIterate(
this.innerApiCalls['partitionQuery'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<protos.google.firestore.v1.ICursor>;
}
Expand Down Expand Up @@ -1977,7 +1977,7 @@ export class FirestoreClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listCollectionIds.createStream(
this.innerApiCalls.listCollectionIds as gax.GaxCall,
this.innerApiCalls.listCollectionIds as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -2032,7 +2032,7 @@ export class FirestoreClient {
this.initialize();
return this.descriptors.page.listCollectionIds.asyncIterate(
this.innerApiCalls['listCollectionIds'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<string>;
}
Expand Down
16 changes: 8 additions & 8 deletions dev/src/v1beta1/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
} from 'google-gax';

import {Transform} from 'stream';
import {RequestType} from 'google-gax/build/src/apitypes';
import {PassThrough} from 'stream';
import * as protos from '../../protos/firestore_v1beta1_proto_api';
import jsonProtos = require('../../protos/v1beta1.json');
Expand Down Expand Up @@ -310,7 +309,8 @@ export class FirestoreClient {
const apiCall = this._gaxModule.createApiCall(
callPromise,
this._defaults[methodName],
descriptor
descriptor,
this._opts.fallback
);

this.innerApiCalls[methodName] = apiCall;
Expand Down Expand Up @@ -1471,7 +1471,7 @@ export class FirestoreClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listDocuments.createStream(
this.innerApiCalls.listDocuments as gax.GaxCall,
this.innerApiCalls.listDocuments as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -1548,7 +1548,7 @@ export class FirestoreClient {
this.initialize();
return this.descriptors.page.listDocuments.asyncIterate(
this.innerApiCalls['listDocuments'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<protos.google.firestore.v1beta1.IDocument>;
}
Expand Down Expand Up @@ -1761,7 +1761,7 @@ export class FirestoreClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.partitionQuery.createStream(
this.innerApiCalls.partitionQuery as gax.GaxCall,
this.innerApiCalls.partitionQuery as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -1844,7 +1844,7 @@ export class FirestoreClient {
this.initialize();
return this.descriptors.page.partitionQuery.asyncIterate(
this.innerApiCalls['partitionQuery'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<protos.google.firestore.v1beta1.ICursor>;
}
Expand Down Expand Up @@ -1993,7 +1993,7 @@ export class FirestoreClient {
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listCollectionIds.createStream(
this.innerApiCalls.listCollectionIds as gax.GaxCall,
this.innerApiCalls.listCollectionIds as GaxCall,
request,
callSettings
);
Expand Down Expand Up @@ -2045,7 +2045,7 @@ export class FirestoreClient {
this.initialize();
return this.descriptors.page.listCollectionIds.asyncIterate(
this.innerApiCalls['listCollectionIds'] as GaxCall,
request as unknown as RequestType,
request as {},
callSettings
) as AsyncIterable<string>;
}
Expand Down
Loading

0 comments on commit a029a6e

Please sign in to comment.