@beekeeperstudio/plugin 1.4.0-beta.3 → 1.4.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eventForwarder.js.map +1 -1
- package/dist/index.d.ts +28 -14
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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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,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 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: 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":"AAmBA,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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E,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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ type TableFilter$1 = {
|
|
|
25
25
|
field: string;
|
|
26
26
|
type: "=" | "!=" | "like" | "not like" | "<" | "<=" | ">" | ">=" | "in" | "is" | "is not";
|
|
27
27
|
value?: string | string[];
|
|
28
|
-
op?:
|
|
28
|
+
op?: "AND" | "OR";
|
|
29
29
|
};
|
|
30
30
|
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
31
31
|
[key: string]: JsonValue;
|
|
@@ -76,6 +76,10 @@ type CornerMenuParams = {
|
|
|
76
76
|
activeRange: ActiveRange;
|
|
77
77
|
};
|
|
78
78
|
type LoadViewParams = CornerMenuParams | RowMenuParams | ColumnMenuParams | CellMenuParams;
|
|
79
|
+
type PluginViewContext = {
|
|
80
|
+
command: string;
|
|
81
|
+
params?: CellMenuParams | ColumnMenuParams | RowMenuParams | CornerMenuParams;
|
|
82
|
+
};
|
|
79
83
|
|
|
80
84
|
interface BaseRequest {
|
|
81
85
|
id: string;
|
|
@@ -126,6 +130,10 @@ interface SetTabTitleRequest extends BaseRequest {
|
|
|
126
130
|
title: string;
|
|
127
131
|
};
|
|
128
132
|
}
|
|
133
|
+
type GetViewContextRequest = BaseRequest & {
|
|
134
|
+
name: "getViewContext";
|
|
135
|
+
args: void;
|
|
136
|
+
};
|
|
129
137
|
interface GetViewStateRequest extends BaseRequest {
|
|
130
138
|
name: "getViewState";
|
|
131
139
|
args: void;
|
|
@@ -209,7 +217,7 @@ type CheckForUpdateRequest = BaseRequest & {
|
|
|
209
217
|
args: void;
|
|
210
218
|
};
|
|
211
219
|
type OpenTabRequest = OpenQueryTabRequest | OpenTableTableTabRequest | OpenTableStructureTabRequest;
|
|
212
|
-
type PluginRequestData = GetTablesRequest | GetColumnsRequest | GetTableKeysRequest | GetAppInfoRequest | GetConnectionInfoRequest | RunQueryRequest | ExpandTableResultRequest | SetTabTitleRequest | GetViewStateRequest | SetViewStateRequest<unknown> | OpenExternalRequest | GetDataRequest | SetDataRequest<unknown> | GetEncryptedDataRequest | SetEncryptedDataRequest<unknown> | ClipboardWriteTextRequest | ClipboardReadTextRequest | OpenTabRequest | CheckForUpdateRequest;
|
|
220
|
+
type PluginRequestData = GetTablesRequest | GetColumnsRequest | GetTableKeysRequest | GetAppInfoRequest | GetConnectionInfoRequest | RunQueryRequest | ExpandTableResultRequest | SetTabTitleRequest | GetViewContextRequest | GetViewStateRequest | SetViewStateRequest<unknown> | OpenExternalRequest | GetDataRequest | SetDataRequest<unknown> | GetEncryptedDataRequest | SetEncryptedDataRequest<unknown> | ClipboardWriteTextRequest | ClipboardReadTextRequest | OpenTabRequest | CheckForUpdateRequest;
|
|
213
221
|
type PluginRequestPayload = PluginRequestData;
|
|
214
222
|
|
|
215
223
|
type AppTheme = {
|
|
@@ -243,14 +251,7 @@ type BroadcastNotification<Message extends JsonValue = JsonValue> = {
|
|
|
243
251
|
message: Message;
|
|
244
252
|
};
|
|
245
253
|
};
|
|
246
|
-
type
|
|
247
|
-
name: "viewLoaded";
|
|
248
|
-
args: {
|
|
249
|
-
command: string;
|
|
250
|
-
params?: CellMenuParams | ColumnMenuParams | RowMenuParams | CornerMenuParams;
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
type PluginNotificationData = ThemeChangedNotification | WindowEventNotification | PluginErrorNotification | ViewLoadedNotification | BroadcastNotification;
|
|
254
|
+
type PluginNotificationData = ThemeChangedNotification | WindowEventNotification | PluginErrorNotification | BroadcastNotification;
|
|
254
255
|
|
|
255
256
|
type TabType = string;
|
|
256
257
|
type TableFilter = any;
|
|
@@ -303,6 +304,9 @@ interface ExpandTableResultResponse extends BaseResponse {
|
|
|
303
304
|
interface SetTabTitleResponse extends BaseResponse {
|
|
304
305
|
result: void;
|
|
305
306
|
}
|
|
307
|
+
type GetViewContextResponse = BaseResponse & {
|
|
308
|
+
result: PluginViewContext;
|
|
309
|
+
};
|
|
306
310
|
interface GetViewStateResponse<T extends unknown> extends BaseResponse {
|
|
307
311
|
result: T;
|
|
308
312
|
}
|
|
@@ -336,7 +340,7 @@ interface OpenTabResponse extends BaseResponse {
|
|
|
336
340
|
interface CheckForUpdateResponse extends BaseResponse {
|
|
337
341
|
result: boolean;
|
|
338
342
|
}
|
|
339
|
-
type PluginResponseData = GetTablesResponse | GetColumnsResponse | GetTableKeysResponse | GetConnectionInfoResponse | RunQueryResponse | ExpandTableResultResponse | SetTabTitleResponse | GetViewStateResponse<unknown> | SetViewStateResponse | OpenExternalResponse | GetDataResponse<unknown> | SetDataResponse | GetEncryptedDataResponse<unknown> | SetEncryptedDataResponse | ClipboardWriteTextResponse | ClipboardReadTextResponse | OpenTabResponse | CheckForUpdateResponse;
|
|
343
|
+
type PluginResponseData = GetTablesResponse | GetColumnsResponse | GetTableKeysResponse | GetConnectionInfoResponse | RunQueryResponse | ExpandTableResultResponse | SetTabTitleResponse | GetViewContextResponse | GetViewStateResponse<unknown> | SetViewStateResponse | OpenExternalResponse | GetDataResponse<unknown> | SetDataResponse | GetEncryptedDataResponse<unknown> | SetEncryptedDataResponse | ClipboardWriteTextResponse | ClipboardReadTextResponse | OpenTabResponse | CheckForUpdateResponse;
|
|
340
344
|
type PluginResponsePayload = PluginResponseData;
|
|
341
345
|
type TabResponse = BaseTabResponse | QueryTabResponse | TableTabResponse;
|
|
342
346
|
interface BaseTabResponse {
|
|
@@ -373,7 +377,6 @@ declare function notify<Message extends JsonValue = JsonValue>(name: BroadcastNo
|
|
|
373
377
|
declare function notify(name: PluginErrorNotification["name"], args: PluginErrorNotification["args"]): void;
|
|
374
378
|
declare function notify(name: WindowEventNotification["name"], args: WindowEventNotification["args"]): void;
|
|
375
379
|
declare function addNotificationListener<Message extends JsonValue = JsonValue>(name: BroadcastNotification["name"], handler: (args: BroadcastNotification<Message>["args"]) => void): void;
|
|
376
|
-
declare function addNotificationListener(name: ViewLoadedNotification["name"], handler: (args: ViewLoadedNotification["args"]) => void): void;
|
|
377
380
|
declare function addNotificationListener(name: ThemeChangedNotification["name"], handler: (args: ThemeChangedNotification["args"]) => void): void;
|
|
378
381
|
declare function removeNotificationListener(name: string, handler: (args: any) => void): void;
|
|
379
382
|
|
|
@@ -426,6 +429,17 @@ declare function expandTableResult(results: any[]): Promise<ExpandTableResultRes
|
|
|
426
429
|
* @since Beekeeper Studio 5.3.0
|
|
427
430
|
**/
|
|
428
431
|
declare function setTabTitle(title: string): Promise<SetTabTitleResponse['result']>;
|
|
432
|
+
/**
|
|
433
|
+
* Get the current view context.
|
|
434
|
+
*
|
|
435
|
+
* A view context describes how this plugin view was opened and what data is
|
|
436
|
+
* available for it. It always includes the static `command` from your
|
|
437
|
+
* `manifest.json`, and may also include dynamic `params` depending on where
|
|
438
|
+
* the menu was invoked.
|
|
439
|
+
*
|
|
440
|
+
* @since Beekeeper Studio 5.4.0
|
|
441
|
+
**/
|
|
442
|
+
declare function getViewContext(): Promise<GetViewContextResponse['result']>;
|
|
429
443
|
/**
|
|
430
444
|
* Get the current state of your view instance.
|
|
431
445
|
*
|
|
@@ -486,5 +500,5 @@ declare const clipboard: {
|
|
|
486
500
|
readText(): Promise<string>;
|
|
487
501
|
};
|
|
488
502
|
|
|
489
|
-
export { addNotificationListener, checkForUpdate, clipboard, expandTableResult, getAppInfo, getColumns, getConnectionInfo, getData, getEncryptedData, getTableKeys, getTables, getViewState, notify, openExternal, openTab, removeNotificationListener, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
|
|
490
|
-
export type { ActiveRange, AppTheme, BroadcastNotification, CellMenuParams, CellMenuTarget, CheckForUpdateRequest, CheckForUpdateResponse, ClipboardReadTextRequest, ClipboardReadTextResponse, ClipboardWriteTextRequest, ClipboardWriteTextResponse, ColumnMenuParams, ColumnMenuTarget, CornerMenuParams, CornerMenuTarget, ExpandTableResultRequest, ExpandTableResultResponse, GetAppInfoRequest, GetAppInfoResponse, GetColumnsRequest, GetColumnsResponse, GetConnectionInfoRequest, GetConnectionInfoResponse, GetDataRequest, GetDataResponse, GetEncryptedDataRequest, GetEncryptedDataResponse, GetTableKeysRequest, GetTableKeysResponse, GetTablesRequest, GetTablesResponse, GetViewStateRequest, GetViewStateResponse, JsonValue, LoadViewParams, OpenExternalRequest, OpenExternalResponse, OpenQueryTabRequest, OpenTabRequest, OpenTabResponse, OpenTableStructureTabRequest, OpenTableTableTabRequest, PluginErrorNotification, PluginNotificationData, PluginRequestData, PluginRequestPayload, PluginResponseData, PluginResponsePayload, QueryResult, RowMenuParams, RowMenuTarget, RunQueryRequest, RunQueryResponse, SetDataRequest, SetDataResponse, SetEncryptedDataRequest, SetEncryptedDataResponse, SetTabTitleRequest, SetTabTitleResponse, SetViewStateRequest, SetViewStateResponse, TabResponse, TableFilter$1 as TableFilter, TableKey, ThemeChangedNotification, ThemeType,
|
|
503
|
+
export { addNotificationListener, checkForUpdate, clipboard, expandTableResult, getAppInfo, getColumns, getConnectionInfo, getData, getEncryptedData, getTableKeys, getTables, getViewContext, getViewState, notify, openExternal, openTab, removeNotificationListener, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
|
|
504
|
+
export type { ActiveRange, AppTheme, BroadcastNotification, CellMenuParams, CellMenuTarget, CheckForUpdateRequest, CheckForUpdateResponse, ClipboardReadTextRequest, ClipboardReadTextResponse, ClipboardWriteTextRequest, ClipboardWriteTextResponse, ColumnMenuParams, ColumnMenuTarget, CornerMenuParams, CornerMenuTarget, ExpandTableResultRequest, ExpandTableResultResponse, GetAppInfoRequest, GetAppInfoResponse, GetColumnsRequest, GetColumnsResponse, GetConnectionInfoRequest, GetConnectionInfoResponse, GetDataRequest, GetDataResponse, GetEncryptedDataRequest, GetEncryptedDataResponse, GetTableKeysRequest, GetTableKeysResponse, GetTablesRequest, GetTablesResponse, GetViewContextRequest, GetViewContextResponse, GetViewStateRequest, GetViewStateResponse, JsonValue, LoadViewParams, OpenExternalRequest, OpenExternalResponse, OpenQueryTabRequest, OpenTabRequest, OpenTabResponse, OpenTableStructureTabRequest, OpenTableTableTabRequest, PluginErrorNotification, PluginNotificationData, PluginRequestData, PluginRequestPayload, PluginResponseData, PluginResponsePayload, PluginViewContext, QueryResult, RowMenuParams, RowMenuTarget, RunQueryRequest, RunQueryResponse, SetDataRequest, SetDataResponse, SetEncryptedDataRequest, SetEncryptedDataResponse, SetTabTitleRequest, SetTabTitleResponse, SetViewStateRequest, SetViewStateResponse, TabResponse, TableFilter$1 as TableFilter, TableKey, ThemeChangedNotification, ThemeType, WindowEventClass, WindowEventInits, WindowEventNotification };
|
package/dist/index.js
CHANGED
|
@@ -166,6 +166,19 @@ async function expandTableResult(results) {
|
|
|
166
166
|
async function setTabTitle(title) {
|
|
167
167
|
return await request({ name: "setTabTitle", args: { title } });
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Get the current view context.
|
|
171
|
+
*
|
|
172
|
+
* A view context describes how this plugin view was opened and what data is
|
|
173
|
+
* available for it. It always includes the static `command` from your
|
|
174
|
+
* `manifest.json`, and may also include dynamic `params` depending on where
|
|
175
|
+
* the menu was invoked.
|
|
176
|
+
*
|
|
177
|
+
* @since Beekeeper Studio 5.4.0
|
|
178
|
+
**/
|
|
179
|
+
async function getViewContext() {
|
|
180
|
+
return await request({ name: "getViewContext", args: void 0 });
|
|
181
|
+
}
|
|
169
182
|
/**
|
|
170
183
|
* Get the current state of your view instance.
|
|
171
184
|
*
|
|
@@ -235,5 +248,5 @@ const clipboard = {
|
|
|
235
248
|
// async read() {},
|
|
236
249
|
};
|
|
237
250
|
|
|
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 };
|
|
251
|
+
export { addNotificationListener, checkForUpdate, clipboard, expandTableResult, getAppInfo, getColumns, getConnectionInfo, getData, getEncryptedData, getTableKeys, getTables, getViewContext, getViewState, notify, openExternal, openTab, removeNotificationListener, request, runQuery, setData, setDebugComms, setEncryptedData, setTabTitle, setViewState };
|
|
239
252
|
//# 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 { 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\";\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;AACL,QAAA,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CA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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 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: 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 GetViewContextResponse,\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 view context.\n *\n * A view context describes how this plugin view was opened and what data is\n * available for it. It always includes the static `command` from your\n * `manifest.json`, and may also include dynamic `params` depending on where\n * the menu was invoked.\n *\n * @since Beekeeper Studio 5.4.0\n **/\nexport async function getViewContext(): Promise<GetViewContextResponse['result']> {\n return await request({ name: \"getViewContext\", args: void 0 });\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\";\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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AM,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.
|
|
3
|
+
"version": "1.4.0-beta.4",
|
|
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",
|