manyfest 1.0.41 → 1.0.42
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/dist/manyfest.compatible.js +219 -70
- package/dist/manyfest.compatible.js.map +1 -0
- package/dist/manyfest.compatible.min.js +1 -1
- package/dist/manyfest.compatible.min.js.map +1 -1
- package/dist/manyfest.js +207 -61
- package/dist/manyfest.js.map +1 -0
- package/dist/manyfest.min.js +1 -1
- package/dist/manyfest.min.js.map +1 -1
- package/package.json +3 -3
- package/source/Manyfest.js +23 -5
- package/test/Manyfest_Object_Read_tests.js +13 -0
- package/types/Manyfest.d.ts +1 -0
- package/types/Manyfest.d.ts.map +1 -1
package/dist/manyfest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _defineProperty(
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
(function (f) {
|
|
@@ -50,11 +50,53 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
50
50
|
return r;
|
|
51
51
|
}()({
|
|
52
52
|
1: [function (require, module, exports) {
|
|
53
|
+
module.exports = {
|
|
54
|
+
"name": "fable-serviceproviderbase",
|
|
55
|
+
"version": "3.0.15",
|
|
56
|
+
"description": "Simple base classes for fable services.",
|
|
57
|
+
"main": "source/Fable-ServiceProviderBase.js",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"start": "node source/Fable-ServiceProviderBase.js",
|
|
60
|
+
"test": "npx mocha -u tdd -R spec",
|
|
61
|
+
"tests": "npx mocha -u tdd --exit -R spec --grep",
|
|
62
|
+
"coverage": "npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",
|
|
63
|
+
"build": "npx quack build"
|
|
64
|
+
},
|
|
65
|
+
"mocha": {
|
|
66
|
+
"diff": true,
|
|
67
|
+
"extension": ["js"],
|
|
68
|
+
"package": "./package.json",
|
|
69
|
+
"reporter": "spec",
|
|
70
|
+
"slow": "75",
|
|
71
|
+
"timeout": "5000",
|
|
72
|
+
"ui": "tdd",
|
|
73
|
+
"watch-files": ["source/**/*.js", "test/**/*.js"],
|
|
74
|
+
"watch-ignore": ["lib/vendor"]
|
|
75
|
+
},
|
|
76
|
+
"repository": {
|
|
77
|
+
"type": "git",
|
|
78
|
+
"url": "https://github.com/stevenvelozo/fable-serviceproviderbase.git"
|
|
79
|
+
},
|
|
80
|
+
"keywords": ["entity", "behavior"],
|
|
81
|
+
"author": "Steven Velozo <steven@velozo.com> (http://velozo.com/)",
|
|
82
|
+
"license": "MIT",
|
|
83
|
+
"bugs": {
|
|
84
|
+
"url": "https://github.com/stevenvelozo/fable-serviceproviderbase/issues"
|
|
85
|
+
},
|
|
86
|
+
"homepage": "https://github.com/stevenvelozo/fable-serviceproviderbase",
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"fable": "^3.0.143",
|
|
89
|
+
"quackage": "^1.0.33"
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}, {}],
|
|
93
|
+
2: [function (require, module, exports) {
|
|
53
94
|
/**
|
|
54
95
|
* Fable Service Base
|
|
55
96
|
* @author <steven@velozo.com>
|
|
56
97
|
*/
|
|
57
98
|
|
|
99
|
+
const libPackage = require('../package.json');
|
|
58
100
|
class FableServiceProviderBase {
|
|
59
101
|
// The constructor can be used in two ways:
|
|
60
102
|
// 1) With a fable, options object and service hash (the options object and service hash are optional)
|
|
@@ -67,6 +109,10 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
67
109
|
this.fable = false;
|
|
68
110
|
}
|
|
69
111
|
|
|
112
|
+
// Initialize the services map if it wasn't passed in
|
|
113
|
+
/** @type {Object} */
|
|
114
|
+
this._PackageFableServiceProvider = libPackage;
|
|
115
|
+
|
|
70
116
|
// initialize options and UUID based on whether the fable was passed in or not.
|
|
71
117
|
if (this.fable) {
|
|
72
118
|
this.UUID = pFable.getUUID();
|
|
@@ -110,8 +156,10 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
110
156
|
|
|
111
157
|
// This is left here in case we want to go back to having different code/base class for "core" services
|
|
112
158
|
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
113
|
-
}, {
|
|
114
|
-
|
|
159
|
+
}, {
|
|
160
|
+
"../package.json": 1
|
|
161
|
+
}],
|
|
162
|
+
3: [function (require, module, exports) {
|
|
115
163
|
// When a boxed property is passed in, it should have quotes of some
|
|
116
164
|
// kind around it.
|
|
117
165
|
//
|
|
@@ -136,7 +184,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
136
184
|
};
|
|
137
185
|
module.exports = cleanWrapCharacters;
|
|
138
186
|
}, {}],
|
|
139
|
-
|
|
187
|
+
4: [function (require, module, exports) {
|
|
140
188
|
/**
|
|
141
189
|
* @author <steven@velozo.com>
|
|
142
190
|
*/
|
|
@@ -220,9 +268,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
220
268
|
}
|
|
221
269
|
module.exports = ManyfestHashTranslation;
|
|
222
270
|
}, {
|
|
223
|
-
"./Manyfest-LogToConsole.js":
|
|
271
|
+
"./Manyfest-LogToConsole.js": 5
|
|
224
272
|
}],
|
|
225
|
-
|
|
273
|
+
5: [function (require, module, exports) {
|
|
226
274
|
/**
|
|
227
275
|
* @author <steven@velozo.com>
|
|
228
276
|
*/
|
|
@@ -238,7 +286,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
238
286
|
};
|
|
239
287
|
module.exports = logToConsole;
|
|
240
288
|
}, {}],
|
|
241
|
-
|
|
289
|
+
6: [function (require, module, exports) {
|
|
242
290
|
/**
|
|
243
291
|
* @author <steven@velozo.com>
|
|
244
292
|
*/
|
|
@@ -270,8 +318,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
270
318
|
* @class ManyfestObjectAddressResolverCheckAddressExists
|
|
271
319
|
*/
|
|
272
320
|
class ManyfestObjectAddressResolverCheckAddressExists {
|
|
273
|
-
constructor() {
|
|
274
|
-
|
|
321
|
+
constructor(pInfoLog, pErrorLog) {
|
|
322
|
+
// Wire in logging
|
|
323
|
+
this.logInfo = typeof pInfoLog == 'function' ? pInfoLog : libSimpleLog;
|
|
324
|
+
this.logError = typeof pErrorLog == 'function' ? pErrorLog : libSimpleLog;
|
|
325
|
+
this.getObjectValueClass = new libGetObjectValue(this.logInfo, this.logError);
|
|
275
326
|
}
|
|
276
327
|
|
|
277
328
|
// Check if an address exists.
|
|
@@ -535,11 +586,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
535
586
|
;
|
|
536
587
|
module.exports = ManyfestObjectAddressResolverCheckAddressExists;
|
|
537
588
|
}, {
|
|
538
|
-
"./Manyfest-LogToConsole.js":
|
|
539
|
-
"./Manyfest-ObjectAddress-GetValue.js":
|
|
540
|
-
"./Manyfest-ObjectAddress-Parser.js":
|
|
589
|
+
"./Manyfest-LogToConsole.js": 5,
|
|
590
|
+
"./Manyfest-ObjectAddress-GetValue.js": 8,
|
|
591
|
+
"./Manyfest-ObjectAddress-Parser.js": 9
|
|
541
592
|
}],
|
|
542
|
-
|
|
593
|
+
7: [function (require, module, exports) {
|
|
543
594
|
/**
|
|
544
595
|
* @author <steven@velozo.com>
|
|
545
596
|
*/
|
|
@@ -844,11 +895,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
844
895
|
;
|
|
845
896
|
module.exports = ManyfestObjectAddressResolverDeleteValue;
|
|
846
897
|
}, {
|
|
847
|
-
"../source/Manyfest-ParseConditionals.js":
|
|
848
|
-
"./Manyfest-CleanWrapCharacters.js":
|
|
849
|
-
"./Manyfest-LogToConsole.js":
|
|
898
|
+
"../source/Manyfest-ParseConditionals.js": 12,
|
|
899
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
900
|
+
"./Manyfest-LogToConsole.js": 5
|
|
850
901
|
}],
|
|
851
|
-
|
|
902
|
+
8: [function (require, module, exports) {
|
|
852
903
|
/**
|
|
853
904
|
* @author <steven@velozo.com>
|
|
854
905
|
*/
|
|
@@ -893,9 +944,16 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
893
944
|
// Get the value of an element at an address
|
|
894
945
|
getValueAtAddress(pObject, pAddress, pParentAddress, pRootObject) {
|
|
895
946
|
// Make sure pObject (the object we are meant to be recursing) is an object (which could be an array or object)
|
|
896
|
-
if (typeof pObject != 'object')
|
|
947
|
+
if (typeof pObject != 'object') {
|
|
948
|
+
return undefined;
|
|
949
|
+
}
|
|
950
|
+
if (pObject === null) {
|
|
951
|
+
return undefined;
|
|
952
|
+
}
|
|
897
953
|
// Make sure pAddress (the address we are resolving) is a string
|
|
898
|
-
if (typeof pAddress != 'string')
|
|
954
|
+
if (typeof pAddress != 'string') {
|
|
955
|
+
return undefined;
|
|
956
|
+
}
|
|
899
957
|
// Stash the parent address for later resolution
|
|
900
958
|
let tmpParentAddress = "";
|
|
901
959
|
if (typeof pParentAddress == 'string') {
|
|
@@ -1113,7 +1171,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1113
1171
|
if (typeof pObject[pAddress] != null) {
|
|
1114
1172
|
return pObject[pAddress];
|
|
1115
1173
|
} else {
|
|
1116
|
-
return
|
|
1174
|
+
return null;
|
|
1117
1175
|
}
|
|
1118
1176
|
}
|
|
1119
1177
|
} else {
|
|
@@ -1341,12 +1399,12 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1341
1399
|
;
|
|
1342
1400
|
module.exports = ManyfestObjectAddressResolverGetValue;
|
|
1343
1401
|
}, {
|
|
1344
|
-
"../source/Manyfest-ParseConditionals.js":
|
|
1345
|
-
"./Manyfest-CleanWrapCharacters.js":
|
|
1346
|
-
"./Manyfest-LogToConsole.js":
|
|
1347
|
-
"./Manyfest-ObjectAddress-Parser.js":
|
|
1402
|
+
"../source/Manyfest-ParseConditionals.js": 12,
|
|
1403
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
1404
|
+
"./Manyfest-LogToConsole.js": 5,
|
|
1405
|
+
"./Manyfest-ObjectAddress-Parser.js": 9
|
|
1348
1406
|
}],
|
|
1349
|
-
|
|
1407
|
+
9: [function (require, module, exports) {
|
|
1350
1408
|
// TODO: This is an inelegant solution to delay the rewrite of Manyfest.
|
|
1351
1409
|
|
|
1352
1410
|
// Fable 3.0 has a service for data formatting that deals well with nested enclosures.
|
|
@@ -1600,7 +1658,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1600
1658
|
}
|
|
1601
1659
|
};
|
|
1602
1660
|
}, {}],
|
|
1603
|
-
|
|
1661
|
+
10: [function (require, module, exports) {
|
|
1604
1662
|
/**
|
|
1605
1663
|
* @author <steven@velozo.com>
|
|
1606
1664
|
*/
|
|
@@ -1661,17 +1719,25 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1661
1719
|
// The "Name" of the Object contained too the left of the bracket
|
|
1662
1720
|
let tmpBoxedPropertyName = pAddress.substring(0, tmpBracketStartIndex).trim();
|
|
1663
1721
|
|
|
1722
|
+
// The "Reference" to the property within it, either an array element or object property
|
|
1723
|
+
let tmpBoxedPropertyReference = pAddress.substring(tmpBracketStartIndex + 1, tmpBracketStopIndex).trim();
|
|
1724
|
+
// Attempt to parse the reference as a number, which will be used as an array element
|
|
1725
|
+
let tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
1726
|
+
let tmpIndexIsNumeric = !isNaN(tmpBoxedPropertyNumber);
|
|
1727
|
+
if (pObject[tmpBoxedPropertyName] == null) {
|
|
1728
|
+
if (tmpIndexIsNumeric) {
|
|
1729
|
+
pObject[tmpBoxedPropertyName] = [];
|
|
1730
|
+
} else {
|
|
1731
|
+
pObject[tmpBoxedPropertyName] = {};
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1664
1735
|
// If the subproperty doesn't test as a proper Object, none of the rest of this is possible.
|
|
1665
1736
|
// This is a rare case where Arrays testing as Objects is useful
|
|
1666
1737
|
if (typeof pObject[tmpBoxedPropertyName] !== 'object') {
|
|
1667
1738
|
return false;
|
|
1668
1739
|
}
|
|
1669
1740
|
|
|
1670
|
-
// The "Reference" to the property within it, either an array element or object property
|
|
1671
|
-
let tmpBoxedPropertyReference = pAddress.substring(tmpBracketStartIndex + 1, tmpBracketStopIndex).trim();
|
|
1672
|
-
// Attempt to parse the reference as a number, which will be used as an array element
|
|
1673
|
-
let tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
1674
|
-
|
|
1675
1741
|
// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
1676
1742
|
// This seems confusing to me at first read, so explaination:
|
|
1677
1743
|
// Is the Boxed Object an Array? TRUE
|
|
@@ -1689,11 +1755,20 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1689
1755
|
tmpBoxedPropertyReference = this.cleanWrapCharacters('"', tmpBoxedPropertyReference);
|
|
1690
1756
|
tmpBoxedPropertyReference = this.cleanWrapCharacters('`', tmpBoxedPropertyReference);
|
|
1691
1757
|
tmpBoxedPropertyReference = this.cleanWrapCharacters("'", tmpBoxedPropertyReference);
|
|
1758
|
+
if (!(tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName])) {
|
|
1759
|
+
// If the subobject doesn't exist, create it
|
|
1760
|
+
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference] = {};
|
|
1761
|
+
}
|
|
1692
1762
|
|
|
1693
1763
|
// Return the value in the property
|
|
1764
|
+
//TODO: For cases where we have chained [][] properties, this needs to recurse somehow
|
|
1694
1765
|
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference] = pValue;
|
|
1695
1766
|
return true;
|
|
1696
1767
|
} else {
|
|
1768
|
+
while (pObject[tmpBoxedPropertyName].length < tmpBoxedPropertyNumber + 1) {
|
|
1769
|
+
// If the subobject doesn't exist, create it
|
|
1770
|
+
pObject[tmpBoxedPropertyName].push({});
|
|
1771
|
+
}
|
|
1697
1772
|
pObject[tmpBoxedPropertyName][tmpBoxedPropertyNumber] = pValue;
|
|
1698
1773
|
return true;
|
|
1699
1774
|
}
|
|
@@ -1727,6 +1802,16 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1727
1802
|
let tmpBoxedPropertyName = tmpSubObjectName.substring(0, tmpBracketStartIndex).trim();
|
|
1728
1803
|
let tmpBoxedPropertyReference = tmpSubObjectName.substring(tmpBracketStartIndex + 1, tmpBracketStopIndex).trim();
|
|
1729
1804
|
let tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
1805
|
+
let tmpIndexIsNumeric = !isNaN(tmpBoxedPropertyNumber);
|
|
1806
|
+
|
|
1807
|
+
//if (typeof(pObject[tmpBoxedPropertyName]) !== 'object')
|
|
1808
|
+
if (pObject[tmpBoxedPropertyName] == null) {
|
|
1809
|
+
if (tmpIndexIsNumeric) {
|
|
1810
|
+
pObject[tmpBoxedPropertyName] = [];
|
|
1811
|
+
} else {
|
|
1812
|
+
pObject[tmpBoxedPropertyName] = {};
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1730
1815
|
|
|
1731
1816
|
// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
1732
1817
|
// This seems confusing to me at first read, so explaination:
|
|
@@ -1742,7 +1827,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1742
1827
|
// BUT
|
|
1743
1828
|
// StudentData.Sections.Algebra.Students is an array, so the ["JaneDoe"].Grade is not possible to access
|
|
1744
1829
|
// TODO: Should this be an error or something? Should we keep a log of failures like this?
|
|
1745
|
-
if (Array.isArray(pObject[tmpBoxedPropertyName])
|
|
1830
|
+
if (Array.isArray(pObject[tmpBoxedPropertyName]) != tmpIndexIsNumeric) {
|
|
1746
1831
|
return false;
|
|
1747
1832
|
}
|
|
1748
1833
|
|
|
@@ -1754,10 +1839,19 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1754
1839
|
tmpBoxedPropertyReference = this.cleanWrapCharacters('"', tmpBoxedPropertyReference);
|
|
1755
1840
|
tmpBoxedPropertyReference = this.cleanWrapCharacters('`', tmpBoxedPropertyReference);
|
|
1756
1841
|
tmpBoxedPropertyReference = this.cleanWrapCharacters("'", tmpBoxedPropertyReference);
|
|
1842
|
+
if (!(tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName])) {
|
|
1843
|
+
// If the subobject doesn't exist, create it
|
|
1844
|
+
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference] = {};
|
|
1845
|
+
}
|
|
1757
1846
|
|
|
1758
1847
|
// Recurse directly into the subobject
|
|
1759
1848
|
return this.setValueAtAddress(pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference], tmpNewAddress, pValue);
|
|
1760
1849
|
} else {
|
|
1850
|
+
while (pObject[tmpBoxedPropertyName].length < tmpBoxedPropertyNumber + 1) {
|
|
1851
|
+
// If the subobject doesn't exist, create it
|
|
1852
|
+
pObject[tmpBoxedPropertyName].push({});
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1761
1855
|
// We parsed a valid number out of the boxed property name, so recurse into the array
|
|
1762
1856
|
return this.setValueAtAddress(pObject[tmpBoxedPropertyName][tmpBoxedPropertyNumber], tmpNewAddress, pValue);
|
|
1763
1857
|
}
|
|
@@ -1784,10 +1878,10 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1784
1878
|
;
|
|
1785
1879
|
module.exports = ManyfestObjectAddressSetValue;
|
|
1786
1880
|
}, {
|
|
1787
|
-
"./Manyfest-CleanWrapCharacters.js":
|
|
1788
|
-
"./Manyfest-LogToConsole.js":
|
|
1881
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
1882
|
+
"./Manyfest-LogToConsole.js": 5
|
|
1789
1883
|
}],
|
|
1790
|
-
|
|
1884
|
+
11: [function (require, module, exports) {
|
|
1791
1885
|
/**
|
|
1792
1886
|
* @author <steven@velozo.com>
|
|
1793
1887
|
*/
|
|
@@ -1895,9 +1989,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1895
1989
|
;
|
|
1896
1990
|
module.exports = ManyfestObjectAddressGeneration;
|
|
1897
1991
|
}, {
|
|
1898
|
-
"./Manyfest-LogToConsole.js":
|
|
1992
|
+
"./Manyfest-LogToConsole.js": 5
|
|
1899
1993
|
}],
|
|
1900
|
-
|
|
1994
|
+
12: [function (require, module, exports) {
|
|
1901
1995
|
// Given a string, parse out any conditional expressions and set whether or not to keep the record.
|
|
1902
1996
|
//
|
|
1903
1997
|
// For instance:
|
|
@@ -2031,7 +2125,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2031
2125
|
};
|
|
2032
2126
|
module.exports = parseConditionals;
|
|
2033
2127
|
}, {}],
|
|
2034
|
-
|
|
2128
|
+
13: [function (require, module, exports) {
|
|
2035
2129
|
/**
|
|
2036
2130
|
* @author <steven@velozo.com>
|
|
2037
2131
|
*/
|
|
@@ -2140,9 +2234,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2140
2234
|
}
|
|
2141
2235
|
module.exports = ManyfestSchemaManipulation;
|
|
2142
2236
|
}, {
|
|
2143
|
-
"./Manyfest-LogToConsole.js":
|
|
2237
|
+
"./Manyfest-LogToConsole.js": 5
|
|
2144
2238
|
}],
|
|
2145
|
-
|
|
2239
|
+
14: [function (require, module, exports) {
|
|
2146
2240
|
/**
|
|
2147
2241
|
* @author <steven@velozo.com>
|
|
2148
2242
|
*/
|
|
@@ -2160,6 +2254,18 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2160
2254
|
Descriptors: {}
|
|
2161
2255
|
};
|
|
2162
2256
|
|
|
2257
|
+
/**
|
|
2258
|
+
* @typedef {{
|
|
2259
|
+
* Hash?: string,
|
|
2260
|
+
* Name?: string,
|
|
2261
|
+
* DataType?: string,
|
|
2262
|
+
* Required?: boolean,
|
|
2263
|
+
* Address?: string,
|
|
2264
|
+
* Description?: string,
|
|
2265
|
+
* [key: string]: any,
|
|
2266
|
+
* }} ManifestDescriptor
|
|
2267
|
+
*/
|
|
2268
|
+
|
|
2163
2269
|
/**
|
|
2164
2270
|
* Manyfest object address-based descriptions and manipulations.
|
|
2165
2271
|
*
|
|
@@ -2172,6 +2278,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2172
2278
|
} else {
|
|
2173
2279
|
super(pFable, pManifest, pServiceHash);
|
|
2174
2280
|
}
|
|
2281
|
+
|
|
2282
|
+
/** @type {Record<string, any>} */
|
|
2283
|
+
this.options;
|
|
2175
2284
|
this.serviceType = 'Manifest';
|
|
2176
2285
|
|
|
2177
2286
|
// Wire in logging
|
|
@@ -2296,7 +2405,12 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2296
2405
|
};
|
|
2297
2406
|
}
|
|
2298
2407
|
|
|
2299
|
-
|
|
2408
|
+
/**
|
|
2409
|
+
* Add a descriptor to the manifest
|
|
2410
|
+
*
|
|
2411
|
+
* @param {string} pAddress - The address of the element to add the descriptor for.
|
|
2412
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor object to add.
|
|
2413
|
+
*/
|
|
2300
2414
|
addDescriptor(pAddress, pDescriptor) {
|
|
2301
2415
|
if (typeof pDescriptor === 'object') {
|
|
2302
2416
|
// Add the Address into the Descriptor if it doesn't exist:
|
|
@@ -2325,14 +2439,29 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2325
2439
|
return false;
|
|
2326
2440
|
}
|
|
2327
2441
|
}
|
|
2442
|
+
|
|
2443
|
+
/**
|
|
2444
|
+
* @param {string} pHash - The hash of the address to resolve.
|
|
2445
|
+
*
|
|
2446
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
2447
|
+
*/
|
|
2328
2448
|
getDescriptorByHash(pHash) {
|
|
2329
2449
|
return this.getDescriptor(this.resolveHashAddress(pHash));
|
|
2330
2450
|
}
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* @param {string} pAddress - The address of the element to get the descriptor for.
|
|
2454
|
+
*
|
|
2455
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
2456
|
+
*/
|
|
2331
2457
|
getDescriptor(pAddress) {
|
|
2332
2458
|
return this.elementDescriptors[pAddress];
|
|
2333
2459
|
}
|
|
2334
2460
|
|
|
2335
|
-
|
|
2461
|
+
/**
|
|
2462
|
+
* execute an action function for each descriptor
|
|
2463
|
+
* @param {(d: ManifestDescriptor) => void} fAction - The action function to execute for each descriptor.
|
|
2464
|
+
*/
|
|
2336
2465
|
eachDescriptor(fAction) {
|
|
2337
2466
|
let tmpDescriptorAddresses = Object.keys(this.elementDescriptors);
|
|
2338
2467
|
for (let i = 0; i < tmpDescriptorAddresses.length; i++) {
|
|
@@ -2356,8 +2485,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2356
2485
|
// Turn a hash into an address, factoring in the translation table.
|
|
2357
2486
|
resolveHashAddress(pHash) {
|
|
2358
2487
|
let tmpAddress = undefined;
|
|
2359
|
-
let tmpInElementHashTable =
|
|
2360
|
-
let tmpInTranslationTable =
|
|
2488
|
+
let tmpInElementHashTable = pHash in this.elementHashes;
|
|
2489
|
+
let tmpInTranslationTable = pHash in this.hashTranslations.translationTable;
|
|
2361
2490
|
|
|
2362
2491
|
// The most straightforward: the hash exists, no translations.
|
|
2363
2492
|
if (tmpInElementHashTable && !tmpInTranslationTable) {
|
|
@@ -2388,18 +2517,28 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2388
2517
|
}
|
|
2389
2518
|
return tmpValue;
|
|
2390
2519
|
}
|
|
2520
|
+
lintAddress(pAddress) {
|
|
2521
|
+
let tmpLintedAddress = pAddress.trim();
|
|
2522
|
+
// Check for a single . (but not a ..) at the end of the address and remove it.
|
|
2523
|
+
if (tmpLintedAddress.endsWith('..')) {
|
|
2524
|
+
tmpLintedAddress = tmpLintedAddress.slice(0, -1);
|
|
2525
|
+
} else if (tmpLintedAddress.endsWith('.')) {
|
|
2526
|
+
tmpLintedAddress = tmpLintedAddress.slice(0, -1);
|
|
2527
|
+
}
|
|
2528
|
+
return tmpLintedAddress;
|
|
2529
|
+
}
|
|
2391
2530
|
|
|
2392
2531
|
// Get the value of an element at an address
|
|
2393
2532
|
getValueAtAddress(pObject, pAddress) {
|
|
2394
|
-
let tmpLintedAddress =
|
|
2533
|
+
let tmpLintedAddress = this.lintAddress(pAddress);
|
|
2395
2534
|
if (tmpLintedAddress == '') {
|
|
2396
2535
|
this.logError("(".concat(this.scope, ") Error getting value at address; address is an empty string."), pObject);
|
|
2397
2536
|
return undefined;
|
|
2398
2537
|
}
|
|
2399
|
-
let tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject,
|
|
2538
|
+
let tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject, tmpLintedAddress);
|
|
2400
2539
|
if (typeof tmpValue == 'undefined') {
|
|
2401
2540
|
// Try to get a default if it exists
|
|
2402
|
-
tmpValue = this.getDefaultValue(this.getDescriptor(
|
|
2541
|
+
tmpValue = this.getDefaultValue(this.getDescriptor(tmpLintedAddress));
|
|
2403
2542
|
}
|
|
2404
2543
|
return tmpValue;
|
|
2405
2544
|
}
|
|
@@ -2411,7 +2550,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2411
2550
|
|
|
2412
2551
|
// Set the value of an element at an address
|
|
2413
2552
|
setValueAtAddress(pObject, pAddress, pValue) {
|
|
2414
|
-
|
|
2553
|
+
let tmpLintedAddress = this.lintAddress(pAddress);
|
|
2554
|
+
return this.objectAddressSetValue.setValueAtAddress(pObject, tmpLintedAddress, pValue);
|
|
2415
2555
|
}
|
|
2416
2556
|
|
|
2417
2557
|
// Delete the value of an element by its hash
|
|
@@ -2421,7 +2561,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2421
2561
|
|
|
2422
2562
|
// Delete the value of an element at an address
|
|
2423
2563
|
deleteValueAtAddress(pObject, pAddress, pValue) {
|
|
2424
|
-
|
|
2564
|
+
let tmpLintedAddress = this.lintAddress(pAddress);
|
|
2565
|
+
return this.objectAddressDeleteValue.deleteValueAtAddress(pObject, tmpLintedAddress, pValue);
|
|
2425
2566
|
}
|
|
2426
2567
|
|
|
2427
2568
|
// Validate the consistency of an object against the schema
|
|
@@ -2509,7 +2650,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2509
2650
|
return tmpValidationData;
|
|
2510
2651
|
}
|
|
2511
2652
|
|
|
2512
|
-
|
|
2653
|
+
/**
|
|
2654
|
+
* Returns a default value, or, the default value for the data type (which is overridable with configuration)
|
|
2655
|
+
*
|
|
2656
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor definition.
|
|
2657
|
+
*/
|
|
2513
2658
|
getDefaultValue(pDescriptor) {
|
|
2514
2659
|
if (typeof pDescriptor != 'object') {
|
|
2515
2660
|
return undefined;
|
|
@@ -2566,15 +2711,16 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
2566
2711
|
;
|
|
2567
2712
|
module.exports = Manyfest;
|
|
2568
2713
|
}, {
|
|
2569
|
-
"./Manyfest-HashTranslation.js":
|
|
2570
|
-
"./Manyfest-LogToConsole.js":
|
|
2571
|
-
"./Manyfest-ObjectAddress-CheckAddressExists.js":
|
|
2572
|
-
"./Manyfest-ObjectAddress-DeleteValue.js":
|
|
2573
|
-
"./Manyfest-ObjectAddress-GetValue.js":
|
|
2574
|
-
"./Manyfest-ObjectAddress-SetValue.js":
|
|
2575
|
-
"./Manyfest-ObjectAddressGeneration.js":
|
|
2576
|
-
"./Manyfest-SchemaManipulation.js":
|
|
2577
|
-
"fable-serviceproviderbase":
|
|
2714
|
+
"./Manyfest-HashTranslation.js": 4,
|
|
2715
|
+
"./Manyfest-LogToConsole.js": 5,
|
|
2716
|
+
"./Manyfest-ObjectAddress-CheckAddressExists.js": 6,
|
|
2717
|
+
"./Manyfest-ObjectAddress-DeleteValue.js": 7,
|
|
2718
|
+
"./Manyfest-ObjectAddress-GetValue.js": 8,
|
|
2719
|
+
"./Manyfest-ObjectAddress-SetValue.js": 10,
|
|
2720
|
+
"./Manyfest-ObjectAddressGeneration.js": 11,
|
|
2721
|
+
"./Manyfest-SchemaManipulation.js": 13,
|
|
2722
|
+
"fable-serviceproviderbase": 2
|
|
2578
2723
|
}]
|
|
2579
|
-
}, {}, [
|
|
2580
|
-
});
|
|
2724
|
+
}, {}, [14])(14);
|
|
2725
|
+
});
|
|
2726
|
+
//# sourceMappingURL=manyfest.js.map
|