Comparing version 1.0.18 to 1.0.19
let libManyfest = require(`../source/Manyfest.js`); | ||
let animalManyfest = new libManyfest( | ||
{ | ||
"Scope": "Animal", | ||
"Descriptors": | ||
{ | ||
"IDAnimal": { "Name":"Database ID", "Description":"The unique integer-based database identifier for an Animal record.", "DataType":"Integer" }, | ||
"Name": { "Description":"The animal's colloquial species name (e.g. Rabbit, Dog, Bear, Mongoose)." }, | ||
"Type": { "Description":"Whether or not the animal is wild, domesticated, agricultural, in a research lab or a part of a zoo.." } | ||
} | ||
}); | ||
let animalManyfest = new libManyfest() | ||
// { | ||
// "Scope": "Animal", | ||
// "Descriptors": | ||
// { | ||
// "IDAnimal": { "Name":"Database ID", "Description":"The unique integer-based database identifier for an Animal record.", "DataType":"Integer" }, | ||
// "Name": { "Description":"The animal's colloquial species name (e.g. Rabbit, Dog, Bear, Mongoose)." }, | ||
// "Type": { "Description":"Whether or not the animal is wild, domesticated, agricultural, in a research lab or a part of a zoo.." } | ||
// } | ||
// }); | ||
@@ -14,0 +14,0 @@ // Make up a cute and furry test creature |
{ | ||
"name": "manyfest", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "JSON Object Manifest for Data Description and Parsing", | ||
@@ -5,0 +5,0 @@ "main": "source/Manyfest.js", |
@@ -17,3 +17,5 @@ /** | ||
const _DefaultConfiguration = { Scope:'Default', Descriptors: {} } | ||
/** | ||
@@ -134,14 +136,15 @@ * Manyfest object address-based descriptions and manipulations. | ||
this.logError(`(${this.scope}) Error loading manifest; expecting an object but parameter was type ${typeof(pManifest)}.`); | ||
return false; | ||
} | ||
if (pManifest.hasOwnProperty('Scope')) | ||
let tmpManifest = (typeof(pManifest) == 'object') ? pManifest : {}; | ||
if (tmpManifest.hasOwnProperty('Scope')) | ||
{ | ||
if (typeof(pManifest.Scope) === 'string') | ||
if (typeof(tmpManifest.Scope) === 'string') | ||
{ | ||
this.scope = pManifest.Scope; | ||
this.scope = tmpManifest.Scope; | ||
} | ||
else | ||
{ | ||
this.logError(`(${this.scope}) Error loading scope from manifest; expecting a string but property was type ${typeof(pManifest.Scope)}.`, pManifest); | ||
this.logError(`(${this.scope}) Error loading scope from manifest; expecting a string but property was type ${typeof(tmpManifest.Scope)}.`, tmpManifest); | ||
} | ||
@@ -151,13 +154,13 @@ } | ||
{ | ||
this.logError(`(${this.scope}) Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.`, pManifest); | ||
this.logError(`(${this.scope}) Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.`, tmpManifest); | ||
} | ||
if (pManifest.hasOwnProperty('Descriptors')) | ||
if (tmpManifest.hasOwnProperty('Descriptors')) | ||
{ | ||
if (typeof(pManifest.Descriptors) === 'object') | ||
if (typeof(tmpManifest.Descriptors) === 'object') | ||
{ | ||
let tmpDescriptionAddresses = Object.keys(pManifest.Descriptors); | ||
let tmpDescriptionAddresses = Object.keys(tmpManifest.Descriptors); | ||
for (let i = 0; i < tmpDescriptionAddresses.length; i++) | ||
{ | ||
this.addDescriptor(tmpDescriptionAddresses[i], pManifest.Descriptors[tmpDescriptionAddresses[i]]); | ||
this.addDescriptor(tmpDescriptionAddresses[i], tmpManifest.Descriptors[tmpDescriptionAddresses[i]]); | ||
} | ||
@@ -167,3 +170,3 @@ } | ||
{ | ||
this.logError(`(${this.scope}) Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ${typeof(pManifest.Descriptors)}.`, pManifest); | ||
this.logError(`(${this.scope}) Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ${typeof(tmpManifest.Descriptors)}.`, tmpManifest); | ||
} | ||
@@ -173,7 +176,7 @@ } | ||
{ | ||
this.logError(`(${this.scope}) Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.`, pManifest); | ||
this.logError(`(${this.scope}) Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.`, tmpManifest); | ||
} | ||
// This seems like it would create a circular dependency issue but it only goes as deep as the schema defines Solvers | ||
if ((pManifest.hasOwnProperty('Solvers')) && (typeof(pManifest.Solvers) == 'object')) | ||
if ((tmpManifest.hasOwnProperty('Solvers')) && (typeof(tmpManifest.Solvers) == 'object')) | ||
{ | ||
@@ -193,10 +196,12 @@ // There are elucidator solvers passed-in, so we will create one to filter data. | ||
// Basically on aggregation, if a filter is set it will set "keep record" to true and let the solver decide differently. | ||
this.dataSolvers = new libElucidator(pManifest.Solvers, this.logInfo, this.logError); | ||
// Please refresh yourself on the complex metaprogramming mechanics of both the manyfest DSL and the elucidator configuration permutation before changing any of this. | ||
// You broke it. You bought it. | ||
this.dataSolvers = new libElucidator(tmpManifest.Solvers, this.logInfo, this.logError); | ||
// Load the solver state in so each instruction can have internal config | ||
// TODO: Should this just be a part of the lower layer pattern? | ||
let tmpSolverKeys = Object.keys(pManifest.Solvers) | ||
let tmpSolverKeys = Object.keys(tmpManifest.Solvers) | ||
for (let i = 0; i < tmpSolverKeys.length; i++) | ||
{ | ||
this.dataSolverState[tmpSolverKeys] = pManifest.Solvers[tmpSolverKeys[i]]; | ||
// Each of these are passed through the metatemplate. | ||
this.dataSolverState[tmpSolverKeys] = tmpManifest.Solvers[tmpSolverKeys[i]]; | ||
} | ||
@@ -203,0 +208,0 @@ |
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
286861
5003