@daex-dev/sdk 0.0.0-stage → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +478 -2
  3. package/dist/client-DVZHOtg6.d.cts +2635 -0
  4. package/dist/client-DVZHOtg6.d.ts +2635 -0
  5. package/dist/connect/browser.cjs +209 -0
  6. package/dist/connect/browser.d.cts +81 -0
  7. package/dist/connect/browser.d.ts +81 -0
  8. package/dist/connect/browser.js +183 -0
  9. package/dist/connect/index.cjs +1954 -0
  10. package/dist/connect/index.d.cts +433 -0
  11. package/dist/connect/index.d.ts +433 -0
  12. package/dist/connect/index.js +1888 -0
  13. package/dist/electron/global.cjs +18 -0
  14. package/dist/electron/global.d.cts +35 -0
  15. package/dist/electron/global.d.ts +35 -0
  16. package/dist/electron/global.js +0 -0
  17. package/dist/electron/index.cjs +1133 -0
  18. package/dist/electron/index.d.cts +510 -0
  19. package/dist/electron/index.d.ts +510 -0
  20. package/dist/electron/index.js +1073 -0
  21. package/dist/electron/preload-auto.cjs +38 -0
  22. package/dist/electron/preload.cjs +66 -0
  23. package/dist/electron/preload.d.cts +46 -0
  24. package/dist/electron/preload.d.ts +46 -0
  25. package/dist/electron/preload.js +43 -0
  26. package/dist/electron/protocol-DXRtliy3.d.cts +904 -0
  27. package/dist/electron/protocol-DXRtliy3.d.ts +904 -0
  28. package/dist/electron/renderer.cjs +631 -0
  29. package/dist/electron/renderer.d.cts +508 -0
  30. package/dist/electron/renderer.d.ts +508 -0
  31. package/dist/electron/renderer.global.js +634 -0
  32. package/dist/electron/renderer.js +608 -0
  33. package/dist/index.cjs +6731 -0
  34. package/dist/index.d.cts +316 -0
  35. package/dist/index.d.ts +316 -0
  36. package/dist/index.js +6661 -0
  37. package/dist/server.cjs +1019 -0
  38. package/dist/server.d.cts +118 -0
  39. package/dist/server.d.ts +118 -0
  40. package/dist/server.js +989 -0
  41. package/dist/testing.cjs +815 -0
  42. package/dist/testing.d.cts +29 -0
  43. package/dist/testing.d.ts +29 -0
  44. package/dist/testing.js +787 -0
  45. package/dist/types-DUGv-9QF.d.cts +166 -0
  46. package/dist/types-DUGv-9QF.d.ts +166 -0
  47. package/package.json +109 -4
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ // src/electron/protocol.ts
4
+ var DAEX_DEFAULT_CHANNEL_PREFIX = "ade";
5
+ var DAEX_DEFAULT_BRIDGE_KEY = "ade";
6
+ function invokeChannel(prefix) {
7
+ return `${prefix}:invoke`;
8
+ }
9
+ function eventChannel(prefix) {
10
+ return `${prefix}:event`;
11
+ }
12
+
13
+ // src/electron/preload.ts
14
+ function exposeDaexBridge(contextBridge, ipcRenderer, opts = {}) {
15
+ const key = opts.key?.trim() || DAEX_DEFAULT_BRIDGE_KEY;
16
+ const prefix = opts.channelPrefix?.trim() || DAEX_DEFAULT_CHANNEL_PREFIX;
17
+ const invokeName = invokeChannel(prefix);
18
+ const eventName = eventChannel(prefix);
19
+ const bridge = {
20
+ invoke(method, args) {
21
+ return ipcRenderer.invoke(invokeName, { method, args });
22
+ },
23
+ onEvent(listener) {
24
+ const handler = (_event, payload) => {
25
+ listener(payload);
26
+ };
27
+ ipcRenderer.on(eventName, handler);
28
+ return () => {
29
+ ipcRenderer.removeListener(eventName, handler);
30
+ };
31
+ }
32
+ };
33
+ contextBridge.exposeInMainWorld(key, bridge);
34
+ }
35
+
36
+ // src/electron/preload-auto.ts
37
+ var electron = require("electron");
38
+ exposeDaexBridge(electron.contextBridge, electron.ipcRenderer);
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/electron/preload.ts
21
+ var preload_exports = {};
22
+ __export(preload_exports, {
23
+ ADE_DEFAULT_BRIDGE_KEY: () => ADE_DEFAULT_BRIDGE_KEY,
24
+ ADE_DEFAULT_CHANNEL_PREFIX: () => ADE_DEFAULT_CHANNEL_PREFIX,
25
+ DAEX_DEFAULT_BRIDGE_KEY: () => DAEX_DEFAULT_BRIDGE_KEY,
26
+ DAEX_DEFAULT_CHANNEL_PREFIX: () => DAEX_DEFAULT_CHANNEL_PREFIX,
27
+ exposeAdeBridge: () => exposeAdeBridge,
28
+ exposeDaexBridge: () => exposeDaexBridge
29
+ });
30
+ module.exports = __toCommonJS(preload_exports);
31
+
32
+ // src/electron/protocol.ts
33
+ var DAEX_DEFAULT_CHANNEL_PREFIX = "ade";
34
+ var DAEX_DEFAULT_BRIDGE_KEY = "ade";
35
+ function invokeChannel(prefix) {
36
+ return `${prefix}:invoke`;
37
+ }
38
+ function eventChannel(prefix) {
39
+ return `${prefix}:event`;
40
+ }
41
+ var ADE_DEFAULT_BRIDGE_KEY = DAEX_DEFAULT_BRIDGE_KEY;
42
+ var ADE_DEFAULT_CHANNEL_PREFIX = DAEX_DEFAULT_CHANNEL_PREFIX;
43
+
44
+ // src/electron/preload.ts
45
+ function exposeDaexBridge(contextBridge, ipcRenderer, opts = {}) {
46
+ const key = opts.key?.trim() || DAEX_DEFAULT_BRIDGE_KEY;
47
+ const prefix = opts.channelPrefix?.trim() || DAEX_DEFAULT_CHANNEL_PREFIX;
48
+ const invokeName = invokeChannel(prefix);
49
+ const eventName = eventChannel(prefix);
50
+ const bridge = {
51
+ invoke(method, args) {
52
+ return ipcRenderer.invoke(invokeName, { method, args });
53
+ },
54
+ onEvent(listener) {
55
+ const handler = (_event, payload) => {
56
+ listener(payload);
57
+ };
58
+ ipcRenderer.on(eventName, handler);
59
+ return () => {
60
+ ipcRenderer.removeListener(eventName, handler);
61
+ };
62
+ }
63
+ };
64
+ contextBridge.exposeInMainWorld(key, bridge);
65
+ }
66
+ var exposeAdeBridge = exposeDaexBridge;
@@ -0,0 +1,46 @@
1
+ import { C as ContextBridgeLike, I as IpcRendererLike } from './protocol-DXRtliy3.cjs';
2
+ export { a as ADE_DEFAULT_BRIDGE_KEY, b as ADE_DEFAULT_CHANNEL_PREFIX, A as AdeBridge, c as DAEX_DEFAULT_BRIDGE_KEY, d as DAEX_DEFAULT_CHANNEL_PREFIX, D as DaexBridge } from './protocol-DXRtliy3.cjs';
3
+
4
+ /**
5
+ * `@daex-dev/sdk/electron/preload` — the preload half of the Electron bridge.
6
+ *
7
+ * THIS FILE MUST BUNDLE TO ONE SELF-CONTAINED FILE. A preload that runs under
8
+ * `sandbox: true` has no module resolution: it cannot `require` a file path and
9
+ * it cannot reach `node_modules`. So this entry imports nothing at run time —
10
+ * only types, which vanish at build — and its published artifact
11
+ * (`dist/electron/preload.cjs`) is a single file with no `require` and no
12
+ * `import` of any kind. Point `webPreferences.preload` straight at that file,
13
+ * or bundle this module into your own preload.
14
+ *
15
+ * WHAT CROSSES. Functions and plain data only. `contextBridge` structured-clones
16
+ * everything it passes, so a class instance arrives as a bare object with no
17
+ * prototype and no methods. The renderer therefore receives an id plus two
18
+ * functions and rebuilds every object shape on its own side.
19
+ */
20
+
21
+ type ExposeDaexBridgeOptions = {
22
+ /** `window` key the bridge lands on. Defaults to `"ade"`. */
23
+ key?: string;
24
+ /** Channel namespace. Must match the main process. Defaults to `"ade"`. */
25
+ channelPrefix?: string;
26
+ };
27
+ /**
28
+ * Expose the DAEX bridge on `window[key]`.
29
+ *
30
+ * Call it once, at the top level of your preload:
31
+ *
32
+ * const { contextBridge, ipcRenderer } = require("electron");
33
+ * exposeDaexBridge(contextBridge, ipcRenderer);
34
+ *
35
+ * The surface is deliberately two functions wide. Every method name, argument
36
+ * shape and subscription rule lives in the renderer half, so a preload written
37
+ * against one SDK version keeps working as the method table grows.
38
+ */
39
+ declare function exposeDaexBridge(contextBridge: ContextBridgeLike, ipcRenderer: IpcRendererLike, opts?: ExposeDaexBridgeOptions): void;
40
+
41
+ /** @deprecated Use {@link ExposeDaexBridgeOptions}. */
42
+ type ExposeAdeBridgeOptions = ExposeDaexBridgeOptions;
43
+ /** @deprecated Use {@link exposeDaexBridge}. */
44
+ declare const exposeAdeBridge: typeof exposeDaexBridge;
45
+
46
+ export { ContextBridgeLike, type ExposeAdeBridgeOptions, type ExposeDaexBridgeOptions, IpcRendererLike, exposeAdeBridge, exposeDaexBridge };
@@ -0,0 +1,46 @@
1
+ import { C as ContextBridgeLike, I as IpcRendererLike } from './protocol-DXRtliy3.js';
2
+ export { a as ADE_DEFAULT_BRIDGE_KEY, b as ADE_DEFAULT_CHANNEL_PREFIX, A as AdeBridge, c as DAEX_DEFAULT_BRIDGE_KEY, d as DAEX_DEFAULT_CHANNEL_PREFIX, D as DaexBridge } from './protocol-DXRtliy3.js';
3
+
4
+ /**
5
+ * `@daex-dev/sdk/electron/preload` — the preload half of the Electron bridge.
6
+ *
7
+ * THIS FILE MUST BUNDLE TO ONE SELF-CONTAINED FILE. A preload that runs under
8
+ * `sandbox: true` has no module resolution: it cannot `require` a file path and
9
+ * it cannot reach `node_modules`. So this entry imports nothing at run time —
10
+ * only types, which vanish at build — and its published artifact
11
+ * (`dist/electron/preload.cjs`) is a single file with no `require` and no
12
+ * `import` of any kind. Point `webPreferences.preload` straight at that file,
13
+ * or bundle this module into your own preload.
14
+ *
15
+ * WHAT CROSSES. Functions and plain data only. `contextBridge` structured-clones
16
+ * everything it passes, so a class instance arrives as a bare object with no
17
+ * prototype and no methods. The renderer therefore receives an id plus two
18
+ * functions and rebuilds every object shape on its own side.
19
+ */
20
+
21
+ type ExposeDaexBridgeOptions = {
22
+ /** `window` key the bridge lands on. Defaults to `"ade"`. */
23
+ key?: string;
24
+ /** Channel namespace. Must match the main process. Defaults to `"ade"`. */
25
+ channelPrefix?: string;
26
+ };
27
+ /**
28
+ * Expose the DAEX bridge on `window[key]`.
29
+ *
30
+ * Call it once, at the top level of your preload:
31
+ *
32
+ * const { contextBridge, ipcRenderer } = require("electron");
33
+ * exposeDaexBridge(contextBridge, ipcRenderer);
34
+ *
35
+ * The surface is deliberately two functions wide. Every method name, argument
36
+ * shape and subscription rule lives in the renderer half, so a preload written
37
+ * against one SDK version keeps working as the method table grows.
38
+ */
39
+ declare function exposeDaexBridge(contextBridge: ContextBridgeLike, ipcRenderer: IpcRendererLike, opts?: ExposeDaexBridgeOptions): void;
40
+
41
+ /** @deprecated Use {@link ExposeDaexBridgeOptions}. */
42
+ type ExposeAdeBridgeOptions = ExposeDaexBridgeOptions;
43
+ /** @deprecated Use {@link exposeDaexBridge}. */
44
+ declare const exposeAdeBridge: typeof exposeDaexBridge;
45
+
46
+ export { ContextBridgeLike, type ExposeAdeBridgeOptions, type ExposeDaexBridgeOptions, IpcRendererLike, exposeAdeBridge, exposeDaexBridge };
@@ -0,0 +1,43 @@
1
+ // src/electron/protocol.ts
2
+ var DAEX_DEFAULT_CHANNEL_PREFIX = "ade";
3
+ var DAEX_DEFAULT_BRIDGE_KEY = "ade";
4
+ function invokeChannel(prefix) {
5
+ return `${prefix}:invoke`;
6
+ }
7
+ function eventChannel(prefix) {
8
+ return `${prefix}:event`;
9
+ }
10
+ var ADE_DEFAULT_BRIDGE_KEY = DAEX_DEFAULT_BRIDGE_KEY;
11
+ var ADE_DEFAULT_CHANNEL_PREFIX = DAEX_DEFAULT_CHANNEL_PREFIX;
12
+
13
+ // src/electron/preload.ts
14
+ function exposeDaexBridge(contextBridge, ipcRenderer, opts = {}) {
15
+ const key = opts.key?.trim() || DAEX_DEFAULT_BRIDGE_KEY;
16
+ const prefix = opts.channelPrefix?.trim() || DAEX_DEFAULT_CHANNEL_PREFIX;
17
+ const invokeName = invokeChannel(prefix);
18
+ const eventName = eventChannel(prefix);
19
+ const bridge = {
20
+ invoke(method, args) {
21
+ return ipcRenderer.invoke(invokeName, { method, args });
22
+ },
23
+ onEvent(listener) {
24
+ const handler = (_event, payload) => {
25
+ listener(payload);
26
+ };
27
+ ipcRenderer.on(eventName, handler);
28
+ return () => {
29
+ ipcRenderer.removeListener(eventName, handler);
30
+ };
31
+ }
32
+ };
33
+ contextBridge.exposeInMainWorld(key, bridge);
34
+ }
35
+ var exposeAdeBridge = exposeDaexBridge;
36
+ export {
37
+ ADE_DEFAULT_BRIDGE_KEY,
38
+ ADE_DEFAULT_CHANNEL_PREFIX,
39
+ DAEX_DEFAULT_BRIDGE_KEY,
40
+ DAEX_DEFAULT_CHANNEL_PREFIX,
41
+ exposeAdeBridge,
42
+ exposeDaexBridge
43
+ };