@beekeeperstudio/plugin 1.4.0-beta.1 → 1.4.0-beta.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"eventForwarder.js","sources":["../src/comms.ts","../src/eventForwarder.ts"],"sourcesContent":["import type { PluginRequestPayload } from \"./requestTypes\";\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 // The whole payload is kept just in case for debugging\n payload: PluginRequestPayload;\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, payload } = pendingRequests.get(id)!;\n pendingRequests.delete(id);\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [RESPONSE] ${payload.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(raw: any): Promise<any> {\n const payload = { id: generateUUID(), ...raw } as PluginRequestPayload;\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [REQUEST] ${payload.name}`);\n console.log(\"id:\", payload.id);\n console.log(\"args:\", payload.args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n\n return new Promise<any>((resolve, reject) => {\n try {\n pendingRequests.set(payload.id, { payload: payload, resolve, reject });\n window.parent.postMessage(payload, \"*\");\n } catch (e) {\n reject(e);\n }\n });\n}\n\nexport function notify(name: string, args: any) {\n const payload = { name, args }\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"args:\", args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n window.parent.postMessage(payload, \"*\");\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":"AAYA,MAAM,eAAe,GAAG,IAAI,GAAG,EAQ5B;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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AChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,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"}
1
+ {"version":3,"file":"eventForwarder.js","sources":["../src/comms.ts","../src/eventForwarder.ts"],"sourcesContent":["import { JsonValue } from \"./commonTypes\";\nimport {\n BroadcastNotification,\n PluginErrorNotification,\n ThemeChangedNotification,\n ViewLoadedNotification,\n WindowEventNotification,\n} from \"./notificationTypes\";\nimport type { PluginRequestPayload } from \"./requestTypes\";\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 // The whole payload is kept just in case for debugging\n payload: PluginRequestPayload;\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, payload } = pendingRequests.get(id)!;\n pendingRequests.delete(id);\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [RESPONSE] ${payload.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(raw: any): Promise<any> {\n const payload = { id: generateUUID(), ...raw } as PluginRequestPayload;\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [REQUEST] ${payload.name}`);\n console.log(\"id:\", payload.id);\n console.log(\"args:\", payload.args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n\n return new Promise<any>((resolve, reject) => {\n try {\n pendingRequests.set(payload.id, { payload: payload, resolve, reject });\n window.parent.postMessage(payload, \"*\");\n } catch (e) {\n reject(e);\n }\n });\n}\n\nexport function notify<Message extends JsonValue = JsonValue>(\n name: BroadcastNotification[\"name\"],\n args: BroadcastNotification<Message>[\"args\"],\n): void;\nexport function notify(\n name: PluginErrorNotification[\"name\"],\n args: PluginErrorNotification[\"args\"],\n): void;\nexport function notify(\n name: WindowEventNotification[\"name\"],\n args: WindowEventNotification[\"args\"],\n): void;\nexport function notify(name: string, args: any) {\n const payload = { name, args };\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"args:\", args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n window.parent.postMessage(payload, \"*\");\n}\n\nconst notificationListeners = new Map<string, ((args: any) => void)[]>();\n\nexport function addNotificationListener<Message extends JsonValue = JsonValue>(\n name: BroadcastNotification[\"name\"],\n handler: (args: BroadcastNotification<Message>[\"args\"]) => void,\n): void;\nexport function addNotificationListener(\n name: ViewLoadedNotification[\"name\"],\n handler: (args: ViewLoadedNotification[\"args\"]) => void,\n): void;\nexport function addNotificationListener(\n name: ThemeChangedNotification[\"name\"],\n handler: (args: ThemeChangedNotification[\"args\"]) => void,\n): void;\nexport 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\nexport function removeNotificationListener(\n name: string,\n handler: (args: any) => void,\n) {\n const handlers = notificationListeners.get(name);\n if (handlers) {\n const index = handlers.indexOf(handler);\n if (index > -1) {\n handlers.splice(index, 1);\n }\n }\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":"AAoBA,MAAM,eAAe,GAAG,IAAI,GAAG,EAQ5B;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,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;AACjC,QAAA,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,EAAE,CAAE;AAC7D,QAAA,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;QAU1B,IAAI,KAAK,EAAE;YACT,MAAM,CAAC,KAAK,CAAC;;aACR;YACL,OAAO,CAAC,MAAM,CAAC;;;AAGrB,CAAC,CAAC;AAoCc,SAAA,MAAM,CAAC,IAAY,EAAE,IAAS,EAAA;AAC5C,IAAA,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE;IAQ9B,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC;AACzC;AAEA,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAmC;;ACvHxE;AACkB;AAElB;AAKA,SAAS,eAAe,CAAI,KAAQ,EAAA;AAIlC,IAAA,IAAI,KAAK,YAAY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AI;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 CHANGED
@@ -7,8 +7,29 @@ interface QueryResult {
7
7
  }[];
8
8
  rows: Record<string, unknown>[];
9
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
+ }
10
22
  type WindowEventClass = "MouseEvent" | "KeyboardEvent" | "PointerEvent" | "Event";
11
23
  type WindowEventInits = MouseEventInit | KeyboardEventInit | PointerEventInit;
24
+ type TableFilter$1 = {
25
+ field: string;
26
+ type: "=" | "!=" | "like" | "not like" | "<" | "<=" | ">" | ">=" | "in" | "is" | "is not";
27
+ value?: string | string[];
28
+ op?: 'AND' | 'OR';
29
+ };
30
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
31
+ [key: string]: JsonValue;
32
+ };
12
33
 
13
34
  interface BaseRequest {
14
35
  id: string;
@@ -26,14 +47,21 @@ interface GetColumnsRequest extends BaseRequest {
26
47
  schema?: string;
27
48
  };
28
49
  }
50
+ type GetTableKeysRequest = BaseRequest & {
51
+ name: "getTableKeys";
52
+ args: {
53
+ table: string;
54
+ schema?: string;
55
+ };
56
+ };
57
+ type GetAppInfoRequest = BaseRequest & {
58
+ name: "getAppInfo";
59
+ args: void;
60
+ };
29
61
  interface GetConnectionInfoRequest extends BaseRequest {
30
62
  name: "getConnectionInfo";
31
63
  args: void;
32
64
  }
