request-iframe 0.1.0 → 0.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.
Files changed (223) hide show
  1. package/QUICKSTART.CN.md +4 -2
  2. package/QUICKSTART.md +4 -2
  3. package/README.CN.md +302 -54
  4. package/README.md +281 -36
  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 +19735 -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 +31 -22
  14. package/esm/api/endpoint.js +229 -0
  15. package/esm/api/server.js +19 -9
  16. package/esm/constants/debug.js +17 -0
  17. package/esm/constants/index.js +115 -66
  18. package/esm/constants/log.js +11 -0
  19. package/esm/constants/messages.js +6 -1
  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 +243 -320
  35. package/esm/{core → impl}/response.js +120 -154
  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 +92 -5
  41. package/esm/message/dispatcher.js +149 -98
  42. package/esm/stream/error.js +22 -0
  43. package/esm/stream/index.js +3 -1
  44. package/esm/stream/readable-stream.js +101 -26
  45. package/esm/stream/stream-core.js +121 -3
  46. package/esm/stream/writable-stream.js +368 -43
  47. package/esm/utils/ack.js +36 -0
  48. package/esm/utils/blob.js +16 -0
  49. package/esm/utils/cache.js +25 -76
  50. package/esm/utils/content-type.js +81 -0
  51. package/esm/utils/debug.js +157 -180
  52. package/esm/utils/hooks.js +130 -0
  53. package/esm/utils/id.js +14 -0
  54. package/esm/utils/iframe.js +20 -0
  55. package/esm/utils/index.js +12 -162
  56. package/esm/utils/is.js +3 -0
  57. package/esm/utils/logger.js +55 -0
  58. package/esm/utils/origin.js +3 -1
  59. package/esm/utils/promise.js +3 -0
  60. package/esm/utils/window.js +31 -0
  61. package/library/api/client.d.ts.map +1 -1
  62. package/library/api/client.js +32 -23
  63. package/library/api/endpoint.d.ts +23 -0
  64. package/library/api/endpoint.d.ts.map +1 -0
  65. package/library/api/endpoint.js +235 -0
  66. package/library/api/server.d.ts +4 -1
  67. package/library/api/server.d.ts.map +1 -1
  68. package/library/api/server.js +19 -9
  69. package/library/constants/debug.d.ts +18 -0
  70. package/library/constants/debug.d.ts.map +1 -0
  71. package/library/constants/debug.js +23 -0
  72. package/library/constants/index.d.ts +58 -7
  73. package/library/constants/index.d.ts.map +1 -1
  74. package/library/constants/index.js +143 -67
  75. package/library/constants/log.d.ts +12 -0
  76. package/library/constants/log.d.ts.map +1 -0
  77. package/library/constants/log.js +17 -0
  78. package/library/constants/messages.d.ts +6 -1
  79. package/library/constants/messages.d.ts.map +1 -1
  80. package/library/constants/messages.js +6 -1
  81. package/library/constants/warn-once.d.ts +12 -0
  82. package/library/constants/warn-once.d.ts.map +1 -0
  83. package/library/constants/warn-once.js +22 -0
  84. package/library/endpoint/facade.d.ts +238 -0
  85. package/library/endpoint/facade.d.ts.map +1 -0
  86. package/library/endpoint/facade.js +398 -0
  87. package/library/endpoint/heartbeat/heartbeat.d.ts +34 -0
  88. package/library/endpoint/heartbeat/heartbeat.d.ts.map +1 -0
  89. package/library/endpoint/heartbeat/heartbeat.js +67 -0
  90. package/library/endpoint/heartbeat/ping.d.ts +18 -0
  91. package/library/endpoint/heartbeat/ping.d.ts.map +1 -0
  92. package/library/endpoint/heartbeat/ping.js +26 -0
  93. package/library/endpoint/index.d.ts +16 -0
  94. package/library/endpoint/index.d.ts.map +1 -0
  95. package/library/endpoint/index.js +114 -0
  96. package/library/endpoint/infra/hub.d.ts +170 -0
  97. package/library/endpoint/infra/hub.d.ts.map +1 -0
  98. package/library/endpoint/infra/hub.js +323 -0
  99. package/library/endpoint/infra/inbox.d.ts +73 -0
  100. package/library/endpoint/infra/inbox.d.ts.map +1 -0
  101. package/library/endpoint/infra/inbox.js +239 -0
  102. package/library/endpoint/infra/outbox.d.ts +149 -0
  103. package/library/endpoint/infra/outbox.d.ts.map +1 -0
  104. package/library/endpoint/infra/outbox.js +415 -0
  105. package/library/endpoint/stream/dispatcher.d.ts +33 -0
  106. package/library/endpoint/stream/dispatcher.d.ts.map +1 -0
  107. package/library/endpoint/stream/dispatcher.js +66 -0
  108. package/library/endpoint/stream/errors.d.ts +20 -0
  109. package/library/endpoint/stream/errors.d.ts.map +1 -0
  110. package/library/endpoint/stream/errors.js +32 -0
  111. package/library/endpoint/stream/factory.d.ts +44 -0
  112. package/library/endpoint/stream/factory.d.ts.map +1 -0
  113. package/library/endpoint/stream/factory.js +82 -0
  114. package/library/endpoint/stream/file-auto-resolve.d.ts +26 -0
  115. package/library/endpoint/stream/file-auto-resolve.d.ts.map +1 -0
  116. package/library/endpoint/stream/file-auto-resolve.js +41 -0
  117. package/library/endpoint/stream/file-writable.d.ts +33 -0
  118. package/library/endpoint/stream/file-writable.d.ts.map +1 -0
  119. package/library/endpoint/stream/file-writable.js +115 -0
  120. package/library/endpoint/stream/handler.d.ts +20 -0
  121. package/library/endpoint/stream/handler.d.ts.map +1 -0
  122. package/library/endpoint/stream/handler.js +32 -0
  123. package/library/{core → impl}/client.d.ts +16 -13
  124. package/library/impl/client.d.ts.map +1 -0
  125. package/library/{core → impl}/client.js +254 -333
  126. package/library/{core → impl}/request.d.ts.map +1 -1
  127. package/library/{core → impl}/response.d.ts +7 -12
  128. package/library/impl/response.d.ts.map +1 -0
  129. package/library/{core → impl}/response.js +120 -154
  130. package/library/{core → impl}/server.d.ts +26 -55
  131. package/library/impl/server.d.ts.map +1 -0
  132. package/library/impl/server.js +575 -0
  133. package/library/index.d.ts +13 -6
  134. package/library/index.d.ts.map +1 -1
  135. package/library/index.js +16 -16
  136. package/library/message/ack.d.ts +15 -0
  137. package/library/message/ack.d.ts.map +1 -0
  138. package/library/message/ack.js +33 -0
  139. package/library/message/channel-cache.d.ts +26 -0
  140. package/library/message/channel-cache.d.ts.map +1 -0
  141. package/library/message/channel-cache.js +115 -0
  142. package/library/message/channel.d.ts +53 -6
  143. package/library/message/channel.d.ts.map +1 -1
  144. package/library/message/channel.js +96 -9
  145. package/library/message/dispatcher.d.ts +17 -0
  146. package/library/message/dispatcher.d.ts.map +1 -1
  147. package/library/message/dispatcher.js +149 -98
  148. package/library/stream/error.d.ts +24 -0
  149. package/library/stream/error.d.ts.map +1 -0
  150. package/library/stream/error.js +29 -0
  151. package/library/stream/index.d.ts +4 -1
  152. package/library/stream/index.d.ts.map +1 -1
  153. package/library/stream/index.js +7 -4
  154. package/library/stream/readable-stream.d.ts.map +1 -1
  155. package/library/stream/readable-stream.js +102 -27
  156. package/library/stream/stream-core.d.ts +22 -1
  157. package/library/stream/stream-core.d.ts.map +1 -1
  158. package/library/stream/stream-core.js +120 -2
  159. package/library/stream/types.d.ts +115 -2
  160. package/library/stream/types.d.ts.map +1 -1
  161. package/library/stream/writable-stream.d.ts +20 -2
  162. package/library/stream/writable-stream.d.ts.map +1 -1
  163. package/library/stream/writable-stream.js +366 -41
  164. package/library/types/index.d.ts +17 -22
  165. package/library/types/index.d.ts.map +1 -1
  166. package/library/utils/ack.d.ts +2 -0
  167. package/library/utils/ack.d.ts.map +1 -0
  168. package/library/utils/ack.js +44 -0
  169. package/library/utils/blob.d.ts +3 -0
  170. package/library/utils/blob.d.ts.map +1 -0
  171. package/library/utils/blob.js +22 -0
  172. package/library/utils/cache.d.ts +10 -20
  173. package/library/utils/cache.d.ts.map +1 -1
  174. package/library/utils/cache.js +25 -79
  175. package/library/utils/content-type.d.ts +13 -0
  176. package/library/utils/content-type.d.ts.map +1 -0
  177. package/library/utils/content-type.js +87 -0
  178. package/library/utils/debug.d.ts.map +1 -1
  179. package/library/utils/debug.js +156 -178
  180. package/library/utils/hooks.d.ts +30 -0
  181. package/library/utils/hooks.d.ts.map +1 -0
  182. package/library/utils/hooks.js +139 -0
  183. package/library/utils/id.d.ts +9 -0
  184. package/library/utils/id.d.ts.map +1 -0
  185. package/library/utils/id.js +21 -0
  186. package/library/utils/iframe.d.ts +5 -0
  187. package/library/utils/iframe.d.ts.map +1 -0
  188. package/library/utils/iframe.js +25 -0
  189. package/library/utils/index.d.ts +7 -34
  190. package/library/utils/index.d.ts.map +1 -1
  191. package/library/utils/index.js +58 -193
  192. package/library/utils/is.d.ts +2 -0
  193. package/library/utils/is.d.ts.map +1 -0
  194. package/library/utils/is.js +9 -0
  195. package/library/utils/logger.d.ts +13 -0
  196. package/library/utils/logger.d.ts.map +1 -0
  197. package/library/utils/logger.js +63 -0
  198. package/library/utils/origin.d.ts.map +1 -1
  199. package/library/utils/origin.js +2 -1
  200. package/library/utils/promise.d.ts +2 -0
  201. package/library/utils/promise.d.ts.map +1 -0
  202. package/library/utils/promise.js +9 -0
  203. package/library/utils/window.d.ts +2 -0
  204. package/library/utils/window.d.ts.map +1 -0
  205. package/library/utils/window.js +38 -0
  206. package/package.json +49 -2
  207. package/react/package.json +2 -1
  208. package/esm/core/client-server.js +0 -329
  209. package/esm/core/server.js +0 -767
  210. package/esm/utils/ack-meta.js +0 -53
  211. package/library/core/client-server.d.ts +0 -106
  212. package/library/core/client-server.d.ts.map +0 -1
  213. package/library/core/client-server.js +0 -336
  214. package/library/core/client.d.ts.map +0 -1
  215. package/library/core/response.d.ts.map +0 -1
  216. package/library/core/server.d.ts.map +0 -1
  217. package/library/core/server.js +0 -772
  218. package/library/utils/ack-meta.d.ts +0 -2
  219. package/library/utils/ack-meta.d.ts.map +0 -1
  220. package/library/utils/ack-meta.js +0 -59
  221. /package/esm/{core → impl}/request.js +0 -0
  222. /package/library/{core → impl}/request.d.ts +0 -0
  223. /package/library/{core → impl}/request.js +0 -0
