@schoolpalm/message-bridge 0.1.0 → 1.2.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.
@@ -1,69 +1,23 @@
1
- /**
2
- * @fileoverview Base bridge class for message-based communication.
3
- * @module @schoolpalm/message-bridge/bridgeBase
4
- */
5
1
  import { MessageType } from './messageTypes';
6
2
  import { MessagePayload } from './payloadSchemas';
7
- /**
8
- * Type definition for message handler functions.
9
- * @template T - The type of message payload this handler accepts.
10
- */
3
+ /** Type definition for message handler functions */
11
4
  type MessageHandler<T extends MessagePayload> = (payload: T) => void;
12
5
  /**
13
6
  * Base class for Host and Module bridges.
14
7
  *
15
- * This abstract base class provides the core functionality for message-based
16
- * communication between windows using the postMessage API. It handles sending
17
- * messages, registering listeners, and managing event listeners.
18
- *
19
- * @example
20
- * ```typescript
21
- * class CustomBridge extends BridgeBase {
22
- * constructor(targetWindow: Window) {
23
- * super(targetWindow, 'https://example.com');
24
- * }
25
- *
26
- * // Add custom methods here
27
- * }
28
- * ```
8
+ * Handles sending, receiving, and dispatching messages via postMessage,
9
+ * with type-safe payloads, origin validation, and optional request/response support.
29
10
  */
30
11
  export declare class BridgeBase {
31
- /** The target window to send messages to. */
32
12
  protected targetWindow: Window;
33
- /** The origin to restrict messages to. */
34
13
  protected targetOrigin: string;
35
- /** Map of message type to array of handler functions. */
36
14
  private listeners;
37
- /**
38
- * Creates a new BridgeBase instance.
39
- * @param targetWindow - The window to send messages to.
40
- * @param targetOrigin - The origin to restrict messages to (default: '*').
41
- */
15
+ private pendingRequests;
42
16
  constructor(targetWindow: Window, targetOrigin?: string);
43
- /**
44
- * Sends a message to the target window.
45
- * @template T - The type of the message payload.
46
- * @param type - The message type to send.
47
- * @param payload - The payload data to send.
48
- */
49
17
  send<T extends MessagePayload>(type: MessageType, payload: T): void;
50
- /**
51
- * Registers a listener for a specific message type.
52
- * @template T - The type of the message payload.
53
- * @param type - The message type to listen for.
54
- * @param callback - The function to call when a message of this type is received.
55
- */
18
+ request<T = any, R = any>(type: MessageType, payload?: T, timeout?: number): Promise<R>;
56
19
  on<T extends MessagePayload>(type: MessageType, callback: MessageHandler<T>): void;
57
- /**
58
- * Internal message handler for incoming postMessage events.
59
- * @private
60
- * @param event - The message event received.
61
- */
62
- private _handleMessage;
63
- /**
64
- * Cleans up event listeners and resources.
65
- * Call this method when the bridge is no longer needed.
66
- */
20
+ protected _handleMessage(event: MessageEvent): void;
67
21
  destroy(): void;
68
22
  }
