@corto-ai/integrations-messenger 0.0.10-dev.0 → 0.0.10-dev.1

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/README.md CHANGED
@@ -78,6 +78,8 @@ messenger.registerChild(iframe.contentWindow, 'my-integration-app');
78
78
  | `auth` | `sendUserDataRequest` / `handleUserDataRequest` | Request the current user's data from the host (currently returns `userId`). |
79
79
  | `pubsub` | `sendNotificationRequest` / `handleNotificationRequest` | Subscribe to (or publish) notifications on a `channel`, supporting multiple responses over time. |
80
80
  | `window` | `sendUpdateUrl` / `handleUpdateUrl` | Update the url in the host application _without navigating_. Used to support routing/refreshing within an integration |
81
+ | `window` | `sendOpenModal` / `handleOpenModal` | Opens a modal overlay that can be used to host integration iframes. Appends the provided path to the root target origin. |
82
+ | `window` | `sendCloseModal` / `handleCloseModal` | Closes a modal overlay that was previously opened with the `sendOpenModal` command |
81
83
 
82
84
  All `matter`, `contact`, and `settings` actions accept an optional `newTab` flag to indicate the host should open the target in a new tab, and `matter` actions also accept an optional `matterId` beyond what's called out above.
83
85
 
@@ -127,6 +129,10 @@ const handle = messenger.actions.pubsub.sendNotificationRequest({ channel: 'docu
127
129
  handle.remove();
128
130
  ```
129
131
 
132
+ #### Modal communication
133
+
134
+ As mentioned above, the `window.sendOpenModal` command allows integrations to trigger a modal overlay and display a custom modal from their application. Its worth noting though that this new modal **will not be able to communicate with the parent application**. Modals should instead communicate with their sibling integration (ie the integration which opened the modal) via the [BroadcastChannelAPI](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API). This way they can notify the sibling of whatever user interaction might be required, including closing the modal.
135
+
130
136
  ### Forwarding
131
137
 
132
138
  In order to support multiple levels of iframe nesting, the package inherently has a "forwarding" mechanic: for any action, if no handler is defined in a given window, the message continues up or down the iframe tree until a handler picks it up. This is enabled by default and requires no opt-in.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@corto-ai/integrations-messenger",
3
- "version": "0.0.10-dev.0",
4
- "devVersion": "0",
3
+ "version": "0.0.10-dev.1",
4
+ "devVersion": "1",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "./src/index.js",
package/src/index.d.ts CHANGED
@@ -56,6 +56,10 @@ declare const _default: {
56
56
  window: {
57
57
  sendUpdateUrl: import(".").ActionCreatorFn<import(".").ActionTypeEnum.WindowUpdateUrl>;
58
58
  handleUpdateUrl: import(".").ActionHandlerFn<import(".").ActionTypeEnum.WindowUpdateUrl>;
59
+ sendOpenModal: import(".").ActionCreatorFn<import(".").ActionTypeEnum.WindowOpenModal>;
60
+ handleOpenModal: import(".").ActionHandlerFn<import(".").ActionTypeEnum.WindowOpenModal>;
61
+ sendCloseModal: import(".").ActionCreatorFn<import(".").ActionTypeEnum.WindowCloseModal>;
62
+ handleCloseModal: import(".").ActionHandlerFn<import(".").ActionTypeEnum.WindowCloseModal>;
59
63
  };
60
64
  };
61
65
  };
@@ -17,6 +17,8 @@ import { type MatterPreviewDocumentDataTypeDTO } from './matter/preview-document
17
17
  import { type MatterSetFullScreenDataTypeDTO } from './matter/set-fullscreen';
18
18
  import { type PubsubNotificationDataTypeDTO } from './pubsub/notification';
19
19
  import { type SettingsOpenDataTypeDTO } from './settings/open';
20
+ import { type WindowCloseModalDataTypeDTO } from './window/close-modal';
21
+ import { type WindowOpenModalDataTypeDTO } from './window/open-modal';
20
22
  import { type WindowUpdateUrlDataTypeDTO } from './window/update-url';
21
23
  export declare enum InternalActionTypeEnum {
22
24
  Handshake = "Handshake"
@@ -39,7 +41,9 @@ export declare enum ActionTypeEnum {
39
41
  PubsubNotification = "PubsubNotification",
40
42
  RequestExchangeToken = "RequestExchangeToken",
41
43
  RequestUserData = "RequestUserData",
42
- WindowUpdateUrl = "WindowUpdateUrl"
44
+ WindowUpdateUrl = "WindowUpdateUrl",
45
+ WindowOpenModal = "WindowOpenModal",
46
+ WindowCloseModal = "WindowCloseModal"
43
47
  }
44
48
  export declare const AdditionalMessageConfig: {
45
49
  [key in ActionTypeEnum]?: AdditionalMessageConfigDTO;
@@ -64,4 +68,6 @@ export type DataTypeMapDTO = {
64
68
  [ActionTypeEnum.RequestExchangeToken]: ExchangeTokenDataTypeDTO;
65
69
  [ActionTypeEnum.RequestUserData]: UserDataDataTypeDTO;
66
70
  [ActionTypeEnum.WindowUpdateUrl]: WindowUpdateUrlDataTypeDTO;
71
+ [ActionTypeEnum.WindowOpenModal]: WindowOpenModalDataTypeDTO;
72
+ [ActionTypeEnum.WindowCloseModal]: WindowCloseModalDataTypeDTO;
67
73
  };
@@ -22,6 +22,8 @@ export var ActionTypeEnum;
22
22
  ActionTypeEnum["RequestExchangeToken"] = "RequestExchangeToken";
23
23
  ActionTypeEnum["RequestUserData"] = "RequestUserData";
24
24
  ActionTypeEnum["WindowUpdateUrl"] = "WindowUpdateUrl";
25
+ ActionTypeEnum["WindowOpenModal"] = "WindowOpenModal";
26
+ ActionTypeEnum["WindowCloseModal"] = "WindowCloseModal";
25
27
  })(ActionTypeEnum || (ActionTypeEnum = {}));
26
28
  export const AdditionalMessageConfig = {
27
29
  [ActionTypeEnum.PubsubNotification]: { keepAlive: true }
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../../libs/integrations-messenger/src/lib/actions/base.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAN,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,iDAAuB,CAAA;AACzB,CAAC,EAFW,sBAAsB,KAAtB,sBAAsB,QAEjC;AAED,MAAM,CAAN,IAAY,cAyBX;AAzBD,WAAY,cAAc;IACxB,iEAA+C,CAAA;IAC/C,mEAAiD,CAAA;IACjD,qEAAmD,CAAA;IACnD,uDAAqC,CAAA;IACrC,yDAAuC,CAAA;IACvC,mDAAiC,CAAA;IACjC,uEAAqD,CAAA;IACrD,iEAA+C,CAAA;IAC/C,2CAAyB,CAAA;IACzB,6DAA2C,CAAA;IAE3C,6CAA2B,CAAA;IAC3B,qDAAmC,CAAA;IAEnC,+CAA6B,CAAA;IAE7B,6CAA2B,CAAA;IAE3B,2DAAyC,CAAA;IAEzC,+DAA6C,CAAA;IAC7C,qDAAmC,CAAA;IAEnC,qDAAmC,CAAA;AACrC,CAAC,EAzBW,cAAc,KAAd,cAAc,QAyBzB;AAED,MAAM,CAAC,MAAM,uBAAuB,GAA6D;IAC/F,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../../libs/integrations-messenger/src/lib/actions/base.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,iDAAuB,CAAA;AACzB,CAAC,EAFW,sBAAsB,KAAtB,sBAAsB,QAEjC;AAED,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,iEAA+C,CAAA;IAC/C,mEAAiD,CAAA;IACjD,qEAAmD,CAAA;IACnD,uDAAqC,CAAA;IACrC,yDAAuC,CAAA;IACvC,mDAAiC,CAAA;IACjC,uEAAqD,CAAA;IACrD,iEAA+C,CAAA;IAC/C,2CAAyB,CAAA;IACzB,6DAA2C,CAAA;IAE3C,6CAA2B,CAAA;IAC3B,qDAAmC,CAAA;IAEnC,+CAA6B,CAAA;IAE7B,6CAA2B,CAAA;IAE3B,2DAAyC,CAAA;IAEzC,+DAA6C,CAAA;IAC7C,qDAAmC,CAAA;IAEnC,qDAAmC,CAAA;IACnC,qDAAmC,CAAA;IACnC,uDAAqC,CAAA;AACvC,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAED,MAAM,CAAC,MAAM,uBAAuB,GAA6D;IAC/F,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;CACzD,CAAC"}
@@ -48,6 +48,10 @@ declare const _default: {
48
48
  window: {
49
49
  sendUpdateUrl: import("../models").ActionCreatorFn<import("./base").ActionTypeEnum.WindowUpdateUrl>;
50
50
  handleUpdateUrl: import("../models").ActionHandlerFn<import("./base").ActionTypeEnum.WindowUpdateUrl>;
51
+ sendOpenModal: import("../models").ActionCreatorFn<import("./base").ActionTypeEnum.WindowOpenModal>;
52
+ handleOpenModal: import("../models").ActionHandlerFn<import("./base").ActionTypeEnum.WindowOpenModal>;
53
+ sendCloseModal: import("../models").ActionCreatorFn<import("./base").ActionTypeEnum.WindowCloseModal>;
54
+ handleCloseModal: import("../models").ActionHandlerFn<import("./base").ActionTypeEnum.WindowCloseModal>;
51
55
  };
52
56
  };
53
57
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { type ActionTypeEnum } from './base';
2
- import { type ActionCreatorConfigDTO, type ActionCreatorFn, type ActionHandlerFn, type StreamActionCreatorFn, type StreamActionHandlerFn } from '../models';
2
+ import { type ActionCreatorConfigDTO, type ActionCreatorFn, type ActionHandlerBuildOptions, type ActionHandlerFn, type StreamActionCreatorFn, type StreamActionHandlerFn } from '../models';
3
3
  export declare const buildActionCreatorFn: <T extends ActionTypeEnum>(type: T, opts?: ActionCreatorConfigDTO<T>) => ActionCreatorFn<T>;
4
- export declare const buildActionHandlerFn: <T extends ActionTypeEnum>(type: T) => ActionHandlerFn<T>;
4
+ export declare const buildActionHandlerFn: <T extends ActionTypeEnum>(type: T, opts?: ActionHandlerBuildOptions) => ActionHandlerFn<T>;
5
5
  export declare const buildAsyncActionCreatorFn: <T extends ActionTypeEnum>(type: T, opts?: ActionCreatorConfigDTO<T>) => StreamActionCreatorFn<T>;
6
6
  export declare const buildAsyncActionHandlerFn: <T extends ActionTypeEnum>(type: T) => StreamActionHandlerFn<T>;
7
7
  export declare const isInternalActionType: (type: string) => boolean;
@@ -24,8 +24,10 @@ export const buildActionCreatorFn = (type, opts = {}) => (request) => new Promis
24
24
  target: parentId
25
25
  });
26
26
  });
27
- export const buildActionHandlerFn = (type) => (handler) => listener.addMessageHandler(type, async ({ data: request }) => {
28
- const response = await handler(request.data);
27
+ export const buildActionHandlerFn = (type, opts) => (handler) => listener.addMessageHandler(type, async ({ data: request }) => {
28
+ const response = await handler(request.data, {
29
+ srcOrigin: opts?.includeSrcOrigin ? target.getTarget(request.src)?.origin : undefined
30
+ });
29
31
  emitter.sendData({
30
32
  id: request.id,
31
33
  type: `${type}Response`,
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../libs/integrations-messenger/src/lib/actions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAuB,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AAUpC,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CAA2B,IAAO,EAAE,OAAkC,EAAE,EAAsB,EAAE,CAChG,CAAC,OAAO,EAAE,EAAE,CACV,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,EAAE,CAAC;IAEzB,MAAM,OAAO,GAAG,QAAQ,CAAC,iBAAiB,CAAC,GAAG,IAAI,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QACnF,IAAI,SAAS,KAAK,QAAQ,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,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ACT,CAAC;QAED,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,CAAC;QACf,EAAE,EAAE,SAAS;QACb,IAAI;QACJ,IAAI,EAAE,OAAiC;QACvC,MAAM,EAAE,QAAQ;KACjB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,yBAAyB,GACpC,CAA2B,IAAO,EAA4B,EAAE,CAChE,CAAC,OAAO,EAAE,EAAE,CACV,QAAQ,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACrD,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;QACjC,OAAO,CAAC,QAAQ,CAAC;YACf,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,GAAG,IAAI,UAAU;YACvB,MAAM,EAAE,OAAO,CAAC,GAAG;YACnB,IAAI,EAAE,QAA+C;SACtD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEP,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAW,EAAE,CAC5D,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type ActionResponseBaseDTO, ActionTypeEnum } from '../../models';
2
+ import { type ActionDataTypeDTO } from '../utils';
3
+ type WindowCloseModalDTO = void;
4
+ type WindowCloseModalResponseDTO = ActionResponseBaseDTO;
5
+ export type WindowCloseModalDataTypeDTO = ActionDataTypeDTO<WindowCloseModalDTO, WindowCloseModalResponseDTO>;
6
+ declare const _default: {
7
+ sendCloseModal: import("../../models").ActionCreatorFn<ActionTypeEnum.WindowCloseModal>;
8
+ handleCloseModal: import("../../models").ActionHandlerFn<ActionTypeEnum.WindowCloseModal>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { ActionTypeEnum } from '../../models';
2
+ import { buildActionCreatorFn, buildActionHandlerFn } from '../utils';
3
+ const sendCloseModal = buildActionCreatorFn(ActionTypeEnum.WindowCloseModal);
4
+ const handleCloseModal = buildActionHandlerFn(ActionTypeEnum.WindowCloseModal);
5
+ export default { sendCloseModal, handleCloseModal };
6
+ //# sourceMappingURL=close-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close-modal.js","sourceRoot":"","sources":["../../../../../../../libs/integrations-messenger/src/lib/actions/window/close-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAA0B,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAQ9F,MAAM,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAC7E,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAE/E,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,5 +1,9 @@
1
1
  declare const _default: {
2
2
  sendUpdateUrl: import("../../models").ActionCreatorFn<import("../base").ActionTypeEnum.WindowUpdateUrl>;
3
3
  handleUpdateUrl: import("../../models").ActionHandlerFn<import("../base").ActionTypeEnum.WindowUpdateUrl>;
4
+ sendOpenModal: import("../../models").ActionCreatorFn<import("../base").ActionTypeEnum.WindowOpenModal>;
5
+ handleOpenModal: import("../../models").ActionHandlerFn<import("../base").ActionTypeEnum.WindowOpenModal>;
6
+ sendCloseModal: import("../../models").ActionCreatorFn<import("../base").ActionTypeEnum.WindowCloseModal>;
7
+ handleCloseModal: import("../../models").ActionHandlerFn<import("../base").ActionTypeEnum.WindowCloseModal>;
4
8
  };
5
9
  export default _default;
@@ -1,5 +1,9 @@
1
+ import closeModal from './close-modal';
2
+ import openModal from './open-modal';
1
3
  import updateUrl from './update-url';
2
4
  export default {
5
+ ...closeModal,
6
+ ...openModal,
3
7
  ...updateUrl
4
8
  };
5
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/integrations-messenger/src/lib/actions/window/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,eAAe;IACb,GAAG,SAAS;CACb,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/integrations-messenger/src/lib/actions/window/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,eAAe;IACb,GAAG,UAAU;IACb,GAAG,SAAS;IACZ,GAAG,SAAS;CACb,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type ActionResponseBaseDTO, ActionTypeEnum } from '../../models';
2
+ import { type ActionDataTypeDTO } from '../utils';
3
+ type WindowOpenModalDTO = {
4
+ path: string;
5
+ };
6
+ type WindowOpenModalResponseDTO = ActionResponseBaseDTO;
7
+ export type WindowOpenModalDataTypeDTO = ActionDataTypeDTO<WindowOpenModalDTO, WindowOpenModalResponseDTO>;
8
+ declare const _default: {
9
+ sendOpenModal: import("../../models").ActionCreatorFn<ActionTypeEnum.WindowOpenModal>;
10
+ handleOpenModal: import("../../models").ActionHandlerFn<ActionTypeEnum.WindowOpenModal>;
11
+ };
12
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { ActionTypeEnum } from '../../models';
2
+ import { buildActionCreatorFn, buildActionHandlerFn } from '../utils';
3
+ const sendOpenModal = buildActionCreatorFn(ActionTypeEnum.WindowOpenModal);
4
+ const handleOpenModal = buildActionHandlerFn(ActionTypeEnum.WindowOpenModal, { includeSrcOrigin: true });
5
+ export default { sendOpenModal, handleOpenModal };
6
+ //# sourceMappingURL=open-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-modal.js","sourceRoot":"","sources":["../../../../../../../libs/integrations-messenger/src/lib/actions/window/open-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAA0B,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAU9F,MAAM,aAAa,GAAG,oBAAoB,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAC3E,MAAM,eAAe,GAAG,oBAAoB,CAAC,cAAc,CAAC,eAAe,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzG,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
@@ -16,6 +16,12 @@ export type ActionCreatorConfigDTO<T extends ActionTypeEnum> = {
16
16
  skipWhen?: (request: ActionRequestDTO<T>, response: ActionResponseDTO<T>) => boolean;
17
17
  };
18
18
  export type ActionCreatorFn<T extends ActionTypeEnum> = (request: ActionRequestDTO<T>) => Promise<ActionResponseDTO<T>>;
19
- export type ActionHandlerFn<T extends ActionTypeEnum> = (handler: (request: ActionRequestDTO<T>) => ActionResponseDTO<T> | Promise<ActionResponseDTO<T>>) => MessageHandlerResponseDTO;
19
+ export type ActionHandlerBuildOptions = {
20
+ includeSrcOrigin: boolean;
21
+ };
22
+ export type ActionHandlerExtraParams = {
23
+ srcOrigin?: string;
24
+ };
25
+ export type ActionHandlerFn<T extends ActionTypeEnum> = (handler: (request: ActionRequestDTO<T>, extras: ActionHandlerExtraParams) => ActionResponseDTO<T> | Promise<ActionResponseDTO<T>>) => MessageHandlerResponseDTO;
20
26
  export type StreamActionCreatorFn<T extends ActionTypeEnum> = (request: ActionRequestDTO<T>, handler: (response: ActionResponseDTO<T>) => void) => MessageHandlerResponseDTO;
21
27
  export type StreamActionHandlerFn<T extends ActionTypeEnum> = (handler: (request: ActionRequestDTO<T>, resolve: (response: ActionResponseDTO<T>) => void) => void) => MessageHandlerResponseDTO;