@@ -3,14 +3,40 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.MessageType = exports.MessageRole = exports.HttpStatusText = exports.HttpStatus = exports.HttpHeader = exports.ErrorCode = exports.DefaultTimeout = void 0;
6
+ exports.AutoAckConstant = void 0;
7
+ Object.defineProperty(exports, "DebugEvent", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _debug.DebugEvent;
11
+ }
12
+ });
13
+ exports.HttpStatusText = exports.HttpStatus = exports.HttpHeader = exports.ErrorCode = exports.DefaultTimeout = void 0;
14
+ Object.defineProperty(exports, "LogLevel", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _log.LogLevel;
18
+ }
19
+ });
20
+ exports.MessageType = exports.MessageRole = void 0;
7
21
  Object.defineProperty(exports, "Messages", {
8
22
  enumerable: true,
9
23
  get: function get() {
10
24
  return _messages.Messages;
11
25
  }
12
26
  });
13
- exports.StreamType = exports.StreamState = exports.StreamMode = exports.StreamInternalMessageType = exports.ProtocolVersion = void 0;
27
+ exports.StreamType = exports.StreamState = exports.StreamMode = exports.StreamInternalMessageType = exports.StreamEvent = exports.ProtocolVersion = exports.OriginConstant = void 0;
28
+ Object.defineProperty(exports, "WarnOnceKey", {
29
+ enumerable: true,
30
+ get: function get() {
31
+ return _warnOnce.WarnOnceKey;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, "buildWarnOnceKey", {
35
+ enumerable: true,
36
+ get: function get() {
37
+ return _warnOnce.buildWarnOnceKey;
38
+ }
39
+ });
14
40
  Object.defineProperty(exports, "formatMessage", {
15
41
  enumerable: true,
16
42
  get: function get() {
@@ -37,14 +63,17 @@ Object.defineProperty(exports, "setMessages", {
37
63
  }
38
64
  });
39
65
  var _messages = require("./messages");
40
- /**
41
- * Protocol version constants
42
- * Used to identify the protocol version of messages, for compatibility handling in future version upgrades
43
- *
44
- * Version compatibility strategy:
45
- * - Only check minimum supported version, reject deprecated old versions
46
- * - Don't check maximum version, as new versions usually maintain backward compatibility with old message formats
47
- * - This way new version servers can be compatible with old version clients, without forcing client upgrades
66
+ var _warnOnce = require("./warn-once");
67
+ var _log = require("./log");
68
+ var _debug = require("./debug");
69
+ /**
70
+ * Protocol version constants
71
+ * Used to identify the protocol version of messages, for compatibility handling in future version upgrades
72
+ *
73
+ * Version compatibility strategy:
74
+ * - Only check minimum supported version, reject deprecated old versions
75
+ * - Don't check maximum version, as new versions usually maintain backward compatibility with old message formats
76
+ * - This way new version servers can be compatible with old version clients, without forcing client upgrades
48
77
  */
49
78
  var ProtocolVersion = exports.ProtocolVersion = {
50
79
  /** Current protocol version */
@@ -53,16 +82,34 @@ var ProtocolVersion = exports.ProtocolVersion = {
53
82
  MIN_SUPPORTED: 1
54
83
  };
55
84
 
56
- /**
57
- * Protocol version type
85
+ /**
86
+ * Special origin values
58
87
  */
88
+ var OriginConstant = exports.OriginConstant = {
89
+ /** Wildcard origin (postMessage targetOrigin = '*') */
90
+ ANY: '*'
91
+ };
92
+
93
+ /**
94
+ * Auto-ack (ACK-only) limits.
95
+ */
96
+ var AutoAckConstant = exports.AutoAckConstant = {
97
+ /** Max length of ack.id to be echoed back in auto-ack */
98
+ MAX_ID_LENGTH: 1024,
99
+ /** Max length of ack.meta to be echoed back in auto-ack */
100
+ MAX_META_LENGTH: 5120
101
+ };
59
102
 
60
- /**
61
- * Protocol validation result
103
+ /**
104
+ * Protocol version type
62
105
  */
63
106
 
64
- /**
65
- * HTTP status code constants
107
+ /**
108
+ * Protocol validation result
109
+ */
110
+
111
+ /**
112
+ * HTTP status code constants
66
113
  */
67
114
  var HttpStatus = exports.HttpStatus = {
68
115
  OK: 200,
@@ -79,8 +126,8 @@ var HttpStatus = exports.HttpStatus = {
79
126
  SERVICE_UNAVAILABLE: 503
80
127
  };
81
128
 
82
- /**
83
- * HTTP status text constants
129
+ /**
130
+ * HTTP status text constants
84
131
  */
85
132
  var HttpStatusText = exports.HttpStatusText = {
86
133
  [HttpStatus.OK]: 'OK',
@@ -97,15 +144,15 @@ var HttpStatusText = exports.HttpStatusText = {
97
144
  [HttpStatus.SERVICE_UNAVAILABLE]: 'Service Unavailable'
98
145
  };
99
146
 
100
- /**
101
- * Get status text
147
+ /**
148
+ * Get status text
102
149
  */
103
150
  function getStatusText(code) {
104
151
  return HttpStatusText[code] || 'Unknown';
105
152
  }
106
153
 
107
- /**
108
- * Error code constants
154
+ /**
155
+ * Error code constants
109
156
  */
110
157
  var ErrorCode = exports.ErrorCode = {
111
158
  /** ACK confirmation timeout */
@@ -135,11 +182,27 @@ var ErrorCode = exports.ErrorCode = {
135
182
  /** Too many concurrent requests (rate limiting) */
136
183
  TOO_MANY_REQUESTS: 'TOO_MANY_REQUESTS',
137
184
  /** Stream start not received in time */
138
- STREAM_START_TIMEOUT: 'STREAM_START_TIMEOUT'
185
+ STREAM_START_TIMEOUT: 'STREAM_START_TIMEOUT',
186
+ /** Stream has already started */
187
+ STREAM_ALREADY_STARTED: 'STREAM_ALREADY_STARTED',
188
+ /** Stream has ended */
189
+ STREAM_ENDED: 'STREAM_ENDED',
190
+ /** Stream idle timeout */
191
+ STREAM_TIMEOUT: 'STREAM_TIMEOUT',
192
+ /** Stream expired */
193
+ STREAM_EXPIRED: 'STREAM_EXPIRED',
194
+ /** Stream read error */
195
+ STREAM_READ_ERROR: 'STREAM_READ_ERROR',
196
+ /** Stream write() is only available when mode is push */
197
+ STREAM_WRITE_ONLY_IN_PUSH_MODE: 'STREAM_WRITE_ONLY_IN_PUSH_MODE',
198
+ /** Stream pending queue overflow */
199
+ STREAM_PENDING_QUEUE_OVERFLOW: 'STREAM_PENDING_QUEUE_OVERFLOW',
200
+ /** Stream pending bytes overflow */
201
+ STREAM_PENDING_BYTES_OVERFLOW: 'STREAM_PENDING_BYTES_OVERFLOW'
139
202
  };
140
203
 
141
- /**
142
- * Message type constants
204
+ /**
205
+ * Message type constants
143
206
  */
144
207
  var MessageType = exports.MessageType = {
145
208
  /** Request message */
@@ -152,8 +215,6 @@ var MessageType = exports.MessageType = {
152
215
  RESPONSE: 'response',
153
216
  /** Error message */
154
217
  ERROR: 'error',
155
- /** Client confirms response received */
156
- RECEIVED: 'received',
157
218
  /** Ping message (for connection detection) */
158
219
  PING: 'ping',
159
220
  /** Pong message (for connection detection) */
@@ -169,9 +230,7 @@ var MessageType = exports.MessageType = {
169
230
  /** Stream cancel */
170
231
  STREAM_CANCEL: 'stream_cancel',
171
232
  /** Stream pull (receiver requests next chunks) */
172
- STREAM_PULL: 'stream_pull',
173
- /** Stream ack (receiver acknowledges a chunk) */
174
- STREAM_ACK: 'stream_ack'
233
+ STREAM_PULL: 'stream_pull'
175
234
  };
176
235
  var MessageRole = exports.MessageRole = {
177
236
  /** Server role */
@@ -179,15 +238,15 @@ var MessageRole = exports.MessageRole = {
179
238
  /** Client role */
180
239
  CLIENT: 'client'
181
240
  };
182
- /**
183
- * Default timeout configuration (milliseconds)
241
+ /**
242
+ * Default timeout configuration (milliseconds)
184
243
  */
185
244
  var DefaultTimeout = exports.DefaultTimeout = {
186
- /**
187
- * ACK confirmation timeout: 1000ms (1s)
188
- * Used for both client waiting for server ACK and server waiting for client RECEIVED.
189
- * Increased from 500ms to accommodate slower environments or busy browsers where postMessage
190
- * serialization/deserialization may take longer.
245
+ /**
246
+ * ACK confirmation timeout: 1000ms (1s)
247
+ * Used for requireAck confirmation (ACK-only).
248
+ * Increased from 500ms to accommodate slower environments or busy browsers where postMessage
249
+ * serialization/deserialization may take longer.
191
250
  */
192
251
  ACK: 1000,
193
252
  /** Request timeout: 5s */
@@ -196,8 +255,8 @@ var DefaultTimeout = exports.DefaultTimeout = {
196
255
  ASYNC: 120000
197
256
  };
198
257
 
199
- /**
200
- * HTTP Header name constants
258
+ /**
259
+ * HTTP Header name constants
201
260
  */
202
261
  var HttpHeader = exports.HttpHeader = {
203
262
  /** Set-Cookie (server sets cookie) */
@@ -212,20 +271,20 @@ var HttpHeader = exports.HttpHeader = {
212
271
  COOKIE: 'Cookie'
213
272
  };
214
273
 
215
- /**
216
- * HTTP Header name type
274
+ /**
275
+ * HTTP Header name type
217
276
  */
218
277
 
219
- /**
220
- * Message type union type
278
+ /**
279
+ * Message type union type
221
280
  */
222
281
 
223
- /**
224
- * Error code union type
282
+ /**
283
+ * Error code union type
225
284
  */
226
285
 
227
- /**
228
- * Stream type constants
286
+ /**
287
+ * Stream type constants
229
288
  */
230
289
  var StreamType = exports.StreamType = {
231
290
  /** Normal data stream */
@@ -234,18 +293,18 @@ var StreamType = exports.StreamType = {
234
293
  FILE: 'file'
235
294
  };
236
295
 
237
- /**
238
- * Stream mode constants
239
- * - PULL: receiver pulls next chunks (backpressure)
240
- * - PUSH: producer pushes via write()
296
+ /**
297
+ * Stream mode constants
298
+ * - PULL: receiver pulls next chunks (backpressure)
299
+ * - PUSH: producer pushes via write()
241
300
  */
242
301
  var StreamMode = exports.StreamMode = {
243
302
  PULL: 'pull',
244
303
  PUSH: 'push'
245
304
  };
246
- /**
247
- * Stream internal message type constants (for stream internal message handling)
248
- * Note: These are MessageType.STREAM_* values with the stream_ prefix removed
305
+ /**
306
+ * Stream internal message type constants (for stream internal message handling)
307
+ * Note: These are MessageType.STREAM_* values with the stream_ prefix removed
249
308
  */
250
309
  var StreamInternalMessageType = exports.StreamInternalMessageType = {
251
310
  /** Data message */
@@ -257,21 +316,19 @@ var StreamInternalMessageType = exports.StreamInternalMessageType = {
257
316
  /** Cancel message */
258
317
  CANCEL: 'cancel',
259
318
  /** Pull message */
260
- PULL: 'pull',
261
- /** Ack message */
262
- ACK: 'ack'
319
+ PULL: 'pull'
263
320
  };
264
321
 
265
- /**
266
- * Stream internal message type value type
322
+ /**
323
+ * Stream internal message type value type
267
324
  */
268
325
 
269
- /**
270
- * Stream type value type
326
+ /**
327
+ * Stream type value type
271
328
  */
272
329
 
273
- /**
274
- * Stream state constants
330
+ /**
331
+ * Stream state constants
275
332
  */
276
333
  var StreamState = exports.StreamState = {
277
334
  /** Pending */
@@ -286,10 +343,29 @@ var StreamState = exports.StreamState = {
286
343
  CANCELLED: 'cancelled'
287
344
  };
288
345
 
289
- /**
290
- * Stream state value type
346
+ /**
347
+ * Stream state value type
348
+ */
349
+
350
+ /**
351
+ * Stream event name constants (for stream.on / observability)
291
352
  */
353
+ var StreamEvent = exports.StreamEvent = {
354
+ START: 'start',
355
+ DATA: 'data',
356
+ READ: 'read',
357
+ WRITE: 'write',
358
+ SEND: 'send',
359
+ PULL: 'pull',
360
+ ACK: 'ack',
361
+ END: 'end',
362
+ CANCEL: 'cancel',
363
+ ERROR: 'error',
364
+ TIMEOUT: 'timeout',
365
+ EXPIRED: 'expired',
366
+ STATE: 'state'
367
+ };
292
368
 
293
- /**
294
- * Message constants (for multi-language support)
369
+ /**
370
+ * Message constants (for multi-language support)
295
371
  */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Log level constants for request-iframe.
3
+ */
4
+ export declare const LogLevel: {
5
+ readonly TRACE: "trace";
6
+ readonly INFO: "info";
7
+ readonly WARN: "warn";
8
+ readonly ERROR: "error";
9
+ readonly SILENT: "silent";
10
+ };
11
+ export type LogLevelValue = typeof LogLevel[keyof typeof LogLevel];
12
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/constants/log.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LogLevel = void 0;
7
+ /**
8
+ * Log level constants for request-iframe.
9
+ */
10
+
11
+ var LogLevel = exports.LogLevel = {
12
+ TRACE: 'trace',
13
+ INFO: 'info',
14
+ WARN: 'warn',
15
+ ERROR: 'error',
16
+ SILENT: 'silent'
17
+ };
@@ -32,11 +32,14 @@ declare const defaultMessages: {
32
32
  readonly MIDDLEWARE_ERROR: "Middleware error";
33
33
  readonly ERROR: "Error";
34
34
  readonly TOO_MANY_REQUESTS: "Too many concurrent requests (limit: {0})";
35
+ readonly HUB_REGISTER_HANDLERS_NOT_SET: "RequestIframeEndpointHub: registerHandlers is not set";
35
36
  /** Client errors */
36
37
  readonly IFRAME_NOT_READY: "iframe.contentWindow is not available";
37
38
  readonly TARGET_WINDOW_CLOSED: "Target window is closed or no longer available";
38
39
  /** ClientServer warnings */
39
40
  readonly CLIENT_SERVER_IGNORED_MESSAGE_WHEN_CLOSED: "Ignored message because client server is closed/destroyed (type: {0}, requestId: {1})";
41
+ /** Server warnings */
42
+ readonly SERVER_IGNORED_MESSAGE_WHEN_CLOSED: "Ignored message because server is closed/destroyed (type: {0}, requestId: {1})";
40
43
  /** Stream related messages */
41
44
  readonly STREAM_NOT_BOUND: "Stream is not bound to a request context";
42
45
  readonly STREAM_ALREADY_STARTED: "Stream has already started";
@@ -48,6 +51,8 @@ declare const defaultMessages: {
48
51
  readonly STREAM_ENDED: "Stream has ended";
49
52
  readonly STREAM_READ_ERROR: "Failed to read stream data";
50
53
  readonly STREAM_WRITE_ONLY_IN_PUSH_MODE: "Stream write() is only available when mode is \"push\"";
54
+ readonly STREAM_PENDING_QUEUE_OVERFLOW: "Stream pending queue overflow (limit: {0})";
55
+ readonly STREAM_PENDING_BYTES_OVERFLOW: "Stream pending bytes overflow (limit: {0})";
51
56
  /** Debug messages - Client */
52
57
  readonly DEBUG_CLIENT_REQUEST_START: "📤 [Client] Request Start";
53
58
  readonly DEBUG_CLIENT_REQUEST_SUCCESS: "✅ [Client] Request Success";
@@ -64,7 +69,7 @@ declare const defaultMessages: {
64
69
  readonly DEBUG_CLIENT_REQUEST_TIMEOUT: "⏱️ [Client] Request Timeout";
65
70
  readonly DEBUG_CLIENT_SENDING_REQUEST: "📤 [Client] Sending Request";
66
71
  readonly DEBUG_CLIENT_SENDING_PING: "📤 [Client] Sending Ping";
67
- readonly DEBUG_CLIENT_SENDING_RECEIVED_ACK: "📤 [Client] Sending Received ACK";
72
+ readonly DEBUG_CLIENT_SENDING_RECEIVED_ACK: "📤 [Client] Sending ACK";
68
73
  /** Debug messages - Server */
69
74
  readonly DEBUG_SERVER_RECEIVED_REQUEST: "📥 [Server] Received Request";
70
75
  readonly DEBUG_SERVER_SETTING_STATUS_CODE: "📝 [Server] Setting Status Code";
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/constants/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,QAAA,MAAM,eAAe;IACnB,8BAA8B;;;;IAK9B,4BAA4B;;;;;IAM5B,qBAAqB;;;;IAKrB,8BAA8B;;;;;;;IAQ9B,oBAAoB;;;IAIpB,4BAA4B;;IAI5B,8BAA8B;;;;;;;;;;;IAY9B,8BAA8B;;;;;;;;;;;;;;;;;IAkB9B,8BAA8B;;;;;;;;;;;;;;;;;;CAkBtB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,eAAe,CAAC;AAOtD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAIxD,CAAC;AAEH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAE/E;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAKpF;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAElE"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/constants/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,QAAA,MAAM,eAAe;IACnB,8BAA8B;;;;IAK9B,4BAA4B;;;;;IAM5B,qBAAqB;;;;IAKrB,8BAA8B;;;;;;;;IAS9B,oBAAoB;;;IAIpB,4BAA4B;;IAI5B,sBAAsB;;IAItB,8BAA8B;;;;;;;;;;;;;IAc9B,8BAA8B;;;;;;;;;;;;;;;;;IAkB9B,8BAA8B;;;;;;;;;;;;;;;;;;CAkBtB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,eAAe,CAAC;AAOtD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAIxD,CAAC;AAEH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAE/E;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAKpF;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAElE"}
@@ -52,11 +52,14 @@ var defaultMessages = {
52
52
  MIDDLEWARE_ERROR: 'Middleware error',
53
53
  ERROR: 'Error',
54
54
  TOO_MANY_REQUESTS: 'Too many concurrent requests (limit: {0})',
55
+ HUB_REGISTER_HANDLERS_NOT_SET: 'RequestIframeEndpointHub: registerHandlers is not set',
55
56
  /** Client errors */
56
57
  IFRAME_NOT_READY: 'iframe.contentWindow is not available',
57
58
  TARGET_WINDOW_CLOSED: 'Target window is closed or no longer available',
58
59
  /** ClientServer warnings */
59
60
  CLIENT_SERVER_IGNORED_MESSAGE_WHEN_CLOSED: 'Ignored message because client server is closed/destroyed (type: {0}, requestId: {1})',
61
+ /** Server warnings */
62
+ SERVER_IGNORED_MESSAGE_WHEN_CLOSED: 'Ignored message because server is closed/destroyed (type: {0}, requestId: {1})',
60
63
  /** Stream related messages */
61
64
  STREAM_NOT_BOUND: 'Stream is not bound to a request context',
62
65
  STREAM_ALREADY_STARTED: 'Stream has already started',
@@ -68,6 +71,8 @@ var defaultMessages = {
68
71
  STREAM_ENDED: 'Stream has ended',
69
72
  STREAM_READ_ERROR: 'Failed to read stream data',
70
73
  STREAM_WRITE_ONLY_IN_PUSH_MODE: 'Stream write() is only available when mode is "push"',
74
+ STREAM_PENDING_QUEUE_OVERFLOW: 'Stream pending queue overflow (limit: {0})',
75
+ STREAM_PENDING_BYTES_OVERFLOW: 'Stream pending bytes overflow (limit: {0})',
71
76
  /** Debug messages - Client */
72
77
  DEBUG_CLIENT_REQUEST_START: '📤 [Client] Request Start',
73
78
  DEBUG_CLIENT_REQUEST_SUCCESS: '✅ [Client] Request Success',
@@ -84,7 +89,7 @@ var defaultMessages = {
84
89
  DEBUG_CLIENT_REQUEST_TIMEOUT: '⏱️ [Client] Request Timeout',
85
90
  DEBUG_CLIENT_SENDING_REQUEST: '📤 [Client] Sending Request',
86
91
  DEBUG_CLIENT_SENDING_PING: '📤 [Client] Sending Ping',
87
- DEBUG_CLIENT_SENDING_RECEIVED_ACK: '📤 [Client] Sending Received ACK',
92
+ DEBUG_CLIENT_SENDING_RECEIVED_ACK: '📤 [Client] Sending ACK',
88
93
  /** Debug messages - Server */
89
94
  DEBUG_SERVER_RECEIVED_REQUEST: '📥 [Server] Received Request',
90
95
  DEBUG_SERVER_SETTING_STATUS_CODE: '📝 [Server] Setting Status Code',
@@ -0,0 +1,12 @@
1
+ /**
2
+ * warnOnce keys (for deduplication).
3
+ *
4
+ * Keep these centralized to avoid scattered magic strings.
5
+ */
6
+ export declare const WarnOnceKey: {
7
+ readonly INBOX_MISSING_PENDING_WHEN_CLOSED: "inbox:missingPendingWhenClosed";
8
+ readonly SERVER_MISSING_PENDING_WHEN_CLOSED: "server:missingPendingWhenClosed";
9
+ };
10
+ export type WarnOnceKeyValue = typeof WarnOnceKey[keyof typeof WarnOnceKey];
11
+ export declare function buildWarnOnceKey(prefix: WarnOnceKeyValue, ...parts: Array<string | number>): string;
12
+ //# sourceMappingURL=warn-once.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warn-once.d.ts","sourceRoot":"","sources":["../../src/constants/warn-once.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,WAAW,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAE5E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAGnG"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WarnOnceKey = void 0;
7
+ exports.buildWarnOnceKey = buildWarnOnceKey;
8
+ require("core-js/modules/es.array.map.js");
9
+ /**
10
+ * warnOnce keys (for deduplication).
11
+ *
12
+ * Keep these centralized to avoid scattered magic strings.
13
+ */
14
+
15
+ var WarnOnceKey = exports.WarnOnceKey = {
16
+ INBOX_MISSING_PENDING_WHEN_CLOSED: 'inbox:missingPendingWhenClosed',
17
+ SERVER_MISSING_PENDING_WHEN_CLOSED: 'server:missingPendingWhenClosed'
18
+ };
19
+ function buildWarnOnceKey(prefix, ...parts) {
20
+ if (!parts.length) return prefix;
21
+ return `${prefix}:${parts.map(String).join(':')}`;
22
+ }