request-iframe 0.1.1 → 0.2.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.
Files changed (208) hide show
  1. package/QUICKSTART.CN.md +4 -2
  2. package/QUICKSTART.md +4 -2
  3. package/README.CN.md +129 -33
  4. package/README.md +116 -15
  5. package/cdn/request-iframe-react.umd.js +3354 -0
  6. package/cdn/request-iframe-react.umd.js.map +1 -0
  7. package/cdn/request-iframe-react.umd.min.js +2 -0
  8. package/cdn/request-iframe-react.umd.min.js.map +1 -0
  9. package/cdn/request-iframe.umd.js +19761 -0
  10. package/cdn/request-iframe.umd.js.map +1 -0
  11. package/cdn/request-iframe.umd.min.js +4 -0
  12. package/cdn/request-iframe.umd.min.js.map +1 -0
  13. package/esm/api/client.js +29 -21
  14. package/esm/api/endpoint.js +229 -0
  15. package/esm/api/server.js +16 -8
  16. package/esm/constants/debug.js +17 -0
  17. package/esm/constants/index.js +84 -67
  18. package/esm/constants/log.js +11 -0
  19. package/esm/constants/messages.js +3 -0
  20. package/esm/constants/warn-once.js +15 -0
  21. package/esm/endpoint/facade.js +390 -0
  22. package/esm/endpoint/heartbeat/heartbeat.js +60 -0
  23. package/esm/endpoint/heartbeat/ping.js +20 -0
  24. package/esm/endpoint/index.js +13 -0
  25. package/esm/endpoint/infra/hub.js +316 -0
  26. package/esm/endpoint/infra/inbox.js +232 -0
  27. package/esm/endpoint/infra/outbox.js +408 -0
  28. package/esm/endpoint/stream/dispatcher.js +58 -0
  29. package/esm/endpoint/stream/errors.js +27 -0
  30. package/esm/endpoint/stream/factory.js +76 -0
  31. package/esm/endpoint/stream/file-auto-resolve.js +34 -0
  32. package/esm/endpoint/stream/file-writable.js +105 -0
  33. package/esm/endpoint/stream/handler.js +26 -0
  34. package/esm/{core → impl}/client.js +240 -317
  35. package/esm/{core → impl}/response.js +113 -155
  36. package/esm/impl/server.js +568 -0
  37. package/esm/index.js +13 -6
  38. package/esm/message/ack.js +27 -0
  39. package/esm/message/channel-cache.js +108 -0
  40. package/esm/message/channel.js +90 -4
  41. package/esm/message/dispatcher.js +115 -75
  42. package/esm/stream/error.js +22 -0
  43. package/esm/stream/index.js +3 -1
  44. package/esm/stream/readable-stream.js +45 -9
  45. package/esm/stream/stream-core.js +7 -2
  46. package/esm/stream/writable-stream.js +97 -26
  47. package/esm/utils/blob.js +16 -0
  48. package/esm/utils/cache.js +25 -76
  49. package/esm/utils/content-type.js +81 -0
  50. package/esm/utils/debug.js +156 -179
  51. package/esm/utils/hooks.js +130 -0
  52. package/esm/utils/id.js +14 -0
  53. package/esm/utils/iframe.js +20 -0
  54. package/esm/utils/index.js +11 -163
  55. package/esm/utils/is.js +3 -0
  56. package/esm/utils/logger.js +55 -0
  57. package/esm/utils/promise.js +3 -0
  58. package/esm/utils/window.js +31 -0
  59. package/library/api/client.d.ts.map +1 -1
  60. package/library/api/client.js +30 -22
  61. package/library/api/endpoint.d.ts +23 -0
  62. package/library/api/endpoint.d.ts.map +1 -0
  63. package/library/api/endpoint.js +235 -0
  64. package/library/api/server.d.ts +4 -1
  65. package/library/api/server.d.ts.map +1 -1
  66. package/library/api/server.js +16 -8
  67. package/library/constants/debug.d.ts +18 -0
  68. package/library/constants/debug.d.ts.map +1 -0
  69. package/library/constants/debug.js +23 -0
  70. package/library/constants/index.d.ts +22 -2
  71. package/library/constants/index.d.ts.map +1 -1
  72. package/library/constants/index.js +110 -67
  73. package/library/constants/log.d.ts +12 -0
  74. package/library/constants/log.d.ts.map +1 -0
  75. package/library/constants/log.js +17 -0
  76. package/library/constants/messages.d.ts +3 -0
  77. package/library/constants/messages.d.ts.map +1 -1
  78. package/library/constants/messages.js +3 -0
  79. package/library/constants/warn-once.d.ts +12 -0
  80. package/library/constants/warn-once.d.ts.map +1 -0
  81. package/library/constants/warn-once.js +22 -0
  82. package/library/endpoint/facade.d.ts +238 -0
  83. package/library/endpoint/facade.d.ts.map +1 -0
  84. package/library/endpoint/facade.js +398 -0
  85. package/library/endpoint/heartbeat/heartbeat.d.ts +34 -0
  86. package/library/endpoint/heartbeat/heartbeat.d.ts.map +1 -0
  87. package/library/endpoint/heartbeat/heartbeat.js +67 -0
  88. package/library/endpoint/heartbeat/ping.d.ts +18 -0
  89. package/library/endpoint/heartbeat/ping.d.ts.map +1 -0
  90. package/library/endpoint/heartbeat/ping.js +26 -0
  91. package/library/endpoint/index.d.ts +16 -0
  92. package/library/endpoint/index.d.ts.map +1 -0
  93. package/library/endpoint/index.js +114 -0
  94. package/library/endpoint/infra/hub.d.ts +170 -0
  95. package/library/endpoint/infra/hub.d.ts.map +1 -0
  96. package/library/endpoint/infra/hub.js +323 -0
  97. package/library/endpoint/infra/inbox.d.ts +73 -0
  98. package/library/endpoint/infra/inbox.d.ts.map +1 -0
  99. package/library/endpoint/infra/inbox.js +239 -0
  100. package/library/endpoint/infra/outbox.d.ts +149 -0
  101. package/library/endpoint/infra/outbox.d.ts.map +1 -0
  102. package/library/endpoint/infra/outbox.js +415 -0
  103. package/library/endpoint/stream/dispatcher.d.ts +33 -0
  104. package/library/endpoint/stream/dispatcher.d.ts.map +1 -0
  105. package/library/endpoint/stream/dispatcher.js +66 -0
  106. package/library/endpoint/stream/errors.d.ts +20 -0
  107. package/library/endpoint/stream/errors.d.ts.map +1 -0
  108. package/library/endpoint/stream/errors.js +32 -0
  109. package/library/endpoint/stream/factory.d.ts +44 -0
  110. package/library/endpoint/stream/factory.d.ts.map +1 -0
  111. package/library/endpoint/stream/factory.js +82 -0
  112. package/library/endpoint/stream/file-auto-resolve.d.ts +26 -0
  113. package/library/endpoint/stream/file-auto-resolve.d.ts.map +1 -0
  114. package/library/endpoint/stream/file-auto-resolve.js +41 -0
  115. package/library/endpoint/stream/file-writable.d.ts +33 -0
  116. package/library/endpoint/stream/file-writable.d.ts.map +1 -0
  117. package/library/endpoint/stream/file-writable.js +115 -0
  118. package/library/endpoint/stream/handler.d.ts +20 -0
  119. package/library/endpoint/stream/handler.d.ts.map +1 -0
  120. package/library/endpoint/stream/handler.js +32 -0
  121. package/library/{core → impl}/client.d.ts +16 -13
  122. package/library/impl/client.d.ts.map +1 -0
  123. package/library/{core → impl}/client.js +251 -330
  124. package/library/{core → impl}/request.d.ts.map +1 -1
  125. package/library/{core → impl}/response.d.ts +5 -10
  126. package/library/impl/response.d.ts.map +1 -0
  127. package/library/{core → impl}/response.js +113 -155
  128. package/library/{core → impl}/server.d.ts +22 -55
  129. package/library/impl/server.d.ts.map +1 -0
  130. package/library/impl/server.js +575 -0
  131. package/library/index.d.ts +13 -6
  132. package/library/index.d.ts.map +1 -1
  133. package/library/index.js +16 -16
  134. package/library/message/ack.d.ts +15 -0
  135. package/library/message/ack.d.ts.map +1 -0
  136. package/library/message/ack.js +33 -0
  137. package/library/message/channel-cache.d.ts +26 -0
  138. package/library/message/channel-cache.d.ts.map +1 -0
  139. package/library/message/channel-cache.js +115 -0
  140. package/library/message/channel.d.ts +53 -6
  141. package/library/message/channel.d.ts.map +1 -1
  142. package/library/message/channel.js +94 -8
  143. package/library/message/dispatcher.d.ts +7 -0
  144. package/library/message/dispatcher.d.ts.map +1 -1
  145. package/library/message/dispatcher.js +116 -76
  146. package/library/stream/error.d.ts +24 -0
  147. package/library/stream/error.d.ts.map +1 -0
  148. package/library/stream/error.js +29 -0
  149. package/library/stream/index.d.ts +4 -1
  150. package/library/stream/index.d.ts.map +1 -1
  151. package/library/stream/index.js +7 -4
  152. package/library/stream/readable-stream.d.ts.map +1 -1
  153. package/library/stream/readable-stream.js +46 -10
  154. package/library/stream/stream-core.d.ts.map +1 -1
  155. package/library/stream/stream-core.js +6 -1
  156. package/library/stream/writable-stream.d.ts.map +1 -1
  157. package/library/stream/writable-stream.js +99 -28
  158. package/library/types/index.d.ts +15 -19
  159. package/library/types/index.d.ts.map +1 -1
  160. package/library/utils/blob.d.ts +3 -0
  161. package/library/utils/blob.d.ts.map +1 -0
  162. package/library/utils/blob.js +22 -0
  163. package/library/utils/cache.d.ts +10 -20
  164. package/library/utils/cache.d.ts.map +1 -1
  165. package/library/utils/cache.js +25 -79
  166. package/library/utils/content-type.d.ts +13 -0
  167. package/library/utils/content-type.d.ts.map +1 -0
  168. package/library/utils/content-type.js +87 -0
  169. package/library/utils/debug.d.ts.map +1 -1
  170. package/library/utils/debug.js +155 -177
  171. package/library/utils/hooks.d.ts +30 -0
  172. package/library/utils/hooks.d.ts.map +1 -0
  173. package/library/utils/hooks.js +139 -0
  174. package/library/utils/id.d.ts +9 -0
  175. package/library/utils/id.d.ts.map +1 -0
  176. package/library/utils/id.js +21 -0
  177. package/library/utils/iframe.d.ts +5 -0
  178. package/library/utils/iframe.d.ts.map +1 -0
  179. package/library/utils/iframe.js +25 -0
  180. package/library/utils/index.d.ts +7 -34
  181. package/library/utils/index.d.ts.map +1 -1
  182. package/library/utils/index.js +58 -194
  183. package/library/utils/is.d.ts +2 -0
  184. package/library/utils/is.d.ts.map +1 -0
  185. package/library/utils/is.js +9 -0
  186. package/library/utils/logger.d.ts +13 -0
  187. package/library/utils/logger.d.ts.map +1 -0
  188. package/library/utils/logger.js +63 -0
  189. package/library/utils/promise.d.ts +2 -0
  190. package/library/utils/promise.d.ts.map +1 -0
  191. package/library/utils/promise.js +9 -0
  192. package/library/utils/window.d.ts +2 -0
  193. package/library/utils/window.d.ts.map +1 -0
  194. package/library/utils/window.js +38 -0
  195. package/package.json +49 -2
  196. package/react/package.json +2 -1
  197. package/esm/core/client-server.js +0 -294
  198. package/esm/core/server.js +0 -776
  199. package/library/core/client-server.d.ts +0 -97
  200. package/library/core/client-server.d.ts.map +0 -1
  201. package/library/core/client-server.js +0 -301
  202. package/library/core/client.d.ts.map +0 -1
  203. package/library/core/response.d.ts.map +0 -1
  204. package/library/core/server.d.ts.map +0 -1
  205. package/library/core/server.js +0 -781
  206. /package/esm/{core → impl}/request.js +0 -0
  207. /package/library/{core → impl}/request.d.ts +0 -0
  208. /package/library/{core → impl}/request.js +0 -0
