Skip to content

Commit 250ef93

Browse files
committed
add toggleStatusBarUI and fix eventForwarder export
1 parent c4adef3 commit 250ef93

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
"types": "./dist/index.d.ts",
1010
"import": "./dist/index.js"
1111
},
12-
"./internal": {
12+
"./dist/internal": {
1313
"types": "./dist/internal.d.ts",
1414
"import": "./dist/internal.js"
15+
},
16+
"./dist/eventForwarder": {
17+
"types": "./dist/eventForwarder.d.ts",
18+
"import": "./dist/eventForwarder.js"
1519
}
1620
},
1721
"files": [

src/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,18 @@ export async function requestFileSave(options: RequestFileSaveOptions): Promise<
233233
return await request({ name: "requestFileSave", args: options });
234234
}
235235

236+
export async function showStatusBarUI(): Promise<void> {
237+
return await request({ name: "toggleStatusBarUI", args: { force: true } });
238+
}
239+
240+
export async function hideStatusBarUI(): Promise<void> {
241+
return await request({ name: "toggleStatusBarUI", args: { force: false } });
242+
}
243+
244+
export async function toggleStatusBarUI(): Promise<void> {
245+
return await request({ name: "toggleStatusBarUI", args: void 0 });
246+
}
247+
236248
/** @since Beekeeper Studio 5.4.0 */
237249
export const broadcast = {
238250
post<T extends JsonValue = JsonValue>(message: T): void {

src/internal.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ export type RequestMap = {
140140
args: RequestFileSaveOptions;
141141
return: void;
142142
};
143+
toggleStatusBarUI: {
144+
args: { force?: boolean };
145+
return: void;
146+
};
143147
"clipboard.writeText": {
144148
args: {
145149
text: string;
@@ -158,16 +162,21 @@ export type RequestMap = {
158162
};
159163
};
160164

161-
export type RequestPayload<T extends keyof RequestMap = keyof RequestMap> = {
162-
id: string;
163-
name: T;
164-
} & Pick<RequestMap[T], "args">;
165+
export type RequestPayload = {
166+
[K in keyof RequestMap]: {
167+
id: string;
168+
name: K;
169+
args: RequestMap[K]["args"];
170+
};
171+
}[keyof RequestMap];
165172

166-
export type ResponsePayload<T extends keyof RequestMap = keyof RequestMap> = {
167-
id: string;
168-
result: RequestMap[T]["return"];
169-
error?: unknown;
170-
};
173+
export type ResponsePayload = {
174+
[K in keyof RequestMap]: {
175+
id: string;
176+
result: RequestMap[K]["return"];
177+
error?: unknown;
178+
};
179+
}[keyof RequestMap];
171180

172181
export type NotificationMap = {
173182
tablesChanged: {

0 commit comments

Comments
 (0)