Skip to content

Commit fb0a393

Browse files
committed
address review feedback
1 parent c517dbc commit fb0a393

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/eventarc/eventarc-client-internal.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
import * as validator from '../utils/validator';
1919
import { FirebaseEventarcError, toCloudEventProtoFormat } from './eventarc-utils';
20-
import { Eventarc, Channel } from './eventarc';
20+
import { App } from '../app';
21+
import { Channel } from './eventarc';
2122
import {
2223
HttpRequestConfig, HttpClient, HttpError, AuthorizedHttpClient
2324
} from '../utils/api-request';
@@ -43,21 +44,21 @@ export class EventarcApiClient {
4344
private projectId?: string;
4445
private readonly resolvedChannelName: Promise<string>;
4546

46-
constructor(private readonly eventarc: Eventarc, private readonly channel: Channel) {
47-
if (!validator.isNonNullObject(eventarc.app) || !('options' in eventarc.app)) {
47+
constructor(private readonly app: App, private readonly channel: Channel) {
48+
if (!validator.isNonNullObject(app) || !('options' in app)) {
4849
throw new FirebaseEventarcError(
4950
'invalid-argument',
50-
'First argument passed to admin.appCheck() must be a valid Firebase app instance.');
51+
'First argument passed to Channel() must be a valid Eventarc service instance.');
5152
}
52-
this.httpClient = new AuthorizedHttpClient(eventarc.app as FirebaseApp);
53+
this.httpClient = new AuthorizedHttpClient(app as FirebaseApp);
5354
this.resolvedChannelName = this.resolveChannelName(channel.name);
5455
}
5556

5657
private getProjectId(): Promise<string> {
5758
if (this.projectId) {
5859
return Promise.resolve(this.projectId);
5960
}
60-
return utils.findProjectId(this.eventarc.app)
61+
return utils.findProjectId(this.app)
6162
.then((projectId) => {
6263
if (!validator.isNonEmptyString(projectId)) {
6364
throw new FirebaseEventarcError(
@@ -153,4 +154,4 @@ export class EventarcApiClient {
153154
const projectId = await this.getProjectId();
154155
return `projects/${projectId}/locations/${location}/channels/${channelId}`;
155156
}
156-
}
157+
}

src/eventarc/eventarc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class Channel {
146146
this.nameInternal = name;
147147
this.eventarcInternal = eventarc;
148148
this.allowedEventTypes = allowedEventTypes;
149-
this.client = new EventarcApiClient(eventarc, this);
149+
this.client = new EventarcApiClient(eventarc.app, this);
150150
}
151151

152152
/**

0 commit comments

Comments
 (0)