manyfest 1.0.2 → 1.0.3
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/.config/configstore/update-notifier-npm.json +1 -1
- package/README.md +29 -11
- package/package.json +3 -2
- package/source/Manyfest-LogToConsole.js +1 -1
- package/source/Manyfest-ObjectAddressResolver.js +585 -0
- package/source/Manyfest.js +178 -251
- package/test/Manyfest_Object_CheckExistence_tests.js +70 -0
- package/test/Manyfest_Object_Populate_tests.js +140 -0
- package/test/{Manyfest_ObjectAccess_tests.js → Manyfest_Object_Read_tests.js} +73 -51
- package/test/Manyfest_Object_Validate_tests.js +82 -0
- package/test/Manyfest_Object_Write_tests.js +161 -0
- package/test/Manyfest_tests.js +49 -0
- package/test/Manyfest_AdvancedObjectAccess_tests.js +0 -80
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ let animalManyfest = new libManyfest(
|
|
|
46
46
|
"Scope": "Animal",
|
|
47
47
|
"Descriptors":
|
|
48
48
|
{
|
|
49
|
-
"IDAnimal": { "Name":"Database ID", "Description":"The unique integer-based database identifier for an Animal record.", "DataType":"Integer" },
|
|
49
|
+
"IDAnimal": { "Name":"Database ID", "Description":"The unique integer-based database identifier for an Animal record.", "DataType":"Integer", "Default":0 },
|
|
50
50
|
"Name": { "Description":"The animal's colloquial species name (e.g. Rabbit, Dog, Bear, Mongoose)." },
|
|
51
51
|
"Type": { "Description":"Whether or not the animal is wild, domesticated, agricultural, in a research lab or a part of a zoo.." }
|
|
52
52
|
}
|
|
@@ -70,16 +70,17 @@ Error does not mean the software throws an exception. It comes back as well-for
|
|
|
70
70
|
Below is a lexicon of terms used throughout this documentation. If you see anything missing, want more elaboration or just dislike a particular term, please file an issue in github!
|
|
71
71
|
|
|
72
72
|
| Term | Description |
|
|
73
|
-
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
| ---- | ----------- |
|
|
74
|
+
Scope | The scope of this representation; generally the clustered or parent record name (e.g. Animal, User, Transaction, etc.) -- does not have functional purpose; only for information and logging.
|
|
75
|
+
Schema | The stateful representation of an object's structural definition.
|
|
76
|
+
Element | A defined element of data in an object.
|
|
77
|
+
Address | The address where that data lies in the object.
|
|
78
|
+
Descriptor | A description of an element including data such as Name, NameShort, Hash, Description, and other important properties.
|
|
79
|
+
Name | The name of the element. Meant to be the most succinct human readable name possible.
|
|
80
|
+
NameShort | A shorter name for the element. Meant to be useful enough to identify the property in log lines, tabular views, graphs and anywhere where we don't always want to see the full name.
|
|
81
|
+
Description | A description for the element. Very useful when consuming other APIs with their own terse naming standards (or no naming standards)!
|
|
82
|
+
Hash | A unique within this scope string-based key for this element. Used for easy access of data.
|
|
83
|
+
Required | Set to true if this element is required.
|
|
83
84
|
|
|
84
85
|
## A More Advanced Schema Example
|
|
85
86
|
|
|
@@ -108,6 +109,7 @@ let animalManyfest = new libManyfest(
|
|
|
108
109
|
"Name":"Comfortable Environmental Temperature",
|
|
109
110
|
"NameShort":"Comf Env Temp",
|
|
110
111
|
"Hash":"ComfET",
|
|
112
|
+
"DataType":"Float",
|
|
111
113
|
"Description":"The most comfortable temperature for this animal to survive in."
|
|
112
114
|
}
|
|
113
115
|
}
|
|
@@ -118,6 +120,22 @@ Notice in this example, the addresses are more complex. They have a dot syntax.
|
|
|
118
120
|
|
|
119
121
|
To aid in this discovery, reference and such, we've given it a NameShort (for use in things like tabular views and graphs/charts), a longer Name and a Hash (to enable easy reading and writing using the object element read/write functions described later in this documentation).
|
|
120
122
|
|
|
123
|
+
### Data Types
|
|
124
|
+
|
|
125
|
+
| Type | Description |
|
|
126
|
+
| ---- | ----------- |
|
|
127
|
+
String | A pretty basic string
|
|
128
|
+
Integer | An integer number
|
|
129
|
+
Float | A floating point number; does not require a decimal point
|
|
130
|
+
Number | A number of any type
|
|
131
|
+
Boolean | A boolean value represented by the JSON true or false
|
|
132
|
+
Binary | A boolean value represented as 1 or 0
|
|
133
|
+
YesNo | A boolean value represented as Y or N
|
|
134
|
+
DateTime | A javascript date
|
|
135
|
+
Array | A plain old javascript array
|
|
136
|
+
Object | A plain old javascript object
|
|
137
|
+
Null | A null value
|
|
138
|
+
|
|
121
139
|
## Reading and Writing Element Properties
|
|
122
140
|
|
|
123
141
|
Lastly, when working with objects, Manyfest provides a set of functions to read and write from/to these element addresses. This can be useful for consistently accessing objects across boundaries as well as filling out element defaults without requiring a crazy amount of boilerplate code.
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "manyfest",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "JSON Object Manifest for Data Description and Parsing",
|
|
5
5
|
"main": "source/Manyfest.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"docker-dev-build-image": "docker build ./ -f Dockerfile_LUXURYCode -t retold/manyfest:local",
|
|
8
8
|
"docker-dev-run": "docker run -it -d --name manyfest -p 12340:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/manyfest\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/manyfest:local",
|
|
9
9
|
"test": "./node_modules/mocha/bin/_mocha -u tdd -R spec",
|
|
10
|
-
"tests": "./node_modules/mocha/bin/_mocha -u tdd -R spec --grep"
|
|
10
|
+
"tests": "./node_modules/mocha/bin/_mocha -u tdd -R spec --grep",
|
|
11
|
+
"coverage": "nyc npm run test && nyc report --reporter=lcov"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
@@ -13,7 +13,7 @@ const logToConsole = (pLogLine, pLogObject) =>
|
|
|
13
13
|
|
|
14
14
|
console.log(`[Manyfest] ${tmpLogLine}`);
|
|
15
15
|
|
|
16
|
-
if (pLogObject) console.log(JSON.stringify(
|
|
16
|
+
if (pLogObject) console.log(JSON.stringify(pLogObject));
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
module.exports = logToConsole;
|