manyfest 1.0.41 → 1.0.43
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 +498 -182
- 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 +487 -173
- 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-CleanWrapCharacters.js +7 -1
- package/source/Manyfest-HashTranslation.js +29 -8
- package/source/Manyfest-ObjectAddress-CheckAddressExists.js +28 -13
- package/source/Manyfest-ObjectAddress-DeleteValue.js +20 -2
- package/source/Manyfest-ObjectAddress-GetValue.js +23 -4
- package/source/Manyfest-ObjectAddress-Parser.js +39 -32
- package/source/Manyfest-ObjectAddress-SetValue.js +14 -2
- package/source/Manyfest-ObjectAddressGeneration.js +23 -12
- package/source/Manyfest-ParseConditionals.js +3 -3
- package/source/Manyfest-SchemaManipulation.js +44 -21
- package/source/Manyfest.js +69 -9
- package/test/Manyfest_Object_Read_tests.js +13 -0
- package/test/Manyfest_Performance_tests.js +48 -0
- package/types/Manyfest-CleanWrapCharacters.d.ts +7 -1
- package/types/Manyfest-CleanWrapCharacters.d.ts.map +1 -1
- package/types/Manyfest-HashTranslation.d.ts +34 -7
- package/types/Manyfest-HashTranslation.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts +23 -4
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts +25 -6
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-GetValue.d.ts +26 -6
- package/types/Manyfest-ObjectAddress-GetValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-Parser.d.ts +5 -5
- package/types/Manyfest-ObjectAddress-Parser.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-SetValue.d.ts +18 -5
- package/types/Manyfest-ObjectAddress-SetValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddressGeneration.d.ts +25 -4
- package/types/Manyfest-ObjectAddressGeneration.d.ts.map +1 -1
- package/types/Manyfest-SchemaManipulation.d.ts +47 -6
- package/types/Manyfest-SchemaManipulation.d.ts.map +1 -1
- package/types/Manyfest.d.ts +36 -12
- package/types/Manyfest.d.ts.map +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
4
|
-
function _possibleConstructorReturn(
|
|
5
|
-
function _assertThisInitialized(
|
|
4
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
5
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
6
6
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
7
|
-
function _getPrototypeOf(
|
|
8
|
-
function _inherits(
|
|
9
|
-
function _setPrototypeOf(
|
|
10
|
-
function _classCallCheck(
|
|
11
|
-
function _defineProperties(
|
|
12
|
-
function _createClass(
|
|
13
|
-
function _defineProperty(
|
|
7
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
8
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
9
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
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; }
|
|
14
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
15
|
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); }
|
|
16
16
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -61,10 +61,53 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
61
61
|
return r;
|
|
62
62
|
}()({
|
|
63
63
|
1: [function (require, module, exports) {
|
|
64
|
+
module.exports = {
|
|
65
|
+
"name": "fable-serviceproviderbase",
|
|
66
|
+
"version": "3.0.15",
|
|
67
|
+
"description": "Simple base classes for fable services.",
|
|
68
|
+
"main": "source/Fable-ServiceProviderBase.js",
|
|
69
|
+
"scripts": {
|
|
70
|
+
"start": "node source/Fable-ServiceProviderBase.js",
|
|
71
|
+
"test": "npx mocha -u tdd -R spec",
|
|
72
|
+
"tests": "npx mocha -u tdd --exit -R spec --grep",
|
|
73
|
+
"coverage": "npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",
|
|
74
|
+
"build": "npx quack build"
|
|
75
|
+
},
|
|
76
|
+
"mocha": {
|
|
77
|
+
"diff": true,
|
|
78
|
+
"extension": ["js"],
|
|
79
|
+
"package": "./package.json",
|
|
80
|
+
"reporter": "spec",
|
|
81
|
+
"slow": "75",
|
|
82
|
+
"timeout": "5000",
|
|
83
|
+
"ui": "tdd",
|
|
84
|
+
"watch-files": ["source/**/*.js", "test/**/*.js"],
|
|
85
|
+
"watch-ignore": ["lib/vendor"]
|
|
86
|
+
},
|
|
87
|
+
"repository": {
|
|
88
|
+
"type": "git",
|
|
89
|
+
"url": "https://github.com/stevenvelozo/fable-serviceproviderbase.git"
|
|
90
|
+
},
|
|
91
|
+
"keywords": ["entity", "behavior"],
|
|
92
|
+
"author": "Steven Velozo <steven@velozo.com> (http://velozo.com/)",
|
|
93
|
+
"license": "MIT",
|
|
94
|
+
"bugs": {
|
|
95
|
+
"url": "https://github.com/stevenvelozo/fable-serviceproviderbase/issues"
|
|
96
|
+
},
|
|
97
|
+
"homepage": "https://github.com/stevenvelozo/fable-serviceproviderbase",
|
|
98
|
+
"devDependencies": {
|
|
99
|
+
"fable": "^3.0.143",
|
|
100
|
+
"quackage": "^1.0.33"
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}, {}],
|
|
104
|
+
2: [function (require, module, exports) {
|
|
64
105
|
/**
|
|
65
106
|
* Fable Service Base
|
|
66
107
|
* @author <steven@velozo.com>
|
|
67
108
|
*/
|
|
109
|
+
|
|
110
|
+
var libPackage = require('../package.json');
|
|
68
111
|
var FableServiceProviderBase = /*#__PURE__*/function () {
|
|
69
112
|
// The constructor can be used in two ways:
|
|
70
113
|
// 1) With a fable, options object and service hash (the options object and service hash are optional)
|
|
@@ -78,6 +121,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
78
121
|
this.fable = false;
|
|
79
122
|
}
|
|
80
123
|
|
|
124
|
+
// Initialize the services map if it wasn't passed in
|
|
125
|
+
/** @type {Object} */
|
|
126
|
+
this._PackageFableServiceProvider = libPackage;
|
|
127
|
+
|
|
81
128
|
// initialize options and UUID based on whether the fable was passed in or not.
|
|
82
129
|
if (this.fable) {
|
|
83
130
|
this.UUID = pFable.getUUID();
|
|
@@ -124,8 +171,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
124
171
|
|
|
125
172
|
// This is left here in case we want to go back to having different code/base class for "core" services
|
|
126
173
|
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
127
|
-
}, {
|
|
128
|
-
|
|
174
|
+
}, {
|
|
175
|
+
"../package.json": 1
|
|
176
|
+
}],
|
|
177
|
+
3: [function (require, module, exports) {
|
|
129
178
|
// When a boxed property is passed in, it should have quotes of some
|
|
130
179
|
// kind around it.
|
|
131
180
|
//
|
|
@@ -141,6 +190,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
141
190
|
//
|
|
142
191
|
// TODO: Should template literals be processed? If so what state do they have access to? That should happen here if so.
|
|
143
192
|
// TODO: Make a simple class include library with these
|
|
193
|
+
/**
|
|
194
|
+
* @param {string} pCharacter - The character to remove from the start and end of the string
|
|
195
|
+
* @param {string} pString - The string to clean
|
|
196
|
+
*
|
|
197
|
+
* @return {string} The cleaned string
|
|
198
|
+
*/
|
|
144
199
|
var cleanWrapCharacters = function cleanWrapCharacters(pCharacter, pString) {
|
|
145
200
|
if (pString.startsWith(pCharacter) && pString.endsWith(pCharacter)) {
|
|
146
201
|
return pString.substring(1, pString.length - 1);
|
|
@@ -150,7 +205,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
150
205
|
};
|
|
151
206
|
module.exports = cleanWrapCharacters;
|
|
152
207
|
}, {}],
|
|
153
|
-
|
|
208
|
+
4: [function (require, module, exports) {
|
|
154
209
|
/**
|
|
155
210
|
* @author <steven@velozo.com>
|
|
156
211
|
*/
|
|
@@ -172,6 +227,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
172
227
|
* @class ManyfestHashTranslation
|
|
173
228
|
*/
|
|
174
229
|
var ManyfestHashTranslation = /*#__PURE__*/function () {
|
|
230
|
+
/**
|
|
231
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
232
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
233
|
+
*/
|
|
175
234
|
function ManyfestHashTranslation(pInfoLog, pErrorLog) {
|
|
176
235
|
_classCallCheck(this, ManyfestHashTranslation);
|
|
177
236
|
// Wire in logging
|
|
@@ -179,11 +238,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
179
238
|
this.logError = typeof pErrorLog === 'function' ? pErrorLog : libSimpleLog;
|
|
180
239
|
this.translationTable = {};
|
|
181
240
|
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @return {number} The number of translations in the table
|
|
244
|
+
*/
|
|
182
245
|
return _createClass(ManyfestHashTranslation, [{
|
|
183
246
|
key: "translationCount",
|
|
184
247
|
value: function translationCount() {
|
|
185
248
|
return Object.keys(this.translationTable).length;
|
|
186
249
|
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param {object} pTranslation - An object containing source:destination hash pairs to add to the translation table
|
|
253
|
+
*/
|
|
187
254
|
}, {
|
|
188
255
|
key: "addTranslation",
|
|
189
256
|
value: function addTranslation(pTranslation) {
|
|
@@ -203,17 +270,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
203
270
|
}
|
|
204
271
|
});
|
|
205
272
|
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @param {string} pTranslationHash - The source hash to remove from the translation table
|
|
276
|
+
*/
|
|
206
277
|
}, {
|
|
207
278
|
key: "removeTranslationHash",
|
|
208
279
|
value: function removeTranslationHash(pTranslationHash) {
|
|
209
|
-
|
|
210
|
-
delete this.translationTable[pTranslationHash];
|
|
211
|
-
}
|
|
280
|
+
delete this.translationTable[pTranslationHash];
|
|
212
281
|
}
|
|
213
282
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
283
|
+
/**
|
|
284
|
+
* This removes translations.
|
|
285
|
+
* If passed a string, just removes the single one.
|
|
286
|
+
* If passed an object, it does all the source keys.
|
|
287
|
+
*
|
|
288
|
+
* @param {string|object} pTranslation - Either a source hash string to remove, or an object containing source:destination hash pairs to remove
|
|
289
|
+
*
|
|
290
|
+
* @return {boolean} True if the removal was successful, false otherwise
|
|
291
|
+
*/
|
|
217
292
|
}, {
|
|
218
293
|
key: "removeTranslation",
|
|
219
294
|
value: function removeTranslation(pTranslation) {
|
|
@@ -237,6 +312,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
237
312
|
value: function clearTranslations() {
|
|
238
313
|
this.translationTable = {};
|
|
239
314
|
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @param {string} pTranslation - The source hash to translate
|
|
318
|
+
*
|
|
319
|
+
* @return {string} The translated hash, or the original if no translation exists
|
|
320
|
+
*/
|
|
240
321
|
}, {
|
|
241
322
|
key: "translate",
|
|
242
323
|
value: function translate(pTranslation) {
|
|
@@ -250,9 +331,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
250
331
|
}();
|
|
251
332
|
module.exports = ManyfestHashTranslation;
|
|
252
333
|
}, {
|
|
253
|
-
"./Manyfest-LogToConsole.js":
|
|
334
|
+
"./Manyfest-LogToConsole.js": 5
|
|
254
335
|
}],
|
|
255
|
-
|
|
336
|
+
5: [function (require, module, exports) {
|
|
256
337
|
/**
|
|
257
338
|
* @author <steven@velozo.com>
|
|
258
339
|
*/
|
|
@@ -268,13 +349,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
268
349
|
};
|
|
269
350
|
module.exports = logToConsole;
|
|
270
351
|
}, {}],
|
|
271
|
-
|
|
352
|
+
6: [function (require, module, exports) {
|
|
272
353
|
/**
|
|
273
354
|
* @author <steven@velozo.com>
|
|
274
355
|
*/
|
|
275
356
|
var libSimpleLog = require('./Manyfest-LogToConsole.js');
|
|
276
357
|
// This is for resolving functions mid-address
|
|
277
358
|
var libGetObjectValue = require('./Manyfest-ObjectAddress-GetValue.js');
|
|
359
|
+
var fCleanWrapCharacters = require('./Manyfest-CleanWrapCharacters.js');
|
|
278
360
|
|
|
279
361
|
// TODO: Just until this is a fable service.
|
|
280
362
|
var _MockFable = {
|
|
@@ -300,17 +382,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
300
382
|
* @class ManyfestObjectAddressResolverCheckAddressExists
|
|
301
383
|
*/
|
|
302
384
|
var ManyfestObjectAddressResolverCheckAddressExists = /*#__PURE__*/function () {
|
|
303
|
-
|
|
385
|
+
/**
|
|
386
|
+
* @param {function} [pInfoLog] - (optional) Function to use for info logging
|
|
387
|
+
* @param {function} [pErrorLog] - (optional) Function to use for error logging
|
|
388
|
+
*/
|
|
389
|
+
function ManyfestObjectAddressResolverCheckAddressExists(pInfoLog, pErrorLog) {
|
|
304
390
|
_classCallCheck(this, ManyfestObjectAddressResolverCheckAddressExists);
|
|
305
|
-
|
|
391
|
+
// Wire in logging
|
|
392
|
+
this.logInfo = typeof pInfoLog == 'function' ? pInfoLog : libSimpleLog;
|
|
393
|
+
this.logError = typeof pErrorLog == 'function' ? pErrorLog : libSimpleLog;
|
|
394
|
+
this.getObjectValueClass = new libGetObjectValue(this.logInfo, this.logError);
|
|
395
|
+
this.cleanWrapCharacters = fCleanWrapCharacters;
|
|
306
396
|
}
|
|
307
397
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
398
|
+
/**
|
|
399
|
+
* Check if an address exists.
|
|
400
|
+
*
|
|
401
|
+
* This is necessary because the getValueAtAddress function is ambiguous on
|
|
402
|
+
* whether the element/property is actually there or not (it returns
|
|
403
|
+
* undefined whether the property exists or not). This function checks for
|
|
404
|
+
* existance and returns true or false dependent.
|
|
405
|
+
*
|
|
406
|
+
* @param {object} pObject - The object to check within
|
|
407
|
+
* @param {string} pAddress - The address to check for
|
|
408
|
+
* @param {object} [pRootObject] - (optional) The root object for function resolution context
|
|
409
|
+
*
|
|
410
|
+
* @return {boolean} - True if the address exists, false if it does not
|
|
411
|
+
*/
|
|
314
412
|
return _createClass(ManyfestObjectAddressResolverCheckAddressExists, [{
|
|
315
413
|
key: "checkAddressExists",
|
|
316
414
|
value: function checkAddressExists(pObject, pAddress, pRootObject) {
|
|
@@ -445,7 +543,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
445
543
|
var _tmpFunctionAddress = tmpSubObjectName.substring(0, _tmpFunctionStartIndex).trim();
|
|
446
544
|
//tmpParentAddress = `${tmpParentAddress}${(tmpParentAddress.length > 0) ? '.' : ''}${tmpSubObjectName}`;
|
|
447
545
|
|
|
448
|
-
if (
|
|
546
|
+
if (typeof pObject[_tmpFunctionAddress] !== 'function') {
|
|
449
547
|
// The address suggests it is a function, but it is not.
|
|
450
548
|
return false;
|
|
451
549
|
}
|
|
@@ -460,12 +558,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
460
558
|
return this.checkAddressExists(pObject[_tmpFunctionAddress].apply(pObject), tmpNewAddress, tmpRootObject);
|
|
461
559
|
} catch (pError) {
|
|
462
560
|
// The function call failed, so the address doesn't exist
|
|
463
|
-
libSimpleLog
|
|
561
|
+
libSimpleLog("Error calling function ".concat(_tmpFunctionAddress, " (address [").concat(pAddress, "]): ").concat(pError.message));
|
|
464
562
|
return false;
|
|
465
563
|
}
|
|
466
564
|
} else {
|
|
467
565
|
// The function doesn't exist, so the address doesn't exist
|
|
468
|
-
libSimpleLog
|
|
566
|
+
libSimpleLog("Function ".concat(_tmpFunctionAddress, " does not exist (address [").concat(pAddress, "])"));
|
|
469
567
|
return false;
|
|
470
568
|
}
|
|
471
569
|
} else {
|
|
@@ -485,12 +583,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
485
583
|
return this.checkAddressExists(pObject[_tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, _tmpRootObject);
|
|
486
584
|
} catch (pError) {
|
|
487
585
|
// The function call failed, so the address doesn't exist
|
|
488
|
-
libSimpleLog
|
|
586
|
+
libSimpleLog("Error calling function ".concat(_tmpFunctionAddress, " (address [").concat(pAddress, "]): ").concat(pError.message));
|
|
489
587
|
return false;
|
|
490
588
|
}
|
|
491
589
|
} else {
|
|
492
590
|
// The function doesn't exist, so the address doesn't exist
|
|
493
|
-
libSimpleLog
|
|
591
|
+
libSimpleLog("Function ".concat(_tmpFunctionAddress, " does not exist (address [").concat(pAddress, "])"));
|
|
494
592
|
return false;
|
|
495
593
|
}
|
|
496
594
|
}
|
|
@@ -566,14 +664,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
566
664
|
}
|
|
567
665
|
}]);
|
|
568
666
|
}();
|
|
569
|
-
;
|
|
570
667
|
module.exports = ManyfestObjectAddressResolverCheckAddressExists;
|
|
571
668
|
}, {
|
|
572
|
-
"./Manyfest-
|
|
573
|
-
"./Manyfest-
|
|
574
|
-
"./Manyfest-ObjectAddress-
|
|
669
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
670
|
+
"./Manyfest-LogToConsole.js": 5,
|
|
671
|
+
"./Manyfest-ObjectAddress-GetValue.js": 8,
|
|
672
|
+
"./Manyfest-ObjectAddress-Parser.js": 9
|
|
575
673
|
}],
|
|
576
|
-
|
|
674
|
+
7: [function (require, module, exports) {
|
|
577
675
|
/**
|
|
578
676
|
* @author <steven@velozo.com>
|
|
579
677
|
*/
|
|
@@ -602,6 +700,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
602
700
|
* @class ManyfestObjectAddressResolverDeleteValue
|
|
603
701
|
*/
|
|
604
702
|
var ManyfestObjectAddressResolverDeleteValue = /*#__PURE__*/function () {
|
|
703
|
+
/**
|
|
704
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
705
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
706
|
+
*/
|
|
605
707
|
function ManyfestObjectAddressResolverDeleteValue(pInfoLog, pErrorLog) {
|
|
606
708
|
_classCallCheck(this, ManyfestObjectAddressResolverDeleteValue);
|
|
607
709
|
// Wire in logging
|
|
@@ -611,13 +713,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
611
713
|
}
|
|
612
714
|
|
|
613
715
|
// TODO: Dry me
|
|
716
|
+
/**
|
|
717
|
+
* @param {string} pAddress - The address being evaluated
|
|
718
|
+
* @param {object} pRecord - The record being evaluated
|
|
719
|
+
*
|
|
720
|
+
* @return {boolean} True if the record passes the filters, false if it does not
|
|
721
|
+
*/
|
|
614
722
|
return _createClass(ManyfestObjectAddressResolverDeleteValue, [{
|
|
615
723
|
key: "checkRecordFilters",
|
|
616
724
|
value: function checkRecordFilters(pAddress, pRecord) {
|
|
617
725
|
return fParseConditionals(this, pAddress, pRecord);
|
|
618
726
|
}
|
|
619
727
|
|
|
620
|
-
|
|
728
|
+
/**
|
|
729
|
+
* Delete the value of an element at an address
|
|
730
|
+
*
|
|
731
|
+
* @param {object} pObject - The object to delete the value from
|
|
732
|
+
* @param {string} pAddress - The address to delete the value at
|
|
733
|
+
* @param {string} [pParentAddress] - (optional) The parent address for recursion
|
|
734
|
+
*
|
|
735
|
+
* @return {boolean|object|undefined} - True if the value was deleted, false if it could not be deleted, undefined on error
|
|
736
|
+
*/
|
|
621
737
|
}, {
|
|
622
738
|
key: "deleteValueAtAddress",
|
|
623
739
|
value: function deleteValueAtAddress(pObject, pAddress, pParentAddress) {
|
|
@@ -884,11 +1000,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
884
1000
|
;
|
|
885
1001
|
module.exports = ManyfestObjectAddressResolverDeleteValue;
|
|
886
1002
|
}, {
|
|
887
|
-
"../source/Manyfest-ParseConditionals.js":
|
|
888
|
-
"./Manyfest-CleanWrapCharacters.js":
|
|
889
|
-
"./Manyfest-LogToConsole.js":
|
|
1003
|
+
"../source/Manyfest-ParseConditionals.js": 12,
|
|
1004
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
1005
|
+
"./Manyfest-LogToConsole.js": 5
|
|
890
1006
|
}],
|
|
891
|
-
|
|
1007
|
+
8: [function (require, module, exports) {
|
|
892
1008
|
/**
|
|
893
1009
|
* @author <steven@velozo.com>
|
|
894
1010
|
*/
|
|
@@ -920,6 +1036,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
920
1036
|
* @class ManyfestObjectAddressResolverGetValue
|
|
921
1037
|
*/
|
|
922
1038
|
var ManyfestObjectAddressResolverGetValue = /*#__PURE__*/function () {
|
|
1039
|
+
/**
|
|
1040
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
1041
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
1042
|
+
*/
|
|
923
1043
|
function ManyfestObjectAddressResolverGetValue(pInfoLog, pErrorLog) {
|
|
924
1044
|
_classCallCheck(this, ManyfestObjectAddressResolverGetValue);
|
|
925
1045
|
// Wire in logging
|
|
@@ -927,20 +1047,43 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
927
1047
|
this.logError = typeof pErrorLog == 'function' ? pErrorLog : libSimpleLog;
|
|
928
1048
|
this.cleanWrapCharacters = fCleanWrapCharacters;
|
|
929
1049
|
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* @param {string} pAddress - The address of the record to check
|
|
1053
|
+
* @param {object} pRecord - The record to check against the filters
|
|
1054
|
+
*
|
|
1055
|
+
* @return {boolean} - True if the record passes the filters, false otherwise
|
|
1056
|
+
*/
|
|
930
1057
|
return _createClass(ManyfestObjectAddressResolverGetValue, [{
|
|
931
1058
|
key: "checkRecordFilters",
|
|
932
1059
|
value: function checkRecordFilters(pAddress, pRecord) {
|
|
933
1060
|
return fParseConditionals(this, pAddress, pRecord);
|
|
934
1061
|
}
|
|
935
1062
|
|
|
936
|
-
|
|
1063
|
+
/**
|
|
1064
|
+
* Get the value of an element at an address
|
|
1065
|
+
*
|
|
1066
|
+
* @param {object} pObject - The object to resolve the address against
|
|
1067
|
+
* @param {string} pAddress - The address to resolve
|
|
1068
|
+
* @param {string} [pParentAddress] - (optional) The parent address for back-navigation
|
|
1069
|
+
* @param {object} [pRootObject] - (optional) The root object for function argument resolution
|
|
1070
|
+
*
|
|
1071
|
+
* @return {any} The value at the address, or undefined if not found
|
|
1072
|
+
*/
|
|
937
1073
|
}, {
|
|
938
1074
|
key: "getValueAtAddress",
|
|
939
1075
|
value: function getValueAtAddress(pObject, pAddress, pParentAddress, pRootObject) {
|
|
940
1076
|
// Make sure pObject (the object we are meant to be recursing) is an object (which could be an array or object)
|
|
941
|
-
if (_typeof(pObject) != 'object')
|
|
1077
|
+
if (_typeof(pObject) != 'object') {
|
|
1078
|
+
return undefined;
|
|
1079
|
+
}
|
|
1080
|
+
if (pObject === null) {
|
|
1081
|
+
return undefined;
|
|
1082
|
+
}
|
|
942
1083
|
// Make sure pAddress (the address we are resolving) is a string
|
|
943
|
-
if (typeof pAddress != 'string')
|
|
1084
|
+
if (typeof pAddress != 'string') {
|
|
1085
|
+
return undefined;
|
|
1086
|
+
}
|
|
944
1087
|
// Stash the parent address for later resolution
|
|
945
1088
|
var tmpParentAddress = "";
|
|
946
1089
|
if (typeof pParentAddress == 'string') {
|
|
@@ -1016,7 +1159,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1016
1159
|
// 2) The end bracket is after the start bracket
|
|
1017
1160
|
&& _MockFable.DataFormat.stringCountEnclosures(pAddress) > 0) {
|
|
1018
1161
|
var tmpFunctionAddress = pAddress.substring(0, tmpFunctionStartIndex).trim();
|
|
1019
|
-
if (
|
|
1162
|
+
if (typeof pObject[tmpFunctionAddress] !== 'function') {
|
|
1020
1163
|
// The address suggests it is a function, but it is not.
|
|
1021
1164
|
return false;
|
|
1022
1165
|
}
|
|
@@ -1158,7 +1301,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1158
1301
|
if (_typeof(pObject[pAddress]) != null) {
|
|
1159
1302
|
return pObject[pAddress];
|
|
1160
1303
|
} else {
|
|
1161
|
-
return
|
|
1304
|
+
return null;
|
|
1162
1305
|
}
|
|
1163
1306
|
}
|
|
1164
1307
|
} else {
|
|
@@ -1193,7 +1336,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1193
1336
|
&& _MockFable.DataFormat.stringCountEnclosures(tmpSubObjectName) > 0) {
|
|
1194
1337
|
var _tmpFunctionAddress2 = tmpSubObjectName.substring(0, _tmpFunctionStartIndex2).trim();
|
|
1195
1338
|
tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
|
|
1196
|
-
if (
|
|
1339
|
+
if (typeof pObject[_tmpFunctionAddress2] !== 'function') {
|
|
1197
1340
|
// The address suggests it is a function, but it is not.
|
|
1198
1341
|
return false;
|
|
1199
1342
|
}
|
|
@@ -1387,12 +1530,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1387
1530
|
;
|
|
1388
1531
|
module.exports = ManyfestObjectAddressResolverGetValue;
|
|
1389
1532
|
}, {
|
|
1390
|
-
"../source/Manyfest-ParseConditionals.js":
|
|
1391
|
-
"./Manyfest-CleanWrapCharacters.js":
|
|
1392
|
-
"./Manyfest-LogToConsole.js":
|
|
1393
|
-
"./Manyfest-ObjectAddress-Parser.js":
|
|
1533
|
+
"../source/Manyfest-ParseConditionals.js": 12,
|
|
1534
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
1535
|
+
"./Manyfest-LogToConsole.js": 5,
|
|
1536
|
+
"./Manyfest-ObjectAddress-Parser.js": 9
|
|
1394
1537
|
}],
|
|
1395
|
-
|
|
1538
|
+
9: [function (require, module, exports) {
|
|
1396
1539
|
// TODO: This is an inelegant solution to delay the rewrite of Manyfest.
|
|
1397
1540
|
|
|
1398
1541
|
// Fable 3.0 has a service for data formatting that deals well with nested enclosures.
|
|
@@ -1403,29 +1546,32 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1403
1546
|
// Until we shift Manyfest to be a fable service, these three functions were pulled out of
|
|
1404
1547
|
// fable to aid in parsing functions with nested enclosures.
|
|
1405
1548
|
|
|
1549
|
+
var DEFAULT_START_SYMBOL_MAP = {
|
|
1550
|
+
'{': 0,
|
|
1551
|
+
'[': 1,
|
|
1552
|
+
'(': 2
|
|
1553
|
+
};
|
|
1554
|
+
var DEFAULT_END_SYMBOL_MAP = {
|
|
1555
|
+
'}': 0,
|
|
1556
|
+
']': 1,
|
|
1557
|
+
')': 2
|
|
1558
|
+
};
|
|
1406
1559
|
module.exports = {
|
|
1407
1560
|
/**
|
|
1408
1561
|
* Count the number of segments in a string, respecting enclosures
|
|
1409
|
-
*
|
|
1410
|
-
* @param {string} pString
|
|
1411
|
-
* @param {string} pSeparator
|
|
1412
|
-
* @param {
|
|
1413
|
-
* @param {
|
|
1414
|
-
*
|
|
1562
|
+
*
|
|
1563
|
+
* @param {string} pString
|
|
1564
|
+
* @param {string} [pSeparator]
|
|
1565
|
+
* @param {Record<string, number>} [pEnclosureStartSymbolMap]
|
|
1566
|
+
* @param {Record<string, number>} [pEnclosureEndSymbolMap]
|
|
1567
|
+
*
|
|
1568
|
+
* @return {number} - The number of segments in the string
|
|
1415
1569
|
*/
|
|
1416
1570
|
stringCountSegments: function stringCountSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1417
1571
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1418
1572
|
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1419
|
-
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ?
|
|
1420
|
-
|
|
1421
|
-
'[': 1,
|
|
1422
|
-
'(': 2
|
|
1423
|
-
};
|
|
1424
|
-
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1425
|
-
'}': 0,
|
|
1426
|
-
']': 1,
|
|
1427
|
-
')': 2
|
|
1428
|
-
};
|
|
1573
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStartSymbolMap : DEFAULT_START_SYMBOL_MAP;
|
|
1574
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEndSymbolMap : DEFAULT_END_SYMBOL_MAP;
|
|
1429
1575
|
if (pString.length < 1) {
|
|
1430
1576
|
return 0;
|
|
1431
1577
|
}
|
|
@@ -1456,28 +1602,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1456
1602
|
},
|
|
1457
1603
|
/**
|
|
1458
1604
|
* Get the first segment in a string, respecting enclosures
|
|
1459
|
-
*
|
|
1460
|
-
* @param {string} pString
|
|
1461
|
-
* @param {string} pSeparator
|
|
1462
|
-
* @param {
|
|
1463
|
-
* @param {
|
|
1464
|
-
*
|
|
1605
|
+
*
|
|
1606
|
+
* @param {string} pString
|
|
1607
|
+
* @param {string} [pSeparator]
|
|
1608
|
+
* @param {Record<string, number>} [pEnclosureStartSymbolMap]
|
|
1609
|
+
* @param {Record<string, number>} [pEnclosureEndSymbolMap]
|
|
1610
|
+
*
|
|
1611
|
+
* @return {string} - the first segment in the string as a string
|
|
1465
1612
|
*/
|
|
1466
1613
|
stringGetFirstSegment: function stringGetFirstSegment(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1467
1614
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1468
1615
|
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1469
|
-
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ?
|
|
1470
|
-
|
|
1471
|
-
'[': 1,
|
|
1472
|
-
'(': 2
|
|
1473
|
-
};
|
|
1474
|
-
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1475
|
-
'}': 0,
|
|
1476
|
-
']': 1,
|
|
1477
|
-
')': 2
|
|
1478
|
-
};
|
|
1616
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStartSymbolMap : DEFAULT_START_SYMBOL_MAP;
|
|
1617
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEndSymbolMap : DEFAULT_END_SYMBOL_MAP;
|
|
1479
1618
|
if (pString.length < 1) {
|
|
1480
|
-
return
|
|
1619
|
+
return '';
|
|
1481
1620
|
}
|
|
1482
1621
|
var tmpEnclosureStack = [];
|
|
1483
1622
|
for (var i = 0; i < tmpString.length; i++) {
|
|
@@ -1505,26 +1644,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1505
1644
|
},
|
|
1506
1645
|
/**
|
|
1507
1646
|
* Get all segments in a string, respecting enclosures
|
|
1508
|
-
*
|
|
1509
|
-
* @param {string} pString
|
|
1510
|
-
* @param {string} pSeparator
|
|
1511
|
-
* @param {
|
|
1512
|
-
* @param {
|
|
1513
|
-
*
|
|
1647
|
+
*
|
|
1648
|
+
* @param {string} pString
|
|
1649
|
+
* @param {string} [pSeparator]
|
|
1650
|
+
* @param {Record<string, number>} [pEnclosureStartSymbolMap]
|
|
1651
|
+
* @param {Record<string, number>} [pEnclosureEndSymbolMap]
|
|
1652
|
+
*
|
|
1653
|
+
* @return {Array<string>} - the segments in the string as an array of strings
|
|
1514
1654
|
*/
|
|
1515
1655
|
stringGetSegments: function stringGetSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1516
1656
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1517
1657
|
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1518
|
-
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ?
|
|
1519
|
-
|
|
1520
|
-
'[': 1,
|
|
1521
|
-
'(': 2
|
|
1522
|
-
};
|
|
1523
|
-
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1524
|
-
'}': 0,
|
|
1525
|
-
']': 1,
|
|
1526
|
-
')': 2
|
|
1527
|
-
};
|
|
1658
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStartSymbolMap : DEFAULT_START_SYMBOL_MAP;
|
|
1659
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEndSymbolMap : DEFAULT_END_SYMBOL_MAP;
|
|
1528
1660
|
var tmpCurrentSegmentStart = 0;
|
|
1529
1661
|
var tmpSegmentList = [];
|
|
1530
1662
|
if (pString.length < 1) {
|
|
@@ -1564,8 +1696,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1564
1696
|
* If no start or end characters are specified, it will default to parentheses. If the string is not a string, it will return 0.
|
|
1565
1697
|
*
|
|
1566
1698
|
* @param {string} pString
|
|
1567
|
-
* @param {string} pEnclosureStart
|
|
1568
|
-
* @param {string} pEnclosureEnd
|
|
1699
|
+
* @param {string} [pEnclosureStart]
|
|
1700
|
+
* @param {string} [pEnclosureEnd]
|
|
1569
1701
|
* @returns the count of full in the string
|
|
1570
1702
|
*/
|
|
1571
1703
|
stringCountEnclosures: function stringCountEnclosures(pString, pEnclosureStart, pEnclosureEnd) {
|
|
@@ -1594,9 +1726,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1594
1726
|
*
|
|
1595
1727
|
* @param {string} pString
|
|
1596
1728
|
* @param {number} pEnclosureIndexToGet
|
|
1597
|
-
* @param {string} pEnclosureStart
|
|
1598
|
-
* @param {string}
|
|
1599
|
-
*
|
|
1729
|
+
* @param {string} [pEnclosureStart]
|
|
1730
|
+
* @param {string} [pEnclosureEnd]
|
|
1731
|
+
*
|
|
1732
|
+
* @return {string} - The value of the enclosure at the specified index
|
|
1600
1733
|
*/
|
|
1601
1734
|
stringGetEnclosureValueByIndex: function stringGetEnclosureValueByIndex(pString, pEnclosureIndexToGet, pEnclosureStart, pEnclosureEnd) {
|
|
1602
1735
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
@@ -1646,7 +1779,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1646
1779
|
}
|
|
1647
1780
|
};
|
|
1648
1781
|
}, {}],
|
|
1649
|
-
|
|
1782
|
+
10: [function (require, module, exports) {
|
|
1650
1783
|
/**
|
|
1651
1784
|
* @author <steven@velozo.com>
|
|
1652
1785
|
*/
|
|
@@ -1672,6 +1805,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1672
1805
|
* @class ManyfestObjectAddressSetValue
|
|
1673
1806
|
*/
|
|
1674
1807
|
var ManyfestObjectAddressSetValue = /*#__PURE__*/function () {
|
|
1808
|
+
/**
|
|
1809
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
1810
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
1811
|
+
*/
|
|
1675
1812
|
function ManyfestObjectAddressSetValue(pInfoLog, pErrorLog) {
|
|
1676
1813
|
_classCallCheck(this, ManyfestObjectAddressSetValue);
|
|
1677
1814
|
// Wire in logging
|
|
@@ -1680,7 +1817,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1680
1817
|
this.cleanWrapCharacters = fCleanWrapCharacters;
|
|
1681
1818
|
}
|
|
1682
1819
|
|
|
1683
|
-
|
|
1820
|
+
/**
|
|
1821
|
+
* Set the value of an element at an address
|
|
1822
|
+
*
|
|
1823
|
+
* @param {object} pObject - The object to set the value in
|
|
1824
|
+
* @param {string} pAddress - The address to set the value at
|
|
1825
|
+
* @param {any} pValue - The value to set at the address
|
|
1826
|
+
*
|
|
1827
|
+
* @return {boolean} True if the value was set, false otherwise
|
|
1828
|
+
*/
|
|
1684
1829
|
return _createClass(ManyfestObjectAddressSetValue, [{
|
|
1685
1830
|
key: "setValueAtAddress",
|
|
1686
1831
|
value: function setValueAtAddress(pObject, pAddress, pValue) {
|
|
@@ -1710,17 +1855,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1710
1855
|
// The "Name" of the Object contained too the left of the bracket
|
|
1711
1856
|
var tmpBoxedPropertyName = pAddress.substring(0, tmpBracketStartIndex).trim();
|
|
1712
1857
|
|
|
1858
|
+
// The "Reference" to the property within it, either an array element or object property
|
|
1859
|
+
var tmpBoxedPropertyReference = pAddress.substring(tmpBracketStartIndex + 1, tmpBracketStopIndex).trim();
|
|
1860
|
+
// Attempt to parse the reference as a number, which will be used as an array element
|
|
1861
|
+
var tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
1862
|
+
var tmpIndexIsNumeric = !isNaN(tmpBoxedPropertyNumber);
|
|
1863
|
+
if (pObject[tmpBoxedPropertyName] == null) {
|
|
1864
|
+
if (tmpIndexIsNumeric) {
|
|
1865
|
+
pObject[tmpBoxedPropertyName] = [];
|
|
1866
|
+
} else {
|
|
1867
|
+
pObject[tmpBoxedPropertyName] = {};
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1713
1871
|
// If the subproperty doesn't test as a proper Object, none of the rest of this is possible.
|
|
1714
1872
|
// This is a rare case where Arrays testing as Objects is useful
|
|
1715
1873
|
if (_typeof(pObject[tmpBoxedPropertyName]) !== 'object') {
|
|
1716
1874
|
return false;
|
|
1717
1875
|
}
|
|
1718
1876
|
|
|
1719
|
-
// The "Reference" to the property within it, either an array element or object property
|
|
1720
|
-
var tmpBoxedPropertyReference = pAddress.substring(tmpBracketStartIndex + 1, tmpBracketStopIndex).trim();
|
|
1721
|
-
// Attempt to parse the reference as a number, which will be used as an array element
|
|
1722
|
-
var tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
1723
|
-
|
|
1724
1877
|
// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
1725
1878
|
// This seems confusing to me at first read, so explaination:
|
|
1726
1879
|
// Is the Boxed Object an Array? TRUE
|
|
@@ -1738,11 +1891,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1738
1891
|
tmpBoxedPropertyReference = this.cleanWrapCharacters('"', tmpBoxedPropertyReference);
|
|
1739
1892
|
tmpBoxedPropertyReference = this.cleanWrapCharacters('`', tmpBoxedPropertyReference);
|
|
1740
1893
|
tmpBoxedPropertyReference = this.cleanWrapCharacters("'", tmpBoxedPropertyReference);
|
|
1894
|
+
if (!(tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName])) {
|
|
1895
|
+
// If the subobject doesn't exist, create it
|
|
1896
|
+
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference] = {};
|
|
1897
|
+
}
|
|
1741
1898
|
|
|
1742
1899
|
// Return the value in the property
|
|
1900
|
+
//TODO: For cases where we have chained [][] properties, this needs to recurse somehow
|
|
1743
1901
|
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference] = pValue;
|
|
1744
1902
|
return true;
|
|
1745
1903
|
} else {
|
|
1904
|
+
while (pObject[tmpBoxedPropertyName].length < tmpBoxedPropertyNumber + 1) {
|
|
1905
|
+
// If the subobject doesn't exist, create it
|
|
1906
|
+
pObject[tmpBoxedPropertyName].push({});
|
|
1907
|
+
}
|
|
1746
1908
|
pObject[tmpBoxedPropertyName][tmpBoxedPropertyNumber] = pValue;
|
|
1747
1909
|
return true;
|
|
1748
1910
|
}
|
|
@@ -1776,6 +1938,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1776
1938
|
var _tmpBoxedPropertyName8 = tmpSubObjectName.substring(0, _tmpBracketStartIndex4).trim();
|
|
1777
1939
|
var _tmpBoxedPropertyReference4 = tmpSubObjectName.substring(_tmpBracketStartIndex4 + 1, _tmpBracketStopIndex4).trim();
|
|
1778
1940
|
var _tmpBoxedPropertyNumber4 = parseInt(_tmpBoxedPropertyReference4, 10);
|
|
1941
|
+
var _tmpIndexIsNumeric = !isNaN(_tmpBoxedPropertyNumber4);
|
|
1942
|
+
|
|
1943
|
+
//if (typeof(pObject[tmpBoxedPropertyName]) !== 'object')
|
|
1944
|
+
if (pObject[_tmpBoxedPropertyName8] == null) {
|
|
1945
|
+
if (_tmpIndexIsNumeric) {
|
|
1946
|
+
pObject[_tmpBoxedPropertyName8] = [];
|
|
1947
|
+
} else {
|
|
1948
|
+
pObject[_tmpBoxedPropertyName8] = {};
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1779
1951
|
|
|
1780
1952
|
// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
1781
1953
|
// This seems confusing to me at first read, so explaination:
|
|
@@ -1791,7 +1963,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1791
1963
|
// BUT
|
|
1792
1964
|
// StudentData.Sections.Algebra.Students is an array, so the ["JaneDoe"].Grade is not possible to access
|
|
1793
1965
|
// TODO: Should this be an error or something? Should we keep a log of failures like this?
|
|
1794
|
-
if (Array.isArray(pObject[_tmpBoxedPropertyName8])
|
|
1966
|
+
if (Array.isArray(pObject[_tmpBoxedPropertyName8]) != _tmpIndexIsNumeric) {
|
|
1795
1967
|
return false;
|
|
1796
1968
|
}
|
|
1797
1969
|
|
|
@@ -1803,10 +1975,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1803
1975
|
_tmpBoxedPropertyReference4 = this.cleanWrapCharacters('"', _tmpBoxedPropertyReference4);
|
|
1804
1976
|
_tmpBoxedPropertyReference4 = this.cleanWrapCharacters('`', _tmpBoxedPropertyReference4);
|
|
1805
1977
|
_tmpBoxedPropertyReference4 = this.cleanWrapCharacters("'", _tmpBoxedPropertyReference4);
|
|
1978
|
+
if (!(_tmpBoxedPropertyReference4 in pObject[_tmpBoxedPropertyName8])) {
|
|
1979
|
+
// If the subobject doesn't exist, create it
|
|
1980
|
+
pObject[_tmpBoxedPropertyName8][_tmpBoxedPropertyReference4] = {};
|
|
1981
|
+
}
|
|
1806
1982
|
|
|
1807
1983
|
// Recurse directly into the subobject
|
|
1808
1984
|
return this.setValueAtAddress(pObject[_tmpBoxedPropertyName8][_tmpBoxedPropertyReference4], tmpNewAddress, pValue);
|
|
1809
1985
|
} else {
|
|
1986
|
+
while (pObject[_tmpBoxedPropertyName8].length < _tmpBoxedPropertyNumber4 + 1) {
|
|
1987
|
+
// If the subobject doesn't exist, create it
|
|
1988
|
+
pObject[_tmpBoxedPropertyName8].push({});
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1810
1991
|
// We parsed a valid number out of the boxed property name, so recurse into the array
|
|
1811
1992
|
return this.setValueAtAddress(pObject[_tmpBoxedPropertyName8][_tmpBoxedPropertyNumber4], tmpNewAddress, pValue);
|
|
1812
1993
|
}
|
|
@@ -1834,10 +2015,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1834
2015
|
;
|
|
1835
2016
|
module.exports = ManyfestObjectAddressSetValue;
|
|
1836
2017
|
}, {
|
|
1837
|
-
"./Manyfest-CleanWrapCharacters.js":
|
|
1838
|
-
"./Manyfest-LogToConsole.js":
|
|
2018
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
2019
|
+
"./Manyfest-LogToConsole.js": 5
|
|
1839
2020
|
}],
|
|
1840
|
-
|
|
2021
|
+
11: [function (require, module, exports) {
|
|
1841
2022
|
/**
|
|
1842
2023
|
* @author <steven@velozo.com>
|
|
1843
2024
|
*/
|
|
@@ -1866,6 +2047,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1866
2047
|
* @class ManyfestObjectAddressGeneration
|
|
1867
2048
|
*/
|
|
1868
2049
|
var ManyfestObjectAddressGeneration = /*#__PURE__*/function () {
|
|
2050
|
+
/**
|
|
2051
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
2052
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
2053
|
+
*/
|
|
1869
2054
|
function ManyfestObjectAddressGeneration(pInfoLog, pErrorLog) {
|
|
1870
2055
|
_classCallCheck(this, ManyfestObjectAddressGeneration);
|
|
1871
2056
|
// Wire in logging
|
|
@@ -1873,15 +2058,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1873
2058
|
this.logError = typeof pErrorLog == 'function' ? pErrorLog : libSimpleLog;
|
|
1874
2059
|
}
|
|
1875
2060
|
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2061
|
+
/**
|
|
2062
|
+
* generateAddressses
|
|
2063
|
+
*
|
|
2064
|
+
* This flattens an object into a set of key:value pairs for *EVERY SINGLE
|
|
2065
|
+
* POSSIBLE ADDRESS* in the object. It can get ... really insane really
|
|
2066
|
+
* quickly. This is not meant to be used directly to generate schemas, but
|
|
2067
|
+
* instead as a starting point for scripts or UIs.
|
|
2068
|
+
*
|
|
2069
|
+
* This will return a mega set of key:value pairs with all possible schema
|
|
2070
|
+
* permutations and default values (when not an object) and everything else.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {any} pObject - The object to generate addresses for
|
|
2073
|
+
* @param {string} [pBaseAddress] - (optional) The base address to start from
|
|
2074
|
+
* @param {object} [pSchema] - (optional) The schema object to append to
|
|
2075
|
+
*
|
|
2076
|
+
* @return {object} The generated schema object
|
|
2077
|
+
*/
|
|
1885
2078
|
return _createClass(ManyfestObjectAddressGeneration, [{
|
|
1886
2079
|
key: "generateAddressses",
|
|
1887
2080
|
value: function generateAddressses(pObject, pBaseAddress, pSchema) {
|
|
@@ -1896,7 +2089,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1896
2089
|
InSchema: false
|
|
1897
2090
|
};
|
|
1898
2091
|
if (tmpObjectType == 'object' && pObject == null) {
|
|
1899
|
-
tmpObjectType = '
|
|
2092
|
+
tmpObjectType = 'undefined';
|
|
1900
2093
|
}
|
|
1901
2094
|
switch (tmpObjectType) {
|
|
1902
2095
|
case 'string':
|
|
@@ -1911,7 +2104,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1911
2104
|
tmpSchema[tmpBaseAddress] = tmpSchemaObjectEntry;
|
|
1912
2105
|
break;
|
|
1913
2106
|
case 'undefined':
|
|
1914
|
-
case 'null':
|
|
1915
2107
|
tmpSchemaObjectEntry.DataType = 'Any';
|
|
1916
2108
|
tmpSchemaObjectEntry.Default = pObject;
|
|
1917
2109
|
tmpSchema[tmpBaseAddress] = tmpSchemaObjectEntry;
|
|
@@ -1949,9 +2141,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1949
2141
|
;
|
|
1950
2142
|
module.exports = ManyfestObjectAddressGeneration;
|
|
1951
2143
|
}, {
|
|
1952
|
-
"./Manyfest-LogToConsole.js":
|
|
2144
|
+
"./Manyfest-LogToConsole.js": 5
|
|
1953
2145
|
}],
|
|
1954
|
-
|
|
2146
|
+
12: [function (require, module, exports) {
|
|
1955
2147
|
// Given a string, parse out any conditional expressions and set whether or not to keep the record.
|
|
1956
2148
|
//
|
|
1957
2149
|
// For instance:
|
|
@@ -2085,7 +2277,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2085
2277
|
};
|
|
2086
2278
|
module.exports = parseConditionals;
|
|
2087
2279
|
}, {}],
|
|
2088
|
-
|
|
2280
|
+
13: [function (require, module, exports) {
|
|
2089
2281
|
/**
|
|
2090
2282
|
* @author <steven@velozo.com>
|
|
2091
2283
|
*/
|
|
@@ -2097,6 +2289,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2097
2289
|
* @class ManyfestSchemaManipulation
|
|
2098
2290
|
*/
|
|
2099
2291
|
var ManyfestSchemaManipulation = /*#__PURE__*/function () {
|
|
2292
|
+
/**
|
|
2293
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
2294
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
2295
|
+
*/
|
|
2100
2296
|
function ManyfestSchemaManipulation(pInfoLog, pErrorLog) {
|
|
2101
2297
|
_classCallCheck(this, ManyfestSchemaManipulation);
|
|
2102
2298
|
// Wire in logging
|
|
@@ -2104,24 +2300,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2104
2300
|
this.logError = typeof pErrorLog === 'function' ? pErrorLog : libSimpleLog;
|
|
2105
2301
|
}
|
|
2106
2302
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2303
|
+
/**
|
|
2304
|
+
* This translates the default address mappings to something different.
|
|
2305
|
+
*
|
|
2306
|
+
* For instance you can pass in manyfest schema descriptor object:
|
|
2307
|
+
* {
|
|
2308
|
+
* "Address.Of.a": { "Hash": "a", "Type": "Number" },
|
|
2309
|
+
* "Address.Of.b": { "Hash": "b", "Type": "Number" }
|
|
2310
|
+
* }
|
|
2311
|
+
*
|
|
2312
|
+
*
|
|
2313
|
+
* And then an address mapping (basically a Hash->Address map)
|
|
2314
|
+
* {
|
|
2315
|
+
* "a": "New.Address.Of.a",
|
|
2316
|
+
* "b": "New.Address.Of.b"
|
|
2317
|
+
* }
|
|
2318
|
+
*
|
|
2319
|
+
* NOTE: This mutates the schema object permanently, altering the base hash.
|
|
2320
|
+
* If there is a collision with an existing address, it can lead to overwrites.
|
|
2321
|
+
* TODO: Discuss what should happen on collisions.
|
|
2322
|
+
*
|
|
2323
|
+
* @param {object} pManyfestSchemaDescriptors - The manyfest schema descriptors to resolve address mappings for
|
|
2324
|
+
* @param {object} pAddressMapping - The address mapping object to use for remapping
|
|
2325
|
+
*
|
|
2326
|
+
* @return {boolean} True if successful, false if there was an error
|
|
2327
|
+
*/
|
|
2125
2328
|
return _createClass(ManyfestSchemaManipulation, [{
|
|
2126
2329
|
key: "resolveAddressMappings",
|
|
2127
2330
|
value: function resolveAddressMappings(pManyfestSchemaDescriptors, pAddressMapping) {
|
|
@@ -2145,8 +2348,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2145
2348
|
var tmpAddressMappingSet = Object.keys(pAddressMapping);
|
|
2146
2349
|
tmpAddressMappingSet.forEach(function (pInputAddress) {
|
|
2147
2350
|
var tmpNewDescriptorAddress = pAddressMapping[pInputAddress];
|
|
2148
|
-
var tmpOldDescriptorAddress =
|
|
2149
|
-
var tmpDescriptor
|
|
2351
|
+
var tmpOldDescriptorAddress = null;
|
|
2352
|
+
var tmpDescriptor;
|
|
2150
2353
|
|
|
2151
2354
|
// See if there is a matching descriptor either by Address directly or Hash
|
|
2152
2355
|
if (pInputAddress in pManyfestSchemaDescriptors) {
|
|
@@ -2171,6 +2374,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2171
2374
|
});
|
|
2172
2375
|
return true;
|
|
2173
2376
|
}
|
|
2377
|
+
|
|
2378
|
+
/**
|
|
2379
|
+
* @param {object} pManyfestSchemaDescriptors - The manyfest schema descriptors to resolve address mappings for
|
|
2380
|
+
* @param {object} pAddressMapping - The address mapping object to use for remapping
|
|
2381
|
+
*
|
|
2382
|
+
* @return {object} A new object containing the remapped schema descriptors
|
|
2383
|
+
*/
|
|
2174
2384
|
}, {
|
|
2175
2385
|
key: "safeResolveAddressMappings",
|
|
2176
2386
|
value: function safeResolveAddressMappings(pManyfestSchemaDescriptors, pAddressMapping) {
|
|
@@ -2179,6 +2389,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2179
2389
|
this.resolveAddressMappings(tmpManyfestSchemaDescriptors, pAddressMapping);
|
|
2180
2390
|
return tmpManyfestSchemaDescriptors;
|
|
2181
2391
|
}
|
|
2392
|
+
|
|
2393
|
+
/**
|
|
2394
|
+
* @param {object} pManyfestSchemaDescriptorsDestination - The destination manyfest schema descriptors
|
|
2395
|
+
* @param {object} pManyfestSchemaDescriptorsSource - The source manyfest schema descriptors
|
|
2396
|
+
*
|
|
2397
|
+
* @return {object} A new object containing the merged schema descriptors
|
|
2398
|
+
*/
|
|
2182
2399
|
}, {
|
|
2183
2400
|
key: "mergeAddressMappings",
|
|
2184
2401
|
value: function mergeAddressMappings(pManyfestSchemaDescriptorsDestination, pManyfestSchemaDescriptorsSource) {
|
|
@@ -2202,9 +2419,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2202
2419
|
}();
|
|
2203
2420
|
module.exports = ManyfestSchemaManipulation;
|
|
2204
2421
|
}, {
|
|
2205
|
-
"./Manyfest-LogToConsole.js":
|
|
2422
|
+
"./Manyfest-LogToConsole.js": 5
|
|
2206
2423
|
}],
|
|
2207
|
-
|
|
2424
|
+
14: [function (require, module, exports) {
|
|
2208
2425
|
/**
|
|
2209
2426
|
* @author <steven@velozo.com>
|
|
2210
2427
|
*/
|
|
@@ -2222,6 +2439,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2222
2439
|
Descriptors: {}
|
|
2223
2440
|
};
|
|
2224
2441
|
|
|
2442
|
+
/**
|
|
2443
|
+
* @typedef {{
|
|
2444
|
+
* Hash?: string,
|
|
2445
|
+
* Name?: string,
|
|
2446
|
+
* DataType?: string,
|
|
2447
|
+
* Required?: boolean,
|
|
2448
|
+
* Address?: string,
|
|
2449
|
+
* Description?: string,
|
|
2450
|
+
* [key: string]: any,
|
|
2451
|
+
* }} ManifestDescriptor
|
|
2452
|
+
*/
|
|
2453
|
+
|
|
2225
2454
|
/**
|
|
2226
2455
|
* Manyfest object address-based descriptions and manipulations.
|
|
2227
2456
|
*
|
|
@@ -2236,6 +2465,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2236
2465
|
} else {
|
|
2237
2466
|
_this3 = _callSuper(this, Manyfest, [pFable, pManifest, pServiceHash]);
|
|
2238
2467
|
}
|
|
2468
|
+
|
|
2469
|
+
/** @type {import('fable')} */
|
|
2470
|
+
_this3.fable;
|
|
2471
|
+
/** @type {Record<string, any>} */
|
|
2472
|
+
_this3.options;
|
|
2473
|
+
/** @type {string} */
|
|
2474
|
+
_this3.Hash;
|
|
2475
|
+
/** @type {string} */
|
|
2476
|
+
_this3.UUID;
|
|
2239
2477
|
_this3.serviceType = 'Manifest';
|
|
2240
2478
|
|
|
2241
2479
|
// Wire in logging
|
|
@@ -2265,9 +2503,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2265
2503
|
if (!('strict' in _this3.options)) {
|
|
2266
2504
|
_this3.options.strict = false;
|
|
2267
2505
|
}
|
|
2506
|
+
|
|
2507
|
+
/** @type {string} */
|
|
2268
2508
|
_this3.scope = undefined;
|
|
2509
|
+
/** @type {Array<string>} */
|
|
2269
2510
|
_this3.elementAddresses = undefined;
|
|
2511
|
+
/** @type {Record<string, string>} */
|
|
2270
2512
|
_this3.elementHashes = undefined;
|
|
2513
|
+
/** @type {Record<string, ManifestDescriptor>} */
|
|
2271
2514
|
_this3.elementDescriptors = undefined;
|
|
2272
2515
|
_this3.reset();
|
|
2273
2516
|
if (_typeof(_this3.options) === 'object') {
|
|
@@ -2299,7 +2542,26 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2299
2542
|
value: function clone() {
|
|
2300
2543
|
// Make a copy of the options in-place
|
|
2301
2544
|
var tmpNewOptions = JSON.parse(JSON.stringify(this.options));
|
|
2302
|
-
var tmpNewManyfest = new Manyfest(this.
|
|
2545
|
+
var tmpNewManyfest = new Manyfest(this.fable, tmpNewOptions, this.Hash);
|
|
2546
|
+
tmpNewManyfest.logInfo = this.logInfo;
|
|
2547
|
+
tmpNewManyfest.logError = this.logError;
|
|
2548
|
+
//FIXME: mostly written by co-pilot
|
|
2549
|
+
var _this$getManifest = this.getManifest(),
|
|
2550
|
+
Scope = _this$getManifest.Scope,
|
|
2551
|
+
Descriptors = _this$getManifest.Descriptors,
|
|
2552
|
+
HashTranslations = _this$getManifest.HashTranslations;
|
|
2553
|
+
tmpNewManyfest.scope = Scope;
|
|
2554
|
+
tmpNewManyfest.elementDescriptors = Descriptors;
|
|
2555
|
+
tmpNewManyfest.elementAddresses = Object.keys(Descriptors);
|
|
2556
|
+
// Rebuild the element hashes
|
|
2557
|
+
for (var i = 0; i < tmpNewManyfest.elementAddresses.length; i++) {
|
|
2558
|
+
var tmpAddress = tmpNewManyfest.elementAddresses[i];
|
|
2559
|
+
var tmpDescriptor = tmpNewManyfest.elementDescriptors[tmpAddress];
|
|
2560
|
+
tmpNewManyfest.elementHashes[tmpAddress] = tmpAddress;
|
|
2561
|
+
if ('Hash' in tmpDescriptor) {
|
|
2562
|
+
tmpNewManyfest.elementHashes[tmpDescriptor.Hash] = tmpAddress;
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2303
2565
|
|
|
2304
2566
|
// Import the hash translations
|
|
2305
2567
|
tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);
|
|
@@ -2307,11 +2569,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2307
2569
|
}
|
|
2308
2570
|
|
|
2309
2571
|
// Deserialize a Manifest from a string
|
|
2572
|
+
/**
|
|
2573
|
+
* @param {string} pManifestString - The manifest string to deserialize
|
|
2574
|
+
*
|
|
2575
|
+
* @return {Manyfest} The deserialized manifest
|
|
2576
|
+
*/
|
|
2310
2577
|
}, {
|
|
2311
2578
|
key: "deserialize",
|
|
2312
2579
|
value: function deserialize(pManifestString) {
|
|
2313
2580
|
// TODO: Add guards for bad manifest string
|
|
2314
|
-
|
|
2581
|
+
this.loadManifest(JSON.parse(pManifestString));
|
|
2582
|
+
return this;
|
|
2315
2583
|
}
|
|
2316
2584
|
|
|
2317
2585
|
// Load a manifest from an object
|
|
@@ -2351,19 +2619,28 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2351
2619
|
}
|
|
2352
2620
|
if ('HashTranslations' in tmpManifest) {
|
|
2353
2621
|
if (_typeof(tmpManifest.HashTranslations) === 'object') {
|
|
2354
|
-
for (var
|
|
2355
|
-
// Each translation is
|
|
2622
|
+
for (var _i0 = 0; _i0 < tmpManifest.HashTranslations.length; _i0++) {
|
|
2623
|
+
// Each translation is
|
|
2624
|
+
//FIXME: ?????????
|
|
2356
2625
|
}
|
|
2357
2626
|
}
|
|
2358
2627
|
}
|
|
2359
2628
|
}
|
|
2360
2629
|
|
|
2361
|
-
|
|
2630
|
+
/**
|
|
2631
|
+
* Serialize the Manifest to a string
|
|
2632
|
+
*
|
|
2633
|
+
* @return {string} - The serialized manifest
|
|
2634
|
+
*/
|
|
2362
2635
|
}, {
|
|
2363
2636
|
key: "serialize",
|
|
2364
2637
|
value: function serialize() {
|
|
2365
2638
|
return JSON.stringify(this.getManifest());
|
|
2366
2639
|
}
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* @return {{ Scope: string, Descriptors: Record<string, ManifestDescriptor>, HashTranslations: Record<string, string> }} - A copy of the manifest state.
|
|
2643
|
+
*/
|
|
2367
2644
|
}, {
|
|
2368
2645
|
key: "getManifest",
|
|
2369
2646
|
value: function getManifest() {
|
|
@@ -2374,7 +2651,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2374
2651
|
};
|
|
2375
2652
|
}
|
|
2376
2653
|
|
|
2377
|
-
|
|
2654
|
+
/**
|
|
2655
|
+
* Add a descriptor to the manifest
|
|
2656
|
+
*
|
|
2657
|
+
* @param {string} pAddress - The address of the element to add the descriptor for.
|
|
2658
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor object to add.
|
|
2659
|
+
*/
|
|
2378
2660
|
}, {
|
|
2379
2661
|
key: "addDescriptor",
|
|
2380
2662
|
value: function addDescriptor(pAddress, pDescriptor) {
|
|
@@ -2405,18 +2687,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2405
2687
|
return false;
|
|
2406
2688
|
}
|
|
2407
2689
|
}
|
|
2690
|
+
|
|
2691
|
+
/**
|
|
2692
|
+
* @param {string} pHash - The hash of the address to resolve.
|
|
2693
|
+
*
|
|
2694
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
2695
|
+
*/
|
|
2408
2696
|
}, {
|
|
2409
2697
|
key: "getDescriptorByHash",
|
|
2410
2698
|
value: function getDescriptorByHash(pHash) {
|
|
2411
2699
|
return this.getDescriptor(this.resolveHashAddress(pHash));
|
|
2412
2700
|
}
|
|
2701
|
+
|
|
2702
|
+
/**
|
|
2703
|
+
* @param {string} pAddress - The address of the element to get the descriptor for.
|
|
2704
|
+
*
|
|
2705
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
2706
|
+
*/
|
|
2413
2707
|
}, {
|
|
2414
2708
|
key: "getDescriptor",
|
|
2415
2709
|
value: function getDescriptor(pAddress) {
|
|
2416
2710
|
return this.elementDescriptors[pAddress];
|
|
2417
2711
|
}
|
|
2418
2712
|
|
|
2419
|
-
|
|
2713
|
+
/**
|
|
2714
|
+
* execute an action function for each descriptor
|
|
2715
|
+
* @param {(d: ManifestDescriptor) => void} fAction - The action function to execute for each descriptor.
|
|
2716
|
+
*/
|
|
2420
2717
|
}, {
|
|
2421
2718
|
key: "eachDescriptor",
|
|
2422
2719
|
value: function eachDescriptor(fAction) {
|
|
@@ -2448,8 +2745,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2448
2745
|
key: "resolveHashAddress",
|
|
2449
2746
|
value: function resolveHashAddress(pHash) {
|
|
2450
2747
|
var tmpAddress = undefined;
|
|
2451
|
-
var tmpInElementHashTable =
|
|
2452
|
-
var tmpInTranslationTable =
|
|
2748
|
+
var tmpInElementHashTable = pHash in this.elementHashes;
|
|
2749
|
+
var tmpInTranslationTable = pHash in this.hashTranslations.translationTable;
|
|
2453
2750
|
|
|
2454
2751
|
// The most straightforward: the hash exists, no translations.
|
|
2455
2752
|
if (tmpInElementHashTable && !tmpInTranslationTable) {
|
|
@@ -2482,20 +2779,32 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2482
2779
|
}
|
|
2483
2780
|
return tmpValue;
|
|
2484
2781
|
}
|
|
2782
|
+
}, {
|
|
2783
|
+
key: "lintAddress",
|
|
2784
|
+
value: function lintAddress(pAddress) {
|
|
2785
|
+
var tmpLintedAddress = pAddress.trim();
|
|
2786
|
+
// Check for a single . (but not a ..) at the end of the address and remove it.
|
|
2787
|
+
if (tmpLintedAddress.endsWith('..')) {
|
|
2788
|
+
tmpLintedAddress = tmpLintedAddress.slice(0, -1);
|
|
2789
|
+
} else if (tmpLintedAddress.endsWith('.')) {
|
|
2790
|
+
tmpLintedAddress = tmpLintedAddress.slice(0, -1);
|
|
2791
|
+
}
|
|
2792
|
+
return tmpLintedAddress;
|
|
2793
|
+
}
|
|
2485
2794
|
|
|
2486
2795
|
// Get the value of an element at an address
|
|
2487
2796
|
}, {
|
|
2488
2797
|
key: "getValueAtAddress",
|
|
2489
2798
|
value: function getValueAtAddress(pObject, pAddress) {
|
|
2490
|
-
var tmpLintedAddress =
|
|
2799
|
+
var tmpLintedAddress = this.lintAddress(pAddress);
|
|
2491
2800
|
if (tmpLintedAddress == '') {
|
|
2492
2801
|
this.logError("(".concat(this.scope, ") Error getting value at address; address is an empty string."), pObject);
|
|
2493
2802
|
return undefined;
|
|
2494
2803
|
}
|
|
2495
|
-
var tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject,
|
|
2804
|
+
var tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject, tmpLintedAddress);
|
|
2496
2805
|
if (typeof tmpValue == 'undefined') {
|
|
2497
2806
|
// Try to get a default if it exists
|
|
2498
|
-
tmpValue = this.getDefaultValue(this.getDescriptor(
|
|
2807
|
+
tmpValue = this.getDefaultValue(this.getDescriptor(tmpLintedAddress));
|
|
2499
2808
|
}
|
|
2500
2809
|
return tmpValue;
|
|
2501
2810
|
}
|
|
@@ -2511,7 +2820,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2511
2820
|
}, {
|
|
2512
2821
|
key: "setValueAtAddress",
|
|
2513
2822
|
value: function setValueAtAddress(pObject, pAddress, pValue) {
|
|
2514
|
-
|
|
2823
|
+
var tmpLintedAddress = this.lintAddress(pAddress);
|
|
2824
|
+
return this.objectAddressSetValue.setValueAtAddress(pObject, tmpLintedAddress, pValue);
|
|
2515
2825
|
}
|
|
2516
2826
|
|
|
2517
2827
|
// Delete the value of an element by its hash
|
|
@@ -2525,7 +2835,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2525
2835
|
}, {
|
|
2526
2836
|
key: "deleteValueAtAddress",
|
|
2527
2837
|
value: function deleteValueAtAddress(pObject, pAddress, pValue) {
|
|
2528
|
-
|
|
2838
|
+
var tmpLintedAddress = this.lintAddress(pAddress);
|
|
2839
|
+
return this.objectAddressDeleteValue.deleteValueAtAddress(pObject, tmpLintedAddress, pValue);
|
|
2529
2840
|
}
|
|
2530
2841
|
|
|
2531
2842
|
// Validate the consistency of an object against the schema
|
|
@@ -2615,7 +2926,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2615
2926
|
return tmpValidationData;
|
|
2616
2927
|
}
|
|
2617
2928
|
|
|
2618
|
-
|
|
2929
|
+
/**
|
|
2930
|
+
* Returns a default value, or, the default value for the data type (which is overridable with configuration)
|
|
2931
|
+
*
|
|
2932
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor definition.
|
|
2933
|
+
*/
|
|
2619
2934
|
}, {
|
|
2620
2935
|
key: "getDefaultValue",
|
|
2621
2936
|
value: function getDefaultValue(pDescriptor) {
|
|
@@ -2680,15 +2995,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2680
2995
|
;
|
|
2681
2996
|
module.exports = Manyfest;
|
|
2682
2997
|
}, {
|
|
2683
|
-
"./Manyfest-HashTranslation.js":
|
|
2684
|
-
"./Manyfest-LogToConsole.js":
|
|
2685
|
-
"./Manyfest-ObjectAddress-CheckAddressExists.js":
|
|
2686
|
-
"./Manyfest-ObjectAddress-DeleteValue.js":
|
|
2687
|
-
"./Manyfest-ObjectAddress-GetValue.js":
|
|
2688
|
-
"./Manyfest-ObjectAddress-SetValue.js":
|
|
2689
|
-
"./Manyfest-ObjectAddressGeneration.js":
|
|
2690
|
-
"./Manyfest-SchemaManipulation.js":
|
|
2691
|
-
"fable-serviceproviderbase":
|
|
2998
|
+
"./Manyfest-HashTranslation.js": 4,
|
|
2999
|
+
"./Manyfest-LogToConsole.js": 5,
|
|
3000
|
+
"./Manyfest-ObjectAddress-CheckAddressExists.js": 6,
|
|
3001
|
+
"./Manyfest-ObjectAddress-DeleteValue.js": 7,
|
|
3002
|
+
"./Manyfest-ObjectAddress-GetValue.js": 8,
|
|
3003
|
+
"./Manyfest-ObjectAddress-SetValue.js": 10,
|
|
3004
|
+
"./Manyfest-ObjectAddressGeneration.js": 11,
|
|
3005
|
+
"./Manyfest-SchemaManipulation.js": 13,
|
|
3006
|
+
"fable-serviceproviderbase": 2
|
|
2692
3007
|
}]
|
|
2693
|
-
}, {}, [
|
|
2694
|
-
});
|
|
3008
|
+
}, {}, [14])(14);
|
|
3009
|
+
});
|
|
3010
|
+
//# sourceMappingURL=manyfest.compatible.js.map
|