Initial
This commit is contained in:
201
resources/app/node_modules/@smithy/eventstream-codec/LICENSE
generated
vendored
Normal file
201
resources/app/node_modules/@smithy/eventstream-codec/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/EventStreamCodec.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/EventStreamCodec.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/HeaderMarshaller.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/HeaderMarshaller.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/Int64.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/Int64.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/Message.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/Message.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/MessageDecoderStream.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/MessageDecoderStream.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/MessageEncoderStream.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/MessageEncoderStream.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/SmithyMessageDecoderStream.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/SmithyMessageDecoderStream.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/SmithyMessageEncoderStream.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/SmithyMessageEncoderStream.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/TestVectors.fixture.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/TestVectors.fixture.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
468
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/index.js
generated
vendored
Normal file
468
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,468 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.ts
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
EventStreamCodec: () => EventStreamCodec,
|
||||
HeaderMarshaller: () => HeaderMarshaller,
|
||||
Int64: () => Int64,
|
||||
MessageDecoderStream: () => MessageDecoderStream,
|
||||
MessageEncoderStream: () => MessageEncoderStream,
|
||||
SmithyMessageDecoderStream: () => SmithyMessageDecoderStream,
|
||||
SmithyMessageEncoderStream: () => SmithyMessageEncoderStream
|
||||
});
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
|
||||
// src/EventStreamCodec.ts
|
||||
var import_crc322 = require("@aws-crypto/crc32");
|
||||
|
||||
// src/HeaderMarshaller.ts
|
||||
|
||||
|
||||
// src/Int64.ts
|
||||
var import_util_hex_encoding = require("@smithy/util-hex-encoding");
|
||||
var _Int64 = class _Int64 {
|
||||
constructor(bytes) {
|
||||
this.bytes = bytes;
|
||||
if (bytes.byteLength !== 8) {
|
||||
throw new Error("Int64 buffers must be exactly 8 bytes");
|
||||
}
|
||||
}
|
||||
static fromNumber(number) {
|
||||
if (number > 9223372036854776e3 || number < -9223372036854776e3) {
|
||||
throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
|
||||
}
|
||||
const bytes = new Uint8Array(8);
|
||||
for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
|
||||
bytes[i] = remaining;
|
||||
}
|
||||
if (number < 0) {
|
||||
negate(bytes);
|
||||
}
|
||||
return new _Int64(bytes);
|
||||
}
|
||||
/**
|
||||
* Called implicitly by infix arithmetic operators.
|
||||
*/
|
||||
valueOf() {
|
||||
const bytes = this.bytes.slice(0);
|
||||
const negative = bytes[0] & 128;
|
||||
if (negative) {
|
||||
negate(bytes);
|
||||
}
|
||||
return parseInt((0, import_util_hex_encoding.toHex)(bytes), 16) * (negative ? -1 : 1);
|
||||
}
|
||||
toString() {
|
||||
return String(this.valueOf());
|
||||
}
|
||||
};
|
||||
__name(_Int64, "Int64");
|
||||
var Int64 = _Int64;
|
||||
function negate(bytes) {
|
||||
for (let i = 0; i < 8; i++) {
|
||||
bytes[i] ^= 255;
|
||||
}
|
||||
for (let i = 7; i > -1; i--) {
|
||||
bytes[i]++;
|
||||
if (bytes[i] !== 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
__name(negate, "negate");
|
||||
|
||||
// src/HeaderMarshaller.ts
|
||||
var _HeaderMarshaller = class _HeaderMarshaller {
|
||||
constructor(toUtf8, fromUtf8) {
|
||||
this.toUtf8 = toUtf8;
|
||||
this.fromUtf8 = fromUtf8;
|
||||
}
|
||||
format(headers) {
|
||||
const chunks = [];
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
const bytes = this.fromUtf8(headerName);
|
||||
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
||||
}
|
||||
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
||||
let position = 0;
|
||||
for (const chunk of chunks) {
|
||||
out.set(chunk, position);
|
||||
position += chunk.byteLength;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
formatHeaderValue(header) {
|
||||
switch (header.type) {
|
||||
case "boolean":
|
||||
return Uint8Array.from([header.value ? 0 /* boolTrue */ : 1 /* boolFalse */]);
|
||||
case "byte":
|
||||
return Uint8Array.from([2 /* byte */, header.value]);
|
||||
case "short":
|
||||
const shortView = new DataView(new ArrayBuffer(3));
|
||||
shortView.setUint8(0, 3 /* short */);
|
||||
shortView.setInt16(1, header.value, false);
|
||||
return new Uint8Array(shortView.buffer);
|
||||
case "integer":
|
||||
const intView = new DataView(new ArrayBuffer(5));
|
||||
intView.setUint8(0, 4 /* integer */);
|
||||
intView.setInt32(1, header.value, false);
|
||||
return new Uint8Array(intView.buffer);
|
||||
case "long":
|
||||
const longBytes = new Uint8Array(9);
|
||||
longBytes[0] = 5 /* long */;
|
||||
longBytes.set(header.value.bytes, 1);
|
||||
return longBytes;
|
||||
case "binary":
|
||||
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
||||
binView.setUint8(0, 6 /* byteArray */);
|
||||
binView.setUint16(1, header.value.byteLength, false);
|
||||
const binBytes = new Uint8Array(binView.buffer);
|
||||
binBytes.set(header.value, 3);
|
||||
return binBytes;
|
||||
case "string":
|
||||
const utf8Bytes = this.fromUtf8(header.value);
|
||||
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
||||
strView.setUint8(0, 7 /* string */);
|
||||
strView.setUint16(1, utf8Bytes.byteLength, false);
|
||||
const strBytes = new Uint8Array(strView.buffer);
|
||||
strBytes.set(utf8Bytes, 3);
|
||||
return strBytes;
|
||||
case "timestamp":
|
||||
const tsBytes = new Uint8Array(9);
|
||||
tsBytes[0] = 8 /* timestamp */;
|
||||
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
||||
return tsBytes;
|
||||
case "uuid":
|
||||
if (!UUID_PATTERN.test(header.value)) {
|
||||
throw new Error(`Invalid UUID received: ${header.value}`);
|
||||
}
|
||||
const uuidBytes = new Uint8Array(17);
|
||||
uuidBytes[0] = 9 /* uuid */;
|
||||
uuidBytes.set((0, import_util_hex_encoding.fromHex)(header.value.replace(/\-/g, "")), 1);
|
||||
return uuidBytes;
|
||||
}
|
||||
}
|
||||
parse(headers) {
|
||||
const out = {};
|
||||
let position = 0;
|
||||
while (position < headers.byteLength) {
|
||||
const nameLength = headers.getUint8(position++);
|
||||
const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
|
||||
position += nameLength;
|
||||
switch (headers.getUint8(position++)) {
|
||||
case 0 /* boolTrue */:
|
||||
out[name] = {
|
||||
type: BOOLEAN_TAG,
|
||||
value: true
|
||||
};
|
||||
break;
|
||||
case 1 /* boolFalse */:
|
||||
out[name] = {
|
||||
type: BOOLEAN_TAG,
|
||||
value: false
|
||||
};
|
||||
break;
|
||||
case 2 /* byte */:
|
||||
out[name] = {
|
||||
type: BYTE_TAG,
|
||||
value: headers.getInt8(position++)
|
||||
};
|
||||
break;
|
||||
case 3 /* short */:
|
||||
out[name] = {
|
||||
type: SHORT_TAG,
|
||||
value: headers.getInt16(position, false)
|
||||
};
|
||||
position += 2;
|
||||
break;
|
||||
case 4 /* integer */:
|
||||
out[name] = {
|
||||
type: INT_TAG,
|
||||
value: headers.getInt32(position, false)
|
||||
};
|
||||
position += 4;
|
||||
break;
|
||||
case 5 /* long */:
|
||||
out[name] = {
|
||||
type: LONG_TAG,
|
||||
value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8))
|
||||
};
|
||||
position += 8;
|
||||
break;
|
||||
case 6 /* byteArray */:
|
||||
const binaryLength = headers.getUint16(position, false);
|
||||
position += 2;
|
||||
out[name] = {
|
||||
type: BINARY_TAG,
|
||||
value: new Uint8Array(headers.buffer, headers.byteOffset + position, binaryLength)
|
||||
};
|
||||
position += binaryLength;
|
||||
break;
|
||||
case 7 /* string */:
|
||||
const stringLength = headers.getUint16(position, false);
|
||||
position += 2;
|
||||
out[name] = {
|
||||
type: STRING_TAG,
|
||||
value: this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, stringLength))
|
||||
};
|
||||
position += stringLength;
|
||||
break;
|
||||
case 8 /* timestamp */:
|
||||
out[name] = {
|
||||
type: TIMESTAMP_TAG,
|
||||
value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf())
|
||||
};
|
||||
position += 8;
|
||||
break;
|
||||
case 9 /* uuid */:
|
||||
const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
|
||||
position += 16;
|
||||
out[name] = {
|
||||
type: UUID_TAG,
|
||||
value: `${(0, import_util_hex_encoding.toHex)(uuidBytes.subarray(0, 4))}-${(0, import_util_hex_encoding.toHex)(uuidBytes.subarray(4, 6))}-${(0, import_util_hex_encoding.toHex)(
|
||||
uuidBytes.subarray(6, 8)
|
||||
)}-${(0, import_util_hex_encoding.toHex)(uuidBytes.subarray(8, 10))}-${(0, import_util_hex_encoding.toHex)(uuidBytes.subarray(10))}`
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unrecognized header type tag`);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
};
|
||||
__name(_HeaderMarshaller, "HeaderMarshaller");
|
||||
var HeaderMarshaller = _HeaderMarshaller;
|
||||
var BOOLEAN_TAG = "boolean";
|
||||
var BYTE_TAG = "byte";
|
||||
var SHORT_TAG = "short";
|
||||
var INT_TAG = "integer";
|
||||
var LONG_TAG = "long";
|
||||
var BINARY_TAG = "binary";
|
||||
var STRING_TAG = "string";
|
||||
var TIMESTAMP_TAG = "timestamp";
|
||||
var UUID_TAG = "uuid";
|
||||
var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
||||
|
||||
// src/splitMessage.ts
|
||||
var import_crc32 = require("@aws-crypto/crc32");
|
||||
var PRELUDE_MEMBER_LENGTH = 4;
|
||||
var PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
|
||||
var CHECKSUM_LENGTH = 4;
|
||||
var MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;
|
||||
function splitMessage({ byteLength, byteOffset, buffer }) {
|
||||
if (byteLength < MINIMUM_MESSAGE_LENGTH) {
|
||||
throw new Error("Provided message too short to accommodate event stream message overhead");
|
||||
}
|
||||
const view = new DataView(buffer, byteOffset, byteLength);
|
||||
const messageLength = view.getUint32(0, false);
|
||||
if (byteLength !== messageLength) {
|
||||
throw new Error("Reported message length does not match received message length");
|
||||
}
|
||||
const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);
|
||||
const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);
|
||||
const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);
|
||||
const checksummer = new import_crc32.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
|
||||
if (expectedPreludeChecksum !== checksummer.digest()) {
|
||||
throw new Error(
|
||||
`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`
|
||||
);
|
||||
}
|
||||
checksummer.update(
|
||||
new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH))
|
||||
);
|
||||
if (expectedMessageChecksum !== checksummer.digest()) {
|
||||
throw new Error(
|
||||
`The message checksum (${checksummer.digest()}) did not match the expected value of ${expectedMessageChecksum}`
|
||||
);
|
||||
}
|
||||
return {
|
||||
headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),
|
||||
body: new Uint8Array(
|
||||
buffer,
|
||||
byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength,
|
||||
messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH)
|
||||
)
|
||||
};
|
||||
}
|
||||
__name(splitMessage, "splitMessage");
|
||||
|
||||
// src/EventStreamCodec.ts
|
||||
var _EventStreamCodec = class _EventStreamCodec {
|
||||
constructor(toUtf8, fromUtf8) {
|
||||
this.headerMarshaller = new HeaderMarshaller(toUtf8, fromUtf8);
|
||||
this.messageBuffer = [];
|
||||
this.isEndOfStream = false;
|
||||
}
|
||||
feed(message) {
|
||||
this.messageBuffer.push(this.decode(message));
|
||||
}
|
||||
endOfStream() {
|
||||
this.isEndOfStream = true;
|
||||
}
|
||||
getMessage() {
|
||||
const message = this.messageBuffer.pop();
|
||||
const isEndOfStream = this.isEndOfStream;
|
||||
return {
|
||||
getMessage() {
|
||||
return message;
|
||||
},
|
||||
isEndOfStream() {
|
||||
return isEndOfStream;
|
||||
}
|
||||
};
|
||||
}
|
||||
getAvailableMessages() {
|
||||
const messages = this.messageBuffer;
|
||||
this.messageBuffer = [];
|
||||
const isEndOfStream = this.isEndOfStream;
|
||||
return {
|
||||
getMessages() {
|
||||
return messages;
|
||||
},
|
||||
isEndOfStream() {
|
||||
return isEndOfStream;
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Convert a structured JavaScript object with tagged headers into a binary
|
||||
* event stream message.
|
||||
*/
|
||||
encode({ headers: rawHeaders, body }) {
|
||||
const headers = this.headerMarshaller.format(rawHeaders);
|
||||
const length = headers.byteLength + body.byteLength + 16;
|
||||
const out = new Uint8Array(length);
|
||||
const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
||||
const checksum = new import_crc322.Crc32();
|
||||
view.setUint32(0, length, false);
|
||||
view.setUint32(4, headers.byteLength, false);
|
||||
view.setUint32(8, checksum.update(out.subarray(0, 8)).digest(), false);
|
||||
out.set(headers, 12);
|
||||
out.set(body, headers.byteLength + 12);
|
||||
view.setUint32(length - 4, checksum.update(out.subarray(8, length - 4)).digest(), false);
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Convert a binary event stream message into a JavaScript object with an
|
||||
* opaque, binary body and tagged, parsed headers.
|
||||
*/
|
||||
decode(message) {
|
||||
const { headers, body } = splitMessage(message);
|
||||
return { headers: this.headerMarshaller.parse(headers), body };
|
||||
}
|
||||
/**
|
||||
* Convert a structured JavaScript object with tagged headers into a binary
|
||||
* event stream message header.
|
||||
*/
|
||||
formatHeaders(rawHeaders) {
|
||||
return this.headerMarshaller.format(rawHeaders);
|
||||
}
|
||||
};
|
||||
__name(_EventStreamCodec, "EventStreamCodec");
|
||||
var EventStreamCodec = _EventStreamCodec;
|
||||
|
||||
// src/MessageDecoderStream.ts
|
||||
var _MessageDecoderStream = class _MessageDecoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const bytes of this.options.inputStream) {
|
||||
const decoded = this.options.decoder.decode(bytes);
|
||||
yield decoded;
|
||||
}
|
||||
}
|
||||
};
|
||||
__name(_MessageDecoderStream, "MessageDecoderStream");
|
||||
var MessageDecoderStream = _MessageDecoderStream;
|
||||
|
||||
// src/MessageEncoderStream.ts
|
||||
var _MessageEncoderStream = class _MessageEncoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const msg of this.options.messageStream) {
|
||||
const encoded = this.options.encoder.encode(msg);
|
||||
yield encoded;
|
||||
}
|
||||
if (this.options.includeEndFrame) {
|
||||
yield new Uint8Array(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
__name(_MessageEncoderStream, "MessageEncoderStream");
|
||||
var MessageEncoderStream = _MessageEncoderStream;
|
||||
|
||||
// src/SmithyMessageDecoderStream.ts
|
||||
var _SmithyMessageDecoderStream = class _SmithyMessageDecoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const message of this.options.messageStream) {
|
||||
const deserialized = await this.options.deserializer(message);
|
||||
if (deserialized === void 0)
|
||||
continue;
|
||||
yield deserialized;
|
||||
}
|
||||
}
|
||||
};
|
||||
__name(_SmithyMessageDecoderStream, "SmithyMessageDecoderStream");
|
||||
var SmithyMessageDecoderStream = _SmithyMessageDecoderStream;
|
||||
|
||||
// src/SmithyMessageEncoderStream.ts
|
||||
var _SmithyMessageEncoderStream = class _SmithyMessageEncoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const chunk of this.options.inputStream) {
|
||||
const payloadBuf = this.options.serializer(chunk);
|
||||
yield payloadBuf;
|
||||
}
|
||||
}
|
||||
};
|
||||
__name(_SmithyMessageEncoderStream, "SmithyMessageEncoderStream");
|
||||
var SmithyMessageEncoderStream = _SmithyMessageEncoderStream;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
|
||||
0 && (module.exports = {
|
||||
EventStreamCodec,
|
||||
HeaderMarshaller,
|
||||
Int64,
|
||||
MessageDecoderStream,
|
||||
MessageEncoderStream,
|
||||
SmithyMessageDecoderStream,
|
||||
SmithyMessageEncoderStream
|
||||
});
|
||||
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/splitMessage.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/splitMessage.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/vectorTypes.fixture.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-cjs/vectorTypes.fixture.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
62
resources/app/node_modules/@smithy/eventstream-codec/dist-es/EventStreamCodec.js
generated
vendored
Normal file
62
resources/app/node_modules/@smithy/eventstream-codec/dist-es/EventStreamCodec.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { Crc32 } from "@aws-crypto/crc32";
|
||||
import { HeaderMarshaller } from "./HeaderMarshaller";
|
||||
import { splitMessage } from "./splitMessage";
|
||||
export class EventStreamCodec {
|
||||
constructor(toUtf8, fromUtf8) {
|
||||
this.headerMarshaller = new HeaderMarshaller(toUtf8, fromUtf8);
|
||||
this.messageBuffer = [];
|
||||
this.isEndOfStream = false;
|
||||
}
|
||||
feed(message) {
|
||||
this.messageBuffer.push(this.decode(message));
|
||||
}
|
||||
endOfStream() {
|
||||
this.isEndOfStream = true;
|
||||
}
|
||||
getMessage() {
|
||||
const message = this.messageBuffer.pop();
|
||||
const isEndOfStream = this.isEndOfStream;
|
||||
return {
|
||||
getMessage() {
|
||||
return message;
|
||||
},
|
||||
isEndOfStream() {
|
||||
return isEndOfStream;
|
||||
},
|
||||
};
|
||||
}
|
||||
getAvailableMessages() {
|
||||
const messages = this.messageBuffer;
|
||||
this.messageBuffer = [];
|
||||
const isEndOfStream = this.isEndOfStream;
|
||||
return {
|
||||
getMessages() {
|
||||
return messages;
|
||||
},
|
||||
isEndOfStream() {
|
||||
return isEndOfStream;
|
||||
},
|
||||
};
|
||||
}
|
||||
encode({ headers: rawHeaders, body }) {
|
||||
const headers = this.headerMarshaller.format(rawHeaders);
|
||||
const length = headers.byteLength + body.byteLength + 16;
|
||||
const out = new Uint8Array(length);
|
||||
const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
||||
const checksum = new Crc32();
|
||||
view.setUint32(0, length, false);
|
||||
view.setUint32(4, headers.byteLength, false);
|
||||
view.setUint32(8, checksum.update(out.subarray(0, 8)).digest(), false);
|
||||
out.set(headers, 12);
|
||||
out.set(body, headers.byteLength + 12);
|
||||
view.setUint32(length - 4, checksum.update(out.subarray(8, length - 4)).digest(), false);
|
||||
return out;
|
||||
}
|
||||
decode(message) {
|
||||
const { headers, body } = splitMessage(message);
|
||||
return { headers: this.headerMarshaller.parse(headers), body };
|
||||
}
|
||||
formatHeaders(rawHeaders) {
|
||||
return this.headerMarshaller.format(rawHeaders);
|
||||
}
|
||||
}
|
||||
182
resources/app/node_modules/@smithy/eventstream-codec/dist-es/HeaderMarshaller.js
generated
vendored
Normal file
182
resources/app/node_modules/@smithy/eventstream-codec/dist-es/HeaderMarshaller.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
import { fromHex, toHex } from "@smithy/util-hex-encoding";
|
||||
import { Int64 } from "./Int64";
|
||||
export class HeaderMarshaller {
|
||||
constructor(toUtf8, fromUtf8) {
|
||||
this.toUtf8 = toUtf8;
|
||||
this.fromUtf8 = fromUtf8;
|
||||
}
|
||||
format(headers) {
|
||||
const chunks = [];
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
const bytes = this.fromUtf8(headerName);
|
||||
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
||||
}
|
||||
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
||||
let position = 0;
|
||||
for (const chunk of chunks) {
|
||||
out.set(chunk, position);
|
||||
position += chunk.byteLength;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
formatHeaderValue(header) {
|
||||
switch (header.type) {
|
||||
case "boolean":
|
||||
return Uint8Array.from([header.value ? 0 : 1]);
|
||||
case "byte":
|
||||
return Uint8Array.from([2, header.value]);
|
||||
case "short":
|
||||
const shortView = new DataView(new ArrayBuffer(3));
|
||||
shortView.setUint8(0, 3);
|
||||
shortView.setInt16(1, header.value, false);
|
||||
return new Uint8Array(shortView.buffer);
|
||||
case "integer":
|
||||
const intView = new DataView(new ArrayBuffer(5));
|
||||
intView.setUint8(0, 4);
|
||||
intView.setInt32(1, header.value, false);
|
||||
return new Uint8Array(intView.buffer);
|
||||
case "long":
|
||||
const longBytes = new Uint8Array(9);
|
||||
longBytes[0] = 5;
|
||||
longBytes.set(header.value.bytes, 1);
|
||||
return longBytes;
|
||||
case "binary":
|
||||
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
||||
binView.setUint8(0, 6);
|
||||
binView.setUint16(1, header.value.byteLength, false);
|
||||
const binBytes = new Uint8Array(binView.buffer);
|
||||
binBytes.set(header.value, 3);
|
||||
return binBytes;
|
||||
case "string":
|
||||
const utf8Bytes = this.fromUtf8(header.value);
|
||||
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
||||
strView.setUint8(0, 7);
|
||||
strView.setUint16(1, utf8Bytes.byteLength, false);
|
||||
const strBytes = new Uint8Array(strView.buffer);
|
||||
strBytes.set(utf8Bytes, 3);
|
||||
return strBytes;
|
||||
case "timestamp":
|
||||
const tsBytes = new Uint8Array(9);
|
||||
tsBytes[0] = 8;
|
||||
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
||||
return tsBytes;
|
||||
case "uuid":
|
||||
if (!UUID_PATTERN.test(header.value)) {
|
||||
throw new Error(`Invalid UUID received: ${header.value}`);
|
||||
}
|
||||
const uuidBytes = new Uint8Array(17);
|
||||
uuidBytes[0] = 9;
|
||||
uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
|
||||
return uuidBytes;
|
||||
}
|
||||
}
|
||||
parse(headers) {
|
||||
const out = {};
|
||||
let position = 0;
|
||||
while (position < headers.byteLength) {
|
||||
const nameLength = headers.getUint8(position++);
|
||||
const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
|
||||
position += nameLength;
|
||||
switch (headers.getUint8(position++)) {
|
||||
case 0:
|
||||
out[name] = {
|
||||
type: BOOLEAN_TAG,
|
||||
value: true,
|
||||
};
|
||||
break;
|
||||
case 1:
|
||||
out[name] = {
|
||||
type: BOOLEAN_TAG,
|
||||
value: false,
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
out[name] = {
|
||||
type: BYTE_TAG,
|
||||
value: headers.getInt8(position++),
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
out[name] = {
|
||||
type: SHORT_TAG,
|
||||
value: headers.getInt16(position, false),
|
||||
};
|
||||
position += 2;
|
||||
break;
|
||||
case 4:
|
||||
out[name] = {
|
||||
type: INT_TAG,
|
||||
value: headers.getInt32(position, false),
|
||||
};
|
||||
position += 4;
|
||||
break;
|
||||
case 5:
|
||||
out[name] = {
|
||||
type: LONG_TAG,
|
||||
value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)),
|
||||
};
|
||||
position += 8;
|
||||
break;
|
||||
case 6:
|
||||
const binaryLength = headers.getUint16(position, false);
|
||||
position += 2;
|
||||
out[name] = {
|
||||
type: BINARY_TAG,
|
||||
value: new Uint8Array(headers.buffer, headers.byteOffset + position, binaryLength),
|
||||
};
|
||||
position += binaryLength;
|
||||
break;
|
||||
case 7:
|
||||
const stringLength = headers.getUint16(position, false);
|
||||
position += 2;
|
||||
out[name] = {
|
||||
type: STRING_TAG,
|
||||
value: this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, stringLength)),
|
||||
};
|
||||
position += stringLength;
|
||||
break;
|
||||
case 8:
|
||||
out[name] = {
|
||||
type: TIMESTAMP_TAG,
|
||||
value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf()),
|
||||
};
|
||||
position += 8;
|
||||
break;
|
||||
case 9:
|
||||
const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
|
||||
position += 16;
|
||||
out[name] = {
|
||||
type: UUID_TAG,
|
||||
value: `${toHex(uuidBytes.subarray(0, 4))}-${toHex(uuidBytes.subarray(4, 6))}-${toHex(uuidBytes.subarray(6, 8))}-${toHex(uuidBytes.subarray(8, 10))}-${toHex(uuidBytes.subarray(10))}`,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unrecognized header type tag`);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
var HEADER_VALUE_TYPE;
|
||||
(function (HEADER_VALUE_TYPE) {
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolTrue"] = 0] = "boolTrue";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolFalse"] = 1] = "boolFalse";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byte"] = 2] = "byte";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["short"] = 3] = "short";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["integer"] = 4] = "integer";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["long"] = 5] = "long";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byteArray"] = 6] = "byteArray";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["string"] = 7] = "string";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["timestamp"] = 8] = "timestamp";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["uuid"] = 9] = "uuid";
|
||||
})(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
|
||||
const BOOLEAN_TAG = "boolean";
|
||||
const BYTE_TAG = "byte";
|
||||
const SHORT_TAG = "short";
|
||||
const INT_TAG = "integer";
|
||||
const LONG_TAG = "long";
|
||||
const BINARY_TAG = "binary";
|
||||
const STRING_TAG = "string";
|
||||
const TIMESTAMP_TAG = "timestamp";
|
||||
const UUID_TAG = "uuid";
|
||||
const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
||||
43
resources/app/node_modules/@smithy/eventstream-codec/dist-es/Int64.js
generated
vendored
Normal file
43
resources/app/node_modules/@smithy/eventstream-codec/dist-es/Int64.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { toHex } from "@smithy/util-hex-encoding";
|
||||
export class Int64 {
|
||||
constructor(bytes) {
|
||||
this.bytes = bytes;
|
||||
if (bytes.byteLength !== 8) {
|
||||
throw new Error("Int64 buffers must be exactly 8 bytes");
|
||||
}
|
||||
}
|
||||
static fromNumber(number) {
|
||||
if (number > 9223372036854776000 || number < -9223372036854776000) {
|
||||
throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
|
||||
}
|
||||
const bytes = new Uint8Array(8);
|
||||
for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
|
||||
bytes[i] = remaining;
|
||||
}
|
||||
if (number < 0) {
|
||||
negate(bytes);
|
||||
}
|
||||
return new Int64(bytes);
|
||||
}
|
||||
valueOf() {
|
||||
const bytes = this.bytes.slice(0);
|
||||
const negative = bytes[0] & 0b10000000;
|
||||
if (negative) {
|
||||
negate(bytes);
|
||||
}
|
||||
return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);
|
||||
}
|
||||
toString() {
|
||||
return String(this.valueOf());
|
||||
}
|
||||
}
|
||||
function negate(bytes) {
|
||||
for (let i = 0; i < 8; i++) {
|
||||
bytes[i] ^= 0xff;
|
||||
}
|
||||
for (let i = 7; i > -1; i--) {
|
||||
bytes[i]++;
|
||||
if (bytes[i] !== 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-es/Message.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-es/Message.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
14
resources/app/node_modules/@smithy/eventstream-codec/dist-es/MessageDecoderStream.js
generated
vendored
Normal file
14
resources/app/node_modules/@smithy/eventstream-codec/dist-es/MessageDecoderStream.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export class MessageDecoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const bytes of this.options.inputStream) {
|
||||
const decoded = this.options.decoder.decode(bytes);
|
||||
yield decoded;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
resources/app/node_modules/@smithy/eventstream-codec/dist-es/MessageEncoderStream.js
generated
vendored
Normal file
17
resources/app/node_modules/@smithy/eventstream-codec/dist-es/MessageEncoderStream.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export class MessageEncoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const msg of this.options.messageStream) {
|
||||
const encoded = this.options.encoder.encode(msg);
|
||||
yield encoded;
|
||||
}
|
||||
if (this.options.includeEndFrame) {
|
||||
yield new Uint8Array(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
resources/app/node_modules/@smithy/eventstream-codec/dist-es/SmithyMessageDecoderStream.js
generated
vendored
Normal file
16
resources/app/node_modules/@smithy/eventstream-codec/dist-es/SmithyMessageDecoderStream.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export class SmithyMessageDecoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const message of this.options.messageStream) {
|
||||
const deserialized = await this.options.deserializer(message);
|
||||
if (deserialized === undefined)
|
||||
continue;
|
||||
yield deserialized;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
resources/app/node_modules/@smithy/eventstream-codec/dist-es/SmithyMessageEncoderStream.js
generated
vendored
Normal file
14
resources/app/node_modules/@smithy/eventstream-codec/dist-es/SmithyMessageEncoderStream.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export class SmithyMessageEncoderStream {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return this.asyncIterator();
|
||||
}
|
||||
async *asyncIterator() {
|
||||
for await (const chunk of this.options.inputStream) {
|
||||
const payloadBuf = this.options.serializer(chunk);
|
||||
yield payloadBuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
146
resources/app/node_modules/@smithy/eventstream-codec/dist-es/TestVectors.fixture.js
generated
vendored
Normal file
146
resources/app/node_modules/@smithy/eventstream-codec/dist-es/TestVectors.fixture.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
import { Int64 } from "./Int64";
|
||||
export const vectors = {
|
||||
all_headers: {
|
||||
expectation: "success",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 204, 0, 0, 0, 175, 15, 174, 100, 202, 10, 101, 118, 101, 110, 116, 45, 116, 121, 112, 101, 4, 0, 0, 160,
|
||||
12, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0, 16, 97, 112, 112, 108, 105, 99, 97, 116,
|
||||
105, 111, 110, 47, 106, 115, 111, 110, 10, 98, 111, 111, 108, 32, 102, 97, 108, 115, 101, 1, 9, 98, 111, 111, 108,
|
||||
32, 116, 114, 117, 101, 0, 4, 98, 121, 116, 101, 2, 207, 8, 98, 121, 116, 101, 32, 98, 117, 102, 6, 0, 20, 73, 39,
|
||||
109, 32, 97, 32, 108, 105, 116, 116, 108, 101, 32, 116, 101, 97, 112, 111, 116, 33, 9, 116, 105, 109, 101, 115,
|
||||
116, 97, 109, 112, 8, 0, 0, 0, 0, 0, 132, 95, 237, 5, 105, 110, 116, 49, 54, 3, 0, 42, 5, 105, 110, 116, 54, 52,
|
||||
5, 0, 0, 0, 0, 2, 135, 87, 178, 4, 117, 117, 105, 100, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 171, 165, 241, 12,
|
||||
]),
|
||||
decoded: {
|
||||
headers: {
|
||||
"event-type": {
|
||||
type: "integer",
|
||||
value: 40972,
|
||||
},
|
||||
"content-type": {
|
||||
type: "string",
|
||||
value: "application/json",
|
||||
},
|
||||
"bool false": {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
},
|
||||
"bool true": {
|
||||
type: "boolean",
|
||||
value: true,
|
||||
},
|
||||
byte: {
|
||||
type: "byte",
|
||||
value: -49,
|
||||
},
|
||||
"byte buf": {
|
||||
type: "binary",
|
||||
value: Uint8Array.from([
|
||||
73, 39, 109, 32, 97, 32, 108, 105, 116, 116, 108, 101, 32, 116, 101, 97, 112, 111, 116, 33,
|
||||
]),
|
||||
},
|
||||
timestamp: {
|
||||
type: "timestamp",
|
||||
value: new Date(8675309),
|
||||
},
|
||||
int16: {
|
||||
type: "short",
|
||||
value: 42,
|
||||
},
|
||||
int64: {
|
||||
type: "long",
|
||||
value: Int64.fromNumber(42424242),
|
||||
},
|
||||
uuid: {
|
||||
type: "uuid",
|
||||
value: "01020304-0506-0708-090a-0b0c0d0e0f10",
|
||||
},
|
||||
},
|
||||
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
||||
},
|
||||
},
|
||||
empty_message: {
|
||||
expectation: "success",
|
||||
encoded: Uint8Array.from([0, 0, 0, 16, 0, 0, 0, 0, 5, 194, 72, 235, 125, 152, 200, 255]),
|
||||
decoded: {
|
||||
headers: {},
|
||||
body: Uint8Array.from([]),
|
||||
},
|
||||
},
|
||||
int32_header: {
|
||||
expectation: "success",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 45, 0, 0, 0, 16, 65, 196, 36, 184, 10, 101, 118, 101, 110, 116, 45, 116, 121, 112, 101, 4, 0, 0, 160, 12,
|
||||
123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 54, 244, 128, 160,
|
||||
]),
|
||||
decoded: {
|
||||
headers: {
|
||||
"event-type": {
|
||||
type: "integer",
|
||||
value: 40972,
|
||||
},
|
||||
},
|
||||
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
||||
},
|
||||
},
|
||||
payload_no_headers: {
|
||||
expectation: "success",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 29, 0, 0, 0, 0, 253, 82, 140, 90, 123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 195, 101, 57,
|
||||
54,
|
||||
]),
|
||||
decoded: {
|
||||
headers: {},
|
||||
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
||||
},
|
||||
},
|
||||
payload_one_str_header: {
|
||||
expectation: "success",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 61, 0, 0, 0, 32, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
||||
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 39, 102, 111, 111, 39, 58,
|
||||
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
||||
]),
|
||||
decoded: {
|
||||
headers: {
|
||||
"content-type": {
|
||||
type: "string",
|
||||
value: "application/json",
|
||||
},
|
||||
},
|
||||
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
||||
},
|
||||
},
|
||||
corrupted_headers: {
|
||||
expectation: "failure",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 61, 0, 0, 0, 32, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
||||
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 97, 102, 111, 111, 39, 58,
|
||||
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
||||
]),
|
||||
},
|
||||
corrupted_header_len: {
|
||||
expectation: "failure",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 61, 0, 0, 0, 33, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
||||
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 39, 102, 111, 111, 39, 58,
|
||||
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
||||
]),
|
||||
},
|
||||
corrupted_length: {
|
||||
expectation: "failure",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 62, 0, 0, 0, 32, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
||||
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 39, 102, 111, 111, 39, 58,
|
||||
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
||||
]),
|
||||
},
|
||||
corrupted_payload: {
|
||||
expectation: "failure",
|
||||
encoded: Uint8Array.from([
|
||||
0, 0, 0, 29, 0, 0, 0, 0, 253, 82, 140, 90, 91, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 195, 101, 57,
|
||||
54,
|
||||
]),
|
||||
},
|
||||
};
|
||||
8
resources/app/node_modules/@smithy/eventstream-codec/dist-es/index.js
generated
vendored
Normal file
8
resources/app/node_modules/@smithy/eventstream-codec/dist-es/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from "./EventStreamCodec";
|
||||
export * from "./HeaderMarshaller";
|
||||
export * from "./Int64";
|
||||
export * from "./Message";
|
||||
export * from "./MessageDecoderStream";
|
||||
export * from "./MessageEncoderStream";
|
||||
export * from "./SmithyMessageDecoderStream";
|
||||
export * from "./SmithyMessageEncoderStream";
|
||||
30
resources/app/node_modules/@smithy/eventstream-codec/dist-es/splitMessage.js
generated
vendored
Normal file
30
resources/app/node_modules/@smithy/eventstream-codec/dist-es/splitMessage.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Crc32 } from "@aws-crypto/crc32";
|
||||
const PRELUDE_MEMBER_LENGTH = 4;
|
||||
const PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
|
||||
const CHECKSUM_LENGTH = 4;
|
||||
const MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;
|
||||
export function splitMessage({ byteLength, byteOffset, buffer }) {
|
||||
if (byteLength < MINIMUM_MESSAGE_LENGTH) {
|
||||
throw new Error("Provided message too short to accommodate event stream message overhead");
|
||||
}
|
||||
const view = new DataView(buffer, byteOffset, byteLength);
|
||||
const messageLength = view.getUint32(0, false);
|
||||
if (byteLength !== messageLength) {
|
||||
throw new Error("Reported message length does not match received message length");
|
||||
}
|
||||
const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);
|
||||
const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);
|
||||
const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);
|
||||
const checksummer = new Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
|
||||
if (expectedPreludeChecksum !== checksummer.digest()) {
|
||||
throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`);
|
||||
}
|
||||
checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH)));
|
||||
if (expectedMessageChecksum !== checksummer.digest()) {
|
||||
throw new Error(`The message checksum (${checksummer.digest()}) did not match the expected value of ${expectedMessageChecksum}`);
|
||||
}
|
||||
return {
|
||||
headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),
|
||||
body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength, messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH)),
|
||||
};
|
||||
}
|
||||
1
resources/app/node_modules/@smithy/eventstream-codec/dist-es/vectorTypes.fixture.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/eventstream-codec/dist-es/vectorTypes.fixture.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
48
resources/app/node_modules/@smithy/eventstream-codec/package.json
generated
vendored
Normal file
48
resources/app/node_modules/@smithy/eventstream-codec/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@smithy/eventstream-codec",
|
||||
"version": "3.0.0",
|
||||
"main": "./dist-cjs/index.js",
|
||||
"module": "./dist-es/index.js",
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"author": {
|
||||
"name": "AWS SDK for JavaScript Team",
|
||||
"url": "https://aws.amazon.com/javascript/"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@aws-crypto/crc32": "3.0.0",
|
||||
"@smithy/types": "^3.0.0",
|
||||
"@smithy/util-hex-encoding": "^3.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@smithy/util-utf8": "^3.0.0",
|
||||
"@types/node": "^16.18.96",
|
||||
"concurrently": "7.0.0",
|
||||
"downlevel-dts": "0.10.1",
|
||||
"rimraf": "3.0.2",
|
||||
"typedoc": "0.23.23"
|
||||
},
|
||||
"typesVersions": {
|
||||
"<4.0": {
|
||||
"dist-types/*": [
|
||||
"dist-types/ts3.4/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**"
|
||||
],
|
||||
"homepage": "https://github.com/awslabs/smithy-typescript/tree/main/packages/eventstream-codec",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/awslabs/smithy-typescript.git",
|
||||
"directory": "packages/eventstream-codec"
|
||||
},
|
||||
"typedoc": {
|
||||
"entryPoint": "src/index.ts"
|
||||
},
|
||||
"publishConfig": {
|
||||
"directory": ".release/package"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user