Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Improve AuthClient Compatibility #1654

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: Prep for next auth major
  • Loading branch information
danielbankhead committed Sep 9, 2024
commit 8d2d0c90f083214969f865e53ae55a24772bd14d
4 changes: 2 additions & 2 deletions gax/src/clientInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import {GrpcClientOptions, ClientStubOptions} from './grpc';
import * as gax from './gax';
import {AuthClient, GoogleAuthOptions} from 'google-auth-library';
import {GoogleAuthOptions} from 'google-auth-library';
import {
BundleDescriptor,
LongrunningDescriptor,
Expand All @@ -30,7 +30,7 @@ import * as operationProtos from '../protos/operations';

export interface ClientOptions
extends GrpcClientOptions,
GoogleAuthOptions<AuthClient>,
GoogleAuthOptions,
ClientStubOptions {
libName?: string;
libVersion?: string;
Expand Down
3 changes: 1 addition & 2 deletions gax/src/fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import * as IamProtos from '../protos/iam_service';
import * as LocationProtos from '../protos/locations';
import * as operationsProtos from '../protos/operations';

export {AnyAuthClient as AuthClient};
export {FallbackServiceError};
export {PathTemplate} from './pathTemplate';
export {routingHeader};
Expand Down Expand Up @@ -79,7 +78,7 @@ export interface ServiceMethods {
}

export class GrpcClient {
auth?: AuthClient | GoogleAuth<AuthClient>;
auth?: AuthClient | GoogleAuth;
authClient?: AuthClient;
fallback: boolean;
grpcVersion: string;
Expand Down
8 changes: 4 additions & 4 deletions gax/src/grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as grpcProtoLoader from '@grpc/proto-loader';
import {execFile} from 'child_process';
import * as fs from 'fs';
import {GoogleAuth, GoogleAuthOptions, AuthClient} from 'google-auth-library';
import {GoogleAuth, GoogleAuthOptions} from 'google-auth-library';
import * as grpc from '@grpc/grpc-js';
import * as os from 'os';
import {join} from 'path';
Expand All @@ -44,8 +44,8 @@ const COMMON_PROTO_FILES: string[] = commonProtoFiles.map(file =>
file.replace(/[/\\]/g, path.sep)
);

export interface GrpcClientOptions extends GoogleAuthOptions<AuthClient> {
auth?: GoogleAuth<AuthClient>;
export interface GrpcClientOptions extends GoogleAuthOptions {
auth?: GoogleAuth;
grpc?: GrpcModule;
protoJson?: protobuf.Root;
httpRules?: Array<google.api.IHttpRule>;
Expand Down Expand Up @@ -113,7 +113,7 @@ export class ClientStub extends grpc.Client {
}

export class GrpcClient {
auth: GoogleAuth<AuthClient>;
auth: GoogleAuth;
grpc: GrpcModule;
grpcVersion: string;
fallback: boolean | 'rest' | 'proto';
Expand Down
2 changes: 1 addition & 1 deletion gax/src/iamService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class IamClient {
private _defaults: {[method: string]: gax.CallSettings};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _protos: any;
auth?: GoogleAuth<AuthClient> | AuthClient;
auth?: GoogleAuth | AuthClient;
descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}};
innerApiCalls: {[name: string]: Function} = {};
iamPolicyStub?: Promise<{[name: string]: Function}>;
Expand Down
2 changes: 1 addition & 1 deletion gax/src/operationsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const ALL_SCOPES: string[] = [];
* @class
*/
export class OperationsClient {
auth?: GoogleAuth<AuthClient> | AuthClient;
auth?: GoogleAuth | AuthClient;
innerApiCalls: {[name: string]: Function};
descriptor: {[method: string]: PageDescriptor};
operationsStub: Promise<{[method: string]: Function}>;
Expand Down
Loading