5193 changed files with 617119 additions and 6 deletions
@ -1,4 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="Black"> |
|||
<option name="sdkName" value="Python 3.12" /> |
|||
</component> |
|||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" /> |
|||
</project> |
|||
@ -0,0 +1 @@ |
|||
../ejs/bin/cli.js |
|||
@ -0,0 +1 @@ |
|||
../fast-xml-parser/src/cli/cli.js |
|||
@ -0,0 +1 @@ |
|||
../jake/bin/cli.js |
|||
@ -0,0 +1 @@ |
|||
../mime/cli.js |
|||
@ -0,0 +1 @@ |
|||
../nodemon/bin/nodemon.js |
|||
@ -0,0 +1 @@ |
|||
../touch/bin/nodetouch.js |
|||
@ -0,0 +1 @@ |
|||
../nopt/bin/nopt.js |
|||
@ -0,0 +1 @@ |
|||
../semver/bin/semver.js |
|||
@ -0,0 +1 @@ |
|||
../uuid/dist/bin/uuid |
|||
File diff suppressed because it is too large
@ -0,0 +1,76 @@ |
|||
# Change Log |
|||
|
|||
All notable changes to this project will be documented in this file. |
|||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. |
|||
|
|||
# [3.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.2...v3.0.0) (2023-01-12) |
|||
|
|||
- feat!: replace Hash implementations with Checksum interface (#492) ([da43dc0](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/da43dc0fdf669d9ebb5bfb1b1f7c79e46c4aaae1)), closes [#492](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/492) |
|||
|
|||
### BREAKING CHANGES |
|||
|
|||
- All classes that implemented `Hash` now implement `Checksum`. |
|||
|
|||
## [2.0.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.1...v2.0.2) (2022-09-07) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- **#337:** update @aws-sdk/types ([#373](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/373)) ([b26a811](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/b26a811a392f5209c7ec7e57251500d4d78f97ff)), closes [#337](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/337) |
|||
|
|||
## [2.0.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.0...v2.0.1) (2021-12-09) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/crc32 |
|||
|
|||
# [2.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.2...v2.0.0) (2021-10-25) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/crc32 |
|||
|
|||
## [1.2.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.1...v1.2.2) (2021-10-12) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- **crc32c:** ie11 does not support Array.from ([#221](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/221)) ([5f49547](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/5f495472ab8988cf203e0f2a70a51f7e1fcd7e60)) |
|||
|
|||
## [1.2.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.0...v1.2.1) (2021-09-17) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/crc32 |
|||
|
|||
# [1.2.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.1.1...v1.2.0) (2021-09-17) |
|||
|
|||
### Features |
|||
|
|||
- Add AwsCrc32 Hash ([f5d7e81](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/f5d7e815fcbe0f8da1edb855fea3bd33eb1edc15)) |
|||
|
|||
# [1.1.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@1.0.0...@aws-crypto/crc32@1.1.0) (2021-08-11) |
|||
|
|||
### Features |
|||
|
|||
- Create CRC-32C implementation ([#201](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/201)) ([e43c7ec](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/e43c7ecd30d6499fa696f5839ecc30502a34b8b6)) |
|||
|
|||
# [1.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@1.0.0-alpha.0...@aws-crypto/crc32@1.0.0) (2020-10-22) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/crc32 |
|||
|
|||
# [1.0.0-alpha.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.4...@aws-crypto/crc32@1.0.0-alpha.0) (2020-02-07) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/crc32 |
|||
|
|||
# [0.1.0-preview.4](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.2...@aws-crypto/crc32@0.1.0-preview.4) (2020-01-16) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8) |
|||
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13) |
|||
|
|||
# [0.1.0-preview.3](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.2...@aws-crypto/crc32@0.1.0-preview.3) (2019-11-15) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8) |
|||
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13) |
|||
|
|||
# [0.1.0-preview.2](https://github.com/aws/aws-javascript-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.1...@aws-crypto/crc32@0.1.0-preview.2) (2019-10-30) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- remove /src/ from .npmignore (for sourcemaps) ([#5](https://github.com/aws/aws-javascript-crypto-helpers/issues/5)) ([ec52056](https://github.com/aws/aws-javascript-crypto-helpers/commit/ec52056)) |
|||
@ -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 {yyyy} {name of copyright owner} |
|||
|
|||
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. |
|||
@ -0,0 +1,16 @@ |
|||
# @aws-crypto/crc32 |
|||
|
|||
Pure JS implementation of CRC32 https://en.wikipedia.org/wiki/Cyclic_redundancy_check |
|||
|
|||
## Usage |
|||
|
|||
``` |
|||
import { Crc32 } from '@aws-crypto/crc32'; |
|||
|
|||
const crc32Digest = (new Crc32).update(buffer).digest() |
|||
|
|||
``` |
|||
|
|||
## Test |
|||
|
|||
`npm test` |
|||
@ -0,0 +1,7 @@ |
|||
import { SourceData, Checksum } from "@aws-sdk/types"; |
|||
export declare class AwsCrc32 implements Checksum { |
|||
private crc32; |
|||
update(toHash: SourceData): void; |
|||
digest(): Promise<Uint8Array>; |
|||
reset(): void; |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
"use strict"; |
|||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|||
// SPDX-License-Identifier: Apache-2.0
|
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.AwsCrc32 = void 0; |
|||
var tslib_1 = require("tslib"); |
|||
var util_1 = require("@aws-crypto/util"); |
|||
var index_1 = require("./index"); |
|||
var AwsCrc32 = /** @class */ (function () { |
|||
function AwsCrc32() { |
|||
this.crc32 = new index_1.Crc32(); |
|||
} |
|||
AwsCrc32.prototype.update = function (toHash) { |
|||
if ((0, util_1.isEmptyData)(toHash)) |
|||
return; |
|||
this.crc32.update((0, util_1.convertToBuffer)(toHash)); |
|||
}; |
|||
AwsCrc32.prototype.digest = function () { |
|||
return tslib_1.__awaiter(this, void 0, void 0, function () { |
|||
return tslib_1.__generator(this, function (_a) { |
|||
return [2 /*return*/, (0, util_1.numToUint8)(this.crc32.digest())]; |
|||
}); |
|||
}); |
|||
}; |
|||
AwsCrc32.prototype.reset = function () { |
|||
this.crc32 = new index_1.Crc32(); |
|||
}; |
|||
return AwsCrc32; |
|||
}()); |
|||
exports.AwsCrc32 = AwsCrc32; |
|||
//# sourceMappingURL=aws_crc32.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"aws_crc32.js","sourceRoot":"","sources":["../src/aws_crc32.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,sCAAsC;;;;AAGtC,yCAA4E;AAC5E,iCAAgC;AAEhC;IAAA;QACU,UAAK,GAAG,IAAI,aAAK,EAAE,CAAC;IAe9B,CAAC;IAbC,yBAAM,GAAN,UAAO,MAAkB;QACvB,IAAI,IAAA,kBAAW,EAAC,MAAM,CAAC;YAAE,OAAO;QAEhC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAA,sBAAe,EAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEK,yBAAM,GAAZ;;;gBACE,sBAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAC;;;KACxC;IAED,wBAAK,GAAL;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,EAAE,CAAC;IAC3B,CAAC;IACH,eAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,4BAAQ"} |
|||
@ -0,0 +1,7 @@ |
|||
export declare function crc32(data: Uint8Array): number; |
|||
export declare class Crc32 { |
|||
private checksum; |
|||
update(data: Uint8Array): this; |
|||
digest(): number; |
|||
} |
|||
export { AwsCrc32 } from "./aws_crc32"; |
|||
@ -0,0 +1,108 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.AwsCrc32 = exports.Crc32 = exports.crc32 = void 0; |
|||
var tslib_1 = require("tslib"); |
|||
var util_1 = require("@aws-crypto/util"); |
|||
function crc32(data) { |
|||
return new Crc32().update(data).digest(); |
|||
} |
|||
exports.crc32 = crc32; |
|||
var Crc32 = /** @class */ (function () { |
|||
function Crc32() { |
|||
this.checksum = 0xffffffff; |
|||
} |
|||
Crc32.prototype.update = function (data) { |
|||
var e_1, _a; |
|||
try { |
|||
for (var data_1 = tslib_1.__values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) { |
|||
var byte = data_1_1.value; |
|||
this.checksum = |
|||
(this.checksum >>> 8) ^ lookupTable[(this.checksum ^ byte) & 0xff]; |
|||
} |
|||
} |
|||
catch (e_1_1) { e_1 = { error: e_1_1 }; } |
|||
finally { |
|||
try { |
|||
if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1); |
|||
} |
|||
finally { if (e_1) throw e_1.error; } |
|||
} |
|||
return this; |
|||
}; |
|||
Crc32.prototype.digest = function () { |
|||
return (this.checksum ^ 0xffffffff) >>> 0; |
|||
}; |
|||
return Crc32; |
|||
}()); |
|||
exports.Crc32 = Crc32; |
|||
// prettier-ignore
|
|||
var a_lookUpTable = [ |
|||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, |
|||
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, |
|||
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, |
|||
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, |
|||
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, |
|||
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, |
|||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, |
|||
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, |
|||
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, |
|||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, |
|||
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, |
|||
0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, |
|||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, |
|||
0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, |
|||
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, |
|||
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, |
|||
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, |
|||
0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, |
|||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, |
|||
0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, |
|||
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, |
|||
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, |
|||
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, |
|||
0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, |
|||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, |
|||
0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, |
|||
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, |
|||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, |
|||
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, |
|||
0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, |
|||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, |
|||
0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, |
|||
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, |
|||
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, |
|||
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, |
|||
0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, |
|||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, |
|||
0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, |
|||
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, |
|||
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, |
|||
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, |
|||
0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, |
|||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, |
|||
0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, |
|||
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, |
|||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, |
|||
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, |
|||
0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, |
|||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, |
|||
0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, |
|||
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, |
|||
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, |
|||
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, |
|||
0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, |
|||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, |
|||
0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, |
|||
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, |
|||
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, |
|||
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, |
|||
0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, |
|||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, |
|||
0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, |
|||
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, |
|||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, |
|||
]; |
|||
var lookupTable = (0, util_1.uint32ArrayFrom)(a_lookUpTable); |
|||
var aws_crc32_1 = require("./aws_crc32"); |
|||
Object.defineProperty(exports, "AwsCrc32", { enumerable: true, get: function () { return aws_crc32_1.AwsCrc32; } }); |
|||
//# sourceMappingURL=index.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAiD;AAEjD,SAAgB,KAAK,CAAC,IAAgB;IACpC,OAAO,IAAI,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3C,CAAC;AAFD,sBAEC;AAED;IAAA;QACU,aAAQ,GAAG,UAAU,CAAC;IAchC,CAAC;IAZC,sBAAM,GAAN,UAAO,IAAgB;;;YACrB,KAAmB,IAAA,SAAA,iBAAA,IAAI,CAAA,0BAAA,4CAAE;gBAApB,IAAM,IAAI,iBAAA;gBACb,IAAI,CAAC,QAAQ;oBACX,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;aACtE;;;;;;;;;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sBAAM,GAAN;QACE,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IACH,YAAC;AAAD,CAAC,AAfD,IAeC;AAfY,sBAAK;AAiBlB,kBAAkB;AAClB,IAAM,aAAa,GAAG;IACpB,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/C,CAAC;AACF,IAAM,WAAW,GAAgB,IAAA,sBAAe,EAAC,aAAa,CAAC,CAAA;AAC/D,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA"} |
|||
@ -0,0 +1,15 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
@ -0,0 +1,142 @@ |
|||
# tslib |
|||
|
|||
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions. |
|||
|
|||
This library is primarily used by the `--importHelpers` flag in TypeScript. |
|||
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: |
|||
|
|||
```ts |
|||
var __assign = (this && this.__assign) || Object.assign || function(t) { |
|||
for (var s, i = 1, n = arguments.length; i < n; i++) { |
|||
s = arguments[i]; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) |
|||
t[p] = s[p]; |
|||
} |
|||
return t; |
|||
}; |
|||
exports.x = {}; |
|||
exports.y = __assign({}, exports.x); |
|||
|
|||
``` |
|||
|
|||
will instead be emitted as something like the following: |
|||
|
|||
```ts |
|||
var tslib_1 = require("tslib"); |
|||
exports.x = {}; |
|||
exports.y = tslib_1.__assign({}, exports.x); |
|||
``` |
|||
|
|||
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. |
|||
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. |
|||
|
|||
# Installing |
|||
|
|||
For the latest stable version, run: |
|||
|
|||
## npm |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
npm install tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
npm install tslib@1.6.1 |
|||
``` |
|||
|
|||
## yarn |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
yarn add tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
yarn add tslib@1.6.1 |
|||
``` |
|||
|
|||
## bower |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
bower install tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
bower install tslib@1.6.1 |
|||
``` |
|||
|
|||
## JSPM |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
jspm install tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
jspm install tslib@1.6.1 |
|||
``` |
|||
|
|||
# Usage |
|||
|
|||
Set the `importHelpers` compiler option on the command line: |
|||
|
|||
``` |
|||
tsc --importHelpers file.ts |
|||
``` |
|||
|
|||
or in your tsconfig.json: |
|||
|
|||
```json |
|||
{ |
|||
"compilerOptions": { |
|||
"importHelpers": true |
|||
} |
|||
} |
|||
``` |
|||
|
|||
#### For bower and JSPM users |
|||
|
|||
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: |
|||
|
|||
```json |
|||
{ |
|||
"compilerOptions": { |
|||
"module": "amd", |
|||
"importHelpers": true, |
|||
"baseUrl": "./", |
|||
"paths": { |
|||
"tslib" : ["bower_components/tslib/tslib.d.ts"] |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
For JSPM users: |
|||
|
|||
```json |
|||
{ |
|||
"compilerOptions": { |
|||
"module": "system", |
|||
"importHelpers": true, |
|||
"baseUrl": "./", |
|||
"paths": { |
|||
"tslib" : ["jspm_packages/npm/tslib@1.[version].0/tslib.d.ts"] |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
|
|||
# Contribute |
|||
|
|||
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. |
|||
|
|||
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. |
|||
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). |
|||
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). |
|||
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. |
|||
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). |
|||
|
|||
# Documentation |
|||
|
|||
* [Quick tutorial](http://www.typescriptlang.org/Tutorial) |
|||
* [Programming handbook](http://www.typescriptlang.org/Handbook) |
|||
* [Homepage](http://www.typescriptlang.org/) |
|||
@ -0,0 +1,51 @@ |
|||
import tslib from '../tslib.js'; |
|||
const { |
|||
__extends, |
|||
__assign, |
|||
__rest, |
|||
__decorate, |
|||
__param, |
|||
__metadata, |
|||
__awaiter, |
|||
__generator, |
|||
__exportStar, |
|||
__createBinding, |
|||
__values, |
|||
__read, |
|||
__spread, |
|||
__spreadArrays, |
|||
__await, |
|||
__asyncGenerator, |
|||
__asyncDelegator, |
|||
__asyncValues, |
|||
__makeTemplateObject, |
|||
__importStar, |
|||
__importDefault, |
|||
__classPrivateFieldGet, |
|||
__classPrivateFieldSet, |
|||
} = tslib; |
|||
export { |
|||
__extends, |
|||
__assign, |
|||
__rest, |
|||
__decorate, |
|||
__param, |
|||
__metadata, |
|||
__awaiter, |
|||
__generator, |
|||
__exportStar, |
|||
__createBinding, |
|||
__values, |
|||
__read, |
|||
__spread, |
|||
__spreadArrays, |
|||
__await, |
|||
__asyncGenerator, |
|||
__asyncDelegator, |
|||
__asyncValues, |
|||
__makeTemplateObject, |
|||
__importStar, |
|||
__importDefault, |
|||
__classPrivateFieldGet, |
|||
__classPrivateFieldSet, |
|||
}; |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"type": "module" |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
{ |
|||
"name": "tslib", |
|||
"author": "Microsoft Corp.", |
|||
"homepage": "https://www.typescriptlang.org/", |
|||
"version": "1.14.1", |
|||
"license": "0BSD", |
|||
"description": "Runtime library for TypeScript helper functions", |
|||
"keywords": [ |
|||
"TypeScript", |
|||
"Microsoft", |
|||
"compiler", |
|||
"language", |
|||
"javascript", |
|||
"tslib", |
|||
"runtime" |
|||
], |
|||
"bugs": { |
|||
"url": "https://github.com/Microsoft/TypeScript/issues" |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "https://github.com/Microsoft/tslib.git" |
|||
}, |
|||
"main": "tslib.js", |
|||
"module": "tslib.es6.js", |
|||
"jsnext:main": "tslib.es6.js", |
|||
"typings": "tslib.d.ts", |
|||
"sideEffects": false, |
|||
"exports": { |
|||
".": { |
|||
"module": "./tslib.es6.js", |
|||
"import": "./modules/index.js", |
|||
"default": "./tslib.js" |
|||
}, |
|||
"./": "./" |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
// When on node 14, it validates that all of the commonjs exports
|
|||
// are correctly re-exported for es modules importers.
|
|||
|
|||
const nodeMajor = Number(process.version.split(".")[0].slice(1)) |
|||
if (nodeMajor < 14) { |
|||
console.log("Skipping because node does not support module exports.") |
|||
process.exit(0) |
|||
} |
|||
|
|||
// ES Modules import via the ./modules folder
|
|||
import * as esTSLib from "../../modules/index.js" |
|||
|
|||
// Force a commonjs resolve
|
|||
import { createRequire } from "module"; |
|||
const commonJSTSLib = createRequire(import.meta.url)("../../tslib.js"); |
|||
|
|||
for (const key in commonJSTSLib) { |
|||
if (commonJSTSLib.hasOwnProperty(key)) { |
|||
if(!esTSLib[key]) throw new Error(`ESModules is missing ${key} - it needs to be re-exported in ./modules/index.js`) |
|||
} |
|||
} |
|||
|
|||
console.log("All exports in commonjs are available for es module consumers.") |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"type": "module", |
|||
"scripts": { |
|||
"test": "node index.js" |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
export declare function __extends(d: Function, b: Function): void; |
|||
export declare function __assign(t: any, ...sources: any[]): any; |
|||
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; |
|||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; |
|||
export declare function __param(paramIndex: number, decorator: Function): Function; |
|||
export declare function __metadata(metadataKey: any, metadataValue: any): Function; |
|||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; |
|||
export declare function __generator(thisArg: any, body: Function): any; |
|||
export declare function __exportStar(m: any, exports: any): void; |
|||
export declare function __values(o: any): any; |
|||
export declare function __read(o: any, n?: number): any[]; |
|||
export declare function __spread(...args: any[][]): any[]; |
|||
export declare function __spreadArrays(...args: any[][]): any[]; |
|||
export declare function __await(v: any): any; |
|||
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; |
|||
export declare function __asyncDelegator(o: any): any; |
|||
export declare function __asyncValues(o: any): any; |
|||
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; |
|||
export declare function __importStar<T>(mod: T): T; |
|||
export declare function __importDefault<T>(mod: T): T | { default: T }; |
|||
export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; |
|||
export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; |
|||
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; |
|||
@ -0,0 +1 @@ |
|||
<script src="tslib.es6.js"></script> |
|||
@ -0,0 +1,218 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
/* global Reflect, Promise */ |
|||
|
|||
var extendStatics = function(d, b) { |
|||
extendStatics = Object.setPrototypeOf || |
|||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
|||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
|||
return extendStatics(d, b); |
|||
}; |
|||
|
|||
export function __extends(d, b) { |
|||
extendStatics(d, b); |
|||
function __() { this.constructor = d; } |
|||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|||
} |
|||
|
|||
export var __assign = function() { |
|||
__assign = Object.assign || function __assign(t) { |
|||
for (var s, i = 1, n = arguments.length; i < n; i++) { |
|||
s = arguments[i]; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
|||
} |
|||
return t; |
|||
} |
|||
return __assign.apply(this, arguments); |
|||
} |
|||
|
|||
export function __rest(s, e) { |
|||
var t = {}; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
|||
t[p] = s[p]; |
|||
if (s != null && typeof Object.getOwnPropertySymbols === "function") |
|||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { |
|||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) |
|||
t[p[i]] = s[p[i]]; |
|||
} |
|||
return t; |
|||
} |
|||
|
|||
export function __decorate(decorators, target, key, desc) { |
|||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
|||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
|||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
|||
return c > 3 && r && Object.defineProperty(target, key, r), r; |
|||
} |
|||
|
|||
export function __param(paramIndex, decorator) { |
|||
return function (target, key) { decorator(target, key, paramIndex); } |
|||
} |
|||
|
|||
export function __metadata(metadataKey, metadataValue) { |
|||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); |
|||
} |
|||
|
|||
export function __awaiter(thisArg, _arguments, P, generator) { |
|||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
|||
return new (P || (P = Promise))(function (resolve, reject) { |
|||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
|||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
|||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
|||
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
|||
}); |
|||
} |
|||
|
|||
export function __generator(thisArg, body) { |
|||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
|||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
|||
function verb(n) { return function (v) { return step([n, v]); }; } |
|||
function step(op) { |
|||
if (f) throw new TypeError("Generator is already executing."); |
|||
while (_) try { |
|||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
|||
if (y = 0, t) op = [op[0] & 2, t.value]; |
|||
switch (op[0]) { |
|||
case 0: case 1: t = op; break; |
|||
case 4: _.label++; return { value: op[1], done: false }; |
|||
case 5: _.label++; y = op[1]; op = [0]; continue; |
|||
case 7: op = _.ops.pop(); _.trys.pop(); continue; |
|||
default: |
|||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
|||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
|||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
|||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
|||
if (t[2]) _.ops.pop(); |
|||
_.trys.pop(); continue; |
|||
} |
|||
op = body.call(thisArg, _); |
|||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
|||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
|||
} |
|||
} |
|||
|
|||
export function __createBinding(o, m, k, k2) { |
|||
if (k2 === undefined) k2 = k; |
|||
o[k2] = m[k]; |
|||
} |
|||
|
|||
export function __exportStar(m, exports) { |
|||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; |
|||
} |
|||
|
|||
export function __values(o) { |
|||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; |
|||
if (m) return m.call(o); |
|||
if (o && typeof o.length === "number") return { |
|||
next: function () { |
|||
if (o && i >= o.length) o = void 0; |
|||
return { value: o && o[i++], done: !o }; |
|||
} |
|||
}; |
|||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); |
|||
} |
|||
|
|||
export function __read(o, n) { |
|||
var m = typeof Symbol === "function" && o[Symbol.iterator]; |
|||
if (!m) return o; |
|||
var i = m.call(o), r, ar = [], e; |
|||
try { |
|||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); |
|||
} |
|||
catch (error) { e = { error: error }; } |
|||
finally { |
|||
try { |
|||
if (r && !r.done && (m = i["return"])) m.call(i); |
|||
} |
|||
finally { if (e) throw e.error; } |
|||
} |
|||
return ar; |
|||
} |
|||
|
|||
export function __spread() { |
|||
for (var ar = [], i = 0; i < arguments.length; i++) |
|||
ar = ar.concat(__read(arguments[i])); |
|||
return ar; |
|||
} |
|||
|
|||
export function __spreadArrays() { |
|||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; |
|||
for (var r = Array(s), k = 0, i = 0; i < il; i++) |
|||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) |
|||
r[k] = a[j]; |
|||
return r; |
|||
}; |
|||
|
|||
export function __await(v) { |
|||
return this instanceof __await ? (this.v = v, this) : new __await(v); |
|||
} |
|||
|
|||
export function __asyncGenerator(thisArg, _arguments, generator) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var g = generator.apply(thisArg, _arguments || []), i, q = []; |
|||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; |
|||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } |
|||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } |
|||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } |
|||
function fulfill(value) { resume("next", value); } |
|||
function reject(value) { resume("throw", value); } |
|||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } |
|||
} |
|||
|
|||
export function __asyncDelegator(o) { |
|||
var i, p; |
|||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; |
|||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } |
|||
} |
|||
|
|||
export function __asyncValues(o) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var m = o[Symbol.asyncIterator], i; |
|||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); |
|||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } |
|||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } |
|||
} |
|||
|
|||
export function __makeTemplateObject(cooked, raw) { |
|||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } |
|||
return cooked; |
|||
}; |
|||
|
|||
export function __importStar(mod) { |
|||
if (mod && mod.__esModule) return mod; |
|||
var result = {}; |
|||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; |
|||
result.default = mod; |
|||
return result; |
|||
} |
|||
|
|||
export function __importDefault(mod) { |
|||
return (mod && mod.__esModule) ? mod : { default: mod }; |
|||
} |
|||
|
|||
export function __classPrivateFieldGet(receiver, privateMap) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to get private field on non-instance"); |
|||
} |
|||
return privateMap.get(receiver); |
|||
} |
|||
|
|||
export function __classPrivateFieldSet(receiver, privateMap, value) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to set private field on non-instance"); |
|||
} |
|||
privateMap.set(receiver, value); |
|||
return value; |
|||
} |
|||
@ -0,0 +1 @@ |
|||
<script src="tslib.js"></script> |
|||
@ -0,0 +1,284 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
|
|||
/* global global, define, System, Reflect, Promise */ |
|||
var __extends; |
|||
var __assign; |
|||
var __rest; |
|||
var __decorate; |
|||
var __param; |
|||
var __metadata; |
|||
var __awaiter; |
|||
var __generator; |
|||
var __exportStar; |
|||
var __values; |
|||
var __read; |
|||
var __spread; |
|||
var __spreadArrays; |
|||
var __await; |
|||
var __asyncGenerator; |
|||
var __asyncDelegator; |
|||
var __asyncValues; |
|||
var __makeTemplateObject; |
|||
var __importStar; |
|||
var __importDefault; |
|||
var __classPrivateFieldGet; |
|||
var __classPrivateFieldSet; |
|||
var __createBinding; |
|||
(function (factory) { |
|||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; |
|||
if (typeof define === "function" && define.amd) { |
|||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); |
|||
} |
|||
else if (typeof module === "object" && typeof module.exports === "object") { |
|||
factory(createExporter(root, createExporter(module.exports))); |
|||
} |
|||
else { |
|||
factory(createExporter(root)); |
|||
} |
|||
function createExporter(exports, previous) { |
|||
if (exports !== root) { |
|||
if (typeof Object.create === "function") { |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
} |
|||
else { |
|||
exports.__esModule = true; |
|||
} |
|||
} |
|||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; |
|||
} |
|||
}) |
|||
(function (exporter) { |
|||
var extendStatics = Object.setPrototypeOf || |
|||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
|||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
|||
|
|||
__extends = function (d, b) { |
|||
extendStatics(d, b); |
|||
function __() { this.constructor = d; } |
|||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|||
}; |
|||
|
|||
__assign = Object.assign || function (t) { |
|||
for (var s, i = 1, n = arguments.length; i < n; i++) { |
|||
s = arguments[i]; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
|||
} |
|||
return t; |
|||
}; |
|||
|
|||
__rest = function (s, e) { |
|||
var t = {}; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
|||
t[p] = s[p]; |
|||
if (s != null && typeof Object.getOwnPropertySymbols === "function") |
|||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { |
|||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) |
|||
t[p[i]] = s[p[i]]; |
|||
} |
|||
return t; |
|||
}; |
|||
|
|||
__decorate = function (decorators, target, key, desc) { |
|||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
|||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
|||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
|||
return c > 3 && r && Object.defineProperty(target, key, r), r; |
|||
}; |
|||
|
|||
__param = function (paramIndex, decorator) { |
|||
return function (target, key) { decorator(target, key, paramIndex); } |
|||
}; |
|||
|
|||
__metadata = function (metadataKey, metadataValue) { |
|||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); |
|||
}; |
|||
|
|||
__awaiter = function (thisArg, _arguments, P, generator) { |
|||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
|||
return new (P || (P = Promise))(function (resolve, reject) { |
|||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
|||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
|||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
|||
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
|||
}); |
|||
}; |
|||
|
|||
__generator = function (thisArg, body) { |
|||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
|||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
|||
function verb(n) { return function (v) { return step([n, v]); }; } |
|||
function step(op) { |
|||
if (f) throw new TypeError("Generator is already executing."); |
|||
while (_) try { |
|||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
|||
if (y = 0, t) op = [op[0] & 2, t.value]; |
|||
switch (op[0]) { |
|||
case 0: case 1: t = op; break; |
|||
case 4: _.label++; return { value: op[1], done: false }; |
|||
case 5: _.label++; y = op[1]; op = [0]; continue; |
|||
case 7: op = _.ops.pop(); _.trys.pop(); continue; |
|||
default: |
|||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
|||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
|||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
|||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
|||
if (t[2]) _.ops.pop(); |
|||
_.trys.pop(); continue; |
|||
} |
|||
op = body.call(thisArg, _); |
|||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
|||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
|||
} |
|||
}; |
|||
|
|||
__createBinding = function(o, m, k, k2) { |
|||
if (k2 === undefined) k2 = k; |
|||
o[k2] = m[k]; |
|||
}; |
|||
|
|||
__exportStar = function (m, exports) { |
|||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; |
|||
}; |
|||
|
|||
__values = function (o) { |
|||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; |
|||
if (m) return m.call(o); |
|||
if (o && typeof o.length === "number") return { |
|||
next: function () { |
|||
if (o && i >= o.length) o = void 0; |
|||
return { value: o && o[i++], done: !o }; |
|||
} |
|||
}; |
|||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); |
|||
}; |
|||
|
|||
__read = function (o, n) { |
|||
var m = typeof Symbol === "function" && o[Symbol.iterator]; |
|||
if (!m) return o; |
|||
var i = m.call(o), r, ar = [], e; |
|||
try { |
|||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); |
|||
} |
|||
catch (error) { e = { error: error }; } |
|||
finally { |
|||
try { |
|||
if (r && !r.done && (m = i["return"])) m.call(i); |
|||
} |
|||
finally { if (e) throw e.error; } |
|||
} |
|||
return ar; |
|||
}; |
|||
|
|||
__spread = function () { |
|||
for (var ar = [], i = 0; i < arguments.length; i++) |
|||
ar = ar.concat(__read(arguments[i])); |
|||
return ar; |
|||
}; |
|||
|
|||
__spreadArrays = function () { |
|||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; |
|||
for (var r = Array(s), k = 0, i = 0; i < il; i++) |
|||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) |
|||
r[k] = a[j]; |
|||
return r; |
|||
}; |
|||
|
|||
__await = function (v) { |
|||
return this instanceof __await ? (this.v = v, this) : new __await(v); |
|||
}; |
|||
|
|||
__asyncGenerator = function (thisArg, _arguments, generator) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var g = generator.apply(thisArg, _arguments || []), i, q = []; |
|||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; |
|||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } |
|||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } |
|||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } |
|||
function fulfill(value) { resume("next", value); } |
|||
function reject(value) { resume("throw", value); } |
|||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } |
|||
}; |
|||
|
|||
__asyncDelegator = function (o) { |
|||
var i, p; |
|||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; |
|||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } |
|||
}; |
|||
|
|||
__asyncValues = function (o) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var m = o[Symbol.asyncIterator], i; |
|||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); |
|||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } |
|||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } |
|||
}; |
|||
|
|||
__makeTemplateObject = function (cooked, raw) { |
|||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } |
|||
return cooked; |
|||
}; |
|||
|
|||
__importStar = function (mod) { |
|||
if (mod && mod.__esModule) return mod; |
|||
var result = {}; |
|||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; |
|||
result["default"] = mod; |
|||
return result; |
|||
}; |
|||
|
|||
__importDefault = function (mod) { |
|||
return (mod && mod.__esModule) ? mod : { "default": mod }; |
|||
}; |
|||
|
|||
__classPrivateFieldGet = function (receiver, privateMap) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to get private field on non-instance"); |
|||
} |
|||
return privateMap.get(receiver); |
|||
}; |
|||
|
|||
__classPrivateFieldSet = function (receiver, privateMap, value) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to set private field on non-instance"); |
|||
} |
|||
privateMap.set(receiver, value); |
|||
return value; |
|||
}; |
|||
|
|||
exporter("__extends", __extends); |
|||
exporter("__assign", __assign); |
|||
exporter("__rest", __rest); |
|||
exporter("__decorate", __decorate); |
|||
exporter("__param", __param); |
|||
exporter("__metadata", __metadata); |
|||
exporter("__awaiter", __awaiter); |
|||
exporter("__generator", __generator); |
|||
exporter("__exportStar", __exportStar); |
|||
exporter("__createBinding", __createBinding); |
|||
exporter("__values", __values); |
|||
exporter("__read", __read); |
|||
exporter("__spread", __spread); |
|||
exporter("__spreadArrays", __spreadArrays); |
|||
exporter("__await", __await); |
|||
exporter("__asyncGenerator", __asyncGenerator); |
|||
exporter("__asyncDelegator", __asyncDelegator); |
|||
exporter("__asyncValues", __asyncValues); |
|||
exporter("__makeTemplateObject", __makeTemplateObject); |
|||
exporter("__importStar", __importStar); |
|||
exporter("__importDefault", __importDefault); |
|||
exporter("__classPrivateFieldGet", __classPrivateFieldGet); |
|||
exporter("__classPrivateFieldSet", __classPrivateFieldSet); |
|||
}); |
|||
@ -0,0 +1,28 @@ |
|||
{ |
|||
"name": "@aws-crypto/crc32", |
|||
"version": "3.0.0", |
|||
"scripts": { |
|||
"prepublishOnly": "tsc", |
|||
"pretest": "tsc -p tsconfig.test.json", |
|||
"test": "mocha --require ts-node/register test/**/*test.ts" |
|||
}, |
|||
"main": "./build/index.js", |
|||
"types": "./build/index.d.ts", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git@github.com:aws/aws-sdk-js-crypto-helpers.git" |
|||
}, |
|||
"author": { |
|||
"name": "AWS Crypto Tools Team", |
|||
"email": "aws-cryptools@amazon.com", |
|||
"url": "https://docs.aws.amazon.com/aws-crypto-tools/index.html?id=docs_gateway#lang/en_us" |
|||
}, |
|||
"homepage": "https://github.com/aws/aws-sdk-js-crypto-helpers/tree/master/packages/crc32", |
|||
"license": "Apache-2.0", |
|||
"dependencies": { |
|||
"@aws-crypto/util": "^3.0.0", |
|||
"@aws-sdk/types": "^3.222.0", |
|||
"tslib": "^1.11.1" |
|||
}, |
|||
"gitHead": "7f56cee8f62bd65cd397eeec29c3c997215bd80c" |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
|||
// SPDX-License-Identifier: Apache-2.0
|
|||
|
|||
import { SourceData, Checksum } from "@aws-sdk/types"; |
|||
import { convertToBuffer, isEmptyData, numToUint8 } from "@aws-crypto/util"; |
|||
import { Crc32 } from "./index"; |
|||
|
|||
export class AwsCrc32 implements Checksum { |
|||
private crc32 = new Crc32(); |
|||
|
|||
update(toHash: SourceData) { |
|||
if (isEmptyData(toHash)) return; |
|||
|
|||
this.crc32.update(convertToBuffer(toHash)); |
|||
} |
|||
|
|||
async digest(): Promise<Uint8Array> { |
|||
return numToUint8(this.crc32.digest()); |
|||
} |
|||
|
|||
reset(): void { |
|||
this.crc32 = new Crc32(); |
|||
} |
|||
} |
|||
@ -0,0 +1,92 @@ |
|||
import {uint32ArrayFrom} from "@aws-crypto/util"; |
|||
|
|||
export function crc32(data: Uint8Array): number { |
|||
return new Crc32().update(data).digest(); |
|||
} |
|||
|
|||
export class Crc32 { |
|||
private checksum = 0xffffffff; |
|||
|
|||
update(data: Uint8Array): this { |
|||
for (const byte of data) { |
|||
this.checksum = |
|||
(this.checksum >>> 8) ^ lookupTable[(this.checksum ^ byte) & 0xff]; |
|||
} |
|||
|
|||
return this; |
|||
} |
|||
|
|||
digest(): number { |
|||
return (this.checksum ^ 0xffffffff) >>> 0; |
|||
} |
|||
} |
|||
|
|||
// prettier-ignore
|
|||
const a_lookUpTable = [ |
|||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, |
|||
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, |
|||
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, |
|||
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, |
|||
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, |
|||
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, |
|||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, |
|||
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, |
|||
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, |
|||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, |
|||
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, |
|||
0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, |
|||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, |
|||
0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, |
|||
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, |
|||
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, |
|||
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, |
|||
0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, |
|||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, |
|||
0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, |
|||
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, |
|||
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, |
|||
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, |
|||
0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, |
|||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, |
|||
0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, |
|||
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, |
|||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, |
|||
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, |
|||
0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, |
|||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, |
|||
0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, |
|||
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, |
|||
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, |
|||
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, |
|||
0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, |
|||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, |
|||
0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, |
|||
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, |
|||
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, |
|||
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, |
|||
0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, |
|||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, |
|||
0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, |
|||
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, |
|||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, |
|||
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, |
|||
0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, |
|||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, |
|||
0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, |
|||
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, |
|||
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, |
|||
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, |
|||
0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, |
|||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, |
|||
0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, |
|||
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, |
|||
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, |
|||
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, |
|||
0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, |
|||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, |
|||
0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, |
|||
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, |
|||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, |
|||
]; |
|||
const lookupTable: Uint32Array = uint32ArrayFrom(a_lookUpTable) |
|||
export { AwsCrc32 } from "./aws_crc32"; |
|||
@ -0,0 +1,23 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"target": "es5", |
|||
"module": "commonjs", |
|||
"declaration": true, |
|||
"strict": true, |
|||
"sourceMap": true, |
|||
"downlevelIteration": true, |
|||
"importHelpers": true, |
|||
"noEmitHelpers": true, |
|||
"lib": [ |
|||
"es5", |
|||
"es2015.promise", |
|||
"es2015.collection", |
|||
"es2015.iterable", |
|||
"es2015.symbol.wellknown" |
|||
], |
|||
"rootDir": "./src", |
|||
"outDir": "./build" |
|||
}, |
|||
"include": ["src/**/*.ts"], |
|||
"exclude": ["node_modules/**"] |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
# Change Log |
|||
|
|||
All notable changes to this project will be documented in this file. |
|||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. |
|||
|
|||
# [3.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.2...v3.0.0) (2023-01-12) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/ie11-detection |
|||
|
|||
## [2.0.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.1...v2.0.2) (2022-09-07) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/ie11-detection |
|||
|
|||
# [2.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.2...v2.0.0) (2021-10-25) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/ie11-detection |
|||
|
|||
# [1.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/ie11-detection@1.0.0-alpha.0...@aws-crypto/ie11-detection@1.0.0) (2020-10-22) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- replace `sourceRoot` -> `rootDir` in tsconfig ([#169](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/169)) ([d437167](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/d437167b51d1c56a4fcc2bb8a446b74a7e3b7e06)) |
|||
|
|||
# [1.0.0-alpha.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/ie11-detection@0.1.0-preview.4...@aws-crypto/ie11-detection@1.0.0-alpha.0) (2020-02-07) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/ie11-detection |
|||
|
|||
# [0.1.0-preview.4](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/ie11-detection@0.1.0-preview.2...@aws-crypto/ie11-detection@0.1.0-preview.4) (2020-01-16) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8) |
|||
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13) |
|||
|
|||
# [0.1.0-preview.3](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/ie11-detection@0.1.0-preview.2...@aws-crypto/ie11-detection@0.1.0-preview.3) (2019-11-15) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8) |
|||
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13) |
|||
|
|||
# [0.1.0-preview.2](https://github.com/aws/aws-javascript-crypto-helpers/compare/@aws-crypto/ie11-detection@0.1.0-preview.1...@aws-crypto/ie11-detection@0.1.0-preview.2) (2019-10-30) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- remove /src/ from .npmignore (for sourcemaps) ([#5](https://github.com/aws/aws-javascript-crypto-helpers/issues/5)) ([ec52056](https://github.com/aws/aws-javascript-crypto-helpers/commit/ec52056)) |
|||
@ -0,0 +1,202 @@ |
|||
|
|||
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 [yyyy] [name of copyright owner] |
|||
|
|||
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. |
|||
@ -0,0 +1,20 @@ |
|||
# @aws-crypto/ie11-detection |
|||
|
|||
Functions for interact with IE11 browsers Crypto. The IE11 `window.subtle` functions are unique. |
|||
This library is used to identify an IE11 `window` and then offering types for crypto functions. |
|||
For example see @aws-crypto/random-source-browser |
|||
|
|||
## Usage |
|||
|
|||
``` |
|||
import {isMsWindow} from '@aws-crypto/ie11-detection' |
|||
|
|||
if (isMsWindow(window)) { |
|||
// use `window.subtle.mscrypto` |
|||
} |
|||
|
|||
``` |
|||
|
|||
## Test |
|||
|
|||
`npm test` |
|||
@ -0,0 +1,19 @@ |
|||
import { Key } from "./Key"; |
|||
/** |
|||
* Represents a cryptographic operation that has been instantiated but not |
|||
* necessarily fed all data or finalized. |
|||
* |
|||
* @see https://msdn.microsoft.com/en-us/library/dn280996(v=vs.85).aspx
|
|||
*/ |
|||
export interface CryptoOperation { |
|||
readonly algorithm: string; |
|||
readonly key: Key; |
|||
onabort: (event: Event) => void; |
|||
oncomplete: (event: Event) => void; |
|||
onerror: (event: Event) => void; |
|||
onprogress: (event: Event) => void; |
|||
readonly result: ArrayBuffer | undefined; |
|||
abort(): void; |
|||
finish(): void; |
|||
process(buffer: ArrayBufferView): void; |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
//# sourceMappingURL=CryptoOperation.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"CryptoOperation.js","sourceRoot":"","sources":["../src/CryptoOperation.ts"],"names":[],"mappings":""} |
|||
@ -0,0 +1,12 @@ |
|||
/** |
|||
* The result of a successful KeyOperation. |
|||
* |
|||
* @see {KeyOperation} |
|||
* @see https://msdn.microsoft.com/en-us/library/dn302313(v=vs.85).aspx
|
|||
*/ |
|||
export interface Key { |
|||
readonly algorithm: string; |
|||
readonly extractable: boolean; |
|||
readonly keyUsage: Array<string>; |
|||
readonly type: string; |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
//# sourceMappingURL=Key.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"Key.js","sourceRoot":"","sources":["../src/Key.ts"],"names":[],"mappings":""} |
|||
@ -0,0 +1,12 @@ |
|||
import { Key } from "./Key"; |
|||
/** |
|||
* Represents the return of a key-related operation that may or may not have |
|||
* been completed. |
|||
* |
|||
* @see https://msdn.microsoft.com/en-us/library/dn302314(v=vs.85).aspx
|
|||
*/ |
|||
export interface KeyOperation { |
|||
oncomplete: (event: Event) => void; |
|||
onerror: (event: Event) => void; |
|||
readonly result: Key | undefined; |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
//# sourceMappingURL=KeyOperation.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"KeyOperation.js","sourceRoot":"","sources":["../src/KeyOperation.ts"],"names":[],"mappings":""} |
|||
@ -0,0 +1,33 @@ |
|||
import { CryptoOperation } from "./CryptoOperation"; |
|||
import { Key } from "./Key"; |
|||
import { KeyOperation } from "./KeyOperation"; |
|||
export type KeyUsage = "encrypt" | "decrypt" | "sign" | "verify" | "derive" | "wrapKey" | "unwrapKey" | "importKey"; |
|||
export type EncryptionOrVerificationAlgorithm = "RSAES-PKCS1-v1_5"; |
|||
export type Ie11EncryptionAlgorithm = "AES-CBC" | "AES-GCM" | "RSA-OAEP" | EncryptionOrVerificationAlgorithm; |
|||
export type Ie11DigestAlgorithm = "SHA-1" | "SHA-256" | "SHA-384"; |
|||
export interface HashAlgorithm { |
|||
name: Ie11DigestAlgorithm; |
|||
} |
|||
export interface HmacAlgorithm { |
|||
name: "HMAC"; |
|||
hash: HashAlgorithm; |
|||
} |
|||
export type SigningAlgorithm = HmacAlgorithm; |
|||
/** |
|||
* Represent ths SubtleCrypto interface as implemented in Internet Explorer 11. |
|||
* This implementation was based on an earlier version of the WebCrypto API and |
|||
* differs from the `window.crypto.subtle` object exposed in Chrome, Safari, |
|||
* Firefox, and MS Edge. |
|||
* |
|||
* @see https://msdn.microsoft.com/en-us/library/dn302325(v=vs.85).aspx
|
|||
*/ |
|||
export interface MsSubtleCrypto { |
|||
decrypt(algorithm: Ie11EncryptionAlgorithm, key: Key, buffer?: ArrayBufferView): CryptoOperation; |
|||
digest(algorithm: Ie11DigestAlgorithm, buffer?: ArrayBufferView): CryptoOperation; |
|||
encrypt(algorithm: Ie11EncryptionAlgorithm, key: Key, buffer?: ArrayBufferView): CryptoOperation; |
|||
exportKey(format: string, key: Key): KeyOperation; |
|||
generateKey(algorithm: SigningAlgorithm | Ie11EncryptionAlgorithm, extractable?: boolean, keyUsages?: Array<KeyUsage>): KeyOperation; |
|||
importKey(format: string, keyData: ArrayBufferView, algorithm: any, extractable?: boolean, keyUsages?: Array<KeyUsage>): KeyOperation; |
|||
sign(algorithm: SigningAlgorithm, key: Key, buffer?: ArrayBufferView): CryptoOperation; |
|||
verify(algorithm: SigningAlgorithm | EncryptionOrVerificationAlgorithm, key: Key, signature: ArrayBufferView, buffer?: ArrayBufferView): CryptoOperation; |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
//# sourceMappingURL=MsSubtleCrypto.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"MsSubtleCrypto.js","sourceRoot":"","sources":["../src/MsSubtleCrypto.ts"],"names":[],"mappings":""} |
|||
@ -0,0 +1,21 @@ |
|||
import { MsSubtleCrypto } from "./MsSubtleCrypto"; |
|||
/** |
|||
* The value accessible as `window.msCrypto` in Internet Explorer 11. |
|||
*/ |
|||
export interface MsCrypto { |
|||
getRandomValues: (toFill: Uint8Array) => void; |
|||
subtle: MsSubtleCrypto; |
|||
} |
|||
/** |
|||
* The `window` object in Internet Explorer 11. This interface does not |
|||
* exhaustively document the prefixed features of `window` in IE11. |
|||
*/ |
|||
export interface MsWindow extends Window { |
|||
MSInputMethodContext: any; |
|||
msCrypto: MsCrypto; |
|||
} |
|||
/** |
|||
* Determines if the provided window is (or is like) the window object one would |
|||
* expect to encounter in Internet Explorer 11. |
|||
*/ |
|||
export declare function isMsWindow(window: Window): window is MsWindow; |
|||
@ -0,0 +1,32 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.isMsWindow = void 0; |
|||
var msSubtleCryptoMethods = [ |
|||
"decrypt", |
|||
"digest", |
|||
"encrypt", |
|||
"exportKey", |
|||
"generateKey", |
|||
"importKey", |
|||
"sign", |
|||
"verify" |
|||
]; |
|||
function quacksLikeAnMsWindow(window) { |
|||
return "MSInputMethodContext" in window && "msCrypto" in window; |
|||
} |
|||
/** |
|||
* Determines if the provided window is (or is like) the window object one would |
|||
* expect to encounter in Internet Explorer 11. |
|||
*/ |
|||
function isMsWindow(window) { |
|||
if (quacksLikeAnMsWindow(window) && window.msCrypto.subtle !== undefined) { |
|||
var _a = window.msCrypto, getRandomValues = _a.getRandomValues, subtle_1 = _a.subtle; |
|||
return msSubtleCryptoMethods |
|||
.map(function (methodName) { return subtle_1[methodName]; }) |
|||
.concat(getRandomValues) |
|||
.every(function (method) { return typeof method === "function"; }); |
|||
} |
|||
return false; |
|||
} |
|||
exports.isMsWindow = isMsWindow; |
|||
//# sourceMappingURL=MsWindow.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"MsWindow.js","sourceRoot":"","sources":["../src/MsWindow.ts"],"names":[],"mappings":";;;AAYA,IAAM,qBAAqB,GAA8B;IACvD,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;IACX,aAAa;IACb,WAAW;IACX,MAAM;IACN,QAAQ;CACT,CAAC;AAmBF,SAAS,oBAAoB,CAAC,MAAc;IAC1C,OAAO,sBAAsB,IAAI,MAAM,IAAI,UAAU,IAAI,MAAM,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,MAAc;IACvC,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;QAClE,IAAA,KAA8B,MAAM,CAAC,QAAQ,EAA3C,eAAe,qBAAA,EAAE,QAAM,YAAoB,CAAC;QACpD,OAAO,qBAAqB;aACzB,GAAG,CAAW,UAAA,UAAU,IAAI,OAAA,QAAM,CAAC,UAAU,CAAC,EAAlB,CAAkB,CAAC;aAC/C,MAAM,CAAC,eAAe,CAAC;aACvB,KAAK,CAAC,UAAA,MAAM,IAAI,OAAA,OAAO,MAAM,KAAK,UAAU,EAA5B,CAA4B,CAAC,CAAC;KAClD;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,gCAUC"} |
|||
@ -0,0 +1,5 @@ |
|||
export * from "./CryptoOperation"; |
|||
export * from "./Key"; |
|||
export * from "./KeyOperation"; |
|||
export * from "./MsSubtleCrypto"; |
|||
export * from "./MsWindow"; |
|||
@ -0,0 +1,9 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
var tslib_1 = require("tslib"); |
|||
tslib_1.__exportStar(require("./CryptoOperation"), exports); |
|||
tslib_1.__exportStar(require("./Key"), exports); |
|||
tslib_1.__exportStar(require("./KeyOperation"), exports); |
|||
tslib_1.__exportStar(require("./MsSubtleCrypto"), exports); |
|||
tslib_1.__exportStar(require("./MsWindow"), exports); |
|||
//# sourceMappingURL=index.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,gDAAsB;AACtB,yDAA+B;AAC/B,2DAAiC;AACjC,qDAA2B"} |
|||
@ -0,0 +1,15 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
@ -0,0 +1,142 @@ |
|||
# tslib |
|||
|
|||
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions. |
|||
|
|||
This library is primarily used by the `--importHelpers` flag in TypeScript. |
|||
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: |
|||
|
|||
```ts |
|||
var __assign = (this && this.__assign) || Object.assign || function(t) { |
|||
for (var s, i = 1, n = arguments.length; i < n; i++) { |
|||
s = arguments[i]; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) |
|||
t[p] = s[p]; |
|||
} |
|||
return t; |
|||
}; |
|||
exports.x = {}; |
|||
exports.y = __assign({}, exports.x); |
|||
|
|||
``` |
|||
|
|||
will instead be emitted as something like the following: |
|||
|
|||
```ts |
|||
var tslib_1 = require("tslib"); |
|||
exports.x = {}; |
|||
exports.y = tslib_1.__assign({}, exports.x); |
|||
``` |
|||
|
|||
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. |
|||
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. |
|||
|
|||
# Installing |
|||
|
|||
For the latest stable version, run: |
|||
|
|||
## npm |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
npm install tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
npm install tslib@1.6.1 |
|||
``` |
|||
|
|||
## yarn |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
yarn add tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
yarn add tslib@1.6.1 |
|||
``` |
|||
|
|||
## bower |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
bower install tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
bower install tslib@1.6.1 |
|||
``` |
|||
|
|||
## JSPM |
|||
|
|||
```sh |
|||
# TypeScript 2.3.3 or later |
|||
jspm install tslib |
|||
|
|||
# TypeScript 2.3.2 or earlier |
|||
jspm install tslib@1.6.1 |
|||
``` |
|||
|
|||
# Usage |
|||
|
|||
Set the `importHelpers` compiler option on the command line: |
|||
|
|||
``` |
|||
tsc --importHelpers file.ts |
|||
``` |
|||
|
|||
or in your tsconfig.json: |
|||
|
|||
```json |
|||
{ |
|||
"compilerOptions": { |
|||
"importHelpers": true |
|||
} |
|||
} |
|||
``` |
|||
|
|||
#### For bower and JSPM users |
|||
|
|||
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: |
|||
|
|||
```json |
|||
{ |
|||
"compilerOptions": { |
|||
"module": "amd", |
|||
"importHelpers": true, |
|||
"baseUrl": "./", |
|||
"paths": { |
|||
"tslib" : ["bower_components/tslib/tslib.d.ts"] |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
For JSPM users: |
|||
|
|||
```json |
|||
{ |
|||
"compilerOptions": { |
|||
"module": "system", |
|||
"importHelpers": true, |
|||
"baseUrl": "./", |
|||
"paths": { |
|||
"tslib" : ["jspm_packages/npm/tslib@1.[version].0/tslib.d.ts"] |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
|
|||
# Contribute |
|||
|
|||
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. |
|||
|
|||
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. |
|||
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). |
|||
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). |
|||
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. |
|||
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). |
|||
|
|||
# Documentation |
|||
|
|||
* [Quick tutorial](http://www.typescriptlang.org/Tutorial) |
|||
* [Programming handbook](http://www.typescriptlang.org/Handbook) |
|||
* [Homepage](http://www.typescriptlang.org/) |
|||
@ -0,0 +1,51 @@ |
|||
import tslib from '../tslib.js'; |
|||
const { |
|||
__extends, |
|||
__assign, |
|||
__rest, |
|||
__decorate, |
|||
__param, |
|||
__metadata, |
|||
__awaiter, |
|||
__generator, |
|||
__exportStar, |
|||
__createBinding, |
|||
__values, |
|||
__read, |
|||
__spread, |
|||
__spreadArrays, |
|||
__await, |
|||
__asyncGenerator, |
|||
__asyncDelegator, |
|||
__asyncValues, |
|||
__makeTemplateObject, |
|||
__importStar, |
|||
__importDefault, |
|||
__classPrivateFieldGet, |
|||
__classPrivateFieldSet, |
|||
} = tslib; |
|||
export { |
|||
__extends, |
|||
__assign, |
|||
__rest, |
|||
__decorate, |
|||
__param, |
|||
__metadata, |
|||
__awaiter, |
|||
__generator, |
|||
__exportStar, |
|||
__createBinding, |
|||
__values, |
|||
__read, |
|||
__spread, |
|||
__spreadArrays, |
|||
__await, |
|||
__asyncGenerator, |
|||
__asyncDelegator, |
|||
__asyncValues, |
|||
__makeTemplateObject, |
|||
__importStar, |
|||
__importDefault, |
|||
__classPrivateFieldGet, |
|||
__classPrivateFieldSet, |
|||
}; |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"type": "module" |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
{ |
|||
"name": "tslib", |
|||
"author": "Microsoft Corp.", |
|||
"homepage": "https://www.typescriptlang.org/", |
|||
"version": "1.14.1", |
|||
"license": "0BSD", |
|||
"description": "Runtime library for TypeScript helper functions", |
|||
"keywords": [ |
|||
"TypeScript", |
|||
"Microsoft", |
|||
"compiler", |
|||
"language", |
|||
"javascript", |
|||
"tslib", |
|||
"runtime" |
|||
], |
|||
"bugs": { |
|||
"url": "https://github.com/Microsoft/TypeScript/issues" |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "https://github.com/Microsoft/tslib.git" |
|||
}, |
|||
"main": "tslib.js", |
|||
"module": "tslib.es6.js", |
|||
"jsnext:main": "tslib.es6.js", |
|||
"typings": "tslib.d.ts", |
|||
"sideEffects": false, |
|||
"exports": { |
|||
".": { |
|||
"module": "./tslib.es6.js", |
|||
"import": "./modules/index.js", |
|||
"default": "./tslib.js" |
|||
}, |
|||
"./": "./" |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
// When on node 14, it validates that all of the commonjs exports
|
|||
// are correctly re-exported for es modules importers.
|
|||
|
|||
const nodeMajor = Number(process.version.split(".")[0].slice(1)) |
|||
if (nodeMajor < 14) { |
|||
console.log("Skipping because node does not support module exports.") |
|||
process.exit(0) |
|||
} |
|||
|
|||
// ES Modules import via the ./modules folder
|
|||
import * as esTSLib from "../../modules/index.js" |
|||
|
|||
// Force a commonjs resolve
|
|||
import { createRequire } from "module"; |
|||
const commonJSTSLib = createRequire(import.meta.url)("../../tslib.js"); |
|||
|
|||
for (const key in commonJSTSLib) { |
|||
if (commonJSTSLib.hasOwnProperty(key)) { |
|||
if(!esTSLib[key]) throw new Error(`ESModules is missing ${key} - it needs to be re-exported in ./modules/index.js`) |
|||
} |
|||
} |
|||
|
|||
console.log("All exports in commonjs are available for es module consumers.") |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"type": "module", |
|||
"scripts": { |
|||
"test": "node index.js" |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
export declare function __extends(d: Function, b: Function): void; |
|||
export declare function __assign(t: any, ...sources: any[]): any; |
|||
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; |
|||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; |
|||
export declare function __param(paramIndex: number, decorator: Function): Function; |
|||
export declare function __metadata(metadataKey: any, metadataValue: any): Function; |
|||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; |
|||
export declare function __generator(thisArg: any, body: Function): any; |
|||
export declare function __exportStar(m: any, exports: any): void; |
|||
export declare function __values(o: any): any; |
|||
export declare function __read(o: any, n?: number): any[]; |
|||
export declare function __spread(...args: any[][]): any[]; |
|||
export declare function __spreadArrays(...args: any[][]): any[]; |
|||
export declare function __await(v: any): any; |
|||
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; |
|||
export declare function __asyncDelegator(o: any): any; |
|||
export declare function __asyncValues(o: any): any; |
|||
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; |
|||
export declare function __importStar<T>(mod: T): T; |
|||
export declare function __importDefault<T>(mod: T): T | { default: T }; |
|||
export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; |
|||
export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; |
|||
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; |
|||
@ -0,0 +1 @@ |
|||
<script src="tslib.es6.js"></script> |
|||
@ -0,0 +1,218 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
/* global Reflect, Promise */ |
|||
|
|||
var extendStatics = function(d, b) { |
|||
extendStatics = Object.setPrototypeOf || |
|||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
|||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
|||
return extendStatics(d, b); |
|||
}; |
|||
|
|||
export function __extends(d, b) { |
|||
extendStatics(d, b); |
|||
function __() { this.constructor = d; } |
|||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|||
} |
|||
|
|||
export var __assign = function() { |
|||
__assign = Object.assign || function __assign(t) { |
|||
for (var s, i = 1, n = arguments.length; i < n; i++) { |
|||
s = arguments[i]; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
|||
} |
|||
return t; |
|||
} |
|||
return __assign.apply(this, arguments); |
|||
} |
|||
|
|||
export function __rest(s, e) { |
|||
var t = {}; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
|||
t[p] = s[p]; |
|||
if (s != null && typeof Object.getOwnPropertySymbols === "function") |
|||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { |
|||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) |
|||
t[p[i]] = s[p[i]]; |
|||
} |
|||
return t; |
|||
} |
|||
|
|||
export function __decorate(decorators, target, key, desc) { |
|||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
|||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
|||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
|||
return c > 3 && r && Object.defineProperty(target, key, r), r; |
|||
} |
|||
|
|||
export function __param(paramIndex, decorator) { |
|||
return function (target, key) { decorator(target, key, paramIndex); } |
|||
} |
|||
|
|||
export function __metadata(metadataKey, metadataValue) { |
|||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); |
|||
} |
|||
|
|||
export function __awaiter(thisArg, _arguments, P, generator) { |
|||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
|||
return new (P || (P = Promise))(function (resolve, reject) { |
|||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
|||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
|||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
|||
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
|||
}); |
|||
} |
|||
|
|||
export function __generator(thisArg, body) { |
|||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
|||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
|||
function verb(n) { return function (v) { return step([n, v]); }; } |
|||
function step(op) { |
|||
if (f) throw new TypeError("Generator is already executing."); |
|||
while (_) try { |
|||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
|||
if (y = 0, t) op = [op[0] & 2, t.value]; |
|||
switch (op[0]) { |
|||
case 0: case 1: t = op; break; |
|||
case 4: _.label++; return { value: op[1], done: false }; |
|||
case 5: _.label++; y = op[1]; op = [0]; continue; |
|||
case 7: op = _.ops.pop(); _.trys.pop(); continue; |
|||
default: |
|||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
|||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
|||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
|||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
|||
if (t[2]) _.ops.pop(); |
|||
_.trys.pop(); continue; |
|||
} |
|||
op = body.call(thisArg, _); |
|||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
|||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
|||
} |
|||
} |
|||
|
|||
export function __createBinding(o, m, k, k2) { |
|||
if (k2 === undefined) k2 = k; |
|||
o[k2] = m[k]; |
|||
} |
|||
|
|||
export function __exportStar(m, exports) { |
|||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; |
|||
} |
|||
|
|||
export function __values(o) { |
|||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; |
|||
if (m) return m.call(o); |
|||
if (o && typeof o.length === "number") return { |
|||
next: function () { |
|||
if (o && i >= o.length) o = void 0; |
|||
return { value: o && o[i++], done: !o }; |
|||
} |
|||
}; |
|||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); |
|||
} |
|||
|
|||
export function __read(o, n) { |
|||
var m = typeof Symbol === "function" && o[Symbol.iterator]; |
|||
if (!m) return o; |
|||
var i = m.call(o), r, ar = [], e; |
|||
try { |
|||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); |
|||
} |
|||
catch (error) { e = { error: error }; } |
|||
finally { |
|||
try { |
|||
if (r && !r.done && (m = i["return"])) m.call(i); |
|||
} |
|||
finally { if (e) throw e.error; } |
|||
} |
|||
return ar; |
|||
} |
|||
|
|||
export function __spread() { |
|||
for (var ar = [], i = 0; i < arguments.length; i++) |
|||
ar = ar.concat(__read(arguments[i])); |
|||
return ar; |
|||
} |
|||
|
|||
export function __spreadArrays() { |
|||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; |
|||
for (var r = Array(s), k = 0, i = 0; i < il; i++) |
|||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) |
|||
r[k] = a[j]; |
|||
return r; |
|||
}; |
|||
|
|||
export function __await(v) { |
|||
return this instanceof __await ? (this.v = v, this) : new __await(v); |
|||
} |
|||
|
|||
export function __asyncGenerator(thisArg, _arguments, generator) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var g = generator.apply(thisArg, _arguments || []), i, q = []; |
|||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; |
|||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } |
|||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } |
|||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } |
|||
function fulfill(value) { resume("next", value); } |
|||
function reject(value) { resume("throw", value); } |
|||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } |
|||
} |
|||
|
|||
export function __asyncDelegator(o) { |
|||
var i, p; |
|||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; |
|||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } |
|||
} |
|||
|
|||
export function __asyncValues(o) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var m = o[Symbol.asyncIterator], i; |
|||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); |
|||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } |
|||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } |
|||
} |
|||
|
|||
export function __makeTemplateObject(cooked, raw) { |
|||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } |
|||
return cooked; |
|||
}; |
|||
|
|||
export function __importStar(mod) { |
|||
if (mod && mod.__esModule) return mod; |
|||
var result = {}; |
|||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; |
|||
result.default = mod; |
|||
return result; |
|||
} |
|||
|
|||
export function __importDefault(mod) { |
|||
return (mod && mod.__esModule) ? mod : { default: mod }; |
|||
} |
|||
|
|||
export function __classPrivateFieldGet(receiver, privateMap) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to get private field on non-instance"); |
|||
} |
|||
return privateMap.get(receiver); |
|||
} |
|||
|
|||
export function __classPrivateFieldSet(receiver, privateMap, value) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to set private field on non-instance"); |
|||
} |
|||
privateMap.set(receiver, value); |
|||
return value; |
|||
} |
|||
@ -0,0 +1 @@ |
|||
<script src="tslib.js"></script> |
|||
@ -0,0 +1,284 @@ |
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
|
|||
/* global global, define, System, Reflect, Promise */ |
|||
var __extends; |
|||
var __assign; |
|||
var __rest; |
|||
var __decorate; |
|||
var __param; |
|||
var __metadata; |
|||
var __awaiter; |
|||
var __generator; |
|||
var __exportStar; |
|||
var __values; |
|||
var __read; |
|||
var __spread; |
|||
var __spreadArrays; |
|||
var __await; |
|||
var __asyncGenerator; |
|||
var __asyncDelegator; |
|||
var __asyncValues; |
|||
var __makeTemplateObject; |
|||
var __importStar; |
|||
var __importDefault; |
|||
var __classPrivateFieldGet; |
|||
var __classPrivateFieldSet; |
|||
var __createBinding; |
|||
(function (factory) { |
|||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; |
|||
if (typeof define === "function" && define.amd) { |
|||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); |
|||
} |
|||
else if (typeof module === "object" && typeof module.exports === "object") { |
|||
factory(createExporter(root, createExporter(module.exports))); |
|||
} |
|||
else { |
|||
factory(createExporter(root)); |
|||
} |
|||
function createExporter(exports, previous) { |
|||
if (exports !== root) { |
|||
if (typeof Object.create === "function") { |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
} |
|||
else { |
|||
exports.__esModule = true; |
|||
} |
|||
} |
|||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; |
|||
} |
|||
}) |
|||
(function (exporter) { |
|||
var extendStatics = Object.setPrototypeOf || |
|||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
|||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
|||
|
|||
__extends = function (d, b) { |
|||
extendStatics(d, b); |
|||
function __() { this.constructor = d; } |
|||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|||
}; |
|||
|
|||
__assign = Object.assign || function (t) { |
|||
for (var s, i = 1, n = arguments.length; i < n; i++) { |
|||
s = arguments[i]; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
|||
} |
|||
return t; |
|||
}; |
|||
|
|||
__rest = function (s, e) { |
|||
var t = {}; |
|||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
|||
t[p] = s[p]; |
|||
if (s != null && typeof Object.getOwnPropertySymbols === "function") |
|||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { |
|||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) |
|||
t[p[i]] = s[p[i]]; |
|||
} |
|||
return t; |
|||
}; |
|||
|
|||
__decorate = function (decorators, target, key, desc) { |
|||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
|||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
|||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
|||
return c > 3 && r && Object.defineProperty(target, key, r), r; |
|||
}; |
|||
|
|||
__param = function (paramIndex, decorator) { |
|||
return function (target, key) { decorator(target, key, paramIndex); } |
|||
}; |
|||
|
|||
__metadata = function (metadataKey, metadataValue) { |
|||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); |
|||
}; |
|||
|
|||
__awaiter = function (thisArg, _arguments, P, generator) { |
|||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
|||
return new (P || (P = Promise))(function (resolve, reject) { |
|||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
|||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
|||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
|||
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
|||
}); |
|||
}; |
|||
|
|||
__generator = function (thisArg, body) { |
|||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
|||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
|||
function verb(n) { return function (v) { return step([n, v]); }; } |
|||
function step(op) { |
|||
if (f) throw new TypeError("Generator is already executing."); |
|||
while (_) try { |
|||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
|||
if (y = 0, t) op = [op[0] & 2, t.value]; |
|||
switch (op[0]) { |
|||
case 0: case 1: t = op; break; |
|||
case 4: _.label++; return { value: op[1], done: false }; |
|||
case 5: _.label++; y = op[1]; op = [0]; continue; |
|||
case 7: op = _.ops.pop(); _.trys.pop(); continue; |
|||
default: |
|||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
|||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
|||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
|||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
|||
if (t[2]) _.ops.pop(); |
|||
_.trys.pop(); continue; |
|||
} |
|||
op = body.call(thisArg, _); |
|||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
|||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
|||
} |
|||
}; |
|||
|
|||
__createBinding = function(o, m, k, k2) { |
|||
if (k2 === undefined) k2 = k; |
|||
o[k2] = m[k]; |
|||
}; |
|||
|
|||
__exportStar = function (m, exports) { |
|||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; |
|||
}; |
|||
|
|||
__values = function (o) { |
|||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; |
|||
if (m) return m.call(o); |
|||
if (o && typeof o.length === "number") return { |
|||
next: function () { |
|||
if (o && i >= o.length) o = void 0; |
|||
return { value: o && o[i++], done: !o }; |
|||
} |
|||
}; |
|||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); |
|||
}; |
|||
|
|||
__read = function (o, n) { |
|||
var m = typeof Symbol === "function" && o[Symbol.iterator]; |
|||
if (!m) return o; |
|||
var i = m.call(o), r, ar = [], e; |
|||
try { |
|||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); |
|||
} |
|||
catch (error) { e = { error: error }; } |
|||
finally { |
|||
try { |
|||
if (r && !r.done && (m = i["return"])) m.call(i); |
|||
} |
|||
finally { if (e) throw e.error; } |
|||
} |
|||
return ar; |
|||
}; |
|||
|
|||
__spread = function () { |
|||
for (var ar = [], i = 0; i < arguments.length; i++) |
|||
ar = ar.concat(__read(arguments[i])); |
|||
return ar; |
|||
}; |
|||
|
|||
__spreadArrays = function () { |
|||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; |
|||
for (var r = Array(s), k = 0, i = 0; i < il; i++) |
|||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) |
|||
r[k] = a[j]; |
|||
return r; |
|||
}; |
|||
|
|||
__await = function (v) { |
|||
return this instanceof __await ? (this.v = v, this) : new __await(v); |
|||
}; |
|||
|
|||
__asyncGenerator = function (thisArg, _arguments, generator) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var g = generator.apply(thisArg, _arguments || []), i, q = []; |
|||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; |
|||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } |
|||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } |
|||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } |
|||
function fulfill(value) { resume("next", value); } |
|||
function reject(value) { resume("throw", value); } |
|||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } |
|||
}; |
|||
|
|||
__asyncDelegator = function (o) { |
|||
var i, p; |
|||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; |
|||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } |
|||
}; |
|||
|
|||
__asyncValues = function (o) { |
|||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|||
var m = o[Symbol.asyncIterator], i; |
|||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); |
|||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } |
|||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } |
|||
}; |
|||
|
|||
__makeTemplateObject = function (cooked, raw) { |
|||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } |
|||
return cooked; |
|||
}; |
|||
|
|||
__importStar = function (mod) { |
|||
if (mod && mod.__esModule) return mod; |
|||
var result = {}; |
|||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; |
|||
result["default"] = mod; |
|||
return result; |
|||
}; |
|||
|
|||
__importDefault = function (mod) { |
|||
return (mod && mod.__esModule) ? mod : { "default": mod }; |
|||
}; |
|||
|
|||
__classPrivateFieldGet = function (receiver, privateMap) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to get private field on non-instance"); |
|||
} |
|||
return privateMap.get(receiver); |
|||
}; |
|||
|
|||
__classPrivateFieldSet = function (receiver, privateMap, value) { |
|||
if (!privateMap.has(receiver)) { |
|||
throw new TypeError("attempted to set private field on non-instance"); |
|||
} |
|||
privateMap.set(receiver, value); |
|||
return value; |
|||
}; |
|||
|
|||
exporter("__extends", __extends); |
|||
exporter("__assign", __assign); |
|||
exporter("__rest", __rest); |
|||
exporter("__decorate", __decorate); |
|||
exporter("__param", __param); |
|||
exporter("__metadata", __metadata); |
|||
exporter("__awaiter", __awaiter); |
|||
exporter("__generator", __generator); |
|||
exporter("__exportStar", __exportStar); |
|||
exporter("__createBinding", __createBinding); |
|||
exporter("__values", __values); |
|||
exporter("__read", __read); |
|||
exporter("__spread", __spread); |
|||
exporter("__spreadArrays", __spreadArrays); |
|||
exporter("__await", __await); |
|||
exporter("__asyncGenerator", __asyncGenerator); |
|||
exporter("__asyncDelegator", __asyncDelegator); |
|||
exporter("__asyncValues", __asyncValues); |
|||
exporter("__makeTemplateObject", __makeTemplateObject); |
|||
exporter("__importStar", __importStar); |
|||
exporter("__importDefault", __importDefault); |
|||
exporter("__classPrivateFieldGet", __classPrivateFieldGet); |
|||
exporter("__classPrivateFieldSet", __classPrivateFieldSet); |
|||
}); |
|||
@ -0,0 +1,26 @@ |
|||
{ |
|||
"name": "@aws-crypto/ie11-detection", |
|||
"version": "3.0.0", |
|||
"description": "Provides functions and types for detecting if the host environment is IE11", |
|||
"scripts": { |
|||
"pretest": "tsc -p tsconfig.json", |
|||
"test": "mocha --require ts-node/register test/**/*test.ts" |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git@github.com:aws/aws-sdk-js-crypto-helpers.git" |
|||
}, |
|||
"author": { |
|||
"name": "AWS Crypto Tools Team", |
|||
"email": "aws-cryptools@amazon.com", |
|||
"url": "https://docs.aws.amazon.com/aws-crypto-tools/index.html?id=docs_gateway#lang/en_us" |
|||
}, |
|||
"homepage": "https://github.com/aws/aws-sdk-js-crypto-helpers/tree/master/packages/ie11-detection", |
|||
"license": "Apache-2.0", |
|||
"main": "./build/index.js", |
|||
"types": "./build/index.d.ts", |
|||
"dependencies": { |
|||
"tslib": "^1.11.1" |
|||
}, |
|||
"gitHead": "7f56cee8f62bd65cd397eeec29c3c997215bd80c" |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
import { Key } from "./Key"; |
|||
|
|||
/** |
|||
* Represents a cryptographic operation that has been instantiated but not |
|||
* necessarily fed all data or finalized. |
|||
* |
|||
* @see https://msdn.microsoft.com/en-us/library/dn280996(v=vs.85).aspx
|
|||
*/ |
|||
export interface CryptoOperation { |
|||
readonly algorithm: string; |
|||
readonly key: Key; |
|||
onabort: (event: Event) => void; |
|||
oncomplete: (event: Event) => void; |
|||
onerror: (event: Event) => void; |
|||
onprogress: (event: Event) => void; |
|||
readonly result: ArrayBuffer | undefined; |
|||
|
|||
abort(): void; |
|||
finish(): void; |
|||
process(buffer: ArrayBufferView): void; |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
/** |
|||
* The result of a successful KeyOperation. |
|||
* |
|||
* @see {KeyOperation} |
|||
* @see https://msdn.microsoft.com/en-us/library/dn302313(v=vs.85).aspx
|
|||
*/ |
|||
export interface Key { |
|||
readonly algorithm: string; |
|||
readonly extractable: boolean; |
|||
readonly keyUsage: Array<string>; |
|||
readonly type: string; |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
import { Key } from "./Key"; |
|||
|
|||
/** |
|||
* Represents the return of a key-related operation that may or may not have |
|||
* been completed. |
|||
* |
|||
* @see https://msdn.microsoft.com/en-us/library/dn302314(v=vs.85).aspx
|
|||
*/ |
|||
export interface KeyOperation { |
|||
oncomplete: (event: Event) => void; |
|||
onerror: (event: Event) => void; |
|||
readonly result: Key | undefined; |
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
import { CryptoOperation } from "./CryptoOperation"; |
|||
import { Key } from "./Key"; |
|||
import { KeyOperation } from "./KeyOperation"; |
|||
|
|||
export type KeyUsage = |
|||
| "encrypt" |
|||
| "decrypt" |
|||
| "sign" |
|||
| "verify" |
|||
| "derive" |
|||
| "wrapKey" |
|||
| "unwrapKey" |
|||
| "importKey"; |
|||
|
|||
export type EncryptionOrVerificationAlgorithm = "RSAES-PKCS1-v1_5"; |
|||
export type Ie11EncryptionAlgorithm = |
|||
| "AES-CBC" |
|||
| "AES-GCM" |
|||
| "RSA-OAEP" |
|||
| EncryptionOrVerificationAlgorithm; |
|||
export type Ie11DigestAlgorithm = "SHA-1" | "SHA-256" | "SHA-384"; |
|||
|
|||
export interface HashAlgorithm { |
|||
name: Ie11DigestAlgorithm; |
|||
} |
|||
|
|||
export interface HmacAlgorithm { |
|||
name: "HMAC"; |
|||
hash: HashAlgorithm; |
|||
} |
|||
|
|||
export type SigningAlgorithm = HmacAlgorithm; |
|||
|
|||
/** |
|||
* Represent ths SubtleCrypto interface as implemented in Internet Explorer 11. |
|||
* This implementation was based on an earlier version of the WebCrypto API and |
|||
* differs from the `window.crypto.subtle` object exposed in Chrome, Safari, |
|||
* Firefox, and MS Edge. |
|||
* |
|||
* @see https://msdn.microsoft.com/en-us/library/dn302325(v=vs.85).aspx
|
|||
*/ |
|||
export interface MsSubtleCrypto { |
|||
decrypt( |
|||
algorithm: Ie11EncryptionAlgorithm, |
|||
key: Key, |
|||
buffer?: ArrayBufferView |
|||
): CryptoOperation; |
|||
|
|||
digest( |
|||
algorithm: Ie11DigestAlgorithm, |
|||
buffer?: ArrayBufferView |
|||
): CryptoOperation; |
|||
|
|||
encrypt( |
|||
algorithm: Ie11EncryptionAlgorithm, |
|||
key: Key, |
|||
buffer?: ArrayBufferView |
|||
): CryptoOperation; |
|||
|
|||
exportKey(format: string, key: Key): KeyOperation; |
|||
|
|||
generateKey( |
|||
algorithm: SigningAlgorithm | Ie11EncryptionAlgorithm, |
|||
extractable?: boolean, |
|||
keyUsages?: Array<KeyUsage> |
|||
): KeyOperation; |
|||
|
|||
importKey( |
|||
format: string, |
|||
keyData: ArrayBufferView, |
|||
algorithm: any, |
|||
extractable?: boolean, |
|||
keyUsages?: Array<KeyUsage> |
|||
): KeyOperation; |
|||
|
|||
sign( |
|||
algorithm: SigningAlgorithm, |
|||
key: Key, |
|||
buffer?: ArrayBufferView |
|||
): CryptoOperation; |
|||
|
|||
verify( |
|||
algorithm: SigningAlgorithm | EncryptionOrVerificationAlgorithm, |
|||
key: Key, |
|||
signature: ArrayBufferView, |
|||
buffer?: ArrayBufferView |
|||
): CryptoOperation; |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
import { MsSubtleCrypto } from "./MsSubtleCrypto"; |
|||
|
|||
type SubtleCryptoMethod = |
|||
| "decrypt" |
|||
| "digest" |
|||
| "encrypt" |
|||
| "exportKey" |
|||
| "generateKey" |
|||
| "importKey" |
|||
| "sign" |
|||
| "verify"; |
|||
|
|||
const msSubtleCryptoMethods: Array<SubtleCryptoMethod> = [ |
|||
"decrypt", |
|||
"digest", |
|||
"encrypt", |
|||
"exportKey", |
|||
"generateKey", |
|||
"importKey", |
|||
"sign", |
|||
"verify" |
|||
]; |
|||
|
|||
/** |
|||
* The value accessible as `window.msCrypto` in Internet Explorer 11. |
|||
*/ |
|||
export interface MsCrypto { |
|||
getRandomValues: (toFill: Uint8Array) => void; |
|||
subtle: MsSubtleCrypto; |
|||
} |
|||
|
|||
/** |
|||
* The `window` object in Internet Explorer 11. This interface does not |
|||
* exhaustively document the prefixed features of `window` in IE11. |
|||
*/ |
|||
export interface MsWindow extends Window { |
|||
MSInputMethodContext: any; |
|||
msCrypto: MsCrypto; |
|||
} |
|||
|
|||
function quacksLikeAnMsWindow(window: Window): window is MsWindow { |
|||
return "MSInputMethodContext" in window && "msCrypto" in window; |
|||
} |
|||
|
|||
/** |
|||
* Determines if the provided window is (or is like) the window object one would |
|||
* expect to encounter in Internet Explorer 11. |
|||
*/ |
|||
export function isMsWindow(window: Window): window is MsWindow { |
|||
if (quacksLikeAnMsWindow(window) && window.msCrypto.subtle !== undefined) { |
|||
const { getRandomValues, subtle } = window.msCrypto; |
|||
return msSubtleCryptoMethods |
|||
.map<Function>(methodName => subtle[methodName]) |
|||
.concat(getRandomValues) |
|||
.every(method => typeof method === "function"); |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
export * from "./CryptoOperation"; |
|||
export * from "./Key"; |
|||
export * from "./KeyOperation"; |
|||
export * from "./MsSubtleCrypto"; |
|||
export * from "./MsWindow"; |
|||
@ -0,0 +1,17 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"module": "commonjs", |
|||
"target": "es5", |
|||
"lib": ["dom", "es5", "es2015.collection"], |
|||
"strict": true, |
|||
"sourceMap": true, |
|||
"declaration": true, |
|||
"stripInternal": true, |
|||
"rootDir": "./src", |
|||
"outDir": "./build", |
|||
"importHelpers": true, |
|||
"noEmitHelpers": true |
|||
}, |
|||
"include": ["src/**/*.ts"], |
|||
"exclude": ["node_modules/**"] |
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
# Change Log |
|||
|
|||
All notable changes to this project will be documented in this file. |
|||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. |
|||
|
|||
# [3.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.2...v3.0.0) (2023-01-12) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- **docs:** sha256 packages, clarify hmac support ([#455](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/455)) ([1be5043](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/1be5043325991f3f5ccb52a8dd928f004b4d442e)) |
|||
|
|||
- feat!: replace Hash implementations with Checksum interface (#492) ([da43dc0](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/da43dc0fdf669d9ebb5bfb1b1f7c79e46c4aaae1)), closes [#492](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/492) |
|||
|
|||
### BREAKING CHANGES |
|||
|
|||
- All classes that implemented `Hash` now implement `Checksum`. |
|||
|
|||
## [2.0.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.1...v2.0.2) (2022-09-07) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- **#337:** update @aws-sdk/types ([#373](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/373)) ([b26a811](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/b26a811a392f5209c7ec7e57251500d4d78f97ff)), closes [#337](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/337) |
|||
|
|||
## [2.0.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.0...v2.0.1) (2021-12-09) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/sha256-browser |
|||
|
|||
# [2.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.2...v2.0.0) (2021-10-25) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/sha256-browser |
|||
|
|||
## [1.2.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.1...v1.2.2) (2021-10-12) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/sha256-browser |
|||
|
|||
## [1.2.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.0...v1.2.1) (2021-09-17) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/sha256-browser |
|||
|
|||
# [1.2.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.1.1...v1.2.0) (2021-09-17) |
|||
|
|||
### Features |
|||
|
|||
- add @aws-crypto/util ([8f489cb](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/8f489cbe4c0e134f826bac66f1bf5172597048b9)) |
|||
|
|||
## [1.1.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/sha256-browser@1.1.0...@aws-crypto/sha256-browser@1.1.1) (2021-07-13) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- **sha256-browser:** throw errors not string ([#194](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/194)) ([7fa7ac4](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/7fa7ac445ef7a04dfb1ff479e7114aba045b2b2c)) |
|||
|
|||
# [1.1.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/sha256-browser@1.0.0...@aws-crypto/sha256-browser@1.1.0) (2021-01-13) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- remove package lock ([6002a5a](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/6002a5ab9218dc8798c19dc205d3eebd3bec5b43)) |
|||
- **aws-crypto:** export explicit dependencies on [@aws-types](https://github.com/aws-types) ([6a1873a](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/6a1873a4dcc2aaa4a1338595703cfa7099f17b8c)) |
|||
- **deps-dev:** move @aws-sdk/types to devDependencies ([#188](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/188)) ([08efdf4](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/08efdf46dcc612d88c441e29945d787f253ee77d)) |
|||
|
|||
# [1.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/sha256-browser@1.0.0-alpha.0...@aws-crypto/sha256-browser@1.0.0) (2020-10-22) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/sha256-browser |
|||
|
|||
# [1.0.0-alpha.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/sha256-browser@0.1.0-preview.4...@aws-crypto/sha256-browser@1.0.0-alpha.0) (2020-02-07) |
|||
|
|||
**Note:** Version bump only for package @aws-crypto/sha256-browser |
|||
|
|||
# [0.1.0-preview.4](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/sha256-browser@0.1.0-preview.2...@aws-crypto/sha256-browser@0.1.0-preview.4) (2020-01-16) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8) |
|||
- es2015.iterable required ([#10](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/10)) ([6e08d83](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/6e08d83c33667ad8cbeeaaa7cedf1bbe05f79ed8)) |
|||
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13) |
|||
|
|||
# [0.1.0-preview.3](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/sha256-browser@0.1.0-preview.2...@aws-crypto/sha256-browser@0.1.0-preview.3) (2019-11-15) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8) |
|||
- es2015.iterable required ([#10](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/10)) ([6e08d83](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/6e08d83c33667ad8cbeeaaa7cedf1bbe05f79ed8)) |
|||
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13) |
|||
|
|||
# [0.1.0-preview.2](https://github.com/aws/aws-javascript-crypto-helpers/compare/@aws-crypto/sha256-browser@0.1.0-preview.1...@aws-crypto/sha256-browser@0.1.0-preview.2) (2019-10-30) |
|||
|
|||
### Bug Fixes |
|||
|
|||
- remove /src/ from .npmignore (for sourcemaps) ([#5](https://github.com/aws/aws-javascript-crypto-helpers/issues/5)) ([ec52056](https://github.com/aws/aws-javascript-crypto-helpers/commit/ec52056)) |
|||
@ -0,0 +1,202 @@ |
|||
|
|||
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 [yyyy] [name of copyright owner] |
|||
|
|||
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. |
|||
@ -0,0 +1,31 @@ |
|||
# @aws-crypto/sha256-browser |
|||
|
|||
SHA256 wrapper for browsers that prefers `window.crypto.subtle` but will |
|||
fall back to a pure JS implementation in @aws-crypto/sha256-js |
|||
to provide a consistent interface for SHA256. |
|||
|
|||
## Usage |
|||
|
|||
- To hash "some data" |
|||
``` |
|||
import {Sha256} from '@aws-crypto/sha256-browser' |
|||
|
|||
const hash = new Sha256(); |
|||
hash.update('some data'); |
|||
const result = await hash.digest(); |
|||
|
|||
``` |
|||
|
|||
- To hmac "some data" with "a key" |
|||
``` |
|||
import {Sha256} from '@aws-crypto/sha256-browser' |
|||
|
|||
const hash = new Sha256('a key'); |
|||
hash.update('some data'); |
|||
const result = await hash.digest(); |
|||
|
|||
``` |
|||
|
|||
## Test |
|||
|
|||
`npm test` |
|||
@ -0,0 +1,10 @@ |
|||
export declare const SHA_256_HASH: { |
|||
name: "SHA-256"; |
|||
}; |
|||
export declare const SHA_256_HMAC_ALGO: { |
|||
name: "HMAC"; |
|||
hash: { |
|||
name: "SHA-256"; |
|||
}; |
|||
}; |
|||
export declare const EMPTY_DATA_SHA_256: Uint8Array; |
|||
@ -0,0 +1,43 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.EMPTY_DATA_SHA_256 = exports.SHA_256_HMAC_ALGO = exports.SHA_256_HASH = void 0; |
|||
exports.SHA_256_HASH = { name: "SHA-256" }; |
|||
exports.SHA_256_HMAC_ALGO = { |
|||
name: "HMAC", |
|||
hash: exports.SHA_256_HASH |
|||
}; |
|||
exports.EMPTY_DATA_SHA_256 = new Uint8Array([ |
|||
227, |
|||
176, |
|||
196, |
|||
66, |
|||
152, |
|||
252, |
|||
28, |
|||
20, |
|||
154, |
|||
251, |
|||
244, |
|||
200, |
|||
153, |
|||
111, |
|||
185, |
|||
36, |
|||
39, |
|||
174, |
|||
65, |
|||
228, |
|||
100, |
|||
155, |
|||
147, |
|||
76, |
|||
164, |
|||
149, |
|||
153, |
|||
27, |
|||
120, |
|||
82, |
|||
184, |
|||
85 |
|||
]); |
|||
//# sourceMappingURL=constants.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAwB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAExD,QAAA,iBAAiB,GAAgD;IAC5E,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,oBAAY;CACnB,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAI,UAAU,CAAC;IAC/C,GAAG;IACH,GAAG;IACH,GAAG;IACH,EAAE;IACF,GAAG;IACH,GAAG;IACH,EAAE;IACF,EAAE;IACF,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,EAAE;IACF,EAAE;IACF,GAAG;IACH,EAAE;IACF,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,EAAE;IACF,GAAG;IACH,GAAG;IACH,GAAG;IACH,EAAE;IACF,GAAG;IACH,EAAE;IACF,GAAG;IACH,EAAE;CACH,CAAC,CAAC"} |
|||
@ -0,0 +1,8 @@ |
|||
import { Checksum, SourceData } from "@aws-sdk/types"; |
|||
export declare class Sha256 implements Checksum { |
|||
private hash; |
|||
constructor(secret?: SourceData); |
|||
update(data: SourceData, encoding?: "utf8" | "ascii" | "latin1"): void; |
|||
digest(): Promise<Uint8Array>; |
|||
reset(): void; |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.Sha256 = void 0; |
|||
var ie11Sha256_1 = require("./ie11Sha256"); |
|||
var webCryptoSha256_1 = require("./webCryptoSha256"); |
|||
var sha256_js_1 = require("@aws-crypto/sha256-js"); |
|||
var supports_web_crypto_1 = require("@aws-crypto/supports-web-crypto"); |
|||
var ie11_detection_1 = require("@aws-crypto/ie11-detection"); |
|||
var util_locate_window_1 = require("@aws-sdk/util-locate-window"); |
|||
var util_1 = require("@aws-crypto/util"); |
|||
var Sha256 = /** @class */ (function () { |
|||
function Sha256(secret) { |
|||
if ((0, supports_web_crypto_1.supportsWebCrypto)((0, util_locate_window_1.locateWindow)())) { |
|||
this.hash = new webCryptoSha256_1.Sha256(secret); |
|||
} |
|||
else if ((0, ie11_detection_1.isMsWindow)((0, util_locate_window_1.locateWindow)())) { |
|||
this.hash = new ie11Sha256_1.Sha256(secret); |
|||
} |
|||
else { |
|||
this.hash = new sha256_js_1.Sha256(secret); |
|||
} |
|||
} |
|||
Sha256.prototype.update = function (data, encoding) { |
|||
this.hash.update((0, util_1.convertToBuffer)(data)); |
|||
}; |
|||
Sha256.prototype.digest = function () { |
|||
return this.hash.digest(); |
|||
}; |
|||
Sha256.prototype.reset = function () { |
|||
this.hash.reset(); |
|||
}; |
|||
return Sha256; |
|||
}()); |
|||
exports.Sha256 = Sha256; |
|||
//# sourceMappingURL=crossPlatformSha256.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"crossPlatformSha256.js","sourceRoot":"","sources":["../src/crossPlatformSha256.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,qDAA8D;AAC9D,mDAA2D;AAE3D,uEAAoE;AACpE,6DAAwD;AACxD,kEAA2D;AAC3D,yCAAmD;AAEnD;IAGE,gBAAY,MAAmB;QAC7B,IAAI,IAAA,uCAAiB,EAAC,IAAA,iCAAY,GAAE,CAAC,EAAE;YACrC,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAe,CAAC,MAAM,CAAC,CAAC;SACzC;aAAM,IAAI,IAAA,2BAAU,EAAC,IAAA,iCAAY,GAAE,CAAC,EAAE;YACrC,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAU,CAAC,MAAM,CAAC,CAAC;SACpC;aAAM;YACL,IAAI,CAAC,IAAI,GAAG,IAAI,kBAAQ,CAAC,MAAM,CAAC,CAAC;SAClC;IACH,CAAC;IAED,uBAAM,GAAN,UAAO,IAAgB,EAAE,QAAsC;QAC7D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAA,sBAAe,EAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,uBAAM,GAAN;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED,sBAAK,GAAL;QACE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IACH,aAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,wBAAM"} |
|||
@ -0,0 +1,9 @@ |
|||
import { Checksum, SourceData } from "@aws-sdk/types"; |
|||
export declare class Sha256 implements Checksum { |
|||
private readonly secret?; |
|||
private operation; |
|||
constructor(secret?: SourceData); |
|||
update(toHash: SourceData): void; |
|||
digest(): Promise<Uint8Array>; |
|||
reset(): void; |
|||
} |
|||
@ -0,0 +1,80 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.Sha256 = void 0; |
|||
var isEmptyData_1 = require("./isEmptyData"); |
|||
var constants_1 = require("./constants"); |
|||
var util_utf8_browser_1 = require("@aws-sdk/util-utf8-browser"); |
|||
var util_locate_window_1 = require("@aws-sdk/util-locate-window"); |
|||
var Sha256 = /** @class */ (function () { |
|||
function Sha256(secret) { |
|||
this.secret = secret; |
|||
this.reset(); |
|||
} |
|||
Sha256.prototype.update = function (toHash) { |
|||
var _this = this; |
|||
if ((0, isEmptyData_1.isEmptyData)(toHash)) { |
|||
return; |
|||
} |
|||
this.operation = this.operation.then(function (operation) { |
|||
operation.onerror = function () { |
|||
_this.operation = Promise.reject(new Error("Error encountered updating hash")); |
|||
}; |
|||
operation.process(toArrayBufferView(toHash)); |
|||
return operation; |
|||
}); |
|||
this.operation.catch(function () { }); |
|||
}; |
|||
Sha256.prototype.digest = function () { |
|||
return this.operation.then(function (operation) { |
|||
return new Promise(function (resolve, reject) { |
|||
operation.onerror = function () { |
|||
reject(new Error("Error encountered finalizing hash")); |
|||
}; |
|||
operation.oncomplete = function () { |
|||
if (operation.result) { |
|||
resolve(new Uint8Array(operation.result)); |
|||
} |
|||
reject(new Error("Error encountered finalizing hash")); |
|||
}; |
|||
operation.finish(); |
|||
}); |
|||
}); |
|||
}; |
|||
Sha256.prototype.reset = function () { |
|||
if (this.secret) { |
|||
this.operation = getKeyPromise(this.secret).then(function (keyData) { |
|||
return (0, util_locate_window_1.locateWindow)().msCrypto.subtle.sign(constants_1.SHA_256_HMAC_ALGO, keyData); |
|||
}); |
|||
this.operation.catch(function () { }); |
|||
} |
|||
else { |
|||
this.operation = Promise.resolve((0, util_locate_window_1.locateWindow)().msCrypto.subtle.digest("SHA-256")); |
|||
} |
|||
}; |
|||
return Sha256; |
|||
}()); |
|||
exports.Sha256 = Sha256; |
|||
function getKeyPromise(secret) { |
|||
return new Promise(function (resolve, reject) { |
|||
var keyOperation = (0, util_locate_window_1.locateWindow)().msCrypto.subtle.importKey("raw", toArrayBufferView(secret), constants_1.SHA_256_HMAC_ALGO, false, ["sign"]); |
|||
keyOperation.oncomplete = function () { |
|||
if (keyOperation.result) { |
|||
resolve(keyOperation.result); |
|||
} |
|||
reject(new Error("ImportKey completed without importing key.")); |
|||
}; |
|||
keyOperation.onerror = function () { |
|||
reject(new Error("ImportKey failed to import key.")); |
|||
}; |
|||
}); |
|||
} |
|||
function toArrayBufferView(data) { |
|||
if (typeof data === "string") { |
|||
return (0, util_utf8_browser_1.fromUtf8)(data); |
|||
} |
|||
if (ArrayBuffer.isView(data)) { |
|||
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); |
|||
} |
|||
return new Uint8Array(data); |
|||
} |
|||
//# sourceMappingURL=ie11Sha256.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"ie11Sha256.js","sourceRoot":"","sources":["../src/ie11Sha256.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,yCAAgD;AAEhD,gEAAsD;AAEtD,kEAA2D;AAE3D;IAIE,gBAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,uBAAM,GAAN,UAAO,MAAkB;QAAzB,iBAgBC;QAfC,IAAI,IAAA,yBAAW,EAAC,MAAM,CAAC,EAAE;YACvB,OAAO;SACR;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAA,SAAS;YAC5C,SAAS,CAAC,OAAO,GAAG;gBAClB,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAC7B,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAC7C,CAAC;YACJ,CAAC,CAAC;YACF,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;YAE7C,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;IACjC,CAAC;IAED,uBAAM,GAAN;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CACxB,UAAA,SAAS;YACP,OAAA,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;gBAC1B,SAAS,CAAC,OAAO,GAAG;oBAClB,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC;gBACzD,CAAC,CAAC;gBACF,SAAS,CAAC,UAAU,GAAG;oBACrB,IAAI,SAAS,CAAC,MAAM,EAAE;wBACpB,OAAO,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;qBAC3C;oBACD,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC;gBACzD,CAAC,CAAC;gBAEF,SAAS,CAAC,MAAM,EAAE,CAAC;YACrB,CAAC,CAAC;QAZF,CAYE,CACL,CAAC;IACJ,CAAC;IAED,sBAAK,GAAL;QACE,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAA,OAAO;gBACpD,OAAC,IAAA,iCAAY,GAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAC7C,6BAAiB,EACjB,OAAO,CACV;YAHD,CAGC,CACJ,CAAC;YACF,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;SAChC;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,OAAO,CAC3B,IAAA,iCAAY,GAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CACjE,CAAC;SACH;IACH,CAAC;IACH,aAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,wBAAM;AA+DnB,SAAS,aAAa,CAAC,MAAkB;IACvC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACjC,IAAM,YAAY,GAAI,IAAA,iCAAY,GAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CACzE,KAAK,EACL,iBAAiB,CAAC,MAAM,CAAC,EACzB,6BAAiB,EACjB,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,YAAY,CAAC,UAAU,GAAG;YACxB,IAAI,YAAY,CAAC,MAAM,EAAE;gBACvB,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;aAC9B;YAED,MAAM,CAAC,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC;QACF,YAAY,CAAC,OAAO,GAAG;YACrB,MAAM,CAAC,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAgB;IACzC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,IAAA,4BAAQ,EAAC,IAAI,CAAC,CAAC;KACvB;IAED,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI,UAAU,CACnB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,iBAAiB,CAC/C,CAAC;KACH;IAED,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"} |
|||
@ -0,0 +1,3 @@ |
|||
export * from "./crossPlatformSha256"; |
|||
export { Sha256 as Ie11Sha256 } from "./ie11Sha256"; |
|||
export { Sha256 as WebCryptoSha256 } from "./webCryptoSha256"; |
|||
@ -0,0 +1,10 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.WebCryptoSha256 = exports.Ie11Sha256 = void 0; |
|||
var tslib_1 = require("tslib"); |
|||
tslib_1.__exportStar(require("./crossPlatformSha256"), exports); |
|||
var ie11Sha256_1 = require("./ie11Sha256"); |
|||
Object.defineProperty(exports, "Ie11Sha256", { enumerable: true, get: function () { return ie11Sha256_1.Sha256; } }); |
|||
var webCryptoSha256_1 = require("./webCryptoSha256"); |
|||
Object.defineProperty(exports, "WebCryptoSha256", { enumerable: true, get: function () { return webCryptoSha256_1.Sha256; } }); |
|||
//# sourceMappingURL=index.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,gEAAsC;AACtC,2CAAoD;AAA3C,wGAAA,MAAM,OAAc;AAC7B,qDAA8D;AAArD,kHAAA,MAAM,OAAmB"} |
|||
@ -0,0 +1,2 @@ |
|||
import { SourceData } from "@aws-sdk/types"; |
|||
export declare function isEmptyData(data: SourceData): boolean; |
|||
@ -0,0 +1,11 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.isEmptyData = void 0; |
|||
function isEmptyData(data) { |
|||
if (typeof data === "string") { |
|||
return data.length === 0; |
|||
} |
|||
return data.byteLength === 0; |
|||
} |
|||
exports.isEmptyData = isEmptyData; |
|||
//# sourceMappingURL=isEmptyData.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"isEmptyData.js","sourceRoot":"","sources":["../src/isEmptyData.ts"],"names":[],"mappings":";;;AAEA,SAAgB,WAAW,CAAC,IAAgB;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;KAC1B;IAED,OAAO,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC;AAC/B,CAAC;AAND,kCAMC"} |
|||
@ -0,0 +1,10 @@ |
|||
import { Checksum, SourceData } from "@aws-sdk/types"; |
|||
export declare class Sha256 implements Checksum { |
|||
private readonly secret?; |
|||
private key; |
|||
private toHash; |
|||
constructor(secret?: SourceData); |
|||
update(data: SourceData): void; |
|||
digest(): Promise<Uint8Array>; |
|||
reset(): void; |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.Sha256 = void 0; |
|||
var util_1 = require("@aws-crypto/util"); |
|||
var constants_1 = require("./constants"); |
|||
var util_locate_window_1 = require("@aws-sdk/util-locate-window"); |
|||
var Sha256 = /** @class */ (function () { |
|||
function Sha256(secret) { |
|||
this.toHash = new Uint8Array(0); |
|||
this.secret = secret; |
|||
this.reset(); |
|||
} |
|||
Sha256.prototype.update = function (data) { |
|||
if ((0, util_1.isEmptyData)(data)) { |
|||
return; |
|||
} |
|||
var update = (0, util_1.convertToBuffer)(data); |
|||
var typedArray = new Uint8Array(this.toHash.byteLength + update.byteLength); |
|||
typedArray.set(this.toHash, 0); |
|||
typedArray.set(update, this.toHash.byteLength); |
|||
this.toHash = typedArray; |
|||
}; |
|||
Sha256.prototype.digest = function () { |
|||
var _this = this; |
|||
if (this.key) { |
|||
return this.key.then(function (key) { |
|||
return (0, util_locate_window_1.locateWindow)() |
|||
.crypto.subtle.sign(constants_1.SHA_256_HMAC_ALGO, key, _this.toHash) |
|||
.then(function (data) { return new Uint8Array(data); }); |
|||
}); |
|||
} |
|||
if ((0, util_1.isEmptyData)(this.toHash)) { |
|||
return Promise.resolve(constants_1.EMPTY_DATA_SHA_256); |
|||
} |
|||
return Promise.resolve() |
|||
.then(function () { |
|||
return (0, util_locate_window_1.locateWindow)().crypto.subtle.digest(constants_1.SHA_256_HASH, _this.toHash); |
|||
}) |
|||
.then(function (data) { return Promise.resolve(new Uint8Array(data)); }); |
|||
}; |
|||
Sha256.prototype.reset = function () { |
|||
var _this = this; |
|||
this.toHash = new Uint8Array(0); |
|||
if (this.secret && this.secret !== void 0) { |
|||
this.key = new Promise(function (resolve, reject) { |
|||
(0, util_locate_window_1.locateWindow)() |
|||
.crypto.subtle.importKey("raw", (0, util_1.convertToBuffer)(_this.secret), constants_1.SHA_256_HMAC_ALGO, false, ["sign"]) |
|||
.then(resolve, reject); |
|||
}); |
|||
this.key.catch(function () { }); |
|||
} |
|||
}; |
|||
return Sha256; |
|||
}()); |
|||
exports.Sha256 = Sha256; |
|||
//# sourceMappingURL=webCryptoSha256.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"webCryptoSha256.js","sourceRoot":"","sources":["../src/webCryptoSha256.ts"],"names":[],"mappings":";;;AACA,yCAAgE;AAChE,yCAIqB;AACrB,kEAA2D;AAE3D;IAKE,gBAAY,MAAmB;QAFvB,WAAM,GAAe,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QAG7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,uBAAM,GAAN,UAAO,IAAgB;QACrB,IAAI,IAAA,kBAAW,EAAC,IAAI,CAAC,EAAE;YACrB,OAAO;SACR;QAED,IAAM,MAAM,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,CAAC;QACrC,IAAM,UAAU,GAAG,IAAI,UAAU,CAC/B,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAC3C,CAAC;QACF,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC/B,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;IAC3B,CAAC;IAED,uBAAM,GAAN;QAAA,iBAkBC;QAjBC,IAAI,IAAI,CAAC,GAAG,EAAE;YACZ,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAC,GAAG;gBACvB,OAAA,IAAA,iCAAY,GAAE;qBACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,6BAAiB,EAAE,GAAG,EAAE,KAAI,CAAC,MAAM,CAAC;qBACvD,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,UAAU,CAAC,IAAI,CAAC,EAApB,CAAoB,CAAC;YAFvC,CAEuC,CACxC,CAAC;SACH;QAED,IAAI,IAAA,kBAAW,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,8BAAkB,CAAC,CAAC;SAC5C;QAED,OAAO,OAAO,CAAC,OAAO,EAAE;aACrB,IAAI,CAAC;YACJ,OAAA,IAAA,iCAAY,GAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,wBAAY,EAAE,KAAI,CAAC,MAAM,CAAC;QAA9D,CAA8D,CAC/D;aACA,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,OAAO,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,EAArC,CAAqC,CAAC,CAAC;IAC3D,CAAC;IAED,sBAAK,GAAL;QAAA,iBAgBC;QAfC,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,EAAE;YACzC,IAAI,CAAC,GAAG,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;gBACrC,IAAA,iCAAY,GAAE;qBACT,MAAM,CAAC,MAAM,CAAC,SAAS,CACxB,KAAK,EACL,IAAA,sBAAe,EAAC,KAAI,CAAC,MAAoB,CAAC,EAC1C,6BAAiB,EACjB,KAAK,EACL,CAAC,MAAM,CAAC,CACX;qBACI,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;SAC1B;IACH,CAAC;IACH,aAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,wBAAM"} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue