manyfest 1.0.32 → 1.0.34
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 +14 -12
- package/dist/manyfest.compatible.js +53 -46
- package/dist/manyfest.compatible.min.js +1 -1
- package/dist/manyfest.compatible.min.js.map +1 -1
- package/dist/manyfest.js +53 -46
- package/dist/manyfest.min.js +1 -1
- package/dist/manyfest.min.js.map +1 -1
- package/package.json +1 -1
- package/source/Manyfest-HashTranslation.js +2 -2
- package/source/Manyfest-ObjectAddress-CheckAddressExists.js +5 -5
- package/source/Manyfest-ObjectAddress-DeleteValue.js +2 -2
- package/source/Manyfest-ObjectAddress-GetValue.js +35 -13
- package/source/Manyfest-ObjectAddress-Parser.js +6 -6
- package/source/Manyfest-ObjectAddress-SetValue.js +3 -3
- package/source/Manyfest-SchemaManipulation.js +4 -4
- package/source/Manyfest.js +16 -16
- package/test/Data-Fruits.json +694 -0
- package/test/Manyfest_Object_Populate_tests.js +4 -4
- package/test/Manyfest_Object_ReadSets_tests.js +19 -0
- package/test/Manyfest_Object_Read_tests.js +8 -45
package/debug/Harness.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
let libManyfest = require(`../source/Manyfest.js`);
|
|
2
2
|
|
|
3
|
-
let
|
|
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
|
+
// });
|
|
4
13
|
|
|
5
14
|
// Make up a cute and furry test creature
|
|
6
|
-
let
|
|
7
|
-
{
|
|
8
|
-
IDAnimal:8675309,
|
|
9
|
-
Name:'BatBrains',
|
|
10
|
-
Type:'Lab',
|
|
11
|
-
Color:'Brown',
|
|
12
|
-
Author: ['Frankenberry', 'Chocula'],
|
|
13
|
-
Choco: require('../test/Data-Archive-org-Frankenberry.json')
|
|
14
|
-
});
|
|
15
|
+
let testAnimal = {IDAnimal:8675309, Name:'BatBrains', Type:'Lab', Color:'Brown'};
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
// Check the Manyfest
|
|
18
|
+
let checkResults = animalManyfest.validate(testAnimal);
|
|
17
19
|
|
|
18
|
-
console.log(JSON.stringify(
|
|
20
|
+
console.log(JSON.stringify(checkResults,null,4));
|
|
@@ -206,7 +206,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
206
206
|
}, {
|
|
207
207
|
key: "removeTranslationHash",
|
|
208
208
|
value: function removeTranslationHash(pTranslationHash) {
|
|
209
|
-
if (this.translationTable
|
|
209
|
+
if (pTranslationHash in this.translationTable) {
|
|
210
210
|
delete this.translationTable[pTranslationHash];
|
|
211
211
|
}
|
|
212
212
|
}
|
|
@@ -240,7 +240,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
240
240
|
}, {
|
|
241
241
|
key: "translate",
|
|
242
242
|
value: function translate(pTranslation) {
|
|
243
|
-
if (this.translationTable
|
|
243
|
+
if (pTranslation in this.translationTable) {
|
|
244
244
|
return this.translationTable[pTranslation];
|
|
245
245
|
} else {
|
|
246
246
|
return pTranslation;
|
|
@@ -352,7 +352,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
352
352
|
// 2) The end bracket is after the start bracket
|
|
353
353
|
&& _MockFable.DataFormat.stringCountEnclosures(pAddress) > 0) {
|
|
354
354
|
var tmpFunctionAddress = pAddress.substring(0, tmpFunctionStartIndex).trim();
|
|
355
|
-
if (
|
|
355
|
+
if (tmpFunctionAddress in pObject && typeof pObject[tmpFunctionAddress] == 'function') {
|
|
356
356
|
return true;
|
|
357
357
|
} else {
|
|
358
358
|
// The address suggests it is a function, but it is not.
|
|
@@ -406,14 +406,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
406
406
|
tmpBoxedPropertyReference = this.cleanWrapCharacters("'", tmpBoxedPropertyReference);
|
|
407
407
|
|
|
408
408
|
// Check if the property exists.
|
|
409
|
-
return pObject[tmpBoxedPropertyName]
|
|
409
|
+
return tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName];
|
|
410
410
|
} else {
|
|
411
411
|
// Use the new in operator to see if the element is in the array
|
|
412
412
|
return tmpBoxedPropertyNumber in pObject[tmpBoxedPropertyName];
|
|
413
413
|
}
|
|
414
414
|
} else {
|
|
415
415
|
// Check if the property exists
|
|
416
|
-
return pObject
|
|
416
|
+
return pAddress in pObject;
|
|
417
417
|
}
|
|
418
418
|
} else {
|
|
419
419
|
var tmpSubObjectName = tmpAddressPartBeginning;
|
|
@@ -526,9 +526,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
526
526
|
|
|
527
527
|
// If there is an object property already named for the sub object, but it isn't an object
|
|
528
528
|
// then the system can't set the value in there. Error and abort!
|
|
529
|
-
if (
|
|
529
|
+
if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
|
|
530
530
|
return false;
|
|
531
|
-
} else if (pObject
|
|
531
|
+
} else if (tmpSubObjectName in pObject) {
|
|
532
532
|
// If there is already a subobject pass that to the recursive thingy
|
|
533
533
|
return this.checkAddressExists(pObject[tmpSubObjectName], tmpNewAddress, tmpRootObject);
|
|
534
534
|
} else {
|
|
@@ -837,9 +837,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
837
837
|
|
|
838
838
|
// If there is an object property already named for the sub object, but it isn't an object
|
|
839
839
|
// then the system can't set the value in there. Error and abort!
|
|
840
|
-
if (
|
|
840
|
+
if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
|
|
841
841
|
return undefined;
|
|
842
|
-
} else if (pObject
|
|
842
|
+
} else if (tmpSubObjectName in pObject) {
|
|
843
843
|
// If there is already a subobject pass that to the recursive thingy
|
|
844
844
|
// Continue to manage the parent address for recursion
|
|
845
845
|
tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
|
|
@@ -1007,13 +1007,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1007
1007
|
|
|
1008
1008
|
// Now get the value for each argument
|
|
1009
1009
|
for (var _i3 = 0; _i3 < tmpFunctionArguments.length; _i3++) {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
} else if (tmpFunctionArguments[_i3][0] == "`" && tmpFunctionArguments[_i3][tmpFunctionArguments[_i3].length - 1] == "`") {
|
|
1010
|
+
// Resolve the values for each subsequent entry
|
|
1011
|
+
// Check if the argument value is a string literal or a reference to an address
|
|
1012
|
+
if (tmpFunctionArguments[_i3].length >= 2 && (tmpFunctionArguments[_i3].charAt(0) == '"' || tmpFunctionArguments[_i3].charAt(0) == "'" || tmpFunctionArguments[_i3].charAt(0) == "`") && (tmpFunctionArguments[_i3].charAt(tmpFunctionArguments[_i3].length - 1) == '"' || tmpFunctionArguments[_i3].charAt(tmpFunctionArguments[_i3].length - 1) == "'" || tmpFunctionArguments[_i3].charAt(tmpFunctionArguments[_i3].length - 1) == "`")) {
|
|
1013
|
+
// This is a string literal
|
|
1015
1014
|
tmpArgumentValues.push(tmpFunctionArguments[_i3].substring(1, tmpFunctionArguments[_i3].length - 1));
|
|
1016
1015
|
} else {
|
|
1016
|
+
// This is a hash address
|
|
1017
1017
|
tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2, tmpFunctionArguments[_i3]));
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
@@ -1161,7 +1161,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1161
1161
|
// Now get the value for each argument
|
|
1162
1162
|
for (var _i5 = 0; _i5 < _tmpFunctionArguments.length; _i5++) {
|
|
1163
1163
|
// Resolve the values for each subsequent entry
|
|
1164
|
-
|
|
1164
|
+
// Check if the argument value is a string literal or a reference to an address
|
|
1165
|
+
if (_tmpFunctionArguments[_i5].length >= 2 && (_tmpFunctionArguments[_i5].charAt(0) == '"' || _tmpFunctionArguments[_i5].charAt(0) == "'" || _tmpFunctionArguments[_i5].charAt(0) == "`") && (_tmpFunctionArguments[_i5].charAt(_tmpFunctionArguments[_i5].length - 1) == '"' || _tmpFunctionArguments[_i5].charAt(_tmpFunctionArguments[_i5].length - 1) == "'" || _tmpFunctionArguments[_i5].charAt(_tmpFunctionArguments[_i5].length - 1) == "`")) {
|
|
1166
|
+
// This is a string literal
|
|
1167
|
+
_tmpArgumentValues.push(_tmpFunctionArguments[_i5].substring(1, _tmpFunctionArguments[_i5].length - 1));
|
|
1168
|
+
} else {
|
|
1169
|
+
// This is a hash address
|
|
1170
|
+
_tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3, _tmpFunctionArguments[_i5]));
|
|
1171
|
+
}
|
|
1165
1172
|
}
|
|
1166
1173
|
return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject, _tmpArgumentValues), tmpNewAddress, tmpParentAddress, _tmpRootObject3);
|
|
1167
1174
|
}
|
|
@@ -1285,9 +1292,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1285
1292
|
|
|
1286
1293
|
// If there is an object property already named for the sub object, but it isn't an object
|
|
1287
1294
|
// then the system can't set the value in there. Error and abort!
|
|
1288
|
-
if (
|
|
1295
|
+
if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
|
|
1289
1296
|
return undefined;
|
|
1290
|
-
} else if (pObject
|
|
1297
|
+
} else if (tmpSubObjectName in pObject) {
|
|
1291
1298
|
// If there is already a subobject pass that to the recursive thingy
|
|
1292
1299
|
// Continue to manage the parent address for recursion
|
|
1293
1300
|
tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
|
|
@@ -1359,12 +1366,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1359
1366
|
tmpSegmentCount++;
|
|
1360
1367
|
}
|
|
1361
1368
|
// IF This is the start of an enclosure
|
|
1362
|
-
else if (
|
|
1369
|
+
else if (tmpString[i] in tmpEnclosureStartSymbolMap) {
|
|
1363
1370
|
// Add it to the stack!
|
|
1364
1371
|
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
1365
1372
|
}
|
|
1366
1373
|
// IF This is the end of an enclosure
|
|
1367
|
-
else if (
|
|
1374
|
+
else if (tmpString[i] in tmpEnclosureEndSymbolMap
|
|
1368
1375
|
// AND it matches the current nest level symbol
|
|
1369
1376
|
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
|
|
1370
1377
|
// Pop it off the stack!
|
|
@@ -1408,12 +1415,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1408
1415
|
return tmpString.substring(0, i);
|
|
1409
1416
|
}
|
|
1410
1417
|
// IF This is the start of an enclosure
|
|
1411
|
-
else if (
|
|
1418
|
+
else if (tmpString[i] in tmpEnclosureStartSymbolMap) {
|
|
1412
1419
|
// Add it to the stack!
|
|
1413
1420
|
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
1414
1421
|
}
|
|
1415
1422
|
// IF This is the end of an enclosure
|
|
1416
|
-
else if (
|
|
1423
|
+
else if (tmpString[i] in tmpEnclosureEndSymbolMap
|
|
1417
1424
|
// AND it matches the current nest level symbol
|
|
1418
1425
|
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
|
|
1419
1426
|
// Pop it off the stack!
|
|
@@ -1460,12 +1467,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1460
1467
|
tmpCurrentSegmentStart = i + 1;
|
|
1461
1468
|
}
|
|
1462
1469
|
// IF This is the start of an enclosure
|
|
1463
|
-
else if (
|
|
1470
|
+
else if (tmpString[i] in tmpEnclosureStartSymbolMap) {
|
|
1464
1471
|
// Add it to the stack!
|
|
1465
1472
|
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
1466
1473
|
}
|
|
1467
1474
|
// IF This is the end of an enclosure
|
|
1468
|
-
else if (
|
|
1475
|
+
else if (tmpString[i] in tmpEnclosureEndSymbolMap
|
|
1469
1476
|
// AND it matches the current nest level symbol
|
|
1470
1477
|
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
|
|
1471
1478
|
// Pop it off the stack!
|
|
@@ -1733,12 +1740,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1733
1740
|
|
|
1734
1741
|
// If there is an object property already named for the sub object, but it isn't an object
|
|
1735
1742
|
// then the system can't set the value in there. Error and abort!
|
|
1736
|
-
if (
|
|
1737
|
-
if (!
|
|
1743
|
+
if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
|
|
1744
|
+
if (!('__ERROR' in pObject)) pObject['__ERROR'] = {};
|
|
1738
1745
|
// Put it in an error object so data isn't lost
|
|
1739
1746
|
pObject['__ERROR'][pAddress] = pValue;
|
|
1740
1747
|
return false;
|
|
1741
|
-
} else if (pObject
|
|
1748
|
+
} else if (tmpSubObjectName in pObject) {
|
|
1742
1749
|
// If there is already a subobject pass that to the recursive thingy
|
|
1743
1750
|
return this.setValueAtAddress(pObject[tmpSubObjectName], tmpNewAddress, pValue);
|
|
1744
1751
|
} else {
|
|
@@ -2057,7 +2064,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2057
2064
|
var tmpManyfestAddresses = Object.keys(pManyfestSchemaDescriptors);
|
|
2058
2065
|
var tmpHashMapping = {};
|
|
2059
2066
|
tmpManyfestAddresses.forEach(function (pAddress) {
|
|
2060
|
-
if (pManyfestSchemaDescriptors[pAddress]
|
|
2067
|
+
if ('Hash' in pManyfestSchemaDescriptors[pAddress]) {
|
|
2061
2068
|
tmpHashMapping[pManyfestSchemaDescriptors[pAddress].Hash] = pAddress;
|
|
2062
2069
|
}
|
|
2063
2070
|
});
|
|
@@ -2068,9 +2075,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2068
2075
|
var tmpDescriptor = false;
|
|
2069
2076
|
|
|
2070
2077
|
// See if there is a matching descriptor either by Address directly or Hash
|
|
2071
|
-
if (pManyfestSchemaDescriptors
|
|
2078
|
+
if (pInputAddress in pManyfestSchemaDescriptors) {
|
|
2072
2079
|
tmpOldDescriptorAddress = pInputAddress;
|
|
2073
|
-
} else if (tmpHashMapping
|
|
2080
|
+
} else if (pInputAddress in tmpHashMapping) {
|
|
2074
2081
|
tmpOldDescriptorAddress = tmpHashMapping[pInputAddress];
|
|
2075
2082
|
}
|
|
2076
2083
|
|
|
@@ -2111,7 +2118,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2111
2118
|
// The first passed-in set of descriptors takes precedence.
|
|
2112
2119
|
var tmpDescriptorAddresses = Object.keys(tmpSource);
|
|
2113
2120
|
tmpDescriptorAddresses.forEach(function (pDescriptorAddress) {
|
|
2114
|
-
if (!
|
|
2121
|
+
if (!(pDescriptorAddress in tmpNewManyfestSchemaDescriptors)) {
|
|
2115
2122
|
tmpNewManyfestSchemaDescriptors[pDescriptorAddress] = tmpSource[pDescriptorAddress];
|
|
2116
2123
|
}
|
|
2117
2124
|
});
|
|
@@ -2166,7 +2173,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2166
2173
|
_this3.objectAddressGetValue = new libObjectAddressGetValue(_this3.logInfo, _this3.logError);
|
|
2167
2174
|
_this3.objectAddressSetValue = new libObjectAddressSetValue(_this3.logInfo, _this3.logError);
|
|
2168
2175
|
_this3.objectAddressDeleteValue = new libObjectAddressDeleteValue(_this3.logInfo, _this3.logError);
|
|
2169
|
-
if (!
|
|
2176
|
+
if (!('defaultValues' in _this3.options)) {
|
|
2170
2177
|
_this3.options.defaultValues = {
|
|
2171
2178
|
"String": "",
|
|
2172
2179
|
"Number": 0,
|
|
@@ -2180,7 +2187,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2180
2187
|
"Null": null
|
|
2181
2188
|
};
|
|
2182
2189
|
}
|
|
2183
|
-
if (!
|
|
2190
|
+
if (!('strict' in _this3.options)) {
|
|
2184
2191
|
_this3.options.strict = false;
|
|
2185
2192
|
}
|
|
2186
2193
|
_this3.scope = undefined;
|
|
@@ -2241,11 +2248,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2241
2248
|
var tmpManifest = _typeof(pManifest) == 'object' ? pManifest : {};
|
|
2242
2249
|
var tmpDescriptorKeys = Object.keys(_DefaultConfiguration);
|
|
2243
2250
|
for (var i = 0; i < tmpDescriptorKeys.length; i++) {
|
|
2244
|
-
if (!
|
|
2251
|
+
if (!(tmpDescriptorKeys[i] in tmpManifest)) {
|
|
2245
2252
|
tmpManifest[tmpDescriptorKeys[i]] = JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));
|
|
2246
2253
|
}
|
|
2247
2254
|
}
|
|
2248
|
-
if (
|
|
2255
|
+
if ('Scope' in tmpManifest) {
|
|
2249
2256
|
if (typeof tmpManifest.Scope === 'string') {
|
|
2250
2257
|
this.scope = tmpManifest.Scope;
|
|
2251
2258
|
} else {
|
|
@@ -2254,7 +2261,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2254
2261
|
} else {
|
|
2255
2262
|
this.logError("(".concat(this.scope, ") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."), tmpManifest);
|
|
2256
2263
|
}
|
|
2257
|
-
if (
|
|
2264
|
+
if ('Descriptors' in tmpManifest) {
|
|
2258
2265
|
if (_typeof(tmpManifest.Descriptors) === 'object') {
|
|
2259
2266
|
var tmpDescriptionAddresses = Object.keys(tmpManifest.Descriptors);
|
|
2260
2267
|
for (var _i9 = 0; _i9 < tmpDescriptionAddresses.length; _i9++) {
|
|
@@ -2266,7 +2273,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2266
2273
|
} else {
|
|
2267
2274
|
this.logError("(".concat(this.scope, ") Error loading object description from manifest object. Property \"Descriptors\" does not exist in the root of the Manifest object."), tmpManifest);
|
|
2268
2275
|
}
|
|
2269
|
-
if (
|
|
2276
|
+
if ('HashTranslations' in tmpManifest) {
|
|
2270
2277
|
if (_typeof(tmpManifest.HashTranslations) === 'object') {
|
|
2271
2278
|
for (var _i10 = 0; _i10 < tmpManifest.HashTranslations.length; _i10++) {
|
|
2272
2279
|
// Each translation is
|
|
@@ -2297,10 +2304,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2297
2304
|
value: function addDescriptor(pAddress, pDescriptor) {
|
|
2298
2305
|
if (_typeof(pDescriptor) === 'object') {
|
|
2299
2306
|
// Add the Address into the Descriptor if it doesn't exist:
|
|
2300
|
-
if (!
|
|
2307
|
+
if (!('Address' in pDescriptor)) {
|
|
2301
2308
|
pDescriptor.Address = pAddress;
|
|
2302
2309
|
}
|
|
2303
|
-
if (!this.elementDescriptors
|
|
2310
|
+
if (!(pAddress in this.elementDescriptors)) {
|
|
2304
2311
|
this.elementAddresses.push(pAddress);
|
|
2305
2312
|
}
|
|
2306
2313
|
|
|
@@ -2309,7 +2316,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2309
2316
|
|
|
2310
2317
|
// Always add the address as a hash
|
|
2311
2318
|
this.elementHashes[pAddress] = pAddress;
|
|
2312
|
-
if (
|
|
2319
|
+
if ('Hash' in pDescriptor) {
|
|
2313
2320
|
// TODO: Check if this is a good idea or not..
|
|
2314
2321
|
// Collisions are bound to happen with both representations of the address/hash in here and developers being able to create their own hashes.
|
|
2315
2322
|
this.elementHashes[pDescriptor.Hash] = pAddress;
|
|
@@ -2365,15 +2372,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2365
2372
|
key: "resolveHashAddress",
|
|
2366
2373
|
value: function resolveHashAddress(pHash) {
|
|
2367
2374
|
var tmpAddress = undefined;
|
|
2368
|
-
var tmpInElementHashTable = this.elementHashes
|
|
2369
|
-
var tmpInTranslationTable = this.hashTranslations.translationTable
|
|
2375
|
+
var tmpInElementHashTable = (pHash in this.elementHashes);
|
|
2376
|
+
var tmpInTranslationTable = (pHash in this.hashTranslations.translationTable);
|
|
2370
2377
|
|
|
2371
2378
|
// The most straightforward: the hash exists, no translations.
|
|
2372
2379
|
if (tmpInElementHashTable && !tmpInTranslationTable) {
|
|
2373
2380
|
tmpAddress = this.elementHashes[pHash];
|
|
2374
2381
|
}
|
|
2375
2382
|
// There is a translation from one hash to another, and, the elementHashes contains the pointer end
|
|
2376
|
-
else if (tmpInTranslationTable && this.
|
|
2383
|
+
else if (tmpInTranslationTable && this.hashTranslations.translate(pHash) in this.elementHashes) {
|
|
2377
2384
|
tmpAddress = this.elementHashes[this.hashTranslations.translate(pHash)];
|
|
2378
2385
|
}
|
|
2379
2386
|
// Use the level of indirection only in the Translation Table
|
|
@@ -2527,13 +2534,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2527
2534
|
if (_typeof(pDescriptor) != 'object') {
|
|
2528
2535
|
return undefined;
|
|
2529
2536
|
}
|
|
2530
|
-
if (
|
|
2537
|
+
if ('Default' in pDescriptor) {
|
|
2531
2538
|
return pDescriptor.Default;
|
|
2532
2539
|
} else {
|
|
2533
2540
|
// Default to a null if it doesn't have a type specified.
|
|
2534
2541
|
// This will ensure a placeholder is created but isn't misinterpreted.
|
|
2535
|
-
var tmpDataType =
|
|
2536
|
-
if (this.options.defaultValues
|
|
2542
|
+
var tmpDataType = 'DataType' in pDescriptor ? pDescriptor.DataType : 'String';
|
|
2543
|
+
if (tmpDataType in this.options.defaultValues) {
|
|
2537
2544
|
return this.options.defaultValues[tmpDataType];
|
|
2538
2545
|
} else {
|
|
2539
2546
|
// give up and return null
|
|
@@ -2549,7 +2556,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2549
2556
|
return this.populateObject(pObject, pOverwriteProperties,
|
|
2550
2557
|
// This just sets up a simple filter to see if there is a default set.
|
|
2551
2558
|
function (pDescriptor) {
|
|
2552
|
-
return
|
|
2559
|
+
return 'Default' in pDescriptor;
|
|
2553
2560
|
});
|
|
2554
2561
|
}
|
|
2555
2562
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function _callSuper(e,t,r){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,_toPropertyKey(s.key),s)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=_typeof(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Manyfest=e()}}((function(){return function e(t,r,s){function n(o,i){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!i&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return n(t[o][1][e]||e)}),u,u.exports,e,t,r,s)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(e,t,r){var s=function(){return _createClass((function e(t,r,s){_classCallCheck(this,e),"object"===_typeof(t)&&t.isFable?this.connectFable(t):this.fable=!1,this.fable?(this.UUID=t.getUUID(),this.options="object"===_typeof(r)?r:{}):(this.options="object"!==_typeof(t)||t.isFable?"object"===_typeof(r)?r:{}:t,this.UUID="CORE-SVC-".concat(Math.floor(89999*Math.random()+1e4))),this.serviceType="Unknown-".concat(this.UUID),this.Hash="string"==typeof s?s:this.fable||"string"!=typeof r?"".concat(this.UUID):r}),[{key:"connectFable",value:function(e){if("object"!==_typeof(e)||!e.isFable){var t="Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(_typeof(e),"].}");return console.log(t),new Error(t)}return this.fable||(this.fable=e),this.log||(this.log=this.fable.Logging),this.services||(this.services=this.fable.services),this.servicesMap||(this.servicesMap=this.fable.servicesMap),!0}}])}();_defineProperty(s,"isFableService",!0),t.exports=s,t.exports.CoreServiceProviderBase=s},{}],2:[function(e,t,r){t.exports=function(e,t){return t.startsWith(e)&&t.endsWith(e)?t.substring(1,t.length-1):t}},{}],3:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.translationTable={}}),[{key:"translationCount",value:function(){return Object.keys(this.translationTable).length}},{key:"addTranslation",value:function(e){var t=this;if("object"!=_typeof(e))return this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(e))),!1;Object.keys(e).forEach((function(r){"string"!=typeof e[r]?t.logError("Hash translation addTranslation expected a translation destination hash for [".concat(r,"] to be a string but the referrant was a ").concat(_typeof(e[r]))):t.translationTable[r]=e[r]}))}},{key:"removeTranslationHash",value:function(e){this.translationTable.hasOwnProperty(e)&&delete this.translationTable[e]}},{key:"removeTranslation",value:function(e){var t=this;return"string"==typeof e?(this.removeTranslationHash(e),!0):"object"==_typeof(e)?(Object.keys(e).forEach((function(e){t.removeTranslation(e)})),!0):(this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(_typeof(e))),!1)}},{key:"clearTranslations",value:function(){this.translationTable={}}},{key:"translate",value:function(e){return this.translationTable.hasOwnProperty(e)?this.translationTable[e]:e}}])}();t.exports=n},{"./Manyfest-LogToConsole.js":4}],4:[function(e,t,r){t.exports=function(e,t){var r="string"==typeof e?e:"";console.log("[Manyfest] ".concat(r)),t&&console.log(JSON.stringify(t))}},{}],5:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-ObjectAddress-GetValue.js"),a={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")},o=function(){return _createClass((function e(){_classCallCheck(this,e),this.getObjectValueClass=new n(s,s)}),[{key:"checkAddressExists",value:function(e,t,r){if("object"!=_typeof(e))return!1;if("string"!=typeof t)return!1;var s=void 0===r?e:r,n=a.DataFormat.stringGetFirstSegment(t);if(n.length==t.length){var o=t.indexOf("["),i=t.indexOf("]"),c=t.indexOf("(");if(c>0&&a.DataFormat.stringCountEnclosures(t)>0){var l=t.substring(0,c).trim();return!(!e.hasOwnProperty(l)||"function"!=typeof e[l])}if(o>0&&i>o&&i-o>1){var u=t.substring(0,o).trim();if("object"!==_typeof(e[u]))return!1;var f=t.substring(o+1,i).trim(),h=parseInt(f,10);return Array.isArray(e[u])!=isNaN(h)&&(isNaN(h)?(f=this.cleanWrapCharacters('"',f),f=this.cleanWrapCharacters("`",f),f=this.cleanWrapCharacters("'",f),e[u].hasOwnProperty(f)):h in e[u])}return e.hasOwnProperty(t)}var p=n,d=t.substring(n.length+1),y=p.indexOf("["),g=p.indexOf("]"),b=p.indexOf("(");if(b>0&&a.DataFormat.stringCountEnclosures(p)>0){var v=p.substring(0,b).trim();if("function"==!_typeof(e[v]))return!1;var A=a.DataFormat.stringGetSegments(a.DataFormat.stringGetEnclosureValueByIndex(p.substring(v.length),0),",");if(0==A.length||""==A[0])return this.checkAddressExists(e[v].apply(e),d,s);for(var j=[],O=void 0===r?e:r,m=0;m<A.length;m++)j.push(this.getObjectValueClass.getValueAtAddress(O,A[m]));return this.checkAddressExists(e[v].apply(e,j),d,O)}if(y>0&&g>y&&g-y>1){var _=p.substring(0,y).trim(),C=p.substring(y+1,g).trim(),E=parseInt(C,10);return Array.isArray(e[_])!=isNaN(E)&&(isNaN(E)?(C=this.cleanWrapCharacters('"',C),C=this.cleanWrapCharacters("`",C),C=this.cleanWrapCharacters("'",C),this.checkAddressExists(e[_][C],d,s)):this.checkAddressExists(e[_][E],d,s))}return(!e.hasOwnProperty(p)||"object"===_typeof(e[p]))&&(e.hasOwnProperty(p)||(e[p]={}),this.checkAddressExists(e[p],d,s))}}])}();t.exports=o},{"./Manyfest-LogToConsole.js":4,"./Manyfest-ObjectAddress-GetValue.js":7,"./Manyfest-ObjectAddress-Parser.js":8}],6:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js"),o=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.cleanWrapCharacters=n}),[{key:"checkRecordFilters",value:function(e,t){return a(this,e,t)}},{key:"deleteValueAtAddress",value:function(e,t,r){if("object"==_typeof(e)&&"string"==typeof t){var s="";"string"==typeof r&&(s=r);var n=t.indexOf(".");if(-1==n){var a=t.indexOf("["),o=t.indexOf("]"),i=t.indexOf("{}");if(a>0&&o>a&&o-a>1){var c=t.substring(0,a).trim();if("object"!==_typeof(e[c]))return!1;var l=t.substring(a+1,o).trim(),u=parseInt(l,10);return Array.isArray(e[c])!=isNaN(u)&&(isNaN(u)?(l=this.cleanWrapCharacters('"',l),l=this.cleanWrapCharacters("`",l),l=this.cleanWrapCharacters("'",l),delete e[c][l],!0):(delete e[c][u],!0))}if(a>0&&o>a&&o-a==1){var f=t.substring(0,a).trim();if(!Array.isArray(e[f]))return!1;for(var h=e[f],p=h.length-1;p>=0;p--){this.checkRecordFilters(t,h[p])&&h.splice(p,1)}return!0}if(i>0){var d=t.substring(0,i).trim();return"object"==_typeof(e[d])&&(delete e[d],!0)}return delete e[t],!0}var y=t.substring(0,n),g=t.substring(n+1),b=y.indexOf("["),v=y.indexOf("]");if(b>0&&v>b&&v-b>1){var A=y.substring(0,b).trim(),j=y.substring(b+1,v).trim(),O=parseInt(j,10);return Array.isArray(e[A])!=isNaN(O)&&("object"==_typeof(e[A])&&(isNaN(O)?(j=this.cleanWrapCharacters('"',j),j=this.cleanWrapCharacters("`",j),j=this.cleanWrapCharacters("'",j),s="".concat(s).concat(s.length>0?".":"").concat(y),this.deleteValueAtAddress(e[A][j],g,s)):(s="".concat(s).concat(s.length>0?".":"").concat(y),this.deleteValueAtAddress(e[A][O],g,s))))}if(b>0&&v>b&&v-b==1){var m=t.substring(0,b).trim();if(!Array.isArray(e[m]))return!1;var _=e[m];s="".concat(s).concat(s.length>0?".":"").concat(m);for(var C={},E=0;E<_.length;E++){var T="".concat(s,"[").concat(E,"]"),k=this.deleteValueAtAddress(e[m][E],g,T);C["".concat(T,".").concat(g)]=k}return C}var D=t.indexOf("{}");if(D>0){var w=t.substring(0,D).trim();if("object"!=_typeof(e[w]))return!1;var x=e[w],P=Object.keys(x);s="".concat(s).concat(s.length>0?".":"").concat(w);for(var V={},M=0;M<P.length;M++){var S="".concat(s,".").concat(P[M]),N=this.deleteValueAtAddress(e[w][P[M]],g,S);this.checkRecordFilters(t,N)&&(V["".concat(S,".").concat(g)]=N)}return V}return e.hasOwnProperty(y)&&"object"!==_typeof(e[y])?void 0:e.hasOwnProperty(y)?(s="".concat(s).concat(s.length>0?".":"").concat(y),this.deleteValueAtAddress(e[y],g,s)):(s="".concat(s).concat(s.length>0?".":"").concat(y),e[y]={},this.deleteValueAtAddress(e[y],g,s))}}}])}();t.exports=o},{"../source/Manyfest-ParseConditionals.js":11,"./Manyfest-CleanWrapCharacters.js":2,"./Manyfest-LogToConsole.js":4}],7:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js"),o={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")},i=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.cleanWrapCharacters=n}),[{key:"checkRecordFilters",value:function(e,t){return a(this,e,t)}},{key:"getValueAtAddress",value:function(e,t,r,s){if("object"==_typeof(e)&&"string"==typeof t){var n="";"string"==typeof r&&(n=r);var a=void 0===s?e:s,i=o.DataFormat.stringGetFirstSegment(t);if(""==i){for(var c=o.DataFormat.stringGetSegments(n),l=0,u=0;u<t.length&&"."==t.charAt(u);u++)l++;var f=c.length-l;if(f<0)return;var h=t.slice(l);return f>0&&(h="".concat(c.slice(0,f).join("."),".").concat(h)),this.logInfo("Back-navigation detected. Recursing back to address [".concat(h,"]")),this.getValueAtAddress(a,h)}if(i.length==t.length){var p=t.indexOf("["),d=t.indexOf("]"),y=t.indexOf("{}"),g=t.indexOf("(");if(g>0&&o.DataFormat.stringCountEnclosures(t)>0){var b=t.substring(0,g).trim();if("function"==!_typeof(e[b]))return!1;var v=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(t.substring(b.length),0),",");if(0==v.length||""==v[0])return e[b].apply(e);for(var A=[],j=void 0===s?e:s,O=0;O<v.length;O++)"'"==v[O][0]&&"'"==v[O][v[O].length-1]||'"'==v[O][0]&&'"'==v[O][v[O].length-1]||"`"==v[O][0]&&"`"==v[O][v[O].length-1]?A.push(v[O].substring(1,v[O].length-1)):A.push(this.getValueAtAddress(j,v[O]));return e[b].apply(e,A)}if(p>0&&d>p&&d-p>1){var m=t.substring(0,p).trim();if("object"!==_typeof(e[m]))return;var _=t.substring(p+1,d).trim(),C=parseInt(_,10);if(Array.isArray(e[m])==isNaN(C))return;return isNaN(C)?(_=this.cleanWrapCharacters('"',_),_=this.cleanWrapCharacters("`",_),_=this.cleanWrapCharacters("'",_),e[m][_]):e[m][C]}if(p>0&&d>p&&d-p==1){var E=t.substring(0,p).trim();if(!Array.isArray(e[E]))return!1;for(var T=e[E],k=[],D=0;D<T.length;D++){this.checkRecordFilters(t,T[D])&&k.push(T[D])}return k}if(y>0){var w=t.substring(0,y).trim();return"object"==_typeof(e[w])&&e[w]}return null!=_typeof(e[t])?e[t]:void 0}var x=i,P=t.substring(i.length+1),V=x.indexOf("["),M=x.indexOf("]"),S=x.indexOf("(");if(S>0&&o.DataFormat.stringCountEnclosures(x)>0){var N=x.substring(0,S).trim();if(n="".concat(n).concat(n.length>0?".":"").concat(x),"function"==!_typeof(e[N]))return!1;var H=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(x.substring(N.length),0),",");if(0==H.length||""==H[0])return this.getValueAtAddress(e[N].apply(e),P,n,a);for(var I=[],F=void 0===s?e:s,W=0;W<H.length;W++)I.push(this.getValueAtAddress(F,H[W]));return this.getValueAtAddress(e[N].apply(e,I),P,n,F)}if(V>0&&M>V&&M-V>1){var R=x.substring(0,V).trim(),L=x.substring(V+1,M).trim(),G=parseInt(L,10);if(Array.isArray(e[R])==isNaN(G))return;if("object"!=_typeof(e[R]))return;return isNaN(G)?(L=this.cleanWrapCharacters('"',L),L=this.cleanWrapCharacters("`",L),L=this.cleanWrapCharacters("'",L),n="".concat(n).concat(n.length>0?".":"").concat(x),this.getValueAtAddress(e[R][L],P,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(x),this.getValueAtAddress(e[R][G],P,n,a))}if(V>0&&M>V&&M-V==1){var J=t.substring(0,V).trim();if(!Array.isArray(e[J]))return!1;var B=e[J];n="".concat(n).concat(n.length>0?".":"").concat(J);for(var U={},z=0;z<B.length;z++){var q="".concat(n,"[").concat(z,"]"),K=this.getValueAtAddress(e[J][z],P,q,a);U["".concat(q,".").concat(P)]=K}return U}var Q=t.indexOf("{}");if(Q>0){var X=t.substring(0,Q).trim();if("object"!=_typeof(e[X]))return!1;var Y=e[X],Z=Object.keys(Y);n="".concat(n).concat(n.length>0?".":"").concat(X);for(var $={},ee=0;ee<Z.length;ee++){var te="".concat(n,".").concat(Z[ee]),re=this.getValueAtAddress(e[X][Z[ee]],P,te,a);this.checkRecordFilters(t,re)&&($["".concat(te,".").concat(P)]=re)}return $}return e.hasOwnProperty(x)&&"object"!==_typeof(e[x])?void 0:e.hasOwnProperty(x)?(n="".concat(n).concat(n.length>0?".":"").concat(x),this.getValueAtAddress(e[x],P,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(x),e[x]={},this.getValueAtAddress(e[x],P,n,a))}}}])}();t.exports=i},{"../source/Manyfest-ParseConditionals.js":11,"./Manyfest-CleanWrapCharacters.js":2,"./Manyfest-LogToConsole.js":4,"./Manyfest-ObjectAddress-Parser.js":8}],8:[function(e,t,r){t.exports={stringCountSegments:function(e,t,r,s){var n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==_typeof(r)?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==_typeof(s)?pEnclosureEnd:{"}":0,"]":1,")":2};if(e.length<1)return 0;for(var c=1,l=[],u=0;u<n.length;u++)n[u]==a&&0==l.length?c++:o.hasOwnProperty(n[u])?l.push(o[n[u]]):i.hasOwnProperty(n[u])&&i[n[u]]==l[l.length-1]&&l.pop();return c},stringGetFirstSegment:function(e,t,r,s){var n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==_typeof(r)?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==_typeof(s)?pEnclosureEnd:{"}":0,"]":1,")":2};if(e.length<1)return 0;for(var c=[],l=0;l<n.length;l++){if(n[l]==a&&0==c.length)return n.substring(0,l);o.hasOwnProperty(n[l])?c.push(o[n[l]]):i.hasOwnProperty(n[l])&&i[n[l]]==c[c.length-1]&&c.pop()}return n},stringGetSegments:function(e,t,r,s){var n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==_typeof(r)?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==_typeof(s)?pEnclosureEnd:{"}":0,"]":1,")":2},c=0,l=[];if(e.length<1)return l;for(var u=[],f=0;f<n.length;f++)n[f]==a&&0==u.length?(l.push(n.substring(c,f)),c=f+1):o.hasOwnProperty(n[f])?u.push(o[n[f]]):i.hasOwnProperty(n[f])&&i[n[f]]==u[u.length-1]&&u.pop();return c<n.length&&l.push(n.substring(c)),l},stringCountEnclosures:function(e,t,r){for(var s="string"==typeof e?e:"",n="string"==typeof t?t:"(",a="string"==typeof r?r:")",o=0,i=0,c=0;c<s.length;c++)s[c]==n?(0==i&&o++,i++):s[c]==a&&i--;return o},stringGetEnclosureValueByIndex:function(e,t,r,s){for(var n="string"==typeof e?e:"",a="number"==typeof t?t:0,o="string"==typeof r?r:"(",i="string"==typeof s?s:")",c=0,l=0,u=!1,f=0,h=0,p=0;p<n.length;p++)n[p]==o?1==++l&&a==++c-1&&(u=!0,f=p):n[p]==i&&0==--l&&u&&h<=f&&(h=p,u=!1);return c<=a?"":h>0&&h>f?n.substring(f+1,h):n.substring(f+1)}}},{}],9:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.cleanWrapCharacters=n}),[{key:"setValueAtAddress",value:function(e,t,r){if("object"!=_typeof(e))return!1;if("string"!=typeof t)return!1;var s=t.indexOf(".");if(-1==s){var n=t.indexOf("["),a=t.indexOf("]");if(n>0&&a>n&&a-n>1){var o=t.substring(0,n).trim();if("object"!==_typeof(e[o]))return!1;var i=t.substring(n+1,a).trim(),c=parseInt(i,10);return Array.isArray(e[o])!=isNaN(c)&&(isNaN(c)?(i=this.cleanWrapCharacters('"',i),i=this.cleanWrapCharacters("`",i),i=this.cleanWrapCharacters("'",i),e[o][i]=r,!0):(e[o][c]=r,!0))}return e[t]=r,!0}var l=t.substring(0,s),u=t.substring(s+1),f=l.indexOf("["),h=l.indexOf("]");if(f>0&&h>f&&h-f>1){var p=l.substring(0,f).trim(),d=l.substring(f+1,h).trim(),y=parseInt(d,10);return Array.isArray(e[p])!=isNaN(y)&&(isNaN(y)?(d=this.cleanWrapCharacters('"',d),d=this.cleanWrapCharacters("`",d),d=this.cleanWrapCharacters("'",d),this.setValueAtAddress(e[p][d],u,r)):this.setValueAtAddress(e[p][y],u,r))}return e.hasOwnProperty(l)&&"object"!==_typeof(e[l])?(e.hasOwnProperty("__ERROR")||(e.__ERROR={}),e.__ERROR[t]=r,!1):(e.hasOwnProperty(l)||(e[l]={}),this.setValueAtAddress(e[l],u,r))}}])}();t.exports=a},{"./Manyfest-CleanWrapCharacters.js":2,"./Manyfest-LogToConsole.js":4}],10:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s}),[{key:"generateAddressses",value:function(e,t,r){var s="string"==typeof t?t:"",n="object"==_typeof(r)?r:{},a=_typeof(e),o={Address:s,Hash:s,Name:s,InSchema:!1};switch("object"==a&&null==e&&(a="null"),a){case"string":o.DataType="String",o.Default=e,n[s]=o;break;case"number":case"bigint":o.DataType="Number",o.Default=e,n[s]=o;break;case"undefined":case"null":o.DataType="Any",o.Default=e,n[s]=o;break;case"object":if(Array.isArray(e)){o.DataType="Array",""!=s&&(n[s]=o);for(var i=0;i<e.length;i++)this.generateAddressses(e[i],"".concat(s,"[").concat(i,"]"),n)}else{o.DataType="Object",""!=s&&(n[s]=o,s+=".");for(var c=Object.keys(e),l=0;l<c.length;l++)this.generateAddressses(e[c[l]],"".concat(s).concat(c[l]),n)}}return n}}])}();t.exports=n},{"./Manyfest-LogToConsole.js":4}],11:[function(e,t,r){var s="<<~?",n="?~>>",a=function(e,t,r,s,n){switch(s){case"TRUE":return!0===e.getValueAtAddress(t,r);case"FALSE":return!1===e.getValueAtAddress(t,r);case"LNGT":case"LENGTH_GREATER_THAN":switch(_typeof(e.getValueAtAddress(t,r))){case"string":case"object":return e.getValueAtAddress(t,r).length>n;default:return!1}break;case"LNLT":case"LENGTH_LESS_THAN":switch(_typeof(e.getValueAtAddress(t,r))){case"string":case"object":return e.getValueAtAddress(t,r).length<n;default:return!1}break;case"!=":return e.getValueAtAddress(t,r)!=n;case"<":return e.getValueAtAddress(t,r)<n;case">":return e.getValueAtAddress(t,r)>n;case"<=":return e.getValueAtAddress(t,r)<=n;case">=":return e.getValueAtAddress(t,r)>=n;case"===":return e.getValueAtAddress(t,r)===n;default:return e.getValueAtAddress(t,r)==n}};t.exports=function(e,t,r){for(var o=!0,i=t.indexOf(s);-1!=i;){var c=t.indexOf(n,i+4);if(-1!=c){var l=t.substring(i+4,c).split(","),u=l[0],f="EXISTS";l.length>1&&(f=l[1]);var h=!1;l.length>2&&(h=l[2]),o=o&&a(e,r,u,f,h),i=t.indexOf(s,c+4)}else i=-1}return o}},{}],12:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s}),[{key:"resolveAddressMappings",value:function(e,t){if("object"!=_typeof(e))return this.logError("Attempted to resolve address mapping but the descriptor was not an object."),!1;if("object"!=_typeof(t))return!0;var r=Object.keys(e),s={};return r.forEach((function(t){e[t].hasOwnProperty("Hash")&&(s[e[t].Hash]=t)})),Object.keys(t).forEach((function(r){var n=t[r],a=!1,o=!1;e.hasOwnProperty(r)?a=r:s.hasOwnProperty(r)&&(a=s[r]),a?(o=e[a],delete e[a]):o={Hash:r},e[n]=o})),!0}},{key:"safeResolveAddressMappings",value:function(e,t){var r=JSON.parse(JSON.stringify(e));return this.resolveAddressMappings(r,t),r}},{key:"mergeAddressMappings",value:function(e,t){if("object"!=_typeof(t)||"object"!=_typeof(e))return this.logError("Attempted to merge two schema descriptors but both were not objects."),!1;var r=JSON.parse(JSON.stringify(t)),s=JSON.parse(JSON.stringify(e));return Object.keys(r).forEach((function(e){s.hasOwnProperty(e)||(s[e]=r[e])})),s}}])}();t.exports=n},{"./Manyfest-LogToConsole.js":4}],13:[function(e,t,r){var s=e("fable-serviceproviderbase"),n=e("./Manyfest-LogToConsole.js"),a=e("./Manyfest-HashTranslation.js"),o=e("./Manyfest-ObjectAddress-CheckAddressExists.js"),i=e("./Manyfest-ObjectAddress-GetValue.js"),c=e("./Manyfest-ObjectAddress-SetValue.js"),l=e("./Manyfest-ObjectAddress-DeleteValue.js"),u=e("./Manyfest-ObjectAddressGeneration.js"),f=e("./Manyfest-SchemaManipulation.js"),h={Scope:"DEFAULT",Descriptors:{}},p=function(e){function t(e,r,s){var h;return _classCallCheck(this,t),(h=_callSuper(this,t,void 0===e?[{}]:[e,r,s])).serviceType="Manifest",h.logInfo=n,h.logError=n,h.objectAddressCheckAddressExists=new o(h.logInfo,h.logError),h.objectAddressGetValue=new i(h.logInfo,h.logError),h.objectAddressSetValue=new c(h.logInfo,h.logError),h.objectAddressDeleteValue=new l(h.logInfo,h.logError),h.options.hasOwnProperty("defaultValues")||(h.options.defaultValues={String:"",Number:0,Float:0,Integer:0,Boolean:!1,Binary:0,DateTime:0,Array:[],Object:{},Null:null}),h.options.hasOwnProperty("strict")||(h.options.strict=!1),h.scope=void 0,h.elementAddresses=void 0,h.elementHashes=void 0,h.elementDescriptors=void 0,h.reset(),"object"===_typeof(h.options)&&h.loadManifest(h.options),h.schemaManipulations=new f(h.logInfo,h.logError),h.objectAddressGeneration=new u(h.logInfo,h.logError),h.hashTranslations=new a(h.logInfo,h.logError),_assertThisInitialized(h)}return _inherits(t,e),_createClass(t,[{key:"reset",value:function(){this.scope="DEFAULT",this.elementAddresses=[],this.elementHashes={},this.elementDescriptors={}}},{key:"clone",value:function(){var e=JSON.parse(JSON.stringify(this.options)),r=new t(this.getManifest(),this.logInfo,this.logError,e);return r.hashTranslations.addTranslation(this.hashTranslations.translationTable),r}},{key:"deserialize",value:function(e){return this.loadManifest(JSON.parse(e))}},{key:"loadManifest",value:function(e){"object"!==_typeof(e)&&this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(e),"."));for(var t="object"==_typeof(e)?e:{},r=Object.keys(h),s=0;s<r.length;s++)t.hasOwnProperty(r[s])||(t[r[s]]=JSON.parse(JSON.stringify(h[r[s]])));if(t.hasOwnProperty("Scope")?"string"==typeof t.Scope?this.scope=t.Scope:this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(t.Scope),"."),t):this.logError("(".concat(this.scope,') Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.'),t),t.hasOwnProperty("Descriptors"))if("object"===_typeof(t.Descriptors))for(var n=Object.keys(t.Descriptors),a=0;a<n.length;a++)this.addDescriptor(n[a],t.Descriptors[n[a]]);else this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(_typeof(t.Descriptors),"."),t);else this.logError("(".concat(this.scope,') Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.'),t);if(t.hasOwnProperty("HashTranslations")&&"object"===_typeof(t.HashTranslations))for(var o=0;o<t.HashTranslations.length;o++);}},{key:"serialize",value:function(){return JSON.stringify(this.getManifest())}},{key:"getManifest",value:function(){return{Scope:this.scope,Descriptors:JSON.parse(JSON.stringify(this.elementDescriptors)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))}}},{key:"addDescriptor",value:function(e,t){return"object"===_typeof(t)?(t.hasOwnProperty("Address")||(t.Address=e),this.elementDescriptors.hasOwnProperty(e)||this.elementAddresses.push(e),this.elementDescriptors[e]=t,this.elementHashes[e]=e,t.hasOwnProperty("Hash")?this.elementHashes[t.Hash]=e:t.Hash=e,!0):(this.logError("(".concat(this.scope,") Error loading object descriptor for address '").concat(e,"' from manifest object. Expecting an object but property was type ").concat(_typeof(t),".")),!1)}},{key:"getDescriptorByHash",value:function(e){return this.getDescriptor(this.resolveHashAddress(e))}},{key:"getDescriptor",value:function(e){return this.elementDescriptors[e]}},{key:"eachDescriptor",value:function(e){for(var t=Object.keys(this.elementDescriptors),r=0;r<t.length;r++)e(this.elementDescriptors[t[r]])}},{key:"checkAddressExistsByHash",value:function(e,t){return this.checkAddressExists(e,this.resolveHashAddress(t))}},{key:"checkAddressExists",value:function(e,t){return this.objectAddressCheckAddressExists.checkAddressExists(e,t)}},{key:"resolveHashAddress",value:function(e){var t=this.elementHashes.hasOwnProperty(e),r=this.hashTranslations.translationTable.hasOwnProperty(e);return t&&!r?this.elementHashes[e]:r&&this.elementHashes.hasOwnProperty(this.hashTranslations.translate(e))?this.elementHashes[this.hashTranslations.translate(e)]:r?this.hashTranslations.translate(e):e}},{key:"getValueByHash",value:function(e,t){var r=this.getValueAtAddress(e,this.resolveHashAddress(t));return void 0===r&&(r=this.getDefaultValue(this.getDescriptorByHash(t))),r}},{key:"getValueAtAddress",value:function(e,t){var r=this.objectAddressGetValue.getValueAtAddress(e,t);return void 0===r&&(r=this.getDefaultValue(this.getDescriptor(t))),r}},{key:"setValueByHash",value:function(e,t,r){return this.setValueAtAddress(e,this.resolveHashAddress(t),r)}},{key:"setValueAtAddress",value:function(e,t,r){return this.objectAddressSetValue.setValueAtAddress(e,t,r)}},{key:"deleteValueByHash",value:function(e,t,r){return this.deleteValueAtAddress(e,this.resolveHashAddress(t),r)}},{key:"deleteValueAtAddress",value:function(e,t,r){return this.objectAddressDeleteValue.deleteValueAtAddress(e,t,r)}},{key:"validate",value:function(e){var t={Error:null,Errors:[],MissingElements:[]};"object"!==_typeof(e)&&(t.Error=!0,t.Errors.push("Expected passed in object to be type object but was passed in ".concat(_typeof(e))));for(var r=function(e,r){t.Error=!0,t.Errors.push('Element at address "'.concat(e,'" ').concat(r,"."))},s=0;s<this.elementAddresses.length;s++){var n=this.getDescriptor(this.elementAddresses[s]),a=this.checkAddressExists(e,n.Address),o=this.getValueAtAddress(e,n.Address);if(void 0!==o&&a||(t.MissingElements.push(n.Address),(n.Required||this.options.strict)&&r(n.Address,"is flagged REQUIRED but is not set in the object")),n.DataType){var i=_typeof(o);switch(n.DataType.toString().trim().toLowerCase()){case"string":"string"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));break;case"number":"number"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));break;case"integer":if("number"!=i)r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));else o.toString().indexOf(".")>-1&&r(n.Address,"has a DataType ".concat(n.DataType," but has a decimal point in the number."));break;case"float":"number"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));break;case"DateTime":"Invalid Date"==new Date(o).toString()&&r(n.Address,"has a DataType ".concat(n.DataType," but is not parsable as a Date by Javascript"));default:"string"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," (which auto-converted to String because it was unrecognized) but is of the type ").concat(i))}}}return t}},{key:"getDefaultValue",value:function(e){if("object"==_typeof(e)){if(e.hasOwnProperty("Default"))return e.Default;var t=e.hasOwnProperty("DataType")?e.DataType:"String";return this.options.defaultValues.hasOwnProperty(t)?this.options.defaultValues[t]:null}}},{key:"populateDefaults",value:function(e,t){return this.populateObject(e,t,(function(e){return e.hasOwnProperty("Default")}))}},{key:"populateObject",value:function(e,t,r){var s=this,n="object"===_typeof(e)?e:{},a=void 0!==t&&t,o="function"==typeof r?r:function(e){return!0};return this.elementAddresses.forEach((function(e){var t=s.getDescriptor(e);o(t)&&(!a&&s.checkAddressExists(n,e)||s.setValueAtAddress(n,e,s.getDefaultValue(t)))})),n}}])}(s);t.exports=p},{"./Manyfest-HashTranslation.js":3,"./Manyfest-LogToConsole.js":4,"./Manyfest-ObjectAddress-CheckAddressExists.js":5,"./Manyfest-ObjectAddress-DeleteValue.js":6,"./Manyfest-ObjectAddress-GetValue.js":7,"./Manyfest-ObjectAddress-SetValue.js":9,"./Manyfest-ObjectAddressGeneration.js":10,"./Manyfest-SchemaManipulation.js":12,"fable-serviceproviderbase":1}]},{},[13])(13)}));
|
|
1
|
+
"use strict";function _callSuper(e,t,r){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,_toPropertyKey(s.key),s)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=_typeof(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Manyfest=e()}}((function(){return function e(t,r,s){function n(o,i){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!i&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return n(t[o][1][e]||e)}),u,u.exports,e,t,r,s)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(e,t,r){var s=function(){return _createClass((function e(t,r,s){_classCallCheck(this,e),"object"===_typeof(t)&&t.isFable?this.connectFable(t):this.fable=!1,this.fable?(this.UUID=t.getUUID(),this.options="object"===_typeof(r)?r:{}):(this.options="object"!==_typeof(t)||t.isFable?"object"===_typeof(r)?r:{}:t,this.UUID="CORE-SVC-".concat(Math.floor(89999*Math.random()+1e4))),this.serviceType="Unknown-".concat(this.UUID),this.Hash="string"==typeof s?s:this.fable||"string"!=typeof r?"".concat(this.UUID):r}),[{key:"connectFable",value:function(e){if("object"!==_typeof(e)||!e.isFable){var t="Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(_typeof(e),"].}");return console.log(t),new Error(t)}return this.fable||(this.fable=e),this.log||(this.log=this.fable.Logging),this.services||(this.services=this.fable.services),this.servicesMap||(this.servicesMap=this.fable.servicesMap),!0}}])}();_defineProperty(s,"isFableService",!0),t.exports=s,t.exports.CoreServiceProviderBase=s},{}],2:[function(e,t,r){t.exports=function(e,t){return t.startsWith(e)&&t.endsWith(e)?t.substring(1,t.length-1):t}},{}],3:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.translationTable={}}),[{key:"translationCount",value:function(){return Object.keys(this.translationTable).length}},{key:"addTranslation",value:function(e){var t=this;if("object"!=_typeof(e))return this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(e))),!1;Object.keys(e).forEach((function(r){"string"!=typeof e[r]?t.logError("Hash translation addTranslation expected a translation destination hash for [".concat(r,"] to be a string but the referrant was a ").concat(_typeof(e[r]))):t.translationTable[r]=e[r]}))}},{key:"removeTranslationHash",value:function(e){e in this.translationTable&&delete this.translationTable[e]}},{key:"removeTranslation",value:function(e){var t=this;return"string"==typeof e?(this.removeTranslationHash(e),!0):"object"==_typeof(e)?(Object.keys(e).forEach((function(e){t.removeTranslation(e)})),!0):(this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(_typeof(e))),!1)}},{key:"clearTranslations",value:function(){this.translationTable={}}},{key:"translate",value:function(e){return e in this.translationTable?this.translationTable[e]:e}}])}();t.exports=n},{"./Manyfest-LogToConsole.js":4}],4:[function(e,t,r){t.exports=function(e,t){var r="string"==typeof e?e:"";console.log("[Manyfest] ".concat(r)),t&&console.log(JSON.stringify(t))}},{}],5:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-ObjectAddress-GetValue.js"),a={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")},o=function(){return _createClass((function e(){_classCallCheck(this,e),this.getObjectValueClass=new n(s,s)}),[{key:"checkAddressExists",value:function(e,t,r){if("object"!=_typeof(e))return!1;if("string"!=typeof t)return!1;var s=void 0===r?e:r,n=a.DataFormat.stringGetFirstSegment(t);if(n.length==t.length){var o=t.indexOf("["),i=t.indexOf("]"),c=t.indexOf("(");if(c>0&&a.DataFormat.stringCountEnclosures(t)>0){var l=t.substring(0,c).trim();return l in e&&"function"==typeof e[l]}if(o>0&&i>o&&i-o>1){var u=t.substring(0,o).trim();if("object"!==_typeof(e[u]))return!1;var f=t.substring(o+1,i).trim(),h=parseInt(f,10);return Array.isArray(e[u])!=isNaN(h)&&(isNaN(h)?(f=this.cleanWrapCharacters('"',f),f=this.cleanWrapCharacters("`",f),(f=this.cleanWrapCharacters("'",f))in e[u]):h in e[u])}return t in e}var d=n,p=t.substring(n.length+1),y=d.indexOf("["),g=d.indexOf("]"),b=d.indexOf("(");if(b>0&&a.DataFormat.stringCountEnclosures(d)>0){var v=d.substring(0,b).trim();if("function"==!_typeof(e[v]))return!1;var A=a.DataFormat.stringGetSegments(a.DataFormat.stringGetEnclosureValueByIndex(d.substring(v.length),0),",");if(0==A.length||""==A[0])return this.checkAddressExists(e[v].apply(e),p,s);for(var j=[],m=void 0===r?e:r,_=0;_<A.length;_++)j.push(this.getObjectValueClass.getValueAtAddress(m,A[_]));return this.checkAddressExists(e[v].apply(e,j),p,m)}if(y>0&&g>y&&g-y>1){var C=d.substring(0,y).trim(),O=d.substring(y+1,g).trim(),E=parseInt(O,10);return Array.isArray(e[C])!=isNaN(E)&&(isNaN(E)?(O=this.cleanWrapCharacters('"',O),O=this.cleanWrapCharacters("`",O),O=this.cleanWrapCharacters("'",O),this.checkAddressExists(e[C][O],p,s)):this.checkAddressExists(e[C][E],p,s))}return(!(d in e)||"object"===_typeof(e[d]))&&(d in e||(e[d]={}),this.checkAddressExists(e[d],p,s))}}])}();t.exports=o},{"./Manyfest-LogToConsole.js":4,"./Manyfest-ObjectAddress-GetValue.js":7,"./Manyfest-ObjectAddress-Parser.js":8}],6:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js"),o=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.cleanWrapCharacters=n}),[{key:"checkRecordFilters",value:function(e,t){return a(this,e,t)}},{key:"deleteValueAtAddress",value:function(e,t,r){if("object"==_typeof(e)&&"string"==typeof t){var s="";"string"==typeof r&&(s=r);var n=t.indexOf(".");if(-1==n){var a=t.indexOf("["),o=t.indexOf("]"),i=t.indexOf("{}");if(a>0&&o>a&&o-a>1){var c=t.substring(0,a).trim();if("object"!==_typeof(e[c]))return!1;var l=t.substring(a+1,o).trim(),u=parseInt(l,10);return Array.isArray(e[c])!=isNaN(u)&&(isNaN(u)?(l=this.cleanWrapCharacters('"',l),l=this.cleanWrapCharacters("`",l),l=this.cleanWrapCharacters("'",l),delete e[c][l],!0):(delete e[c][u],!0))}if(a>0&&o>a&&o-a==1){var f=t.substring(0,a).trim();if(!Array.isArray(e[f]))return!1;for(var h=e[f],d=h.length-1;d>=0;d--){this.checkRecordFilters(t,h[d])&&h.splice(d,1)}return!0}if(i>0){var p=t.substring(0,i).trim();return"object"==_typeof(e[p])&&(delete e[p],!0)}return delete e[t],!0}var y=t.substring(0,n),g=t.substring(n+1),b=y.indexOf("["),v=y.indexOf("]");if(b>0&&v>b&&v-b>1){var A=y.substring(0,b).trim(),j=y.substring(b+1,v).trim(),m=parseInt(j,10);return Array.isArray(e[A])!=isNaN(m)&&("object"==_typeof(e[A])&&(isNaN(m)?(j=this.cleanWrapCharacters('"',j),j=this.cleanWrapCharacters("`",j),j=this.cleanWrapCharacters("'",j),s="".concat(s).concat(s.length>0?".":"").concat(y),this.deleteValueAtAddress(e[A][j],g,s)):(s="".concat(s).concat(s.length>0?".":"").concat(y),this.deleteValueAtAddress(e[A][m],g,s))))}if(b>0&&v>b&&v-b==1){var _=t.substring(0,b).trim();if(!Array.isArray(e[_]))return!1;var C=e[_];s="".concat(s).concat(s.length>0?".":"").concat(_);for(var O={},E=0;E<C.length;E++){var T="".concat(s,"[").concat(E,"]"),k=this.deleteValueAtAddress(e[_][E],g,T);O["".concat(T,".").concat(g)]=k}return O}var D=t.indexOf("{}");if(D>0){var x=t.substring(0,D).trim();if("object"!=_typeof(e[x]))return!1;var V=e[x],M=Object.keys(V);s="".concat(s).concat(s.length>0?".":"").concat(x);for(var S={},N=0;N<M.length;N++){var w="".concat(s,".").concat(M[N]),H=this.deleteValueAtAddress(e[x][M[N]],g,w);this.checkRecordFilters(t,H)&&(S["".concat(w,".").concat(g)]=H)}return S}return y in e&&"object"!==_typeof(e[y])?void 0:y in e?(s="".concat(s).concat(s.length>0?".":"").concat(y),this.deleteValueAtAddress(e[y],g,s)):(s="".concat(s).concat(s.length>0?".":"").concat(y),e[y]={},this.deleteValueAtAddress(e[y],g,s))}}}])}();t.exports=o},{"../source/Manyfest-ParseConditionals.js":11,"./Manyfest-CleanWrapCharacters.js":2,"./Manyfest-LogToConsole.js":4}],7:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js"),o={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")},i=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.cleanWrapCharacters=n}),[{key:"checkRecordFilters",value:function(e,t){return a(this,e,t)}},{key:"getValueAtAddress",value:function(e,t,r,s){if("object"==_typeof(e)&&"string"==typeof t){var n="";"string"==typeof r&&(n=r);var a=void 0===s?e:s,i=o.DataFormat.stringGetFirstSegment(t);if(""==i){for(var c=o.DataFormat.stringGetSegments(n),l=0,u=0;u<t.length&&"."==t.charAt(u);u++)l++;var f=c.length-l;if(f<0)return;var h=t.slice(l);return f>0&&(h="".concat(c.slice(0,f).join("."),".").concat(h)),this.logInfo("Back-navigation detected. Recursing back to address [".concat(h,"]")),this.getValueAtAddress(a,h)}if(i.length==t.length){var d=t.indexOf("["),p=t.indexOf("]"),y=t.indexOf("{}"),g=t.indexOf("(");if(g>0&&o.DataFormat.stringCountEnclosures(t)>0){var b=t.substring(0,g).trim();if("function"==!_typeof(e[b]))return!1;var v=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(t.substring(b.length),0),",");if(0==v.length||""==v[0])return e[b].apply(e);for(var A=[],j=void 0===s?e:s,m=0;m<v.length;m++)!(v[m].length>=2)||'"'!=v[m].charAt(0)&&"'"!=v[m].charAt(0)&&"`"!=v[m].charAt(0)||'"'!=v[m].charAt(v[m].length-1)&&"'"!=v[m].charAt(v[m].length-1)&&"`"!=v[m].charAt(v[m].length-1)?A.push(this.getValueAtAddress(j,v[m])):A.push(v[m].substring(1,v[m].length-1));return e[b].apply(e,A)}if(d>0&&p>d&&p-d>1){var _=t.substring(0,d).trim();if("object"!==_typeof(e[_]))return;var C=t.substring(d+1,p).trim(),O=parseInt(C,10);if(Array.isArray(e[_])==isNaN(O))return;return isNaN(O)?(C=this.cleanWrapCharacters('"',C),C=this.cleanWrapCharacters("`",C),C=this.cleanWrapCharacters("'",C),e[_][C]):e[_][O]}if(d>0&&p>d&&p-d==1){var E=t.substring(0,d).trim();if(!Array.isArray(e[E]))return!1;for(var T=e[E],k=[],D=0;D<T.length;D++){this.checkRecordFilters(t,T[D])&&k.push(T[D])}return k}if(y>0){var x=t.substring(0,y).trim();return"object"==_typeof(e[x])&&e[x]}return null!=_typeof(e[t])?e[t]:void 0}var V=i,M=t.substring(i.length+1),S=V.indexOf("["),N=V.indexOf("]"),w=V.indexOf("(");if(w>0&&o.DataFormat.stringCountEnclosures(V)>0){var H=V.substring(0,w).trim();if(n="".concat(n).concat(n.length>0?".":"").concat(V),"function"==!_typeof(e[H]))return!1;var P=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(V.substring(H.length),0),",");if(0==P.length||""==P[0])return this.getValueAtAddress(e[H].apply(e),M,n,a);for(var I=[],F=void 0===s?e:s,W=0;W<P.length;W++)!(P[W].length>=2)||'"'!=P[W].charAt(0)&&"'"!=P[W].charAt(0)&&"`"!=P[W].charAt(0)||'"'!=P[W].charAt(P[W].length-1)&&"'"!=P[W].charAt(P[W].length-1)&&"`"!=P[W].charAt(P[W].length-1)?I.push(this.getValueAtAddress(F,P[W])):I.push(P[W].substring(1,P[W].length-1));return this.getValueAtAddress(e[H].apply(e,I),M,n,F)}if(S>0&&N>S&&N-S>1){var R=V.substring(0,S).trim(),L=V.substring(S+1,N).trim(),G=parseInt(L,10);if(Array.isArray(e[R])==isNaN(G))return;if("object"!=_typeof(e[R]))return;return isNaN(G)?(L=this.cleanWrapCharacters('"',L),L=this.cleanWrapCharacters("`",L),L=this.cleanWrapCharacters("'",L),n="".concat(n).concat(n.length>0?".":"").concat(V),this.getValueAtAddress(e[R][L],M,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(V),this.getValueAtAddress(e[R][G],M,n,a))}if(S>0&&N>S&&N-S==1){var J=t.substring(0,S).trim();if(!Array.isArray(e[J]))return!1;var B=e[J];n="".concat(n).concat(n.length>0?".":"").concat(J);for(var U={},z=0;z<B.length;z++){var q="".concat(n,"[").concat(z,"]"),K=this.getValueAtAddress(e[J][z],M,q,a);U["".concat(q,".").concat(M)]=K}return U}var Q=t.indexOf("{}");if(Q>0){var X=t.substring(0,Q).trim();if("object"!=_typeof(e[X]))return!1;var Y=e[X],Z=Object.keys(Y);n="".concat(n).concat(n.length>0?".":"").concat(X);for(var $={},ee=0;ee<Z.length;ee++){var te="".concat(n,".").concat(Z[ee]),re=this.getValueAtAddress(e[X][Z[ee]],M,te,a);this.checkRecordFilters(t,re)&&($["".concat(te,".").concat(M)]=re)}return $}return V in e&&"object"!==_typeof(e[V])?void 0:V in e?(n="".concat(n).concat(n.length>0?".":"").concat(V),this.getValueAtAddress(e[V],M,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(V),e[V]={},this.getValueAtAddress(e[V],M,n,a))}}}])}();t.exports=i},{"../source/Manyfest-ParseConditionals.js":11,"./Manyfest-CleanWrapCharacters.js":2,"./Manyfest-LogToConsole.js":4,"./Manyfest-ObjectAddress-Parser.js":8}],8:[function(e,t,r){t.exports={stringCountSegments:function(e,t,r,s){var n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==_typeof(r)?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==_typeof(s)?pEnclosureEnd:{"}":0,"]":1,")":2};if(e.length<1)return 0;for(var c=1,l=[],u=0;u<n.length;u++)n[u]==a&&0==l.length?c++:n[u]in o?l.push(o[n[u]]):n[u]in i&&i[n[u]]==l[l.length-1]&&l.pop();return c},stringGetFirstSegment:function(e,t,r,s){var n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==_typeof(r)?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==_typeof(s)?pEnclosureEnd:{"}":0,"]":1,")":2};if(e.length<1)return 0;for(var c=[],l=0;l<n.length;l++){if(n[l]==a&&0==c.length)return n.substring(0,l);n[l]in o?c.push(o[n[l]]):n[l]in i&&i[n[l]]==c[c.length-1]&&c.pop()}return n},stringGetSegments:function(e,t,r,s){var n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==_typeof(r)?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==_typeof(s)?pEnclosureEnd:{"}":0,"]":1,")":2},c=0,l=[];if(e.length<1)return l;for(var u=[],f=0;f<n.length;f++)n[f]==a&&0==u.length?(l.push(n.substring(c,f)),c=f+1):n[f]in o?u.push(o[n[f]]):n[f]in i&&i[n[f]]==u[u.length-1]&&u.pop();return c<n.length&&l.push(n.substring(c)),l},stringCountEnclosures:function(e,t,r){for(var s="string"==typeof e?e:"",n="string"==typeof t?t:"(",a="string"==typeof r?r:")",o=0,i=0,c=0;c<s.length;c++)s[c]==n?(0==i&&o++,i++):s[c]==a&&i--;return o},stringGetEnclosureValueByIndex:function(e,t,r,s){for(var n="string"==typeof e?e:"",a="number"==typeof t?t:0,o="string"==typeof r?r:"(",i="string"==typeof s?s:")",c=0,l=0,u=!1,f=0,h=0,d=0;d<n.length;d++)n[d]==o?1==++l&&a==++c-1&&(u=!0,f=d):n[d]==i&&0==--l&&u&&h<=f&&(h=d,u=!1);return c<=a?"":h>0&&h>f?n.substring(f+1,h):n.substring(f+1)}}},{}],9:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s,this.cleanWrapCharacters=n}),[{key:"setValueAtAddress",value:function(e,t,r){if("object"!=_typeof(e))return!1;if("string"!=typeof t)return!1;var s=t.indexOf(".");if(-1==s){var n=t.indexOf("["),a=t.indexOf("]");if(n>0&&a>n&&a-n>1){var o=t.substring(0,n).trim();if("object"!==_typeof(e[o]))return!1;var i=t.substring(n+1,a).trim(),c=parseInt(i,10);return Array.isArray(e[o])!=isNaN(c)&&(isNaN(c)?(i=this.cleanWrapCharacters('"',i),i=this.cleanWrapCharacters("`",i),i=this.cleanWrapCharacters("'",i),e[o][i]=r,!0):(e[o][c]=r,!0))}return e[t]=r,!0}var l=t.substring(0,s),u=t.substring(s+1),f=l.indexOf("["),h=l.indexOf("]");if(f>0&&h>f&&h-f>1){var d=l.substring(0,f).trim(),p=l.substring(f+1,h).trim(),y=parseInt(p,10);return Array.isArray(e[d])!=isNaN(y)&&(isNaN(y)?(p=this.cleanWrapCharacters('"',p),p=this.cleanWrapCharacters("`",p),p=this.cleanWrapCharacters("'",p),this.setValueAtAddress(e[d][p],u,r)):this.setValueAtAddress(e[d][y],u,r))}return l in e&&"object"!==_typeof(e[l])?("__ERROR"in e||(e.__ERROR={}),e.__ERROR[t]=r,!1):(l in e||(e[l]={}),this.setValueAtAddress(e[l],u,r))}}])}();t.exports=a},{"./Manyfest-CleanWrapCharacters.js":2,"./Manyfest-LogToConsole.js":4}],10:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s}),[{key:"generateAddressses",value:function(e,t,r){var s="string"==typeof t?t:"",n="object"==_typeof(r)?r:{},a=_typeof(e),o={Address:s,Hash:s,Name:s,InSchema:!1};switch("object"==a&&null==e&&(a="null"),a){case"string":o.DataType="String",o.Default=e,n[s]=o;break;case"number":case"bigint":o.DataType="Number",o.Default=e,n[s]=o;break;case"undefined":case"null":o.DataType="Any",o.Default=e,n[s]=o;break;case"object":if(Array.isArray(e)){o.DataType="Array",""!=s&&(n[s]=o);for(var i=0;i<e.length;i++)this.generateAddressses(e[i],"".concat(s,"[").concat(i,"]"),n)}else{o.DataType="Object",""!=s&&(n[s]=o,s+=".");for(var c=Object.keys(e),l=0;l<c.length;l++)this.generateAddressses(e[c[l]],"".concat(s).concat(c[l]),n)}}return n}}])}();t.exports=n},{"./Manyfest-LogToConsole.js":4}],11:[function(e,t,r){var s="<<~?",n="?~>>",a=function(e,t,r,s,n){switch(s){case"TRUE":return!0===e.getValueAtAddress(t,r);case"FALSE":return!1===e.getValueAtAddress(t,r);case"LNGT":case"LENGTH_GREATER_THAN":switch(_typeof(e.getValueAtAddress(t,r))){case"string":case"object":return e.getValueAtAddress(t,r).length>n;default:return!1}break;case"LNLT":case"LENGTH_LESS_THAN":switch(_typeof(e.getValueAtAddress(t,r))){case"string":case"object":return e.getValueAtAddress(t,r).length<n;default:return!1}break;case"!=":return e.getValueAtAddress(t,r)!=n;case"<":return e.getValueAtAddress(t,r)<n;case">":return e.getValueAtAddress(t,r)>n;case"<=":return e.getValueAtAddress(t,r)<=n;case">=":return e.getValueAtAddress(t,r)>=n;case"===":return e.getValueAtAddress(t,r)===n;default:return e.getValueAtAddress(t,r)==n}};t.exports=function(e,t,r){for(var o=!0,i=t.indexOf(s);-1!=i;){var c=t.indexOf(n,i+4);if(-1!=c){var l=t.substring(i+4,c).split(","),u=l[0],f="EXISTS";l.length>1&&(f=l[1]);var h=!1;l.length>2&&(h=l[2]),o=o&&a(e,r,u,f,h),i=t.indexOf(s,c+4)}else i=-1}return o}},{}],12:[function(e,t,r){var s=e("./Manyfest-LogToConsole.js"),n=function(){return _createClass((function e(t,r){_classCallCheck(this,e),this.logInfo="function"==typeof t?t:s,this.logError="function"==typeof r?r:s}),[{key:"resolveAddressMappings",value:function(e,t){if("object"!=_typeof(e))return this.logError("Attempted to resolve address mapping but the descriptor was not an object."),!1;if("object"!=_typeof(t))return!0;var r=Object.keys(e),s={};return r.forEach((function(t){"Hash"in e[t]&&(s[e[t].Hash]=t)})),Object.keys(t).forEach((function(r){var n=t[r],a=!1,o=!1;r in e?a=r:r in s&&(a=s[r]),a?(o=e[a],delete e[a]):o={Hash:r},e[n]=o})),!0}},{key:"safeResolveAddressMappings",value:function(e,t){var r=JSON.parse(JSON.stringify(e));return this.resolveAddressMappings(r,t),r}},{key:"mergeAddressMappings",value:function(e,t){if("object"!=_typeof(t)||"object"!=_typeof(e))return this.logError("Attempted to merge two schema descriptors but both were not objects."),!1;var r=JSON.parse(JSON.stringify(t)),s=JSON.parse(JSON.stringify(e));return Object.keys(r).forEach((function(e){e in s||(s[e]=r[e])})),s}}])}();t.exports=n},{"./Manyfest-LogToConsole.js":4}],13:[function(e,t,r){var s=e("fable-serviceproviderbase"),n=e("./Manyfest-LogToConsole.js"),a=e("./Manyfest-HashTranslation.js"),o=e("./Manyfest-ObjectAddress-CheckAddressExists.js"),i=e("./Manyfest-ObjectAddress-GetValue.js"),c=e("./Manyfest-ObjectAddress-SetValue.js"),l=e("./Manyfest-ObjectAddress-DeleteValue.js"),u=e("./Manyfest-ObjectAddressGeneration.js"),f=e("./Manyfest-SchemaManipulation.js"),h={Scope:"DEFAULT",Descriptors:{}},d=function(e){function t(e,r,s){var h;return _classCallCheck(this,t),(h=_callSuper(this,t,void 0===e?[{}]:[e,r,s])).serviceType="Manifest",h.logInfo=n,h.logError=n,h.objectAddressCheckAddressExists=new o(h.logInfo,h.logError),h.objectAddressGetValue=new i(h.logInfo,h.logError),h.objectAddressSetValue=new c(h.logInfo,h.logError),h.objectAddressDeleteValue=new l(h.logInfo,h.logError),"defaultValues"in h.options||(h.options.defaultValues={String:"",Number:0,Float:0,Integer:0,Boolean:!1,Binary:0,DateTime:0,Array:[],Object:{},Null:null}),"strict"in h.options||(h.options.strict=!1),h.scope=void 0,h.elementAddresses=void 0,h.elementHashes=void 0,h.elementDescriptors=void 0,h.reset(),"object"===_typeof(h.options)&&h.loadManifest(h.options),h.schemaManipulations=new f(h.logInfo,h.logError),h.objectAddressGeneration=new u(h.logInfo,h.logError),h.hashTranslations=new a(h.logInfo,h.logError),_assertThisInitialized(h)}return _inherits(t,e),_createClass(t,[{key:"reset",value:function(){this.scope="DEFAULT",this.elementAddresses=[],this.elementHashes={},this.elementDescriptors={}}},{key:"clone",value:function(){var e=JSON.parse(JSON.stringify(this.options)),r=new t(this.getManifest(),this.logInfo,this.logError,e);return r.hashTranslations.addTranslation(this.hashTranslations.translationTable),r}},{key:"deserialize",value:function(e){return this.loadManifest(JSON.parse(e))}},{key:"loadManifest",value:function(e){"object"!==_typeof(e)&&this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(e),"."));for(var t="object"==_typeof(e)?e:{},r=Object.keys(h),s=0;s<r.length;s++)r[s]in t||(t[r[s]]=JSON.parse(JSON.stringify(h[r[s]])));if("Scope"in t?"string"==typeof t.Scope?this.scope=t.Scope:this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(t.Scope),"."),t):this.logError("(".concat(this.scope,') Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.'),t),"Descriptors"in t)if("object"===_typeof(t.Descriptors))for(var n=Object.keys(t.Descriptors),a=0;a<n.length;a++)this.addDescriptor(n[a],t.Descriptors[n[a]]);else this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(_typeof(t.Descriptors),"."),t);else this.logError("(".concat(this.scope,') Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.'),t);if("HashTranslations"in t&&"object"===_typeof(t.HashTranslations))for(var o=0;o<t.HashTranslations.length;o++);}},{key:"serialize",value:function(){return JSON.stringify(this.getManifest())}},{key:"getManifest",value:function(){return{Scope:this.scope,Descriptors:JSON.parse(JSON.stringify(this.elementDescriptors)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))}}},{key:"addDescriptor",value:function(e,t){return"object"===_typeof(t)?("Address"in t||(t.Address=e),e in this.elementDescriptors||this.elementAddresses.push(e),this.elementDescriptors[e]=t,this.elementHashes[e]=e,"Hash"in t?this.elementHashes[t.Hash]=e:t.Hash=e,!0):(this.logError("(".concat(this.scope,") Error loading object descriptor for address '").concat(e,"' from manifest object. Expecting an object but property was type ").concat(_typeof(t),".")),!1)}},{key:"getDescriptorByHash",value:function(e){return this.getDescriptor(this.resolveHashAddress(e))}},{key:"getDescriptor",value:function(e){return this.elementDescriptors[e]}},{key:"eachDescriptor",value:function(e){for(var t=Object.keys(this.elementDescriptors),r=0;r<t.length;r++)e(this.elementDescriptors[t[r]])}},{key:"checkAddressExistsByHash",value:function(e,t){return this.checkAddressExists(e,this.resolveHashAddress(t))}},{key:"checkAddressExists",value:function(e,t){return this.objectAddressCheckAddressExists.checkAddressExists(e,t)}},{key:"resolveHashAddress",value:function(e){var t=e in this.elementHashes,r=e in this.hashTranslations.translationTable;return t&&!r?this.elementHashes[e]:r&&this.hashTranslations.translate(e)in this.elementHashes?this.elementHashes[this.hashTranslations.translate(e)]:r?this.hashTranslations.translate(e):e}},{key:"getValueByHash",value:function(e,t){var r=this.getValueAtAddress(e,this.resolveHashAddress(t));return void 0===r&&(r=this.getDefaultValue(this.getDescriptorByHash(t))),r}},{key:"getValueAtAddress",value:function(e,t){var r=this.objectAddressGetValue.getValueAtAddress(e,t);return void 0===r&&(r=this.getDefaultValue(this.getDescriptor(t))),r}},{key:"setValueByHash",value:function(e,t,r){return this.setValueAtAddress(e,this.resolveHashAddress(t),r)}},{key:"setValueAtAddress",value:function(e,t,r){return this.objectAddressSetValue.setValueAtAddress(e,t,r)}},{key:"deleteValueByHash",value:function(e,t,r){return this.deleteValueAtAddress(e,this.resolveHashAddress(t),r)}},{key:"deleteValueAtAddress",value:function(e,t,r){return this.objectAddressDeleteValue.deleteValueAtAddress(e,t,r)}},{key:"validate",value:function(e){var t={Error:null,Errors:[],MissingElements:[]};"object"!==_typeof(e)&&(t.Error=!0,t.Errors.push("Expected passed in object to be type object but was passed in ".concat(_typeof(e))));for(var r=function(e,r){t.Error=!0,t.Errors.push('Element at address "'.concat(e,'" ').concat(r,"."))},s=0;s<this.elementAddresses.length;s++){var n=this.getDescriptor(this.elementAddresses[s]),a=this.checkAddressExists(e,n.Address),o=this.getValueAtAddress(e,n.Address);if(void 0!==o&&a||(t.MissingElements.push(n.Address),(n.Required||this.options.strict)&&r(n.Address,"is flagged REQUIRED but is not set in the object")),n.DataType){var i=_typeof(o);switch(n.DataType.toString().trim().toLowerCase()){case"string":"string"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));break;case"number":"number"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));break;case"integer":if("number"!=i)r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));else o.toString().indexOf(".")>-1&&r(n.Address,"has a DataType ".concat(n.DataType," but has a decimal point in the number."));break;case"float":"number"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(i));break;case"DateTime":"Invalid Date"==new Date(o).toString()&&r(n.Address,"has a DataType ".concat(n.DataType," but is not parsable as a Date by Javascript"));default:"string"!=i&&r(n.Address,"has a DataType ".concat(n.DataType," (which auto-converted to String because it was unrecognized) but is of the type ").concat(i))}}}return t}},{key:"getDefaultValue",value:function(e){if("object"==_typeof(e)){if("Default"in e)return e.Default;var t="DataType"in e?e.DataType:"String";return t in this.options.defaultValues?this.options.defaultValues[t]:null}}},{key:"populateDefaults",value:function(e,t){return this.populateObject(e,t,(function(e){return"Default"in e}))}},{key:"populateObject",value:function(e,t,r){var s=this,n="object"===_typeof(e)?e:{},a=void 0!==t&&t,o="function"==typeof r?r:function(e){return!0};return this.elementAddresses.forEach((function(e){var t=s.getDescriptor(e);o(t)&&(!a&&s.checkAddressExists(n,e)||s.setValueAtAddress(n,e,s.getDefaultValue(t)))})),n}}])}(s);t.exports=d},{"./Manyfest-HashTranslation.js":3,"./Manyfest-LogToConsole.js":4,"./Manyfest-ObjectAddress-CheckAddressExists.js":5,"./Manyfest-ObjectAddress-DeleteValue.js":6,"./Manyfest-ObjectAddress-GetValue.js":7,"./Manyfest-ObjectAddress-SetValue.js":9,"./Manyfest-ObjectAddressGeneration.js":10,"./Manyfest-SchemaManipulation.js":12,"fable-serviceproviderbase":1}]},{},[13])(13)}));
|
|
2
2
|
//# sourceMappingURL=manyfest.compatible.min.js.map
|