@beekeeperstudio/plugin 1.0.10
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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/eventForwarder.js +139 -0
- package/dist/eventForwarder.js.map +1 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Beekeeper Studio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @beekeeperstudio/plugin
|
|
2
|
+
|
|
3
|
+
A TypeScript wrapper library for building Beekeeper Studio plugins that enables communication between your plugin and the main application.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install github:beekeeper-studio/plugin
|
|
9
|
+
# or
|
|
10
|
+
yarn add github:beekeeper-studio/plugin
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { request, notify } from '@beekeeperstudio/plugin';
|
|
17
|
+
|
|
18
|
+
// Get all tables in the current database
|
|
19
|
+
const tables = await request('getTables');
|
|
20
|
+
|
|
21
|
+
// Run a SQL query
|
|
22
|
+
const result = await request('runQuery', { query: 'SELECT * FROM users LIMIT 10' });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Build the library
|
|
29
|
+
npm run build
|
|
30
|
+
|
|
31
|
+
# Prepare for publishing
|
|
32
|
+
npm run prepublishOnly
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
MIT
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const pendingRequests = new Map();
|
|
2
|
+
window.addEventListener("message", (event) => {
|
|
3
|
+
const { id, name, args, result, error } = event.data || {};
|
|
4
|
+
if (name) {
|
|
5
|
+
const handlers = notificationListeners.get(name);
|
|
6
|
+
if (handlers) {
|
|
7
|
+
handlers.forEach((handler) => handler(args));
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
if (id && pendingRequests.has(id)) {
|
|
11
|
+
const { resolve, reject, name } = pendingRequests.get(id);
|
|
12
|
+
pendingRequests.delete(id);
|
|
13
|
+
if (error) {
|
|
14
|
+
reject(error);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
resolve(result);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
function notify(name, args) {
|
|
22
|
+
window.parent.postMessage({ name, args }, "*");
|
|
23
|
+
}
|
|
24
|
+
const notificationListeners = new Map();
|
|
25
|
+
|
|
26
|
+
/** Any events that need to be forwarded to parent/plugin system
|
|
27
|
+
* must go here */
|
|
28
|
+
/** FIXME this file must be injected from the plugin system automatically */
|
|
29
|
+
function createEventInit(event) {
|
|
30
|
+
if (event instanceof MouseEvent) {
|
|
31
|
+
const eventInitOptions = {
|
|
32
|
+
clientX: event.clientX,
|
|
33
|
+
clientY: event.clientY,
|
|
34
|
+
screenX: event.screenX,
|
|
35
|
+
screenY: event.screenY,
|
|
36
|
+
button: event.button,
|
|
37
|
+
buttons: event.buttons,
|
|
38
|
+
altKey: event.altKey,
|
|
39
|
+
ctrlKey: event.ctrlKey,
|
|
40
|
+
shiftKey: event.shiftKey,
|
|
41
|
+
metaKey: event.metaKey,
|
|
42
|
+
movementX: event.movementX,
|
|
43
|
+
movementY: event.movementY,
|
|
44
|
+
detail: event.detail,
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
eventClass: "MouseEvent",
|
|
48
|
+
eventInitOptions,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (event instanceof PointerEvent) {
|
|
52
|
+
const eventInitOptions = {
|
|
53
|
+
clientX: event.clientX,
|
|
54
|
+
clientY: event.clientY,
|
|
55
|
+
screenX: event.screenX,
|
|
56
|
+
screenY: event.screenY,
|
|
57
|
+
button: event.button,
|
|
58
|
+
buttons: event.buttons,
|
|
59
|
+
altKey: event.altKey,
|
|
60
|
+
ctrlKey: event.ctrlKey,
|
|
61
|
+
shiftKey: event.shiftKey,
|
|
62
|
+
metaKey: event.metaKey,
|
|
63
|
+
movementX: event.movementX,
|
|
64
|
+
movementY: event.movementY,
|
|
65
|
+
detail: event.detail,
|
|
66
|
+
pointerId: event.pointerId,
|
|
67
|
+
pointerType: event.pointerType,
|
|
68
|
+
isPrimary: event.isPrimary,
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
eventClass: "PointerEvent",
|
|
72
|
+
eventInitOptions,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (event instanceof KeyboardEvent) {
|
|
76
|
+
const isPasswordField = event.target?.type === "password";
|
|
77
|
+
if (isPasswordField) {
|
|
78
|
+
// Avoid logging keystrokes from password fields
|
|
79
|
+
return {
|
|
80
|
+
eventClass: "KeyboardEvent",
|
|
81
|
+
eventInitOptions: {},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const eventInitOptions = {
|
|
85
|
+
key: event.key,
|
|
86
|
+
code: event.code,
|
|
87
|
+
keyCode: event.keyCode,
|
|
88
|
+
location: event.location,
|
|
89
|
+
altKey: event.altKey,
|
|
90
|
+
ctrlKey: event.ctrlKey,
|
|
91
|
+
shiftKey: event.shiftKey,
|
|
92
|
+
metaKey: event.metaKey,
|
|
93
|
+
repeat: event.repeat,
|
|
94
|
+
isComposing: event.isComposing,
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
eventClass: "KeyboardEvent",
|
|
98
|
+
eventInitOptions,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
eventClass: "Event",
|
|
103
|
+
eventInitOptions: {},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const forwardedEvents = [
|
|
107
|
+
"contextmenu",
|
|
108
|
+
"click",
|
|
109
|
+
"dblclick",
|
|
110
|
+
"pointercancel",
|
|
111
|
+
"pointerdown",
|
|
112
|
+
"pointerenter",
|
|
113
|
+
"pointerleave",
|
|
114
|
+
"pointermove",
|
|
115
|
+
"pointerout",
|
|
116
|
+
"pointerover",
|
|
117
|
+
"pointerup",
|
|
118
|
+
"mousedown",
|
|
119
|
+
"mouseenter",
|
|
120
|
+
"mouseleave",
|
|
121
|
+
"mousemove",
|
|
122
|
+
"mouseout",
|
|
123
|
+
"mouseover",
|
|
124
|
+
"mouseup",
|
|
125
|
+
"keydown",
|
|
126
|
+
"keypress",
|
|
127
|
+
"keyup",
|
|
128
|
+
];
|
|
129
|
+
forwardedEvents.forEach((eventType) => {
|
|
130
|
+
document.addEventListener(eventType, (event) => {
|
|
131
|
+
const eventInit = createEventInit(event);
|
|
132
|
+
notify("windowEvent", {
|
|
133
|
+
eventType,
|
|
134
|
+
eventClass: eventInit.eventClass,
|
|
135
|
+
eventInitOptions: eventInit.eventInitOptions,
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=eventForwarder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventForwarder.js","sources":["../src/comms.ts","../src/eventForwarder.ts"],"sourcesContent":["import type {\n GetTablesRequest,\n GetColumnsRequest,\n RunQueryRequest,\n ExpandTableResultRequest,\n SetTabTitleRequest,\n GetViewStateRequest,\n SetViewStateRequest,\n OpenExternalRequest,\n} from \"./requestTypes\";\nimport type {\n GetTablesResponse,\n GetColumnsResponse,\n GetConnectionInfoResponse,\n GetAllTabsResponse,\n RunQueryResponse,\n ExpandTableResultResponse,\n SetTabTitleResponse,\n GetViewStateResponse,\n SetViewStateResponse,\n OpenExternalResponse,\n} from \"./responseTypes\";\nimport { generateUUID } from \"./utils\";\n\n// Define a custom import.meta interface for TypeScript\ndeclare global {\n interface ImportMeta {\n env: {\n MODE: string;\n };\n }\n}\n\nconst pendingRequests = new Map<\n string,\n {\n name: string;\n resolve: (value: any) => void;\n reject: (reason?: any) => void;\n }\n>();\n\nlet debugComms = false;\n\nexport function setDebugComms(value: boolean) {\n debugComms = value;\n}\n\nwindow.addEventListener(\"message\", (event) => {\n const { id, name, args, result, error } = event.data || {};\n\n if (name) {\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"Args:\", args);\n console.groupEnd();\n }\n\n const handlers = notificationListeners.get(name);\n if (handlers) {\n handlers.forEach((handler) => handler(args));\n }\n }\n\n if (id && pendingRequests.has(id)) {\n const { resolve, reject, name } = pendingRequests.get(id)!;\n pendingRequests.delete(id);\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [RESPONSE] ${name}`);\n console.log(\"Result:\", result);\n if (error) console.error(\"Error:\", error);\n console.groupEnd();\n }\n\n if (error) {\n reject(error);\n } else {\n resolve(result);\n }\n }\n});\n\nexport async function request(name: \"getTables\", args?: GetTablesRequest[\"args\"]): Promise<GetTablesResponse>;\nexport async function request(name: \"getColumns\", args: GetColumnsRequest[\"args\"]): Promise<GetColumnsResponse>;\nexport async function request(name: \"getConnectionInfo\"): Promise<GetConnectionInfoResponse>;\nexport async function request(name: \"getAllTabs\"): Promise<GetAllTabsResponse>;\nexport async function request(name: \"runQuery\", args: RunQueryRequest[\"args\"]): Promise<RunQueryResponse>;\nexport async function request(name: \"expandTableResult\", args: ExpandTableResultRequest[\"args\"]): Promise<ExpandTableResultResponse>;\nexport async function request(name: \"setTabTitle\", args: SetTabTitleRequest[\"args\"]): Promise<SetTabTitleResponse>;\nexport async function request<T extends unknown>(name: \"getViewState\", args: GetViewStateRequest[\"args\"]): Promise<GetViewStateResponse<T>>;\nexport async function request<T extends unknown>(name: \"setViewState\", args: SetViewStateRequest<T>[\"args\"]): Promise<SetViewStateResponse>;\nexport async function request<T extends unknown>(name: \"openExternal\", args: OpenExternalRequest[\"args\"]): Promise<OpenExternalResponse>;\nexport async function request(name: unknown, args?: unknown): Promise<unknown> {\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [REQUEST] ${name}`);\n console.log(\"Args:\", args);\n console.groupEnd();\n }\n\n return new Promise<any>((resolve, reject) => {\n try {\n const id = generateUUID();\n const data = { id, name, args };\n pendingRequests.set(id, { name: name as string, resolve, reject });\n window.parent.postMessage(data, \"*\");\n } catch (e) {\n reject(e);\n }\n });\n}\n\nexport function notify(name: string, args: any) {\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"Args:\", args);\n console.groupEnd();\n }\n window.parent.postMessage({ name, args }, \"*\");\n}\n\nconst notificationListeners = new Map<string, ((args: any) => void)[]>();\n\nexport async function addNotificationListener(\n name: string,\n handler: (args: any) => void,\n) {\n if (!notificationListeners.get(name)) {\n notificationListeners.set(name, []);\n }\n notificationListeners.get(name)!.push(handler);\n}\n","/** Any events that need to be forwarded to parent/plugin system\n * must go here */\n\n/** FIXME this file must be injected from the plugin system automatically */\n\nimport { notify } from \"./comms\";\nimport { WindowEventInits, WindowEventClass } from \"./commonTypes\";\n\nfunction createEventInit<T>(event: T): {\n eventClass: WindowEventClass;\n eventInitOptions: WindowEventInits;\n} {\n if (event instanceof MouseEvent) {\n const eventInitOptions: MouseEventInit = {\n clientX: event.clientX,\n clientY: event.clientY,\n screenX: event.screenX,\n screenY: event.screenY,\n button: event.button,\n buttons: event.buttons,\n altKey: event.altKey,\n ctrlKey: event.ctrlKey,\n shiftKey: event.shiftKey,\n metaKey: event.metaKey,\n movementX: event.movementX,\n movementY: event.movementY,\n detail: event.detail,\n };\n return {\n eventClass: \"MouseEvent\",\n eventInitOptions,\n };\n }\n\n if (event instanceof PointerEvent) {\n const eventInitOptions: PointerEventInit = {\n clientX: event.clientX,\n clientY: event.clientY,\n screenX: event.screenX,\n screenY: event.screenY,\n button: event.button,\n buttons: event.buttons,\n altKey: event.altKey,\n ctrlKey: event.ctrlKey,\n shiftKey: event.shiftKey,\n metaKey: event.metaKey,\n movementX: event.movementX,\n movementY: event.movementY,\n detail: event.detail,\n pointerId: event.pointerId,\n pointerType: event.pointerType,\n isPrimary: event.isPrimary,\n };\n return {\n eventClass: \"PointerEvent\",\n eventInitOptions,\n };\n }\n\n if (event instanceof KeyboardEvent) {\n const isPasswordField =\n (event.target as HTMLInputElement)?.type === \"password\";\n\n if (isPasswordField) {\n // Avoid logging keystrokes from password fields\n return {\n eventClass: \"KeyboardEvent\",\n eventInitOptions: {},\n };\n }\n\n const eventInitOptions: KeyboardEventInit = {\n key: event.key,\n code: event.code,\n keyCode: event.keyCode,\n location: event.location,\n altKey: event.altKey,\n ctrlKey: event.ctrlKey,\n shiftKey: event.shiftKey,\n metaKey: event.metaKey,\n repeat: event.repeat,\n isComposing: event.isComposing,\n };\n\n return {\n eventClass: \"KeyboardEvent\",\n eventInitOptions,\n };\n }\n\n return {\n eventClass: \"Event\",\n eventInitOptions: {},\n };\n}\n\nconst forwardedEvents = [\n \"contextmenu\",\n \"click\",\n \"dblclick\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerenter\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerout\",\n \"pointerover\",\n \"pointerup\",\n \"mousedown\",\n \"mouseenter\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseout\",\n \"mouseover\",\n \"mouseup\",\n \"keydown\",\n \"keypress\",\n \"keyup\",\n] as const;\n\nforwardedEvents.forEach((eventType) => {\n document.addEventListener(eventType, (event) => {\n const eventInit = createEventInit(event);\n notify(\"windowEvent\", {\n eventType,\n eventClass: eventInit.eventClass,\n eventInitOptions: eventInit.eventInitOptions,\n });\n });\n});\n"],"names":[],"mappings":"AAiCA,MAAM,eAAe,GAAG,IAAI,GAAG,EAO5B;AAQH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,KAAI;AAC3C,IAAA,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE;IAE1D,IAAI,IAAI,EAAE;QAQR,MAAM,QAAQ,GAAG,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC;QAChD,IAAI,QAAQ,EAAE;AACZ,YAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;;;IAIhD,IAAI,EAAE,IAAI,eAAe,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M,EAAE,KAAK,CAAC,MAAM;YACpB,WAAW,EAAE,KAAK,CAAC,WAAW;SAC/B;QAED,OAAO;AACL,YAAA,UAAU,EAAE,eAAe;YAC3B,gBAAgB;SACjB;;IAGH,OAAO;AACL,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,gBAAgB,EAAE,EAAE;KACrB;AACH;AAEA,MAAM,eAAe,GAAG;IACtB,aAAa;IACb,OAAO;IACP,UAAU;IACV,eAAe;IACf,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,YAAY;IACZ,aAAa;IACb,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,UAAU;IACV,WAAW;IACX,SAAS;IACT,SAAS;IACT,UAAU;IACV,OAAO;CACC;AAEV,eAAe,CAAC,OAAO,CAAC,CAAC,SAAS,KAAI;IACpC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,KAAI;AAC7C,QAAA,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;QACxC,MAAM,CAAC,aAAa,EAAE;YACpB,SAAS;YACT,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;AAC7C,SAAA,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
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
|
+
type WindowEventClass = "MouseEvent" | "KeyboardEvent" | "PointerEvent" | "Event";
|
|
11
|
+
type WindowEventInits = MouseEventInit | KeyboardEventInit | PointerEventInit;
|
|
12
|
+
|
|
13
|
+
interface BaseRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
interface GetTablesRequest extends BaseRequest {
|
|
17
|
+
name: "getTables";
|
|
18
|
+
args: {
|
|
19
|
+
schema?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
interface GetColumnsRequest extends BaseRequest {
|
|
23
|
+
name: "getColumns";
|
|
24
|
+
args: {
|
|
25
|
+
table: string;
|
|
26
|
+
schema?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface GetConnectionInfoRequest extends BaseRequest {
|
|
30
|
+
name: "getConnectionInfo";
|
|
31
|
+
args: void;
|
|
32
|
+
}
|
|
33
|
+
interface GetAllTabsRequest extends BaseRequest {
|
|
34
|
+
name: "getAllTabs";
|
|
35
|
+
args: void;
|
|
36
|
+
}
|
|
37
|
+
interface RunQueryRequest extends BaseRequest {
|
|
38
|
+
name: "runQuery";
|
|
39
|
+
args: {
|
|
40
|
+
query: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
interface ExpandTableResultRequest extends BaseRequest {
|
|
44
|
+
name: "expandTableResult";
|
|
45
|
+
args: {
|
|
46
|
+
results: QueryResult[];
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
interface SetTabTitleRequest extends BaseRequest {
|
|
50
|
+
name: "setTabTitle";
|
|
51
|
+
args: {
|
|
52
|
+
title: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface GetViewStateRequest extends BaseRequest {
|
|
56
|
+
name: "getViewState";
|
|
57
|
+
args: void;
|
|
58
|
+
}
|
|
59
|
+
interface SetViewStateRequest<T extends unknown> extends BaseRequest {
|
|
60
|
+
name: "setViewState";
|
|
61
|
+
args: {
|
|
62
|
+
state: T;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
interface OpenExternalRequest extends BaseRequest {
|
|
66
|
+
name: "openExternal";
|
|
67
|
+
args: {
|
|
68
|
+
link: boolean;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
type PluginRequestData = GetTablesRequest | GetColumnsRequest | GetConnectionInfoRequest | GetAllTabsRequest | RunQueryRequest | ExpandTableResultRequest | SetTabTitleRequest | GetViewStateRequest | SetViewStateRequest<unknown> | OpenExternalRequest;
|
|
72
|
+
|
|
73
|
+
type TabType = string;
|
|
74
|
+
type TableFilter = any;
|
|
75
|
+
type TableOrView = any;
|
|
76
|
+
|
|
77
|
+
/** The list of tables */
|
|
78
|
+
type GetTablesResponse = {
|
|
79
|
+
name: string;
|
|
80
|
+
schema?: string;
|
|
81
|
+
}[];
|
|
82
|
+
/** The list of columns */
|
|
83
|
+
type GetColumnsResponse = {
|
|
84
|
+
name: string;
|
|
85
|
+
type: string;
|
|
86
|
+
}[];
|
|
87
|
+
type GetConnectionInfoResponse = {
|
|
88
|
+
connectionType: string;
|
|
89
|
+
databaseName: string;
|
|
90
|
+
defaultSchema?: string;
|
|
91
|
+
readOnlyMode: boolean;
|
|
92
|
+
};
|
|
93
|
+
type TabResponse = BaseTabResponse | QueryTabResponse | TableTabResponse;
|
|
94
|
+
type GetAllTabsResponse = TabResponse[];
|
|
95
|
+
type RunQueryResponse = {
|
|
96
|
+
results: QueryResult[];
|
|
97
|
+
error?: unknown;
|
|
98
|
+
};
|
|
99
|
+
type ExpandTableResultResponse = void;
|
|
100
|
+
type SetTabTitleResponse = void;
|
|
101
|
+
type GetViewStateResponse<T extends unknown> = T;
|
|
102
|
+
type SetViewStateResponse = void;
|
|
103
|
+
type OpenExternalResponse = void;
|
|
104
|
+
interface PluginResponseData {
|
|
105
|
+
id: string;
|
|
106
|
+
result: GetTablesResponse | GetColumnsResponse | GetConnectionInfoResponse | GetAllTabsResponse | RunQueryResponse | ExpandTableResultResponse | SetTabTitleResponse | GetViewStateResponse<unknown> | SetViewStateResponse | OpenExternalResponse;
|
|
107
|
+
error?: Error;
|
|
108
|
+
}
|
|
109
|
+
interface QueryTabResponse extends BaseTabResponse {
|
|
110
|
+
type: "query";
|
|
111
|
+
data: {
|
|
112
|
+
query: string;
|
|
113
|
+
result: unknown;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
interface TableTabResponse extends BaseTabResponse {
|
|
117
|
+
type: "table";
|
|
118
|
+
data: {
|
|
119
|
+
table: TableOrView;
|
|
120
|
+
filters: TableFilter[] | string;
|
|
121
|
+
result: unknown;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
interface BaseTabResponse {
|
|
125
|
+
type: TabType;
|
|
126
|
+
id: number;
|
|
127
|
+
title: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface ThemeChangedNotification {
|
|
131
|
+
name: "themeChanged";
|
|
132
|
+
args: {
|
|
133
|
+
palette: Record<string, string>;
|
|
134
|
+
cssString: string;
|
|
135
|
+
type: ThemeType;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
interface WindowEventNotification {
|
|
139
|
+
name: "windowEvent";
|
|
140
|
+
args: {
|
|
141
|
+
eventType: string;
|
|
142
|
+
eventClass: WindowEventClass;
|
|
143
|
+
eventInitOptions: WindowEventInits;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
type PluginNotificationData = ThemeChangedNotification | WindowEventNotification;
|
|
147
|
+
|
|
148
|
+
declare global {
|
|
149
|
+
interface ImportMeta {
|
|
150
|
+
env: {
|
|
151
|
+
MODE: string;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
declare function setDebugComms(value: boolean): void;
|
|
156
|
+
declare function request(name: "getTables", args?: GetTablesRequest["args"]): Promise<GetTablesResponse>;
|
|
157
|
+
declare function request(name: "getColumns", args: GetColumnsRequest["args"]): Promise<GetColumnsResponse>;
|
|
158
|
+
declare function request(name: "getConnectionInfo"): Promise<GetConnectionInfoResponse>;
|
|
159
|
+
declare function request(name: "getAllTabs"): Promise<GetAllTabsResponse>;
|
|
160
|
+
declare function request(name: "runQuery", args: RunQueryRequest["args"]): Promise<RunQueryResponse>;
|
|
161
|
+
declare function request(name: "expandTableResult", args: ExpandTableResultRequest["args"]): Promise<ExpandTableResultResponse>;
|
|
162
|
+
declare function request(name: "setTabTitle", args: SetTabTitleRequest["args"]): Promise<SetTabTitleResponse>;
|
|
163
|
+
declare function request<T extends unknown>(name: "getViewState", args: GetViewStateRequest["args"]): Promise<GetViewStateResponse<T>>;
|
|
164
|
+
declare function request<T extends unknown>(name: "setViewState", args: SetViewStateRequest<T>["args"]): Promise<SetViewStateResponse>;
|
|
165
|
+
declare function request<T extends unknown>(name: "openExternal", args: OpenExternalRequest["args"]): Promise<OpenExternalResponse>;
|
|
166
|
+
declare function notify(name: string, args: any): void;
|
|
167
|
+
declare function addNotificationListener(name: string, handler: (args: any) => void): Promise<void>;
|
|
168
|
+
|
|
169
|
+
export { addNotificationListener, notify, request, setDebugComms };
|
|
170
|
+
export type { ExpandTableResultRequest, ExpandTableResultResponse, GetAllTabsRequest, GetAllTabsResponse, GetColumnsRequest, GetColumnsResponse, GetConnectionInfoRequest, GetConnectionInfoResponse, GetTablesRequest, GetTablesResponse, GetViewStateRequest, GetViewStateResponse, OpenExternalRequest, OpenExternalResponse, PluginNotificationData, PluginRequestData, PluginResponseData, QueryResult, RunQueryRequest, RunQueryResponse, SetTabTitleRequest, SetTabTitleResponse, SetViewStateRequest, SetViewStateResponse, TabResponse, ThemeChangedNotification, ThemeType, WindowEventClass, WindowEventInits, WindowEventNotification };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function generateUUID() {
|
|
2
|
+
const buf = new Uint8Array(16);
|
|
3
|
+
crypto.getRandomValues(buf);
|
|
4
|
+
buf[6] = (buf[6] & 0x0f) | 0x40; // version 4
|
|
5
|
+
buf[8] = (buf[8] & 0x3f) | 0x80; // variant
|
|
6
|
+
const hex = Array.from(buf, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
7
|
+
return [
|
|
8
|
+
hex.substring(0, 8),
|
|
9
|
+
hex.substring(8, 12),
|
|
10
|
+
hex.substring(12, 16),
|
|
11
|
+
hex.substring(16, 20),
|
|
12
|
+
hex.substring(20),
|
|
13
|
+
].join("-");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const pendingRequests = new Map();
|
|
17
|
+
let debugComms = false;
|
|
18
|
+
function setDebugComms(value) {
|
|
19
|
+
debugComms = value;
|
|
20
|
+
}
|
|
21
|
+
window.addEventListener("message", (event) => {
|
|
22
|
+
const { id, name, args, result, error } = event.data || {};
|
|
23
|
+
if (name) {
|
|
24
|
+
if (debugComms) {
|
|
25
|
+
const time = new Date().toLocaleTimeString("en-GB");
|
|
26
|
+
console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);
|
|
27
|
+
console.log("Args:", args);
|
|
28
|
+
console.groupEnd();
|
|
29
|
+
}
|
|
30
|
+
const handlers = notificationListeners.get(name);
|
|
31
|
+
if (handlers) {
|
|
32
|
+
handlers.forEach((handler) => handler(args));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (id && pendingRequests.has(id)) {
|
|
36
|
+
const { resolve, reject, name } = pendingRequests.get(id);
|
|
37
|
+
pendingRequests.delete(id);
|
|
38
|
+
if (debugComms) {
|
|
39
|
+
const time = new Date().toLocaleTimeString("en-GB");
|
|
40
|
+
console.groupCollapsed(`${time} [RESPONSE] ${name}`);
|
|
41
|
+
console.log("Result:", result);
|
|
42
|
+
if (error)
|
|
43
|
+
console.error("Error:", error);
|
|
44
|
+
console.groupEnd();
|
|
45
|
+
}
|
|
46
|
+
if (error) {
|
|
47
|
+
reject(error);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
resolve(result);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
async function request(name, args) {
|
|
55
|
+
if (debugComms) {
|
|
56
|
+
const time = new Date().toLocaleTimeString("en-GB");
|
|
57
|
+
console.groupCollapsed(`${time} [REQUEST] ${name}`);
|
|
58
|
+
console.log("Args:", args);
|
|
59
|
+
console.groupEnd();
|
|
60
|
+
}
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
try {
|
|
63
|
+
const id = generateUUID();
|
|
64
|
+
const data = { id, name, args };
|
|
65
|
+
pendingRequests.set(id, { name: name, resolve, reject });
|
|
66
|
+
window.parent.postMessage(data, "*");
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
reject(e);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function notify(name, args) {
|
|
74
|
+
if (debugComms) {
|
|
75
|
+
const time = new Date().toLocaleTimeString("en-GB");
|
|
76
|
+
console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);
|
|
77
|
+
console.log("Args:", args);
|
|
78
|
+
console.groupEnd();
|
|
79
|
+
}
|
|
80
|
+
window.parent.postMessage({ name, args }, "*");
|
|
81
|
+
}
|
|
82
|
+
const notificationListeners = new Map();
|
|
83
|
+
async function addNotificationListener(name, handler) {
|
|
84
|
+
if (!notificationListeners.get(name)) {
|
|
85
|
+
notificationListeners.set(name, []);
|
|
86
|
+
}
|
|
87
|
+
notificationListeners.get(name).push(handler);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { addNotificationListener, notify, request, setDebugComms };
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/utils.ts","../src/comms.ts"],"sourcesContent":["export function generateUUID() {\n const buf = new Uint8Array(16);\n crypto.getRandomValues(buf);\n\n buf[6] = (buf[6] & 0x0f) | 0x40; // version 4\n buf[8] = (buf[8] & 0x3f) | 0x80; // variant\n\n const hex = Array.from(buf, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n\n return [\n hex.substring(0, 8),\n hex.substring(8, 12),\n hex.substring(12, 16),\n hex.substring(16, 20),\n hex.substring(20),\n ].join(\"-\");\n}\n","import type {\n GetTablesRequest,\n GetColumnsRequest,\n RunQueryRequest,\n ExpandTableResultRequest,\n SetTabTitleRequest,\n GetViewStateRequest,\n SetViewStateRequest,\n OpenExternalRequest,\n} from \"./requestTypes\";\nimport type {\n GetTablesResponse,\n GetColumnsResponse,\n GetConnectionInfoResponse,\n GetAllTabsResponse,\n RunQueryResponse,\n ExpandTableResultResponse,\n SetTabTitleResponse,\n GetViewStateResponse,\n SetViewStateResponse,\n OpenExternalResponse,\n} from \"./responseTypes\";\nimport { generateUUID } from \"./utils\";\n\n// Define a custom import.meta interface for TypeScript\ndeclare global {\n interface ImportMeta {\n env: {\n MODE: string;\n };\n }\n}\n\nconst pendingRequests = new Map<\n string,\n {\n name: string;\n resolve: (value: any) => void;\n reject: (reason?: any) => void;\n }\n>();\n\nlet debugComms = false;\n\nexport function setDebugComms(value: boolean) {\n debugComms = value;\n}\n\nwindow.addEventListener(\"message\", (event) => {\n const { id, name, args, result, error } = event.data || {};\n\n if (name) {\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"Args:\", args);\n console.groupEnd();\n }\n\n const handlers = notificationListeners.get(name);\n if (handlers) {\n handlers.forEach((handler) => handler(args));\n }\n }\n\n if (id && pendingRequests.has(id)) {\n const { resolve, reject, name } = pendingRequests.get(id)!;\n pendingRequests.delete(id);\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [RESPONSE] ${name}`);\n console.log(\"Result:\", result);\n if (error) console.error(\"Error:\", error);\n console.groupEnd();\n }\n\n if (error) {\n reject(error);\n } else {\n resolve(result);\n }\n }\n});\n\nexport async function request(name: \"getTables\", args?: GetTablesRequest[\"args\"]): Promise<GetTablesResponse>;\nexport async function request(name: \"getColumns\", args: GetColumnsRequest[\"args\"]): Promise<GetColumnsResponse>;\nexport async function request(name: \"getConnectionInfo\"): Promise<GetConnectionInfoResponse>;\nexport async function request(name: \"getAllTabs\"): Promise<GetAllTabsResponse>;\nexport async function request(name: \"runQuery\", args: RunQueryRequest[\"args\"]): Promise<RunQueryResponse>;\nexport async function request(name: \"expandTableResult\", args: ExpandTableResultRequest[\"args\"]): Promise<ExpandTableResultResponse>;\nexport async function request(name: \"setTabTitle\", args: SetTabTitleRequest[\"args\"]): Promise<SetTabTitleResponse>;\nexport async function request<T extends unknown>(name: \"getViewState\", args: GetViewStateRequest[\"args\"]): Promise<GetViewStateResponse<T>>;\nexport async function request<T extends unknown>(name: \"setViewState\", args: SetViewStateRequest<T>[\"args\"]): Promise<SetViewStateResponse>;\nexport async function request<T extends unknown>(name: \"openExternal\", args: OpenExternalRequest[\"args\"]): Promise<OpenExternalResponse>;\nexport async function request(name: unknown, args?: unknown): Promise<unknown> {\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [REQUEST] ${name}`);\n console.log(\"Args:\", args);\n console.groupEnd();\n }\n\n return new Promise<any>((resolve, reject) => {\n try {\n const id = generateUUID();\n const data = { id, name, args };\n pendingRequests.set(id, { name: name as string, resolve, reject });\n window.parent.postMessage(data, \"*\");\n } catch (e) {\n reject(e);\n }\n });\n}\n\nexport function notify(name: string, args: any) {\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"Args:\", args);\n console.groupEnd();\n }\n window.parent.postMessage({ name, args }, \"*\");\n}\n\nconst notificationListeners = new Map<string, ((args: any) => void)[]>();\n\nexport async function addNotificationListener(\n name: string,\n handler: (args: any) => void,\n) {\n if (!notificationListeners.get(name)) {\n notificationListeners.set(name, []);\n }\n notificationListeners.get(name)!.push(handler);\n}\n"],"names":[],"mappings":"SAAgB,YAAY,GAAA;AAC1B,IAAA,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC;AAC9B,IAAA,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC;AAE3B,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,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AAChD;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@beekeeperstudio/plugin",
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "A simple TypeScript wrapper to send messages from your Beekeeper Studio plugin to the main app.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/*.js",
|
|
9
|
+
"dist/*.d.ts",
|
|
10
|
+
"dist/*.js.map",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "rollup -c",
|
|
16
|
+
"prepublishOnly": "yarn run build",
|
|
17
|
+
"clean": "rm -rf dist"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/beekeeper-studio/plugin.git"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"beekeeper-studio",
|
|
28
|
+
"plugin",
|
|
29
|
+
"typescript",
|
|
30
|
+
"database"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"private": false,
|
|
34
|
+
"author": {
|
|
35
|
+
"name": "Beekeeper Studio Team",
|
|
36
|
+
"email": "support@beekeeperstudio.io",
|
|
37
|
+
"url": "https://beekeeperstudio.io"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
41
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
42
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
43
|
+
"rollup": "^4.41.1",
|
|
44
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
45
|
+
"tslib": "^2.8.1",
|
|
46
|
+
"typescript": "^5.8.3"
|
|
47
|
+
}
|
|
48
|
+
}
|