request-iframe 0.0.5 → 0.1.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/README.CN.md +54 -7
- package/README.md +64 -11
- package/esm/api/client.js +79 -0
- package/esm/api/server.js +59 -0
- package/esm/constants/index.js +257 -0
- package/esm/constants/messages.js +155 -0
- package/esm/core/client-server.js +329 -0
- package/esm/core/client.js +873 -0
- package/esm/core/request.js +27 -0
- package/esm/core/response.js +451 -0
- package/esm/core/server.js +767 -0
- package/esm/index.js +21 -0
- package/esm/interceptors/index.js +122 -0
- package/esm/message/channel.js +181 -0
- package/esm/message/dispatcher.js +380 -0
- package/esm/message/index.js +2 -0
- package/esm/stream/file-stream.js +289 -0
- package/esm/stream/index.js +44 -0
- package/esm/stream/readable-stream.js +500 -0
- package/esm/stream/stream-core.js +91 -0
- package/esm/stream/types.js +1 -0
- package/esm/stream/writable-stream.js +582 -0
- package/esm/types/index.js +1 -0
- package/esm/utils/ack-meta.js +53 -0
- package/esm/utils/cache.js +147 -0
- package/esm/utils/cookie.js +352 -0
- package/esm/utils/debug.js +521 -0
- package/esm/utils/error.js +27 -0
- package/esm/utils/index.js +178 -0
- package/esm/utils/origin.js +28 -0
- package/esm/utils/path-match.js +148 -0
- package/esm/utils/protocol.js +157 -0
- package/library/api/client.d.ts.map +1 -1
- package/library/api/client.js +8 -1
- package/library/api/server.d.ts.map +1 -1
- package/library/api/server.js +4 -1
- package/library/constants/index.d.ts +25 -1
- package/library/constants/index.d.ts.map +1 -1
- package/library/constants/index.js +30 -5
- package/library/constants/messages.d.ts +5 -0
- package/library/constants/messages.d.ts.map +1 -1
- package/library/constants/messages.js +5 -0
- package/library/core/client-server.d.ts +3 -2
- package/library/core/client-server.d.ts.map +1 -1
- package/library/core/client-server.js +51 -4
- package/library/core/client.d.ts +4 -1
- package/library/core/client.d.ts.map +1 -1
- package/library/core/client.js +74 -31
- package/library/core/response.d.ts +21 -3
- package/library/core/response.d.ts.map +1 -1
- package/library/core/response.js +46 -6
- package/library/core/server.d.ts +28 -1
- package/library/core/server.d.ts.map +1 -1
- package/library/core/server.js +180 -19
- package/library/message/channel.d.ts +6 -0
- package/library/message/channel.d.ts.map +1 -1
- package/library/message/dispatcher.d.ts +22 -0
- package/library/message/dispatcher.d.ts.map +1 -1
- package/library/message/dispatcher.js +92 -0
- package/library/stream/file-stream.d.ts +4 -0
- package/library/stream/file-stream.d.ts.map +1 -1
- package/library/stream/file-stream.js +61 -33
- package/library/stream/index.d.ts.map +1 -1
- package/library/stream/index.js +2 -0
- package/library/stream/readable-stream.d.ts +30 -11
- package/library/stream/readable-stream.d.ts.map +1 -1
- package/library/stream/readable-stream.js +329 -73
- package/library/stream/stream-core.d.ts +44 -0
- package/library/stream/stream-core.d.ts.map +1 -0
- package/library/stream/stream-core.js +98 -0
- package/library/stream/types.d.ts +90 -3
- package/library/stream/types.d.ts.map +1 -1
- package/library/stream/writable-stream.d.ts +40 -12
- package/library/stream/writable-stream.d.ts.map +1 -1
- package/library/stream/writable-stream.js +391 -195
- package/library/types/index.d.ts +70 -3
- package/library/types/index.d.ts.map +1 -1
- package/library/utils/ack-meta.d.ts +2 -0
- package/library/utils/ack-meta.d.ts.map +1 -0
- package/library/utils/ack-meta.js +59 -0
- package/library/utils/index.d.ts +1 -0
- package/library/utils/index.d.ts.map +1 -1
- package/library/utils/index.js +16 -0
- package/library/utils/origin.d.ts +14 -0
- package/library/utils/origin.d.ts.map +1 -0
- package/library/utils/origin.js +34 -0
- package/package.json +31 -7
- package/react/README.md +16 -0
- package/react/esm/index.js +284 -0
- package/react/library/index.d.ts +1 -1
- package/react/library/index.d.ts.map +1 -1
- package/react/library/index.js +7 -4
- package/react/package.json +24 -2
- package/library/__tests__/channel.test.ts +0 -432
- package/library/__tests__/coverage-branches.test.ts +0 -356
- package/library/__tests__/debug.test.ts +0 -610
- package/library/__tests__/dispatcher.test.ts +0 -485
- package/library/__tests__/interceptors.test.ts +0 -146
- package/library/__tests__/requestIframe.test.ts +0 -5590
- package/library/__tests__/server.test.ts +0 -738
- package/library/__tests__/stream.test.ts +0 -726
- package/library/__tests__/utils.test.ts +0 -473
- package/library/api/client.d.js +0 -5
- package/library/api/server.d.js +0 -5
- package/library/constants/index.d.js +0 -36
- package/library/constants/messages.d.js +0 -5
- package/library/core/client.d.js +0 -5
- package/library/core/message-handler.d.ts +0 -110
- package/library/core/message-handler.d.ts.map +0 -1
- package/library/core/message-handler.js +0 -320
- package/library/core/request-response.d.ts +0 -59
- package/library/core/request-response.d.ts.map +0 -1
- package/library/core/request-response.js +0 -337
- package/library/core/request.d.js +0 -5
- package/library/core/response.d.js +0 -5
- package/library/core/server-base.d.ts +0 -86
- package/library/core/server-base.d.ts.map +0 -1
- package/library/core/server-base.js +0 -257
- package/library/core/server-client.d.js +0 -5
- package/library/core/server-client.d.ts +0 -101
- package/library/core/server-client.d.ts.map +0 -1
- package/library/core/server-client.js +0 -266
- package/library/core/server.d.js +0 -5
- package/library/interceptors/index.d.js +0 -5
- package/library/message/channel.d.js +0 -5
- package/library/message/dispatcher.d.js +0 -5
- package/library/message/index.d.js +0 -25
- package/library/stream/file-stream.d.js +0 -4
- package/library/stream/index.d.js +0 -58
- package/library/stream/readable-stream.d.js +0 -5
- package/library/stream/types.d.js +0 -5
- package/library/stream/writable-stream.d.js +0 -5
- package/library/types/index.d.js +0 -5
- package/library/utils/cache.d.js +0 -5
- package/library/utils/cookie.d.js +0 -5
- package/library/utils/debug.d.js +0 -5
- package/library/utils/index.d.js +0 -94
- package/library/utils/path-match.d.js +0 -5
- package/library/utils/protocol.d.js +0 -5
- package/react/library/__tests__/index.test.d.ts +0 -2
- package/react/library/__tests__/index.test.d.ts.map +0 -1
- package/react/library/__tests__/index.test.tsx +0 -792
|
@@ -0,0 +1,289 @@
|
|
|
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
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
import "core-js/modules/es.array.iterator.js";
|
|
10
|
+
import "core-js/modules/es.symbol.description.js";
|
|
11
|
+
import "core-js/modules/es.array.from.js";
|
|
12
|
+
import "core-js/modules/es.array.reduce.js";
|
|
13
|
+
import "core-js/modules/es.array.slice.js";
|
|
14
|
+
import "core-js/modules/es.array.filter.js";
|
|
15
|
+
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
|
16
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
17
|
+
import "core-js/modules/es.regexp.to-string.js";
|
|
18
|
+
import "core-js/modules/es.typed-array.uint8-array.js";
|
|
19
|
+
import "core-js/modules/es.typed-array.fill.js";
|
|
20
|
+
import "core-js/modules/es.typed-array.iterator.js";
|
|
21
|
+
import "core-js/modules/es.typed-array.set.js";
|
|
22
|
+
import "core-js/modules/es.typed-array.sort.js";
|
|
23
|
+
import "core-js/modules/es.typed-array.to-string.js";
|
|
24
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
25
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
26
|
+
import { IframeWritableStream } from './writable-stream';
|
|
27
|
+
import { IframeReadableStream } from './readable-stream';
|
|
28
|
+
import { StreamType as StreamTypeConstant } from '../constants';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Convert Uint8Array to Base64 string
|
|
32
|
+
*/
|
|
33
|
+
function uint8ArrayToBase64(uint8Array) {
|
|
34
|
+
/**
|
|
35
|
+
* Avoid O(n^2) string concatenation for large buffers.
|
|
36
|
+
* Note: btoa still needs a single binary string, so this mainly improves conversion cost.
|
|
37
|
+
*/
|
|
38
|
+
var chunkSize = 0x8000; // 32KB per chunk (safe for fromCharCode/apply limits)
|
|
39
|
+
var parts = [];
|
|
40
|
+
for (var i = 0; i < uint8Array.length; i += chunkSize) {
|
|
41
|
+
var chunk = uint8Array.subarray(i, i + chunkSize);
|
|
42
|
+
parts.push(String.fromCharCode.apply(null, chunk));
|
|
43
|
+
}
|
|
44
|
+
return btoa(parts.join(''));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Convert Base64 string to Uint8Array
|
|
49
|
+
*/
|
|
50
|
+
function base64ToUint8Array(base64) {
|
|
51
|
+
var binary = atob(base64);
|
|
52
|
+
var uint8Array = new Uint8Array(binary.length);
|
|
53
|
+
for (var i = 0; i < binary.length; i++) {
|
|
54
|
+
uint8Array[i] = binary.charCodeAt(i);
|
|
55
|
+
}
|
|
56
|
+
return uint8Array;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* IframeFileWritableStream - Server-side file writable stream
|
|
61
|
+
* Automatically handles Base64 encoding of file content
|
|
62
|
+
*/
|
|
63
|
+
export class IframeFileWritableStream extends IframeWritableStream {
|
|
64
|
+
constructor(options) {
|
|
65
|
+
super(_objectSpread(_objectSpread({}, options), {}, {
|
|
66
|
+
type: StreamTypeConstant.FILE,
|
|
67
|
+
metadata: _objectSpread(_objectSpread({}, options.metadata), {}, {
|
|
68
|
+
filename: options.filename,
|
|
69
|
+
mimeType: options.mimeType || 'application/octet-stream',
|
|
70
|
+
size: options.size
|
|
71
|
+
})
|
|
72
|
+
}));
|
|
73
|
+
this.filename = options.filename;
|
|
74
|
+
this.mimeType = options.mimeType || 'application/octet-stream';
|
|
75
|
+
this.size = options.size;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Override encode method to convert Uint8Array to Base64
|
|
80
|
+
*/
|
|
81
|
+
encodeData(data) {
|
|
82
|
+
if (data instanceof Uint8Array) {
|
|
83
|
+
return uint8ArrayToBase64(data);
|
|
84
|
+
}
|
|
85
|
+
if (data instanceof ArrayBuffer) {
|
|
86
|
+
return uint8ArrayToBase64(new Uint8Array(data));
|
|
87
|
+
}
|
|
88
|
+
if (typeof data === 'string') {
|
|
89
|
+
// Already a base64 string
|
|
90
|
+
return data;
|
|
91
|
+
}
|
|
92
|
+
// Try to convert other types
|
|
93
|
+
return String(data);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* IframeFileReadableStream - Client-side file readable stream
|
|
99
|
+
* Automatically handles Base64 decoding of file content
|
|
100
|
+
*/
|
|
101
|
+
export class IframeFileReadableStream extends IframeReadableStream {
|
|
102
|
+
constructor(streamId, requestId, messageHandler, options = {}) {
|
|
103
|
+
var _options$metadata, _options$metadata2, _options$metadata3;
|
|
104
|
+
super(streamId, requestId, messageHandler, _objectSpread(_objectSpread({}, options), {}, {
|
|
105
|
+
type: StreamTypeConstant.FILE
|
|
106
|
+
}));
|
|
107
|
+
this.filename = options.filename || ((_options$metadata = options.metadata) === null || _options$metadata === void 0 ? void 0 : _options$metadata.filename);
|
|
108
|
+
this.mimeType = options.mimeType || ((_options$metadata2 = options.metadata) === null || _options$metadata2 === void 0 ? void 0 : _options$metadata2.mimeType);
|
|
109
|
+
this.size = options.size || ((_options$metadata3 = options.metadata) === null || _options$metadata3 === void 0 ? void 0 : _options$metadata3.size);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Override decode method to convert Base64 to Uint8Array
|
|
114
|
+
*/
|
|
115
|
+
decodeData(data) {
|
|
116
|
+
if (typeof data === 'string') {
|
|
117
|
+
return base64ToUint8Array(data);
|
|
118
|
+
}
|
|
119
|
+
if (data instanceof Uint8Array) {
|
|
120
|
+
return data;
|
|
121
|
+
}
|
|
122
|
+
if (data instanceof ArrayBuffer) {
|
|
123
|
+
return new Uint8Array(data);
|
|
124
|
+
}
|
|
125
|
+
return new Uint8Array();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Override merge method to merge all Uint8Array chunks
|
|
130
|
+
*/
|
|
131
|
+
mergeChunks() {
|
|
132
|
+
var chunks = this.chunks;
|
|
133
|
+
if (chunks.length === 0) {
|
|
134
|
+
return new Uint8Array();
|
|
135
|
+
}
|
|
136
|
+
if (chunks.length === 1) {
|
|
137
|
+
return chunks[0];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Calculate total length
|
|
141
|
+
var totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
142
|
+
var result = new Uint8Array(totalLength);
|
|
143
|
+
|
|
144
|
+
// Merge all chunks
|
|
145
|
+
var offset = 0;
|
|
146
|
+
var _iterator = _createForOfIteratorHelper(chunks),
|
|
147
|
+
_step;
|
|
148
|
+
try {
|
|
149
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
150
|
+
var chunk = _step.value;
|
|
151
|
+
result.set(chunk, offset);
|
|
152
|
+
offset += chunk.length;
|
|
153
|
+
}
|
|
154
|
+
} catch (err) {
|
|
155
|
+
_iterator.e(err);
|
|
156
|
+
} finally {
|
|
157
|
+
_iterator.f();
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Read all data as a merged Uint8Array (file stream default behavior)
|
|
164
|
+
*/
|
|
165
|
+
read() {
|
|
166
|
+
var _superprop_getRead = () => super.read,
|
|
167
|
+
_this = this;
|
|
168
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
169
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
170
|
+
while (1) switch (_context.prev = _context.next) {
|
|
171
|
+
case 0:
|
|
172
|
+
_context.next = 1;
|
|
173
|
+
return _superprop_getRead().call(_this);
|
|
174
|
+
case 1:
|
|
175
|
+
return _context.abrupt("return", _context.sent);
|
|
176
|
+
case 2:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context.stop();
|
|
179
|
+
}
|
|
180
|
+
}, _callee);
|
|
181
|
+
}))();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Read as Blob
|
|
186
|
+
*/
|
|
187
|
+
readAsBlob() {
|
|
188
|
+
var _this2 = this;
|
|
189
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
190
|
+
var data, buffer;
|
|
191
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
192
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
_context2.next = 1;
|
|
195
|
+
return _this2.read();
|
|
196
|
+
case 1:
|
|
197
|
+
data = _context2.sent;
|
|
198
|
+
// Use slice to create a pure ArrayBuffer copy to avoid type issues
|
|
199
|
+
buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
200
|
+
return _context2.abrupt("return", new Blob([buffer], {
|
|
201
|
+
type: _this2.mimeType || 'application/octet-stream'
|
|
202
|
+
}));
|
|
203
|
+
case 2:
|
|
204
|
+
case "end":
|
|
205
|
+
return _context2.stop();
|
|
206
|
+
}
|
|
207
|
+
}, _callee2);
|
|
208
|
+
}))();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Read as File
|
|
213
|
+
* @param fileName Optional file name (if not provided, uses stream's filename)
|
|
214
|
+
*/
|
|
215
|
+
readAsFile(fileName) {
|
|
216
|
+
var _this3 = this;
|
|
217
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
218
|
+
var data, buffer, name;
|
|
219
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
220
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
221
|
+
case 0:
|
|
222
|
+
_context3.next = 1;
|
|
223
|
+
return _this3.read();
|
|
224
|
+
case 1:
|
|
225
|
+
data = _context3.sent;
|
|
226
|
+
// Use slice to create a pure ArrayBuffer copy to avoid type issues
|
|
227
|
+
buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
228
|
+
name = fileName || _this3.filename || 'file';
|
|
229
|
+
return _context3.abrupt("return", new File([buffer], name, {
|
|
230
|
+
type: _this3.mimeType || 'application/octet-stream'
|
|
231
|
+
}));
|
|
232
|
+
case 2:
|
|
233
|
+
case "end":
|
|
234
|
+
return _context3.stop();
|
|
235
|
+
}
|
|
236
|
+
}, _callee3);
|
|
237
|
+
}))();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Read as ArrayBuffer
|
|
242
|
+
*/
|
|
243
|
+
readAsArrayBuffer() {
|
|
244
|
+
var _this4 = this;
|
|
245
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
246
|
+
var data, buffer;
|
|
247
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
248
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
249
|
+
case 0:
|
|
250
|
+
_context4.next = 1;
|
|
251
|
+
return _this4.read();
|
|
252
|
+
case 1:
|
|
253
|
+
data = _context4.sent;
|
|
254
|
+
// Create a new ArrayBuffer copy
|
|
255
|
+
buffer = new ArrayBuffer(data.byteLength);
|
|
256
|
+
new Uint8Array(buffer).set(data);
|
|
257
|
+
return _context4.abrupt("return", buffer);
|
|
258
|
+
case 2:
|
|
259
|
+
case "end":
|
|
260
|
+
return _context4.stop();
|
|
261
|
+
}
|
|
262
|
+
}, _callee4);
|
|
263
|
+
}))();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Read as Data URL
|
|
268
|
+
*/
|
|
269
|
+
readAsDataURL() {
|
|
270
|
+
var _this5 = this;
|
|
271
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
272
|
+
var data, base64;
|
|
273
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
274
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
275
|
+
case 0:
|
|
276
|
+
_context5.next = 1;
|
|
277
|
+
return _this5.read();
|
|
278
|
+
case 1:
|
|
279
|
+
data = _context5.sent;
|
|
280
|
+
base64 = uint8ArrayToBase64(data);
|
|
281
|
+
return _context5.abrupt("return", `data:${_this5.mimeType || 'application/octet-stream'};base64,${base64}`);
|
|
282
|
+
case 2:
|
|
283
|
+
case "end":
|
|
284
|
+
return _context5.stop();
|
|
285
|
+
}
|
|
286
|
+
}, _callee5);
|
|
287
|
+
}))();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Type exports
|
|
2
|
+
export * from './types';
|
|
3
|
+
|
|
4
|
+
// Duplex core is internal and not exported publicly.
|
|
5
|
+
|
|
6
|
+
// Writable stream (server-side)
|
|
7
|
+
export { IframeWritableStream } from './writable-stream';
|
|
8
|
+
export { IframeFileWritableStream } from './file-stream';
|
|
9
|
+
|
|
10
|
+
// Readable stream (client-side)
|
|
11
|
+
export { IframeReadableStream, StreamMessageHandler } from './readable-stream';
|
|
12
|
+
export { IframeFileReadableStream } from './file-stream';
|
|
13
|
+
|
|
14
|
+
// Type checking utility functions
|
|
15
|
+
import { IframeReadableStream } from './readable-stream';
|
|
16
|
+
import { IframeFileReadableStream, IframeFileWritableStream } from './file-stream';
|
|
17
|
+
import { IframeWritableStream } from './writable-stream';
|
|
18
|
+
/**
|
|
19
|
+
* Check if value is an IframeReadableStream
|
|
20
|
+
*/
|
|
21
|
+
export function isIframeReadableStream(value) {
|
|
22
|
+
return value instanceof IframeReadableStream;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Check if value is an IframeFileReadableStream (file stream)
|
|
27
|
+
*/
|
|
28
|
+
export function isIframeFileReadableStream(value) {
|
|
29
|
+
return value instanceof IframeFileReadableStream;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Check if value is an IframeWritableStream (includes IframeFileWritableStream)
|
|
34
|
+
*/
|
|
35
|
+
export function isIframeWritableStream(value) {
|
|
36
|
+
return value instanceof IframeWritableStream || value instanceof IframeFileWritableStream;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if value is an IframeFileWritableStream (file writable stream)
|
|
41
|
+
*/
|
|
42
|
+
export function isIframeFileWritableStream(value) {
|
|
43
|
+
return value instanceof IframeFileWritableStream;
|
|
44
|
+
}
|