diff --git a/dev/src/v1/firestore_admin_client.ts b/dev/src/v1/firestore_admin_client.ts index aedca6d4a..6dee553f7 100644 --- a/dev/src/v1/firestore_admin_client.ts +++ b/dev/src/v1/firestore_admin_client.ts @@ -50,6 +50,7 @@ const version = require('../../../package.json').version; export class FirestoreAdminClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -61,6 +62,7 @@ export class FirestoreAdminClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -105,6 +107,9 @@ export class FirestoreAdminClient { const staticMembers = this.constructor as typeof FirestoreAdminClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -258,6 +263,9 @@ export class FirestoreAdminClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -286,7 +294,8 @@ export class FirestoreAdminClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.firestore.admin.v1.FirestoreAdmin, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/dev/src/v1/firestore_client.ts b/dev/src/v1/firestore_client.ts index 958e74688..f216b4c27 100644 --- a/dev/src/v1/firestore_client.ts +++ b/dev/src/v1/firestore_client.ts @@ -55,6 +55,7 @@ const version = require('../../../package.json').version; export class FirestoreClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -66,6 +67,7 @@ export class FirestoreClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; firestoreStub?: Promise<{[name: string]: Function}>; @@ -108,6 +110,9 @@ export class FirestoreClient { const staticMembers = this.constructor as typeof FirestoreClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -205,6 +210,9 @@ export class FirestoreClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -233,7 +241,8 @@ export class FirestoreClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.firestore.v1.Firestore, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/dev/src/v1beta1/firestore_client.ts b/dev/src/v1beta1/firestore_client.ts index 10fbc0a3f..a64604cdd 100644 --- a/dev/src/v1beta1/firestore_client.ts +++ b/dev/src/v1beta1/firestore_client.ts @@ -58,6 +58,7 @@ const version = require('../../../package.json').version; export class FirestoreClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -69,6 +70,7 @@ export class FirestoreClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; firestoreStub?: Promise<{[name: string]: Function}>; @@ -111,6 +113,9 @@ export class FirestoreClient { const staticMembers = this.constructor as typeof FirestoreClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -208,6 +213,9 @@ export class FirestoreClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -236,7 +244,8 @@ export class FirestoreClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.firestore.v1beta1.Firestore, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/synth.metadata b/synth.metadata index ce7e5b0e4..eda4970c3 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-firestore.git", - "sha": "5e384157efda51dc91eeb314a7ac53466764af3d" + "sha": "8d9c50381eedf6ee8043eed681d03b44262b9820" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "076f7e9f0b258bdb54338895d7251b202e8f0de3", - "internalRef": "380641501" + "sha": "80f404215a9346259db760d80d0671f28c433453", + "internalRef": "385101839" } }, { diff --git a/types/v1/firestore_admin_client.d.ts b/types/v1/firestore_admin_client.d.ts index 945ebe8a0..523c92ad7 100644 --- a/types/v1/firestore_admin_client.d.ts +++ b/types/v1/firestore_admin_client.d.ts @@ -35,12 +35,14 @@ import * as protos from '../protos/firestore_admin_v1_proto_api'; export declare class FirestoreAdminClient { private _terminated; private _opts; + private _providedCustomServicePath; private _gaxModule; private _gaxGrpc; private _protos; private _defaults; auth: gax.GoogleAuth; descriptors: Descriptors; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: { [name: string]: Function; }; diff --git a/types/v1/firestore_client.d.ts b/types/v1/firestore_client.d.ts index fca4787e1..139527dd9 100644 --- a/types/v1/firestore_client.d.ts +++ b/types/v1/firestore_client.d.ts @@ -40,12 +40,14 @@ import * as protos from '../protos/firestore_v1_proto_api'; export declare class FirestoreClient { private _terminated; private _opts; + private _providedCustomServicePath; private _gaxModule; private _gaxGrpc; private _protos; private _defaults; auth: gax.GoogleAuth; descriptors: Descriptors; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: { [name: string]: Function; }; diff --git a/types/v1beta1/firestore_client.d.ts b/types/v1beta1/firestore_client.d.ts index 2f182209a..24ea51b39 100644 --- a/types/v1beta1/firestore_client.d.ts +++ b/types/v1beta1/firestore_client.d.ts @@ -41,12 +41,14 @@ import * as protos from '../protos/firestore_v1beta1_proto_api'; export declare class FirestoreClient { private _terminated; private _opts; + private _providedCustomServicePath; private _gaxModule; private _gaxGrpc; private _protos; private _defaults; auth: gax.GoogleAuth; descriptors: Descriptors; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: { [name: string]: Function; };