69
23
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"bridgeBase.d.ts","sourceRoot":"","sources":["../src/bridgeBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,KAAK,cAAc,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;AAErE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,UAAU;IACrB,6CAA6C;IAC7C,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,0CAA0C;IAC1C,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,yDAAyD;IACzD,OAAO,CAAC,SAAS,CAAsD;IAEvE;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,YAAY,GAAE,MAAY;IAM5D;;;;;OAKG;IACH,IAAI,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IAI5D;;;;;OAKG;IACH,EAAE,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;IAK3E;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAMtB;;;OAGG;IACH,OAAO;CAIR"}
1
+ {"version":3,"file":"bridgeBase.d.ts","sourceRoot":"","sources":["../src/bridgeBase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAmC,MAAM,kBAAkB,CAAA;AAElF,oDAAoD;AACpD,KAAK,cAAc,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAA;AAEpE;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,SAAS,CAAC,YAAY,EAAE,MAAM,CAAA;IAC9B,SAAS,CAAC,YAAY,EAAE,MAAM,CAAA;IAC9B,OAAO,CAAC,SAAS,CAAqD;IACtE,OAAO,CAAC,eAAe,CAAiD;gBAE5D,YAAY,EAAE,MAAM,EAAE,YAAY,GAAE,MAAY;IAO5D,IAAI,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IAK5D,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAiBrF,EAAE,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;IAK3E,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,YAAY;IAwB5C,OAAO;CAKR"}
@@ -1,76 +1,69 @@
1
- /**
2
- * @fileoverview Base bridge class for message-based communication.
3
- * @module @schoolpalm/message-bridge/bridgeBase
4
- */
1
+ // src/bridgeBase.ts
2
+ import { MessageType } from './messageTypes';
5
3
  /**
6
4
  * Base class for Host and Module bridges.
7
5
  *
8
- * This abstract base class provides the core functionality for message-based
9
- * communication between windows using the postMessage API. It handles sending
10
- * messages, registering listeners, and managing event listeners.
11
- *
12
- * @example
13
- * ```typescript
14
- * class CustomBridge extends BridgeBase {
15
- * constructor(targetWindow: Window) {
16
- * super(targetWindow, 'https://example.com');
17
- * }
18
- *
19
- * // Add custom methods here
20
- * }
21
- * ```
6
+ * Handles sending, receiving, and dispatching messages via postMessage,
7
+ * with type-safe payloads, origin validation, and optional request/response support.
22
8
  */
23
9
  export class BridgeBase {
24
- /**
25
- * Creates a new BridgeBase instance.
26
- * @param targetWindow - The window to send messages to.
27
- * @param targetOrigin - The origin to restrict messages to (default: '*').
28
- */
29
10
  constructor(targetWindow, targetOrigin = '*') {
30
- /** Map of message type to array of handler functions. */
31
11
  this.listeners = new Map();
12
+ this.pendingRequests = new Map();
32
13
  this.targetWindow = targetWindow;
33
14
  this.targetOrigin = targetOrigin;
34
15
  window.addEventListener('message', this._handleMessage.bind(this));
35
16
  }
36
- /**
37
- * Sends a message to the target window.
38
- * @template T - The type of the message payload.
39
- * @param type - The message type to send.
40
- * @param payload - The payload data to send.
41
- */
17
+ // ---------- Send messages ----------
42
18
  send(type, payload) {
43
19
  this.targetWindow.postMessage({ type, payload }, this.targetOrigin);
44
20
  }
45
- /**
46
- * Registers a listener for a specific message type.
47
- * @template T - The type of the message payload.
48
- * @param type - The message type to listen for.
49
- * @param callback - The function to call when a message of this type is received.
50
- */
21
+ // ---------- Request/Response ----------
22
+ request(type, payload, timeout = 5000) {
23
+ return new Promise((resolve, reject) => {
24
+ const requestId = crypto.randomUUID();
25
+ this.pendingRequests.set(requestId, resolve);
26
+ this.send(MessageType.DATA_REQUEST, { requestId, type, payload });
27
+ setTimeout(() => {
28
+ if (this.pendingRequests.has(requestId)) {
29
+ this.pendingRequests.delete(requestId);
30
+ reject(new Error(`Request ${type} timed out`));
31
+ }
32
+ }, timeout);
33
+ });
34
+ }
35
+ // ---------- Event handling ----------
51
36
  on(type, callback) {
52
37
  if (!this.listeners.has(type))
53
38
  this.listeners.set(type, []);
54
39
  this.listeners.get(type)?.push(callback);
55
40
  }
56
- /**
57
- * Internal message handler for incoming postMessage events.
58
- * @private
59
- * @param event - The message event received.
60
- */
61
41
  _handleMessage(event) {
42
+ // Strict origin check
43
+ if (this.targetOrigin !== '*' && event.origin !== this.targetOrigin)
44
+ return;
62
45
  const { type, payload } = event.data || {};
63
- if (!type || !this.listeners.has(type))
46
+ if (!type)
64
47
  return;
65
- this.listeners.get(type)?.forEach(cb => cb(payload));
48
+ // Handle DATA_RESPONSE automatically
49
+ if (type === MessageType.DATA_RESPONSE && payload?.requestId) {
50
+ const resolver = this.pendingRequests.get(payload.requestId);
51
+ if (resolver) {
52
+ resolver(payload);
53
+ this.pendingRequests.delete(payload.requestId);
54
+ return;
55
+ }
56
+ }
57
+ // Dispatch to listeners
58
+ if (this.listeners.has(type)) {
59
+ this.listeners.get(type)?.forEach(cb => cb(payload));
60
+ }
66
61
  }
67
- /**
68
- * Cleans up event listeners and resources.
69
- * Call this method when the bridge is no longer needed.
70
- */
62
+ // ---------- Cleanup ----------
71
63
  destroy() {
72
64
  window.removeEventListener('message', this._handleMessage.bind(this));
73
65
  this.listeners.clear();
66
+ this.pendingRequests.clear();
74
67
  }
75
68
  }
76
69
  //# sourceMappingURL=bridgeBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridgeBase.js","sourceRoot":"","sources":["../src/bridgeBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,UAAU;IAQrB;;;;OAIG;IACH,YAAY,YAAoB,EAAE,eAAuB,GAAG;QAR5D,yDAAyD;QACjD,cAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;QAQrE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAA2B,IAAiB,EAAE,OAAU;QAC1D,IAA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AAA;QACtB,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;IAC9B,CAAC;CACF"}
@@ -1,52 +1,20 @@
1
- /**
2
- * @fileoverview Host-side bridge for communication with embedded modules.
3
- * @module @schoolpalm/message-bridge/hostBridge
4
- */
5
1
  import { BridgeBase } from './bridgeBase';
6
- import { ModuleStartPayload } from './payloadSchemas';
2
+ import { ModuleStartPayload, UIUpdatePayload, ErrorPayload, ModuleContextPayload, HandshakeReadyPayload } from './payloadSchemas';
7
3
  /**
8
- * Host-side bridge for communication with embedded modules.
9
- *
10
- * This class extends BridgeBase to provide host-specific functionality for
11
- * communicating with modules embedded in iframes. It handles initialization
12
- * and termination of modules.
13
- *
14
- * @example
15
- * ```typescript
16
- * const iframe = document.getElementById('module-iframe') as HTMLIFrameElement;
17
- * const hostBridge = new HostBridge(iframe, 'https://module.example.com');
18
- *
19
- * // Start a module
20
- * hostBridge.sendModuleStart({
21
- * route: '/dashboard',
22
- * context: { userId: 123 },
23
- * timestamp: Date.now()
24
- * });
25
- *
26
- * // Listen for UI updates from the module
27
- * hostBridge.on(MessageType.UI_UPDATE, (payload) => {
28
- * console.log('UI Update:', payload);
29
- * });
30
- * ```
4
+ * HostBridge: communication from Host Module iframe
31
5
  */
32
6
  export declare class HostBridge extends BridgeBase {
33
- /**
34
- * Creates a new HostBridge instance.
35
- * @param iframe - The iframe element containing the module.
36
- * @param targetOrigin - The origin to restrict messages to (default: '*').
37
- */
38
7
  constructor(iframe: HTMLIFrameElement, targetOrigin?: string);
8
+ onHandshakeReady(callback: (payload: HandshakeReadyPayload) => void): void;
39
9
  /**
40
- * Sends a module-start message to the embedded module.
41
- * This initializes the module with the provided route and context.
42
- * @param payload - The module start payload containing route, context, and timestamp.
10
+ * Start module safely after handshake
43
11
  */
12
+ startModule(payload: ModuleStartPayload, timeout?: number): void;
44
13
  sendModuleStart(payload: ModuleStartPayload): void;
45
- /**
46
- * Sends a module-exit message to the embedded module.
47
- * This signals the module to clean up and terminate.
48
- * @param reason - Optional reason for the module exit.
49
- */
50
14
  sendModuleExit(reason?: string): void;
15
+ onUIUpdate(callback: (payload: UIUpdatePayload) => void): void;
16
+ onError(callback: (payload: ErrorPayload) => void): void;
17
+ sendContextUpdate(payload: ModuleContextPayload): void;
18
+ requestData<T = any, R = any>(type: string, payload?: T, timeout?: number): Promise<R>;
51
19
  }
52
20
  //# sourceMappingURL=hostBridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hostBridge.d.ts","sourceRoot":"","sources":["../src/hostBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC;;;;OAIG;gBACS,MAAM,EAAE,iBAAiB,EAAE,YAAY,GAAE,MAAY;IAIjE;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,kBAAkB;IAI3C;;;;OAIG;IACH,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM;CAG/B"}
1
+ {"version":3,"file":"hostBridge.d.ts","sourceRoot":"","sources":["../src/hostBridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EACL,kBAAkB,EAElB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,kBAAkB,CAAA;AAEzB;;GAEG;AACH,qBAAa,UAAW,SAAQ,UAAU;gBAC5B,MAAM,EAAE,iBAAiB,EAAE,YAAY,GAAE,MAAY;IAQjE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI;IAInE;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,GAAE,MAAa;IAY/D,eAAe,CAAC,OAAO,EAAE,kBAAkB;IAI3C,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM;IAK9B,UAAU,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI;IAIvD,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI;IAKjD,iBAAiB,CAAC,OAAO,EAAE,oBAAoB;IAKhD,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CASpF"}
@@ -1,59 +1,58 @@
1
- /**
2
- * @fileoverview Host-side bridge for communication with embedded modules.
3
- * @module @schoolpalm/message-bridge/hostBridge
4
- */
5
1
  // src/hostBridge.ts
6
2
  import { BridgeBase } from './bridgeBase';
7
3
  import { MessageType } from './messageTypes';
8
4
  /**
9
- * Host-side bridge for communication with embedded modules.
10
- *
11
- * This class extends BridgeBase to provide host-specific functionality for
12
- * communicating with modules embedded in iframes. It handles initialization
13
- * and termination of modules.
14
- *
15
- * @example
16
- * ```typescript
17
- * const iframe = document.getElementById('module-iframe') as HTMLIFrameElement;
18
- * const hostBridge = new HostBridge(iframe, 'https://module.example.com');
19
- *
20
- * // Start a module
21
- * hostBridge.sendModuleStart({
22
- * route: '/dashboard',
23
- * context: { userId: 123 },
24
- * timestamp: Date.now()
25
- * });
26
- *
27
- * // Listen for UI updates from the module
28
- * hostBridge.on(MessageType.UI_UPDATE, (payload) => {
29
- * console.log('UI Update:', payload);
30
- * });
31
- * ```
5
+ * HostBridge: communication from Host Module iframe
32
6
  */
33
7
  export class HostBridge extends BridgeBase {
34
- /**
35
- * Creates a new HostBridge instance.
36
- * @param iframe - The iframe element containing the module.
37
- * @param targetOrigin - The origin to restrict messages to (default: '*').
38
- */
39
8
  constructor(iframe, targetOrigin = '*') {
9
+ if (!iframe.contentWindow) {
10
+ throw new Error('Iframe has no contentWindow');
11
+ }
40
12
  super(iframe.contentWindow, targetOrigin);
41
13
  }
14
+ // ---------- Lifecycle / handshake ----------
15
+ onHandshakeReady(callback) {
16
+ this.on(MessageType.HANDSHAKE_READY, callback);
17
+ }
42
18
  /**
43
- * Sends a module-start message to the embedded module.
44
- * This initializes the module with the provided route and context.
45
- * @param payload - The module start payload containing route, context, and timestamp.
19
+ * Start module safely after handshake
46
20
  */
21
+ startModule(payload, timeout = 5000) {
22
+ const timer = setTimeout(() => {
23
+ console.error('Module handshake timeout');
24
+ }, timeout);
25
+ this.onHandshakeReady(() => {
26
+ clearTimeout(timer);
27
+ this.sendModuleStart(payload);
28
+ });
29
+ }
30
+ // ---------- Module control ----------
47
31
  sendModuleStart(payload) {
48
32
  this.send(MessageType.MODULE_START, payload);
49
33
  }
50
- /**
51
- * Sends a module-exit message to the embedded module.
52
- * This signals the module to clean up and terminate.
53
- * @param reason - Optional reason for the module exit.
54
- */
55
34
  sendModuleExit(reason) {
56
35
  this.send(MessageType.MODULE_EXIT, { reason });
57
36
  }
37
+ // ---------- UI events ----------
38
+ onUIUpdate(callback) {
39
+ this.on(MessageType.UI_UPDATE, callback);
40
+ }
41
+ onError(callback) {
42
+ this.on(MessageType.ERROR, callback);
43
+ }
44
+ // ---------- Context / theme sync ----------
45
+ sendContextUpdate(payload) {
46
+ this.send(MessageType.CONTEXT_UPDATE, payload);
47
+ }
48
+ // ---------- Request / response ----------
49
+ requestData(type, payload, timeout = 5000) {
50
+ const requestPayload = {
51
+ requestId: crypto.randomUUID(),
52
+ type,
53
+ payload: payload
54
+ };
55
+ return this.request(MessageType.DATA_REQUEST, requestPayload, timeout);
56
+ }
58
57
  }
59
58
  //# sourceMappingURL=hostBridge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hostBridge.js","sourceRoot":"","sources":["../src/hostBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,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",
35
35
  /** Host → Module: Signals the module to exit and clean up. */
36
- MODULE_EXIT = "module:exit"
36
+ MODULE_EXIT = "module:exit",
37
+ CONTEXT_UPDATE = "context:update"
37
38
  }
38
39
  //# sourceMappingURL=messageTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../src/messageTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,oBAAY,WAAW;IACrB,sEAAsE;IACtE,eAAe,oBAAoB;IACnC,wEAAwE;IACxE,YAAY,iBAAiB;IAC7B,qEAAqE;IACrE,SAAS,cAAc;IACvB,kDAAkD;IAClD,YAAY,iBAAiB;IAC7B,iDAAiD;IACjD,aAAa,kBAAkB;IAC/B,mDAAmD;IACnD,KAAK,UAAU;IACf,8DAA8D;IAC9D,WAAW,gBAAgB;CAC5B"}
1
+ {"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../src/messageTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,oBAAY,WAAW;IACrB,sEAAsE;IACtE,eAAe,oBAAoB;IACnC,wEAAwE;IACxE,YAAY,iBAAiB;IAC7B,qEAAqE;IACrE,SAAS,cAAc;IACvB,kDAAkD;IAClD,YAAY,iBAAiB;IAC7B,iDAAiD;IACjD,aAAa,kBAAkB;IAC/B,mDAAmD;IACnD,KAAK,UAAU;IACf,8DAA8D;IAC9D,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;CAClC"}
@@ -36,5 +36,6 @@ export var MessageType;
36
36
  MessageType["ERROR"] = "error";
37
37
  /** Host → Module: Signals the module to exit and clean up. */
38
38
  MessageType["MODULE_EXIT"] = "module:exit";
39
+ MessageType["CONTEXT_UPDATE"] = "context:update";
39
40
  })(MessageType || (MessageType = {}));
