@beekeeperstudio/plugin 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -19,9 +19,38 @@ interface TableKey {
19
19
  onUpdate?: string;
20
20
  onDelete?: string;
21
21
  }
22
+ type IndexColumn = {
23
+ name: string;
24
+ order?: 'ASC' | 'DESC' | '2d' | '2dsphere' | 'text' | 'geoHaystack' | 'hashed' | number;
25
+ /** MySQL Only */
26
+ prefix?: number | null;
27
+ };
28
+ type PrimaryKey = {
29
+ columnName: string;
30
+ position: number;
31
+ };
32
+ type TableIndex = {
33
+ id: string;
34
+ table: string;
35
+ schema: string;
36
+ name: string;
37
+ columns: IndexColumn[];
38
+ unique: boolean;
39
+ primary: boolean;
40
+ /** for postgres 15 and above https://www.postgresql.org/about/featurematrix/detail/392/ */
41
+ nullsNotDistinct?: boolean;
42
+ };
43
+ type Table = {
44
+ name: string;
45
+ schema?: string;
46
+ };
47
+ type Column = {
48
+ name: string;
49
+ type: string;
50
+ };
22
51
  type WindowEventClass = "MouseEvent" | "KeyboardEvent" | "PointerEvent" | "Event";
23
52
  type WindowEventInits = MouseEventInit | KeyboardEventInit | PointerEventInit;
