@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.
@@ -0,0 +1,326 @@
1
+ type ThemeType = "dark" | "light";
2
+ interface QueryResult {
3
+ fields: {
4
+ id: string;
5
+ name: string;
6
+ dataType?: string;
7
+ }[];
8
+ rows: Record<string, unknown>[];
9
+ }
10
+ interface TableKey {
11
+ isComposite: boolean;
12
+ toTable: string;
13
+ toSchema: string;
14
+ toColumn: string | string[];
15
+ fromTable: string;
16
+ fromSchema: string;
17
+ fromColumn: string | string[];
18
+ constraintName?: string;
19
+ onUpdate?: string;
20
+ onDelete?: string;
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
+ };
51
+ type WindowEventClass = "MouseEvent" | "KeyboardEvent" | "PointerEvent" | "Event";
52
+ type WindowEventInits = MouseEventInit | KeyboardEventInit | PointerEventInit;
53
+ type TableFilter = {
54
+ field: string;
55
+ type: "=" | "!=" | "like" | "not like" | "<" | "<=" | ">" | ">=" | "in" | "is" | "is not";
56
+ value?: string | string[];
57
+ op?: "AND" | "OR";
58
+ };
59
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
60
+ [key: string]: JsonValue;
61
+ };
62
+ type DatabaseType = 'postgresql' | 'mysql' | 'mariadb' | 'sqlite' | 'sqlserver' | 'oracle' | 'mongodb' | 'cassandra' | 'clickhouse' | 'firebird' | 'bigquery' | 'redshift' | 'duckdb' | 'libsql' | 'redis' | 'surrealdb' | 'trino';
63
+ type ConnectionInfo = {
64
+ /** @alias databaseType */
65
+ connectionType: string;
66
+ /** The ID of the connection */
67
+ id: number;
68
+ /** The name of the connection specified in the connection form */
69
+ workspaceId: number;
70
+ /** The name of the connection specified in the connection form */
71
+ connectionName: string;
72
+ databaseType: DatabaseType;
73
+ /** The name of the database connected to */
74
+ databaseName: string;
75
+ defaultSchema?: string;
76
+ readOnlyMode: boolean;
77
+ };
78
+ type AppInfo = {
79
+ version: string;
80
+ theme: AppTheme;
81
+ };
82
+ type AppTheme = {
83
+ palette: Record<string, string>;
84
+ cssString: string;
85
+ type: ThemeType;
86
+ };
87
+ type RunQueryResult = {
88
+ results: QueryResult[];
89
+ error?: unknown;
90
+ };
91
+ type OpenQueryTabOptions = {
92
+ query?: string;
93
+ };
94
+ type OpenTableTableTabOptions = {
95
+ table: string;
96
+ schema?: string;
97
+ filters?: TableFilter[];
98
+ database?: string;
99
+ };
100
+ type OpenTableStructureTabOptions = {
101
+ table: string;
102
+ schema?: string;
103
+ database?: string;
104
+ };
105
+ type RequestFileSaveOptions = {
106
+ data: string;
107
+ fileName: string;
108
+ /** @default "utf8" */
109
+ encoding?: "utf8" | "base64";
110
+ filters?: {
111
+ name: string;
112
+ extensions: string[];
113
+ }[];
114
+ };
115
+ type PluginErrorObject = {
116
+ name?: string;
117
+ message: string;
118
+ stack?: string;
119
+ };
120
+ type WindowEventObject = {
121
+ eventType: string;
122
+ eventClass: WindowEventClass;
123
+ eventInitOptions: WindowEventInits;
124
+ };
125
+
126
+ type RequestMap = {
127
+ getSchemas: {
128
+ args: void;
129
+ return: string[];
130
+ };
131
+ getTables: {
132
+ args: {
133
+ schema?: string;
134
+ };
135
+ return: Table[];
136
+ };
137
+ getColumns: {
138
+ args: {
139
+ table: string;
140
+ schema?: string;
141
+ };
142
+ return: Column[];
143
+ };
144
+ getTableKeys: {
145
+ args: {
146
+ table: string;
147
+ schema?: string;
148
+ };
149
+ return: TableKey[];
150
+ };
151
+ getPrimaryKeys: {
152
+ args: {
153
+ table: string;
154
+ schema?: string;
155
+ };
156
+ return: PrimaryKey[];
157
+ };
158
+ getTableIndexes: {
159
+ args: {
160
+ table: string;
161
+ schema?: string;
162
+ };
163
+ return: TableIndex[];
164
+ };
165
+ getIncomingKeys: {
166
+ args: {
167
+ table: string;
168
+ schema?: string;
169
+ };
170
+ return: TableKey[];
171
+ };
172
+ getOutgoingKeys: {
173
+ args: {
174
+ table: string;
175
+ schema?: string;
176
+ };
177
+ return: TableKey[];
178
+ };
179
+ getConnectionInfo: {
180
+ args: void;
181
+ return: ConnectionInfo;
182
+ };
183
+ getAppInfo: {
184
+ args: void;
185
+ return: AppInfo;
186
+ };
187
+ checkForUpdate: {
188
+ args: void;
189
+ return: boolean;
190
+ };
191
+ runQuery: {
192
+ args: {
193
+ query: string;
194
+ };
195
+ return: RunQueryResult;
196
+ };
197
+ expandTableResult: {
198
+ args: {
199
+ results: QueryResult[];
200
+ };
201
+ return: void;
202
+ };
203
+ setTabTitle: {
204
+ args: {
205
+ title: string;
206
+ };
207
+ return: void;
208
+ };
209
+ getViewContext: {
210
+ args: void;
211
+ return: any;
212
+ };
213
+ getViewState: {
214
+ args: void;
215
+ return: any;
216
+ };
217
+ setViewState: {
218
+ args: {
219
+ state: any;
220
+ };
221
+ return: void;
222
+ };
223
+ openExternal: {
224
+ args: {
225
+ link: string;
226
+ };
227
+ return: void;
228
+ };
229
+ getData: {
230
+ args: {
231
+ key: string;
232
+ };
233
+ return: any;
234
+ };
235
+ setData: {
236
+ args: {
237
+ key: string;
238
+ value: any;
239
+ };
240
+ return: void;
241
+ };
242
+ getEncryptedData: {
243
+ args: {
244
+ key: string;
245
+ };
246
+ return: any;
247
+ };
248
+ setEncryptedData: {
249
+ args: {
250
+ key: string;
251
+ value: any;
252
+ };
253
+ return: void;
254
+ };
255
+ openTab: {
256
+ args: ({
257
+ type: "query";
258
+ } & OpenQueryTabOptions) | ({
259
+ type: "tableTable";
260
+ } & OpenTableTableTabOptions) | ({
261
+ type: "tableStructure";
262
+ } & OpenTableStructureTabOptions);
263
+ return: void;
264
+ };
265
+ requestFileSave: {
266
+ args: RequestFileSaveOptions;
267
+ return: void;
268
+ };
269
+ toggleStatusBarUI: {
270
+ args: {
271
+ force?: boolean;
272
+ };
273
+ return: void;
274
+ };
275
+ "clipboard.writeText": {
276
+ args: {
277
+ text: string;
278
+ };
279
+ return: void;
280
+ };
281
+ "clipboard.writeImage": {
282
+ args: {
283
+ data: string;
284
+ };
285
+ return: void;
286
+ };
287
+ "clipboard.readText": {
288
+ args: void;
289
+ return: string;
290
+ };
291
+ };
292
+ type RequestPayload = {
293
+ [K in keyof RequestMap]: {
294
+ id: string;
295
+ name: K;
296
+ args: RequestMap[K]["args"];
297
+ };
298
+ }[keyof RequestMap];
299
+ type ResponsePayload = {
300
+ [K in keyof RequestMap]: {
301
+ id: string;
302
+ result: RequestMap[K]["return"];
303
+ error?: unknown;
304
+ };
305
+ }[keyof RequestMap];
306
+ type NotificationMap = {
307
+ tablesChanged: {
308
+ args: void;
309
+ };
310
+ broadcast: {
311
+ args: {
312
+ message: JsonValue;
313
+ };
314
+ };
315
+ themeChanged: {
316
+ args: AppTheme;
317
+ };
318
+ windowEvent: {
319
+ args: WindowEventObject;
320
+ };
321
+ pluginError: {
322
+ args: PluginErrorObject;
323
+ };
324
+ };
325
+
326
+ export type { NotificationMap, RequestMap, RequestPayload, ResponsePayload };
@@ -0,0 +1 @@
1
+
package/package.json CHANGED
@@ -1,9 +1,23 @@
1
1
  {
2
2
  "name": "@beekeeperstudio/plugin",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "A simple TypeScript wrapper to send messages from your Beekeeper Studio plugin to the main app.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./dist/internal": {
13
+ "types": "./dist/internal.d.ts",
14
+ "import": "./dist/internal.js"
15
+ },
16
+ "./dist/eventForwarder": {
17
+ "types": "./dist/eventForwarder.d.ts",
18
+ "import": "./dist/eventForwarder.js"
19
+ }
20
+ },
7
21
  "files": [
8
22
  "dist/*.js",
9
23
  "dist/*.d.ts",