manyfest 1.0.17 → 1.0.19
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/debug/Harness.js +10 -10
- package/package.json +11 -11
- package/source/Manyfest.js +22 -17
package/debug/Harness.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
let libManyfest = require(`../source/Manyfest.js`);
|
|
2
2
|
|
|
3
|
-
let animalManyfest = new libManyfest(
|
|
4
|
-
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
3
|
+
let animalManyfest = new libManyfest()
|
|
4
|
+
// {
|
|
5
|
+
// "Scope": "Animal",
|
|
6
|
+
// "Descriptors":
|
|
7
|
+
// {
|
|
8
|
+
// "IDAnimal": { "Name":"Database ID", "Description":"The unique integer-based database identifier for an Animal record.", "DataType":"Integer" },
|
|
9
|
+
// "Name": { "Description":"The animal's colloquial species name (e.g. Rabbit, Dog, Bear, Mongoose)." },
|
|
10
|
+
// "Type": { "Description":"Whether or not the animal is wild, domesticated, agricultural, in a research lab or a part of a zoo.." }
|
|
11
|
+
// }
|
|
12
|
+
// });
|
|
13
13
|
|
|
14
14
|
// Make up a cute and furry test creature
|
|
15
15
|
let testAnimal = {IDAnimal:8675309, Name:'BatBrains', Type:'Lab', Color:'Brown'};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "manyfest",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "JSON Object Manifest for Data Description and Parsing",
|
|
5
5
|
"main": "source/Manyfest.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@babel/core": "^7.
|
|
46
|
-
"@babel/preset-env": "^7.
|
|
47
|
-
"@testing-library/dom": "^
|
|
48
|
-
"async": "^3.2.
|
|
45
|
+
"@babel/core": "^7.21.5",
|
|
46
|
+
"@babel/preset-env": "^7.21.5",
|
|
47
|
+
"@testing-library/dom": "^9.2.0",
|
|
48
|
+
"async": "^3.2.4",
|
|
49
49
|
"browserify": "^17.0.0",
|
|
50
|
-
"chai": "4.3.
|
|
50
|
+
"chai": "4.3.7",
|
|
51
51
|
"gulp": "^4.0.2",
|
|
52
52
|
"gulp-babel": "^8.0.0",
|
|
53
53
|
"gulp-buble": "^0.9.0",
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"gulp-sourcemaps": "^3.0.0",
|
|
56
56
|
"gulp-terser": "^2.1.0",
|
|
57
57
|
"gulp-util": "^3.0.8",
|
|
58
|
-
"jsdom": "^
|
|
59
|
-
"mocha": "
|
|
60
|
-
"npm-check-updates": "^
|
|
58
|
+
"jsdom": "^21.1.1",
|
|
59
|
+
"mocha": "10.2.0",
|
|
60
|
+
"npm-check-updates": "^16.10.9",
|
|
61
61
|
"nyc": "^15.1.0",
|
|
62
62
|
"vinyl-buffer": "^1.0.1",
|
|
63
63
|
"vinyl-source-stream": "^2.0.0"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"elucidator": "^1.0.
|
|
67
|
-
"precedent": "^1.0.
|
|
66
|
+
"elucidator": "^1.0.7",
|
|
67
|
+
"precedent": "^1.0.9"
|
|
68
68
|
},
|
|
69
69
|
"author": "steven velozo <steven@velozo.com>",
|
|
70
70
|
"license": "MIT",
|
package/source/Manyfest.js
CHANGED
|
@@ -14,6 +14,8 @@ let libObjectAddressDeleteValue = require('./Manyfest-ObjectAddress-DeleteValue.
|
|
|
14
14
|
let libObjectAddressGeneration = require('./Manyfest-ObjectAddressGeneration.js');
|
|
15
15
|
let libSchemaManipulation = require('./Manyfest-SchemaManipulation.js');
|
|
16
16
|
|
|
17
|
+
const _DefaultConfiguration = { Scope:'Default', Descriptors: {} }
|
|
18
|
+
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Manyfest object address-based descriptions and manipulations.
|
|
@@ -130,47 +132,48 @@ class Manyfest
|
|
|
130
132
|
if (typeof(pManifest) !== 'object')
|
|
131
133
|
{
|
|
132
134
|
this.logError(`(${this.scope}) Error loading manifest; expecting an object but parameter was type ${typeof(pManifest)}.`);
|
|
133
|
-
return false;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
+
let tmpManifest = (typeof(pManifest) == 'object') ? pManifest : {};
|
|
138
|
+
|
|
139
|
+
if (tmpManifest.hasOwnProperty('Scope'))
|
|
137
140
|
{
|
|
138
|
-
if (typeof(
|
|
141
|
+
if (typeof(tmpManifest.Scope) === 'string')
|
|
139
142
|
{
|
|
140
|
-
this.scope =
|
|
143
|
+
this.scope = tmpManifest.Scope;
|
|
141
144
|
}
|
|
142
145
|
else
|
|
143
146
|
{
|
|
144
|
-
this.logError(`(${this.scope}) Error loading scope from manifest; expecting a string but property was type ${typeof(
|
|
147
|
+
this.logError(`(${this.scope}) Error loading scope from manifest; expecting a string but property was type ${typeof(tmpManifest.Scope)}.`, tmpManifest);
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
150
|
else
|
|
148
151
|
{
|
|
149
|
-
this.logError(`(${this.scope}) Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.`,
|
|
152
|
+
this.logError(`(${this.scope}) Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.`, tmpManifest);
|
|
150
153
|
}
|
|
151
154
|
|
|
152
|
-
if (
|
|
155
|
+
if (tmpManifest.hasOwnProperty('Descriptors'))
|
|
153
156
|
{
|
|
154
|
-
if (typeof(
|
|
157
|
+
if (typeof(tmpManifest.Descriptors) === 'object')
|
|
155
158
|
{
|
|
156
|
-
let tmpDescriptionAddresses = Object.keys(
|
|
159
|
+
let tmpDescriptionAddresses = Object.keys(tmpManifest.Descriptors);
|
|
157
160
|
for (let i = 0; i < tmpDescriptionAddresses.length; i++)
|
|
158
161
|
{
|
|
159
|
-
this.addDescriptor(tmpDescriptionAddresses[i],
|
|
162
|
+
this.addDescriptor(tmpDescriptionAddresses[i], tmpManifest.Descriptors[tmpDescriptionAddresses[i]]);
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
165
|
else
|
|
163
166
|
{
|
|
164
|
-
this.logError(`(${this.scope}) Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ${typeof(
|
|
167
|
+
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);
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
else
|
|
168
171
|
{
|
|
169
|
-
this.logError(`(${this.scope}) Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.`,
|
|
172
|
+
this.logError(`(${this.scope}) Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.`, tmpManifest);
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
// This seems like it would create a circular dependency issue but it only goes as deep as the schema defines Solvers
|
|
173
|
-
if ((
|
|
176
|
+
if ((tmpManifest.hasOwnProperty('Solvers')) && (typeof(tmpManifest.Solvers) == 'object'))
|
|
174
177
|
{
|
|
175
178
|
// There are elucidator solvers passed-in, so we will create one to filter data.
|
|
176
179
|
let libElucidator = require('elucidator');
|
|
@@ -185,14 +188,16 @@ class Manyfest
|
|
|
185
188
|
// IF YOU PERMUTE THE Record SUBOBJECT YOU CAN AFFECT RECURSION
|
|
186
189
|
// This is mostly meant for if statements to filter.
|
|
187
190
|
// Basically on aggregation, if a filter is set it will set "keep record" to true and let the solver decide differently.
|
|
188
|
-
|
|
191
|
+
// Please refresh yourself on the complex metaprogramming mechanics of both the manyfest DSL and the elucidator configuration permutation before changing any of this.
|
|
192
|
+
// You broke it. You bought it.
|
|
193
|
+
this.dataSolvers = new libElucidator(tmpManifest.Solvers, this.logInfo, this.logError);
|
|
189
194
|
|
|
190
195
|
// Load the solver state in so each instruction can have internal config
|
|
191
|
-
|
|
192
|
-
let tmpSolverKeys = Object.keys(pManifest.Solvers)
|
|
196
|
+
let tmpSolverKeys = Object.keys(tmpManifest.Solvers)
|
|
193
197
|
for (let i = 0; i < tmpSolverKeys.length; i++)
|
|
194
198
|
{
|
|
195
|
-
|
|
199
|
+
// Each of these are passed through the metatemplate.
|
|
200
|
+
this.dataSolverState[tmpSolverKeys] = tmpManifest.Solvers[tmpSolverKeys[i]];
|
|
196
201
|
}
|
|
197
202
|
|
|
198
203
|
this.setElucidatorSolvers(this.dataSolvers, this.dataSolverState);
|