33
- interface GetAllTabsRequest extends BaseRequest {
34
- name: "getAllTabs";
35
- args: void;
36
- }
37
65
  interface RunQueryRequest extends BaseRequest {
38
66
  name: "runQuery";
39
67
  args: {
@@ -108,7 +136,7 @@ type OpenQueryTabRequest = BaseRequest & {
108
136
  name: "openTab";
109
137
  args: {
110
138
  type: "query";
111
- query: string;
139
+ query?: string;
112
140
  };
113
141
  };
114
142
  type OpenTableTableTabRequest = BaseRequest & {
@@ -117,6 +145,8 @@ type OpenTableTableTabRequest = BaseRequest & {
117
145
  type: "tableTable";
118
146
  table: string;
119
147
  schema?: string;
148
+ filters?: TableFilter$1[];
149
+ database?: string;
120
150
  };
121
151
  };
122
152
  type OpenTableStructureTabRequest = BaseRequest & {
@@ -125,12 +155,57 @@ type OpenTableStructureTabRequest = BaseRequest & {
125
155
  type: "tableStructure";
126
156
  table: string;
127
157
  schema?: string;
158
+ database?: string;
128
159
  };
129
160
  };
161
+ type CheckForUpdateRequest = BaseRequest & {
162
+ name: "checkForUpdate";
163
+ args: void;
164
+ };
130
165
  type OpenTabRequest = OpenQueryTabRequest | OpenTableTableTabRequest | OpenTableStructureTabRequest;
131
- type PluginRequestData = GetTablesRequest | GetColumnsRequest | GetConnectionInfoRequest | GetAllTabsRequest | RunQueryRequest | ExpandTableResultRequest | SetTabTitleRequest | GetViewStateRequest | SetViewStateRequest<unknown> | OpenExternalRequest | GetDataRequest | SetDataRequest<unknown> | GetEncryptedDataRequest | SetEncryptedDataRequest<unknown> | ClipboardWriteTextRequest | ClipboardReadTextRequest | OpenQueryTabRequest | OpenTableTableTabRequest | OpenTableStructureTabRequest;
166
+ type PluginRequestData = GetTablesRequest | GetColumnsRequest | GetTableKeysRequest | GetAppInfoRequest | GetConnectionInfoRequest | RunQueryRequest | ExpandTableResultRequest | SetTabTitleRequest | GetViewStateRequest | SetViewStateRequest<unknown> | OpenExternalRequest | GetDataRequest | SetDataRequest<unknown> | GetEncryptedDataRequest | SetEncryptedDataRequest<unknown> | ClipboardWriteTextRequest | ClipboardReadTextRequest | OpenTabRequest | CheckForUpdateRequest;
132
167
  type PluginRequestPayload = PluginRequestData;
133
168
 
169
+ type AppTheme = {
170
+ palette: Record<string, string>;
171
+ cssString: string;
172
+ type: ThemeType;
173
+ };
174
+ type ThemeChangedNotification = {
175
+ name: "themeChanged";
176
+ args: AppTheme;
177
+ };
178
+ type WindowEventNotification = {
179
+ name: "windowEvent";
180
+ args: {
181
+ eventType: string;
182
+ eventClass: WindowEventClass;
183
+ eventInitOptions: WindowEventInits;
184
+ };
185
+ };
186
+ type PluginErrorNotification = {
187
+ name: "pluginError";
188
+ args: {
189
+ name?: string;
190
+ message?: string;
191
+ stack?: string;
192
+ };
193
+ };
194
+ type BroadcastNotification<Message extends JsonValue = JsonValue> = {
195
+ name: "broadcast";
196
+ args: {
197
+ message: Message;
198
+ };
199
+ };
200
+ type ViewLoadedNotification = {
201
+ name: "viewLoaded";
202
+ args: {
203
+ command: string;
204
+ args?: JsonValue;
205
+ };
206
+ };
207
+ type PluginNotificationData = ThemeChangedNotification | WindowEventNotification | PluginErrorNotification | ViewLoadedNotification | BroadcastNotification;
208
+
134
209
  type TabType = string;
135
210
  type TableFilter = any;
136
211
  type TableOrView = any;
@@ -150,17 +225,26 @@ interface GetColumnsResponse extends BaseResponse {
150
225
  type: string;
151
226
  }[];
152
227
  }
228
+ type GetTableKeysResponse = BaseResponse & {
229
+ result: TableKey[];
230
+ };
153
231
  interface GetConnectionInfoResponse extends BaseResponse {
154
232
  result: {
233
+ /** @deprecated Use `databaseType` instead */
155
234
  connectionType: string;
235
+ databaseType: string;
236
+ databaseTypeDisplayName: string;
156
237
  databaseName: string;
157
238
  defaultSchema?: string;
158
239
  readOnlyMode: boolean;
159
240
  };
160
241
  }
161
- interface GetAllTabsResponse extends BaseResponse {
162
- result: Tab[];
163
- }
242
+ type GetAppInfoResponse = BaseResponse & {
243
+ result: {
244
+ version: string;
245
+ theme: AppTheme;
246
+ };
247
+ };
164
248
  interface RunQueryResponse extends BaseResponse {
165
249
  result: {
166
250
  results: QueryResult[];
@@ -203,10 +287,12 @@ interface ClipboardReadTextResponse extends BaseResponse {
203
287
  interface OpenTabResponse extends BaseResponse {
204
288
  result: void;
205
289
  }
206
- type PluginResponseData = GetTablesResponse | GetColumnsResponse | GetConnectionInfoResponse | GetAllTabsResponse | RunQueryResponse | ExpandTableResultResponse | SetTabTitleResponse | GetViewStateResponse<unknown> | SetViewStateResponse | OpenExternalResponse | GetDataResponse<unknown> | SetDataResponse | GetEncryptedDataResponse<unknown> | SetEncryptedDataResponse | ClipboardWriteTextResponse | ClipboardReadTextResponse | OpenTabResponse;
290
+ interface CheckForUpdateResponse extends BaseResponse {
291
+ result: boolean;
292
+ }
293
+ type PluginResponseData = GetTablesResponse | GetColumnsResponse | GetTableKeysResponse | GetConnectionInfoResponse | RunQueryResponse | ExpandTableResultResponse | SetTabTitleResponse | GetViewStateResponse<unknown> | SetViewStateResponse | OpenExternalResponse | GetDataResponse<unknown> | SetDataResponse | GetEncryptedDataResponse<unknown> | SetEncryptedDataResponse | ClipboardWriteTextResponse | ClipboardReadTextResponse | OpenTabResponse | CheckForUpdateResponse;
207
294
  type PluginResponsePayload = PluginResponseData;
208
- type TabResponse = Tab;
209
- type Tab = BaseTabResponse | QueryTabResponse | TableTabResponse;
295
+ type TabResponse = BaseTabResponse | QueryTabResponse | TableTabResponse;
210
296
  interface BaseTabResponse {
211
297
  type: TabType;
212
298
  id: number;
@@ -228,32 +314,6 @@ interface TableTabResponse extends BaseTabResponse {
228
314
  };
229
315
  }
230
316
 
231
- interface ThemeChangedNotification {
232
- name: "themeChanged";
233
- args: {
234
- palette: Record<string, string>;
235
- cssString: string;
236
- type: ThemeType;
237
- };
238
- }
239
- interface WindowEventNotification {
240
- name: "windowEvent";
241
- args: {
242
- eventType: string;
243
- eventClass: WindowEventClass;
244
- eventInitOptions: WindowEventInits;
245
- };
246
- }
247
- interface PluginErrorNotification {
248
- name: "pluginError";
249
- args: {
250
- name?: string;
251
- message?: string;
252
- stack?: string;
253
- };
254
- }
255
- type PluginNotificationData = ThemeChangedNotification | WindowEventNotification | PluginErrorNotification;
256
-
257
317
  declare global {
258
318
  interface ImportMeta {
259
319
  env: {
@@ -263,19 +323,80 @@ declare global {
263
323
  }
264
324
  declare function setDebugComms(value: boolean): void;
265
325
  declare function request(raw: any): Promise<any>;
266
- declare function notify(name: string, args: any): void;
267
- declare function addNotificationListener(name: string, handler: (args: any) => void): Promise<void>;
326
+ declare function notify<Message extends JsonValue = JsonValue>(name: BroadcastNotification["name"], args: BroadcastNotification<Message>["args"]): void;
327
+ declare function notify(name: PluginErrorNotification["name"], args: PluginErrorNotification["args"]): void;
328
+ declare function notify(name: WindowEventNotification["name"], args: WindowEventNotification["args"]): void;
329
+ declare function addNotificationListener<Message extends JsonValue = JsonValue>(name: BroadcastNotification["name"], handler: (args: BroadcastNotification<Message>["args"]) => void): void;
330
+ declare function addNotificationListener(name: ViewLoadedNotification["name"], handler: (args: ViewLoadedNotification["args"]) => void): void;
331
+ declare function addNotificationListener(name: ThemeChangedNotification["name"], handler: (args: ThemeChangedNotification["args"]) => void): void;
332
+ declare function removeNotificationListener(name: string, handler: (args: any) => void): void;
268
333
 
334
+ /**
335
+ * Get a list of tables from the current database.
336
+ * @since Beekeeper Studio 5.3.0
337
+ **/
269
338
  declare function getTables(schema?: string): Promise<GetTablesResponse['result']>;
339
+ /**
340
+ * Get a list of columns from a table.
341
+ *
342
+ * @since Beekeeper Studio 5.3.0
343
+ **/
270
344
  declare function getColumns(table: string, schema?: string): Promise<GetColumnsResponse['result']>;
345
+ /** @since Beekeeper Studio 5.4.0 */
346
+ declare function getTableKeys(table: string, schema?: string): Promise<GetTableKeysResponse['result']>;
347
+ /**
348
+ * Get information about the current database connection.
349
+ *
350
+ * @since Beekeeper Studio 5.3.0
351
+ **/
271
352
  declare function getConnectionInfo(): Promise<GetConnectionInfoResponse['result']>;
272
- declare function getAllTabs(): Promise<GetAllTabsResponse['result']>;
353
+ /** @since Beekeeper Studio 5.4.0 */
354
+ declare function getAppInfo(): Promise<GetAppInfoResponse['result']>;
355
+ /**
356
+ * Check if plugin's update is available.
357
+ *
358
+ * @since Beekeeper Studio 5.4.0
359
+ **/
360
+ declare function checkForUpdate(): Promise<CheckForUpdateResponse['result']>;
361
+ /**
362
+ * Execute a SQL query against the current database.
363
+ *
364
+ * WARNING: The query will be executed exactly as provided with no modification
365
+ * or sanitization. Always validate and sanitize user input before including it
366
+ * in queries to prevent unwanted actions.
367
+ *
368
+ * @since Beekeeper Studio 5.3.0
369
+ **/
273
370
  declare function runQuery(query: string): Promise<RunQueryResponse['result']>;
371
+ /**
372
+ * Display query results in the bottom table panel (shell-type tabs only).
373
+ *
374
+ * @since Beekeeper Studio 5.3.0
375
+ **/
274
376
  declare function expandTableResult(results: any[]): Promise<ExpandTableResultResponse['result']>;
377
+ /**
378
+ * Set the title of the current plugin tab.
379
+ *
380
+ * @since Beekeeper Studio 5.3.0
381
+ **/
275
382
  declare function setTabTitle(title: string): Promise<SetTabTitleResponse['result']>;
383
+ /**
384
+ * Get the current state of your view instance.
385
+ *
386
+ * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}
387
+ * @since Beekeeper Studio 5.3.0
388
+ **/
276
389
  declare function getViewState<T>(): Promise<GetViewStateResponse<T>['result']>;
390
+ /**
391
+ * Set the state of your view instance.
392
+ *
393
+ * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}
394
+ * @since Beekeeper Studio 5.3.0
395
+ **/
277
396
  declare function setViewState<T>(state: T): Promise<SetViewStateResponse['result']>;
397
+ /** @since Beekeeper Studio 5.3.0 */
278
398
  declare function openExternal(link: string): Promise<OpenExternalResponse['result']>;
399
+ /** @since Beekeeper Studio 5.3.0 */
279
400
  declare function getData<T>(key?: string): Promise<GetDataResponse<T>['result']>;
280
401
  /**
281
402
  * Store data that can be retrieved later.
@@ -286,9 +407,12 @@ declare function getData<T>(key?: string): Promise<GetDataResponse<T>['result']>
286
407
  *
287
408
  * // Store with default key (equivalent to setData("default", value))
288
409
  * await setData({ name: "John" });
410
+ *
411
+ * @since Beekeeper Studio 5.3.0
289
412
  */
290
413
  declare function setData<T>(key: string, value: T): Promise<SetDataResponse['result']>;
291
414
  declare function setData<T>(value: T): Promise<SetDataResponse['result']>;
415
+ /** @since Beekeeper Studio 5.3.0 */
292
416
  declare function getEncryptedData<T>(key: string): Promise<GetEncryptedDataResponse<T>['result']>;
293
417
  /**
294
418
  * Store encrypted data that can be retrieved later.
@@ -299,10 +423,13 @@ declare function getEncryptedData<T>(key: string): Promise<GetEncryptedDataRespo
299
423
  *
300
424
  * // Store with default key (equivalent to setEncryptedData("default", value))
301
425
  * await setEncryptedData({ token: "abc123" });
426
+ *
427
+ * @since Beekeeper Studio 5.3.0
302
428
  */
303
429
  declare function setEncryptedData<T>(key: string, value: T): Promise<SetEncryptedDataResponse['result']>;
304
430
  declare function setEncryptedData<T>(value: T): Promise<SetEncryptedDataResponse['result']>;
305
- declare function openTab(type: "query", args: Omit<OpenQueryTabRequest['args'], 'type'>): Promise<OpenTabResponse>;
431
+ /** @since Beekeeper Studio 5.4.0 */
432
+ declare function openTab(type: "query", args?: Omit<OpenQueryTabRequest['args'], 'type'>): Promise<OpenTabResponse>;
306
433
  declare function openTab(type: "tableTable", args: Omit<OpenTableTableTabRequest['args'], 'type'>): Promise<OpenTabResponse>;
307
434
  declare function openTab(type: "tableStructure", args: Omit<OpenTableStructureTabRequest['args'], 'type'>): Promise<OpenTabResponse>;
308
435
  /** Clipboard interface. */
@@ -313,5 +440,5 @@ declare const clipboard: {
313
440
  readText(): Promise<string>;
314
441
  };
315
442
 
316
- export { addNotificationListener, clipboard, expandTableResult, getAllTabs, getColumns, getConnectionInfo, getData, getEncryptedData, getTables, getViewState, notify, openExternal, openTab, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
317
- export type { ClipboardReadTextRequest, ClipboardReadTextResponse, ClipboardWriteTextRequest, ClipboardWriteTextResponse, ExpandTableResultRequest, ExpandTableResultResponse, GetAllTabsRequest, GetAllTabsResponse, GetColumnsRequest, GetColumnsResponse, GetConnectionInfoRequest, GetConnectionInfoResponse, GetDataRequest, GetDataResponse, GetEncryptedDataRequest, GetEncryptedDataResponse, GetTablesRequest, GetTablesResponse, GetViewStateRequest, GetViewStateResponse, OpenExternalRequest, OpenExternalResponse, OpenQueryTabRequest, OpenTabRequest, OpenTabResponse, OpenTableStructureTabRequest, OpenTableTableTabRequest, PluginErrorNotification, PluginNotificationData, PluginRequestData, PluginRequestPayload, PluginResponseData, PluginResponsePayload, QueryResult, RunQueryRequest, RunQueryResponse, SetDataRequest, SetDataResponse, SetEncryptedDataRequest, SetEncryptedDataResponse, SetTabTitleRequest, SetTabTitleResponse, SetViewStateRequest, SetViewStateResponse, TabResponse, ThemeChangedNotification, ThemeType, WindowEventClass, WindowEventInits, WindowEventNotification };
443
+ export { addNotificationListener, checkForUpdate, clipboard, expandTableResult, getAppInfo, getColumns, getConnectionInfo, getData, getEncryptedData, getTableKeys, getTables, getViewState, notify, openExternal, openTab, removeNotificationListener, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
444
+ export type { AppTheme, BroadcastNotification, CheckForUpdateRequest, CheckForUpdateResponse, ClipboardReadTextRequest, ClipboardReadTextResponse, ClipboardWriteTextRequest, ClipboardWriteTextResponse, ExpandTableResultRequest, ExpandTableResultResponse, GetAppInfoRequest, GetAppInfoResponse, GetColumnsRequest, GetColumnsResponse, GetConnectionInfoRequest, GetConnectionInfoResponse, GetDataRequest, GetDataResponse, GetEncryptedDataRequest, GetEncryptedDataResponse, GetTableKeysRequest, GetTableKeysResponse, GetTablesRequest, GetTablesResponse, GetViewStateRequest, GetViewStateResponse, JsonValue, OpenExternalRequest, OpenExternalResponse, OpenQueryTabRequest, OpenTabRequest, OpenTabResponse, OpenTableStructureTabRequest, OpenTableTableTabRequest, PluginErrorNotification, PluginNotificationData, PluginRequestData, PluginRequestPayload, PluginResponseData, PluginResponsePayload, QueryResult, RunQueryRequest, RunQueryResponse, SetDataRequest, SetDataResponse, SetEncryptedDataRequest, SetEncryptedDataResponse, SetTabTitleRequest, SetTabTitleResponse, SetViewStateRequest, SetViewStateResponse, TabResponse, TableFilter$1 as TableFilter, TableKey, ThemeChangedNotification, ThemeType, ViewLoadedNotification, WindowEventClass, WindowEventInits, WindowEventNotification };
package/dist/index.js CHANGED
@@ -83,43 +83,112 @@ function notify(name, args) {
83
83
  window.parent.postMessage(payload, "*");
84
84
  }
85
85
  const notificationListeners = new Map();
86
- async function addNotificationListener(name, handler) {
86
+ function addNotificationListener(name, handler) {
87
87
  if (!notificationListeners.get(name)) {
88
88
  notificationListeners.set(name, []);
89
89
  }
90
90
  notificationListeners.get(name).push(handler);
91
91
  }
92
+ function removeNotificationListener(name, handler) {
93
+ const handlers = notificationListeners.get(name);
94
+ if (handlers) {
95
+ const index = handlers.indexOf(handler);
96
+ if (index > -1) {
97
+ handlers.splice(index, 1);
98
+ }
99
+ }
100
+ }
92
101
 
102
+ /**
103
+ * Get a list of tables from the current database.
104
+ * @since Beekeeper Studio 5.3.0
105
+ **/
93
106
  async function getTables(schema) {
94
107
  return await request({ name: "getTables", args: { schema } });
95
108
  }
109
+ /**
110
+ * Get a list of columns from a table.
111
+ *
112
+ * @since Beekeeper Studio 5.3.0
113
+ **/
96
114
  async function getColumns(table, schema) {
97
115
  return await request({ name: "getColumns", args: { table, schema } });
98
116
  }
117
+ /** @since Beekeeper Studio 5.4.0 */
118
+ async function getTableKeys(table, schema) {
119
+ return await request({ name: "getTableKeys", args: { table, schema } });
120
+ }
121
+ /**
122
+ * Get information about the current database connection.
123
+ *
124
+ * @since Beekeeper Studio 5.3.0
125
+ **/
99
126
  async function getConnectionInfo() {
100
127
  return await request({ name: "getConnectionInfo", args: void 0 });
101
128
  }
102
- async function getAllTabs() {
103
- return await request({ name: "getAllTabs", args: void 0 });
104
- }
129
+ /** @since Beekeeper Studio 5.4.0 */
130
+ async function getAppInfo() {
131
+ return await request({ name: "getAppInfo", args: void 0 });
132
+ }
133
+ /**
134
+ * Check if plugin's update is available.
135
+ *
136
+ * @since Beekeeper Studio 5.4.0
137
+ **/
138
+ async function checkForUpdate() {
139
+ return await request({ name: "checkForUpdate", args: void 0 });
140
+ }
141
+ /**
142
+ * Execute a SQL query against the current database.
143
+ *
144
+ * WARNING: The query will be executed exactly as provided with no modification
145
+ * or sanitization. Always validate and sanitize user input before including it
146
+ * in queries to prevent unwanted actions.
147
+ *
148
+ * @since Beekeeper Studio 5.3.0
149
+ **/
105
150
  async function runQuery(query) {
106
151
  return await request({ name: "runQuery", args: { query } });
107
152
  }
153
+ /**
154
+ * Display query results in the bottom table panel (shell-type tabs only).
155
+ *
156
+ * @since Beekeeper Studio 5.3.0
157
+ **/
108
158
  async function expandTableResult(results) {
109
159
  return await request({ name: "expandTableResult", args: { results } });
110
160
  }
161
+ /**
162
+ * Set the title of the current plugin tab.
163
+ *
164
+ * @since Beekeeper Studio 5.3.0
165
+ **/
111
166
  async function setTabTitle(title) {
112
167
  return await request({ name: "setTabTitle", args: { title } });
113
168
  }
169
+ /**
170
+ * Get the current state of your view instance.
171
+ *
172
+ * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}
173
+ * @since Beekeeper Studio 5.3.0
174
+ **/
114
175
  async function getViewState() {
115
176
  return await request({ name: "getViewState", args: void 0 });
116
177
  }
178
+ /**
179
+ * Set the state of your view instance.
180
+ *
181
+ * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}
182
+ * @since Beekeeper Studio 5.3.0
183
+ **/
117
184
  async function setViewState(state) {
118
185
  return await request({ name: "setViewState", args: { state } });
119
186
  }
187
+ /** @since Beekeeper Studio 5.3.0 */
120
188
  async function openExternal(link) {
121
189
  return await request({ name: "openExternal", args: { link } });
122
190
  }
191
+ /** @since Beekeeper Studio 5.3.0 */
123
192
  async function getData(key = "default") {
124
193
  return await request({ name: "getData", args: { key } });
125
194
  }
@@ -131,6 +200,7 @@ async function setData(keyOrValue, value) {
131
200
  return await request({ name: "setData", args: { key: "default", value: keyOrValue } });
132
201
  }
133
202
  }
203
+ /** @since Beekeeper Studio 5.3.0 */
134
204
  async function getEncryptedData(key) {
135
205
  return await request({ name: "getEncryptedData", args: { key } });
136
206
  }
@@ -165,5 +235,5 @@ const clipboard = {
165
235
  // async read() {},
166
236
  };
167
237
 
168
- export { addNotificationListener, clipboard, expandTableResult, getAllTabs, getColumns, getConnectionInfo, getData, getEncryptedData, getTables, getViewState, notify, openExternal, openTab, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
238
+ export { addNotificationListener, checkForUpdate, clipboard, expandTableResult, getAppInfo, getColumns, getConnectionInfo, getData, getEncryptedData, getTableKeys, getTables, getViewState, notify, openExternal, openTab, removeNotificationListener, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
169
239
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/utils.ts","../src/comms.ts","../src/index.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 { PluginRequestPayload } from \"./requestTypes\";\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 // The whole payload is kept just in case for debugging\n payload: PluginRequestPayload;\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, payload } = pendingRequests.get(id)!;\n pendingRequests.delete(id);\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [RESPONSE] ${payload.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(raw: any): Promise<any> {\n const payload = { id: generateUUID(), ...raw } as PluginRequestPayload;\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [REQUEST] ${payload.name}`);\n console.log(\"id:\", payload.id);\n console.log(\"args:\", payload.args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n\n return new Promise<any>((resolve, reject) => {\n try {\n pendingRequests.set(payload.id, { payload: payload, resolve, reject });\n window.parent.postMessage(payload, \"*\");\n } catch (e) {\n reject(e);\n }\n });\n}\n\nexport function notify(name: string, args: any) {\n const payload = { name, args }\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"args:\", args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n window.parent.postMessage(payload, \"*\");\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","import { request } from \"./comms\";\nimport type {\n GetTablesRequest,\n GetColumnsRequest,\n RunQueryRequest,\n ExpandTableResultRequest,\n SetTabTitleRequest,\n SetViewStateRequest,\n OpenExternalRequest,\n SetDataRequest,\n SetEncryptedDataRequest,\n OpenTabRequest,\n OpenQueryTabRequest,\n OpenTableTableTabRequest,\n OpenTableStructureTabRequest,\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 GetDataResponse,\n SetDataResponse,\n GetEncryptedDataResponse,\n SetEncryptedDataResponse,\n OpenTabResponse,\n} from \"./responseTypes\";\n\nexport async function getTables(schema?: string): Promise<GetTablesResponse['result']> {\n return await request({ name: \"getTables\", args: { schema } as GetTablesRequest['args'] });\n}\n\nexport async function getColumns(table: string, schema?: string): Promise<GetColumnsResponse['result']> {\n return await request({ name: \"getColumns\", args: { table, schema } as GetColumnsRequest['args'] });\n}\n\nexport async function getConnectionInfo(): Promise<GetConnectionInfoResponse['result']> {\n return await request({ name: \"getConnectionInfo\", args: void 0 });\n}\n\nexport async function getAllTabs(): Promise<GetAllTabsResponse['result']> {\n return await request({ name: \"getAllTabs\", args: void 0 });\n}\n\nexport async function runQuery(query: string): Promise<RunQueryResponse['result']> {\n return await request({ name: \"runQuery\", args: { query } as RunQueryRequest['args'] });\n}\n\nexport async function expandTableResult(results: any[]): Promise<ExpandTableResultResponse['result']> {\n return await request({ name: \"expandTableResult\", args: { results } as ExpandTableResultRequest['args'] });\n}\n\nexport async function setTabTitle(title: string): Promise<SetTabTitleResponse['result']> {\n return await request({ name: \"setTabTitle\", args: { title } as SetTabTitleRequest['args'] });\n}\n\nexport async function getViewState<T>(): Promise<GetViewStateResponse<T>['result']> {\n return await request({ name: \"getViewState\", args: void 0 });\n}\n\nexport async function setViewState<T>(state: T): Promise<SetViewStateResponse['result']> {\n return await request({ name: \"setViewState\", args: { state } as SetViewStateRequest<T>['args'] });\n}\n\nexport async function openExternal(link: string): Promise<OpenExternalResponse['result']> {\n return await request({ name: \"openExternal\", args: { link } as OpenExternalRequest['args'] });\n}\n\nexport async function getData<T>(key: string = \"default\"): Promise<GetDataResponse<T>['result']> {\n return await request({ name: \"getData\", args: { key } });\n}\n\n/**\n * Store data that can be retrieved later.\n * \n * @example\n * // Store with custom key\n * await setData(\"myKey\", { name: \"John\" });\n * \n * // Store with default key (equivalent to setData(\"default\", value))\n * await setData({ name: \"John\" });\n */\nexport async function setData<T>(key: string, value: T): Promise<SetDataResponse['result']>;\nexport async function setData<T>(value: T): Promise<SetDataResponse['result']>;\nexport async function setData<T>(keyOrValue: string | T, value?: T): Promise<SetDataResponse['result']> {\n if (value !== undefined) {\n return await request({ name: \"setData\", args: { key: keyOrValue as string, value } as SetDataRequest<T>['args'] });\n } else {\n return await request({ name: \"setData\", args: { key: \"default\", value: keyOrValue as T } as SetDataRequest<T>['args'] });\n }\n}\n\nexport async function getEncryptedData<T>(key: string): Promise<GetEncryptedDataResponse<T>['result']> {\n return await request({ name: \"getEncryptedData\", args: { key } });\n}\n\n/**\n * Store encrypted data that can be retrieved later.\n * \n * @example\n * // Store with custom key\n * await setEncryptedData(\"secretKey\", { token: \"abc123\" });\n * \n * // Store with default key (equivalent to setEncryptedData(\"default\", value))\n * await setEncryptedData({ token: \"abc123\" });\n */\nexport async function setEncryptedData<T>(key: string, value: T): Promise<SetEncryptedDataResponse['result']>;\nexport async function setEncryptedData<T>(value: T): Promise<SetEncryptedDataResponse['result']>;\nexport async function setEncryptedData<T>(keyOrValue: string | T, value?: T): Promise<SetEncryptedDataResponse['result']> {\n if (value !== undefined) {\n return await request({ name: \"setEncryptedData\", args: { key: keyOrValue as string, value } as SetEncryptedDataRequest<T>['args'] });\n } else {\n return await request({ name: \"setEncryptedData\", args: { key: \"default\", value: keyOrValue as T } as SetEncryptedDataRequest<T>['args'] });\n }\n}\n\nexport async function openTab(type: \"query\", args: Omit<OpenQueryTabRequest['args'], 'type'>): Promise<OpenTabResponse>;\nexport async function openTab(type: \"tableTable\", args: Omit<OpenTableTableTabRequest['args'], 'type'>): Promise<OpenTabResponse>;\nexport async function openTab(type: \"tableStructure\", args: Omit<OpenTableStructureTabRequest['args'], 'type'>): Promise<OpenTabResponse>;\nexport async function openTab(type: OpenTabRequest['args']['type'], args: Omit<OpenTabRequest['args'], 'type'>): Promise<OpenTabResponse> {\n return await request({ name: \"openTab\", args: { type, ...args } });\n}\n\n/** Clipboard interface. */\nexport const clipboard = {\n /** Write text to the Electron clipboard. */\n async writeText(text: string): Promise<void> {\n await request({\n name: \"clipboard.writeText\",\n args: { text },\n });\n },\n /** Read text from the Electron clipboard. */\n async readText(): Promise<string> {\n return await request({\n name: \"clipboard.readText\",\n args: void 0,\n });\n },\n // async write() {},\n // async read() {},\n};\n\nexport * from \"./commonTypes\";\nexport * from \"./requestTypes\";\nexport * from \"./responseTypes\";\nexport * from \"./notificationTypes\";\nexport * from \"./comms\";\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,IAAI,IAAI,CAAC;AAChC,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC;AAEhC,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IAE5E,OAAO;AAC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9I;AAKO,eAAe,OAAO,CAAC,IAAoC,EAAE,IAA0C,EAAA;AAC5G,IAAA,OAAO,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC;AACpE;AAEA;AACa,MAAA,SAAS,GAAG;;IAEvB,MAAM,SAAS,CAAC,IAAY,EAAA;AAC1B,QAAA,MAAM,OAAO,CAAC;AACZ,YAAA,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,EAAE,IAAI,EAAE;AACf,SAAA,CAAC;KACH;;AAED,IAAA,MAAM,QAAQ,GAAA;QACZ,OAAO,MAAM,OAAO,CAAC;AACnB,YAAA,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,MAAM;AACb,SAAA,CAAC;KACH;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/utils.ts","../src/comms.ts","../src/index.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 { JsonValue } from \"./commonTypes\";\nimport {\n BroadcastNotification,\n PluginErrorNotification,\n ThemeChangedNotification,\n ViewLoadedNotification,\n WindowEventNotification,\n} from \"./notificationTypes\";\nimport type { PluginRequestPayload } from \"./requestTypes\";\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 // The whole payload is kept just in case for debugging\n payload: PluginRequestPayload;\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, payload } = pendingRequests.get(id)!;\n pendingRequests.delete(id);\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [RESPONSE] ${payload.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(raw: any): Promise<any> {\n const payload = { id: generateUUID(), ...raw } as PluginRequestPayload;\n\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [REQUEST] ${payload.name}`);\n console.log(\"id:\", payload.id);\n console.log(\"args:\", payload.args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n\n return new Promise<any>((resolve, reject) => {\n try {\n pendingRequests.set(payload.id, { payload: payload, resolve, reject });\n window.parent.postMessage(payload, \"*\");\n } catch (e) {\n reject(e);\n }\n });\n}\n\nexport function notify<Message extends JsonValue = JsonValue>(\n name: BroadcastNotification[\"name\"],\n args: BroadcastNotification<Message>[\"args\"],\n): void;\nexport function notify(\n name: PluginErrorNotification[\"name\"],\n args: PluginErrorNotification[\"args\"],\n): void;\nexport function notify(\n name: WindowEventNotification[\"name\"],\n args: WindowEventNotification[\"args\"],\n): void;\nexport function notify(name: string, args: any) {\n const payload = { name, args };\n if (debugComms) {\n const time = new Date().toLocaleTimeString(\"en-GB\");\n console.groupCollapsed(`${time} [NOTIFICATION] ${name}`);\n console.log(\"args:\", args);\n console.log(\"payload:\", payload);\n console.groupEnd();\n }\n window.parent.postMessage(payload, \"*\");\n}\n\nconst notificationListeners = new Map<string, ((args: any) => void)[]>();\n\nexport function addNotificationListener<Message extends JsonValue = JsonValue>(\n name: BroadcastNotification[\"name\"],\n handler: (args: BroadcastNotification<Message>[\"args\"]) => void,\n): void;\nexport function addNotificationListener(\n name: ViewLoadedNotification[\"name\"],\n handler: (args: ViewLoadedNotification[\"args\"]) => void,\n): void;\nexport function addNotificationListener(\n name: ThemeChangedNotification[\"name\"],\n handler: (args: ThemeChangedNotification[\"args\"]) => void,\n): void;\nexport 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\nexport function removeNotificationListener(\n name: string,\n handler: (args: any) => void,\n) {\n const handlers = notificationListeners.get(name);\n if (handlers) {\n const index = handlers.indexOf(handler);\n if (index > -1) {\n handlers.splice(index, 1);\n }\n }\n}\n","import { request } from \"./comms\";\nimport type {\n GetTablesRequest,\n GetColumnsRequest,\n RunQueryRequest,\n ExpandTableResultRequest,\n SetTabTitleRequest,\n SetViewStateRequest,\n OpenExternalRequest,\n SetDataRequest,\n SetEncryptedDataRequest,\n OpenTabRequest,\n OpenQueryTabRequest,\n OpenTableTableTabRequest,\n OpenTableStructureTabRequest,\n GetTableKeysRequest,\n} from \"./requestTypes\";\nimport type {\n GetTablesResponse,\n GetColumnsResponse,\n GetConnectionInfoResponse,\n RunQueryResponse,\n ExpandTableResultResponse,\n SetTabTitleResponse,\n GetViewStateResponse,\n SetViewStateResponse,\n OpenExternalResponse,\n GetDataResponse,\n SetDataResponse,\n GetEncryptedDataResponse,\n SetEncryptedDataResponse,\n OpenTabResponse,\n GetTableKeysResponse,\n GetAppInfoResponse,\n CheckForUpdateResponse,\n} from \"./responseTypes\";\n\n/**\n * Get a list of tables from the current database.\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function getTables(schema?: string): Promise<GetTablesResponse['result']> {\n return await request({ name: \"getTables\", args: { schema } as GetTablesRequest['args'] });\n}\n\n/**\n * Get a list of columns from a table.\n *\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function getColumns(table: string, schema?: string): Promise<GetColumnsResponse['result']> {\n return await request({ name: \"getColumns\", args: { table, schema } as GetColumnsRequest['args'] });\n}\n\n/** @since Beekeeper Studio 5.4.0 */\nexport async function getTableKeys(table: string, schema?: string): Promise<GetTableKeysResponse['result']> {\n return await request({ name: \"getTableKeys\", args: { table, schema } as GetTableKeysRequest['args'] });\n}\n\n/**\n * Get information about the current database connection.\n *\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function getConnectionInfo(): Promise<GetConnectionInfoResponse['result']> {\n return await request({ name: \"getConnectionInfo\", args: void 0 });\n}\n\n/** @since Beekeeper Studio 5.4.0 */\nexport async function getAppInfo(): Promise<GetAppInfoResponse['result']> {\n return await request({ name: \"getAppInfo\", args: void 0 });\n}\n\n/**\n * Check if plugin's update is available.\n *\n * @since Beekeeper Studio 5.4.0\n **/\nexport async function checkForUpdate(): Promise<CheckForUpdateResponse['result']> {\n return await request({ name: \"checkForUpdate\", args: void 0 });\n}\n\n/**\n * Execute a SQL query against the current database.\n *\n * WARNING: The query will be executed exactly as provided with no modification\n * or sanitization. Always validate and sanitize user input before including it\n * in queries to prevent unwanted actions.\n *\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function runQuery(query: string): Promise<RunQueryResponse['result']> {\n return await request({ name: \"runQuery\", args: { query } as RunQueryRequest['args'] });\n}\n\n/**\n * Display query results in the bottom table panel (shell-type tabs only).\n *\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function expandTableResult(results: any[]): Promise<ExpandTableResultResponse['result']> {\n return await request({ name: \"expandTableResult\", args: { results } as ExpandTableResultRequest['args'] });\n}\n\n/**\n * Set the title of the current plugin tab.\n *\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function setTabTitle(title: string): Promise<SetTabTitleResponse['result']> {\n return await request({ name: \"setTabTitle\", args: { title } as SetTabTitleRequest['args'] });\n}\n\n/**\n * Get the current state of your view instance.\n *\n * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function getViewState<T>(): Promise<GetViewStateResponse<T>['result']> {\n return await request({ name: \"getViewState\", args: void 0 });\n}\n\n/**\n * Set the state of your view instance.\n *\n * @see {@link https://docs.beekeeperstudio.io/plugin_development/plugin-views/#view-state|View State}\n * @since Beekeeper Studio 5.3.0\n **/\nexport async function setViewState<T>(state: T): Promise<SetViewStateResponse['result']> {\n return await request({ name: \"setViewState\", args: { state } as SetViewStateRequest<T>['args'] });\n}\n\n/** @since Beekeeper Studio 5.3.0 */\nexport async function openExternal(link: string): Promise<OpenExternalResponse['result']> {\n return await request({ name: \"openExternal\", args: { link } as OpenExternalRequest['args'] });\n}\n\n/** @since Beekeeper Studio 5.3.0 */\nexport async function getData<T>(key: string = \"default\"): Promise<GetDataResponse<T>['result']> {\n return await request({ name: \"getData\", args: { key } });\n}\n\n/**\n * Store data that can be retrieved later.\n * \n * @example\n * // Store with custom key\n * await setData(\"myKey\", { name: \"John\" });\n * \n * // Store with default key (equivalent to setData(\"default\", value))\n * await setData({ name: \"John\" });\n *\n * @since Beekeeper Studio 5.3.0\n */\nexport async function setData<T>(key: string, value: T): Promise<SetDataResponse['result']>;\nexport async function setData<T>(value: T): Promise<SetDataResponse['result']>;\nexport async function setData<T>(keyOrValue: string | T, value?: T): Promise<SetDataResponse['result']> {\n if (value !== undefined) {\n return await request({ name: \"setData\", args: { key: keyOrValue as string, value } as SetDataRequest<T>['args'] });\n } else {\n return await request({ name: \"setData\", args: { key: \"default\", value: keyOrValue as T } as SetDataRequest<T>['args'] });\n }\n}\n\n/** @since Beekeeper Studio 5.3.0 */\nexport async function getEncryptedData<T>(key: string): Promise<GetEncryptedDataResponse<T>['result']> {\n return await request({ name: \"getEncryptedData\", args: { key } });\n}\n\n/**\n * Store encrypted data that can be retrieved later.\n * \n * @example\n * // Store with custom key\n * await setEncryptedData(\"secretKey\", { token: \"abc123\" });\n * \n * // Store with default key (equivalent to setEncryptedData(\"default\", value))\n * await setEncryptedData({ token: \"abc123\" });\n *\n * @since Beekeeper Studio 5.3.0\n */\nexport async function setEncryptedData<T>(key: string, value: T): Promise<SetEncryptedDataResponse['result']>;\nexport async function setEncryptedData<T>(value: T): Promise<SetEncryptedDataResponse['result']>;\nexport async function setEncryptedData<T>(keyOrValue: string | T, value?: T): Promise<SetEncryptedDataResponse['result']> {\n if (value !== undefined) {\n return await request({ name: \"setEncryptedData\", args: { key: keyOrValue as string, value } as SetEncryptedDataRequest<T>['args'] });\n } else {\n return await request({ name: \"setEncryptedData\", args: { key: \"default\", value: keyOrValue as T } as SetEncryptedDataRequest<T>['args'] });\n }\n}\n\n/** @since Beekeeper Studio 5.4.0 */\nexport async function openTab(type: \"query\", args?: Omit<OpenQueryTabRequest['args'], 'type'>): Promise<OpenTabResponse>;\nexport async function openTab(type: \"tableTable\", args: Omit<OpenTableTableTabRequest['args'], 'type'>): Promise<OpenTabResponse>;\nexport async function openTab(type: \"tableStructure\", args: Omit<OpenTableStructureTabRequest['args'], 'type'>): Promise<OpenTabResponse>;\nexport async function openTab(type: OpenTabRequest['args']['type'], args?: Omit<OpenTabRequest['args'], 'type'>): Promise<OpenTabResponse> {\n return await request({ name: \"openTab\", args: { type, ...args } });\n}\n\n/** Clipboard interface. */\nexport const clipboard = {\n /** Write text to the Electron clipboard. */\n async writeText(text: string): Promise<void> {\n await request({\n name: \"clipboard.writeText\",\n args: { text },\n });\n },\n /** Read text from the Electron clipboard. */\n async readText(): Promise<string> {\n return await request({\n name: \"clipboard.readText\",\n args: void 0,\n });\n },\n // async write() {},\n // async read() {},\n};\n\nexport * from \"./commonTypes\";\nexport * from \"./requestTypes\";\nexport * from \"./responseTypes\";\nexport * from \"./notificationTypes\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,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,UAAe,EAAwC,EAAE,CAAC;;AAE9I;AAMO,eAAe,OAAO,CAAC,IAAoC,EAAE,IAA2C,EAAA;AAC7G,IAAA,OAAO,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC;AACpE;AAEA;AACa,MAAA,SAAS,GAAG;;IAEvB,MAAM,SAAS,CAAC,IAAY,EAAA;AAC1B,QAAA,MAAM,OAAO,CAAC;AACZ,YAAA,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,EAAE,IAAI,EAAE;AACf,SAAA,CAAC;KACH;;AAED,IAAA,MAAM,QAAQ,GAAA;QACZ,OAAO,MAAM,OAAO,CAAC;AACnB,YAAA,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,MAAM;AACb,SAAA,CAAC;KACH;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beekeeperstudio/plugin",
3
- "version": "1.4.0-beta.1",
3
+ "version": "1.4.0-beta.2",
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",