-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[VS Code] Fix the no project emulator experience #9072
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
Changes from 1 commit
eecb596
1a3dd24
cbd646c
e8565dc
ec21799
95ad006
e7b7a7e
8a33cf2
92a0df9
4622456
d28c59d
0d9552b
4299a0b
24cae69
82e0e67
764ed09
f796243
1bdb3dc
b887d00
2e45fa6
61abeb5
abb98ba
6ce63a9
31adc23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -305,27 +305,35 @@ export class ResolvedDataConnectConfig { | |||||
| export class ResolvedDataConnectConfigs { | ||||||
| constructor(readonly values: DeepReadOnly<ResolvedDataConnectConfig[]>) {} | ||||||
|
|
||||||
| get serviceIds() { | ||||||
| get serviceIds(): string[] { | ||||||
| return this.values.map((config) => config.value.serviceId); | ||||||
| } | ||||||
|
|
||||||
| get allConnectors() { | ||||||
| get allConnectors(): ResolvedConnectorYaml[] { | ||||||
| return this.values.flatMap((dc) => dc.resolvedConnectors); | ||||||
| } | ||||||
|
|
||||||
| findById(serviceId: string) { | ||||||
| return this.values.find((dc) => dc.value.serviceId === serviceId); | ||||||
| findById(serviceId: string): ResolvedDataConnectConfig { | ||||||
| const dc = this.values.find((dc) => dc.value.serviceId === serviceId); | ||||||
| if (!dc) { | ||||||
| throw new Error(`No dataconnect.yaml with serviceId ${serviceId}. Available: ${this.serviceIds.join(", ")}`); | ||||||
| } | ||||||
| return dc; | ||||||
| } | ||||||
|
|
||||||
| findEnclosingServiceForPath(filePath: string) { | ||||||
| return this.values.find((dc) => dc.containsPath(filePath)); | ||||||
| findEnclosingServiceForPath(filePath: string): ResolvedDataConnectConfig { | ||||||
| const dc = this.values.find((dc) => dc.containsPath(filePath)); | ||||||
| if (!dc) { | ||||||
| throw new Error(`No enclosing dataconnect.yaml found for path ${filePath}. Available Paths: ${this.values.map((dc) => dc.path).join(", ")}`); | ||||||
| } | ||||||
| return dc; | ||||||
| } | ||||||
|
|
||||||
| getApiServicePathByPath(projectId: string, path: string) { | ||||||
| getApiServicePathByPath(projectId: string | undefined, path: string): string { | ||||||
| const dataConnectConfig = this.findEnclosingServiceForPath(path); | ||||||
| const serviceId = dataConnectConfig?.value.serviceId; | ||||||
| const locationId = dataConnectConfig?.dataConnectLocation; | ||||||
| return `projects/${projectId}/locations/${locationId}/services/${serviceId}`; | ||||||
| return `projects/${projectId || "p"}/locations/${locationId}/services/${serviceId}`; | ||||||
|
||||||
| return `projects/${projectId || "p"}/locations/${locationId}/services/${serviceId}`; | |
| return `projects/${projectId || "demo-ignored"}/locations/${locationId}/services/${serviceId}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when .firebaserc is missing. project is undefined here.
Sure, I will use the no-project placeholder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add a comment that the Data Connect emulator ignores the project ID and will return the right response pretending that there's only one project
Uh oh!
There was an error while loading. Please reload this page.