24
- type TableFilter$1 = {
53
+ type TableFilter = {
25
54
  field: string;
26
55
  type: "=" | "!=" | "like" | "not like" | "<" | "<=" | ">" | ">=" | "in" | "is" | "is not";
27
56
  value?: string | string[];
@@ -80,333 +109,270 @@ type PluginViewContext = {
80
109
  command: string;
81
110
  params?: CellMenuParams | ColumnMenuParams | RowMenuParams | CornerMenuParams;
82
111
  };
112
+ type DatabaseType = 'postgresql' | 'mysql' | 'mariadb' | 'sqlite' | 'sqlserver' | 'oracle' | 'mongodb' | 'cassandra' | 'clickhouse' | 'firebird' | 'bigquery' | 'redshift' | 'duckdb' | 'libsql' | 'redis' | 'surrealdb' | 'trino';
113
+ type ConnectionInfo = {
114
+ /** @alias databaseType */
115
+ connectionType: string;
116
+ /** The ID of the connection */
117
+ id: number;
118
+ /** The name of the connection specified in the connection form */
119
+ workspaceId: number;
120
+ /** The name of the connection specified in the connection form */
121
+ connectionName: string;
122
+ databaseType: DatabaseType;
123
+ /** The name of the database connected to */
124
+ databaseName: string;
125
+ defaultSchema?: string;
126
+ readOnlyMode: boolean;
127
+ };
128
+ type AppInfo = {
129
+ version: string;
130
+ theme: AppTheme;
131
+ };
132
+ type AppTheme = {
133
+ palette: Record<string, string>;
134
+ cssString: string;
135
+ type: ThemeType;
136
+ };
137
+ type RunQueryResult = {
138
+ results: QueryResult[];
139
+ error?: unknown;
140
+ };
141
+ type OpenQueryTabOptions = {
142
+ query?: string;
143
+ };
144
+ type OpenTableTableTabOptions = {
145
+ table: string;
146
+ schema?: string;
147
+ filters?: TableFilter[];
148
+ database?: string;
149
+ };
150
+ type OpenTableStructureTabOptions = {
151
+ table: string;
152
+ schema?: string;
153
+ database?: string;
154
+ };
155
+ type RequestFileSaveOptions = {
156
+ data: string;
157
+ fileName: string;
158
+ /** @default "utf8" */
159
+ encoding?: "utf8" | "base64";
160
+ filters?: {
161
+ name: string;
162
+ extensions: string[];
163
+ }[];
164
+ };
165
+ type PluginErrorObject = {
166
+ name?: string;
167
+ message: string;
168
+ stack?: string;
169
+ };
170
+ type WindowEventObject = {
171
+ eventType: string;
172
+ eventClass: WindowEventClass;
173
+ eventInitOptions: WindowEventInits;
174
+ };
83
175
 
84
- interface BaseRequest {
85
- id: string;
86
- }
87
- interface GetTablesRequest extends BaseRequest {
88
- name: "getTables";
89
- args: {
90
- schema?: string;
176
+ type RequestMap = {
177
+ getSchemas: {
178
+ args: void;
179
+ return: string[];
91
180
  };
92
- }
93
- interface GetColumnsRequest extends BaseRequest {
94
- name: "getColumns";
95
- args: {
96
- table: string;
97
- schema?: string;
181
+ getTables: {
182
+ args: {
183
+ schema?: string;
184
+ };
185
+ return: Table[];
98
186
  };
99
- }
100
- type GetTableKeysRequest = BaseRequest & {
101
- name: "getTableKeys";
102
- args: {
103
- table: string;
104
- schema?: string;
187
+ getColumns: {
188
+ args: {
189
+ table: string;
190
+ schema?: string;
191
+ };
192
+ return: Column[];
105
193
  };
106
- };
107
- type GetAppInfoRequest = BaseRequest & {
108
- name: "getAppInfo";
109
- args: void;
110
- };
111
- interface GetConnectionInfoRequest extends BaseRequest {
112
- name: "getConnectionInfo";
113
- args: void;
114
- }
115
- interface RunQueryRequest extends BaseRequest {
116
- name: "runQuery";
117
- args: {
118
- query: string;
194
+ getTableKeys: {
195
+ args: {
196
+ table: string;
197
+ schema?: string;
198
+ };
199
+ return: TableKey[];
119
200
  };
120
- }
121
- interface ExpandTableResultRequest extends BaseRequest {
122
- name: "expandTableResult";
123
- args: {
124
- results: QueryResult[];
201
+ getPrimaryKeys: {
202
+ args: {
203
+ table: string;
204
+ schema?: string;
205
+ };
206
+ return: PrimaryKey[];
125
207
  };
126
- }
127
- interface SetTabTitleRequest extends BaseRequest {
128
- name: "setTabTitle";
129
- args: {
130
- title: string;
208
+ getTableIndexes: {
209
+ args: {
210
+ table: string;
211
+ schema?: string;
212
+ };
213
+ return: TableIndex[];
131
214
  };
132
- }
133
- type GetViewContextRequest = BaseRequest & {
134
- name: "getViewContext";
135
- args: void;
136
- };
137
- interface GetViewStateRequest extends BaseRequest {
138
- name: "getViewState";
139
- args: void;
140
- }
141
- interface SetViewStateRequest<T extends unknown> extends BaseRequest {
142
- name: "setViewState";
143
- args: {
144
- state: T;
215
+ getIncomingKeys: {
216
+ args: {
217
+ table: string;
218
+ schema?: string;
219
+ };
220
+ return: TableKey[];
145
221
  };
146
- }
147
- interface OpenExternalRequest extends BaseRequest {
148
- name: "openExternal";
149
- args: {
150
- link: string;
222
+ getOutgoingKeys: {
223
+ args: {
224
+ table: string;
225
+ schema?: string;
226
+ };
227
+ return: TableKey[];
151
228
  };
152
- }
153
- interface SetDataRequest<T extends unknown> extends BaseRequest {
154
- name: "setData";
155
- args: {
156
- key: string;
157
- value: T;
229
+ getConnectionInfo: {
230
+ args: void;
231
+ return: ConnectionInfo;
158
232
  };
159
- }
160
- interface GetDataRequest extends BaseRequest {
161
- name: "getData";
162
- args: {
163
- key: string;
233
+ getAppInfo: {
234
+ args: void;
235
+ return: AppInfo;
164
236
  };
165
- }
166
- interface GetEncryptedDataRequest extends BaseRequest {
167
- name: "getEncryptedData";
168
- args: {
169
- key: string;
237
+ checkForUpdate: {
238
+ args: void;
239
+ return: boolean;
170
240
  };
171
- }
172
- interface SetEncryptedDataRequest<T extends unknown> extends BaseRequest {
173
- name: "setEncryptedData";
174
- args: {
175
- key: string;
176
- value: T;
241
+ runQuery: {
242
+ args: {
243
+ query: string;
244
+ };
245
+ return: RunQueryResult;
177
246
  };
178
- }
179
- interface ClipboardWriteTextRequest extends BaseRequest {
180
- name: "clipboard.writeText";
181
- args: {
182
- text: string;
247
+ expandTableResult: {
248
+ args: {
249
+ results: QueryResult[];
250
+ };
251
+ return: void;
183
252
  };
184
- }
185
- interface ClipboardReadTextRequest extends BaseRequest {
186
- name: "clipboard.readText";
187
- args: void;
188
- }
189
- type OpenQueryTabRequest = BaseRequest & {
190
- name: "openTab";
191
- args: {
192
- type: "query";
193
- query?: string;
253
+ setTabTitle: {
254
+ args: {
255
+ title: string;
256
+ };
257
+ return: void;
194
258
  };
195
- };
196
- type OpenTableTableTabRequest = BaseRequest & {
197
- name: "openTab";
198
- args: {
199
- type: "tableTable";
200
- table: string;
201
- schema?: string;
202
- filters?: TableFilter$1[];
203
- database?: string;
259
+ getViewContext: {
260
+ args: void;
261
+ return: any;
204
262
  };
205
- };
206
- type OpenTableStructureTabRequest = BaseRequest & {
207
- name: "openTab";
208
- args: {
209
- type: "tableStructure";
210
- table: string;
211
- schema?: string;
212
- database?: string;
263
+ getViewState: {
264
+ args: void;
265
+ return: any;
213
266
  };
214
- };
215
- type CheckForUpdateRequest = BaseRequest & {
216
- name: "checkForUpdate";
217
- args: void;
218
- };
219
- type OpenTabRequest = OpenQueryTabRequest | OpenTableTableTabRequest | OpenTableStructureTabRequest;
220
- type PluginRequestData = GetTablesRequest | GetColumnsRequest | GetTableKeysRequest | GetAppInfoRequest | GetConnectionInfoRequest | RunQueryRequest | ExpandTableResultRequest | SetTabTitleRequest | GetViewContextRequest | GetViewStateRequest | SetViewStateRequest<unknown> | OpenExternalRequest | GetDataRequest | SetDataRequest<unknown> | GetEncryptedDataRequest | SetEncryptedDataRequest<unknown> | ClipboardWriteTextRequest | ClipboardReadTextRequest | OpenTabRequest | CheckForUpdateRequest;
221
- type PluginRequestPayload = PluginRequestData;
222
-
223
- type AppTheme = {
224
- palette: Record<string, string>;
225
- cssString: string;
226
- type: ThemeType;
227
- };
228
- type ThemeChangedNotification = {
229
- name: "themeChanged";
230
- args: AppTheme;
231
- };
232
- type WindowEventNotification = {
233
- name: "windowEvent";
234
- args: {
235
- eventType: string;
236
- eventClass: WindowEventClass;
237
- eventInitOptions: WindowEventInits;
267
+ setViewState: {
268
+ args: {
269
+ state: any;
270
+ };
271
+ return: void;
238
272
  };
239
- };
240
- type PluginErrorNotification = {
241
- name: "pluginError";
242
- args: {
243
- name?: string;
244
- message?: string;
245
- stack?: string;
273
+ openExternal: {
274
+ args: {
275
+ link: string;
276
+ };
277
+ return: void;
246
278
  };
247
- };
248
- type BroadcastNotification<Message extends JsonValue = JsonValue> = {
249
- name: "broadcast";
250
- args: {
251
- message: Message;
279
+ getData: {
280
+ args: {
281
+ key: string;
282
+ };
283
+ return: any;
252
284
  };
253
- };
254
- type PluginNotificationData = ThemeChangedNotification | WindowEventNotification | PluginErrorNotification | BroadcastNotification;
255
-
256
- type TabType = string;
257
- type TableFilter = any;
258
- type TableOrView = any;
259
- interface BaseResponse {
260
- id: string;
261
- error?: Error;
262
- }
263
- interface GetTablesResponse extends BaseResponse {
264
- result: {
265
- name: string;
266
- schema?: string;
267
- }[];
268
- }
269
- interface GetColumnsResponse extends BaseResponse {
270
- result: {
271
- name: string;
272
- type: string;
273
- }[];
274
- }
275
- type GetTableKeysResponse = BaseResponse & {
276
- result: TableKey[];
277
- };
278
- interface GetConnectionInfoResponse extends BaseResponse {
279
- result: {
280
- /** @deprecated Use `databaseType` instead */
281
- connectionType: string;
282
- /** The ID of the connection */
283
- id: number;
284
- /** The name of the connection specified in the connection form */
285
- workspaceId: number;
286
- /** The name of the connection specified in the connection form */
287
- connectionName: string;
288
- databaseType: 'postgresql' | 'mysql' | 'mariadb' | 'sqlite' | 'sqlserver' | 'oracle' | 'mongodb' | 'cassandra' | 'clickhouse' | 'firebird' | 'bigquery' | 'redshift' | 'duckdb' | 'libsql' | 'redis' | 'surrealdb' | 'trino';
289
- /** The name of the database connected to */
290
- databaseName: string;
291
- defaultSchema?: string;
292
- readOnlyMode: boolean;
285
+ setData: {
286
+ args: {
287
+ key: string;
288
+ value: any;
289
+ };
290
+ return: void;
293
291
  };
294
- }
295
- type GetAppInfoResponse = BaseResponse & {
296
- result: {
297
- version: string;
298
- theme: AppTheme;
292
+ getEncryptedData: {
293
+ args: {
294
+ key: string;
295
+ };
296
+ return: any;
299
297
  };
300
- };
301
- interface RunQueryResponse extends BaseResponse {
302
- result: {
303
- results: QueryResult[];
304
- error?: unknown;
298
+ setEncryptedData: {
299
+ args: {
300
+ key: string;
301
+ value: any;
302
+ };
303
+ return: void;
305
304
  };
306
- }
307
- interface ExpandTableResultResponse extends BaseResponse {
308
- result: void;
309
- }
310
- interface SetTabTitleResponse extends BaseResponse {
311
- result: void;
312
- }
313
- type GetViewContextResponse = BaseResponse & {
314
- result: PluginViewContext;
315
- };
316
- interface GetViewStateResponse<T extends unknown> extends BaseResponse {
317
- result: T;
318
- }
319
- interface SetViewStateResponse extends BaseResponse {
320
- result: void;
321
- }
322
- interface OpenExternalResponse extends BaseResponse {
323
- result: void;
324
- }
325
- interface GetDataResponse<T extends unknown> extends BaseResponse {
326
- result: T;
327
- }
328
- interface SetDataResponse extends BaseResponse {
329
- result: void;
330
- }
331
- interface GetEncryptedDataResponse<T extends unknown> extends BaseResponse {
332
- result: T;
333
- }
334
- interface SetEncryptedDataResponse extends BaseResponse {
335
- result: void;
336
- }
337
- interface ClipboardWriteTextResponse extends BaseResponse {
338
- result: void;
339
- }
340
- interface ClipboardReadTextResponse extends BaseResponse {
341
- result: string;
342
- }
343
- interface OpenTabResponse extends BaseResponse {
344
- result: void;
345
- }
346
- interface CheckForUpdateResponse extends BaseResponse {
347
- result: boolean;
348
- }
349
- type PluginResponseData = GetTablesResponse | GetColumnsResponse | GetTableKeysResponse | GetConnectionInfoResponse | RunQueryResponse | ExpandTableResultResponse | SetTabTitleResponse | GetViewContextResponse | GetViewStateResponse<unknown> | SetViewStateResponse | OpenExternalResponse | GetDataResponse<unknown> | SetDataResponse | GetEncryptedDataResponse<unknown> | SetEncryptedDataResponse | ClipboardWriteTextResponse | ClipboardReadTextResponse | OpenTabResponse | CheckForUpdateResponse;
350
- type PluginResponsePayload = PluginResponseData;
351
- type TabResponse = BaseTabResponse | QueryTabResponse | TableTabResponse;
352
- interface BaseTabResponse {
353
- type: TabType;
354
- id: number;
355
- title: string;
356
- }
357
- interface QueryTabResponse extends BaseTabResponse {
358
- type: "query";
359
- data: {
360
- query: string;
361
- result: unknown;
305
+ openTab: {
306
+ args: ({
307
+ type: "query";
308
+ } & OpenQueryTabOptions) | ({
309
+ type: "tableTable";
310
+ } & OpenTableTableTabOptions) | ({
311
+ type: "tableStructure";
312
+ } & OpenTableStructureTabOptions);
313
+ return: void;
362
314
  };
363
- }
364
- interface TableTabResponse extends BaseTabResponse {
365
- type: "table";
366
- data: {
367
- table: TableOrView;
368
- filters: TableFilter[] | string;
369
- result: unknown;
315
+ requestFileSave: {
316
+ args: RequestFileSaveOptions;
317
+ return: void;
370
318
  };
371
- }
372
-
373
- declare global {
374
- interface ImportMeta {
375
- env: {
376
- MODE: string;
319
+ toggleStatusBarUI: {
320
+ args: {
321
+ force?: boolean;
377
322
  };
378
- }
379
- }
380
- declare function setDebugComms(enabled: boolean): void;
381
- declare function request(raw: any): Promise<any>;
382
- declare function notify<Message extends JsonValue = JsonValue>(name: BroadcastNotification["name"], args: BroadcastNotification<Message>["args"]): void;
383
- declare function notify(name: PluginErrorNotification["name"], args: PluginErrorNotification["args"]): void;
384
- declare function notify(name: WindowEventNotification["name"], args: WindowEventNotification["args"]): void;
385
- declare function addNotificationListener<Message extends JsonValue = JsonValue>(name: BroadcastNotification["name"], handler: (args: BroadcastNotification<Message>["args"]) => void): void;
386
- declare function addNotificationListener(name: ThemeChangedNotification["name"], handler: (args: ThemeChangedNotification["args"]) => void): void;
387
- declare function removeNotificationListener(name: string, handler: (args: any) => void): void;
323
+ return: void;
324
+ };
325
+ "clipboard.writeText": {
326
+ args: {
327
+ text: string;
328
+ };
329
+ return: void;
330
+ };
331
+ "clipboard.writeImage": {
332
+ args: {
333
+ data: string;
334
+ };
335
+ return: void;
336
+ };
337
+ "clipboard.readText": {
338
+ args: void;
339
+ return: string;
340
+ };
341
+ };
388
342
 
343
+ /**
344
+ * Get a list of schemas from the current database.
345
+ *
346
+ * @since Beekeeper Studio 5.5.0
347
+ **/
348
+ declare function getSchemas(): Promise<string[]>;
389
349
  /**
390
350
  * Get a list of tables from the current database.
351
+ *
391
352
  * @since Beekeeper Studio 5.3.0
392
353
  **/
393
- declare function getTables(schema?: string): Promise<GetTablesResponse['result']>;
354
+ declare function getTables(schema?: string): Promise<Table[]>;
394
355
  /**
395
356
  * Get a list of columns from a table.
396
357
  *
397
358
  * @since Beekeeper Studio 5.3.0
398
359
  **/
399
- declare function getColumns(table: string, schema?: string): Promise<GetColumnsResponse['result']>;
360
+ declare function getColumns(table: string, schema?: string): Promise<Column[]>;
400
361
  /** @since Beekeeper Studio 5.4.0 */
401
- declare function getTableKeys(table: string, schema?: string): Promise<GetTableKeysResponse['result']>;
362
+ declare function getTableKeys(table: string, schema?: string): Promise<TableKey[]>;
363
+ /** @since Beekeeper Studio 5.5.0 */
364
+ declare function getTableIndexes(table: string, schema?: string): Promise<TableIndex[]>;
365
+ declare function getPrimaryKeys(table: string, schema?: string): Promise<PrimaryKey[]>;
366
+ declare function getIncomingKeys(table: string, schema?: string): Promise<TableKey[]>;
367
+ declare function getOutgoingKeys(table: string, schema?: string): Promise<TableKey[]>;
402
368
  /**
403
369
  * Get information about the current database connection.
404
370
  *
405
371
  * @since Beekeeper Studio 5.3.0
406
372
  **/
407
- declare function getConnectionInfo(): Promise<GetConnectionInfoResponse['result']>;
373
+ declare function getConnectionInfo(): Promise<ConnectionInfo>;
408
374
  /** @since Beekeeper Studio 5.4.0 */
409
- declare function getAppInfo(): Promise<GetAppInfoResponse['result']>;
375
+ declare function getAppInfo(): Promise<AppInfo>;
410
376
  /**
411
377
  * Get the version of Beekeeper Studio
412
378
  * @since Beekeeper Studio 5.3.0
@@ -419,7 +385,7 @@ declare function getAppVersion(): Promise<"5.3" | (string & {
419
385
  *
420
386
  * @since Beekeeper Studio 5.4.0
421
387
  **/
422
- declare function checkForUpdate(): Promise<CheckForUpdateResponse['result']>;
388
+ declare function checkForUpdate(): Promise<boolean>;
423
389
  /**
424
390
  * Execute a SQL query against the current database.
425
391
  *
@@ -429,19 +395,19 @@ declare function checkForUpdate(): Promise<CheckForUpdateResponse['result']>;
429
395
  *
430
396
  * @since Beekeeper Studio 5.3.0
431
397
  **/
432
- declare function runQuery(query: string): Promise<RunQueryResponse['result']>;
398
+ declare function runQuery(query: string): Promise<RunQueryResult>;
433
399
  /**
434
400
  * Display query results in the bottom table panel (shell-type tabs only).
435
401
  *
436
402
  * @since Beekeeper Studio 5.3.0
437
403
  **/
438
- declare function expandTableResult(results: any[]): Promise<ExpandTableResultResponse['result']>;
404
+ declare function expandTableResult(results: QueryResult[]): Promise<void>;
439
405
  /**
440
406
  * Set the title of the current plugin tab.
441
407
  *
442
408
  * @since Beekeeper Studio 5.3.0
443
409
  **/
444
- declare function setTabTitle(title: string): Promise<SetTabTitleResponse['result']>;
410
+ declare function setTabTitle(title: string): Promise<void>;
445
411
  /**
446
412
  * Get the current view context.
447
413
  *
@@ -452,25 +418,25 @@ declare function setTabTitle(title: string): Promise<SetTabTitleResponse['result
452
418
  *
453
419
  * @since Beekeeper Studio 5.4.0
454
420
  **/
455
- declare function getViewContext(): Promise<GetViewContextResponse['result']>;
421
+ declare function getViewContext(): Promise<PluginViewContext>;
456
422
  /**
457
423
  * Get the current state of your view instance.
458
424
  *
459
425
  * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}
460
426
  * @since Beekeeper Studio 5.3.0
461
427
  **/
462
- declare function getViewState<T>(): Promise<GetViewStateResponse<T>['result']>;
428
+ declare function getViewState<T = unknown>(): Promise<T>;
463
429
  /**
464
430
  * Set the state of your view instance.
465
431
  *
466
432
  * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}
467
433
  * @since Beekeeper Studio 5.3.0
468
434
  **/
469
- declare function setViewState<T>(state: T): Promise<SetViewStateResponse['result']>;
435
+ declare function setViewState<T = unknown>(state: T): Promise<void>;
470
436
  /** @since Beekeeper Studio 5.3.0 */
471
- declare function openExternal(link: string): Promise<OpenExternalResponse['result']>;
437
+ declare function openExternal(link: string): Promise<void>;
472
438
  /** @since Beekeeper Studio 5.3.0 */
473
- declare function getData<T>(key?: string): Promise<GetDataResponse<T>['result']>;
439
+ declare function getData<T = unknown>(key?: string): Promise<T>;
474
440
  /**
475
441
  * Store data that can be retrieved later.
476
442
  *
@@ -483,10 +449,10 @@ declare function getData<T>(key?: string): Promise<GetDataResponse<T>['result']>
483
449
  *
484
450
  * @since Beekeeper Studio 5.3.0
485
451
  */
486
- declare function setData<T>(key: string, value: T): Promise<SetDataResponse['result']>;
487
- declare function setData<T>(value: T): Promise<SetDataResponse['result']>;
452
+ declare function setData<T = unknown>(key: string, value: T): Promise<void>;
453
+ declare function setData<T = unknown>(value: T): Promise<void>;
488
454
  /** @since Beekeeper Studio 5.3.0 */
489
- declare function getEncryptedData<T>(key: string): Promise<GetEncryptedDataResponse<T>['result']>;
455
+ declare function getEncryptedData<T>(key: string): Promise<T>;
490
456
  /**
491
457
  * Store encrypted data that can be retrieved later.
492
458
  *
@@ -499,12 +465,16 @@ declare function getEncryptedData<T>(key: string): Promise<GetEncryptedDataRespo
499
465
  *
500
466
  * @since Beekeeper Studio 5.3.0
501
467
  */
502
- declare function setEncryptedData<T>(key: string, value: T): Promise<SetEncryptedDataResponse['result']>;
503
- declare function setEncryptedData<T>(value: T): Promise<SetEncryptedDataResponse['result']>;
468
+ declare function setEncryptedData<T = unknown>(key: string, value: T): Promise<void>;
469
+ declare function setEncryptedData<T = unknown>(value: T): Promise<void>;
504
470
  /** @since Beekeeper Studio 5.4.0 */
505
- declare function openTab(type: "query", args?: Omit<OpenQueryTabRequest['args'], 'type'>): Promise<OpenTabResponse>;
506
- declare function openTab(type: "tableTable", args: Omit<OpenTableTableTabRequest['args'], 'type'>): Promise<OpenTabResponse>;
507
- declare function openTab(type: "tableStructure", args: Omit<OpenTableStructureTabRequest['args'], 'type'>): Promise<OpenTabResponse>;
471
+ declare function openTab(type: "query", options?: OpenQueryTabOptions): Promise<void>;
472
+ declare function openTab(type: "tableTable", options: OpenTableTableTabOptions): Promise<void>;
473
+ declare function openTab(type: "tableStructure", options: OpenTableStructureTabOptions): Promise<void>;
474
+ declare function requestFileSave(options: RequestFileSaveOptions): Promise<void>;
475
+ declare function showStatusBarUI(): Promise<void>;
476
+ declare function hideStatusBarUI(): Promise<void>;
477
+ declare function toggleStatusBarUI(): Promise<void>;
508
478
  /** @since Beekeeper Studio 5.4.0 */
509
479
  declare const broadcast: {
510
480
  post<T extends JsonValue = JsonValue>(message: T): void;
@@ -514,17 +484,36 @@ declare const broadcast: {
514
484
  declare const log: {
515
485
  error(err: string | Error): void;
516
486
  };
517
- /**
518
- * Clipboard interface.
519
- *
520
- * @since Beekeeper Studio 5.3.0
521
- **/
487
+ /** Clipboard interface. */
522
488
  declare const clipboard: {
523
- /** Write text to the Electron clipboard. */
489
+ /** Write text to the Electron clipboard.
490
+ * @since Beekeeper Studio 5.3.0 */
524
491
  writeText(text: string): Promise<void>;
525
- /** Read text from the Electron clipboard. */
492
+ /** Read text from the Electron clipboard.
493
+ * @since Beekeeper Studio 5.3.0 */
526
494
  readText(): Promise<string>;
495
+ /** @param data - Base64 encoded image data.
496
+ * @since Beekeeper Studio 5.5.0 */
497
+ writeImage(data: string): Promise<void>;
527
498
  };
499
+ declare function setDebugComms(enabled: boolean): void;
500
+ declare function notify<Message extends JsonValue = JsonValue>(name: "broadcast", args: {
501
+ message: Message;
502
+ }): void;
503
+ declare function notify(name: "pluginError", args: PluginErrorObject): void;
504
+ declare function notify(name: "windowEvent", args: WindowEventObject): void;
505
+ declare function addNotificationListener(name: "tablesChanged", handler: () => void): void;
506
+ declare function addNotificationListener<Message extends JsonValue = JsonValue>(name: "broadcast", handler: (args: {
507
+ message: Message;
508
+ }) => void): void;
509
+ declare function addNotificationListener(name: "themeChanged", handler: (args: AppTheme) => void): void;
510
+ declare function removeNotificationListener(name: "tablesChanged", handler: (args: any) => void): void;
511
+ declare function removeNotificationListener<Message extends JsonValue = JsonValue>(name: "broadcast", handler: (args: any) => void): void;
512
+ declare function removeNotificationListener(name: "themeChanged", handler: (args: any) => void): void;
513
+ declare function request<T extends keyof RequestMap>(raw: {
514
+ name: T;
515
+ args: RequestMap[T]["args"];
516
+ }): Promise<RequestMap[T]["return"]>;
528
517
 
529
- export { addNotificationListener, broadcast, checkForUpdate, clipboard, expandTableResult, getAppInfo, getAppVersion, getColumns, getConnectionInfo, getData, getEncryptedData, getTableKeys, getTables, getViewContext, getViewState, log, notify, openExternal, openTab, removeNotificationListener, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
530
- export type { ActiveRange, AppTheme, BroadcastNotification, CellMenuParams, CellMenuTarget, CheckForUpdateRequest, CheckForUpdateResponse, ClipboardReadTextRequest, ClipboardReadTextResponse, ClipboardWriteTextRequest, ClipboardWriteTextResponse, ColumnMenuParams, ColumnMenuTarget, CornerMenuParams, CornerMenuTarget, ExpandTableResultRequest, ExpandTableResultResponse, GetAppInfoRequest, GetAppInfoResponse, GetColumnsRequest, GetColumnsResponse, GetConnectionInfoRequest, GetConnectionInfoResponse, GetDataRequest, GetDataResponse, GetEncryptedDataRequest, GetEncryptedDataResponse, GetTableKeysRequest, GetTableKeysResponse, GetTablesRequest, GetTablesResponse, GetViewContextRequest, GetViewContextResponse, GetViewStateRequest, GetViewStateResponse, JsonValue, LoadViewParams, OpenExternalRequest, OpenExternalResponse, OpenQueryTabRequest, OpenTabRequest, OpenTabResponse, OpenTableStructureTabRequest, OpenTableTableTabRequest, PluginErrorNotification, PluginNotificationData, PluginRequestData, PluginRequestPayload, PluginResponseData, PluginResponsePayload, PluginViewContext, QueryResult, RowMenuParams, RowMenuTarget, RunQueryRequest, RunQueryResponse, SetDataRequest, SetDataResponse, SetEncryptedDataRequest, SetEncryptedDataResponse, SetTabTitleRequest, SetTabTitleResponse, SetViewStateRequest, SetViewStateResponse, TabResponse, TableFilter$1 as TableFilter, TableKey, ThemeChangedNotification, ThemeType, WindowEventClass, WindowEventInits, WindowEventNotification };
518
+ export { addNotificationListener, broadcast, checkForUpdate, clipboard, expandTableResult, getAppInfo, getAppVersion, getColumns, getConnectionInfo, getData, getEncryptedData, getIncomingKeys, getOutgoingKeys, getPrimaryKeys, getSchemas, getTableIndexes, getTableKeys, getTables, getViewContext, getViewState, hideStatusBarUI, log, notify, openExternal, openTab, removeNotificationListener, request, requestFileSave, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState, showStatusBarUI, toggleStatusBarUI };
519
+ export type { ActiveRange, AppInfo, AppTheme, CellMenuParams, CellMenuTarget, Column, ColumnMenuParams, ColumnMenuTarget, ConnectionInfo, CornerMenuParams, CornerMenuTarget, DatabaseType, IndexColumn, JsonValue, LoadViewParams, OpenQueryTabOptions, OpenTableStructureTabOptions, OpenTableTableTabOptions, PluginErrorObject, PluginViewContext, PrimaryKey, QueryResult, RequestFileSaveOptions, RowMenuParams, RowMenuTarget, RunQueryResult, Table, TableFilter, TableIndex, TableKey, ThemeType, WindowEventClass, WindowEventInits, WindowEventObject };