@metamask/snaps-utils
Advanced tools
Comparing version 0.26.0 to 0.26.1
@@ -10,2 +10,3 @@ export * from './caveats'; | ||
export * from './object'; | ||
export * from './path'; | ||
export * from './snaps'; | ||
@@ -12,0 +13,0 @@ export * from './types'; |
@@ -26,2 +26,3 @@ "use strict"; | ||
__exportStar(require("./object"), exports); | ||
__exportStar(require("./path"), exports); | ||
__exportStar(require("./snaps"), exports); | ||
@@ -28,0 +29,0 @@ __exportStar(require("./types"), exports); |
@@ -15,2 +15,3 @@ export * from './caveats'; | ||
export * from './object'; | ||
export * from './path'; | ||
export * from './post-process'; | ||
@@ -17,0 +18,0 @@ export * from './snaps'; |
@@ -31,2 +31,3 @@ "use strict"; | ||
__exportStar(require("./object"), exports); | ||
__exportStar(require("./path"), exports); | ||
__exportStar(require("./post-process"), exports); | ||
@@ -33,0 +34,0 @@ __exportStar(require("./snaps"), exports); |
@@ -320,4 +320,4 @@ import { Infer, Struct } from 'superstruct'; | ||
}, { | ||
filePath: Struct<string, null>; | ||
iconPath: Struct<string | undefined, null>; | ||
filePath: Struct<string, unknown>; | ||
iconPath: Struct<string | undefined, unknown>; | ||
packageName: Struct<string, null>; | ||
@@ -505,1 +505,10 @@ registry: Struct<"https://registry.npmjs.org" | "https://registry.npmjs.org/", null>; | ||
export declare function assertIsSnapManifest(value: unknown): asserts value is SnapManifest; | ||
/** | ||
* Creates a {@link SnapManifest} object from JSON. | ||
* | ||
* | ||
* @param value - The value to check. | ||
* @throws If the value cannot be coerced to a {@link SnapManifest} object. | ||
* @returns The created {@link SnapManifest} object. | ||
*/ | ||
export declare function createSnapManifest(value: unknown): SnapManifest; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assertIsSnapManifest = exports.isSnapManifest = exports.SnapManifestStruct = exports.PermissionsStruct = exports.SnapGetBip32EntropyPermissionsStruct = exports.Bip32EntropyStruct = exports.bip32entropy = exports.Bip32PathStruct = exports.base64 = exports.SIP_6_MAGIC_VALUE = void 0; | ||
exports.createSnapManifest = exports.assertIsSnapManifest = exports.isSnapManifest = exports.SnapManifestStruct = exports.PermissionsStruct = exports.SnapGetBip32EntropyPermissionsStruct = exports.Bip32EntropyStruct = exports.bip32entropy = exports.Bip32PathStruct = exports.base64 = exports.SIP_6_MAGIC_VALUE = void 0; | ||
const utils_1 = require("@metamask/utils"); | ||
@@ -9,2 +9,3 @@ const superstruct_1 = require("superstruct"); | ||
const namespace_1 = require("../namespace"); | ||
const path_1 = require("../path"); | ||
const types_1 = require("../types"); | ||
@@ -99,2 +100,4 @@ const versions_1 = require("../versions"); | ||
}); | ||
/* eslint-enable @typescript-eslint/naming-convention */ | ||
const relativePath = (struct) => (0, superstruct_1.coerce)(struct, struct, (value) => (0, path_1.normalizeRelative)(value)); | ||
exports.SnapManifestStruct = (0, superstruct_1.object)({ | ||
@@ -112,4 +115,4 @@ version: versions_1.VersionStruct, | ||
npm: (0, superstruct_1.object)({ | ||
filePath: (0, superstruct_1.size)((0, superstruct_1.string)(), 1, Infinity), | ||
iconPath: (0, superstruct_1.optional)((0, superstruct_1.size)((0, superstruct_1.string)(), 1, Infinity)), | ||
filePath: relativePath((0, superstruct_1.size)((0, superstruct_1.string)(), 1, Infinity)), | ||
iconPath: (0, superstruct_1.optional)(relativePath((0, superstruct_1.size)((0, superstruct_1.string)(), 1, Infinity))), | ||
packageName: types_1.NameStruct, | ||
@@ -146,2 +149,15 @@ registry: (0, superstruct_1.union)([ | ||
exports.assertIsSnapManifest = assertIsSnapManifest; | ||
/** | ||
* Creates a {@link SnapManifest} object from JSON. | ||
* | ||
* | ||
* @param value - The value to check. | ||
* @throws If the value cannot be coerced to a {@link SnapManifest} object. | ||
* @returns The created {@link SnapManifest} object. | ||
*/ | ||
function createSnapManifest(value) { | ||
// TODO: Add a utility to prefix these errors similar to assertStruct | ||
return (0, superstruct_1.create)(value, exports.SnapManifestStruct); | ||
} | ||
exports.createSnapManifest = createSnapManifest; | ||
//# sourceMappingURL=validation.js.map |
{ | ||
"name": "@metamask/snaps-utils", | ||
"version": "0.26.0", | ||
"version": "0.26.1", | ||
"repository": { | ||
@@ -23,3 +23,3 @@ "type": "git", | ||
"browser": { | ||
"./dist/index": "./dist/index.browser.js" | ||
"./dist/index.js": "./dist/index.browser.js" | ||
}, | ||
@@ -56,3 +56,3 @@ "typesVersions": { | ||
"@babel/types": "^7.18.7", | ||
"@metamask/snaps-types": "^0.26.0", | ||
"@metamask/snaps-types": "^0.26.1", | ||
"@metamask/utils": "^3.3.1", | ||
@@ -59,0 +59,0 @@ "@noble/hashes": "^1.1.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
317674
90
4094