cdk-cost-analyzer 0.1.49 → 0.1.51
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/.cdk-cost-analyzer-cache/metadata.json +8 -8
- package/dist/action/136.index.js +25 -26
- package/dist/action/566.index.js +41 -43
- package/dist/action/579.index.js +1059 -4
- package/dist/action/605.index.js +21 -0
- package/dist/action/762.index.js +1 -1
- package/dist/action/998.index.js +1 -1
- package/dist/action/index.js +3 -3
- package/dist/releasetag.txt +1 -1
- package/package.json +4 -4
package/dist/action/579.index.js
CHANGED
|
@@ -1,14 +1,964 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
exports.id = 579;
|
|
3
2
|
exports.ids = [579];
|
|
4
3
|
exports.modules = {
|
|
5
4
|
|
|
5
|
+
/***/ 6863:
|
|
6
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|
11
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
12
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13
|
+
exports.AwsCrc32 = void 0;
|
|
14
|
+
var tslib_1 = __webpack_require__(1860);
|
|
15
|
+
var util_1 = __webpack_require__(5667);
|
|
16
|
+
var index_1 = __webpack_require__(2110);
|
|
17
|
+
var AwsCrc32 = /** @class */ (function () {
|
|
18
|
+
function AwsCrc32() {
|
|
19
|
+
this.crc32 = new index_1.Crc32();
|
|
20
|
+
}
|
|
21
|
+
AwsCrc32.prototype.update = function (toHash) {
|
|
22
|
+
if ((0, util_1.isEmptyData)(toHash))
|
|
23
|
+
return;
|
|
24
|
+
this.crc32.update((0, util_1.convertToBuffer)(toHash));
|
|
25
|
+
};
|
|
26
|
+
AwsCrc32.prototype.digest = function () {
|
|
27
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
28
|
+
return tslib_1.__generator(this, function (_a) {
|
|
29
|
+
return [2 /*return*/, (0, util_1.numToUint8)(this.crc32.digest())];
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
AwsCrc32.prototype.reset = function () {
|
|
34
|
+
this.crc32 = new index_1.Crc32();
|
|
35
|
+
};
|
|
36
|
+
return AwsCrc32;
|
|
37
|
+
}());
|
|
38
|
+
exports.AwsCrc32 = AwsCrc32;
|
|
39
|
+
//# sourceMappingURL=aws_crc32.js.map
|
|
40
|
+
|
|
41
|
+
/***/ }),
|
|
42
|
+
|
|
43
|
+
/***/ 2110:
|
|
44
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
45
|
+
|
|
46
|
+
"use strict";
|
|
47
|
+
|
|
48
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49
|
+
exports.AwsCrc32 = exports.Crc32 = exports.crc32 = void 0;
|
|
50
|
+
var tslib_1 = __webpack_require__(1860);
|
|
51
|
+
var util_1 = __webpack_require__(5667);
|
|
52
|
+
function crc32(data) {
|
|
53
|
+
return new Crc32().update(data).digest();
|
|
54
|
+
}
|
|
55
|
+
exports.crc32 = crc32;
|
|
56
|
+
var Crc32 = /** @class */ (function () {
|
|
57
|
+
function Crc32() {
|
|
58
|
+
this.checksum = 0xffffffff;
|
|
59
|
+
}
|
|
60
|
+
Crc32.prototype.update = function (data) {
|
|
61
|
+
var e_1, _a;
|
|
62
|
+
try {
|
|
63
|
+
for (var data_1 = tslib_1.__values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
|
|
64
|
+
var byte = data_1_1.value;
|
|
65
|
+
this.checksum =
|
|
66
|
+
(this.checksum >>> 8) ^ lookupTable[(this.checksum ^ byte) & 0xff];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
70
|
+
finally {
|
|
71
|
+
try {
|
|
72
|
+
if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
|
|
73
|
+
}
|
|
74
|
+
finally { if (e_1) throw e_1.error; }
|
|
75
|
+
}
|
|
76
|
+
return this;
|
|
77
|
+
};
|
|
78
|
+
Crc32.prototype.digest = function () {
|
|
79
|
+
return (this.checksum ^ 0xffffffff) >>> 0;
|
|
80
|
+
};
|
|
81
|
+
return Crc32;
|
|
82
|
+
}());
|
|
83
|
+
exports.Crc32 = Crc32;
|
|
84
|
+
// prettier-ignore
|
|
85
|
+
var a_lookUpTable = [
|
|
86
|
+
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
|
|
87
|
+
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
|
88
|
+
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
|
|
89
|
+
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
|
|
90
|
+
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
|
|
91
|
+
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
|
92
|
+
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
|
|
93
|
+
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
|
|
94
|
+
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
|
95
|
+
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
|
|
96
|
+
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
|
|
97
|
+
0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
|
98
|
+
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
|
|
99
|
+
0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
|
|
100
|
+
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
|
|
101
|
+
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
|
|
102
|
+
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
|
|
103
|
+
0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
|
104
|
+
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
|
|
105
|
+
0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
|
|
106
|
+
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
|
|
107
|
+
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
|
|
108
|
+
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
|
|
109
|
+
0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
|
110
|
+
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
|
|
111
|
+
0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
|
|
112
|
+
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
|
113
|
+
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
|
|
114
|
+
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
|
|
115
|
+
0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
|
116
|
+
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
|
|
117
|
+
0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
|
|
118
|
+
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
|
|
119
|
+
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
|
|
120
|
+
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
|
|
121
|
+
0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
|
122
|
+
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
|
|
123
|
+
0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
|
|
124
|
+
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
|
|
125
|
+
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
|
|
126
|
+
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
|
|
127
|
+
0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
|
128
|
+
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
|
|
129
|
+
0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
|
|
130
|
+
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
|
131
|
+
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
|
|
132
|
+
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
|
|
133
|
+
0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
|
134
|
+
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
|
|
135
|
+
0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
|
|
136
|
+
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
|
|
137
|
+
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
|
|
138
|
+
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
|
|
139
|
+
0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
|
140
|
+
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
|
|
141
|
+
0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
|
|
142
|
+
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
|
|
143
|
+
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
|
|
144
|
+
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
|
|
145
|
+
0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
|
146
|
+
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
|
|
147
|
+
0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
|
|
148
|
+
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
|
149
|
+
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
|
|
150
|
+
];
|
|
151
|
+
var lookupTable = (0, util_1.uint32ArrayFrom)(a_lookUpTable);
|
|
152
|
+
var aws_crc32_1 = __webpack_require__(6863);
|
|
153
|
+
Object.defineProperty(exports, "AwsCrc32", ({ enumerable: true, get: function () { return aws_crc32_1.AwsCrc32; } }));
|
|
154
|
+
//# sourceMappingURL=index.js.map
|
|
155
|
+
|
|
156
|
+
/***/ }),
|
|
157
|
+
|
|
158
|
+
/***/ 8056:
|
|
159
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
160
|
+
|
|
161
|
+
"use strict";
|
|
162
|
+
|
|
163
|
+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|
164
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
165
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
166
|
+
exports.convertToBuffer = void 0;
|
|
167
|
+
var util_utf8_1 = __webpack_require__(7515);
|
|
168
|
+
// Quick polyfill
|
|
169
|
+
var fromUtf8 = typeof Buffer !== "undefined" && Buffer.from
|
|
170
|
+
? function (input) { return Buffer.from(input, "utf8"); }
|
|
171
|
+
: util_utf8_1.fromUtf8;
|
|
172
|
+
function convertToBuffer(data) {
|
|
173
|
+
// Already a Uint8, do nothing
|
|
174
|
+
if (data instanceof Uint8Array)
|
|
175
|
+
return data;
|
|
176
|
+
if (typeof data === "string") {
|
|
177
|
+
return fromUtf8(data);
|
|
178
|
+
}
|
|
179
|
+
if (ArrayBuffer.isView(data)) {
|
|
180
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
|
|
181
|
+
}
|
|
182
|
+
return new Uint8Array(data);
|
|
183
|
+
}
|
|
184
|
+
exports.convertToBuffer = convertToBuffer;
|
|
185
|
+
//# sourceMappingURL=convertToBuffer.js.map
|
|
186
|
+
|
|
187
|
+
/***/ }),
|
|
188
|
+
|
|
189
|
+
/***/ 5667:
|
|
190
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
191
|
+
|
|
192
|
+
"use strict";
|
|
193
|
+
|
|
194
|
+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|
195
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
196
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
197
|
+
exports.uint32ArrayFrom = exports.numToUint8 = exports.isEmptyData = exports.convertToBuffer = void 0;
|
|
198
|
+
var convertToBuffer_1 = __webpack_require__(8056);
|
|
199
|
+
Object.defineProperty(exports, "convertToBuffer", ({ enumerable: true, get: function () { return convertToBuffer_1.convertToBuffer; } }));
|
|
200
|
+
var isEmptyData_1 = __webpack_require__(4658);
|
|
201
|
+
Object.defineProperty(exports, "isEmptyData", ({ enumerable: true, get: function () { return isEmptyData_1.isEmptyData; } }));
|
|
202
|
+
var numToUint8_1 = __webpack_require__(5436);
|
|
203
|
+
Object.defineProperty(exports, "numToUint8", ({ enumerable: true, get: function () { return numToUint8_1.numToUint8; } }));
|
|
204
|
+
var uint32ArrayFrom_1 = __webpack_require__(673);
|
|
205
|
+
Object.defineProperty(exports, "uint32ArrayFrom", ({ enumerable: true, get: function () { return uint32ArrayFrom_1.uint32ArrayFrom; } }));
|
|
206
|
+
//# sourceMappingURL=index.js.map
|
|
207
|
+
|
|
208
|
+
/***/ }),
|
|
209
|
+
|
|
210
|
+
/***/ 4658:
|
|
211
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
212
|
+
|
|
213
|
+
"use strict";
|
|
214
|
+
|
|
215
|
+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|
216
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
217
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
218
|
+
exports.isEmptyData = void 0;
|
|
219
|
+
function isEmptyData(data) {
|
|
220
|
+
if (typeof data === "string") {
|
|
221
|
+
return data.length === 0;
|
|
222
|
+
}
|
|
223
|
+
return data.byteLength === 0;
|
|
224
|
+
}
|
|
225
|
+
exports.isEmptyData = isEmptyData;
|
|
226
|
+
//# sourceMappingURL=isEmptyData.js.map
|
|
227
|
+
|
|
228
|
+
/***/ }),
|
|
229
|
+
|
|
230
|
+
/***/ 5436:
|
|
231
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
232
|
+
|
|
233
|
+
"use strict";
|
|
234
|
+
|
|
235
|
+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|
236
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
237
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
238
|
+
exports.numToUint8 = void 0;
|
|
239
|
+
function numToUint8(num) {
|
|
240
|
+
return new Uint8Array([
|
|
241
|
+
(num & 0xff000000) >> 24,
|
|
242
|
+
(num & 0x00ff0000) >> 16,
|
|
243
|
+
(num & 0x0000ff00) >> 8,
|
|
244
|
+
num & 0x000000ff,
|
|
245
|
+
]);
|
|
246
|
+
}
|
|
247
|
+
exports.numToUint8 = numToUint8;
|
|
248
|
+
//# sourceMappingURL=numToUint8.js.map
|
|
249
|
+
|
|
250
|
+
/***/ }),
|
|
251
|
+
|
|
252
|
+
/***/ 673:
|
|
253
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
254
|
+
|
|
255
|
+
"use strict";
|
|
256
|
+
|
|
257
|
+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|
258
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
259
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
260
|
+
exports.uint32ArrayFrom = void 0;
|
|
261
|
+
// IE 11 does not support Array.from, so we do it manually
|
|
262
|
+
function uint32ArrayFrom(a_lookUpTable) {
|
|
263
|
+
if (!Uint32Array.from) {
|
|
264
|
+
var return_array = new Uint32Array(a_lookUpTable.length);
|
|
265
|
+
var a_index = 0;
|
|
266
|
+
while (a_index < a_lookUpTable.length) {
|
|
267
|
+
return_array[a_index] = a_lookUpTable[a_index];
|
|
268
|
+
a_index += 1;
|
|
269
|
+
}
|
|
270
|
+
return return_array;
|
|
271
|
+
}
|
|
272
|
+
return Uint32Array.from(a_lookUpTable);
|
|
273
|
+
}
|
|
274
|
+
exports.uint32ArrayFrom = uint32ArrayFrom;
|
|
275
|
+
//# sourceMappingURL=uint32ArrayFrom.js.map
|
|
276
|
+
|
|
277
|
+
/***/ }),
|
|
278
|
+
|
|
279
|
+
/***/ 7515:
|
|
280
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
281
|
+
|
|
282
|
+
var __defProp = Object.defineProperty;
|
|
283
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
284
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
285
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
286
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
287
|
+
var __export = (target, all) => {
|
|
288
|
+
for (var name in all)
|
|
289
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
290
|
+
};
|
|
291
|
+
var __copyProps = (to, from, except, desc) => {
|
|
292
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
293
|
+
for (let key of __getOwnPropNames(from))
|
|
294
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
295
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
296
|
+
}
|
|
297
|
+
return to;
|
|
298
|
+
};
|
|
299
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
300
|
+
|
|
301
|
+
// src/index.ts
|
|
302
|
+
var src_exports = {};
|
|
303
|
+
__export(src_exports, {
|
|
304
|
+
fromUtf8: () => fromUtf8,
|
|
305
|
+
toUint8Array: () => toUint8Array,
|
|
306
|
+
toUtf8: () => toUtf8
|
|
307
|
+
});
|
|
308
|
+
module.exports = __toCommonJS(src_exports);
|
|
309
|
+
|
|
310
|
+
// src/fromUtf8.ts
|
|
311
|
+
var import_util_buffer_from = __webpack_require__(4151);
|
|
312
|
+
var fromUtf8 = /* @__PURE__ */ __name((input) => {
|
|
313
|
+
const buf = (0, import_util_buffer_from.fromString)(input, "utf8");
|
|
314
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
|
|
315
|
+
}, "fromUtf8");
|
|
316
|
+
|
|
317
|
+
// src/toUint8Array.ts
|
|
318
|
+
var toUint8Array = /* @__PURE__ */ __name((data) => {
|
|
319
|
+
if (typeof data === "string") {
|
|
320
|
+
return fromUtf8(data);
|
|
321
|
+
}
|
|
322
|
+
if (ArrayBuffer.isView(data)) {
|
|
323
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
|
|
324
|
+
}
|
|
325
|
+
return new Uint8Array(data);
|
|
326
|
+
}, "toUint8Array");
|
|
327
|
+
|
|
328
|
+
// src/toUtf8.ts
|
|
329
|
+
|
|
330
|
+
var toUtf8 = /* @__PURE__ */ __name((input) => {
|
|
331
|
+
if (typeof input === "string") {
|
|
332
|
+
return input;
|
|
333
|
+
}
|
|
334
|
+
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
|
|
335
|
+
throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
|
|
336
|
+
}
|
|
337
|
+
return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
|
|
338
|
+
}, "toUtf8");
|
|
339
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
340
|
+
|
|
341
|
+
0 && (0);
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
/***/ }),
|
|
346
|
+
|
|
6
347
|
/***/ 6579:
|
|
7
348
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8
349
|
|
|
350
|
+
"use strict";
|
|
351
|
+
var __webpack_unused_export__;
|
|
9
352
|
|
|
10
353
|
|
|
11
|
-
var
|
|
354
|
+
var crc32 = __webpack_require__(2110);
|
|
355
|
+
var serde = __webpack_require__(2430);
|
|
356
|
+
var node_stream = __webpack_require__(7075);
|
|
357
|
+
|
|
358
|
+
class Int64 {
|
|
359
|
+
bytes;
|
|
360
|
+
constructor(bytes) {
|
|
361
|
+
this.bytes = bytes;
|
|
362
|
+
if (bytes.byteLength !== 8) {
|
|
363
|
+
throw new Error("Int64 buffers must be exactly 8 bytes");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
static fromNumber(number) {
|
|
367
|
+
if (number > 9_223_372_036_854_775_807 || number < -9223372036854776e3) {
|
|
368
|
+
throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
|
|
369
|
+
}
|
|
370
|
+
const bytes = new Uint8Array(8);
|
|
371
|
+
for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
|
|
372
|
+
bytes[i] = remaining;
|
|
373
|
+
}
|
|
374
|
+
if (number < 0) {
|
|
375
|
+
negate(bytes);
|
|
376
|
+
}
|
|
377
|
+
return new Int64(bytes);
|
|
378
|
+
}
|
|
379
|
+
valueOf() {
|
|
380
|
+
const bytes = this.bytes.slice(0);
|
|
381
|
+
const negative = bytes[0] & 0b10000000;
|
|
382
|
+
if (negative) {
|
|
383
|
+
negate(bytes);
|
|
384
|
+
}
|
|
385
|
+
return parseInt(serde.toHex(bytes), 16) * (negative ? -1 : 1);
|
|
386
|
+
}
|
|
387
|
+
toString() {
|
|
388
|
+
return String(this.valueOf());
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function negate(bytes) {
|
|
392
|
+
for (let i = 0; i < 8; i++) {
|
|
393
|
+
bytes[i] ^= 0xff;
|
|
394
|
+
}
|
|
395
|
+
for (let i = 7; i > -1; i--) {
|
|
396
|
+
bytes[i]++;
|
|
397
|
+
if (bytes[i] !== 0)
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
class HeaderMarshaller {
|
|
403
|
+
toUtf8;
|
|
404
|
+
fromUtf8;
|
|
405
|
+
constructor(toUtf8, fromUtf8) {
|
|
406
|
+
this.toUtf8 = toUtf8;
|
|
407
|
+
this.fromUtf8 = fromUtf8;
|
|
408
|
+
}
|
|
409
|
+
format(headers) {
|
|
410
|
+
const chunks = [];
|
|
411
|
+
for (const headerName of Object.keys(headers)) {
|
|
412
|
+
const bytes = this.fromUtf8(headerName);
|
|
413
|
+
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
|
414
|
+
}
|
|
415
|
+
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
|
416
|
+
let position = 0;
|
|
417
|
+
for (const chunk of chunks) {
|
|
418
|
+
out.set(chunk, position);
|
|
419
|
+
position += chunk.byteLength;
|
|
420
|
+
}
|
|
421
|
+
return out;
|
|
422
|
+
}
|
|
423
|
+
formatHeaderValue(header) {
|
|
424
|
+
switch (header.type) {
|
|
425
|
+
case "boolean":
|
|
426
|
+
return Uint8Array.from([header.value ? 0 : 1]);
|
|
427
|
+
case "byte":
|
|
428
|
+
return Uint8Array.from([2, header.value]);
|
|
429
|
+
case "short":
|
|
430
|
+
const shortView = new DataView(new ArrayBuffer(3));
|
|
431
|
+
shortView.setUint8(0, 3);
|
|
432
|
+
shortView.setInt16(1, header.value, false);
|
|
433
|
+
return new Uint8Array(shortView.buffer);
|
|
434
|
+
case "integer":
|
|
435
|
+
const intView = new DataView(new ArrayBuffer(5));
|
|
436
|
+
intView.setUint8(0, 4);
|
|
437
|
+
intView.setInt32(1, header.value, false);
|
|
438
|
+
return new Uint8Array(intView.buffer);
|
|
439
|
+
case "long":
|
|
440
|
+
const longBytes = new Uint8Array(9);
|
|
441
|
+
longBytes[0] = 5;
|
|
442
|
+
longBytes.set(header.value.bytes, 1);
|
|
443
|
+
return longBytes;
|
|
444
|
+
case "binary":
|
|
445
|
+
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
446
|
+
binView.setUint8(0, 6);
|
|
447
|
+
binView.setUint16(1, header.value.byteLength, false);
|
|
448
|
+
const binBytes = new Uint8Array(binView.buffer);
|
|
449
|
+
binBytes.set(header.value, 3);
|
|
450
|
+
return binBytes;
|
|
451
|
+
case "string":
|
|
452
|
+
const utf8Bytes = this.fromUtf8(header.value);
|
|
453
|
+
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
454
|
+
strView.setUint8(0, 7);
|
|
455
|
+
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
456
|
+
const strBytes = new Uint8Array(strView.buffer);
|
|
457
|
+
strBytes.set(utf8Bytes, 3);
|
|
458
|
+
return strBytes;
|
|
459
|
+
case "timestamp":
|
|
460
|
+
const tsBytes = new Uint8Array(9);
|
|
461
|
+
tsBytes[0] = 8;
|
|
462
|
+
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
|
463
|
+
return tsBytes;
|
|
464
|
+
case "uuid":
|
|
465
|
+
if (!UUID_PATTERN.test(header.value)) {
|
|
466
|
+
throw new Error(`Invalid UUID received: ${header.value}`);
|
|
467
|
+
}
|
|
468
|
+
const uuidBytes = new Uint8Array(17);
|
|
469
|
+
uuidBytes[0] = 9;
|
|
470
|
+
uuidBytes.set(serde.fromHex(header.value.replace(/\-/g, "")), 1);
|
|
471
|
+
return uuidBytes;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
parse(headers) {
|
|
475
|
+
const out = {};
|
|
476
|
+
let position = 0;
|
|
477
|
+
while (position < headers.byteLength) {
|
|
478
|
+
const nameLength = headers.getUint8(position++);
|
|
479
|
+
const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
|
|
480
|
+
position += nameLength;
|
|
481
|
+
switch (headers.getUint8(position++)) {
|
|
482
|
+
case 0:
|
|
483
|
+
out[name] = {
|
|
484
|
+
type: BOOLEAN_TAG,
|
|
485
|
+
value: true,
|
|
486
|
+
};
|
|
487
|
+
break;
|
|
488
|
+
case 1:
|
|
489
|
+
out[name] = {
|
|
490
|
+
type: BOOLEAN_TAG,
|
|
491
|
+
value: false,
|
|
492
|
+
};
|
|
493
|
+
break;
|
|
494
|
+
case 2:
|
|
495
|
+
out[name] = {
|
|
496
|
+
type: BYTE_TAG,
|
|
497
|
+
value: headers.getInt8(position++),
|
|
498
|
+
};
|
|
499
|
+
break;
|
|
500
|
+
case 3:
|
|
501
|
+
out[name] = {
|
|
502
|
+
type: SHORT_TAG,
|
|
503
|
+
value: headers.getInt16(position, false),
|
|
504
|
+
};
|
|
505
|
+
position += 2;
|
|
506
|
+
break;
|
|
507
|
+
case 4:
|
|
508
|
+
out[name] = {
|
|
509
|
+
type: INT_TAG,
|
|
510
|
+
value: headers.getInt32(position, false),
|
|
511
|
+
};
|
|
512
|
+
position += 4;
|
|
513
|
+
break;
|
|
514
|
+
case 5:
|
|
515
|
+
out[name] = {
|
|
516
|
+
type: LONG_TAG,
|
|
517
|
+
value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)),
|
|
518
|
+
};
|
|
519
|
+
position += 8;
|
|
520
|
+
break;
|
|
521
|
+
case 6:
|
|
522
|
+
const binaryLength = headers.getUint16(position, false);
|
|
523
|
+
position += 2;
|
|
524
|
+
out[name] = {
|
|
525
|
+
type: BINARY_TAG,
|
|
526
|
+
value: new Uint8Array(headers.buffer, headers.byteOffset + position, binaryLength),
|
|
527
|
+
};
|
|
528
|
+
position += binaryLength;
|
|
529
|
+
break;
|
|
530
|
+
case 7:
|
|
531
|
+
const stringLength = headers.getUint16(position, false);
|
|
532
|
+
position += 2;
|
|
533
|
+
out[name] = {
|
|
534
|
+
type: STRING_TAG,
|
|
535
|
+
value: this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, stringLength)),
|
|
536
|
+
};
|
|
537
|
+
position += stringLength;
|
|
538
|
+
break;
|
|
539
|
+
case 8:
|
|
540
|
+
out[name] = {
|
|
541
|
+
type: TIMESTAMP_TAG,
|
|
542
|
+
value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf()),
|
|
543
|
+
};
|
|
544
|
+
position += 8;
|
|
545
|
+
break;
|
|
546
|
+
case 9:
|
|
547
|
+
const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
|
|
548
|
+
position += 16;
|
|
549
|
+
out[name] = {
|
|
550
|
+
type: UUID_TAG,
|
|
551
|
+
value: `${serde.toHex(uuidBytes.subarray(0, 4))}-${serde.toHex(uuidBytes.subarray(4, 6))}-${serde.toHex(uuidBytes.subarray(6, 8))}-${serde.toHex(uuidBytes.subarray(8, 10))}-${serde.toHex(uuidBytes.subarray(10))}`,
|
|
552
|
+
};
|
|
553
|
+
break;
|
|
554
|
+
default:
|
|
555
|
+
throw new Error(`Unrecognized header type tag`);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return out;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
var HEADER_VALUE_TYPE;
|
|
562
|
+
(function (HEADER_VALUE_TYPE) {
|
|
563
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolTrue"] = 0] = "boolTrue";
|
|
564
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolFalse"] = 1] = "boolFalse";
|
|
565
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byte"] = 2] = "byte";
|
|
566
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["short"] = 3] = "short";
|
|
567
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["integer"] = 4] = "integer";
|
|
568
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["long"] = 5] = "long";
|
|
569
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byteArray"] = 6] = "byteArray";
|
|
570
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["string"] = 7] = "string";
|
|
571
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["timestamp"] = 8] = "timestamp";
|
|
572
|
+
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["uuid"] = 9] = "uuid";
|
|
573
|
+
})(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
|
|
574
|
+
const BOOLEAN_TAG = "boolean";
|
|
575
|
+
const BYTE_TAG = "byte";
|
|
576
|
+
const SHORT_TAG = "short";
|
|
577
|
+
const INT_TAG = "integer";
|
|
578
|
+
const LONG_TAG = "long";
|
|
579
|
+
const BINARY_TAG = "binary";
|
|
580
|
+
const STRING_TAG = "string";
|
|
581
|
+
const TIMESTAMP_TAG = "timestamp";
|
|
582
|
+
const UUID_TAG = "uuid";
|
|
583
|
+
const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
584
|
+
|
|
585
|
+
const PRELUDE_MEMBER_LENGTH = 4;
|
|
586
|
+
const PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
|
|
587
|
+
const CHECKSUM_LENGTH = 4;
|
|
588
|
+
const MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;
|
|
589
|
+
function splitMessage({ byteLength, byteOffset, buffer }) {
|
|
590
|
+
if (byteLength < MINIMUM_MESSAGE_LENGTH) {
|
|
591
|
+
throw new Error("Provided message too short to accommodate event stream message overhead");
|
|
592
|
+
}
|
|
593
|
+
const view = new DataView(buffer, byteOffset, byteLength);
|
|
594
|
+
const messageLength = view.getUint32(0, false);
|
|
595
|
+
if (byteLength !== messageLength) {
|
|
596
|
+
throw new Error("Reported message length does not match received message length");
|
|
597
|
+
}
|
|
598
|
+
const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);
|
|
599
|
+
const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);
|
|
600
|
+
const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);
|
|
601
|
+
const checksummer = new crc32.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
|
|
602
|
+
if (expectedPreludeChecksum !== checksummer.digest()) {
|
|
603
|
+
throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`);
|
|
604
|
+
}
|
|
605
|
+
checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH)));
|
|
606
|
+
if (expectedMessageChecksum !== checksummer.digest()) {
|
|
607
|
+
throw new Error(`The message checksum (${checksummer.digest()}) did not match the expected value of ${expectedMessageChecksum}`);
|
|
608
|
+
}
|
|
609
|
+
return {
|
|
610
|
+
headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),
|
|
611
|
+
body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength, messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH)),
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
class EventStreamCodec {
|
|
616
|
+
headerMarshaller;
|
|
617
|
+
messageBuffer;
|
|
618
|
+
isEndOfStream;
|
|
619
|
+
constructor(toUtf8, fromUtf8) {
|
|
620
|
+
this.headerMarshaller = new HeaderMarshaller(toUtf8, fromUtf8);
|
|
621
|
+
this.messageBuffer = [];
|
|
622
|
+
this.isEndOfStream = false;
|
|
623
|
+
}
|
|
624
|
+
feed(message) {
|
|
625
|
+
this.messageBuffer.push(this.decode(message));
|
|
626
|
+
}
|
|
627
|
+
endOfStream() {
|
|
628
|
+
this.isEndOfStream = true;
|
|
629
|
+
}
|
|
630
|
+
getMessage() {
|
|
631
|
+
const message = this.messageBuffer.pop();
|
|
632
|
+
const isEndOfStream = this.isEndOfStream;
|
|
633
|
+
return {
|
|
634
|
+
getMessage() {
|
|
635
|
+
return message;
|
|
636
|
+
},
|
|
637
|
+
isEndOfStream() {
|
|
638
|
+
return isEndOfStream;
|
|
639
|
+
},
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
getAvailableMessages() {
|
|
643
|
+
const messages = this.messageBuffer;
|
|
644
|
+
this.messageBuffer = [];
|
|
645
|
+
const isEndOfStream = this.isEndOfStream;
|
|
646
|
+
return {
|
|
647
|
+
getMessages() {
|
|
648
|
+
return messages;
|
|
649
|
+
},
|
|
650
|
+
isEndOfStream() {
|
|
651
|
+
return isEndOfStream;
|
|
652
|
+
},
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
encode({ headers: rawHeaders, body }) {
|
|
656
|
+
const headers = this.headerMarshaller.format(rawHeaders);
|
|
657
|
+
const length = headers.byteLength + body.byteLength + 16;
|
|
658
|
+
const out = new Uint8Array(length);
|
|
659
|
+
const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
|
660
|
+
const checksum = new crc32.Crc32();
|
|
661
|
+
view.setUint32(0, length, false);
|
|
662
|
+
view.setUint32(4, headers.byteLength, false);
|
|
663
|
+
view.setUint32(8, checksum.update(out.subarray(0, 8)).digest(), false);
|
|
664
|
+
out.set(headers, 12);
|
|
665
|
+
out.set(body, headers.byteLength + 12);
|
|
666
|
+
view.setUint32(length - 4, checksum.update(out.subarray(8, length - 4)).digest(), false);
|
|
667
|
+
return out;
|
|
668
|
+
}
|
|
669
|
+
decode(message) {
|
|
670
|
+
const { headers, body } = splitMessage(message);
|
|
671
|
+
return { headers: this.headerMarshaller.parse(headers), body };
|
|
672
|
+
}
|
|
673
|
+
formatHeaders(rawHeaders) {
|
|
674
|
+
return this.headerMarshaller.format(rawHeaders);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
class MessageDecoderStream {
|
|
679
|
+
options;
|
|
680
|
+
constructor(options) {
|
|
681
|
+
this.options = options;
|
|
682
|
+
}
|
|
683
|
+
[Symbol.asyncIterator]() {
|
|
684
|
+
return this.asyncIterator();
|
|
685
|
+
}
|
|
686
|
+
async *asyncIterator() {
|
|
687
|
+
for await (const bytes of this.options.inputStream) {
|
|
688
|
+
const decoded = this.options.decoder.decode(bytes);
|
|
689
|
+
yield decoded;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
class MessageEncoderStream {
|
|
695
|
+
options;
|
|
696
|
+
constructor(options) {
|
|
697
|
+
this.options = options;
|
|
698
|
+
}
|
|
699
|
+
[Symbol.asyncIterator]() {
|
|
700
|
+
return this.asyncIterator();
|
|
701
|
+
}
|
|
702
|
+
async *asyncIterator() {
|
|
703
|
+
for await (const msg of this.options.messageStream) {
|
|
704
|
+
const encoded = this.options.encoder.encode(msg);
|
|
705
|
+
yield encoded;
|
|
706
|
+
}
|
|
707
|
+
if (this.options.includeEndFrame) {
|
|
708
|
+
yield new Uint8Array(0);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
class SmithyMessageDecoderStream {
|
|
714
|
+
options;
|
|
715
|
+
constructor(options) {
|
|
716
|
+
this.options = options;
|
|
717
|
+
}
|
|
718
|
+
[Symbol.asyncIterator]() {
|
|
719
|
+
return this.asyncIterator();
|
|
720
|
+
}
|
|
721
|
+
async *asyncIterator() {
|
|
722
|
+
for await (const message of this.options.messageStream) {
|
|
723
|
+
const deserialized = await this.options.deserializer(message);
|
|
724
|
+
if (deserialized === undefined)
|
|
725
|
+
continue;
|
|
726
|
+
yield deserialized;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
class SmithyMessageEncoderStream {
|
|
732
|
+
options;
|
|
733
|
+
constructor(options) {
|
|
734
|
+
this.options = options;
|
|
735
|
+
}
|
|
736
|
+
[Symbol.asyncIterator]() {
|
|
737
|
+
return this.asyncIterator();
|
|
738
|
+
}
|
|
739
|
+
async *asyncIterator() {
|
|
740
|
+
for await (const chunk of this.options.inputStream) {
|
|
741
|
+
const payloadBuf = this.options.serializer(chunk);
|
|
742
|
+
yield payloadBuf;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function getChunkedStream(source) {
|
|
748
|
+
let currentMessageTotalLength = 0;
|
|
749
|
+
let currentMessagePendingLength = 0;
|
|
750
|
+
let currentMessage = null;
|
|
751
|
+
let messageLengthBuffer = null;
|
|
752
|
+
const allocateMessage = (size) => {
|
|
753
|
+
if (typeof size !== "number") {
|
|
754
|
+
throw new Error("Attempted to allocate an event message where size was not a number: " + size);
|
|
755
|
+
}
|
|
756
|
+
currentMessageTotalLength = size;
|
|
757
|
+
currentMessagePendingLength = 4;
|
|
758
|
+
currentMessage = new Uint8Array(size);
|
|
759
|
+
const currentMessageView = new DataView(currentMessage.buffer);
|
|
760
|
+
currentMessageView.setUint32(0, size, false);
|
|
761
|
+
};
|
|
762
|
+
const iterator = async function* () {
|
|
763
|
+
const sourceIterator = source[Symbol.asyncIterator]();
|
|
764
|
+
while (true) {
|
|
765
|
+
const { value, done } = await sourceIterator.next();
|
|
766
|
+
if (done) {
|
|
767
|
+
if (!currentMessageTotalLength) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
else if (currentMessageTotalLength === currentMessagePendingLength) {
|
|
771
|
+
yield currentMessage;
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
throw new Error("Truncated event message received.");
|
|
775
|
+
}
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
const chunkLength = value.length;
|
|
779
|
+
let currentOffset = 0;
|
|
780
|
+
while (currentOffset < chunkLength) {
|
|
781
|
+
if (!currentMessage) {
|
|
782
|
+
const bytesRemaining = chunkLength - currentOffset;
|
|
783
|
+
if (!messageLengthBuffer) {
|
|
784
|
+
messageLengthBuffer = new Uint8Array(4);
|
|
785
|
+
}
|
|
786
|
+
const numBytesForTotal = Math.min(4 - currentMessagePendingLength, bytesRemaining);
|
|
787
|
+
messageLengthBuffer.set(value.slice(currentOffset, currentOffset + numBytesForTotal), currentMessagePendingLength);
|
|
788
|
+
currentMessagePendingLength += numBytesForTotal;
|
|
789
|
+
currentOffset += numBytesForTotal;
|
|
790
|
+
if (currentMessagePendingLength < 4) {
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
allocateMessage(new DataView(messageLengthBuffer.buffer).getUint32(0, false));
|
|
794
|
+
messageLengthBuffer = null;
|
|
795
|
+
}
|
|
796
|
+
const numBytesToWrite = Math.min(currentMessageTotalLength - currentMessagePendingLength, chunkLength - currentOffset);
|
|
797
|
+
currentMessage.set(value.slice(currentOffset, currentOffset + numBytesToWrite), currentMessagePendingLength);
|
|
798
|
+
currentMessagePendingLength += numBytesToWrite;
|
|
799
|
+
currentOffset += numBytesToWrite;
|
|
800
|
+
if (currentMessageTotalLength && currentMessageTotalLength === currentMessagePendingLength) {
|
|
801
|
+
yield currentMessage;
|
|
802
|
+
currentMessage = null;
|
|
803
|
+
currentMessageTotalLength = 0;
|
|
804
|
+
currentMessagePendingLength = 0;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
return {
|
|
810
|
+
[Symbol.asyncIterator]: iterator,
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
function getUnmarshalledStream(source, options) {
|
|
815
|
+
const messageUnmarshaller = getMessageUnmarshaller(options.deserializer, options.toUtf8);
|
|
816
|
+
return {
|
|
817
|
+
[Symbol.asyncIterator]: async function* () {
|
|
818
|
+
for await (const chunk of source) {
|
|
819
|
+
const message = options.eventStreamCodec.decode(chunk);
|
|
820
|
+
const type = await messageUnmarshaller(message);
|
|
821
|
+
if (type === undefined)
|
|
822
|
+
continue;
|
|
823
|
+
yield type;
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function getMessageUnmarshaller(deserializer, toUtf8) {
|
|
829
|
+
return async function (message) {
|
|
830
|
+
const { value: messageType } = message.headers[":message-type"];
|
|
831
|
+
if (messageType === "error") {
|
|
832
|
+
const unmodeledError = new Error(message.headers[":error-message"].value || "UnknownError");
|
|
833
|
+
unmodeledError.name = message.headers[":error-code"].value;
|
|
834
|
+
throw unmodeledError;
|
|
835
|
+
}
|
|
836
|
+
else if (messageType === "exception") {
|
|
837
|
+
const code = message.headers[":exception-type"].value;
|
|
838
|
+
const exception = { [code]: message };
|
|
839
|
+
const deserializedException = await deserializer(exception);
|
|
840
|
+
if (deserializedException.$unknown) {
|
|
841
|
+
const error = new Error(toUtf8(message.body));
|
|
842
|
+
error.name = code;
|
|
843
|
+
throw error;
|
|
844
|
+
}
|
|
845
|
+
throw deserializedException[code];
|
|
846
|
+
}
|
|
847
|
+
else if (messageType === "event") {
|
|
848
|
+
const event = {
|
|
849
|
+
[message.headers[":event-type"].value]: message,
|
|
850
|
+
};
|
|
851
|
+
const deserialized = await deserializer(event);
|
|
852
|
+
if (deserialized.$unknown)
|
|
853
|
+
return;
|
|
854
|
+
return deserialized;
|
|
855
|
+
}
|
|
856
|
+
else {
|
|
857
|
+
throw Error(`Unrecognizable event type: ${message.headers[":event-type"].value}`);
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
let EventStreamMarshaller$1 = class EventStreamMarshaller {
|
|
863
|
+
eventStreamCodec;
|
|
864
|
+
utfEncoder;
|
|
865
|
+
constructor({ utf8Encoder, utf8Decoder }) {
|
|
866
|
+
this.eventStreamCodec = new EventStreamCodec(utf8Encoder, utf8Decoder);
|
|
867
|
+
this.utfEncoder = utf8Encoder;
|
|
868
|
+
}
|
|
869
|
+
deserialize(body, deserializer) {
|
|
870
|
+
const inputStream = getChunkedStream(body);
|
|
871
|
+
return new SmithyMessageDecoderStream({
|
|
872
|
+
messageStream: new MessageDecoderStream({ inputStream, decoder: this.eventStreamCodec }),
|
|
873
|
+
deserializer: getMessageUnmarshaller(deserializer, this.utfEncoder),
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
serialize(inputStream, serializer) {
|
|
877
|
+
return new MessageEncoderStream({
|
|
878
|
+
messageStream: new SmithyMessageEncoderStream({ inputStream, serializer }),
|
|
879
|
+
encoder: this.eventStreamCodec,
|
|
880
|
+
includeEndFrame: true,
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
const eventStreamSerdeProvider$1 = (options) => new EventStreamMarshaller$1(options);
|
|
885
|
+
|
|
886
|
+
class EventStreamMarshaller {
|
|
887
|
+
universalMarshaller;
|
|
888
|
+
constructor({ utf8Encoder, utf8Decoder }) {
|
|
889
|
+
this.universalMarshaller = new EventStreamMarshaller$1({
|
|
890
|
+
utf8Decoder,
|
|
891
|
+
utf8Encoder,
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
deserialize(body, deserializer) {
|
|
895
|
+
const bodyIterable = typeof body[Symbol.asyncIterator] === "function" ? body : readableToIterable(body);
|
|
896
|
+
return this.universalMarshaller.deserialize(bodyIterable, deserializer);
|
|
897
|
+
}
|
|
898
|
+
serialize(input, serializer) {
|
|
899
|
+
return node_stream.Readable.from(this.universalMarshaller.serialize(input, serializer));
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
const eventStreamSerdeProvider = (options) => new EventStreamMarshaller(options);
|
|
903
|
+
async function* readableToIterable(readStream) {
|
|
904
|
+
let streamEnded = false;
|
|
905
|
+
let generationEnded = false;
|
|
906
|
+
const records = new Array();
|
|
907
|
+
readStream.on("error", (err) => {
|
|
908
|
+
if (!streamEnded) {
|
|
909
|
+
streamEnded = true;
|
|
910
|
+
}
|
|
911
|
+
if (err) {
|
|
912
|
+
throw err;
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
readStream.on("data", (data) => {
|
|
916
|
+
records.push(data);
|
|
917
|
+
});
|
|
918
|
+
readStream.on("end", () => {
|
|
919
|
+
streamEnded = true;
|
|
920
|
+
});
|
|
921
|
+
while (!generationEnded) {
|
|
922
|
+
const value = await new Promise((resolve) => setTimeout(() => resolve(records.shift()), 0));
|
|
923
|
+
if (value) {
|
|
924
|
+
yield value;
|
|
925
|
+
}
|
|
926
|
+
generationEnded = streamEnded && records.length === 0;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
const readableStreamToIterable = (readableStream) => ({
|
|
931
|
+
[Symbol.asyncIterator]: async function* () {
|
|
932
|
+
const reader = readableStream.getReader();
|
|
933
|
+
try {
|
|
934
|
+
while (true) {
|
|
935
|
+
const { done, value } = await reader.read();
|
|
936
|
+
if (done)
|
|
937
|
+
return;
|
|
938
|
+
yield value;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
finally {
|
|
942
|
+
reader.releaseLock();
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
});
|
|
946
|
+
const iterableToReadableStream = (asyncIterable) => {
|
|
947
|
+
const iterator = asyncIterable[Symbol.asyncIterator]();
|
|
948
|
+
return new ReadableStream({
|
|
949
|
+
async pull(controller) {
|
|
950
|
+
const { done, value } = await iterator.next();
|
|
951
|
+
if (done) {
|
|
952
|
+
return controller.close();
|
|
953
|
+
}
|
|
954
|
+
controller.enqueue(value);
|
|
955
|
+
},
|
|
956
|
+
});
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
const resolveEventStreamSerdeConfig = (input) => Object.assign(input, {
|
|
960
|
+
eventStreamMarshaller: input.eventStreamSerdeProvider(input),
|
|
961
|
+
});
|
|
12
962
|
|
|
13
963
|
class EventStreamSerde {
|
|
14
964
|
marshaller;
|
|
@@ -114,7 +1064,7 @@ class EventStreamSerde {
|
|
|
114
1064
|
out[name] = body;
|
|
115
1065
|
}
|
|
116
1066
|
else if (member.isStringSchema()) {
|
|
117
|
-
out[name] = (this.serdeContext?.utf8Encoder ??
|
|
1067
|
+
out[name] = (this.serdeContext?.utf8Encoder ?? serde.toUtf8)(body);
|
|
118
1068
|
}
|
|
119
1069
|
else if (member.isStructSchema()) {
|
|
120
1070
|
out[name] = await this.deserializer.read(member, body);
|
|
@@ -261,7 +1211,7 @@ class EventStreamSerde {
|
|
|
261
1211
|
}
|
|
262
1212
|
const messageSerialization = serializer.flush() ?? new Uint8Array();
|
|
263
1213
|
const body = typeof messageSerialization === "string"
|
|
264
|
-
? (this.serdeContext?.utf8Decoder ??
|
|
1214
|
+
? (this.serdeContext?.utf8Decoder ?? serde.fromUtf8)(messageSerialization)
|
|
265
1215
|
: messageSerialization;
|
|
266
1216
|
return {
|
|
267
1217
|
body,
|
|
@@ -272,7 +1222,112 @@ class EventStreamSerde {
|
|
|
272
1222
|
}
|
|
273
1223
|
}
|
|
274
1224
|
|
|
1225
|
+
__webpack_unused_export__ = EventStreamCodec;
|
|
1226
|
+
__webpack_unused_export__ = EventStreamMarshaller;
|
|
275
1227
|
exports.EventStreamSerde = EventStreamSerde;
|
|
1228
|
+
__webpack_unused_export__ = HeaderMarshaller;
|
|
1229
|
+
__webpack_unused_export__ = Int64;
|
|
1230
|
+
__webpack_unused_export__ = MessageDecoderStream;
|
|
1231
|
+
__webpack_unused_export__ = MessageEncoderStream;
|
|
1232
|
+
__webpack_unused_export__ = SmithyMessageDecoderStream;
|
|
1233
|
+
__webpack_unused_export__ = SmithyMessageEncoderStream;
|
|
1234
|
+
__webpack_unused_export__ = EventStreamMarshaller$1;
|
|
1235
|
+
__webpack_unused_export__ = eventStreamSerdeProvider;
|
|
1236
|
+
__webpack_unused_export__ = getChunkedStream;
|
|
1237
|
+
__webpack_unused_export__ = getMessageUnmarshaller;
|
|
1238
|
+
__webpack_unused_export__ = getUnmarshalledStream;
|
|
1239
|
+
__webpack_unused_export__ = iterableToReadableStream;
|
|
1240
|
+
__webpack_unused_export__ = readableStreamToIterable;
|
|
1241
|
+
__webpack_unused_export__ = resolveEventStreamSerdeConfig;
|
|
1242
|
+
__webpack_unused_export__ = eventStreamSerdeProvider$1;
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
/***/ }),
|
|
1246
|
+
|
|
1247
|
+
/***/ 6130:
|
|
1248
|
+
/***/ ((module) => {
|
|
1249
|
+
|
|
1250
|
+
var __defProp = Object.defineProperty;
|
|
1251
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1252
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1253
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1254
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1255
|
+
var __export = (target, all) => {
|
|
1256
|
+
for (var name in all)
|
|
1257
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1258
|
+
};
|
|
1259
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1260
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1261
|
+
for (let key of __getOwnPropNames(from))
|
|
1262
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1263
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1264
|
+
}
|
|
1265
|
+
return to;
|
|
1266
|
+
};
|
|
1267
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1268
|
+
|
|
1269
|
+
// src/index.ts
|
|
1270
|
+
var src_exports = {};
|
|
1271
|
+
__export(src_exports, {
|
|
1272
|
+
isArrayBuffer: () => isArrayBuffer
|
|
1273
|
+
});
|
|
1274
|
+
module.exports = __toCommonJS(src_exports);
|
|
1275
|
+
var isArrayBuffer = /* @__PURE__ */ __name((arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]", "isArrayBuffer");
|
|
1276
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1277
|
+
|
|
1278
|
+
0 && (0);
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
/***/ }),
|
|
1283
|
+
|
|
1284
|
+
/***/ 4151:
|
|
1285
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1286
|
+
|
|
1287
|
+
var __defProp = Object.defineProperty;
|
|
1288
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1289
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1290
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1291
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1292
|
+
var __export = (target, all) => {
|
|
1293
|
+
for (var name in all)
|
|
1294
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1295
|
+
};
|
|
1296
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1297
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1298
|
+
for (let key of __getOwnPropNames(from))
|
|
1299
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1300
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1301
|
+
}
|
|
1302
|
+
return to;
|
|
1303
|
+
};
|
|
1304
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1305
|
+
|
|
1306
|
+
// src/index.ts
|
|
1307
|
+
var src_exports = {};
|
|
1308
|
+
__export(src_exports, {
|
|
1309
|
+
fromArrayBuffer: () => fromArrayBuffer,
|
|
1310
|
+
fromString: () => fromString
|
|
1311
|
+
});
|
|
1312
|
+
module.exports = __toCommonJS(src_exports);
|
|
1313
|
+
var import_is_array_buffer = __webpack_require__(6130);
|
|
1314
|
+
var import_buffer = __webpack_require__(181);
|
|
1315
|
+
var fromArrayBuffer = /* @__PURE__ */ __name((input, offset = 0, length = input.byteLength - offset) => {
|
|
1316
|
+
if (!(0, import_is_array_buffer.isArrayBuffer)(input)) {
|
|
1317
|
+
throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`);
|
|
1318
|
+
}
|
|
1319
|
+
return import_buffer.Buffer.from(input, offset, length);
|
|
1320
|
+
}, "fromArrayBuffer");
|
|
1321
|
+
var fromString = /* @__PURE__ */ __name((input, encoding) => {
|
|
1322
|
+
if (typeof input !== "string") {
|
|
1323
|
+
throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
|
|
1324
|
+
}
|
|
1325
|
+
return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input);
|
|
1326
|
+
}, "fromString");
|
|
1327
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1328
|
+
|
|
1329
|
+
0 && (0);
|
|
1330
|
+
|
|
276
1331
|
|
|
277
1332
|
|
|
278
1333
|
/***/ })
|