@junando/worker 0.16.1 → 0.16.3
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/dist/dist-cjs-ChKmbyib.cjs +100 -0
- package/dist/event-streams-D0peAKGF.cjs +1676 -0
- package/dist/handler.cjs +3956 -2070
- package/dist/{node-DdUjbr7d.cjs → node-BZLMCJ1t.cjs} +9 -9
- package/dist/{node-CaH-Nh2c.cjs → node-DTI7Tj9K.cjs} +1 -1
- package/dist/{sdk-DKBOmAd5.cjs → sdk-DUcZIewE.cjs} +166 -162
- package/dist/serde-BKDOXNkW.cjs +6890 -0
- package/package.json +6 -6
|
@@ -0,0 +1,1676 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./rolldown-runtime-BDXX5GFZ.cjs');
|
|
2
|
+
const require_serde = require('./serde-BKDOXNkW.cjs');
|
|
3
|
+
let node_crypto = require("node:crypto");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
let node_stream = require("node:stream");
|
|
6
|
+
let node_zlib = require("node:zlib");
|
|
7
|
+
node_zlib = require_rolldown_runtime.__toESM(node_zlib);
|
|
8
|
+
|
|
9
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/chunked-blob-reader/chunked-blob-reader.js
|
|
10
|
+
async function blobReader(blob, onChunk, chunkSize = 1024 * 1024) {
|
|
11
|
+
const size = blob.size;
|
|
12
|
+
let totalBytesRead = 0;
|
|
13
|
+
while (totalBytesRead < size) {
|
|
14
|
+
const slice = blob.slice(totalBytesRead, Math.min(size, totalBytesRead + chunkSize));
|
|
15
|
+
onChunk(new Uint8Array(await slice.arrayBuffer()));
|
|
16
|
+
totalBytesRead += slice.size;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
var init_chunked_blob_reader = require_rolldown_runtime.__esmMin((() => {}));
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/hash-blob-browser/blobHasher.js
|
|
23
|
+
var blobHasher;
|
|
24
|
+
var init_blobHasher = require_rolldown_runtime.__esmMin((() => {
|
|
25
|
+
init_chunked_blob_reader();
|
|
26
|
+
blobHasher = async function blobHasher(hashCtor, blob) {
|
|
27
|
+
const hash = new hashCtor();
|
|
28
|
+
await blobReader(blob, (chunk) => {
|
|
29
|
+
hash.update(chunk);
|
|
30
|
+
});
|
|
31
|
+
return hash.digest();
|
|
32
|
+
};
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/hash-stream-node/HashCalculator.js
|
|
37
|
+
var HashCalculator;
|
|
38
|
+
var init_HashCalculator = require_rolldown_runtime.__esmMin((() => {
|
|
39
|
+
require_serde.init_serde();
|
|
40
|
+
HashCalculator = class extends node_stream.Writable {
|
|
41
|
+
hash;
|
|
42
|
+
constructor(hash, options) {
|
|
43
|
+
super(options);
|
|
44
|
+
this.hash = hash;
|
|
45
|
+
}
|
|
46
|
+
_write(chunk, encoding, callback) {
|
|
47
|
+
try {
|
|
48
|
+
this.hash.update(require_serde.toUint8Array(chunk));
|
|
49
|
+
} catch (err) {
|
|
50
|
+
return callback(err);
|
|
51
|
+
}
|
|
52
|
+
callback();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/hash-stream-node/fileStreamHasher.js
|
|
59
|
+
var fileStreamHasher, isReadStream;
|
|
60
|
+
var init_fileStreamHasher = require_rolldown_runtime.__esmMin((() => {
|
|
61
|
+
init_HashCalculator();
|
|
62
|
+
fileStreamHasher = (hashCtor, fileStream) => new Promise((resolve, reject) => {
|
|
63
|
+
if (!isReadStream(fileStream)) {
|
|
64
|
+
reject(new Error("Unable to calculate hash for non-file streams."));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const fileStreamTee = (0, node_fs.createReadStream)(fileStream.path, {
|
|
68
|
+
start: fileStream.start,
|
|
69
|
+
end: fileStream.end
|
|
70
|
+
});
|
|
71
|
+
const hash = new hashCtor();
|
|
72
|
+
const hashCalculator = new HashCalculator(hash);
|
|
73
|
+
fileStreamTee.pipe(hashCalculator);
|
|
74
|
+
fileStreamTee.on("error", (err) => {
|
|
75
|
+
hashCalculator.end();
|
|
76
|
+
reject(err);
|
|
77
|
+
});
|
|
78
|
+
hashCalculator.on("error", reject);
|
|
79
|
+
hashCalculator.on("finish", function() {
|
|
80
|
+
hash.digest().then(resolve).catch(reject);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
isReadStream = (stream) => typeof stream.path === "string";
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/hash-stream-node/readableStreamHasher.js
|
|
88
|
+
var readableStreamHasher;
|
|
89
|
+
var init_readableStreamHasher = require_rolldown_runtime.__esmMin((() => {
|
|
90
|
+
init_HashCalculator();
|
|
91
|
+
readableStreamHasher = (hashCtor, readableStream) => {
|
|
92
|
+
if (readableStream.readableFlowing !== null) {
|
|
93
|
+
throw new Error("Unable to calculate hash for flowing readable stream");
|
|
94
|
+
}
|
|
95
|
+
const hash = new hashCtor();
|
|
96
|
+
const hashCalculator = new HashCalculator(hash);
|
|
97
|
+
readableStream.pipe(hashCalculator);
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
readableStream.on("error", (err) => {
|
|
100
|
+
hashCalculator.end();
|
|
101
|
+
reject(err);
|
|
102
|
+
});
|
|
103
|
+
hashCalculator.on("error", reject);
|
|
104
|
+
hashCalculator.on("finish", () => {
|
|
105
|
+
hash.digest().then(resolve).catch(reject);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/md5/Md5Js.js
|
|
113
|
+
function compress(state, block) {
|
|
114
|
+
let a = state[0], b = state[1], c = state[2], d = state[3];
|
|
115
|
+
for (let i = 0; i < 64; ++i) {
|
|
116
|
+
let f, g;
|
|
117
|
+
if (i < 16) {
|
|
118
|
+
f = b & c | ~b & d;
|
|
119
|
+
g = i;
|
|
120
|
+
} else if (i < 32) {
|
|
121
|
+
f = d & b | c & ~d;
|
|
122
|
+
g = (5 * i + 1) % 16;
|
|
123
|
+
} else if (i < 48) {
|
|
124
|
+
f = b ^ c ^ d;
|
|
125
|
+
g = (3 * i + 5) % 16;
|
|
126
|
+
} else {
|
|
127
|
+
f = c ^ (b | ~d);
|
|
128
|
+
g = 7 * i % 16;
|
|
129
|
+
}
|
|
130
|
+
const x = block.getUint32(g * 4, true);
|
|
131
|
+
const tmp = d;
|
|
132
|
+
d = c;
|
|
133
|
+
c = b;
|
|
134
|
+
const s = S[(i >> 4) * 4 + (i & 3)];
|
|
135
|
+
const sum = (a + f & M) + (x + T[i] & M) & M;
|
|
136
|
+
b = b + ((sum << s | sum >>> 32 - s) >>> 0) & M;
|
|
137
|
+
a = tmp;
|
|
138
|
+
}
|
|
139
|
+
state[0] = state[0] + a & M;
|
|
140
|
+
state[1] = state[1] + b & M;
|
|
141
|
+
state[2] = state[2] + c & M;
|
|
142
|
+
state[3] = state[3] + d & M;
|
|
143
|
+
}
|
|
144
|
+
var Md5Js, INIT$1, M, S, T;
|
|
145
|
+
var init_Md5Js = require_rolldown_runtime.__esmMin((() => {
|
|
146
|
+
require_serde.init_serde();
|
|
147
|
+
Md5Js = class {
|
|
148
|
+
digestLength = 16;
|
|
149
|
+
state = Uint32Array.from(INIT$1);
|
|
150
|
+
writeBuffer = new DataView(new ArrayBuffer(64));
|
|
151
|
+
bufferLength = 0;
|
|
152
|
+
bytesHashed = 0;
|
|
153
|
+
update(sourceData) {
|
|
154
|
+
const data = require_serde.toUint8Array(sourceData);
|
|
155
|
+
let pos = 0;
|
|
156
|
+
let len = data.byteLength;
|
|
157
|
+
this.bytesHashed += len;
|
|
158
|
+
while (len > 0) {
|
|
159
|
+
this.writeBuffer.setUint8(this.bufferLength++, data[pos++]);
|
|
160
|
+
--len;
|
|
161
|
+
if (this.bufferLength === 64) {
|
|
162
|
+
compress(this.state, this.writeBuffer);
|
|
163
|
+
this.bufferLength = 0;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async digest() {
|
|
168
|
+
const state = Uint32Array.from(this.state);
|
|
169
|
+
const buf = new DataView(this.writeBuffer.buffer.slice(0));
|
|
170
|
+
let bufLen = this.bufferLength;
|
|
171
|
+
const bits = this.bytesHashed * 8;
|
|
172
|
+
buf.setUint8(bufLen++, 128);
|
|
173
|
+
if (this.bufferLength % 64 >= 56) {
|
|
174
|
+
for (let i = bufLen; i < 64; ++i) {
|
|
175
|
+
buf.setUint8(i, 0);
|
|
176
|
+
}
|
|
177
|
+
compress(state, buf);
|
|
178
|
+
bufLen = 0;
|
|
179
|
+
}
|
|
180
|
+
for (let i = bufLen; i < 56; ++i) {
|
|
181
|
+
buf.setUint8(i, 0);
|
|
182
|
+
}
|
|
183
|
+
buf.setUint32(56, bits >>> 0, true);
|
|
184
|
+
buf.setUint32(60, Math.floor(bits / 2 ** 32), true);
|
|
185
|
+
compress(state, buf);
|
|
186
|
+
const out = new Uint8Array(16);
|
|
187
|
+
const view = new DataView(out.buffer);
|
|
188
|
+
for (let i = 0; i < 4; ++i) {
|
|
189
|
+
view.setUint32(i * 4, state[i], true);
|
|
190
|
+
}
|
|
191
|
+
return out;
|
|
192
|
+
}
|
|
193
|
+
reset() {
|
|
194
|
+
this.state.set(INIT$1);
|
|
195
|
+
this.writeBuffer = new DataView(new ArrayBuffer(64));
|
|
196
|
+
this.bufferLength = 0;
|
|
197
|
+
this.bytesHashed = 0;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
INIT$1 = [
|
|
201
|
+
1732584193,
|
|
202
|
+
4023233417,
|
|
203
|
+
2562383102,
|
|
204
|
+
271733878
|
|
205
|
+
];
|
|
206
|
+
M = 4294967295;
|
|
207
|
+
S = Uint8Array.of(7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21);
|
|
208
|
+
T = Array.from({ length: 64 }, (_, i) => Math.abs(Math.sin(i + 1)) * 2 ** 32 >>> 0);
|
|
209
|
+
}));
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/md5/Md5Node.js
|
|
213
|
+
function buildNativeClass$2() {
|
|
214
|
+
return class Md5Node {
|
|
215
|
+
digestLength = 16;
|
|
216
|
+
hash = (0, node_crypto.createHash)("md5");
|
|
217
|
+
update(data) {
|
|
218
|
+
this.hash.update(require_serde.toUint8Array(data));
|
|
219
|
+
}
|
|
220
|
+
async digest() {
|
|
221
|
+
const buf = this.hash.copy().digest();
|
|
222
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
223
|
+
}
|
|
224
|
+
reset() {
|
|
225
|
+
this.hash = (0, node_crypto.createHash)("md5");
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
var hasNativeCrypto$1, Md5Node;
|
|
230
|
+
var init_Md5Node = require_rolldown_runtime.__esmMin((() => {
|
|
231
|
+
require_serde.init_serde();
|
|
232
|
+
init_Md5Js();
|
|
233
|
+
hasNativeCrypto$1 = (() => {
|
|
234
|
+
try {
|
|
235
|
+
(0, node_crypto.createHash)("md5");
|
|
236
|
+
return true;
|
|
237
|
+
} catch {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
})();
|
|
241
|
+
Md5Node = hasNativeCrypto$1 ? buildNativeClass$2() : Md5Js;
|
|
242
|
+
}));
|
|
243
|
+
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Js.js
|
|
246
|
+
var CRC32_TABLE, ONES, Crc32Js;
|
|
247
|
+
var init_Crc32Js = require_rolldown_runtime.__esmMin((() => {
|
|
248
|
+
CRC32_TABLE = new Uint32Array(256);
|
|
249
|
+
for (let i = 0; i < 256; ++i) {
|
|
250
|
+
let c = i;
|
|
251
|
+
for (let j = 0; j < 8; ++j) {
|
|
252
|
+
c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
253
|
+
}
|
|
254
|
+
CRC32_TABLE[i] = c >>> 0;
|
|
255
|
+
}
|
|
256
|
+
ONES = 4294967295;
|
|
257
|
+
Crc32Js = class {
|
|
258
|
+
digestLength = 4;
|
|
259
|
+
checksum = ONES;
|
|
260
|
+
update(data) {
|
|
261
|
+
for (let i = 0; i < data.length; ++i) {
|
|
262
|
+
this.checksum = this.checksum >>> 8 ^ CRC32_TABLE[(this.checksum ^ data[i]) & 255];
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
digestSync() {
|
|
266
|
+
return (this.checksum ^ ONES) >>> 0;
|
|
267
|
+
}
|
|
268
|
+
async digest() {
|
|
269
|
+
const value = this.digestSync();
|
|
270
|
+
const out = new Uint8Array(4);
|
|
271
|
+
new DataView(out.buffer).setUint32(0, value, false);
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
reset() {
|
|
275
|
+
this.checksum = ONES;
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}));
|
|
279
|
+
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Node.js
|
|
282
|
+
function buildNativeClass$1(nativeCrc32) {
|
|
283
|
+
return class Crc32Node {
|
|
284
|
+
digestLength = 4;
|
|
285
|
+
value = 0;
|
|
286
|
+
update(data) {
|
|
287
|
+
this.value = nativeCrc32(data, this.value);
|
|
288
|
+
}
|
|
289
|
+
digestSync() {
|
|
290
|
+
return this.value >>> 0;
|
|
291
|
+
}
|
|
292
|
+
async digest() {
|
|
293
|
+
const out = new Uint8Array(4);
|
|
294
|
+
new DataView(out.buffer).setUint32(0, this.digestSync(), false);
|
|
295
|
+
return out;
|
|
296
|
+
}
|
|
297
|
+
reset() {
|
|
298
|
+
this.value = 0;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
var zlibCrc32, Crc32Node;
|
|
303
|
+
var init_Crc32Node = require_rolldown_runtime.__esmMin((() => {
|
|
304
|
+
init_Crc32Js();
|
|
305
|
+
zlibCrc32 = typeof node_zlib.crc32 === "function" ? node_zlib.crc32 : undefined;
|
|
306
|
+
Crc32Node = zlibCrc32 ? buildNativeClass$1(zlibCrc32) : Crc32Js;
|
|
307
|
+
}));
|
|
308
|
+
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256Js.js
|
|
311
|
+
var BLOCK, DIGEST_LENGTH, MAX_HASHABLE_LENGTH, Sha256Js, INIT, K;
|
|
312
|
+
var init_Sha256Js = require_rolldown_runtime.__esmMin((() => {
|
|
313
|
+
require_serde.init_serde();
|
|
314
|
+
BLOCK = 64;
|
|
315
|
+
DIGEST_LENGTH = 32;
|
|
316
|
+
MAX_HASHABLE_LENGTH = 2 ** 53 - 1;
|
|
317
|
+
Sha256Js = class Sha256Js {
|
|
318
|
+
digestLength = DIGEST_LENGTH;
|
|
319
|
+
state = Int32Array.from(INIT);
|
|
320
|
+
w;
|
|
321
|
+
buffer = new Uint8Array(64);
|
|
322
|
+
bufferLength = 0;
|
|
323
|
+
bytesHashed = 0;
|
|
324
|
+
finished = false;
|
|
325
|
+
inner;
|
|
326
|
+
outer;
|
|
327
|
+
constructor(secret) {
|
|
328
|
+
if (secret) {
|
|
329
|
+
const key = Sha256Js.normalizeKey(secret);
|
|
330
|
+
this.inner = new Sha256Js();
|
|
331
|
+
this.outer = new Sha256Js();
|
|
332
|
+
const { inner, outer } = this;
|
|
333
|
+
const pad = new Uint8Array(BLOCK * 2);
|
|
334
|
+
for (let i = 0; i < BLOCK; ++i) {
|
|
335
|
+
pad[i] = 54 ^ key[i];
|
|
336
|
+
pad[i + BLOCK] = 92 ^ key[i];
|
|
337
|
+
}
|
|
338
|
+
inner.update(pad.subarray(0, BLOCK));
|
|
339
|
+
outer.update(pad.subarray(BLOCK));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
update(data) {
|
|
343
|
+
if (this.finished) {
|
|
344
|
+
throw new Error("Attempted to update an already finished HMAC.");
|
|
345
|
+
}
|
|
346
|
+
if (this.inner) {
|
|
347
|
+
this.inner.update(data);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const chunk = require_serde.toUint8Array(data);
|
|
351
|
+
let position = 0;
|
|
352
|
+
let { byteLength } = chunk;
|
|
353
|
+
this.bytesHashed += byteLength;
|
|
354
|
+
if (this.bytesHashed * 8 > MAX_HASHABLE_LENGTH) {
|
|
355
|
+
throw new Error("Cannot hash more than 2^53 - 1 bits");
|
|
356
|
+
}
|
|
357
|
+
while (byteLength > 0) {
|
|
358
|
+
this.buffer[this.bufferLength++] = chunk[position++];
|
|
359
|
+
byteLength--;
|
|
360
|
+
if (this.bufferLength === BLOCK) {
|
|
361
|
+
this.hashBuffer();
|
|
362
|
+
this.bufferLength = 0;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
async digest() {
|
|
367
|
+
const { inner, outer } = this;
|
|
368
|
+
if (inner && outer) {
|
|
369
|
+
if (this.finished) {
|
|
370
|
+
throw new Error("Attempted to digest an already finished HMAC.");
|
|
371
|
+
}
|
|
372
|
+
this.finished = true;
|
|
373
|
+
const innerDigest = inner.digestSync();
|
|
374
|
+
outer.update(innerDigest);
|
|
375
|
+
return outer.digestSync();
|
|
376
|
+
}
|
|
377
|
+
return this.digestSync();
|
|
378
|
+
}
|
|
379
|
+
reset() {
|
|
380
|
+
this.state = Int32Array.from(INIT);
|
|
381
|
+
this.buffer = new Uint8Array(64);
|
|
382
|
+
this.bufferLength = 0;
|
|
383
|
+
this.bytesHashed = 0;
|
|
384
|
+
}
|
|
385
|
+
digestSync() {
|
|
386
|
+
const state = this.state.slice();
|
|
387
|
+
const buffer = this.buffer.slice();
|
|
388
|
+
let bufferLength = this.bufferLength;
|
|
389
|
+
const bitsHashed = this.bytesHashed * 8;
|
|
390
|
+
const bufferView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
391
|
+
bufferView.setUint8(bufferLength++, 128);
|
|
392
|
+
if ((bufferLength - 1) % BLOCK >= BLOCK - 8) {
|
|
393
|
+
for (let i = bufferLength; i < BLOCK; ++i) {
|
|
394
|
+
bufferView.setUint8(i, 0);
|
|
395
|
+
}
|
|
396
|
+
this.hashBufferWith(state, buffer);
|
|
397
|
+
bufferLength = 0;
|
|
398
|
+
}
|
|
399
|
+
for (let i = bufferLength; i < BLOCK - 8; ++i) {
|
|
400
|
+
bufferView.setUint8(i, 0);
|
|
401
|
+
}
|
|
402
|
+
bufferView.setUint32(BLOCK - 8, Math.floor(bitsHashed / 4294967296), false);
|
|
403
|
+
bufferView.setUint32(BLOCK - 4, bitsHashed, false);
|
|
404
|
+
this.hashBufferWith(state, buffer);
|
|
405
|
+
const out = new Uint8Array(DIGEST_LENGTH);
|
|
406
|
+
for (let i = 0; i < 8; ++i) {
|
|
407
|
+
out[i * 4] = state[i] >>> 24 & 255;
|
|
408
|
+
out[i * 4 + 1] = state[i] >>> 16 & 255;
|
|
409
|
+
out[i * 4 + 2] = state[i] >>> 8 & 255;
|
|
410
|
+
out[i * 4 + 3] = state[i] >>> 0 & 255;
|
|
411
|
+
}
|
|
412
|
+
return out;
|
|
413
|
+
}
|
|
414
|
+
static normalizeKey(secret) {
|
|
415
|
+
const key = require_serde.toUint8Array(secret);
|
|
416
|
+
if (key.byteLength > BLOCK) {
|
|
417
|
+
const h = new Sha256Js();
|
|
418
|
+
h.update(key);
|
|
419
|
+
const out = h.digestSync();
|
|
420
|
+
const padded = new Uint8Array(BLOCK);
|
|
421
|
+
padded.set(out);
|
|
422
|
+
return padded;
|
|
423
|
+
}
|
|
424
|
+
if (key.byteLength < BLOCK) {
|
|
425
|
+
const padded = new Uint8Array(BLOCK);
|
|
426
|
+
padded.set(key);
|
|
427
|
+
return padded;
|
|
428
|
+
}
|
|
429
|
+
return key;
|
|
430
|
+
}
|
|
431
|
+
hashBuffer() {
|
|
432
|
+
this.hashBufferWith(this.state, this.buffer);
|
|
433
|
+
}
|
|
434
|
+
hashBufferWith(state, buffer) {
|
|
435
|
+
const w = this.w ??= new Int32Array(64);
|
|
436
|
+
let s0 = state[0], s1 = state[1], s2 = state[2], s3 = state[3], s4 = state[4], s5 = state[5], s6 = state[6], s7 = state[7];
|
|
437
|
+
for (let i = 0; i < BLOCK; ++i) {
|
|
438
|
+
if (i < 16) {
|
|
439
|
+
w[i] = (buffer[i * 4] & 255) << 24 | (buffer[i * 4 + 1] & 255) << 16 | (buffer[i * 4 + 2] & 255) << 8 | buffer[i * 4 + 3] & 255;
|
|
440
|
+
} else {
|
|
441
|
+
let u = w[i - 2];
|
|
442
|
+
const t1 = (u >>> 17 | u << 15) ^ (u >>> 19 | u << 13) ^ u >>> 10;
|
|
443
|
+
u = w[i - 15];
|
|
444
|
+
const t2 = (u >>> 7 | u << 25) ^ (u >>> 18 | u << 14) ^ u >>> 3;
|
|
445
|
+
w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);
|
|
446
|
+
}
|
|
447
|
+
const t1 = (((s4 >>> 6 | s4 << 26) ^ (s4 >>> 11 | s4 << 21) ^ (s4 >>> 25 | s4 << 7)) + (s4 & s5 ^ ~s4 & s6) | 0) + (s7 + (K[i] + w[i] | 0) | 0) | 0;
|
|
448
|
+
const t2 = ((s0 >>> 2 | s0 << 30) ^ (s0 >>> 13 | s0 << 19) ^ (s0 >>> 22 | s0 << 10)) + (s0 & s1 ^ s0 & s2 ^ s1 & s2) | 0;
|
|
449
|
+
s7 = s6;
|
|
450
|
+
s6 = s5;
|
|
451
|
+
s5 = s4;
|
|
452
|
+
s4 = s3 + t1 | 0;
|
|
453
|
+
s3 = s2;
|
|
454
|
+
s2 = s1;
|
|
455
|
+
s1 = s0;
|
|
456
|
+
s0 = t1 + t2 | 0;
|
|
457
|
+
}
|
|
458
|
+
state[0] += s0;
|
|
459
|
+
state[1] += s1;
|
|
460
|
+
state[2] += s2;
|
|
461
|
+
state[3] += s3;
|
|
462
|
+
state[4] += s4;
|
|
463
|
+
state[5] += s5;
|
|
464
|
+
state[6] += s6;
|
|
465
|
+
state[7] += s7;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
INIT = new Int32Array([
|
|
469
|
+
1779033703,
|
|
470
|
+
3144134277,
|
|
471
|
+
1013904242,
|
|
472
|
+
2773480762,
|
|
473
|
+
1359893119,
|
|
474
|
+
2600822924,
|
|
475
|
+
528734635,
|
|
476
|
+
1541459225
|
|
477
|
+
]);
|
|
478
|
+
K = new Int32Array([
|
|
479
|
+
1116352408,
|
|
480
|
+
1899447441,
|
|
481
|
+
3049323471,
|
|
482
|
+
3921009573,
|
|
483
|
+
961987163,
|
|
484
|
+
1508970993,
|
|
485
|
+
2453635748,
|
|
486
|
+
2870763221,
|
|
487
|
+
3624381080,
|
|
488
|
+
310598401,
|
|
489
|
+
607225278,
|
|
490
|
+
1426881987,
|
|
491
|
+
1925078388,
|
|
492
|
+
2162078206,
|
|
493
|
+
2614888103,
|
|
494
|
+
3248222580,
|
|
495
|
+
3835390401,
|
|
496
|
+
4022224774,
|
|
497
|
+
264347078,
|
|
498
|
+
604807628,
|
|
499
|
+
770255983,
|
|
500
|
+
1249150122,
|
|
501
|
+
1555081692,
|
|
502
|
+
1996064986,
|
|
503
|
+
2554220882,
|
|
504
|
+
2821834349,
|
|
505
|
+
2952996808,
|
|
506
|
+
3210313671,
|
|
507
|
+
3336571891,
|
|
508
|
+
3584528711,
|
|
509
|
+
113926993,
|
|
510
|
+
338241895,
|
|
511
|
+
666307205,
|
|
512
|
+
773529912,
|
|
513
|
+
1294757372,
|
|
514
|
+
1396182291,
|
|
515
|
+
1695183700,
|
|
516
|
+
1986661051,
|
|
517
|
+
2177026350,
|
|
518
|
+
2456956037,
|
|
519
|
+
2730485921,
|
|
520
|
+
2820302411,
|
|
521
|
+
3259730800,
|
|
522
|
+
3345764771,
|
|
523
|
+
3516065817,
|
|
524
|
+
3600352804,
|
|
525
|
+
4094571909,
|
|
526
|
+
275423344,
|
|
527
|
+
430227734,
|
|
528
|
+
506948616,
|
|
529
|
+
659060556,
|
|
530
|
+
883997877,
|
|
531
|
+
958139571,
|
|
532
|
+
1322822218,
|
|
533
|
+
1537002063,
|
|
534
|
+
1747873779,
|
|
535
|
+
1955562222,
|
|
536
|
+
2024104815,
|
|
537
|
+
2227730452,
|
|
538
|
+
2361852424,
|
|
539
|
+
2428436474,
|
|
540
|
+
2756734187,
|
|
541
|
+
3204031479,
|
|
542
|
+
3329325298
|
|
543
|
+
]);
|
|
544
|
+
}));
|
|
545
|
+
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256Node.js
|
|
548
|
+
function buildNativeClass() {
|
|
549
|
+
return class Sha256Node {
|
|
550
|
+
digestLength = 32;
|
|
551
|
+
secret;
|
|
552
|
+
hash;
|
|
553
|
+
isHmac;
|
|
554
|
+
finished = false;
|
|
555
|
+
constructor(secret) {
|
|
556
|
+
this.secret = secret;
|
|
557
|
+
this.isHmac = !!secret;
|
|
558
|
+
this.hash = this.createHash();
|
|
559
|
+
}
|
|
560
|
+
update(data) {
|
|
561
|
+
if (this.finished) {
|
|
562
|
+
throw new Error("Attempted to update an already finished hash.");
|
|
563
|
+
}
|
|
564
|
+
this.hash.update(data);
|
|
565
|
+
}
|
|
566
|
+
async digest() {
|
|
567
|
+
let buf;
|
|
568
|
+
if (this.isHmac) {
|
|
569
|
+
this.finished = true;
|
|
570
|
+
buf = this.hash.digest();
|
|
571
|
+
} else {
|
|
572
|
+
buf = this.hash.copy().digest();
|
|
573
|
+
}
|
|
574
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
575
|
+
}
|
|
576
|
+
reset() {
|
|
577
|
+
this.hash = this.createHash();
|
|
578
|
+
this.finished = false;
|
|
579
|
+
}
|
|
580
|
+
createHash() {
|
|
581
|
+
return this.secret ? (0, node_crypto.createHmac)("sha256", toBuffer(this.secret)) : (0, node_crypto.createHash)("sha256");
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
function toBuffer(data) {
|
|
586
|
+
if (typeof data === "string") {
|
|
587
|
+
return data;
|
|
588
|
+
}
|
|
589
|
+
if (ArrayBuffer.isView(data)) {
|
|
590
|
+
return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
591
|
+
}
|
|
592
|
+
return Buffer.from(data);
|
|
593
|
+
}
|
|
594
|
+
var hasNativeCrypto, Sha256Node;
|
|
595
|
+
var init_Sha256Node = require_rolldown_runtime.__esmMin((() => {
|
|
596
|
+
init_Sha256Js();
|
|
597
|
+
hasNativeCrypto = (() => {
|
|
598
|
+
try {
|
|
599
|
+
(0, node_crypto.createHash)("sha256");
|
|
600
|
+
return true;
|
|
601
|
+
} catch {
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
})();
|
|
605
|
+
Sha256Node = hasNativeCrypto ? buildNativeClass() : Sha256Js;
|
|
606
|
+
}));
|
|
607
|
+
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256WebCrypto.js
|
|
610
|
+
var digest, sign, importKey, subtle, MAX_PENDING_BYTES, Sha256WebCrypto;
|
|
611
|
+
var init_Sha256WebCrypto = require_rolldown_runtime.__esmMin((() => {
|
|
612
|
+
require_serde.init_serde();
|
|
613
|
+
init_Sha256Js();
|
|
614
|
+
({digest, sign, importKey} = globalThis?.crypto?.subtle ?? {});
|
|
615
|
+
subtle = typeof digest === "function" && typeof sign === "function" && typeof importKey === "function" ? globalThis.crypto.subtle : undefined;
|
|
616
|
+
MAX_PENDING_BYTES = 8 * 1024 * 1024;
|
|
617
|
+
Sha256WebCrypto = class {
|
|
618
|
+
digestLength = 32;
|
|
619
|
+
secret;
|
|
620
|
+
pending = [];
|
|
621
|
+
pendingBytes = 0;
|
|
622
|
+
fallback;
|
|
623
|
+
finished = false;
|
|
624
|
+
constructor(secret) {
|
|
625
|
+
if (secret) {
|
|
626
|
+
this.secret = require_serde.toUint8Array(secret);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
update(data) {
|
|
630
|
+
if (this.finished) {
|
|
631
|
+
throw new Error("Attempted to update an already finished HMAC.");
|
|
632
|
+
}
|
|
633
|
+
if (this.fallback) {
|
|
634
|
+
this.fallback.update(data);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
this.pending.push(data.slice());
|
|
638
|
+
this.pendingBytes += data.byteLength;
|
|
639
|
+
if (this.pendingBytes >= MAX_PENDING_BYTES) {
|
|
640
|
+
this.switchToFallback();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
async digest() {
|
|
644
|
+
if (this.fallback) {
|
|
645
|
+
return this.fallback.digest();
|
|
646
|
+
}
|
|
647
|
+
if (this.secret && this.finished) {
|
|
648
|
+
throw new Error("Attempted to digest an already finished HMAC.");
|
|
649
|
+
}
|
|
650
|
+
const data = require_serde.concatBytes(this.pending);
|
|
651
|
+
if (subtle) {
|
|
652
|
+
if (this.secret) {
|
|
653
|
+
this.finished = true;
|
|
654
|
+
const key = await subtle.importKey("raw", this.secret, {
|
|
655
|
+
name: "HMAC",
|
|
656
|
+
hash: "SHA-256"
|
|
657
|
+
}, false, ["sign"]);
|
|
658
|
+
const sig = await subtle.sign("HMAC", key, data);
|
|
659
|
+
return new Uint8Array(sig);
|
|
660
|
+
}
|
|
661
|
+
const hash = await subtle.digest("SHA-256", data);
|
|
662
|
+
return new Uint8Array(hash);
|
|
663
|
+
}
|
|
664
|
+
const sha256 = new Sha256Js(this.secret);
|
|
665
|
+
sha256.update(data);
|
|
666
|
+
return sha256.digest();
|
|
667
|
+
}
|
|
668
|
+
reset() {
|
|
669
|
+
this.pending = [];
|
|
670
|
+
this.pendingBytes = 0;
|
|
671
|
+
this.fallback = undefined;
|
|
672
|
+
this.finished = false;
|
|
673
|
+
}
|
|
674
|
+
switchToFallback() {
|
|
675
|
+
const sha256Js = new Sha256Js(this.secret);
|
|
676
|
+
for (const chunk of this.pending) {
|
|
677
|
+
sha256Js.update(chunk);
|
|
678
|
+
}
|
|
679
|
+
this.fallback = sha256Js;
|
|
680
|
+
this.pending = [];
|
|
681
|
+
this.pendingBytes = 0;
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
}));
|
|
685
|
+
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/checksum/index.js
|
|
688
|
+
var init_checksum = require_rolldown_runtime.__esmMin((() => {
|
|
689
|
+
init_blobHasher();
|
|
690
|
+
init_fileStreamHasher();
|
|
691
|
+
init_readableStreamHasher();
|
|
692
|
+
init_Md5Js();
|
|
693
|
+
init_Md5Node();
|
|
694
|
+
init_Crc32Js();
|
|
695
|
+
init_Crc32Node();
|
|
696
|
+
init_Sha256Js();
|
|
697
|
+
init_Sha256Node();
|
|
698
|
+
init_Sha256WebCrypto();
|
|
699
|
+
init_chunked_blob_reader();
|
|
700
|
+
}));
|
|
701
|
+
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/Int64.js
|
|
704
|
+
function negate(bytes) {
|
|
705
|
+
for (let i = 0; i < 8; i++) {
|
|
706
|
+
bytes[i] ^= 255;
|
|
707
|
+
}
|
|
708
|
+
for (let i = 7; i > -1; i--) {
|
|
709
|
+
bytes[i]++;
|
|
710
|
+
if (bytes[i] !== 0) break;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
var Int64;
|
|
714
|
+
var init_Int64 = require_rolldown_runtime.__esmMin((() => {
|
|
715
|
+
require_serde.init_serde();
|
|
716
|
+
Int64 = class Int64 {
|
|
717
|
+
bytes;
|
|
718
|
+
constructor(bytes) {
|
|
719
|
+
this.bytes = bytes;
|
|
720
|
+
if (bytes.byteLength !== 8) {
|
|
721
|
+
throw new Error("Int64 buffers must be exactly 8 bytes");
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
static fromNumber(number) {
|
|
725
|
+
if (number > 0x8000000000000000 || number < -0x8000000000000000) {
|
|
726
|
+
throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
|
|
727
|
+
}
|
|
728
|
+
const bytes = new Uint8Array(8);
|
|
729
|
+
for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
|
|
730
|
+
bytes[i] = remaining;
|
|
731
|
+
}
|
|
732
|
+
if (number < 0) {
|
|
733
|
+
negate(bytes);
|
|
734
|
+
}
|
|
735
|
+
return new Int64(bytes);
|
|
736
|
+
}
|
|
737
|
+
valueOf() {
|
|
738
|
+
const bytes = this.bytes.slice(0);
|
|
739
|
+
const negative = bytes[0] & 128;
|
|
740
|
+
if (negative) {
|
|
741
|
+
negate(bytes);
|
|
742
|
+
}
|
|
743
|
+
return parseInt(require_serde.toHex(bytes), 16) * (negative ? -1 : 1);
|
|
744
|
+
}
|
|
745
|
+
toString() {
|
|
746
|
+
return String(this.valueOf());
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
}));
|
|
750
|
+
|
|
751
|
+
//#endregion
|
|
752
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js
|
|
753
|
+
var HeaderMarshaller, HEADER_VALUE_TYPE, BOOLEAN_TAG, BYTE_TAG, SHORT_TAG, INT_TAG, LONG_TAG, BINARY_TAG, STRING_TAG, TIMESTAMP_TAG, UUID_TAG, UUID_PATTERN;
|
|
754
|
+
var init_HeaderMarshaller = require_rolldown_runtime.__esmMin((() => {
|
|
755
|
+
require_serde.init_transport();
|
|
756
|
+
require_serde.init_serde();
|
|
757
|
+
init_Int64();
|
|
758
|
+
HeaderMarshaller = class {
|
|
759
|
+
toUtf8;
|
|
760
|
+
fromUtf8;
|
|
761
|
+
constructor(toUtf8, fromUtf8) {
|
|
762
|
+
this.toUtf8 = toUtf8;
|
|
763
|
+
this.fromUtf8 = fromUtf8;
|
|
764
|
+
}
|
|
765
|
+
format(headers) {
|
|
766
|
+
const chunks = [];
|
|
767
|
+
for (const headerName in headers) {
|
|
768
|
+
if (!require_serde.hasOwn(headers, headerName)) continue;
|
|
769
|
+
const bytes = this.fromUtf8(headerName);
|
|
770
|
+
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
|
771
|
+
}
|
|
772
|
+
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
|
773
|
+
let position = 0;
|
|
774
|
+
for (const chunk of chunks) {
|
|
775
|
+
out.set(chunk, position);
|
|
776
|
+
position += chunk.byteLength;
|
|
777
|
+
}
|
|
778
|
+
return out;
|
|
779
|
+
}
|
|
780
|
+
formatHeaderValue(header) {
|
|
781
|
+
switch (header.type) {
|
|
782
|
+
case "boolean": return Uint8Array.from([header.value ? 0 : 1]);
|
|
783
|
+
case "byte": return Uint8Array.from([2, header.value]);
|
|
784
|
+
case "short":
|
|
785
|
+
const shortView = new DataView(new ArrayBuffer(3));
|
|
786
|
+
shortView.setUint8(0, 3);
|
|
787
|
+
shortView.setInt16(1, header.value, false);
|
|
788
|
+
return new Uint8Array(shortView.buffer);
|
|
789
|
+
case "integer":
|
|
790
|
+
const intView = new DataView(new ArrayBuffer(5));
|
|
791
|
+
intView.setUint8(0, 4);
|
|
792
|
+
intView.setInt32(1, header.value, false);
|
|
793
|
+
return new Uint8Array(intView.buffer);
|
|
794
|
+
case "long":
|
|
795
|
+
const longBytes = new Uint8Array(9);
|
|
796
|
+
longBytes[0] = 5;
|
|
797
|
+
longBytes.set(header.value.bytes, 1);
|
|
798
|
+
return longBytes;
|
|
799
|
+
case "binary":
|
|
800
|
+
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
801
|
+
binView.setUint8(0, 6);
|
|
802
|
+
binView.setUint16(1, header.value.byteLength, false);
|
|
803
|
+
const binBytes = new Uint8Array(binView.buffer);
|
|
804
|
+
binBytes.set(header.value, 3);
|
|
805
|
+
return binBytes;
|
|
806
|
+
case "string":
|
|
807
|
+
const utf8Bytes = this.fromUtf8(header.value);
|
|
808
|
+
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
809
|
+
strView.setUint8(0, 7);
|
|
810
|
+
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
811
|
+
const strBytes = new Uint8Array(strView.buffer);
|
|
812
|
+
strBytes.set(utf8Bytes, 3);
|
|
813
|
+
return strBytes;
|
|
814
|
+
case "timestamp":
|
|
815
|
+
const tsBytes = new Uint8Array(9);
|
|
816
|
+
tsBytes[0] = 8;
|
|
817
|
+
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
|
818
|
+
return tsBytes;
|
|
819
|
+
case "uuid":
|
|
820
|
+
if (!UUID_PATTERN.test(header.value)) {
|
|
821
|
+
throw new Error(`Invalid UUID received: ${header.value}`);
|
|
822
|
+
}
|
|
823
|
+
const uuidBytes = new Uint8Array(17);
|
|
824
|
+
uuidBytes[0] = 9;
|
|
825
|
+
uuidBytes.set(require_serde.fromHex(header.value.replace(/-/g, "")), 1);
|
|
826
|
+
return uuidBytes;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
parse(headers) {
|
|
830
|
+
const out = {};
|
|
831
|
+
let position = 0;
|
|
832
|
+
while (position < headers.byteLength) {
|
|
833
|
+
const nameLength = headers.getUint8(position++);
|
|
834
|
+
const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
|
|
835
|
+
position += nameLength;
|
|
836
|
+
switch (headers.getUint8(position++)) {
|
|
837
|
+
case 0:
|
|
838
|
+
out[name] = {
|
|
839
|
+
type: BOOLEAN_TAG,
|
|
840
|
+
value: true
|
|
841
|
+
};
|
|
842
|
+
break;
|
|
843
|
+
case 1:
|
|
844
|
+
out[name] = {
|
|
845
|
+
type: BOOLEAN_TAG,
|
|
846
|
+
value: false
|
|
847
|
+
};
|
|
848
|
+
break;
|
|
849
|
+
case 2:
|
|
850
|
+
out[name] = {
|
|
851
|
+
type: BYTE_TAG,
|
|
852
|
+
value: headers.getInt8(position++)
|
|
853
|
+
};
|
|
854
|
+
break;
|
|
855
|
+
case 3:
|
|
856
|
+
out[name] = {
|
|
857
|
+
type: SHORT_TAG,
|
|
858
|
+
value: headers.getInt16(position, false)
|
|
859
|
+
};
|
|
860
|
+
position += 2;
|
|
861
|
+
break;
|
|
862
|
+
case 4:
|
|
863
|
+
out[name] = {
|
|
864
|
+
type: INT_TAG,
|
|
865
|
+
value: headers.getInt32(position, false)
|
|
866
|
+
};
|
|
867
|
+
position += 4;
|
|
868
|
+
break;
|
|
869
|
+
case 5:
|
|
870
|
+
out[name] = {
|
|
871
|
+
type: LONG_TAG,
|
|
872
|
+
value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8))
|
|
873
|
+
};
|
|
874
|
+
position += 8;
|
|
875
|
+
break;
|
|
876
|
+
case 6:
|
|
877
|
+
const binaryLength = headers.getUint16(position, false);
|
|
878
|
+
position += 2;
|
|
879
|
+
out[name] = {
|
|
880
|
+
type: BINARY_TAG,
|
|
881
|
+
value: new Uint8Array(headers.buffer, headers.byteOffset + position, binaryLength)
|
|
882
|
+
};
|
|
883
|
+
position += binaryLength;
|
|
884
|
+
break;
|
|
885
|
+
case 7:
|
|
886
|
+
const stringLength = headers.getUint16(position, false);
|
|
887
|
+
position += 2;
|
|
888
|
+
out[name] = {
|
|
889
|
+
type: STRING_TAG,
|
|
890
|
+
value: this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, stringLength))
|
|
891
|
+
};
|
|
892
|
+
position += stringLength;
|
|
893
|
+
break;
|
|
894
|
+
case 8:
|
|
895
|
+
out[name] = {
|
|
896
|
+
type: TIMESTAMP_TAG,
|
|
897
|
+
value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf())
|
|
898
|
+
};
|
|
899
|
+
position += 8;
|
|
900
|
+
break;
|
|
901
|
+
case 9:
|
|
902
|
+
const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
|
|
903
|
+
position += 16;
|
|
904
|
+
out[name] = {
|
|
905
|
+
type: UUID_TAG,
|
|
906
|
+
value: `${require_serde.toHex(uuidBytes.subarray(0, 4))}-${require_serde.toHex(uuidBytes.subarray(4, 6))}-${require_serde.toHex(uuidBytes.subarray(6, 8))}-${require_serde.toHex(uuidBytes.subarray(8, 10))}-${require_serde.toHex(uuidBytes.subarray(10))}`
|
|
907
|
+
};
|
|
908
|
+
break;
|
|
909
|
+
default: throw new Error(`Unrecognized header type tag`);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return out;
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
;
|
|
916
|
+
(function(HEADER_VALUE_TYPE) {
|
|
917
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolTrue"] = 0] = "boolTrue";
|
|
918
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolFalse"] = 1] = "boolFalse";
|
|
919
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byte"] = 2] = "byte";
|
|
920
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["short"] = 3] = "short";
|
|
921
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["integer"] = 4] = "integer";
|
|
922
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["long"] = 5] = "long";
|
|
923
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byteArray"] = 6] = "byteArray";
|
|
924
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["string"] = 7] = "string";
|
|
925
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["timestamp"] = 8] = "timestamp";
|
|
926
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["uuid"] = 9] = "uuid";
|
|
927
|
+
})(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
|
|
928
|
+
BOOLEAN_TAG = "boolean";
|
|
929
|
+
BYTE_TAG = "byte";
|
|
930
|
+
SHORT_TAG = "short";
|
|
931
|
+
INT_TAG = "integer";
|
|
932
|
+
LONG_TAG = "long";
|
|
933
|
+
BINARY_TAG = "binary";
|
|
934
|
+
STRING_TAG = "string";
|
|
935
|
+
TIMESTAMP_TAG = "timestamp";
|
|
936
|
+
UUID_TAG = "uuid";
|
|
937
|
+
UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
938
|
+
}));
|
|
939
|
+
|
|
940
|
+
//#endregion
|
|
941
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/splitMessage.js
|
|
942
|
+
function splitMessage({ byteLength, byteOffset, buffer }) {
|
|
943
|
+
if (byteLength < MINIMUM_MESSAGE_LENGTH) {
|
|
944
|
+
throw new Error("Provided message too short to accommodate event stream message overhead");
|
|
945
|
+
}
|
|
946
|
+
const view = new DataView(buffer, byteOffset, byteLength);
|
|
947
|
+
const messageLength = view.getUint32(0, false);
|
|
948
|
+
if (byteLength !== messageLength) {
|
|
949
|
+
throw new Error("Reported message length does not match received message length");
|
|
950
|
+
}
|
|
951
|
+
const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);
|
|
952
|
+
const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);
|
|
953
|
+
const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);
|
|
954
|
+
const checksummer = new Crc32Node();
|
|
955
|
+
checksummer.update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
|
|
956
|
+
if (expectedPreludeChecksum !== checksummer.digestSync()) {
|
|
957
|
+
throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digestSync()})`);
|
|
958
|
+
}
|
|
959
|
+
checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH)));
|
|
960
|
+
if (expectedMessageChecksum !== checksummer.digestSync()) {
|
|
961
|
+
throw new Error(`The message checksum (${checksummer.digestSync()}) did not match the expected value of ${expectedMessageChecksum}`);
|
|
962
|
+
}
|
|
963
|
+
return {
|
|
964
|
+
headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),
|
|
965
|
+
body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength, messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH))
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
var PRELUDE_MEMBER_LENGTH, PRELUDE_LENGTH, CHECKSUM_LENGTH, MINIMUM_MESSAGE_LENGTH;
|
|
969
|
+
var init_splitMessage = require_rolldown_runtime.__esmMin((() => {
|
|
970
|
+
init_checksum();
|
|
971
|
+
PRELUDE_MEMBER_LENGTH = 4;
|
|
972
|
+
PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
|
|
973
|
+
CHECKSUM_LENGTH = 4;
|
|
974
|
+
MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;
|
|
975
|
+
}));
|
|
976
|
+
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js
|
|
979
|
+
var EventStreamCodec;
|
|
980
|
+
var init_EventStreamCodec = require_rolldown_runtime.__esmMin((() => {
|
|
981
|
+
init_checksum();
|
|
982
|
+
init_HeaderMarshaller();
|
|
983
|
+
init_splitMessage();
|
|
984
|
+
EventStreamCodec = class {
|
|
985
|
+
headerMarshaller;
|
|
986
|
+
messageBuffer;
|
|
987
|
+
isEndOfStream;
|
|
988
|
+
constructor(toUtf8, fromUtf8) {
|
|
989
|
+
this.headerMarshaller = new HeaderMarshaller(toUtf8, fromUtf8);
|
|
990
|
+
this.messageBuffer = [];
|
|
991
|
+
this.isEndOfStream = false;
|
|
992
|
+
}
|
|
993
|
+
feed(message) {
|
|
994
|
+
this.messageBuffer.push(this.decode(message));
|
|
995
|
+
}
|
|
996
|
+
endOfStream() {
|
|
997
|
+
this.isEndOfStream = true;
|
|
998
|
+
}
|
|
999
|
+
getMessage() {
|
|
1000
|
+
const message = this.messageBuffer.pop();
|
|
1001
|
+
const isEndOfStream = this.isEndOfStream;
|
|
1002
|
+
return {
|
|
1003
|
+
getMessage() {
|
|
1004
|
+
return message;
|
|
1005
|
+
},
|
|
1006
|
+
isEndOfStream() {
|
|
1007
|
+
return isEndOfStream;
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
getAvailableMessages() {
|
|
1012
|
+
const messages = this.messageBuffer;
|
|
1013
|
+
this.messageBuffer = [];
|
|
1014
|
+
const isEndOfStream = this.isEndOfStream;
|
|
1015
|
+
return {
|
|
1016
|
+
getMessages() {
|
|
1017
|
+
return messages;
|
|
1018
|
+
},
|
|
1019
|
+
isEndOfStream() {
|
|
1020
|
+
return isEndOfStream;
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
encode({ headers: rawHeaders, body }) {
|
|
1025
|
+
const headers = this.headerMarshaller.format(rawHeaders);
|
|
1026
|
+
const length = headers.byteLength + body.byteLength + 16;
|
|
1027
|
+
const out = new Uint8Array(length);
|
|
1028
|
+
const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
|
1029
|
+
const checksum = new Crc32Node();
|
|
1030
|
+
view.setUint32(0, length, false);
|
|
1031
|
+
view.setUint32(4, headers.byteLength, false);
|
|
1032
|
+
checksum.update(out.subarray(0, 8));
|
|
1033
|
+
view.setUint32(8, checksum.digestSync(), false);
|
|
1034
|
+
out.set(headers, 12);
|
|
1035
|
+
out.set(body, headers.byteLength + 12);
|
|
1036
|
+
checksum.update(out.subarray(8, length - 4));
|
|
1037
|
+
view.setUint32(length - 4, checksum.digestSync(), false);
|
|
1038
|
+
return out;
|
|
1039
|
+
}
|
|
1040
|
+
decode(message) {
|
|
1041
|
+
const { headers, body } = splitMessage(message);
|
|
1042
|
+
return {
|
|
1043
|
+
headers: this.headerMarshaller.parse(headers),
|
|
1044
|
+
body
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
formatHeaders(rawHeaders) {
|
|
1048
|
+
return this.headerMarshaller.format(rawHeaders);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
}));
|
|
1052
|
+
|
|
1053
|
+
//#endregion
|
|
1054
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/MessageDecoderStream.js
|
|
1055
|
+
var MessageDecoderStream;
|
|
1056
|
+
var init_MessageDecoderStream = require_rolldown_runtime.__esmMin((() => {
|
|
1057
|
+
MessageDecoderStream = class {
|
|
1058
|
+
options;
|
|
1059
|
+
constructor(options) {
|
|
1060
|
+
this.options = options;
|
|
1061
|
+
}
|
|
1062
|
+
[Symbol.asyncIterator]() {
|
|
1063
|
+
return this.asyncIterator();
|
|
1064
|
+
}
|
|
1065
|
+
async *asyncIterator() {
|
|
1066
|
+
for await (const bytes of this.options.inputStream) {
|
|
1067
|
+
const decoded = this.options.decoder.decode(bytes);
|
|
1068
|
+
yield decoded;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
}));
|
|
1073
|
+
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/MessageEncoderStream.js
|
|
1076
|
+
var MessageEncoderStream;
|
|
1077
|
+
var init_MessageEncoderStream = require_rolldown_runtime.__esmMin((() => {
|
|
1078
|
+
MessageEncoderStream = class {
|
|
1079
|
+
options;
|
|
1080
|
+
constructor(options) {
|
|
1081
|
+
this.options = options;
|
|
1082
|
+
}
|
|
1083
|
+
[Symbol.asyncIterator]() {
|
|
1084
|
+
return this.asyncIterator();
|
|
1085
|
+
}
|
|
1086
|
+
async *asyncIterator() {
|
|
1087
|
+
for await (const msg of this.options.messageStream) {
|
|
1088
|
+
const encoded = this.options.encoder.encode(msg);
|
|
1089
|
+
yield encoded;
|
|
1090
|
+
}
|
|
1091
|
+
if (this.options.includeEndFrame) {
|
|
1092
|
+
yield new Uint8Array(0);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
}));
|
|
1097
|
+
|
|
1098
|
+
//#endregion
|
|
1099
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/SmithyMessageDecoderStream.js
|
|
1100
|
+
var SmithyMessageDecoderStream;
|
|
1101
|
+
var init_SmithyMessageDecoderStream = require_rolldown_runtime.__esmMin((() => {
|
|
1102
|
+
SmithyMessageDecoderStream = class {
|
|
1103
|
+
options;
|
|
1104
|
+
constructor(options) {
|
|
1105
|
+
this.options = options;
|
|
1106
|
+
}
|
|
1107
|
+
[Symbol.asyncIterator]() {
|
|
1108
|
+
return this.asyncIterator();
|
|
1109
|
+
}
|
|
1110
|
+
async *asyncIterator() {
|
|
1111
|
+
for await (const message of this.options.messageStream) {
|
|
1112
|
+
const deserialized = await this.options.deserializer(message);
|
|
1113
|
+
if (deserialized === undefined) continue;
|
|
1114
|
+
yield deserialized;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
}));
|
|
1119
|
+
|
|
1120
|
+
//#endregion
|
|
1121
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/SmithyMessageEncoderStream.js
|
|
1122
|
+
var SmithyMessageEncoderStream;
|
|
1123
|
+
var init_SmithyMessageEncoderStream = require_rolldown_runtime.__esmMin((() => {
|
|
1124
|
+
SmithyMessageEncoderStream = class {
|
|
1125
|
+
options;
|
|
1126
|
+
constructor(options) {
|
|
1127
|
+
this.options = options;
|
|
1128
|
+
}
|
|
1129
|
+
[Symbol.asyncIterator]() {
|
|
1130
|
+
return this.asyncIterator();
|
|
1131
|
+
}
|
|
1132
|
+
async *asyncIterator() {
|
|
1133
|
+
for await (const chunk of this.options.inputStream) {
|
|
1134
|
+
const payloadBuf = this.options.serializer(chunk);
|
|
1135
|
+
yield payloadBuf;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
}));
|
|
1140
|
+
|
|
1141
|
+
//#endregion
|
|
1142
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/getChunkedStream.js
|
|
1143
|
+
function getChunkedStream(source) {
|
|
1144
|
+
let currentMessageTotalLength = 0;
|
|
1145
|
+
let currentMessagePendingLength = 0;
|
|
1146
|
+
let currentMessage = null;
|
|
1147
|
+
let messageLengthBuffer = null;
|
|
1148
|
+
const allocateMessage = (size) => {
|
|
1149
|
+
if (typeof size !== "number") {
|
|
1150
|
+
throw new Error("Attempted to allocate an event message where size was not a number: " + size);
|
|
1151
|
+
}
|
|
1152
|
+
currentMessageTotalLength = size;
|
|
1153
|
+
currentMessagePendingLength = 4;
|
|
1154
|
+
currentMessage = new Uint8Array(size);
|
|
1155
|
+
const currentMessageView = new DataView(currentMessage.buffer);
|
|
1156
|
+
currentMessageView.setUint32(0, size, false);
|
|
1157
|
+
};
|
|
1158
|
+
const iterator = async function* () {
|
|
1159
|
+
const sourceIterator = source[Symbol.asyncIterator]();
|
|
1160
|
+
while (true) {
|
|
1161
|
+
const { value, done } = await sourceIterator.next();
|
|
1162
|
+
if (done) {
|
|
1163
|
+
if (!currentMessageTotalLength) {
|
|
1164
|
+
return;
|
|
1165
|
+
} else if (currentMessageTotalLength === currentMessagePendingLength) {
|
|
1166
|
+
yield currentMessage;
|
|
1167
|
+
} else {
|
|
1168
|
+
throw new Error("Truncated event message received.");
|
|
1169
|
+
}
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
const chunkLength = value.length;
|
|
1173
|
+
let currentOffset = 0;
|
|
1174
|
+
while (currentOffset < chunkLength) {
|
|
1175
|
+
if (!currentMessage) {
|
|
1176
|
+
const bytesRemaining = chunkLength - currentOffset;
|
|
1177
|
+
if (!messageLengthBuffer) {
|
|
1178
|
+
messageLengthBuffer = new Uint8Array(4);
|
|
1179
|
+
}
|
|
1180
|
+
const numBytesForTotal = Math.min(4 - currentMessagePendingLength, bytesRemaining);
|
|
1181
|
+
messageLengthBuffer.set(value.slice(currentOffset, currentOffset + numBytesForTotal), currentMessagePendingLength);
|
|
1182
|
+
currentMessagePendingLength += numBytesForTotal;
|
|
1183
|
+
currentOffset += numBytesForTotal;
|
|
1184
|
+
if (currentMessagePendingLength < 4) {
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
allocateMessage(new DataView(messageLengthBuffer.buffer).getUint32(0, false));
|
|
1188
|
+
messageLengthBuffer = null;
|
|
1189
|
+
}
|
|
1190
|
+
const numBytesToWrite = Math.min(currentMessageTotalLength - currentMessagePendingLength, chunkLength - currentOffset);
|
|
1191
|
+
currentMessage.set(value.slice(currentOffset, currentOffset + numBytesToWrite), currentMessagePendingLength);
|
|
1192
|
+
currentMessagePendingLength += numBytesToWrite;
|
|
1193
|
+
currentOffset += numBytesToWrite;
|
|
1194
|
+
if (currentMessageTotalLength && currentMessageTotalLength === currentMessagePendingLength) {
|
|
1195
|
+
yield currentMessage;
|
|
1196
|
+
currentMessage = null;
|
|
1197
|
+
currentMessageTotalLength = 0;
|
|
1198
|
+
currentMessagePendingLength = 0;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
return { [Symbol.asyncIterator]: iterator };
|
|
1204
|
+
}
|
|
1205
|
+
var init_getChunkedStream = require_rolldown_runtime.__esmMin((() => {}));
|
|
1206
|
+
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/getUnmarshalledStream.js
|
|
1209
|
+
function getUnmarshalledStream(source, options) {
|
|
1210
|
+
const messageUnmarshaller = getMessageUnmarshaller(options.deserializer, options.toUtf8);
|
|
1211
|
+
return { [Symbol.asyncIterator]: async function* () {
|
|
1212
|
+
for await (const chunk of source) {
|
|
1213
|
+
const message = options.eventStreamCodec.decode(chunk);
|
|
1214
|
+
const type = await messageUnmarshaller(message);
|
|
1215
|
+
if (type === undefined) continue;
|
|
1216
|
+
yield type;
|
|
1217
|
+
}
|
|
1218
|
+
} };
|
|
1219
|
+
}
|
|
1220
|
+
function getMessageUnmarshaller(deserializer, toUtf8) {
|
|
1221
|
+
return async function(message) {
|
|
1222
|
+
const { value: messageType } = message.headers[":message-type"];
|
|
1223
|
+
if (messageType === "error") {
|
|
1224
|
+
const unmodeledError = new Error(message.headers[":error-message"].value || "UnknownError");
|
|
1225
|
+
unmodeledError.name = message.headers[":error-code"].value;
|
|
1226
|
+
throw unmodeledError;
|
|
1227
|
+
} else if (messageType === "exception") {
|
|
1228
|
+
const code = message.headers[":exception-type"].value;
|
|
1229
|
+
const exception = { [code]: message };
|
|
1230
|
+
const deserializedException = await deserializer(exception);
|
|
1231
|
+
if (deserializedException.$unknown) {
|
|
1232
|
+
const error = new Error(toUtf8(message.body));
|
|
1233
|
+
error.name = code;
|
|
1234
|
+
throw error;
|
|
1235
|
+
}
|
|
1236
|
+
throw deserializedException[code];
|
|
1237
|
+
} else if (messageType === "event") {
|
|
1238
|
+
const event = { [message.headers[":event-type"].value]: message };
|
|
1239
|
+
const deserialized = await deserializer(event);
|
|
1240
|
+
if (deserialized.$unknown) return;
|
|
1241
|
+
return deserialized;
|
|
1242
|
+
} else {
|
|
1243
|
+
throw Error(`Unrecognizable event type: ${message.headers[":event-type"].value}`);
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
var init_getUnmarshalledStream = require_rolldown_runtime.__esmMin((() => {}));
|
|
1248
|
+
|
|
1249
|
+
//#endregion
|
|
1250
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/EventStreamMarshaller.js
|
|
1251
|
+
var EventStreamMarshaller$1, eventStreamSerdeProvider$1;
|
|
1252
|
+
var init_EventStreamMarshaller$1 = require_rolldown_runtime.__esmMin((() => {
|
|
1253
|
+
init_EventStreamCodec();
|
|
1254
|
+
init_MessageDecoderStream();
|
|
1255
|
+
init_MessageEncoderStream();
|
|
1256
|
+
init_SmithyMessageDecoderStream();
|
|
1257
|
+
init_SmithyMessageEncoderStream();
|
|
1258
|
+
init_getChunkedStream();
|
|
1259
|
+
init_getUnmarshalledStream();
|
|
1260
|
+
EventStreamMarshaller$1 = class {
|
|
1261
|
+
eventStreamCodec;
|
|
1262
|
+
utfEncoder;
|
|
1263
|
+
constructor({ utf8Encoder, utf8Decoder }) {
|
|
1264
|
+
this.eventStreamCodec = new EventStreamCodec(utf8Encoder, utf8Decoder);
|
|
1265
|
+
this.utfEncoder = utf8Encoder;
|
|
1266
|
+
}
|
|
1267
|
+
deserialize(body, deserializer) {
|
|
1268
|
+
const inputStream = getChunkedStream(body);
|
|
1269
|
+
return new SmithyMessageDecoderStream({
|
|
1270
|
+
messageStream: new MessageDecoderStream({
|
|
1271
|
+
inputStream,
|
|
1272
|
+
decoder: this.eventStreamCodec
|
|
1273
|
+
}),
|
|
1274
|
+
deserializer: getMessageUnmarshaller(deserializer, this.utfEncoder)
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
serialize(inputStream, serializer) {
|
|
1278
|
+
return new MessageEncoderStream({
|
|
1279
|
+
messageStream: new SmithyMessageEncoderStream({
|
|
1280
|
+
inputStream,
|
|
1281
|
+
serializer
|
|
1282
|
+
}),
|
|
1283
|
+
encoder: this.eventStreamCodec,
|
|
1284
|
+
includeEndFrame: true
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1288
|
+
eventStreamSerdeProvider$1 = (options) => new EventStreamMarshaller$1(options);
|
|
1289
|
+
}));
|
|
1290
|
+
|
|
1291
|
+
//#endregion
|
|
1292
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde/EventStreamMarshaller.js
|
|
1293
|
+
async function* readableToIterable(readStream) {
|
|
1294
|
+
let streamEnded = false;
|
|
1295
|
+
let generationEnded = false;
|
|
1296
|
+
const records = new Array();
|
|
1297
|
+
readStream.on("error", (err) => {
|
|
1298
|
+
if (!streamEnded) {
|
|
1299
|
+
streamEnded = true;
|
|
1300
|
+
}
|
|
1301
|
+
if (err) {
|
|
1302
|
+
throw err;
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
readStream.on("data", (data) => {
|
|
1306
|
+
records.push(data);
|
|
1307
|
+
});
|
|
1308
|
+
readStream.on("end", () => {
|
|
1309
|
+
streamEnded = true;
|
|
1310
|
+
});
|
|
1311
|
+
while (!generationEnded) {
|
|
1312
|
+
const value = await new Promise((resolve) => setTimeout(() => resolve(records.shift()), 0));
|
|
1313
|
+
if (value) {
|
|
1314
|
+
yield value;
|
|
1315
|
+
}
|
|
1316
|
+
generationEnded = streamEnded && records.length === 0;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
var EventStreamMarshaller, eventStreamSerdeProvider;
|
|
1320
|
+
var init_EventStreamMarshaller = require_rolldown_runtime.__esmMin((() => {
|
|
1321
|
+
init_EventStreamMarshaller$1();
|
|
1322
|
+
EventStreamMarshaller = class {
|
|
1323
|
+
universalMarshaller;
|
|
1324
|
+
constructor({ utf8Encoder, utf8Decoder }) {
|
|
1325
|
+
this.universalMarshaller = new EventStreamMarshaller$1({
|
|
1326
|
+
utf8Decoder,
|
|
1327
|
+
utf8Encoder
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
deserialize(body, deserializer) {
|
|
1331
|
+
const bodyIterable = typeof body[Symbol.asyncIterator] === "function" ? body : readableToIterable(body);
|
|
1332
|
+
return this.universalMarshaller.deserialize(bodyIterable, deserializer);
|
|
1333
|
+
}
|
|
1334
|
+
serialize(input, serializer) {
|
|
1335
|
+
return node_stream.Readable.from(this.universalMarshaller.serialize(input, serializer));
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
eventStreamSerdeProvider = (options) => new EventStreamMarshaller(options);
|
|
1339
|
+
}));
|
|
1340
|
+
|
|
1341
|
+
//#endregion
|
|
1342
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde/utils.js
|
|
1343
|
+
var readableStreamToIterable, iterableToReadableStream;
|
|
1344
|
+
var init_utils = require_rolldown_runtime.__esmMin((() => {
|
|
1345
|
+
readableStreamToIterable = (readableStream) => ({ [Symbol.asyncIterator]: async function* () {
|
|
1346
|
+
const reader = readableStream.getReader();
|
|
1347
|
+
try {
|
|
1348
|
+
while (true) {
|
|
1349
|
+
const { done, value } = await reader.read();
|
|
1350
|
+
if (done) return;
|
|
1351
|
+
yield value;
|
|
1352
|
+
}
|
|
1353
|
+
} finally {
|
|
1354
|
+
reader.releaseLock();
|
|
1355
|
+
}
|
|
1356
|
+
} });
|
|
1357
|
+
iterableToReadableStream = (asyncIterable) => {
|
|
1358
|
+
const iterator = asyncIterable[Symbol.asyncIterator]();
|
|
1359
|
+
return new ReadableStream({ async pull(controller) {
|
|
1360
|
+
const { done, value } = await iterator.next();
|
|
1361
|
+
if (done) {
|
|
1362
|
+
return controller.close();
|
|
1363
|
+
}
|
|
1364
|
+
controller.enqueue(value);
|
|
1365
|
+
} });
|
|
1366
|
+
};
|
|
1367
|
+
}));
|
|
1368
|
+
|
|
1369
|
+
//#endregion
|
|
1370
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-config-resolver/EventStreamSerdeConfig.js
|
|
1371
|
+
var resolveEventStreamSerdeConfig;
|
|
1372
|
+
var init_EventStreamSerdeConfig = require_rolldown_runtime.__esmMin((() => {
|
|
1373
|
+
resolveEventStreamSerdeConfig = (input) => Object.assign(input, { eventStreamMarshaller: input.eventStreamSerdeProvider(input) });
|
|
1374
|
+
}));
|
|
1375
|
+
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js
|
|
1378
|
+
var EventStreamSerde;
|
|
1379
|
+
var init_EventStreamSerde = require_rolldown_runtime.__esmMin((() => {
|
|
1380
|
+
require_serde.init_transport();
|
|
1381
|
+
require_serde.init_schema();
|
|
1382
|
+
require_serde.init_serde();
|
|
1383
|
+
EventStreamSerde = class {
|
|
1384
|
+
marshaller;
|
|
1385
|
+
serializer;
|
|
1386
|
+
deserializer;
|
|
1387
|
+
serdeContext;
|
|
1388
|
+
defaultContentType;
|
|
1389
|
+
compositeErrorRegistry;
|
|
1390
|
+
constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, compositeErrorRegistry }) {
|
|
1391
|
+
this.marshaller = marshaller;
|
|
1392
|
+
this.serializer = serializer;
|
|
1393
|
+
this.deserializer = deserializer;
|
|
1394
|
+
this.serdeContext = serdeContext;
|
|
1395
|
+
this.defaultContentType = defaultContentType;
|
|
1396
|
+
this.compositeErrorRegistry = compositeErrorRegistry;
|
|
1397
|
+
}
|
|
1398
|
+
async serializeEventStream({ eventStream, requestSchema, initialRequest, initialMessageType }) {
|
|
1399
|
+
const marshaller = this.marshaller;
|
|
1400
|
+
const eventStreamMember = requestSchema.getEventStreamMember();
|
|
1401
|
+
const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
|
|
1402
|
+
const serializer = this.serializer;
|
|
1403
|
+
const defaultContentType = this.defaultContentType;
|
|
1404
|
+
const initialRequestMarker = Symbol("initialRequestMarker");
|
|
1405
|
+
const eventStreamIterable = { async *[Symbol.asyncIterator]() {
|
|
1406
|
+
if (initialRequest) {
|
|
1407
|
+
const headers = {
|
|
1408
|
+
":event-type": {
|
|
1409
|
+
type: "string",
|
|
1410
|
+
value: initialMessageType ?? "initial-request"
|
|
1411
|
+
},
|
|
1412
|
+
":message-type": {
|
|
1413
|
+
type: "string",
|
|
1414
|
+
value: "event"
|
|
1415
|
+
},
|
|
1416
|
+
":content-type": {
|
|
1417
|
+
type: "string",
|
|
1418
|
+
value: defaultContentType
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
serializer.write(requestSchema, initialRequest);
|
|
1422
|
+
const body = serializer.flush();
|
|
1423
|
+
yield {
|
|
1424
|
+
[initialRequestMarker]: true,
|
|
1425
|
+
headers,
|
|
1426
|
+
body
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
for await (const page of eventStream) {
|
|
1430
|
+
yield page;
|
|
1431
|
+
}
|
|
1432
|
+
} };
|
|
1433
|
+
return marshaller.serialize(eventStreamIterable, (event) => {
|
|
1434
|
+
if (event[initialRequestMarker]) {
|
|
1435
|
+
return {
|
|
1436
|
+
headers: event.headers,
|
|
1437
|
+
body: event.body
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
let unionMember = "";
|
|
1441
|
+
for (const key in event) {
|
|
1442
|
+
if (!require_serde.hasOwn(event, key)) continue;
|
|
1443
|
+
if (key !== "__type") {
|
|
1444
|
+
unionMember = key;
|
|
1445
|
+
break;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);
|
|
1449
|
+
const headers = {
|
|
1450
|
+
":event-type": {
|
|
1451
|
+
type: "string",
|
|
1452
|
+
value: eventType
|
|
1453
|
+
},
|
|
1454
|
+
":message-type": {
|
|
1455
|
+
type: "string",
|
|
1456
|
+
value: "event"
|
|
1457
|
+
},
|
|
1458
|
+
":content-type": {
|
|
1459
|
+
type: "string",
|
|
1460
|
+
value: explicitPayloadContentType ?? defaultContentType
|
|
1461
|
+
},
|
|
1462
|
+
...additionalHeaders
|
|
1463
|
+
};
|
|
1464
|
+
return {
|
|
1465
|
+
headers,
|
|
1466
|
+
body
|
|
1467
|
+
};
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
async deserializeEventStream({ response, responseSchema, initialResponseContainer, initialMessageType }) {
|
|
1471
|
+
const marshaller = this.marshaller;
|
|
1472
|
+
const eventStreamMember = responseSchema.getEventStreamMember();
|
|
1473
|
+
const unionSchema = responseSchema.getMemberSchema(eventStreamMember);
|
|
1474
|
+
const memberSchemas = unionSchema.getMemberSchemas();
|
|
1475
|
+
const initialResponseMarker = Symbol("initialResponseMarker");
|
|
1476
|
+
const asyncIterable = marshaller.deserialize(response.body, async (event) => {
|
|
1477
|
+
let unionMember = "";
|
|
1478
|
+
for (const key in event) {
|
|
1479
|
+
if (!require_serde.hasOwn(event, key)) continue;
|
|
1480
|
+
if (key !== "__type") {
|
|
1481
|
+
unionMember = key;
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
const body = event[unionMember].body;
|
|
1486
|
+
if (unionMember === (initialMessageType ?? "initial-response")) {
|
|
1487
|
+
const dataObject = await this.deserializer.read(responseSchema, body);
|
|
1488
|
+
delete dataObject[eventStreamMember];
|
|
1489
|
+
return {
|
|
1490
|
+
[initialResponseMarker]: true,
|
|
1491
|
+
...dataObject
|
|
1492
|
+
};
|
|
1493
|
+
} else if (unionMember in memberSchemas) {
|
|
1494
|
+
const eventStreamSchema = memberSchemas[unionMember];
|
|
1495
|
+
if (eventStreamSchema.isStructSchema()) {
|
|
1496
|
+
const out = {};
|
|
1497
|
+
let hasBindings = false;
|
|
1498
|
+
for (const [name, member] of eventStreamSchema.structIterator()) {
|
|
1499
|
+
const { eventHeader, eventPayload } = member.getMergedTraits();
|
|
1500
|
+
hasBindings = hasBindings || Boolean(eventHeader || eventPayload);
|
|
1501
|
+
if (eventPayload) {
|
|
1502
|
+
if (member.isBlobSchema()) {
|
|
1503
|
+
out[name] = body;
|
|
1504
|
+
} else if (member.isStringSchema()) {
|
|
1505
|
+
out[name] = (this.serdeContext?.utf8Encoder ?? require_serde.toUtf8)(body);
|
|
1506
|
+
} else if (member.isStructSchema()) {
|
|
1507
|
+
out[name] = await this.deserializer.read(member, body);
|
|
1508
|
+
}
|
|
1509
|
+
} else if (eventHeader) {
|
|
1510
|
+
const value = event[unionMember].headers[name]?.value;
|
|
1511
|
+
if (value != null) {
|
|
1512
|
+
if (member.isNumericSchema()) {
|
|
1513
|
+
if (value && typeof value === "object" && "bytes" in value) {
|
|
1514
|
+
out[name] = BigInt(value.toString());
|
|
1515
|
+
} else {
|
|
1516
|
+
out[name] = Number(value);
|
|
1517
|
+
}
|
|
1518
|
+
} else {
|
|
1519
|
+
out[name] = value;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
return { [unionMember]: await this.readEventMember(eventStreamSchema, body, hasBindings, out) };
|
|
1525
|
+
}
|
|
1526
|
+
return { [unionMember]: await this.deserializer.read(eventStreamSchema, body) };
|
|
1527
|
+
} else {
|
|
1528
|
+
return { $unknown: event };
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
const asyncIterator = asyncIterable[Symbol.asyncIterator]();
|
|
1532
|
+
const firstEvent = await asyncIterator.next();
|
|
1533
|
+
if (firstEvent.done) {
|
|
1534
|
+
return asyncIterable;
|
|
1535
|
+
}
|
|
1536
|
+
if (firstEvent.value?.[initialResponseMarker]) {
|
|
1537
|
+
if (!responseSchema) {
|
|
1538
|
+
throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
|
|
1539
|
+
}
|
|
1540
|
+
for (const key in firstEvent.value) {
|
|
1541
|
+
if (!require_serde.hasOwn(firstEvent.value, key)) continue;
|
|
1542
|
+
initialResponseContainer[key] = firstEvent.value[key];
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
return { async *[Symbol.asyncIterator]() {
|
|
1546
|
+
if (!firstEvent?.value?.[initialResponseMarker]) {
|
|
1547
|
+
yield firstEvent.value;
|
|
1548
|
+
}
|
|
1549
|
+
while (true) {
|
|
1550
|
+
const { done, value } = await asyncIterator.next();
|
|
1551
|
+
if (done) {
|
|
1552
|
+
break;
|
|
1553
|
+
}
|
|
1554
|
+
yield value;
|
|
1555
|
+
}
|
|
1556
|
+
} };
|
|
1557
|
+
}
|
|
1558
|
+
async readEventMember(eventStreamSchema, body, hasBindings, out) {
|
|
1559
|
+
let ErrCtor;
|
|
1560
|
+
const staticStructuralSchema = eventStreamSchema.getSchema();
|
|
1561
|
+
if (Array.isArray(staticStructuralSchema) && staticStructuralSchema[0] === -3) {
|
|
1562
|
+
const namespace = staticStructuralSchema[1];
|
|
1563
|
+
const nsRegistry = require_serde.TypeRegistry.for(namespace);
|
|
1564
|
+
this.compositeErrorRegistry?.copyFrom(nsRegistry);
|
|
1565
|
+
ErrCtor = (this.compositeErrorRegistry ?? nsRegistry)?.getErrorCtor(staticStructuralSchema);
|
|
1566
|
+
}
|
|
1567
|
+
const dataObject = hasBindings ? out : body.byteLength === 0 ? {} : await this.deserializer.read(eventStreamSchema, body);
|
|
1568
|
+
if (ErrCtor) {
|
|
1569
|
+
const message = dataObject.message ?? dataObject.Message ?? "Unknown";
|
|
1570
|
+
const metadata = {};
|
|
1571
|
+
const $fault = eventStreamSchema.getMergedTraits().error;
|
|
1572
|
+
if ($fault) {
|
|
1573
|
+
metadata.$fault = $fault;
|
|
1574
|
+
}
|
|
1575
|
+
return Object.assign(new ErrCtor({}), metadata, { message }, dataObject);
|
|
1576
|
+
}
|
|
1577
|
+
return dataObject;
|
|
1578
|
+
}
|
|
1579
|
+
writeEventBody(unionMember, unionSchema, event) {
|
|
1580
|
+
const serializer = this.serializer;
|
|
1581
|
+
let eventType = unionMember;
|
|
1582
|
+
let explicitPayloadMember = null;
|
|
1583
|
+
let explicitPayloadContentType;
|
|
1584
|
+
const isKnownSchema = (() => {
|
|
1585
|
+
const struct = unionSchema.getSchema();
|
|
1586
|
+
return struct[4].includes(unionMember);
|
|
1587
|
+
})();
|
|
1588
|
+
const additionalHeaders = {};
|
|
1589
|
+
if (!isKnownSchema) {
|
|
1590
|
+
const [type, value] = event[unionMember];
|
|
1591
|
+
eventType = type;
|
|
1592
|
+
serializer.write(15, value);
|
|
1593
|
+
} else {
|
|
1594
|
+
const eventSchema = unionSchema.getMemberSchema(unionMember);
|
|
1595
|
+
if (eventSchema.isStructSchema()) {
|
|
1596
|
+
for (const [memberName, memberSchema] of eventSchema.structIterator()) {
|
|
1597
|
+
const { eventHeader, eventPayload } = memberSchema.getMergedTraits();
|
|
1598
|
+
if (eventPayload) {
|
|
1599
|
+
explicitPayloadMember = memberName;
|
|
1600
|
+
} else if (eventHeader) {
|
|
1601
|
+
const value = event[unionMember][memberName];
|
|
1602
|
+
let type = "binary";
|
|
1603
|
+
if (memberSchema.isNumericSchema()) {
|
|
1604
|
+
if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) {
|
|
1605
|
+
type = "integer";
|
|
1606
|
+
} else {
|
|
1607
|
+
type = "long";
|
|
1608
|
+
}
|
|
1609
|
+
} else if (memberSchema.isTimestampSchema()) {
|
|
1610
|
+
type = "timestamp";
|
|
1611
|
+
} else if (memberSchema.isStringSchema()) {
|
|
1612
|
+
type = "string";
|
|
1613
|
+
} else if (memberSchema.isBooleanSchema()) {
|
|
1614
|
+
type = "boolean";
|
|
1615
|
+
}
|
|
1616
|
+
if (value != null) {
|
|
1617
|
+
additionalHeaders[memberName] = {
|
|
1618
|
+
type,
|
|
1619
|
+
value
|
|
1620
|
+
};
|
|
1621
|
+
delete event[unionMember][memberName];
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (explicitPayloadMember !== null) {
|
|
1626
|
+
const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);
|
|
1627
|
+
if (payloadSchema.isBlobSchema()) {
|
|
1628
|
+
explicitPayloadContentType = "application/octet-stream";
|
|
1629
|
+
} else if (payloadSchema.isStringSchema()) {
|
|
1630
|
+
explicitPayloadContentType = "text/plain";
|
|
1631
|
+
}
|
|
1632
|
+
serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);
|
|
1633
|
+
} else {
|
|
1634
|
+
serializer.write(eventSchema, event[unionMember]);
|
|
1635
|
+
}
|
|
1636
|
+
} else if (eventSchema.isUnitSchema()) {
|
|
1637
|
+
serializer.write(eventSchema, {});
|
|
1638
|
+
} else {
|
|
1639
|
+
throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
const messageSerialization = serializer.flush() ?? new Uint8Array();
|
|
1643
|
+
const body = typeof messageSerialization === "string" ? (this.serdeContext?.utf8Decoder ?? require_serde.fromUtf8)(messageSerialization) : messageSerialization;
|
|
1644
|
+
return {
|
|
1645
|
+
body,
|
|
1646
|
+
eventType,
|
|
1647
|
+
explicitPayloadContentType,
|
|
1648
|
+
additionalHeaders
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
}));
|
|
1653
|
+
|
|
1654
|
+
//#endregion
|
|
1655
|
+
//#region ../../node_modules/.pnpm/@smithy+core@3.33.3/node_modules/@smithy/core/dist-es/submodules/event-streams/index.js
|
|
1656
|
+
var init_event_streams = require_rolldown_runtime.__esmMin((() => {
|
|
1657
|
+
init_EventStreamCodec();
|
|
1658
|
+
init_HeaderMarshaller();
|
|
1659
|
+
init_Int64();
|
|
1660
|
+
init_MessageDecoderStream();
|
|
1661
|
+
init_MessageEncoderStream();
|
|
1662
|
+
init_SmithyMessageDecoderStream();
|
|
1663
|
+
init_SmithyMessageEncoderStream();
|
|
1664
|
+
init_EventStreamMarshaller();
|
|
1665
|
+
init_utils();
|
|
1666
|
+
init_EventStreamMarshaller$1();
|
|
1667
|
+
init_getChunkedStream();
|
|
1668
|
+
init_getUnmarshalledStream();
|
|
1669
|
+
init_EventStreamSerdeConfig();
|
|
1670
|
+
init_EventStreamSerde();
|
|
1671
|
+
}));
|
|
1672
|
+
|
|
1673
|
+
//#endregion
|
|
1674
|
+
init_event_streams();
|
|
1675
|
+
exports.EventStreamSerde = EventStreamSerde;
|
|
1676
|
+
exports.eventStreamSerdeProvider = eventStreamSerdeProvider;
|