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.
- package/QUICKSTART.CN.md +4 -2
- package/QUICKSTART.md +4 -2
- package/README.CN.md +302 -54
- package/README.md +281 -36
- package/cdn/request-iframe-react.umd.js +3354 -0
- package/cdn/request-iframe-react.umd.js.map +1 -0
- package/cdn/request-iframe-react.umd.min.js +2 -0
- package/cdn/request-iframe-react.umd.min.js.map +1 -0
- package/cdn/request-iframe.umd.js +19735 -0
- package/cdn/request-iframe.umd.js.map +1 -0
- package/cdn/request-iframe.umd.min.js +4 -0
- package/cdn/request-iframe.umd.min.js.map +1 -0
- package/esm/api/client.js +31 -22
- package/esm/api/endpoint.js +229 -0
- package/esm/api/server.js +19 -9
- package/esm/constants/debug.js +17 -0
- package/esm/constants/index.js +115 -66
- package/esm/constants/log.js +11 -0
- package/esm/constants/messages.js +6 -1
- package/esm/constants/warn-once.js +15 -0
- package/esm/endpoint/facade.js +390 -0
- package/esm/endpoint/heartbeat/heartbeat.js +60 -0
- package/esm/endpoint/heartbeat/ping.js +20 -0
- package/esm/endpoint/index.js +13 -0
- package/esm/endpoint/infra/hub.js +316 -0
- package/esm/endpoint/infra/inbox.js +232 -0
- package/esm/endpoint/infra/outbox.js +408 -0
- package/esm/endpoint/stream/dispatcher.js +58 -0
- package/esm/endpoint/stream/errors.js +27 -0
- package/esm/endpoint/stream/factory.js +76 -0
- package/esm/endpoint/stream/file-auto-resolve.js +34 -0
- package/esm/endpoint/stream/file-writable.js +105 -0
- package/esm/endpoint/stream/handler.js +26 -0
- package/esm/{core → impl}/client.js +243 -320
- package/esm/{core → impl}/response.js +120 -154
- package/esm/impl/server.js +568 -0
- package/esm/index.js +13 -6
- package/esm/message/ack.js +27 -0
- package/esm/message/channel-cache.js +108 -0
- package/esm/message/channel.js +92 -5
- package/esm/message/dispatcher.js +149 -98
- package/esm/stream/error.js +22 -0
- package/esm/stream/index.js +3 -1
- package/esm/stream/readable-stream.js +101 -26
- package/esm/stream/stream-core.js +121 -3
- package/esm/stream/writable-stream.js +368 -43
- package/esm/utils/ack.js +36 -0
- package/esm/utils/blob.js +16 -0
- package/esm/utils/cache.js +25 -76
- package/esm/utils/content-type.js +81 -0
- package/esm/utils/debug.js +157 -180
- package/esm/utils/hooks.js +130 -0
- package/esm/utils/id.js +14 -0
- package/esm/utils/iframe.js +20 -0
- package/esm/utils/index.js +12 -162
- package/esm/utils/is.js +3 -0
- package/esm/utils/logger.js +55 -0
- package/esm/utils/origin.js +3 -1
- package/esm/utils/promise.js +3 -0
- package/esm/utils/window.js +31 -0
- package/library/api/client.d.ts.map +1 -1
- package/library/api/client.js +32 -23
- package/library/api/endpoint.d.ts +23 -0
- package/library/api/endpoint.d.ts.map +1 -0
- package/library/api/endpoint.js +235 -0
- package/library/api/server.d.ts +4 -1
- package/library/api/server.d.ts.map +1 -1
- package/library/api/server.js +19 -9
- package/library/constants/debug.d.ts +18 -0
- package/library/constants/debug.d.ts.map +1 -0
- package/library/constants/debug.js +23 -0
- package/library/constants/index.d.ts +58 -7
- package/library/constants/index.d.ts.map +1 -1
- package/library/constants/index.js +143 -67
- package/library/constants/log.d.ts +12 -0
- package/library/constants/log.d.ts.map +1 -0
- package/library/constants/log.js +17 -0
- package/library/constants/messages.d.ts +6 -1
- package/library/constants/messages.d.ts.map +1 -1
- package/library/constants/messages.js +6 -1
- package/library/constants/warn-once.d.ts +12 -0
- package/library/constants/warn-once.d.ts.map +1 -0
- package/library/constants/warn-once.js +22 -0
- package/library/endpoint/facade.d.ts +238 -0
- package/library/endpoint/facade.d.ts.map +1 -0
- package/library/endpoint/facade.js +398 -0
- package/library/endpoint/heartbeat/heartbeat.d.ts +34 -0
- package/library/endpoint/heartbeat/heartbeat.d.ts.map +1 -0
- package/library/endpoint/heartbeat/heartbeat.js +67 -0
- package/library/endpoint/heartbeat/ping.d.ts +18 -0
- package/library/endpoint/heartbeat/ping.d.ts.map +1 -0
- package/library/endpoint/heartbeat/ping.js +26 -0
- package/library/endpoint/index.d.ts +16 -0
- package/library/endpoint/index.d.ts.map +1 -0
- package/library/endpoint/index.js +114 -0
- package/library/endpoint/infra/hub.d.ts +170 -0
- package/library/endpoint/infra/hub.d.ts.map +1 -0
- package/library/endpoint/infra/hub.js +323 -0
- package/library/endpoint/infra/inbox.d.ts +73 -0
- package/library/endpoint/infra/inbox.d.ts.map +1 -0
- package/library/endpoint/infra/inbox.js +239 -0
- package/library/endpoint/infra/outbox.d.ts +149 -0
- package/library/endpoint/infra/outbox.d.ts.map +1 -0
- package/library/endpoint/infra/outbox.js +415 -0
- package/library/endpoint/stream/dispatcher.d.ts +33 -0
- package/library/endpoint/stream/dispatcher.d.ts.map +1 -0
- package/library/endpoint/stream/dispatcher.js +66 -0
- package/library/endpoint/stream/errors.d.ts +20 -0
- package/library/endpoint/stream/errors.d.ts.map +1 -0
- package/library/endpoint/stream/errors.js +32 -0
- package/library/endpoint/stream/factory.d.ts +44 -0
- package/library/endpoint/stream/factory.d.ts.map +1 -0
- package/library/endpoint/stream/factory.js +82 -0
- package/library/endpoint/stream/file-auto-resolve.d.ts +26 -0
- package/library/endpoint/stream/file-auto-resolve.d.ts.map +1 -0
- package/library/endpoint/stream/file-auto-resolve.js +41 -0
- package/library/endpoint/stream/file-writable.d.ts +33 -0
- package/library/endpoint/stream/file-writable.d.ts.map +1 -0
- package/library/endpoint/stream/file-writable.js +115 -0
- package/library/endpoint/stream/handler.d.ts +20 -0
- package/library/endpoint/stream/handler.d.ts.map +1 -0
- package/library/endpoint/stream/handler.js +32 -0
- package/library/{core → impl}/client.d.ts +16 -13
- package/library/impl/client.d.ts.map +1 -0
- package/library/{core → impl}/client.js +254 -333
- package/library/{core → impl}/request.d.ts.map +1 -1
- package/library/{core → impl}/response.d.ts +7 -12
- package/library/impl/response.d.ts.map +1 -0
- package/library/{core → impl}/response.js +120 -154
- package/library/{core → impl}/server.d.ts +26 -55
- package/library/impl/server.d.ts.map +1 -0
- package/library/impl/server.js +575 -0
- package/library/index.d.ts +13 -6
- package/library/index.d.ts.map +1 -1
- package/library/index.js +16 -16
- package/library/message/ack.d.ts +15 -0
- package/library/message/ack.d.ts.map +1 -0
- package/library/message/ack.js +33 -0
- package/library/message/channel-cache.d.ts +26 -0
- package/library/message/channel-cache.d.ts.map +1 -0
- package/library/message/channel-cache.js +115 -0
- package/library/message/channel.d.ts +53 -6
- package/library/message/channel.d.ts.map +1 -1
- package/library/message/channel.js +96 -9
- package/library/message/dispatcher.d.ts +17 -0
- package/library/message/dispatcher.d.ts.map +1 -1
- package/library/message/dispatcher.js +149 -98
- package/library/stream/error.d.ts +24 -0
- package/library/stream/error.d.ts.map +1 -0
- package/library/stream/error.js +29 -0
- package/library/stream/index.d.ts +4 -1
- package/library/stream/index.d.ts.map +1 -1
- package/library/stream/index.js +7 -4
- package/library/stream/readable-stream.d.ts.map +1 -1
- package/library/stream/readable-stream.js +102 -27
- package/library/stream/stream-core.d.ts +22 -1
- package/library/stream/stream-core.d.ts.map +1 -1
- package/library/stream/stream-core.js +120 -2
- package/library/stream/types.d.ts +115 -2
- package/library/stream/types.d.ts.map +1 -1
- package/library/stream/writable-stream.d.ts +20 -2
- package/library/stream/writable-stream.d.ts.map +1 -1
- package/library/stream/writable-stream.js +366 -41
- package/library/types/index.d.ts +17 -22
- package/library/types/index.d.ts.map +1 -1
- package/library/utils/ack.d.ts +2 -0
- package/library/utils/ack.d.ts.map +1 -0
- package/library/utils/ack.js +44 -0
- package/library/utils/blob.d.ts +3 -0
- package/library/utils/blob.d.ts.map +1 -0
- package/library/utils/blob.js +22 -0
- package/library/utils/cache.d.ts +10 -20
- package/library/utils/cache.d.ts.map +1 -1
- package/library/utils/cache.js +25 -79
- package/library/utils/content-type.d.ts +13 -0
- package/library/utils/content-type.d.ts.map +1 -0
- package/library/utils/content-type.js +87 -0
- package/library/utils/debug.d.ts.map +1 -1
- package/library/utils/debug.js +156 -178
- package/library/utils/hooks.d.ts +30 -0
- package/library/utils/hooks.d.ts.map +1 -0
- package/library/utils/hooks.js +139 -0
- package/library/utils/id.d.ts +9 -0
- package/library/utils/id.d.ts.map +1 -0
- package/library/utils/id.js +21 -0
- package/library/utils/iframe.d.ts +5 -0
- package/library/utils/iframe.d.ts.map +1 -0
- package/library/utils/iframe.js +25 -0
- package/library/utils/index.d.ts +7 -34
- package/library/utils/index.d.ts.map +1 -1
- package/library/utils/index.js +58 -193
- package/library/utils/is.d.ts +2 -0
- package/library/utils/is.d.ts.map +1 -0
- package/library/utils/is.js +9 -0
- package/library/utils/logger.d.ts +13 -0
- package/library/utils/logger.d.ts.map +1 -0
- package/library/utils/logger.js +63 -0
- package/library/utils/origin.d.ts.map +1 -1
- package/library/utils/origin.js +2 -1
- package/library/utils/promise.d.ts +2 -0
- package/library/utils/promise.d.ts.map +1 -0
- package/library/utils/promise.js +9 -0
- package/library/utils/window.d.ts +2 -0
- package/library/utils/window.d.ts.map +1 -0
- package/library/utils/window.js +38 -0
- package/package.json +49 -2
- package/react/package.json +2 -1
- package/esm/core/client-server.js +0 -329
- package/esm/core/server.js +0 -767
- package/esm/utils/ack-meta.js +0 -53
- package/library/core/client-server.d.ts +0 -106
- package/library/core/client-server.d.ts.map +0 -1
- package/library/core/client-server.js +0 -336
- package/library/core/client.d.ts.map +0 -1
- package/library/core/response.d.ts.map +0 -1
- package/library/core/server.d.ts.map +0 -1
- package/library/core/server.js +0 -772
- package/library/utils/ack-meta.d.ts +0 -2
- package/library/utils/ack-meta.d.ts.map +0 -1
- package/library/utils/ack-meta.js +0 -59
- /package/esm/{core → impl}/request.js +0 -0
- /package/library/{core → impl}/request.d.ts +0 -0
- /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.
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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
|
-
*
|
|
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
|
|
103
|
+
/**
|
|
104
|
+
* Protocol version type
|
|
62
105
|
*/
|
|
63
106
|
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
+
}
|