Skip to content

Commit

Permalink
Merge Public Preview launch branch into master (#7703)
Browse files Browse the repository at this point in the history
* update cli support for dataconnect toolkit and webhooks (#7635)

* update cli support for toolkit and webhooks

* update ports

* update ports

* Replace any with Options

* update exec to call webhook, format

* address comment

* address comment

* remove unused var

---------

Co-authored-by: joehan <joehanley@google.com>

* Emulator start refactor (#7638)

* update cli support for toolkit and webhooks

* update ports

* update ports

* Replace any with Options

* update exec to call webhook, format

* address comment

* address comment

* remove unused var

* vscode implementation of emulator start

* delete debug log

* address comments

---------

Co-authored-by: joehan <joehanley@google.com>

* DataConnect + PGLite prototype. (#7615)

* Hacking away at pglite+dataconnect emulator

* Hacking away at it

* More debugging

* I THINK IT WORKSSSSS

* Saving my progress at EoD

* --amend

* Progress

* clean up

* formatting

* Use extended query patch (thanks @gregnr!)

* Format and merge master

* PR fixes

* Remove JSON comments

* format

* Fxing test compilation issues

* Cleaning up build issues

* PR fixes

* Format and generate json schema

* Patching in missing types for VSCode builds

* More type fixing

* More type fixing

* Little bit mroe code review

* Removed unused dep

* More pr fixes

* test:emualtors build fixed

* PR fixes

* Fix port disagreement

* Fix webhook; Clean up emulator code (#7649)

* fix webhooks and cleanup old emulator code

* await sendVSCode completion

* Also handle extended query protocol for close messages (#7653)

* Better handling for invalid JSON variables (#7654)

* Adding a docs link to the sidebar (#7657)

* Clean up code-extension config (#7660)

* Clean up extension configuration

* pulls out messages into i10n/markdown-compatible source

* Simplify the config getter

* Remove errant firebase-path

* Add firebase-path option for vscode (#7662)

* Add firebase-path option for vscode

Allow folks to specify a specific firebase binary

* Update vscode port

* Improved messaging on deploy (#7661)

* Removing LocalConnectionString (#7652)

* cleaning up localconnectionstring

* LocalConnectionString is dead

* test fix

* Good catch

* Enable strict mode (#7663)

* Teardown legacy context provider

* Enable strict mode on the vscode webviews (#7665)

* add await (#7670)

* Rough pass on extension UI (#7668)

* Rough pass on extension UI

* Update docs UI

* Flex the panels to get full-width content

* [𝘀𝗽𝗿] initial version (#7676)

Created using spr 1.3.6-beta.1

* Round 1 of bug bash fixes (#7667)

* Round 1 of bug bash fixes

* Fixing build issue

* Fix package-lock.json

* Oops

* Use lsofi instead of rolling our own

* format

* Fixing lsofi issues (#7683)

* Reload codelens on emulator status change; Add loading state back for emulators start (#7692)

* Add handling for port conflicts. Add fallback for emulator loading state (#7682)

* Add handling for port conflicts. Add fallback for emulator loading state

* update equality

* address comments

* Set default state for sidebar. Update fallback for emulator start (#7694)

* Set default state for sidebar. Update fallback for emulator start

* address comments

* small text update

* change comment

* Re-fetch the extensions doc link when the app is initialized (#7695)

* Better handling for port conflicts and errors in Data Connect emulator (#7691)

* WIP - better error handlingport conflicts

* Void

* Update src/emulator/storage/rules/runtime.ts

Co-authored-by: Yuchen Shi <yuchenshi@google.com>

* Update src/emulator/downloadableEmulators.ts

Co-authored-by: Yuchen Shi <yuchenshi@google.com>

* Find open ports

---------

Co-authored-by: Yuchen Shi <yuchenshi@google.com>

* remove debug mode (#7697)

* Add UI polish for running emulator status (#7699)

* update emulator reset text (#7698)

* update emulator reset text

* update text

* update text (#7700)

* update webhook (#7702)

* startup -> start-up (#7701)

* Fix broken logout, and clean up anys (#7714)

* Fix invalid connector path in FDC example (#7709)

* Added dart to firebase CLI (#7569)

---------

Co-authored-by: joehan <joehanley@google.com>
Co-authored-by: TJ Lavelle <tlavelle@google.com>
Co-authored-by: TJ Lavelle <tj@lavelle.io>
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
Co-authored-by: Remi Rousselet <darky12s@gmail.com>
Co-authored-by: Maneesh Tewani <maneesht@users.noreply.github.com>
  • Loading branch information
7 people committed Sep 23, 2024
1 parent a5392f4 commit 3903c44
Show file tree
Hide file tree
Showing 120 changed files with 4,083 additions and 1,277 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ module.exports = {
// TODO(jamesdaniels): add this to overrides instead
ignorePatterns: [
"src/dynamicImport.js",
"src/emulator/dataconnect/pg-gateway",
"scripts/webframeworks-deploy-tests/nextjs/**",
"scripts/webframeworks-deploy-tests/angular/**",
"scripts/frameworks-tests/vite-project/**",
Expand Down
25 changes: 14 additions & 11 deletions firebase-vscode/common/messaging/broker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export type Receiver = {} | Webview;
export abstract class Broker<
OutgoingMessages extends MessageParamsMap,
IncomingMessages extends MessageParamsMap,
R extends Receiver
R extends Receiver,
> {
protected readonly listeners: MessageListeners<IncomingMessages> = {};

abstract sendMessage<T extends keyof OutgoingMessages>(
message: T,
data: OutgoingMessages[T]
data: OutgoingMessages[T],
): void;
registerReceiver(receiver: R): void {}

Expand Down Expand Up @@ -58,42 +58,45 @@ export abstract class Broker<
export interface BrokerImpl<
OutgoingMessages,
IncomingMessages,
R extends Receiver
R extends Receiver,
> {
send<E extends keyof OutgoingMessages>(
message: E,
args?: OutgoingMessages[E]
args?: OutgoingMessages[E],
): void;
registerReceiver(receiver: R): void;
on<E extends keyof IncomingMessages>(
message: Extract<E, string>,
listener: (params: IncomingMessages[E]) => void
listener: (params: IncomingMessages[E]) => void,
): () => void;
delete(): void;
}

export function createBroker<
OutgoingMessages extends MessageParamsMap,
IncomingMessages extends MessageParamsMap,
R extends Receiver
R extends Receiver,
>(
broker: Broker<OutgoingMessages, IncomingMessages, R>
broker: Broker<OutgoingMessages, IncomingMessages, R>,
): BrokerImpl<OutgoingMessages, IncomingMessages, Receiver> {
return {
send<E extends keyof OutgoingMessages>(
message: Extract<E, string>,
args?: OutgoingMessages[E]
args: OutgoingMessages[E],
): void {
broker.sendMessage(message, args);
broker.sendMessage<E>(message, args);
},
registerReceiver(receiver: R): void {
broker.registerReceiver(receiver);
},
on<E extends keyof IncomingMessages>(
message: Extract<E, string>,
listener: (params: IncomingMessages[E]) => void
listener: (params: IncomingMessages[E]) => void,
): () => void {
return broker.addListener(message, listener);
return broker.addListener(
message,
listener as Listener<IncomingMessages>,
);
},
delete(): void {
broker.delete();
Expand Down
37 changes: 17 additions & 20 deletions firebase-vscode/common/messaging/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@ import { FirebaseConfig } from "../../../src/firebaseConfig";
import { User } from "../../../src/types/auth";
import { ServiceAccountUser } from "../types";
import { RCData } from "../../../src/rc";
import { EmulatorUiSelections, RunningEmulatorInfo } from "./types";
import { EmulatorsStatus, RunningEmulatorInfo } from "./types";
import { ExecutionResult } from "graphql";
import { SerializedError } from "../error";

export const DEFAULT_EMULATOR_UI_SELECTIONS: EmulatorUiSelections = {
projectId: "demo-something",
importStateFolderPath: "",
exportStateOnExit: false,
mode: "dataconnect",
debugLogging: false,
};

export enum UserMockKind {
ADMIN = "admin",
UNAUTHENTICATED = "unauthenticated",
Expand All @@ -44,7 +36,6 @@ export interface WebviewToExtensionParamsMap {
/* Emulator panel requests */
getEmulatorUiSelections: void;
getEmulatorInfos: void;
updateEmulatorUiSelections: Partial<EmulatorUiSelections>;

/** Notify extension that current user has been changed in UI. */
requestChangeUser: { user: User | ServiceAccountUser };
Expand All @@ -60,6 +51,9 @@ export interface WebviewToExtensionParamsMap {
/** Calls the `firebase init` CLI */
runFirebaseInit: void;

/** Calls the `firebase init` CLI */
runStartEmulators: void;

/**
* Show a UI message using the vscode interface
*/
Expand Down Expand Up @@ -99,11 +93,16 @@ export interface WebviewToExtensionParamsMap {
/** Configures generated SDK */
"fdc.configure-sdk": void;

/** Opens generated docs */
"fdc.open-docs": void;

// Initialize "result" tab.
getDataConnectResults: void;

// execute terminal tasks
executeLogin: void;

getDocsLink: void;
}

export interface DataConnectResults {
Expand All @@ -119,16 +118,12 @@ export type ValueOrError<T> =

export interface ExtensionToWebviewParamsMap {
/** Triggered when the emulator UI/state changes */
notifyEmulatorUiSelectionsChanged: EmulatorUiSelections;
notifyEmulatorStateChanged: {
status: "running" | "stopped" | "starting" | "stopping";
infos: RunningEmulatorInfo | undefined;
status: EmulatorsStatus;
infos?: RunningEmulatorInfo | undefined;
};
notifyEmulatorImportFolder: { folder: string };

notifyIsConnectedToPostgres: boolean;

notifyPostgresStringChanged: string;
notifyEmulatorsHanging: boolean;

/** Triggered when new environment variables values are found. */
notifyEnv: { env: { isMonospace: boolean } };
Expand All @@ -142,15 +137,15 @@ export interface ExtensionToWebviewParamsMap {
/**
* This can potentially call multiple webviews to notify of user selection.
*/
notifyUserChanged: { user: User | ServiceAccountUser };
notifyUserChanged: { user: User | ServiceAccountUser | null };

/**
* Notify webview of initial discovery or change in firebase.json or
* .firebaserc
*/
notifyFirebaseConfig: {
firebaseJson: ValueOrError<FirebaseConfig> | undefined;
firebaseRC: ValueOrError<RCData> | undefined;
firebaseJson?: ValueOrError<FirebaseConfig | undefined>;
firebaseRC?: ValueOrError<RCData | undefined>;
};
/** Whether any dataconnect.yaml is present */
notifyHasFdcConfigs: boolean;
Expand All @@ -165,6 +160,8 @@ export interface ExtensionToWebviewParamsMap {
notifyDataConnectRequiredArgs: { args: string[] };

notifyIsLoadingUser: boolean;

notifyDocksLink: string;
}

export type MessageParamsMap =
Expand Down
11 changes: 2 additions & 9 deletions firebase-vscode/common/messaging/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { EmulatorInfo } from "../emulator/types";
import { ExtensionToWebviewParamsMap, MessageParamsMap } from "./protocol";

export interface Message<M> {
command: string;
Expand All @@ -16,14 +15,8 @@ export interface MessageListeners<M> {
* Info to display in the UI while the emulators are running
*/
export interface RunningEmulatorInfo {
uiUrl: string;
displayInfo: EmulatorInfo[];
}

export interface EmulatorUiSelections {
projectId: string;
firebaseJsonPath?: string;
importStateFolderPath?: string;
exportStateOnExit: boolean;
mode: "all" | "dataconnect";
debugLogging: boolean;
}
export type EmulatorsStatus = "running" | "stopped" | "starting" | "stopping";
88 changes: 10 additions & 78 deletions firebase-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3903c44

Please sign in to comment.