@metamask/utils
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -59,3 +59,3 @@ import { Infer, Struct } from 'superstruct'; | ||
export declare type JsonRpcError = OptionalField<Infer<typeof JsonRpcErrorStruct>, 'data'>; | ||
export declare const JsonRpcParamsStruct: Struct<unknown[] | Record<string, unknown> | undefined, null>; | ||
export declare const JsonRpcParamsStruct: Struct<Record<string, Json> | Json[] | undefined, null>; | ||
export declare type JsonRpcParams = Infer<typeof JsonRpcParamsStruct>; | ||
@@ -66,3 +66,3 @@ export declare const JsonRpcRequestStruct: Struct<{ | ||
jsonrpc: "2.0"; | ||
params?: unknown[] | Record<string, unknown> | undefined; | ||
params?: Record<string, Json> | Json[] | undefined; | ||
}, { | ||
@@ -72,3 +72,3 @@ id: Struct<string | number | null, null>; | ||
method: Struct<string, null>; | ||
params: Struct<unknown[] | Record<string, unknown> | undefined, null>; | ||
params: Struct<Record<string, Json> | Json[] | undefined, null>; | ||
}>; | ||
@@ -87,3 +87,3 @@ export declare type InferWithParams<Type extends Struct<any, unknown>, Params extends JsonRpcParams> = Omit<Infer<Type>, 'params'> & (keyof Params extends undefined ? { | ||
jsonrpc: "2.0"; | ||
params?: unknown[] | Record<string, unknown> | undefined; | ||
params?: Record<string, Json> | Json[] | undefined; | ||
}, Omit<{ | ||
@@ -93,3 +93,3 @@ id: Struct<string | number | null, null>; | ||
method: Struct<string, null>; | ||
params: Struct<unknown[] | Record<string, unknown> | undefined, null>; | ||
params: Struct<Record<string, Json> | Json[] | undefined, null>; | ||
}, "id">>; | ||
@@ -96,0 +96,0 @@ /** |
@@ -5,7 +5,10 @@ "use strict"; | ||
const superstruct_1 = require("superstruct"); | ||
const assert_1 = require("./assert"); | ||
const misc_1 = require("./misc"); | ||
const assert_1 = require("./assert"); | ||
exports.JsonStruct = (0, superstruct_1.define)('Json', (value) => { | ||
const [isValid] = validateJsonAndGetSize(value, true); | ||
return isValid; | ||
if (!isValid) { | ||
return 'Expected a valid JSON-serializable value'; | ||
} | ||
return true; | ||
}); | ||
@@ -35,3 +38,3 @@ /** | ||
}); | ||
exports.JsonRpcParamsStruct = (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.object)(), (0, superstruct_1.array)()])); | ||
exports.JsonRpcParamsStruct = (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.record)((0, superstruct_1.string)(), exports.JsonStruct), (0, superstruct_1.array)(exports.JsonStruct)])); | ||
exports.JsonRpcRequestStruct = (0, superstruct_1.object)({ | ||
@@ -38,0 +41,0 @@ id: exports.JsonRpcIdStruct, |
{ | ||
"name": "@metamask/utils", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Various JavaScript/TypeScript utilities of wide relevance to the MetaMask codebase.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2694
207250
42
1