@@ -10,28 +10,21 @@ import "core-js/modules/es.promise.js";
10
10
  import "core-js/modules/web.dom-collections.iterator.js";
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
- import { MessageType, getStatusText, Messages } from '../constants';
14
-
15
- /**
16
- * Debug log prefix
17
- */
18
- var DEBUG_PREFIX = '[request-iframe]';
19
-
20
- /**
21
- * Format log output
22
- * - Prefix: bold
23
- * - info: message text in blue
24
- */
25
- function log(level, message, data) {
26
- var timestamp = new Date().toISOString();
27
- var prefix = `${DEBUG_PREFIX} [${timestamp}] [${level.toUpperCase()}]`;
28
- var prefixStyle = 'font-weight:bold';
29
- var messageStyle = level === 'info' ? 'color: #1976d2' : '';
30
- if (data !== undefined) {
31
- console[level](`%c${prefix}%c ${message}`, prefixStyle, messageStyle, data);
32
- } else {
33
- console[level](`%c${prefix}%c ${message}`, prefixStyle, messageStyle);
13
+ import { MessageType, getStatusText, Messages, LogLevel, DebugEvent } from '../constants';
14
+ import { ensureRequestIframeLogLevel, requestIframeLog } from './logger';
15
+ function logEvent(level, event, message, data) {
16
+ if (data !== undefined && data !== null && typeof data === 'object') {
17
+ requestIframeLog(level, message, _objectSpread({
18
+ event
19
+ }, data));
20
+ return;
34
21
  }
22
+ requestIframeLog(level, message, data === undefined ? {
23
+ event
24
+ } : {
25
+ event,
26
+ data
27
+ });
35
28
  }
36
29
 
37
30
  /**
@@ -63,9 +56,11 @@ function formatMessageData(data) {
63
56
  * Register debug interceptors for client
64
57
  */
65
58
  export function setupClientDebugInterceptors(client) {
59
+ ensureRequestIframeLogLevel(LogLevel.INFO);
60
+
66
61
  // Request interceptor: log request start
67
62
  client.interceptors.request.use(config => {
68
- log('info', Messages.DEBUG_CLIENT_REQUEST_START, formatMessageData({
63
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_REQUEST_START, Messages.DEBUG_CLIENT_REQUEST_START, formatMessageData({
69
64
  path: config.path,
70
65
  body: config.body,
71
66
  headers: config.headers,
@@ -98,20 +93,20 @@ export function setupClientDebugInterceptors(client) {
98
93
  mimeType,
99
94
  contentLength
100
95
  };
101
- log('info', Messages.DEBUG_CLIENT_REQUEST_SUCCESS_FILE, formatMessageData(logData));
96
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_REQUEST_SUCCESS_FILE, Messages.DEBUG_CLIENT_REQUEST_SUCCESS_FILE, formatMessageData(logData));
102
97
  } else if (response.stream) {
103
98
  logData.stream = {
104
99
  streamId: response.stream.streamId,
105
100
  type: response.stream.type
106
101
  };
107
- log('info', Messages.DEBUG_CLIENT_REQUEST_SUCCESS_STREAM, formatMessageData(logData));
102
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_REQUEST_SUCCESS_STREAM, Messages.DEBUG_CLIENT_REQUEST_SUCCESS_STREAM, formatMessageData(logData));
108
103
  } else {
109
104
  logData.data = response.data;
110
- log('info', Messages.DEBUG_CLIENT_REQUEST_SUCCESS, formatMessageData(logData));
105
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_REQUEST_SUCCESS, Messages.DEBUG_CLIENT_REQUEST_SUCCESS, formatMessageData(logData));
111
106
  }
112
107
  return response;
113
108
  }, error => {
114
- log('error', Messages.DEBUG_CLIENT_REQUEST_FAILED, formatMessageData({
109
+ logEvent(LogLevel.ERROR, DebugEvent.CLIENT_REQUEST_FAILED, Messages.DEBUG_CLIENT_REQUEST_FAILED, formatMessageData({
115
110
  requestId: error.requestId,
116
111
  code: error.code,
117
112
  message: error.message,
@@ -121,114 +116,116 @@ export function setupClientDebugInterceptors(client) {
121
116
  return Promise.reject(error);
122
117
  });
123
118
 
124
- // Hook into client's internal message handling via server's message dispatcher
125
- // This requires accessing internal properties, so we use type assertion
119
+ /** Attach hook-based message debugging (no monkey patch). */
126
120
  var clientImpl = client;
127
- if (clientImpl.server && clientImpl.server.messageDispatcher) {
128
- setupClientMessageDebugging(clientImpl);
129
- }
121
+ setupClientMessageDebuggingViaHooks(clientImpl);
130
122
  }
131
123
 
132
124
  /**
133
- * Setup message-level debugging for client
125
+ * Setup message-level debugging for client (hook-based, no monkey patch).
134
126
  */
135
- function setupClientMessageDebugging(clientImpl) {
136
- var _server$_registerPend, _server$messageDispat;
137
- var server = clientImpl.server;
138
-
139
- // Store original _registerPendingRequest
140
- var originalRegister = (_server$_registerPend = server._registerPendingRequest) === null || _server$_registerPend === void 0 ? void 0 : _server$_registerPend.bind(server);
141
- if (originalRegister) {
142
- server._registerPendingRequest = function (requestId, resolve, reject, origin) {
143
- // Wrap resolve to log incoming messages
144
- var wrappedResolve = data => {
145
- if (data.type === MessageType.ACK) {
146
- log('info', Messages.DEBUG_CLIENT_RECEIVED_ACK, formatMessageData({
147
- requestId: data.requestId,
148
- path: data.path
149
- }));
150
- } else if (data.type === MessageType.ASYNC) {
151
- log('info', Messages.DEBUG_CLIENT_RECEIVED_ASYNC, formatMessageData({
152
- requestId: data.requestId,
153
- path: data.path
154
- }));
155
- } else if (data.type === MessageType.STREAM_START) {
156
- var streamBody = data.body;
157
- log('info', Messages.DEBUG_CLIENT_RECEIVED_STREAM_START, formatMessageData({
158
- requestId: data.requestId,
159
- streamId: streamBody === null || streamBody === void 0 ? void 0 : streamBody.streamId,
160
- streamType: streamBody === null || streamBody === void 0 ? void 0 : streamBody.type,
161
- chunked: streamBody === null || streamBody === void 0 ? void 0 : streamBody.chunked,
162
- autoResolve: streamBody === null || streamBody === void 0 ? void 0 : streamBody.autoResolve,
163
- metadata: streamBody === null || streamBody === void 0 ? void 0 : streamBody.metadata
164
- }));
165
- } else if (data.type === MessageType.STREAM_DATA) {
166
- var _streamBody$data;
167
- var _streamBody = data.body;
168
- log('info', Messages.DEBUG_CLIENT_RECEIVED_STREAM_DATA, formatMessageData({
169
- requestId: data.requestId,
170
- streamId: _streamBody === null || _streamBody === void 0 ? void 0 : _streamBody.streamId,
171
- done: _streamBody === null || _streamBody === void 0 ? void 0 : _streamBody.done,
172
- dataLength: (_streamBody === null || _streamBody === void 0 || (_streamBody$data = _streamBody.data) === null || _streamBody$data === void 0 ? void 0 : _streamBody$data.length) || 0
173
- }));
174
- } else if (data.type === MessageType.STREAM_END) {
175
- var _streamBody2 = data.body;
176
- log('info', Messages.DEBUG_CLIENT_RECEIVED_STREAM_END, formatMessageData({
177
- requestId: data.requestId,
178
- streamId: _streamBody2 === null || _streamBody2 === void 0 ? void 0 : _streamBody2.streamId
179
- }));
180
- } else if (data.type === MessageType.RESPONSE) {
181
- log('info', Messages.DEBUG_CLIENT_RECEIVED_RESPONSE, formatMessageData({
182
- requestId: data.requestId,
183
- status: data.status,
184
- statusText: data.statusText,
185
- requireAck: data.requireAck
186
- }));
187
- } else if (data.type === MessageType.ERROR) {
188
- log('error', Messages.DEBUG_CLIENT_RECEIVED_ERROR, formatMessageData({
189
- requestId: data.requestId,
190
- status: data.status,
191
- statusText: data.statusText,
192
- error: data.error
193
- }));
194
- }
195
- resolve(data);
196
- };
197
-
198
- // Wrap reject to log timeouts
199
- var wrappedReject = () => {
200
- log('warn', Messages.DEBUG_CLIENT_REQUEST_TIMEOUT, {
201
- requestId,
202
- origin
203
- });
204
- reject();
205
- };
206
- return originalRegister(requestId, wrappedResolve, wrappedReject, origin);
207
- };
208
- }
127
+ function setupClientMessageDebuggingViaHooks(clientImpl) {
128
+ var _clientImpl$hub, _clientImpl$getHub, _outbox$hooks, _dispatcher$hooks, _inbox$hooks, _dispatcher$hooks2;
129
+ var inbox = clientImpl.inbox;
130
+ var outbox = clientImpl.outbox;
131
+ var dispatcher = ((_clientImpl$hub = clientImpl.hub) === null || _clientImpl$hub === void 0 ? void 0 : _clientImpl$hub.messageDispatcher) || ((_clientImpl$getHub = clientImpl.getHub) === null || _clientImpl$getHub === void 0 || (_clientImpl$getHub = _clientImpl$getHub.call(clientImpl)) === null || _clientImpl$getHub === void 0 ? void 0 : _clientImpl$getHub.messageDispatcher);
209
132
 
210
- // Log when messages are sent
211
- var originalSendMessage = (_server$messageDispat = server.messageDispatcher) === null || _server$messageDispat === void 0 || (_server$messageDispat = _server$messageDispat.sendMessage) === null || _server$messageDispat === void 0 ? void 0 : _server$messageDispat.bind(server.messageDispatcher);
212
- if (originalSendMessage) {
213
- server.messageDispatcher.sendMessage = function (target, targetOrigin, type, requestId, data) {
133
+ /** Outbound */
134
+ if (outbox !== null && outbox !== void 0 && (_outbox$hooks = outbox.hooks) !== null && _outbox$hooks !== void 0 && (_outbox$hooks = _outbox$hooks.afterSendMessage) !== null && _outbox$hooks !== void 0 && _outbox$hooks.tap) {
135
+ outbox.hooks.afterSendMessage.tap('debug', (type, requestId, data) => {
214
136
  if (type === MessageType.REQUEST) {
215
- log('info', Messages.DEBUG_CLIENT_SENDING_REQUEST, formatMessageData({
137
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_OUTBOUND, Messages.DEBUG_CLIENT_SENDING_REQUEST, formatMessageData({
216
138
  requestId,
217
139
  path: data === null || data === void 0 ? void 0 : data.path,
218
140
  body: data === null || data === void 0 ? void 0 : data.body,
219
141
  headers: data === null || data === void 0 ? void 0 : data.headers
220
142
  }));
221
143
  } else if (type === MessageType.PING) {
222
- log('info', Messages.DEBUG_CLIENT_SENDING_PING, {
144
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_OUTBOUND, Messages.DEBUG_CLIENT_SENDING_PING, {
223
145
  requestId
224
146
  });
225
147
  } else if (type === MessageType.ACK) {
226
- log('info', Messages.DEBUG_CLIENT_SENDING_RECEIVED_ACK, {
148
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_OUTBOUND, Messages.DEBUG_CLIENT_SENDING_RECEIVED_ACK, {
227
149
  requestId
228
150
  });
229
151
  }
230
- return originalSendMessage(target, targetOrigin, type, requestId, data);
231
- };
152
+ });
153
+ } else if (dispatcher !== null && dispatcher !== void 0 && (_dispatcher$hooks = dispatcher.hooks) !== null && _dispatcher$hooks !== void 0 && (_dispatcher$hooks = _dispatcher$hooks.afterSend) !== null && _dispatcher$hooks !== void 0 && _dispatcher$hooks.tap) {
154
+ dispatcher.hooks.afterSend.tap('debug', (_target, _origin, message) => {
155
+ if (message.type === MessageType.REQUEST) {
156
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_OUTBOUND, Messages.DEBUG_CLIENT_SENDING_REQUEST, formatMessageData({
157
+ requestId: message.requestId,
158
+ path: message.path,
159
+ body: message.body,
160
+ headers: message.headers
161
+ }));
162
+ }
163
+ });
164
+ }
165
+
166
+ /** Inbound */
167
+ if (inbox !== null && inbox !== void 0 && (_inbox$hooks = inbox.hooks) !== null && _inbox$hooks !== void 0 && (_inbox$hooks = _inbox$hooks.inbound) !== null && _inbox$hooks !== void 0 && _inbox$hooks.tap) {
168
+ inbox.hooks.inbound.tap('debug', data => {
169
+ if (data.type === MessageType.ACK) {
170
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_ACK, formatMessageData({
171
+ requestId: data.requestId,
172
+ path: data.path
173
+ }));
174
+ } else if (data.type === MessageType.ASYNC) {
175
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_ASYNC, formatMessageData({
176
+ requestId: data.requestId,
177
+ path: data.path
178
+ }));
179
+ } else if (data.type === MessageType.STREAM_START) {
180
+ var streamBody = data.body;
181
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_STREAM_START, formatMessageData({
182
+ requestId: data.requestId,
183
+ streamId: streamBody === null || streamBody === void 0 ? void 0 : streamBody.streamId,
184
+ streamType: streamBody === null || streamBody === void 0 ? void 0 : streamBody.type,
185
+ chunked: streamBody === null || streamBody === void 0 ? void 0 : streamBody.chunked,
186
+ autoResolve: streamBody === null || streamBody === void 0 ? void 0 : streamBody.autoResolve,
187
+ metadata: streamBody === null || streamBody === void 0 ? void 0 : streamBody.metadata
188
+ }));
189
+ } else if (data.type === MessageType.STREAM_DATA) {
190
+ var _streamBody$data;
191
+ var _streamBody = data.body;
192
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_STREAM_DATA, formatMessageData({
193
+ requestId: data.requestId,
194
+ streamId: _streamBody === null || _streamBody === void 0 ? void 0 : _streamBody.streamId,
195
+ done: _streamBody === null || _streamBody === void 0 ? void 0 : _streamBody.done,
196
+ dataLength: (_streamBody === null || _streamBody === void 0 || (_streamBody$data = _streamBody.data) === null || _streamBody$data === void 0 ? void 0 : _streamBody$data.length) || 0
197
+ }));
198
+ } else if (data.type === MessageType.STREAM_END) {
199
+ var _streamBody2 = data.body;
200
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_STREAM_END, formatMessageData({
201
+ requestId: data.requestId,
202
+ streamId: _streamBody2 === null || _streamBody2 === void 0 ? void 0 : _streamBody2.streamId
203
+ }));
204
+ } else if (data.type === MessageType.RESPONSE) {
205
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_RESPONSE, formatMessageData({
206
+ requestId: data.requestId,
207
+ status: data.status,
208
+ statusText: data.statusText,
209
+ requireAck: data.requireAck
210
+ }));
211
+ } else if (data.type === MessageType.ERROR) {
212
+ logEvent(LogLevel.ERROR, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_ERROR, formatMessageData({
213
+ requestId: data.requestId,
214
+ status: data.status,
215
+ statusText: data.statusText,
216
+ error: data.error
217
+ }));
218
+ }
219
+ });
220
+ } else if (dispatcher !== null && dispatcher !== void 0 && (_dispatcher$hooks2 = dispatcher.hooks) !== null && _dispatcher$hooks2 !== void 0 && (_dispatcher$hooks2 = _dispatcher$hooks2.inbound) !== null && _dispatcher$hooks2 !== void 0 && _dispatcher$hooks2.tap) {
221
+ dispatcher.hooks.inbound.tap('debug', data => {
222
+ if (data.type === MessageType.ACK) {
223
+ logEvent(LogLevel.INFO, DebugEvent.CLIENT_MESSAGE_INBOUND, Messages.DEBUG_CLIENT_RECEIVED_ACK, formatMessageData({
224
+ requestId: data.requestId,
225
+ path: data.path
226
+ }));
227
+ }
228
+ });
232
229
  }
233
230
  }
234
231
 
@@ -237,6 +234,7 @@ function setupClientMessageDebugging(clientImpl) {
237
234
  * Use middleware to log requests and responses
238
235
  */
239
236
  export function setupServerDebugListeners(server) {
237
+ ensureRequestIframeLogLevel(LogLevel.INFO);
240
238
  var serverImpl = server;
241
239
  var startTimes = new Map();
242
240
 
@@ -245,7 +243,7 @@ export function setupServerDebugListeners(server) {
245
243
  var _res$sendStream;
246
244
  var startTime = Date.now();
247
245
  startTimes.set(req.requestId, startTime);
248
- log('info', Messages.DEBUG_SERVER_RECEIVED_REQUEST, formatMessageData({
246
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_REQUEST_RECEIVED, Messages.DEBUG_SERVER_RECEIVED_REQUEST, formatMessageData({
249
247
  requestId: req.requestId,
250
248
  path: req.path,
251
249
  body: req.body,
@@ -265,7 +263,7 @@ export function setupServerDebugListeners(server) {
265
263
 
266
264
  // Track status code changes
267
265
  res.status = function (code) {
268
- log('info', Messages.DEBUG_SERVER_SETTING_STATUS_CODE, {
266
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_RESPONSE_SEND, Messages.DEBUG_SERVER_SETTING_STATUS_CODE, {
269
267
  requestId: req.requestId,
270
268
  path: req.path,
271
269
  statusCode: code
@@ -275,7 +273,7 @@ export function setupServerDebugListeners(server) {
275
273
 
276
274
  // Track header changes
277
275
  res.setHeader = function (name, value) {
278
- log('info', Messages.DEBUG_SERVER_SETTING_HEADER, {
276
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_RESPONSE_SEND, Messages.DEBUG_SERVER_SETTING_HEADER, {
279
277
  requestId: req.requestId,
280
278
  path: req.path,
281
279
  header: name,
@@ -293,7 +291,7 @@ export function setupServerDebugListeners(server) {
293
291
  case 0:
294
292
  duration = Date.now() - (startTimes.get(req.requestId) || startTime);
295
293
  startTimes.delete(req.requestId);
296
- log('info', Messages.DEBUG_SERVER_SENDING_RESPONSE, formatMessageData({
294
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_RESPONSE_SEND, Messages.DEBUG_SERVER_SENDING_RESPONSE, formatMessageData({
297
295
  requestId: req.requestId,
298
296
  path: req.path,
299
297
  status: res.statusCode,
@@ -324,7 +322,7 @@ export function setupServerDebugListeners(server) {
324
322
  case 0:
325
323
  duration = Date.now() - (startTimes.get(req.requestId) || startTime);
326
324
  startTimes.delete(req.requestId);
327
- log('info', Messages.DEBUG_SERVER_SENDING_JSON_RESPONSE, formatMessageData({
325
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_RESPONSE_SEND, Messages.DEBUG_SERVER_SENDING_JSON_RESPONSE, formatMessageData({
328
326
  requestId: req.requestId,
329
327
  path: req.path,
330
328
  status: res.statusCode,
@@ -355,7 +353,7 @@ export function setupServerDebugListeners(server) {
355
353
  case 0:
356
354
  duration = Date.now() - (startTimes.get(req.requestId) || startTime);
357
355
  startTimes.delete(req.requestId);
358
- log('info', Messages.DEBUG_SERVER_SENDING_FILE, formatMessageData({
356
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_RESPONSE_SEND, Messages.DEBUG_SERVER_SENDING_FILE, formatMessageData({
359
357
  requestId: req.requestId,
360
358
  path: req.path,
361
359
  status: res.statusCode,
@@ -387,7 +385,7 @@ export function setupServerDebugListeners(server) {
387
385
  case 0:
388
386
  duration = Date.now() - (startTimes.get(req.requestId) || startTime);
389
387
  startTimes.delete(req.requestId);
390
- log('info', Messages.DEBUG_SERVER_SENDING_STREAM, formatMessageData({
388
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_RESPONSE_SEND, Messages.DEBUG_SERVER_SENDING_STREAM, formatMessageData({
391
389
  requestId: req.requestId,
392
390
  path: req.path,
393
391
  status: res.statusCode,
@@ -410,36 +408,37 @@ export function setupServerDebugListeners(server) {
410
408
  next();
411
409
  });
412
410
 
413
- // Hook into server's message dispatcher for more detailed logging
414
- if (serverImpl.messageDispatcher) {
415
- setupServerMessageDebugging(serverImpl);
416
- }
411
+ /** Hook into MessageDispatcher hooks (no monkey patch). */
412
+ setupServerMessageDebuggingViaHooks(serverImpl);
417
413
  }
418
414
 
419
415
  /**
420
- * Setup message-level debugging for server
416
+ * Setup message-level debugging for server (hook-based, no monkey patch).
421
417
  */
422
- function setupServerMessageDebugging(serverImpl) {
423
- var _dispatcher$sendMessa, _serverImpl$handleReq, _serverImpl$runMiddle;
424
- var dispatcher = serverImpl.messageDispatcher;
418
+ function setupServerMessageDebuggingViaHooks(serverImpl) {
419
+ var _dispatcher$hooks$aft, _dispatcher$hooks$inb;
420
+ var dispatcher = serverImpl.messageDispatcher || serverImpl.dispatcher;
421
+ if (!(dispatcher !== null && dispatcher !== void 0 && dispatcher.hooks)) return;
425
422
 
426
- // Log when messages are sent
427
- var originalSendMessage = (_dispatcher$sendMessa = dispatcher.sendMessage) === null || _dispatcher$sendMessa === void 0 ? void 0 : _dispatcher$sendMessa.bind(dispatcher);
428
- if (originalSendMessage) {
429
- dispatcher.sendMessage = function (target, targetOrigin, type, requestId, data) {
423
+ /** Outbound messages */
424
+ if ((_dispatcher$hooks$aft = dispatcher.hooks.afterSend) !== null && _dispatcher$hooks$aft !== void 0 && _dispatcher$hooks$aft.tap) {
425
+ dispatcher.hooks.afterSend.tap('debug', (_target, _targetOrigin, message) => {
426
+ var type = message.type;
427
+ var requestId = message.requestId;
428
+ var data = message;
430
429
  if (type === MessageType.ACK) {
431
- log('info', Messages.DEBUG_SERVER_SENDING_ACK, formatMessageData({
430
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_MESSAGE_OUTBOUND, Messages.DEBUG_SERVER_SENDING_ACK, formatMessageData({
432
431
  requestId,
433
- path: data === null || data === void 0 ? void 0 : data.path
432
+ path: data.path
434
433
  }));
435
434
  } else if (type === MessageType.ASYNC) {
436
- log('info', Messages.DEBUG_SERVER_SENDING_ASYNC, formatMessageData({
435
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_MESSAGE_OUTBOUND, Messages.DEBUG_SERVER_SENDING_ASYNC, formatMessageData({
437
436
  requestId,
438
- path: data === null || data === void 0 ? void 0 : data.path
437
+ path: data.path
439
438
  }));
440
439
  } else if (type === MessageType.STREAM_START) {
441
440
  var streamBody = (data === null || data === void 0 ? void 0 : data.body) || {};
442
- log('info', Messages.DEBUG_SERVER_SENDING_STREAM_START, formatMessageData({
441
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_MESSAGE_OUTBOUND, Messages.DEBUG_SERVER_SENDING_STREAM_START, formatMessageData({
443
442
  requestId,
444
443
  streamId: streamBody.streamId,
445
444
  streamType: streamBody.type,
@@ -450,7 +449,7 @@ function setupServerMessageDebugging(serverImpl) {
450
449
  } else if (type === MessageType.STREAM_DATA) {
451
450
  var _streamBody3$data;
452
451
  var _streamBody3 = (data === null || data === void 0 ? void 0 : data.body) || {};
453
- log('info', Messages.DEBUG_SERVER_SENDING_STREAM_DATA, formatMessageData({
452
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_MESSAGE_OUTBOUND, Messages.DEBUG_SERVER_SENDING_STREAM_DATA, formatMessageData({
454
453
  requestId,
455
454
  streamId: _streamBody3.streamId,
456
455
  done: _streamBody3.done,
@@ -458,12 +457,12 @@ function setupServerMessageDebugging(serverImpl) {
458
457
  }));
459
458
  } else if (type === MessageType.STREAM_END) {
460
459
  var _streamBody4 = (data === null || data === void 0 ? void 0 : data.body) || {};
461
- log('info', Messages.DEBUG_SERVER_SENDING_STREAM_END, formatMessageData({
460
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_MESSAGE_OUTBOUND, Messages.DEBUG_SERVER_SENDING_STREAM_END, formatMessageData({
462
461
  requestId,
463
462
  streamId: _streamBody4.streamId
464
463
  }));
465
464
  } else if (type === MessageType.ERROR) {
466
- log('error', Messages.DEBUG_SERVER_SENDING_ERROR, formatMessageData({
465
+ logEvent(LogLevel.ERROR, DebugEvent.SERVER_MESSAGE_OUTBOUND, Messages.DEBUG_SERVER_SENDING_ERROR, formatMessageData({
467
466
  requestId,
468
467
  status: data === null || data === void 0 ? void 0 : data.status,
469
468
  statusText: data === null || data === void 0 ? void 0 : data.statusText,
@@ -471,7 +470,7 @@ function setupServerMessageDebugging(serverImpl) {
471
470
  path: data === null || data === void 0 ? void 0 : data.path
472
471
  }));
473
472
  } else if (type === MessageType.RESPONSE) {
474
- log('info', Messages.DEBUG_SERVER_SENDING_RESPONSE_VIA_DISPATCHER, formatMessageData({
473
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_MESSAGE_OUTBOUND, Messages.DEBUG_SERVER_SENDING_RESPONSE_VIA_DISPATCHER, formatMessageData({
475
474
  requestId,
476
475
  status: data === null || data === void 0 ? void 0 : data.status,
477
476
  statusText: data === null || data === void 0 ? void 0 : data.statusText,
@@ -479,43 +478,21 @@ function setupServerMessageDebugging(serverImpl) {
479
478
  path: data === null || data === void 0 ? void 0 : data.path
480
479
  }));
481
480
  }
482
- return originalSendMessage(target, targetOrigin, type, requestId, data);
483
- };
481
+ });
484
482
  }
485
483
 
486
- // Log when requests are received (before handler)
487
- var originalHandleRequest = (_serverImpl$handleReq = serverImpl.handleRequest) === null || _serverImpl$handleReq === void 0 ? void 0 : _serverImpl$handleReq.bind(serverImpl);
488
- if (originalHandleRequest) {
489
- serverImpl.handleRequest = function (data, context) {
490
- log('info', Messages.DEBUG_SERVER_HANDLING_REQUEST, formatMessageData({
491
- requestId: data.requestId,
492
- path: data.path,
493
- origin: context === null || context === void 0 ? void 0 : context.origin,
494
- role: data.role,
495
- creatorId: data.creatorId
496
- }));
497
- return originalHandleRequest(data, context);
498
- };
499
- }
500
-
501
- // Log handler execution
502
- var originalRunMiddlewares = (_serverImpl$runMiddle = serverImpl.runMiddlewares) === null || _serverImpl$runMiddle === void 0 ? void 0 : _serverImpl$runMiddle.bind(serverImpl);
503
- if (originalRunMiddlewares) {
504
- serverImpl.runMiddlewares = function (req, res, callback) {
505
- var handlerStartTime = Date.now();
506
- log('info', Messages.DEBUG_SERVER_EXECUTING_MIDDLEWARE_CHAIN, {
507
- requestId: req.requestId,
508
- path: req.path
509
- });
510
- return originalRunMiddlewares(req, res, () => {
511
- var handlerDuration = Date.now() - handlerStartTime;
512
- log('info', Messages.DEBUG_SERVER_MIDDLEWARE_CHAIN_COMPLETED, {
513
- requestId: req.requestId,
514
- path: req.path,
515
- duration: `${handlerDuration}ms`
516
- });
517
- callback();
518
- });
519
- };
484
+ /** Inbound messages */
485
+ if ((_dispatcher$hooks$inb = dispatcher.hooks.inbound) !== null && _dispatcher$hooks$inb !== void 0 && _dispatcher$hooks$inb.tap) {
486
+ dispatcher.hooks.inbound.tap('debug', (data, context) => {
487
+ if (data.type === MessageType.REQUEST) {
488
+ logEvent(LogLevel.INFO, DebugEvent.SERVER_MESSAGE_INBOUND, Messages.DEBUG_SERVER_HANDLING_REQUEST, formatMessageData({
489
+ requestId: data.requestId,
490
+ path: data.path,
491
+ origin: context === null || context === void 0 ? void 0 : context.origin,
492
+ role: data.role,
493
+ creatorId: data.creatorId
494
+ }));
495
+ }
496
+ });
520
497
  }
521
498
  }
@@ -0,0 +1,130 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ import "core-js/modules/es.symbol.description.js";
8
+ import "core-js/modules/es.array.from.js";
9
+ import "core-js/modules/es.array.index-of.js";
10
+ import "core-js/modules/es.array.iterator.js";
11
+ import "core-js/modules/es.array.slice.js";
12
+ import "core-js/modules/es.array.splice.js";
13
+ import "core-js/modules/es.regexp.exec.js";
14
+ import "core-js/modules/es.regexp.to-string.js";
15
+ import "core-js/modules/web.dom-collections.iterator.js";
16
+ /**
17
+ * A tiny "Tapable-like" hook implementation.
18
+ *
19
+ * Design goals:
20
+ * - Zero dependencies
21
+ * - Browser-friendly
22
+ * - Familiar API surface (tap/call, tapPromise/promise)
23
+ */
24
+
25
+ /**
26
+ * SyncHook - runs taps synchronously in registration order.
27
+ */
28
+ export class SyncHook {
29
+ constructor() {
30
+ _defineProperty(this, "taps", []);
31
+ }
32
+ tap(name, fn) {
33
+ var tap = {
34
+ name,
35
+ fn
36
+ };
37
+ this.taps.push(tap);
38
+ return () => {
39
+ var idx = this.taps.indexOf(tap);
40
+ if (idx >= 0) this.taps.splice(idx, 1);
41
+ };
42
+ }
43
+ call(...args) {
44
+ var _iterator = _createForOfIteratorHelper(this.taps),
45
+ _step;
46
+ try {
47
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
48
+ var t = _step.value;
49
+ t.fn(...args);
50
+ }
51
+ } catch (err) {
52
+ _iterator.e(err);
53
+ } finally {
54
+ _iterator.f();
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * AsyncSeriesHook - runs taps in series, awaiting each.
61
+ */
62
+ export class AsyncSeriesHook {
63
+ constructor() {
64
+ _defineProperty(this, "taps", []);
65
+ }
66
+ tapPromise(name, fn) {
67
+ var tap = {
68
+ name,
69
+ fn
70
+ };
71
+ this.taps.push(tap);
72
+ return () => {
73
+ var idx = this.taps.indexOf(tap);
74
+ if (idx >= 0) this.taps.splice(idx, 1);
75
+ };
76
+ }
77
+ tap(name, fn) {
78
+ return this.tapPromise(name, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(...args) {
79
+ return _regeneratorRuntime.wrap(function (_context) {
80
+ while (1) switch (_context.prev = _context.next) {
81
+ case 0:
82
+ _context.next = 1;
83
+ return fn(...args);
84
+ case 1:
85
+ case "end":
86
+ return _context.stop();
87
+ }
88
+ }, _callee);
89
+ })));
90
+ }
91
+ promise(...args) {
92
+ var _this = this;
93
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
94
+ var _iterator2, _step2, t, _t;
95
+ return _regeneratorRuntime.wrap(function (_context2) {
96
+ while (1) switch (_context2.prev = _context2.next) {
97
+ case 0:
98
+ _iterator2 = _createForOfIteratorHelper(_this.taps);
99
+ _context2.prev = 1;
100
+ _iterator2.s();
101
+ case 2:
102
+ if ((_step2 = _iterator2.n()).done) {
103
+ _context2.next = 4;
104
+ break;
105
+ }
106
+ t = _step2.value;
107
+ _context2.next = 3;
108
+ return t.fn(...args);
109
+ case 3:
110
+ _context2.next = 2;
111
+ break;
112
+ case 4:
113
+ _context2.next = 6;
114
+ break;
115
+ case 5:
116
+ _context2.prev = 5;
117
+ _t = _context2["catch"](1);
118
+ _iterator2.e(_t);
119
+ case 6:
120
+ _context2.prev = 6;
121
+ _iterator2.f();
122
+ return _context2.finish(6);
123
+ case 7:
124
+ case "end":
125
+ return _context2.stop();
126
+ }
127
+ }, _callee2, null, [[1, 5, 6, 7]]);
128
+ }))();
129
+ }
130
+ }
@@ -0,0 +1,14 @@
1
+ import "core-js/modules/es.regexp.to-string.js";
2
+ /**
3
+ * Generate unique request ID
4
+ */
5
+ export function generateRequestId() {
6
+ return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
7
+ }
8
+
9
+ /**
10
+ * Generate unique instance ID
11
+ */
12
+ export function generateInstanceId() {
13
+ return `inst_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
14
+ }