@metamask/utils 1.0.0 → 3.0.0
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 +44 -1
- package/README.md +1 -1
- package/dist/__fixtures__/index.d.ts +1 -0
- package/dist/__fixtures__/index.js +18 -0
- package/dist/__fixtures__/index.js.map +1 -0
- package/dist/__fixtures__/json.d.ts +825 -0
- package/dist/__fixtures__/json.js +797 -0
- package/dist/__fixtures__/json.js.map +1 -0
- package/dist/collections.js +31 -33
- package/dist/collections.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +187 -40
- package/dist/json.js +336 -12
- package/dist/json.js.map +1 -1
- package/dist/logging.d.ts +29 -0
- package/dist/logging.js +43 -0
- package/dist/logging.js.map +1 -0
- package/dist/misc.d.ts +47 -0
- package/dist/misc.js +80 -1
- package/dist/misc.js.map +1 -1
- package/dist/time.d.ts +37 -16
- package/dist/time.js +50 -17
- package/dist/time.js.map +1 -1
- package/package.json +11 -7
package/CHANGELOG.md
CHANGED
|
@@ -6,9 +6,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [3.0.0]
|
|
10
|
+
### Added
|
|
11
|
+
- Add logging functions ([#20](https://github.com/MetaMask/utils/pull/20))
|
|
12
|
+
- Add frozen collections (implemented in [#5](https://github.com/MetaMask/utils/pull/5) but exported in [#19](https://github.com/MetaMask/utils/pull/19))
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- **BREAKING:** Improve types and type validation ([#19](https://github.com/MetaMask/utils/pull/19))
|
|
16
|
+
- Various type changes have been made that might be breaking:
|
|
17
|
+
- The `JsonRpcRequest` and `JsonRpcNotification` types now include a generic constraint requiring that the `Params` type extends the `JsonRpcParams` type.
|
|
18
|
+
- The `JsonRpcSuccess` and `JsonRpcResponse` types now include a generic contraint for the `Result` type, requiring that it extends the `Json` type.
|
|
19
|
+
- Various validation functions now accept `unknown` parameters rather than specific types. This should not be breaking except that it may affect type inference for the parameters passed in.
|
|
20
|
+
- New JSON-related functions have been added:
|
|
21
|
+
- `assertIsJsonRpcResponse`
|
|
22
|
+
- `isJsonRpcResponse`
|
|
23
|
+
- `InferWithParams`
|
|
24
|
+
- `JsonRpcParams`
|
|
25
|
+
- New JSON Struct types have been added:
|
|
26
|
+
- `JsonRpcErrorStruct`
|
|
27
|
+
- `JsonRpcFailureStruct`
|
|
28
|
+
- `JsonRpcIdStruct`
|
|
29
|
+
- `JsonRpcParamsStruct`
|
|
30
|
+
- `JsonRpcRequestStruct`
|
|
31
|
+
- `JsonRpcResponseStruct`
|
|
32
|
+
- `JsonRpcSuccessStruct`
|
|
33
|
+
- `JsonRpcVersionStruct`
|
|
34
|
+
- `JsonStruct`
|
|
35
|
+
|
|
36
|
+
## [2.1.0]
|
|
37
|
+
### Added
|
|
38
|
+
- Add JSON storage validation and limit utilities ([#14](https://github.com/MetaMask/utils/pull/14))
|
|
39
|
+
- Adds a new function `validateJsonAndGetSize`.
|
|
40
|
+
|
|
41
|
+
## [2.0.0]
|
|
42
|
+
### Added
|
|
43
|
+
- Add more JSON utils ([#8](https://github.com/MetaMask/utils/pull/8))
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
- **BREAKING:** Refactor and expand time utils ([#9](https://github.com/MetaMask/utils/pull/9))
|
|
47
|
+
- Adds a new function, `inMilliseconds`, and moves the time constants into a TypeScript `enum`.
|
|
48
|
+
|
|
9
49
|
## [1.0.0]
|
|
10
50
|
### Added
|
|
11
51
|
- Initial release
|
|
12
52
|
|
|
13
|
-
[Unreleased]: https://github.com/MetaMask/utils/compare/
|
|
53
|
+
[Unreleased]: https://github.com/MetaMask/utils/compare/v3.0.0...HEAD
|
|
54
|
+
[3.0.0]: https://github.com/MetaMask/utils/compare/v2.1.0...v3.0.0
|
|
55
|
+
[2.1.0]: https://github.com/MetaMask/utils/compare/v2.0.0...v2.1.0
|
|
56
|
+
[2.0.0]: https://github.com/MetaMask/utils/compare/v1.0.0...v2.0.0
|
|
14
57
|
[1.0.0]: https://github.com/MetaMask/utils/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ or
|
|
|
12
12
|
|
|
13
13
|
## API
|
|
14
14
|
|
|
15
|
-
The full API documentation for the latest published version of this library is [available here](https://metamask.github.io/
|
|
15
|
+
The full API documentation for the latest published version of this library is [available here](https://metamask.github.io/utils/index.html).
|
|
16
16
|
|
|
17
17
|
## Contributing
|
|
18
18
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './json';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./json"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/__fixtures__/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB","sourcesContent":["export * from './json';\n"]}
|