40
41
  //# sourceMappingURL=messageTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageTypes.js","sourceRoot":"","sources":["../src/messageTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sBAAsB;AAEtB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAN,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB,sEAAsE;IACtE,kDAAmC,CAAA;IACnC,wEAAwE;IACxE,4CAA6B,CAAA;IAC7B,qEAAqE;IACrE,sCAAuB,CAAA;IACvB,kDAAkD;IAClD,4CAA6B,CAAA;IAC7B,iDAAiD;IACjD,8CAA+B,CAAA;IAC/B,mDAAmD;IACnD,8BAAe,CAAA;IACf,8DAA8D;IAC9D,0CAA2B,CAAA;AAC7B,CAAC,EAfW,WAAW,KAAX,WAAW,QAetB"}
1
+ {"version":3,"file":"messageTypes.js","sourceRoot":"","sources":["../src/messageTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sBAAsB;AAEtB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAN,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACrB,sEAAsE;IACtE,kDAAmC,CAAA;IACnC,wEAAwE;IACxE,4CAA6B,CAAA;IAC7B,qEAAqE;IACrE,sCAAuB,CAAA;IACvB,kDAAkD;IAClD,4CAA6B,CAAA;IAC7B,iDAAiD;IACjD,8CAA+B,CAAA;IAC/B,mDAAmD;IACnD,8BAAe,CAAA;IACf,8DAA8D;IAC9D,0CAA2B,CAAA;IAC3B,gDAAiC,CAAA;AACnC,CAAC,EAhBW,WAAW,KAAX,WAAW,QAgBtB"}
@@ -1,61 +1,21 @@
1
- /**
2
- * @fileoverview Module-side bridge for communication with the host application.
3
- * @module @schoolpalm/message-bridge/moduleBridge
4
- */
5
1
  import { BridgeBase } from './bridgeBase';
6
2
  import { HandshakeReadyPayload, UIUpdatePayload, ErrorPayload } from './payloadSchemas';
7
3
  /**
8
4
  * Module-side bridge for communication with the host application.
9
- *
10
- * This class extends BridgeBase to provide module-specific functionality for
11
- * communicating with the parent host application. It handles handshake,
12
- * UI updates, and error reporting from the embedded module.
13
- *
14
- * @example
15
- * ```typescript
16
- * const moduleBridge = new ModuleBridge('https://host.example.com');
17
- *
18
- * // Send handshake when module is ready
19
- * moduleBridge.sendHandshake({
20
- * version: '1.0.0',
21
- * timestamp: Date.now()
22
- * });
23
- *
24
- * // Update UI in the host
25
- * moduleBridge.sendUIUpdate({
26
- * title: 'Dashboard',
27
- * breadcrumb: ['Home', 'Dashboard'],
28
- * theme: 'dark'
29
- * });
30
- *
31
- * // Listen for module start from host
32
- * moduleBridge.on(MessageType.MODULE_START, (payload) => {
33
- * console.log('Module started:', payload.route);
34
- * });
35
- * ```
36
5
  */
37
6
  export declare class ModuleBridge extends BridgeBase {
38
- /**
39
- * Creates a new ModuleBridge instance.
40
- * @param targetOrigin - The origin to restrict messages to (default: '*').
41
- */
42
7
  constructor(targetOrigin?: string);
43
- /**
44
- * Notifies the host application that the module is ready.
45
- * This should be called after the module has initialized.
46
- * @param payload - The handshake payload containing version and timestamp.
47
- */
48
8
  sendHandshake(payload: HandshakeReadyPayload): void;
9
+ onModuleStart(callback: (payload: any) => void): void;
10
+ sendUIUpdate(payload: UIUpdatePayload): void;
11
+ sendError(payload: ErrorPayload): void;
49
12
  /**
50
- * Notifies the host application of UI updates.
51
- * This includes changes to title, breadcrumb, and theme.
52
- * @param payload - The UI update payload.
13
+ * Module requests data from host
53
14
  */
54
- sendUIUpdate(payload: UIUpdatePayload): void;
15
+ requestData<T = any, R = any>(type: string, payload?: T, timeout?: number): Promise<R>;
55
16
  /**
56
- * Notifies the host application of an error.
57
- * @param payload - The error payload containing error details.
17
+ * Respond to a host request
58
18
  */
59
- sendError(payload: ErrorPayload): void;
19
+ respondData(requestId: string, data: any, status?: 'success' | 'error'): void;
60
20
  }
61
21
  //# sourceMappingURL=moduleBridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"moduleBridge.d.ts","sourceRoot":"","sources":["../src/moduleBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C;;;OAGG;gBACS,YAAY,GAAE,MAAY;IAItC;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,qBAAqB;IAI5C;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,eAAe;IAIrC;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,YAAY;CAGhC"}
1
+ {"version":3,"file":"moduleBridge.d.ts","sourceRoot":"","sources":["../src/moduleBridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,YAAY,EAGb,MAAM,kBAAkB,CAAA;AAEzB;;GAEG;AACH,qBAAa,YAAa,SAAQ,UAAU;gBAC9B,YAAY,GAAE,MAAY;IAKtC,aAAa,CAAC,OAAO,EAAE,qBAAqB;IAI5C,aAAa,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI;IAI9C,YAAY,CAAC,OAAO,EAAE,eAAe;IAIrC,SAAS,CAAC,OAAO,EAAE,YAAY;IAK/B;;OAEG;IACH,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IASpF;;OAEG;IACJ,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,SAAS,GAAG,OAAmB;CASjF"}
@@ -1,70 +1,48 @@
1
- /**
2
- * @fileoverview Module-side bridge for communication with the host application.
3
- * @module @schoolpalm/message-bridge/moduleBridge
4
- */
5
1
  // src/moduleBridge.ts
6
2
  import { BridgeBase } from './bridgeBase';
7
3
  import { MessageType } from './messageTypes';
8
4
  /**
9
5
  * Module-side bridge for communication with the host application.
10
- *
11
- * This class extends BridgeBase to provide module-specific functionality for
12
- * communicating with the parent host application. It handles handshake,
13
- * UI updates, and error reporting from the embedded module.
14
- *
15
- * @example
16
- * ```typescript
17
- * const moduleBridge = new ModuleBridge('https://host.example.com');
18
- *
19
- * // Send handshake when module is ready
20
- * moduleBridge.sendHandshake({
21
- * version: '1.0.0',
22
- * timestamp: Date.now()
23
- * });
24
- *
25
- * // Update UI in the host
26
- * moduleBridge.sendUIUpdate({
27
- * title: 'Dashboard',
28
- * breadcrumb: ['Home', 'Dashboard'],
29
- * theme: 'dark'
30
- * });
31
- *
32
- * // Listen for module start from host
33
- * moduleBridge.on(MessageType.MODULE_START, (payload) => {
34
- * console.log('Module started:', payload.route);
35
- * });
36
- * ```
37
6
  */
38
7
  export class ModuleBridge extends BridgeBase {
39
- /**
40
- * Creates a new ModuleBridge instance.
41
- * @param targetOrigin - The origin to restrict messages to (default: '*').
42
- */
43
8
  constructor(targetOrigin = '*') {
44
9
  super(window.parent, targetOrigin);
45
10
  }
46
- /**
47
- * Notifies the host application that the module is ready.
48
- * This should be called after the module has initialized.
49
- * @param payload - The handshake payload containing version and timestamp.
50
- */
11
+ // ---------- Lifecycle / handshake ----------
51
12
  sendHandshake(payload) {
52
13
  this.send(MessageType.HANDSHAKE_READY, payload);
53
14
  }
54
- /**
55
- * Notifies the host application of UI updates.
56
- * This includes changes to title, breadcrumb, and theme.
57
- * @param payload - The UI update payload.
58
- */
15
+ onModuleStart(callback) {
16
+ this.on(MessageType.MODULE_START, callback);
17
+ }
59
18
  sendUIUpdate(payload) {
60
19
  this.send(MessageType.UI_UPDATE, payload);
61
20
  }
62
- /**
63
- * Notifies the host application of an error.
64
- * @param payload - The error payload containing error details.
65
- */
66
21
  sendError(payload) {
67
22
  this.send(MessageType.ERROR, payload);
68
23
  }
24
+ // ---------- Request / response ----------
25
+ /**
26
+ * Module requests data from host
27
+ */
28
+ requestData(type, payload, timeout = 5000) {
29
+ const requestPayload = {
30
+ requestId: crypto.randomUUID(),
31
+ type,
32
+ payload: payload
33
+ };
34
+ return this.request(MessageType.DATA_REQUEST, requestPayload, timeout);
35
+ }
36
+ /**
37
+ * Respond to a host request
38
+ */
39
+ respondData(requestId, data, status = 'success') {
40
+ const response = {
41
+ requestId,
42
+ status,
43
+ payload: data
44
+ };
45
+ this.send(MessageType.DATA_RESPONSE, response);
46
+ }
69
47
  }
70
48
  //# sourceMappingURL=moduleBridge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"moduleBridge.js","sourceRoot":"","sources":["../src/moduleBridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sBAAsB;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,YAAa,SAAQ,UAAU;IAC1C;;;OAGG;IACH,YAAY,eAAuB,GAAG;QACpC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,OAA8B;QAC1C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,OAAwB;QACnC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,OAAqB;QAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;CACF"}
1
+ {"version":3,"file":"moduleBridge.js","sourceRoot":"","sources":["../src/modu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