@truffle/contract-schema
Advanced tools
Comparing version 3.2.4 to 3.2.5
32
index.js
@@ -67,3 +67,3 @@ var pkgVersion = require("./package.json").version; | ||
sources: ["abi", "interface"], | ||
transform: function(value) { | ||
transform: function (value) { | ||
if (typeof value === "string") { | ||
@@ -87,3 +87,3 @@ try { | ||
sources: ["bytecode", "binary", "unlinked_binary", "evm.bytecode.object"], | ||
transform: function(value) { | ||
transform: function (value) { | ||
if (value && value.indexOf("0x") !== 0) { | ||
@@ -101,3 +101,3 @@ value = "0x" + value; | ||
], | ||
transform: function(value) { | ||
transform: function (value) { | ||
if (value && value.indexOf("0x") !== 0) { | ||
@@ -110,2 +110,4 @@ value = "0x" + value; | ||
immutableReferences: {}, | ||
generatedSources: {}, | ||
deployedGeneratedSources: {}, | ||
sourceMap: { | ||
@@ -125,3 +127,3 @@ sources: ["sourceMap", "srcmap", "evm.bytecode.sourceMap"] | ||
legacyAST: { | ||
transform: function(value, obj) { | ||
transform: function (value, obj) { | ||
var schemaVersion = obj.schemaVersion || "0.0.0"; | ||
@@ -148,3 +150,3 @@ | ||
*/ | ||
transform: function(value = {}, obj) { | ||
transform: function (value = {}, obj) { | ||
// Sanitize value's events for known networks | ||
@@ -174,3 +176,3 @@ Object.keys(value).forEach(networkId => { | ||
sources: ["updatedAt", "updated_at"], | ||
transform: function(value) { | ||
transform: function (value) { | ||
if (typeof value === "number") { | ||
@@ -195,3 +197,3 @@ value = new Date(value).toISOString(); | ||
if (transform === undefined) { | ||
transform = function(x) { | ||
transform = function (x) { | ||
return x; | ||
@@ -201,3 +203,3 @@ }; | ||
return function(obj) { | ||
return function (obj) { | ||
try { | ||
@@ -223,4 +225,4 @@ return transform(obj[key]); | ||
var getters = Array.prototype.slice.call(arguments); | ||
return function(obj) { | ||
return getters.reduce(function(cur, get) { | ||
return function (obj) { | ||
return getters.reduce(function (cur, get) { | ||
return get(cur); | ||
@@ -238,3 +240,3 @@ }, obj); | ||
// - Rejects with list of errors from schema validator | ||
validate: function(contractObj) { | ||
validate: function (contractObj) { | ||
var ajv = new Ajv({ verbose: true }); | ||
@@ -284,3 +286,3 @@ ajv.addSchema(abiSchema); | ||
// returns a contract object | ||
normalize: function(objDirty, options) { | ||
normalize: function (objDirty, options) { | ||
options = options || {}; | ||
@@ -290,3 +292,3 @@ var normalized = {}; | ||
// iterate over each property | ||
Object.keys(properties).forEach(function(key) { | ||
Object.keys(properties).forEach(function (key) { | ||
var property = properties[key]; | ||
@@ -305,3 +307,3 @@ var value; // normalized value || undefined | ||
if (typeof source === "string") { | ||
var traversals = source.split(".").map(function(k) { | ||
var traversals = source.split(".").map(function (k) { | ||
return getter(k); | ||
@@ -328,3 +330,3 @@ }); | ||
// Copy x- options | ||
Object.keys(objDirty).forEach(function(key) { | ||
Object.keys(objDirty).forEach(function (key) { | ||
if (key.indexOf("x-") === 0) { | ||
@@ -331,0 +333,0 @@ normalized[key] = getter(key)(objDirty); |
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "3.2.4", | ||
"version": "3.2.5", | ||
"main": "index.js", | ||
@@ -43,3 +43,3 @@ "directories": { | ||
}, | ||
"gitHead": "bc2ded4ced7b49a29ee5236e31f3a62773b2a142" | ||
"gitHead": "01381004f67cfd64865e3c8dbf4fe78882189817" | ||
} |
@@ -87,2 +87,8 @@ { | ||
"$ref": "#/definitions/ImmutableReferences" | ||
}, | ||
"generatedSources": { | ||
"$ref": "#/definitions/GeneratedSources" | ||
}, | ||
"deployedGeneratedSources": { | ||
"$ref": "#/definitions/GeneratedSources" | ||
} | ||
@@ -156,2 +162,16 @@ }, | ||
}, | ||
"GeneratedSources": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"id": {"type": "integer", "minimum": 0}, | ||
"language": {"type": "string"}, | ||
"name": {"type": "string"}, | ||
"contents": {"type": "string"}, | ||
"ast": {"type": "object"} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"Source": { | ||
@@ -158,0 +178,0 @@ "type": "string" |
@@ -81,2 +81,11 @@ /* tslint:disable */ | ||
export type SchemaVersion = string; | ||
export type GeneratedSources = { | ||
id?: number; | ||
language?: string; | ||
name?: string; | ||
contents?: string; | ||
ast?: { | ||
[k: string]: any; | ||
}; | ||
}[]; | ||
@@ -127,2 +136,4 @@ /** | ||
immutableReferences?: ImmutableReferences; | ||
generatedSources?: GeneratedSources; | ||
deployedGeneratedSources?: GeneratedSources; | ||
/** | ||
@@ -129,0 +140,0 @@ * This interface was referenced by `ContractObject`'s JSON-Schema definition |
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
259731
6579
1