@bitgo-beta/deser-lib 1.0.1-beta.3 → 1.0.1-beta.300

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,61 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 1.7.0 (2024-09-10)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **deser-lib:** add .npmignore to deser-lib ([8572427](https://github.com/BitGo/BitGoJS/commit/857242748d28c1d27c85578091d902701ce6f41e))
11
+ - **deser-lib:** add deser-lib path to tsconfig.packages ([0e5ef65](https://github.com/BitGo/BitGoJS/commit/0e5ef654b78214b7cc6086ce05c305d4d7425d64))
12
+ - **deser-lib:** use cbor.encode instead of cbor.encodeCanonical ([5209222](https://github.com/BitGo/BitGoJS/commit/5209222b8667d2e843cf5257f9a59b9b0fa39a5d))
13
+
14
+ ### Features
15
+
16
+ - bump typescript to 4.9 ([6675058](https://github.com/BitGo/BitGoJS/commit/667505862b79d24e3f625e7306d949acf07691bf))
17
+ - **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
18
+ - **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
19
+
20
+ # 1.5.0 (2024-01-30)
21
+
22
+ ### Bug Fixes
23
+
24
+ - **deser-lib:** add .npmignore to deser-lib ([8572427](https://github.com/BitGo/BitGoJS/commit/857242748d28c1d27c85578091d902701ce6f41e))
25
+ - **deser-lib:** add deser-lib path to tsconfig.packages ([0e5ef65](https://github.com/BitGo/BitGoJS/commit/0e5ef654b78214b7cc6086ce05c305d4d7425d64))
26
+
27
+ ### Features
28
+
29
+ - **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
30
+ - **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
31
+
32
+ # 1.4.0 (2024-01-26)
33
+
34
+ ### Bug Fixes
35
+
36
+ - **deser-lib:** add deser-lib path to tsconfig.packages ([0e5ef65](https://github.com/BitGo/BitGoJS/commit/0e5ef654b78214b7cc6086ce05c305d4d7425d64))
37
+
38
+ ### Features
39
+
40
+ - **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
41
+ - **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
42
+
43
+ # 1.3.0 (2024-01-26)
44
+
45
+ ### Bug Fixes
46
+
47
+ - **deser-lib:** add deser-lib path to tsconfig.packages ([0e5ef65](https://github.com/BitGo/BitGoJS/commit/0e5ef654b78214b7cc6086ce05c305d4d7425d64))
48
+
49
+ ### Features
50
+
51
+ - **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
52
+ - **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
53
+
54
+ # 1.2.0 (2024-01-25)
55
+
56
+ ### Features
57
+
58
+ - **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
59
+ - **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
60
+
6
61
  # 1.1.0 (2024-01-22)
7
62
 
8
63
  ### Features
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # Deser Lib
2
2
 
3
- This library will be used to centralize all the serialization and de-serialization schemes used in the bitgojs modules.
3
+ This library will be used to centralize all the serialization and de-serialization schemes used in the BitGoJS modules.
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@bitgo-beta/deser-lib",
3
+ "version": "1.0.1-beta.300",
4
+ "description": "BitGo serialization and deseralization library",
5
+ "main": "./dist/src/index.js",
6
+ "types": "./dist/src/index.d.ts",
7
+ "scripts": {
8
+ "test": "yarn unit-test",
9
+ "unit-test": "nyc -- mocha --recursive test",
10
+ "build": "yarn tsc --build --incremental --verbose .",
11
+ "fmt": "prettier --write .",
12
+ "check-fmt": "prettier --check .",
13
+ "clean": "rm -r ./dist",
14
+ "lint": "eslint --quiet .",
15
+ "prepare": "npm run build"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/BitGo/BitGoJS.git",
20
+ "directory": "modules/deser-lib"
21
+ },
22
+ "author": "BitGo SDK Team <sdkteam@bitgo.com>",
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/bitgo/bitgojs/issues"
26
+ },
27
+ "homepage": "https://github.com/bitgo/bitgojs#readme",
28
+ "nyc": {
29
+ "extension": [
30
+ ".ts"
31
+ ]
32
+ },
33
+ "lint-staged": {
34
+ "*.{js,ts}": [
35
+ "yarn prettier --write",
36
+ "yarn eslint --fix"
37
+ ]
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "cbor": "^9.0.1"
44
+ },
45
+ "gitHead": "23f6be76076006bd168a8c778f63e49c53e4b477"
46
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Transform value into its canonical, serializable form.
4
+ * @param value - Value to transform.
5
+ * @returns Canonical, serializable form of value.
6
+ */
7
+ export declare function transform<T>(value: T): T | Buffer;
8
+ /**
9
+ * Untransform value into its human readable form.
10
+ * @param value - Value to untransform.
11
+ * @returns Untransformed, human readable form of value.
12
+ */
13
+ export declare function untransform<T>(value: T): T | string;
14
+ /**
15
+ * Serialize a value.
16
+ * @param value - Value to serialize.
17
+ * @returns Buffer representing serialized value.
18
+ */
19
+ export declare function serialize<T>(value: T): Buffer;
20
+ /**
21
+ * Deserialize a value.
22
+ * @param value - Buffer to deserialize.
23
+ * @returns Deserialized value.
24
+ */
25
+ export declare function deserialize(value: Buffer): unknown;
26
+ //# sourceMappingURL=cbor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../../src/cbor.ts"],"names":[],"mappings":";AAiIA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CA6BjD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CA2BnD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD"}
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserialize = exports.serialize = exports.untransform = exports.transform = void 0;
4
+ const cbor_1 = require("cbor");
5
+ /**
6
+ * Return a string describing value as a type.
7
+ * @param value - Any javascript value to type.
8
+ * @returns String describing value type.
9
+ */
10
+ function getType(value) {
11
+ if (value === null || value === undefined) {
12
+ return 'null';
13
+ }
14
+ if (value instanceof Array) {
15
+ const types = value.map(getType);
16
+ if (!types.slice(1).every((value) => value === types[0])) {
17
+ throw new Error('Array elements are not of the same type');
18
+ }
19
+ return JSON.stringify([types[0]]);
20
+ }
21
+ if (value instanceof Object) {
22
+ const properties = Object.getOwnPropertyNames(value);
23
+ properties.sort();
24
+ return JSON.stringify(properties.reduce((acc, name) => {
25
+ acc[name] = getType(value[name]);
26
+ return acc;
27
+ }, {}));
28
+ }
29
+ if (typeof value === 'string') {
30
+ if (value.startsWith('0x')) {
31
+ return 'bytes';
32
+ }
33
+ return 'string';
34
+ }
35
+ return JSON.stringify(typeof value);
36
+ }
37
+ /**
38
+ * Compare two buffers for sorting.
39
+ * @param a - left buffer to compare to right buffer.
40
+ * @param b - right buffer to compare to left buffer.
41
+ * @returns Negative if a < b, positive if b > a, 0 if equal.
42
+ */
43
+ function bufferCompare(a, b) {
44
+ let i = 0;
45
+ while (i < a.length && i < b.length && a[i] == b[i]) {
46
+ i++;
47
+ }
48
+ if (i === a.length && i === b.length) {
49
+ return 0;
50
+ }
51
+ if (i === a.length || i === b.length) {
52
+ return a.length - b.length;
53
+ }
54
+ return a[i] - b[i];
55
+ }
56
+ /**
57
+ * Type check for sortable array element.
58
+ * @param value - Value to type check.
59
+ * @returns True if value is a sortable array element.
60
+ */
61
+ function isSortable(value) {
62
+ return value instanceof Object && 'weight' in value && typeof value.weight === 'number';
63
+ }
64
+ /**
65
+ * Convert number to base 256 and return as a big-endian Buffer.
66
+ * @param value - Value to convert.
67
+ * @returns Buffer representation of the number.
68
+ */
69
+ function numberToBufferBE(value) {
70
+ // Normalize value so that negative numbers aren't compared higher
71
+ // than positive numbers when accounting for two's complement.
72
+ value += Math.pow(2, 52);
73
+ const byteCount = Math.floor((value.toString(2).length + 7) / 8);
74
+ const buffer = Buffer.alloc(byteCount);
75
+ let i = 0;
76
+ while (value) {
77
+ buffer[i++] = value % 256;
78
+ value = Math.floor(value / 256);
79
+ }
80
+ return buffer.reverse();
81
+ }
82
+ /**
83
+ * Compare two array elements for sorting.
84
+ * @param a - left element to compare to right element.
85
+ * @param b - right element to compare to left element.
86
+ * @returns Negative if a < b, positive if b > a, 0 if equal.
87
+ */
88
+ function elementCompare(a, b) {
89
+ if (!isSortable(a) || !isSortable(b)) {
90
+ throw new Error('Array elements must be sortable');
91
+ }
92
+ if (a.weight === b.weight) {
93
+ if (a.value === undefined && b.value === undefined) {
94
+ throw new Error('Array elements must be sortable');
95
+ }
96
+ const aVal = transform(a.value);
97
+ const bVal = transform(b.value);
98
+ if ((!Buffer.isBuffer(aVal) && typeof aVal !== 'string' && typeof aVal !== 'number') ||
99
+ (!Buffer.isBuffer(bVal) && typeof bVal !== 'string' && typeof bVal !== 'number')) {
100
+ throw new Error('Array element value cannot be compared');
101
+ }
102
+ let aBuf, bBuf;
103
+ if (typeof aVal === 'number') {
104
+ aBuf = numberToBufferBE(aVal);
105
+ }
106
+ else {
107
+ aBuf = Buffer.from(aVal);
108
+ }
109
+ if (typeof bVal === 'number') {
110
+ bBuf = numberToBufferBE(bVal);
111
+ }
112
+ else {
113
+ bBuf = Buffer.from(bVal);
114
+ }
115
+ return bufferCompare(aBuf, bBuf);
116
+ }
117
+ return a.weight - b.weight;
118
+ }
119
+ /**
120
+ * Transform value into its canonical, serializable form.
121
+ * @param value - Value to transform.
122
+ * @returns Canonical, serializable form of value.
123
+ */
124
+ function transform(value) {
125
+ if (value === null || value === undefined) {
126
+ return value;
127
+ }
128
+ if (typeof value === 'string') {
129
+ // Transform hex strings to buffers.
130
+ if (value.startsWith('0x')) {
131
+ if (!value.match(/^0x([0-9a-fA-F]{2})*$/)) {
132
+ throw new Error('0x prefixed string contains non-hex characters.');
133
+ }
134
+ return Buffer.from(value.slice(2), 'hex');
135
+ }
136
+ else if (value.startsWith('\\0x')) {
137
+ return value.slice(1);
138
+ }
139
+ }
140
+ else if (value instanceof Array) {
141
+ // Enforce array elements are same type.
142
+ getType(value);
143
+ value = [...value];
144
+ value.sort(elementCompare);
145
+ return value.map(transform);
146
+ }
147
+ else if (value instanceof Object) {
148
+ const properties = Object.getOwnPropertyNames(value);
149
+ properties.sort();
150
+ return properties.reduce((acc, name) => {
151
+ acc[name] = transform(value[name]);
152
+ return acc;
153
+ }, {});
154
+ }
155
+ return value;
156
+ }
157
+ exports.transform = transform;
158
+ /**
159
+ * Untransform value into its human readable form.
160
+ * @param value - Value to untransform.
161
+ * @returns Untransformed, human readable form of value.
162
+ */
163
+ function untransform(value) {
164
+ if (Buffer.isBuffer(value)) {
165
+ return '0x' + value.toString('hex');
166
+ }
167
+ else if (typeof value === 'string') {
168
+ if (value.startsWith('0x')) {
169
+ return '\\' + value;
170
+ }
171
+ }
172
+ else if (value instanceof Array && value.length > 1) {
173
+ for (let i = 1; i < value.length; i++) {
174
+ if (value[i - 1].weight > value[i].weight) {
175
+ throw new Error('Array elements are not in canonical order');
176
+ }
177
+ }
178
+ return value.map(untransform);
179
+ }
180
+ else if (value instanceof Object) {
181
+ const properties = Object.getOwnPropertyNames(value);
182
+ for (let i = 1; i < properties.length; i++) {
183
+ if (properties[i - 1].localeCompare(properties[i]) > 0) {
184
+ throw new Error('Object properties are not in canonical order');
185
+ }
186
+ }
187
+ return properties.reduce((acc, name) => {
188
+ acc[name] = untransform(value[name]);
189
+ return acc;
190
+ }, {});
191
+ }
192
+ return value;
193
+ }
194
+ exports.untransform = untransform;
195
+ /**
196
+ * Serialize a value.
197
+ * @param value - Value to serialize.
198
+ * @returns Buffer representing serialized value.
199
+ */
200
+ function serialize(value) {
201
+ return (0, cbor_1.encode)(transform(value));
202
+ }
203
+ exports.serialize = serialize;
204
+ /**
205
+ * Deserialize a value.
206
+ * @param value - Buffer to deserialize.
207
+ * @returns Deserialized value.
208
+ */
209
+ function deserialize(value) {
210
+ return untransform((0, cbor_1.decodeFirstSync)(value));
211
+ }
212
+ exports.deserialize = deserialize;
213
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Jvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jYm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUErQztBQUUvQzs7OztHQUlHO0FBQ0gsU0FBUyxPQUFPLENBQUMsS0FBYztJQUM3QixJQUFJLEtBQUssS0FBSyxJQUFJLElBQUksS0FBSyxLQUFLLFNBQVMsRUFBRTtRQUN6QyxPQUFPLE1BQU0sQ0FBQztLQUNmO0lBQ0QsSUFBSS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xuICB9XG4gIHJldHVybiB2YWx1ZTtcbn1cblxuLyoqXG4gKiBTZXJpYWxpemUgYSB2YWx1ZS5cbiAqIEBwYXJhbSB2YWx1ZSAtIFZhbHVlIHRvIHNlcmlhbGl6ZS5cbiAqIEByZXR1cm5zIEJ1ZmZlciByZXByZXNlbnRpbmcgc2VyaWFsaXplZCB2YWx1ZS5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHNlcmlhbGl6ZTxUPih2YWx1ZTogVCk6IEJ1ZmZlciB7XG4gIHJldHVybiBlbmNvZGUodHJhbnNmb3JtKHZhbHVlKSk7XG59XG5cbi8qKlxuICogRGVzZXJpYWxpemUgYSB2YWx1ZS5cbiAqIEBwYXJhbSB2YWx1ZSAtIEJ1ZmZlciB0byBkZXNlcmlhbGl6ZS5cbiAqIEByZXR1cm5zIERlc2VyaWFsaXplZCB2YWx1ZS5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGRlc2VyaWFsaXplKHZhbHVlOiBCdWZmZXIpOiB1bmtub3duIHtcbiAgcmV0dXJuIHVudHJhbnNmb3JtKGRlY29kZUZpcnN0U3luYyh2YWx1ZSkpO1xufVxuIl19
@@ -0,0 +1,2 @@
1
+ export * as Cbor from './cbor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Cbor = void 0;
4
+ exports.Cbor = require("./cbor");
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsaUNBQStCIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogYXMgQ2JvciBmcm9tICcuL2Nib3InO1xuIl19
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/file.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/filereader.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/nofilter/types/index.d.ts","../../../node_modules/cbor/types/vendor/binary-parse-stream/index.d.ts","../../../node_modules/cbor/types/lib/tagged.d.ts","../../../node_modules/cbor/types/lib/decoder.d.ts","../../../node_modules/cbor/types/lib/commented.d.ts","../../../node_modules/cbor/types/lib/diagnose.d.ts","../../../node_modules/cbor/types/lib/encoder.d.ts","../../../node_modules/cbor/types/lib/simple.d.ts","../../../node_modules/cbor/types/lib/map.d.ts","../../../node_modules/cbor/types/lib/objectRecorder.d.ts","../../../node_modules/cbor/types/lib/sharedValueEncoder.d.ts","../../../node_modules/cbor/types/lib/cbor.d.ts","../src/cbor.ts","../src/index.ts","../package.json","../../../node_modules/@types/archy/index.d.ts","../../../node_modules/@types/bluebird/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/base-x/src/index.d.ts","../../../node_modules/@types/bs58/index.d.ts","../../../node_modules/keyv/src/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/responselike/index.d.ts","../../../node_modules/@types/cacheable-request/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/conventional-commits-parser/ts4.9/index.d.ts","../../../node_modules/@types/cookiejar/index.d.ts","../../../node_modules/@types/create-hmac/index.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@types/eccrypto/index.d.ts","../../../node_modules/@types/elliptic/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/ethereumjs-util/index.d.ts","../../../node_modules/@types/eventsource/dom-monkeypatch.d.ts","../../../node_modules/@types/eventsource/index.d.ts","../../../node_modules/@types/expect/index.d.ts","../../../node_modules/@types/fs-extra/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/jasmine/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/keyv/index.d.ts","../../../node_modules/@types/linkify-it/build/index.cjs.d.ts","../../../node_modules/@types/linkify-it/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/long/index.d.ts","../../../node_modules/@types/mdurl/build/index.cjs.d.ts","../../../node_modules/@types/mdurl/index.d.ts","../../../node_modules/@types/markdown-it/dist/index.cjs.d.ts","../../../node_modules/@types/markdown-it/index.d.ts","../../../node_modules/@types/mime-types/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/minimist/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/pbkdf2/index.d.ts","../../../node_modules/@types/qrcode/index.d.ts","../../../node_modules/@types/raf/index.d.ts","../../../node_modules/@types/randombytes/index.d.ts","../../../node_modules/@types/secp256k1/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/sha.js/index.d.ts","../../../node_modules/@types/sinon/ts3.1/index.d.ts","../../../node_modules/@types/sjcl/index.d.ts","../../../node_modules/@types/superagent/index.d.ts","../../../node_modules/@types/urijs/dom-monkeypatch.d.ts","../../../node_modules/@types/urijs/index.d.ts","../../../node_modules/@types/utf8/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/bignumber.js/bignumber.d.ts","../../../types/bignumber.js/index.d.ts","../../../types/express/index.d.ts","../../../types/keccak/index.d.ts","../../../node_modules/should/should.d.ts","../../../types/should-sinon/index.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"2db0dd3aaa2ed285950273ce96ae8a450b45423aa9da2d10e194570f1233fa6b","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"e7be367719c613d580d4b27fdf8fe64c9736f48217f4b322c0d63b2971460918","affectsGlobalScope":true},"3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36",{"version":"392eadc2af403dd10b4debfbc655c089a7fa6a9750caeb770cfb30051e55e848","affectsGlobalScope":true},"62f1c00d3d246e0e3cf0224f91e122d560428ec1ccc36bb51d4574a84f1dbad0","53f0960fdcc53d097918adfd8861ffbe0db989c56ffc16c052197bf115da5ed6",{"version":"662163e5327f260b23ca0a1a1ad8a74078aabb587c904fcb5ef518986987eaff","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb",{"version":"c48c503c6b3f63baf18257e9a87559b5602a4e960107c762586d2a6a62b64a18","affectsGlobalScope":true},"b0c0d1d13be149f790a75b381b413490f98558649428bb916fd2d71a3f47a134","3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","0364f8bb461d6e84252412d4e5590feda4eb582f77d47f7a024a7a9ff105dfdc","5433f7f77cd1fd53f45bd82445a4e437b2f6a72a32070e907530a4fea56c30c8","d0ca5d7df114035258a9d01165be309371fcccf0cccd9d57b1453204686d1ed0",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"9a30b7fefd7f8abbca4828d481c61c18e40fe5ff107e113b1c1fcd2c8dcf2743","affectsGlobalScope":true},"173b6275a81ebdb283b180654890f46516c21199734fed01a773b1c168b8c45c","304f66274aa8119e8d65a49b1cff84cbf803def6afe1b2cc987386e9a9890e22","1b9adafe8a7fefaeaf9099a0e06f602903f6268438147b843a33a5233ac71745","98273274f2dbb79b0b2009b20f74eca4a7146a3447c912d580cd5d2d94a7ae30","c933f7ba4b201c98b14275fd11a14abb950178afd2074703250fe3654fc10cd2","2eaa31492906bc8525aff3c3ec2236e22d90b0dfeee77089f196cd0adf0b3e3b",{"version":"ea455cc68871b049bcecd9f56d4cf27b852d6dafd5e3b54468ca87cc11604e4d","affectsGlobalScope":true},"8f5814f29dbaf8bacd1764aebdf1c8a6eb86381f6a188ddbac0fcbaab855ce52","a63d03de72adfb91777784015bd3b4125abd2f5ef867fc5a13920b5649e8f52b","d20e003f3d518a7c1f749dbe27c6ab5e3be7b3c905a48361b04a9557de4a6900",{"version":"1d4d78c8b23c9ddaaaa49485e6adc2ec01086dfe5d8d4d36ca4cdc98d2f7e74a","affectsGlobalScope":true},{"version":"44fc16356b81c0463cc7d7b2b35dcf324d8144136f5bc5ce73ced86f2b3475b5","affectsGlobalScope":true},"575fb200043b11b464db8e42cc64379c5fd322b6d787638e005b5ee98a64486d","6de2f225d942562733e231a695534b30039bdf1875b377bb7255881f0df8ede8","56249fd3ef1f6b90888e606f4ea648c43978ef43a7263aafad64f8d83cd3b8aa","139ad1dc93a503da85b7a0d5f615bddbae61ad796bc68fedd049150db67a1e26","7b166975fdbd3b37afb64707b98bca88e46577bbc6c59871f9383a7df2daacd1","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","81505c54d7cad0009352eaa21bd923ab7cdee7ec3405357a54d9a5da033a2084","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","3c1f19c7abcda6b3a4cf9438a15c7307a080bd3b51dfd56b198d9f86baf19447","2ee1645e0df9d84467cfe1d67b0ad3003c2f387de55874d565094464ee6f2927",{"version":"071d4b4af5755e1a081aa3b785b5526d09276af5a50e4725dea26edd4e7deb31","affectsGlobalScope":true},{"version":"9cf780e96b687e4bdfd1907ed26a688c18b89797490a00598fa8b8ab683335dd","affectsGlobalScope":true},"98e00f3613402504bc2a2c9a621800ab48e0a463d1eed062208a4ae98ad8f84c","9ae88ce9f73446c24b2d2452e993b676da1b31fca5ceb7276e7f36279f693ed1","e49d7625faff2a7842e4e7b9b197f972633fca685afcf6b4403400c97d087c36","b82c38abc53922b1b3670c3af6f333c21b735722a8f156e7d357a2da7c53a0a0",{"version":"b423f53647708043299ded4daa68d95c967a2ac30aa1437adc4442129d7d0a6c","affectsGlobalScope":true},{"version":"7245af181218216bacb01fbdf51095617a51661f20d77178c69a377e16fb69ed","affectsGlobalScope":true},"4f0fc7b7f54422bd97cfaf558ddb4bca86893839367b746a8f86b60ac7619673","4cdd8b6b51599180a387cc7c1c50f49eca5ce06595d781638fd0216520d98246","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"8704423bf338bff381ebc951ed819935d0252d90cd6de7dffe5b0a5debb65d07","affectsGlobalScope":true},"7c6929fd7cbf38499b6a600b91c3b603d1d78395046dc3499b2b92d01418b94b",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a42be67ed1ddaec743582f41fc219db96a1b69719fccac6d1464321178d610fc","a5193be78a634ab211a471d41295c21d5f54675a97330b9a1720b8e41887cc10","83c1ba8b6d747485ff09206e7c5d7532f3b44a8bfcb002e48f50f5f051ea9a4a","43b31498c95a593f3f7168b16ff68ea04e2e6c84f0fd68202e356286c79040f9","f76f38c4ccedb027993c1077a86faf5e385a0010a1471e9936ff161834149918","72ae38e969e3e8fb7631f9b8c4974bd18af9b6cd075d11c354a6c41538ff3f86","b78b543da8c56fd11295b7154b6b17478797cf4fd2a236729d2701d166d91f00","98f9f2089fcc21cf8be6bc6d4c0c20b5f6933a7fe36f57b01c4951eb0482bca9","1006c614527de8832eb5f8c6de68ca910b0bac25d931cfb459884b52fc2b9aea","d19103d893cfada4d66b3947d20d14d9e1431d3ba16a66d87985a5668aae2160","172035de856c114189c089c5bcec0dc47716ee562946ac8d4e10a96cd54b16c9","7c559565fe235c8452dc846365e1bd06ad0ebca510a3c4949d89a05d472e204e","9d87d7b67c0ad1cc456e0bed96faab74d68cd16443521dbee249c94d7093bc43",{"version":"ab36210ada4e9fd1622604bb9b33206b2bbc18b498b612c542b2fd479abdab37","signature":"875b546e158c428c79b93ac5a518d2618b346829bd3bd9c945bed3728fe10afa"},"d3e650b5e80f003e83a9b959b92a61d494a898703b95d8adb4d418a8e73ae843",{"version":"1691d7fac82fe601f7ba900088a5604b5f1187fad7fbe97431f306973aaafeb6","signature":"49f562f1b8637be95fa72606652bdca732095d1249a5432e42b52b6cfbdf1a1b"},"c31294ba7381e921caa30d4408fa7637053d9cb3456a750f276fd8a9bb0e42d8","ee3a39a0de7a80b8f3637977bdba57bfc48c87877aac70011ddc391c5a91ab5c","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","e91751abb2372a36a90869d36f6ad5d5e69a84c5513ca99d236554e4dd8b9aa1","721e7b8ccbcdb0599123bcc94b18ca247bc329cda0a4028703cf5610b4c3f90a","42baf4ca38c38deaf411ea73f37bc39ff56c6e5c761a968b64ac1b25c92b5cd8","d7dbe0ad36bdca8a6ecf143422a48e72cc8927bab7b23a1a2485c2f78a7022c6","8718fa41d7cf4aa91de4e8f164c90f88e0bf343aa92a1b9b725a9c675c64e16b","f992cd6cc0bcbaa4e6c810468c90f2d8595f8c6c3cf050c806397d3de8585562","104c67f0da1bdf0d94865419247e20eded83ce7f9911a1aa75fc675c077ca66e","f96f3c445afc7d65d4790386e37c5b57f095f285cc89b8315b209fe0c81837c1","0dc6940ff35d845686a118ee7384713a84024d60ef26f25a2f87992ec7ddbd64","5385a7d591ae122fa744b647909ed60c065fc74715f2d350325aefb20af7381f","68cc8d6fcc2f270d7108f02f3ebc59480a54615be3e09a47e14527f349e9d53e","3eb11dbf3489064a47a2e1cf9d261b1f100ef0b3b50ffca6c44dd99d6dd81ac1","c0017998521cb9c4844bbc2b522ed2c257aa04e4582967fd6168fcd86cc13ab4","bc9d7f2a012412c294f4eb0fc856e063112a3666957a190542b62662391810b2",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe","085d4c9f010e6f363961dd1939a851d029b97994f705d79f2a72a0c88a5c4bc5",{"version":"0b812af1c8e8062774c99f008bea098f290db21fd3b4efb0c539356e722e9f6a","affectsGlobalScope":true},"c6bb7e4c7e80685ad60e2b286ee7eea9fffb05d48e24e52dbbb67d7214596e33","975f84de013567851d216d78a3a86736bb330cae11fdc907b222dffa148b31d2","ed19da84b7dbf00952ad0b98ce5c194f1903bcf7c94d8103e8e0d63b271543ae","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044",{"version":"0fc30665ed9340743e9a9fee26b4bf59f71280315a7b13a0c37f59c07ddab2d9","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","fec943fdb3275eb6e006b35e04a8e2e99e9adf3f4b969ddf15315ac7575a93e4","742f21debb3937c3839a63245648238555bdab1ea095d43fd10c88a64029bf76","7cfdf3b9a5ba934a058bfc9390c074104dc7223b7e3c16fd5335206d789bc3d3","ff81bffa4ecfceae2e86b5920c3fcb250b66b1d6ed72944dffdf58123be2481b","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","da2b6356b84a40111aaecb18304ea4e4fcb43d70efb1c13ca7d7a906445ee0d3","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","aa2c18a1b5a086bbcaae10a4efba409cc95ba7287d8cf8f2591b53704fea3dea","6f294731b495c65ecf46a5694f0082954b961cf05463bea823f8014098eaffa0","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","6c65d33115c7410ecbb59db5fcbb042fc6b831a258d028dbb06b42b75d8459c1","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","b03afe4bec768ae333582915146f48b161e567a81b5ebc31c4d78af089770ac9","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9","4f6a12044ee6f458db11964153830abbc499e73d065c51c329ec97407f4b13dd","0e60e0cbf2283adfd5a15430ae548cd2f662d581b5da6ecd98220203e7067c70","0944f27ebff4b20646b71e7e3faaaae50a6debd40bc63e225de1320dd15c5795","5d30565583300c9256072a013ac0318cc603ff769b4c5cafc222394ea93963e1","6dfd0aeb128f03ebaa66306bf1fc753bf434f47373900fc2205660fae499ac2e","a109c4289d59d9019cfe1eeab506fe57817ee549499b02a83a7e9d3bdf662d63","169cc96316cacf8b489aaab4ac6bcef7b33e8779a8902bce57c737b4aa372d16","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","fbca5ffaebf282ec3cdac47b0d1d4a138a8b0bb32105251a38acb235087d3318",{"version":"3f6d6465811321abc30a1e5f667feed63e5b3917b3d6c8d6645daf96c75f97ba","affectsGlobalScope":true},"22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","916be7d770b0ae0406be9486ac12eb9825f21514961dd050594c4b250617d5a8","254d9fb8c872d73d34594be8a200fd7311dbfa10a4116bfc465fba408052f2b3","e7500c5c071db4d1e20e87166be266f489dd632b738e885b221e6efa6c8efe89","4cf58cd73f135e59d2268b4b792623bd8cc7ea887d96498f2a64d550beb930bb","cc6bdeb756593c9c914204f158057b328ed53c898f176a0706a8dafcc108b49e","d8f7109e14f20eb735225a62fd3f8366da1a8349e90331cdad57f4b04caf6c5a","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","2bc8dc34e17c2289dec4615104ee29c874bf5e5224e199e376fdd502bb83ef9a","168435ab3390620aebf1aa0001b380983582d0849755eeb17f2c501d1fc57587","bf405bf5f16c35b3b2f0956602e4305d2b799a80ccbe384ff7cbfdd742cfc688","31c502014e5ba046d5cb060136929b73fd53f0f989aa37b2b0424644cb0d93ef",{"version":"c3924759a92cd75c7b9d36bc3aa7614e31c81df4a1dd8fc4289a9eeb56c596e0","affectsGlobalScope":true},{"version":"88c95849c807dcd491e15d624f27bc5e5680590bfb87d0278612aaee2d6214f7","affectsGlobalScope":true},"a6a80d576cb7beda26af64d1e0a23e382c9986fae214de994870f4cd7b4e0ea1","f7163a5d37d21f636f6a5cd1c064ce95fada21917859a64b6cc49a8b6fd5c1a8","bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","b7b0003c5404c9cae2d7caf5d6b469b190cea06cce7815ba0e479a4457875290","e9b48596baefe465d46567a4beccd564035024a154d99f54c7fed02380707333","1cf13a0e412ccde6ac154f59ad8e7c04ec603951a090c7799e107e5aff594c5c",{"version":"70f0ddc58f8b7283e1cffa39863938ab694e14fb3dcf0cac4d78b2d002f91255","affectsGlobalScope":true},{"version":"00e7b47f372bb59d96a4d8007f83d389f8e3010617150a256e26e1be8a6a5995","affectsGlobalScope":true},{"version":"79da89e1b61cecf107f52a0c2578f31528bc0accdc73bec7325f468a5706a559","affectsGlobalScope":true},"4de163cf9037509faf9276540c717c0879309ee4e385b5ccfe6de54868d50de1"],"options":{"composite":true,"declaration":true,"declarationMap":true,"inlineSourceMap":true,"inlineSources":true,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitThis":true,"outDir":"./","rootDir":"..","skipLibCheck":true,"strictBindCallApply":true,"strictFunctionTypes":true,"strictNullChecks":true,"strictPropertyInitialization":true,"target":6},"fileIdsList":[[142],[143],[130],[130,149],[92,95,122,130,151,152,153],[95,130],[111,130],[85,130],[159],[148],[164,166],[163,164,165],[130,148],[169],[93,130],[92,130],[177],[179,181,182,183,184,185,186,187,188,189,190,191],[179,180,182,183,184,185,186,187,188,189,190,191],[180,181,182,183,184,185,186,187,188,189,190,191],[179,180,181,183,184,185,186,187,188,189,190,191],[179,180,181,182,184,185,186,187,188,189,190,191],[179,180,181,182,183,185,186,187,188,189,190,191],[179,180,181,182,183,184,186,187,188,189,190,191],[179,180,181,182,183,184,185,187,188,189,190,191],[179,180,181,182,183,184,185,186,188,189,190,191],[179,180,181,182,183,184,185,186,187,189,190,191],[179,180,181,182,183,184,185,186,187,188,190,191],[179,180,181,182,183,184,185,186,187,188,189,191],[179,180,181,182,183,184,185,186,187,188,189,190],[178,194],[195],[193],[43],[79],[80,85,114],[81,86,92,93,100,111,122],[81,82,92,100],[83,123],[84,85,93,101],[85,111,119],[86,88,92,100],[79,87],[88,89],[92],[90,92],[79,92],[92,93,94,111,122],[92,93,94,107,111,114],[77,80,127],[88,92,95,100,111,122],[92,93,95,96,100,111,119,122],[95,97,111,119,122],[43,44,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129],[92,98],[99,122,127],[88,92,100,111],[101],[102],[79,103],[100,101,104,121,127],[105],[106],[92,107,108],[107,109,123,125],[80,92,111,112,113,114],[80,111,113],[111,112],[114],[115],[79,111],[92,117,118],[117,118],[85,100,111,119],[120],[100,121],[80,95,106,122],[85,123],[111,124],[99,125],[126],[80,85,92,94,103,111,122,125,127],[111,128],[95,111,130],[208,247],[208,232,247],[247],[208],[208,233,247],[208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246],[233,247],[80,93,95,111,130,157],[252],[92,95,97,111,119,122,128,130],[256],[133,134,135,136,137,138,139,141],[80,111,130,131,134],[80,111,130,131,132,133],[111,134],[80,111,130,131],[137,140],[111,131],[80,111,130],[54,58,122],[54,111,122],[49],[51,54,119,122],[100,119],[49,130],[51,54,100,122],[46,47,50,53,80,92,111,122],[46,52],[50,54,80,114,122,130],[80,130],[70,80,130],[48,49,130],[54],[48,49,50,51,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,73,74,75,76],[54,61,62],[52,54,62,63],[53],[46,49,54],[54,58,62,63],[58],[52,54,57,122],[46,51,52,54,58,61],[80,111],[49,54,70,80,127,130],[258,259],[262]],"referencedMap":[[143,1],[144,2],[148,3],[150,4],[154,5],[155,6],[156,7],[158,8],[160,9],[161,3],[162,10],[167,11],[166,12],[168,13],[170,14],[172,15],[176,16],[178,17],[180,18],[181,19],[179,20],[182,21],[183,22],[184,23],[185,24],[186,25],[187,26],[188,27],[189,28],[190,29],[191,30],[195,31],[196,32],[194,33],[43,34],[44,34],[79,35],[80,36],[81,37],[82,38],[83,39],[84,40],[85,41],[86,42],[87,43],[88,44],[89,44],[91,45],[90,46],[92,47],[93,48],[94,49],[78,50],[95,51],[96,52],[97,53],[130,54],[98,55],[99,56],[100,57],[101,58],[102,59],[103,60],[104,61],[105,62],[106,63],[107,64],[108,64],[109,65],[111,66],[113,67],[112,68],[114,69],[115,70],[116,71],[117,72],[118,73],[119,74],[120,75],[121,76],[122,77],[123,78],[124,79],[125,80],[126,81],[127,82],[128,83],[203,3],[204,7],[206,8],[153,84],[207,3],[232,85],[233,86],[208,87],[211,87],[230,85],[231,85],[221,85],[220,88],[218,85],[213,85],[226,85],[224,85],[228,85],[212,85],[225,85],[229,85],[214,85],[215,85],[227,85],[209,85],[216,85],[217,85],[219,85],[223,85],[234,89],[222,85],[210,85],[247,90],[241,89],[243,91],[242,89],[235,89],[236,89],[238,89],[240,89],[244,91],[245,91],[237,91],[239,91],[248,8],[251,92],[253,93],[255,94],[257,95],[149,3],[142,96],[135,97],[134,98],[136,99],[137,100],[141,101],[132,102],[151,45],[131,103],[61,104],[68,105],[60,104],[75,106],[52,107],[51,108],[74,3],[69,109],[72,110],[54,111],[53,112],[49,113],[48,114],[71,115],[50,116],[55,117],[59,117],[77,118],[76,117],[63,119],[64,120],[66,121],[62,122],[65,123],[70,3],[57,124],[58,125],[67,126],[47,127],[73,128],[259,129],[263,130]],"exportedModulesMap":[[144,2],[148,3],[150,4],[154,5],[155,6],[156,7],[158,8],[160,9],[161,3],[162,10],[167,11],[166,12],[168,13],[170,14],[172,15],[176,16],[178,17],[180,18],[181,19],[179,20],[182,21],[183,22],[184,23],[185,24],[186,25],[187,26],[188,27],[189,28],[190,29],[191,30],[195,31],[196,32],[194,33],[43,34],[44,34],[79,35],[80,36],[81,37],[82,38],[83,39],[84,40],[85,41],[86,42],[87,43],[88,44],[89,44],[91,45],[90,46],[92,47],[93,48],[94,49],[78,50],[95,51],[96,52],[97,53],[130,54],[98,55],[99,56],[100,57],[101,58],[102,59],[103,60],[104,61],[105,62],[106,63],[107,64],[108,64],[109,65],[111,66],[113,67],[112,68],[114,69],[115,70],[116,71],[117,72],[118,73],[119,74],[120,75],[121,76],[122,77],[123,78],[124,79],[125,80],[126,81],[127,82],[128,83],[203,3],[204,7],[206,8],[153,84],[207,3],[232,85],[233,86],[208,87],[211,87],[230,85],[231,85],[221,85],[220,88],[218,85],[213,85],[226,85],[224,85],[228,85],[212,85],[225,85],[229,85],[214,85],[215,85],[227,85],[209,85],[216,85],[217,85],[219,85],[223,85],[234,89],[222,85],[210,85],[247,90],[241,89],[243,91],[242,89],[235,89],[236,89],[238,89],[240,89],[244,91],[245,91],[237,91],[239,91],[248,8],[251,92],[253,93],[255,94],[257,95],[149,3],[142,96],[135,97],[134,98],[136,99],[137,100],[141,101],[132,102],[151,45],[131,103],[61,104],[68,105],[60,104],[75,106],[52,107],[51,108],[74,3],[69,109],[72,110],[54,111],[53,112],[49,113],[48,114],[71,115],[50,116],[55,117],[59,117],[77,118],[76,117],[63,119],[64,120],[66,121],[62,122],[65,123],[70,3],[57,124],[58,125],[67,126],[47,127],[73,128],[259,129],[263,130]],"semanticDiagnosticsPerFile":[145,143,144,146,147,148,150,154,155,156,157,158,160,161,162,167,163,166,164,168,169,170,171,172,173,152,174,165,175,176,177,178,180,181,179,182,183,184,185,186,187,188,189,190,191,192,195,196,193,194,197,198,199,200,159,43,44,79,80,81,82,83,84,85,86,87,88,89,91,90,92,93,94,78,129,95,96,97,130,98,99,100,101,102,103,104,105,106,107,108,109,110,111,113,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,201,202,203,204,205,206,153,207,232,233,208,211,230,231,221,220,218,213,226,224,228,212,225,229,214,215,227,209,216,217,219,223,234,222,210,247,246,241,243,242,235,236,238,240,244,245,237,239,248,249,250,251,252,253,254,255,256,257,149,258,45,142,135,134,136,137,139,140,141,138,133,132,151,131,262,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,33,30,31,32,34,7,35,40,41,36,37,38,39,1,42,61,68,60,75,52,51,74,69,72,54,53,49,48,71,50,55,56,59,46,77,76,63,64,66,62,65,70,57,58,67,47,73,259,260,261,263],"latestChangedDtsFile":"./src/index.d.ts"},"version":"4.9.5"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo-beta/deser-lib",
3
- "version": "1.0.1-beta.3",
3
+ "version": "1.0.1-beta.300",
4
4
  "description": "BitGo serialization and deseralization library",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "dependencies": {
43
43
  "cbor": "^9.0.1"
44
44
  },
45
- "gitHead": "19b127edc0db7b6757eb1691a685f756d94d5108"
45
+ "gitHead": "23f6be76076006bd168a8c778f63e49c53e4b477"
46
46
  }
package/.prettierignore DELETED
@@ -1,2 +0,0 @@
1
- .nyc_output/
2
- dist/
package/.prettierrc.yml DELETED
@@ -1,3 +0,0 @@
1
- printWidth: 120
2
- singleQuote: true
3
- trailingComma: 'es5'
package/src/cbor.ts DELETED
@@ -1,216 +0,0 @@
1
- import { decodeFirstSync, encodeCanonical } from 'cbor';
2
-
3
- /**
4
- * Return a string describing value as a type.
5
- * @param value - Any javascript value to type.
6
- * @returns String describing value type.
7
- */
8
- function getType(value: unknown): string {
9
- if (value === null || value === undefined) {
10
- return 'null';
11
- }
12
- if (value instanceof Array) {
13
- const types = value.map(getType);
14
- if (!types.slice(1).every((value) => value === types[0])) {
15
- throw new Error('Array elements are not of the same type');
16
- }
17
- return JSON.stringify([types[0]]);
18
- }
19
- if (value instanceof Object) {
20
- const properties = Object.getOwnPropertyNames(value);
21
- properties.sort();
22
- return JSON.stringify(
23
- properties.reduce((acc, name) => {
24
- acc[name] = getType(value[name]);
25
- return acc;
26
- }, {})
27
- );
28
- }
29
- if (typeof value === 'string') {
30
- if (value.startsWith('0x')) {
31
- return 'bytes';
32
- }
33
- return 'string';
34
- }
35
- return JSON.stringify(typeof value);
36
- }
37
-
38
- /**
39
- * Compare two buffers for sorting.
40
- * @param a - left buffer to compare to right buffer.
41
- * @param b - right buffer to compare to left buffer.
42
- * @returns Negative if a < b, positive if b > a, 0 if equal.
43
- */
44
- function bufferCompare(a: Buffer, b: Buffer): number {
45
- let i = 0;
46
- while (i < a.length && i < b.length && a[i] == b[i]) {
47
- i++;
48
- }
49
- if (i === a.length && i === b.length) {
50
- return 0;
51
- }
52
- if (i === a.length || i === b.length) {
53
- return a.length - b.length;
54
- }
55
- return a[i] - b[i];
56
- }
57
-
58
- /** A sortable array element. */
59
- type Sortable = {
60
- weight: number;
61
- value?: unknown;
62
- };
63
-
64
- /**
65
- * Type check for sortable array element.
66
- * @param value - Value to type check.
67
- * @returns True if value is a sortable array element.
68
- */
69
- function isSortable(value: unknown): value is Sortable {
70
- return value instanceof Object && 'weight' in value && typeof (value as Sortable).weight === 'number';
71
- }
72
-
73
- /**
74
- * Convert number to base 256 and return as a big-endian Buffer.
75
- * @param value - Value to convert.
76
- * @returns Buffer representation of the number.
77
- */
78
- function numberToBufferBE(value: number): Buffer {
79
- // Normalize value so that negative numbers aren't compared higher
80
- // than positive numbers when accounting for two's complement.
81
- value += Math.pow(2, 52);
82
- const byteCount = Math.floor((value.toString(2).length + 7) / 8);
83
- const buffer = Buffer.alloc(byteCount);
84
- let i = 0;
85
- while (value) {
86
- buffer[i++] = value % 256;
87
- value = Math.floor(value / 256);
88
- }
89
- return buffer.reverse();
90
- }
91
-
92
- /**
93
- * Compare two array elements for sorting.
94
- * @param a - left element to compare to right element.
95
- * @param b - right element to compare to left element.
96
- * @returns Negative if a < b, positive if b > a, 0 if equal.
97
- */
98
- function elementCompare(a: unknown, b: unknown): number {
99
- if (!isSortable(a) || !isSortable(b)) {
100
- throw new Error('Array elements must be sortable');
101
- }
102
- if (a.weight === b.weight) {
103
- if (a.value === undefined && b.value === undefined) {
104
- throw new Error('Array elements must be sortable');
105
- }
106
- const aVal = transform(a.value);
107
- const bVal = transform(b.value);
108
- if (
109
- (!Buffer.isBuffer(aVal) && typeof aVal !== 'string' && typeof aVal !== 'number') ||
110
- (!Buffer.isBuffer(bVal) && typeof bVal !== 'string' && typeof bVal !== 'number')
111
- ) {
112
- throw new Error('Array element value cannot be compared');
113
- }
114
- let aBuf, bBuf;
115
- if (typeof aVal === 'number') {
116
- aBuf = numberToBufferBE(aVal);
117
- } else {
118
- aBuf = Buffer.from(aVal);
119
- }
120
- if (typeof bVal === 'number') {
121
- bBuf = numberToBufferBE(bVal);
122
- } else {
123
- bBuf = Buffer.from(bVal);
124
- }
125
- return bufferCompare(aBuf, bBuf);
126
- }
127
- return a.weight - b.weight;
128
- }
129
-
130
- /**
131
- * Transform value into its canonical, serializable form.
132
- * @param value - Value to transform.
133
- * @returns Canonical, serializable form of value.
134
- */
135
- export function transform<T>(value: T): T | Buffer {
136
- if (value === null || value === undefined) {
137
- return value;
138
- }
139
- if (typeof value === 'string') {
140
- // Transform hex strings to buffers.
141
- if (value.startsWith('0x')) {
142
- if (!value.match(/^0x([0-9a-fA-F]{2})*$/)) {
143
- throw new Error('0x prefixed string contains non-hex characters.');
144
- }
145
- return Buffer.from(value.slice(2), 'hex');
146
- } else if (value.startsWith('\\0x')) {
147
- return value.slice(1) as unknown as T;
148
- }
149
- } else if (value instanceof Array) {
150
- // Enforce array elements are same type.
151
- getType(value);
152
- value = [...value] as unknown as T;
153
- (value as unknown as Array<unknown>).sort(elementCompare);
154
- return (value as unknown as Array<unknown>).map(transform) as unknown as T;
155
- } else if (value instanceof Object) {
156
- const properties = Object.getOwnPropertyNames(value);
157
- properties.sort();
158
- return properties.reduce((acc, name) => {
159
- acc[name] = transform(value[name]);
160
- return acc;
161
- }, {}) as unknown as T;
162
- }
163
- return value;
164
- }
165
-
166
- /**
167
- * Untransform value into its human readable form.
168
- * @param value - Value to untransform.
169
- * @returns Untransformed, human readable form of value.
170
- */
171
- export function untransform<T>(value: T): T | string {
172
- if (Buffer.isBuffer(value)) {
173
- return '0x' + value.toString('hex');
174
- } else if (typeof value === 'string') {
175
- if (value.startsWith('0x')) {
176
- return '\\' + value;
177
- }
178
- } else if (value instanceof Array && value.length > 1) {
179
- for (let i = 1; i < value.length; i++) {
180
- if (value[i - 1].weight > value[i].weight) {
181
- throw new Error('Array elements are not in canonical order');
182
- }
183
- }
184
- return value.map(untransform) as unknown as T;
185
- } else if (value instanceof Object) {
186
- const properties = Object.getOwnPropertyNames(value);
187
- for (let i = 1; i < properties.length; i++) {
188
- if (properties[i - 1].localeCompare(properties[i]) > 0) {
189
- throw new Error('Object properties are not in caonical order');
190
- }
191
- }
192
- return properties.reduce((acc, name) => {
193
- acc[name] = untransform(value[name]);
194
- return acc;
195
- }, {}) as unknown as T;
196
- }
197
- return value;
198
- }
199
-
200
- /**
201
- * Serialize a value.
202
- * @param value - Value to serialize.
203
- * @returns Buffer representing serialized value.
204
- */
205
- export function serialize<T>(value: T): Buffer {
206
- return encodeCanonical(transform(value));
207
- }
208
-
209
- /**
210
- * Deserialize a value.
211
- * @param value - Buffer to deserialize.
212
- * @returns Deserialized value.
213
- */
214
- export function deserialize(value: Buffer): unknown {
215
- return untransform(decodeFirstSync(value));
216
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * as Cbor from './cbor';
@@ -1,96 +0,0 @@
1
- [
2
- {
3
- "deserialized": {
4
- "keys": [
5
- {
6
- "key": "0x010203",
7
- "weight": 0
8
- },
9
- {
10
- "key": "0x040506",
11
- "weight": 1
12
- }
13
- ]
14
- },
15
- "serialized": "a1646b65797382a2636b6579430102036677656967687400a2636b6579430405066677656967687401"
16
- },
17
- {
18
- "deserialized": {
19
- "a": "0xffffffff",
20
- "b": "0x00000000",
21
- "c": "0xffffffff",
22
- "d": [
23
- {
24
- "weight": 0
25
- },
26
- {
27
- "weight": 1
28
- },
29
- {
30
- "weight": 2
31
- },
32
- {
33
- "weight": 3
34
- }
35
- ]
36
- },
37
- "serialized": "a4616144ffffffff61624400000000616344ffffffff616484a16677656967687400a16677656967687401a16677656967687402a16677656967687403"
38
- },
39
- {
40
- "deserialized": {
41
- "a": [
42
- {
43
- "value": "a",
44
- "weight": 0
45
- },
46
- {
47
- "value": "b",
48
- "weight": 0
49
- },
50
- {
51
- "value": "c",
52
- "weight": 0
53
- }
54
- ]
55
- },
56
- "serialized": "a1616183a26576616c756561616677656967687400a26576616c756561626677656967687400a26576616c756561636677656967687400"
57
- },
58
- {
59
- "deserialized": {
60
- "a": [
61
- {
62
- "value": "0x0a",
63
- "weight": 0
64
- },
65
- {
66
- "value": "0x0b",
67
- "weight": 0
68
- },
69
- {
70
- "value": "0x0c",
71
- "weight": 0
72
- }
73
- ]
74
- },
75
- "serialized": "a1616183a26576616c7565410a6677656967687400a26576616c7565410b6677656967687400a26576616c7565410c6677656967687400"
76
- },
77
- {
78
- "deserialized": {
79
- "a": [
80
- {
81
- "value": 1,
82
- "weight": 0
83
- },
84
- {
85
- "value": 2,
86
- "weight": 0
87
- },
88
- {
89
- "value": 3,
90
- "weight": 0
91
- }
92
- ]
93
- },
94
- "serialized": "a1616183a26576616c7565016677656967687400a26576616c7565026677656967687400a26576616c7565036677656967687400"
95
- }
96
- ]
@@ -1,326 +0,0 @@
1
- import { Cbor } from '../..';
2
- import * as cborFixtures from '../cbor/fixtures.json';
3
-
4
- describe('deser-lib', function () {
5
- describe('cbor', function () {
6
- describe('transform', function () {
7
- it('orders object properties canonically', function () {
8
- const res = Cbor.transform({ b: 'second', a: 'first' }) as any;
9
- const properties = Object.getOwnPropertyNames(res);
10
- properties[0].should.equal('a');
11
- properties[1].should.equal('b');
12
- res.a.should.equal('first');
13
- res.b.should.equal('second');
14
- });
15
-
16
- describe('canonical ordering', function () {
17
- it('orders by weight', function () {
18
- const res = Cbor.transform([
19
- { weight: 2, value: null },
20
- { weight: 1, value: null },
21
- ]) as any;
22
- res[0].weight.should.equal(1);
23
- res[1].weight.should.equal(2);
24
- });
25
-
26
- it('groups equal elements', function () {
27
- const res = Cbor.transform([
28
- {
29
- weight: 2,
30
- value: 'b',
31
- },
32
- {
33
- weight: 1,
34
- value: 'a',
35
- },
36
- {
37
- weight: 3,
38
- value: 'c',
39
- },
40
- {
41
- weight: 2,
42
- value: 'b',
43
- },
44
- ]) as any;
45
- res[0].weight.should.equal(1);
46
- res[1].weight.should.equal(2);
47
- res[2].weight.should.equal(2);
48
- res[3].weight.should.equal(3);
49
- });
50
-
51
- it('orders number values', function () {
52
- const res = Cbor.transform([
53
- { weight: 1, value: 2 },
54
- { weight: 1, value: 1 },
55
- ]) as any;
56
- res[0].value.should.equal(1);
57
- res[1].value.should.equal(2);
58
- });
59
-
60
- it('orders string values', function () {
61
- const res = Cbor.transform([
62
- { weight: 1, value: 'ab' },
63
- { weight: 1, value: 'aa' },
64
- ]) as any;
65
- res[0].value.should.equal('aa');
66
- res[1].value.should.equal('ab');
67
- });
68
-
69
- it('orders byte values', function () {
70
- const res = Cbor.transform([
71
- { weight: 1, value: '0x0b' },
72
- { weight: 1, value: '0x0a' },
73
- ]) as any;
74
- res[0].value.equals(Buffer.from([0x0a])).should.equal(true);
75
- res[1].value.equals(Buffer.from([0x0b])).should.equal(true);
76
- });
77
-
78
- it('orders string values of different lengths', function () {
79
- const res = Cbor.transform([
80
- { weight: 1, value: 'ab' },
81
- { weight: 1, value: 'a' },
82
- ]) as any;
83
- res[0].value.should.equal('a');
84
- res[1].value.should.equal('ab');
85
- });
86
-
87
- it('throws for elements without weight', function () {
88
- (() => Cbor.transform([{}, {}])).should.throw();
89
- });
90
-
91
- it('throws for elements without value', function () {
92
- (() => Cbor.transform([{ weight: 1 }, { weight: 1 }])).should.throw();
93
- });
94
-
95
- it('throws for values that cannot be compared', function () {
96
- (() =>
97
- Cbor.transform([
98
- { weight: 1, value: {} },
99
- { weight: 1, value: 1 },
100
- ])).should.throw();
101
- (() =>
102
- Cbor.transform([
103
- { weight: 1, value: undefined },
104
- { weight: 1, value: null },
105
- ])).should.throw();
106
- });
107
-
108
- it('throws for elements of mixed type', function () {
109
- (() =>
110
- Cbor.transform([
111
- { weight: 0, value: '0' },
112
- { weight: 0, value: 0 },
113
- ])).should.throw();
114
- });
115
- });
116
-
117
- it('preserves null values', function () {
118
- const res = Cbor.transform({ value: null }) as any;
119
- res.should.have.property('value').which.is.null();
120
- });
121
-
122
- it('replaces prefixed hex strings with Buffers', function () {
123
- const hex = '00010203';
124
- const res = Cbor.transform({ value: '0x' + hex }) as any;
125
- Buffer.isBuffer(res.value).should.equal(true);
126
- res.value.equals(Buffer.from(hex, 'hex')).should.equal(true);
127
- });
128
-
129
- it('preserves non-prefixed hex strings', function () {
130
- const string = '00010203';
131
- const res = Cbor.transform({ value: string }) as any;
132
- res.value.should.equal(string);
133
- });
134
-
135
- it('preserves escaped strings', function () {
136
- const string = '0xPrefixedString';
137
- const res = Cbor.transform({ value: '\\' + string }) as any;
138
- res.value.should.equal(string);
139
- });
140
-
141
- it('transforms object recursively', function () {
142
- const res = Cbor.transform({ value: { b: 'second', a: 'first' } }) as any;
143
- const properties = Object.getOwnPropertyNames(res.value);
144
- properties[0].should.equal('a');
145
- properties[1].should.equal('b');
146
- res.value.a.should.equal('first');
147
- res.value.b.should.equal('second');
148
- });
149
-
150
- it('transforms array recursively', function () {
151
- const res = Cbor.transform([{ weight: 0, value: { b: 'second', a: 'first' } }]) as any;
152
- const properties = Object.getOwnPropertyNames(res[0].value);
153
- properties[0].should.equal('a');
154
- properties[1].should.equal('b');
155
- res[0].value.a.should.equal('first');
156
- res[0].value.b.should.equal('second');
157
- });
158
-
159
- it('throws for invalid hex strings', function () {
160
- (() => Cbor.transform('0x0g')).should.throw();
161
- });
162
- });
163
-
164
- describe('untransform', function () {
165
- it('untransforms object', function () {
166
- const res = Cbor.untransform({ a: 'first', b: 'second' }) as any;
167
- const properties = Object.getOwnPropertyNames(res);
168
- properties[0].should.equal('a');
169
- properties[1].should.equal('b');
170
- res.a.should.equal('first');
171
- res.b.should.equal('second');
172
- });
173
-
174
- it('enforces canonical object property order', function () {
175
- (() => Cbor.untransform({ b: 'second', a: 'first' })).should.throw();
176
- });
177
-
178
- it('enforces canonical array element order', function () {
179
- (() => Cbor.untransform([{ weight: 2 }, { weight: 1 }])).should.throw();
180
- });
181
-
182
- it('replaces Buffers with prefixed hex strings', function () {
183
- const hex = '00010203';
184
- const res = Cbor.untransform({ value: Buffer.from(hex, 'hex') }) as any;
185
- res.value.should.equal('0x' + hex);
186
- });
187
-
188
- it('preserves non-prefixed hex strings', function () {
189
- const string = '00010203';
190
- const res = Cbor.untransform({ value: string }) as any;
191
- res.value.should.equal(string);
192
- });
193
-
194
- it('escapes prefixed string', function () {
195
- const string = '0xPrefixedString';
196
- const res = Cbor.untransform({ value: string }) as any;
197
- res.value.should.equal('\\' + string);
198
- });
199
-
200
- it('untransforms object recursively', function () {
201
- const hex = '00010203';
202
- const res = Cbor.untransform({ value: { value: Buffer.from(hex, 'hex') } }) as any;
203
- res.value.value.should.equal('0x' + hex);
204
- });
205
-
206
- it('untransforms array recursively', function () {
207
- const hex = '00010203';
208
- const res = Cbor.untransform([{ value: Buffer.from(hex, 'hex'), weight: 0 }]) as any;
209
- res[0].value.should.equal('0x' + hex);
210
- });
211
- });
212
-
213
- describe('fixtures', function () {
214
- xit('creates test vectors', function () {
215
- const { writeFileSync } = require('fs');
216
- const deserialized = [
217
- {
218
- keys: [
219
- {
220
- key: '0x010203',
221
- weight: 0,
222
- },
223
- {
224
- key: '0x040506',
225
- weight: 1,
226
- },
227
- ],
228
- },
229
- {
230
- a: '0xffffffff',
231
- b: '0x00000000',
232
- c: '0xffffffff',
233
- d: [
234
- {
235
- weight: 0,
236
- },
237
- {
238
- weight: 1,
239
- },
240
- {
241
- weight: 2,
242
- },
243
- {
244
- weight: 3,
245
- },
246
- ],
247
- },
248
- {
249
- a: [
250
- {
251
- value: 'a',
252
- weight: 0,
253
- },
254
- {
255
- value: 'b',
256
- weight: 0,
257
- },
258
- {
259
- value: 'c',
260
- weight: 0,
261
- },
262
- ],
263
- },
264
- {
265
- a: [
266
- {
267
- weight: 0,
268
- value: '0x0a',
269
- },
270
- {
271
- weight: 0,
272
- value: '0x0b',
273
- },
274
- {
275
- weight: 0,
276
- value: '0x0c',
277
- },
278
- ],
279
- },
280
- {
281
- a: [
282
- {
283
- weight: 0,
284
- value: 1,
285
- },
286
- {
287
- weight: 0,
288
- value: 2,
289
- },
290
- {
291
- weight: 0,
292
- value: 3,
293
- },
294
- ],
295
- },
296
- ];
297
- const serialized = deserialized.map((x) => Cbor.serialize(x).toString('hex'));
298
- writeFileSync(
299
- 'test/cbor/fixtures.json',
300
- JSON.stringify(
301
- deserialized.map((deserialized, i) => ({
302
- deserialized: Cbor.untransform(Cbor.transform(deserialized)),
303
- serialized: serialized[i],
304
- })),
305
- null,
306
- 2
307
- )
308
- );
309
- });
310
-
311
- for (let i = 0; i < cborFixtures.length; i++) {
312
- it(`deserializes vector[${i}]`, function () {
313
- const { deserialized, serialized } = cborFixtures[i];
314
- Cbor.serialize(deserialized).equals(Buffer.from(serialized, 'hex')).should.equal(true);
315
- });
316
- }
317
-
318
- for (let i = 0; i < cborFixtures.length; i++) {
319
- it(`serializes vector[${i}]`, function () {
320
- const { deserialized, serialized } = cborFixtures[i];
321
- JSON.stringify(Cbor.deserialize(Buffer.from(serialized, 'hex'))).should.equal(JSON.stringify(deserialized));
322
- });
323
- }
324
- });
325
- });
326
- });
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "."
6
- },
7
- "include": ["src/**/*", "package.json"]
8
- }