manyfest 1.0.31 → 1.0.33

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.
@@ -206,7 +206,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
206
206
  }, {
207
207
  key: "removeTranslationHash",
208
208
  value: function removeTranslationHash(pTranslationHash) {
209
- if (this.translationTable.hasOwnProperty(pTranslationHash)) {
209
+ if (pTranslationHash in this.translationTable) {
210
210
  delete this.translationTable[pTranslationHash];
211
211
  }
212
212
  }
@@ -240,7 +240,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
240
240
  }, {
241
241
  key: "translate",
242
242
  value: function translate(pTranslation) {
243
- if (this.translationTable.hasOwnProperty(pTranslation)) {
243
+ if (pTranslation in this.translationTable) {
244
244
  return this.translationTable[pTranslation];
245
245
  } else {
246
246
  return pTranslation;
@@ -273,6 +273,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
273
273
  * @author <steven@velozo.com>
274
274
  */
275
275
  var libSimpleLog = require('./Manyfest-LogToConsole.js');
276
+ // This is for resolving functions mid-address
277
+ var libGetObjectValue = require('./Manyfest-ObjectAddress-GetValue.js');
278
+
279
+ // TODO: Just until this is a fable service.
280
+ var _MockFable = {
281
+ DataFormat: require('./Manyfest-ObjectAddress-Parser.js')
282
+ };
276
283
 
277
284
  /**
278
285
  * Object Address Resolver
@@ -295,6 +302,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
295
302
  var ManyfestObjectAddressResolverCheckAddressExists = /*#__PURE__*/function () {
296
303
  function ManyfestObjectAddressResolverCheckAddressExists() {
297
304
  _classCallCheck(this, ManyfestObjectAddressResolverCheckAddressExists);
305
+ this.getObjectValueClass = new libGetObjectValue(libSimpleLog, libSimpleLog);
298
306
  }
299
307
 
300
308
  // Check if an address exists.
@@ -305,21 +313,52 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
305
313
  // existance and returns true or false dependent.
306
314
  return _createClass(ManyfestObjectAddressResolverCheckAddressExists, [{
307
315
  key: "checkAddressExists",
308
- value: function checkAddressExists(pObject, pAddress) {
316
+ value: function checkAddressExists(pObject, pAddress, pRootObject) {
309
317
  // TODO: Should these throw an error?
310
318
  // Make sure pObject is an object
311
319
  if (_typeof(pObject) != 'object') return false;
312
320
  // Make sure pAddress is a string
313
321
  if (typeof pAddress != 'string') return false;
314
322
 
315
- // TODO: Make this work for things like SomeRootObject.Metadata["Some.People.Use.Bad.Object.Property.Names"]
316
- var tmpSeparatorIndex = pAddress.indexOf('.');
323
+ // Set the root object to the passed-in object if it isn't set yet. This is expected to be the root object.
324
+ // NOTE: This was added to support functions mid-stream
325
+ var tmpRootObject = typeof pRootObject == 'undefined' ? pObject : pRootObject;
326
+
327
+ // DONE: Make this work for things like SomeRootObject.Metadata["Some.People.Use.Bad.Object.Property.Names"]
328
+ var tmpAddressPartBeginning = _MockFable.DataFormat.stringGetFirstSegment(pAddress);
317
329
 
318
330
  // This is the terminal address string (no more dots so the RECUSION ENDS IN HERE somehow)
319
- if (tmpSeparatorIndex == -1) {
331
+ if (tmpAddressPartBeginning.length == pAddress.length) {
320
332
  // Check if the address refers to a boxed property
321
333
  var tmpBracketStartIndex = pAddress.indexOf('[');
322
334
  var tmpBracketStopIndex = pAddress.indexOf(']');
335
+
336
+ // Check if there is a function somewhere in the address... parenthesis start should only be in a function
337
+ var tmpFunctionStartIndex = pAddress.indexOf('(');
338
+
339
+ // NOTE THAT FUNCTIONS MUST RESOLVE FIRST
340
+ // Functions look like this
341
+ // MyFunction()
342
+ // MyFunction(Some.Address)
343
+ // MyFunction(Some.Address,Some.Other.Address)
344
+ // MyFunction(Some.Address,Some.Other.Address,Some.Third.Address)
345
+ //
346
+ // This could be enhanced to allow purely numeric and string values to be passed to the function. For now,
347
+ // To heck with that. This is a simple function call.
348
+ //
349
+ // The requirements to detect a function are:
350
+ // 1) The start bracket is after character 0
351
+ if (tmpFunctionStartIndex > 0
352
+ // 2) The end bracket is after the start bracket
353
+ && _MockFable.DataFormat.stringCountEnclosures(pAddress) > 0) {
354
+ var tmpFunctionAddress = pAddress.substring(0, tmpFunctionStartIndex).trim();
355
+ if (tmpFunctionAddress in pObject && typeof pObject[tmpFunctionAddress] == 'function') {
356
+ return true;
357
+ } else {
358
+ // The address suggests it is a function, but it is not.
359
+ return false;
360
+ }
361
+ }
323
362
  // Boxed elements look like this:
324
363
  // MyValues[10]
325
364
  // MyValues['Name']
@@ -329,7 +368,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
329
368
  // When we are passed SomeObject["Name"] this code below recurses as if it were SomeObject.Name
330
369
  // The requirements to detect a boxed element are:
331
370
  // 1) The start bracket is after character 0
332
- if (tmpBracketStartIndex > 0
371
+ else if (tmpBracketStartIndex > 0
333
372
  // 2) The end bracket has something between them
334
373
  && tmpBracketStopIndex > tmpBracketStartIndex
335
374
  // 3) There is data
@@ -367,23 +406,69 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
367
406
  tmpBoxedPropertyReference = this.cleanWrapCharacters("'", tmpBoxedPropertyReference);
368
407
 
369
408
  // Check if the property exists.
370
- return pObject[tmpBoxedPropertyName].hasOwnProperty(tmpBoxedPropertyReference);
409
+ return tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName];
371
410
  } else {
372
411
  // Use the new in operator to see if the element is in the array
373
412
  return tmpBoxedPropertyNumber in pObject[tmpBoxedPropertyName];
374
413
  }
375
414
  } else {
376
415
  // Check if the property exists
377
- return pObject.hasOwnProperty(pAddress);
416
+ return pAddress in pObject;
378
417
  }
379
418
  } else {
380
- var tmpSubObjectName = pAddress.substring(0, tmpSeparatorIndex);
381
- var tmpNewAddress = pAddress.substring(tmpSeparatorIndex + 1);
419
+ var tmpSubObjectName = tmpAddressPartBeginning;
420
+ var tmpNewAddress = pAddress.substring(tmpAddressPartBeginning.length + 1);
382
421
 
383
422
  // Test if the tmpNewAddress is an array or object
384
423
  // Check if it's a boxed property
385
424
  var _tmpBracketStartIndex = tmpSubObjectName.indexOf('[');
386
425
  var _tmpBracketStopIndex = tmpSubObjectName.indexOf(']');
426
+
427
+ // Check if there is a function somewhere in the address... parenthesis start should only be in a function
428
+ var _tmpFunctionStartIndex = tmpSubObjectName.indexOf('(');
429
+
430
+ // NOTE THAT FUNCTIONS MUST RESOLVE FIRST
431
+ // Functions look like this
432
+ // MyFunction()
433
+ // MyFunction(Some.Address)
434
+ // MyFunction(Some.Address,Some.Other.Address)
435
+ // MyFunction(Some.Address,Some.Other.Address,Some.Third.Address)
436
+ //
437
+ // This could be enhanced to allow purely numeric and string values to be passed to the function. For now,
438
+ // To heck with that. This is a simple function call.
439
+ //
440
+ // The requirements to detect a function are:
441
+ // 1) The start bracket is after character 0
442
+ if (_tmpFunctionStartIndex > 0
443
+ // 2) The end bracket is after the start bracket
444
+ && _MockFable.DataFormat.stringCountEnclosures(tmpSubObjectName) > 0) {
445
+ var _tmpFunctionAddress = tmpSubObjectName.substring(0, _tmpFunctionStartIndex).trim();
446
+ //tmpParentAddress = `${tmpParentAddress}${(tmpParentAddress.length > 0) ? '.' : ''}${tmpSubObjectName}`;
447
+
448
+ if (!_typeof(pObject[_tmpFunctionAddress]) == 'function') {
449
+ // The address suggests it is a function, but it is not.
450
+ return false;
451
+ }
452
+
453
+ // Now see if the function has arguments.
454
+ // Implementation notes: * ARGUMENTS MUST SHARE THE SAME ROOT OBJECT CONTEXT *
455
+ var tmpFunctionArguments = _MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(tmpSubObjectName.substring(_tmpFunctionAddress.length), 0), ',');
456
+ if (tmpFunctionArguments.length == 0 || tmpFunctionArguments[0] == '') {
457
+ // No arguments... just call the function (bound to the scope of the object it is contained withing)
458
+ return this.checkAddressExists(pObject[_tmpFunctionAddress].apply(pObject), tmpNewAddress, tmpRootObject);
459
+ } else {
460
+ var tmpArgumentValues = [];
461
+ var _tmpRootObject = typeof pRootObject == 'undefined' ? pObject : pRootObject;
462
+
463
+ // Now get the value for each argument
464
+ for (var i = 0; i < tmpFunctionArguments.length; i++) {
465
+ // Resolve the values for each subsequent entry
466
+ // NOTE: This is where the resolves get really tricky. Recursion within recursion. Programming gom jabbar, yo.
467
+ tmpArgumentValues.push(this.getObjectValueClass.getValueAtAddress(_tmpRootObject, tmpFunctionArguments[i]));
468
+ }
469
+ return this.checkAddressExists(pObject[_tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, _tmpRootObject);
470
+ }
471
+ }
387
472
  // Boxed elements look like this:
388
473
  // MyValues[42]
389
474
  // MyValues['Color']
@@ -393,7 +478,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
393
478
  // When we are passed SomeObject["Name"] this code below recurses as if it were SomeObject.Name
394
479
  // The requirements to detect a boxed element are:
395
480
  // 1) The start bracket is after character 0
396
- if (_tmpBracketStartIndex > 0
481
+ else if (_tmpBracketStartIndex > 0
397
482
  // 2) The end bracket has something between them
398
483
  && _tmpBracketStopIndex > _tmpBracketStartIndex
399
484
  // 3) There is data
@@ -432,24 +517,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
432
517
  _tmpBoxedPropertyReference = this.cleanWrapCharacters("'", _tmpBoxedPropertyReference);
433
518
 
434
519
  // Recurse directly into the subobject
435
- return this.checkAddressExists(pObject[_tmpBoxedPropertyName][_tmpBoxedPropertyReference], tmpNewAddress);
520
+ return this.checkAddressExists(pObject[_tmpBoxedPropertyName][_tmpBoxedPropertyReference], tmpNewAddress, tmpRootObject);
436
521
  } else {
437
522
  // We parsed a valid number out of the boxed property name, so recurse into the array
438
- return this.checkAddressExists(pObject[_tmpBoxedPropertyName][_tmpBoxedPropertyNumber], tmpNewAddress);
523
+ return this.checkAddressExists(pObject[_tmpBoxedPropertyName][_tmpBoxedPropertyNumber], tmpNewAddress, tmpRootObject);
439
524
  }
440
525
  }
441
526
 
442
527
  // If there is an object property already named for the sub object, but it isn't an object
443
528
  // then the system can't set the value in there. Error and abort!
444
- if (pObject.hasOwnProperty(tmpSubObjectName) && _typeof(pObject[tmpSubObjectName]) !== 'object') {
529
+ if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
445
530
  return false;
446
- } else if (pObject.hasOwnProperty(tmpSubObjectName)) {
531
+ } else if (tmpSubObjectName in pObject) {
447
532
  // If there is already a subobject pass that to the recursive thingy
448
- return this.checkAddressExists(pObject[tmpSubObjectName], tmpNewAddress);
533
+ return this.checkAddressExists(pObject[tmpSubObjectName], tmpNewAddress, tmpRootObject);
449
534
  } else {
450
535
  // Create a subobject and then pass that
451
536
  pObject[tmpSubObjectName] = {};
452
- return this.checkAddressExists(pObject[tmpSubObjectName], tmpNewAddress);
537
+ return this.checkAddressExists(pObject[tmpSubObjectName], tmpNewAddress, tmpRootObject);
453
538
  }
454
539
  }
455
540
  }
@@ -458,7 +543,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
458
543
  ;
459
544
  module.exports = ManyfestObjectAddressResolverCheckAddressExists;
460
545
  }, {
461
- "./Manyfest-LogToConsole.js": 4
546
+ "./Manyfest-LogToConsole.js": 4,
547
+ "./Manyfest-ObjectAddress-GetValue.js": 7,
548
+ "./Manyfest-ObjectAddress-Parser.js": 8
462
549
  }],
463
550
  6: [function (require, module, exports) {
464
551
  /**
@@ -671,7 +758,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
671
758
  if (_typeof(pObject[_tmpBoxedPropertyName3]) != 'object') {
672
759
  return false;
673
760
  }
674
-
675
761
  //This is a bracketed value
676
762
  // 4) If the middle part is *only* a number (no single, double or backtick quotes) it is an array element,
677
763
  // otherwise we will try to reat it as a dynamic object property.
@@ -751,9 +837,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
751
837
 
752
838
  // If there is an object property already named for the sub object, but it isn't an object
753
839
  // then the system can't set the value in there. Error and abort!
754
- if (pObject.hasOwnProperty(tmpSubObjectName) && _typeof(pObject[tmpSubObjectName]) !== 'object') {
840
+ if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
755
841
  return undefined;
756
- } else if (pObject.hasOwnProperty(tmpSubObjectName)) {
842
+ } else if (tmpSubObjectName in pObject) {
757
843
  // If there is already a subobject pass that to the recursive thingy
758
844
  // Continue to manage the parent address for recursion
759
845
  tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
@@ -772,7 +858,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
772
858
  ;
773
859
  module.exports = ManyfestObjectAddressResolverDeleteValue;
774
860
  }, {
775
- "../source/Manyfest-ParseConditionals.js": 10,
861
+ "../source/Manyfest-ParseConditionals.js": 11,
776
862
  "./Manyfest-CleanWrapCharacters.js": 2,
777
863
  "./Manyfest-LogToConsole.js": 4
778
864
  }],
@@ -783,6 +869,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
783
869
  var libSimpleLog = require('./Manyfest-LogToConsole.js');
784
870
  var fCleanWrapCharacters = require('./Manyfest-CleanWrapCharacters.js');
785
871
  var fParseConditionals = require("../source/Manyfest-ParseConditionals.js");
872
+ var _MockFable = {
873
+ DataFormat: require('./Manyfest-ObjectAddress-Parser.js')
874
+ };
786
875
 
787
876
  /**
788
877
  * Object Address Resolver - GetValue
@@ -835,14 +924,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
835
924
  // Set the root object to the passed-in object if it isn't set yet. This is expected to be the root object.
836
925
  var tmpRootObject = typeof pRootObject == 'undefined' ? pObject : pRootObject;
837
926
 
838
- // TODO: Make this work for things like SomeRootObject.Metadata["Some.People.Use.Bad.Object.Property.Names"]
839
- var tmpSeparatorIndex = pAddress.indexOf('.');
927
+ // DONE: Make this work for things like SomeRootObject.Metadata["Some.People.Use.Bad.Object.Property.Names"]
928
+ var tmpAddressPartBeginning = _MockFable.DataFormat.stringGetFirstSegment(pAddress);
840
929
 
841
930
  // Adding simple back-navigation in objects
842
- if (tmpSeparatorIndex == 0) {
931
+ if (tmpAddressPartBeginning == '') {
843
932
  // Given an address of "Bundle.Contract.IDContract...Project.IDProject" the ... would be interpreted as two back-navigations from IDContract.
844
933
  // When the address is passed in, though, the first . is already eliminated. So we can count the dots.
845
- var tmpParentAddressParts = tmpParentAddress.split('.');
934
+ var tmpParentAddressParts = _MockFable.DataFormat.stringGetSegments(tmpParentAddress);
846
935
  var tmpBackNavigationCount = 0;
847
936
 
848
937
  // Count the number of dots
@@ -871,7 +960,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
871
960
  }
872
961
 
873
962
  // This is the terminal address string (no more dots so the RECUSION ENDS IN HERE somehow)
874
- if (tmpSeparatorIndex == -1) {
963
+ if (tmpAddressPartBeginning.length == pAddress.length) {
964
+ // TODO: Optimize this by having these calls only happen when the previous fails.
965
+ // TODO: Alternatively look for all markers in one pass?
875
966
  // Check if the address refers to a boxed property
876
967
  var tmpBracketStartIndex = pAddress.indexOf('[');
877
968
  var tmpBracketStopIndex = pAddress.indexOf(']');
@@ -880,6 +971,48 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
880
971
  // Note this will not work with a bracket in the same address box set
881
972
  var tmpObjectTypeMarkerIndex = pAddress.indexOf('{}');
882
973
 
974
+ // Check if there is a function somewhere in the address... parenthesis start should only be in a function
975
+ var tmpFunctionStartIndex = pAddress.indexOf('(');
976
+
977
+ // NOTE THAT FUNCTIONS MUST RESOLVE FIRST
978
+ // Functions look like this
979
+ // MyFunction()
980
+ // MyFunction(Some.Address)
981
+ // MyFunction(Some.Address,Some.Other.Address)
982
+ // MyFunction(Some.Address,Some.Other.Address,Some.Third.Address)
983
+ //
984
+ // This could be enhanced to allow purely numeric and string values to be passed to the function. For now,
985
+ // To heck with that. This is a simple function call.
986
+ //
987
+ // The requirements to detect a function are:
988
+ // 1) The start bracket is after character 0
989
+ if (tmpFunctionStartIndex > 0
990
+ // 2) The end bracket is after the start bracket
991
+ && _MockFable.DataFormat.stringCountEnclosures(pAddress) > 0) {
992
+ var tmpFunctionAddress = pAddress.substring(0, tmpFunctionStartIndex).trim();
993
+ if (!_typeof(pObject[tmpFunctionAddress]) == 'function') {
994
+ // The address suggests it is a function, but it is not.
995
+ return false;
996
+ }
997
+
998
+ // Now see if the function has arguments.
999
+ // Implementation notes: * ARGUMENTS MUST SHARE THE SAME ROOT OBJECT CONTEXT *
1000
+ var tmpFunctionArguments = _MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(pAddress.substring(tmpFunctionAddress.length), 0), ',');
1001
+ if (tmpFunctionArguments.length == 0 || tmpFunctionArguments[0] == '') {
1002
+ // No arguments... just call the function (bound to the scope of the object it is contained withing)
1003
+ return pObject[tmpFunctionAddress].apply(pObject);
1004
+ } else {
1005
+ var tmpArgumentValues = [];
1006
+ var _tmpRootObject2 = typeof pRootObject == 'undefined' ? pObject : pRootObject;
1007
+
1008
+ // Now get the value for each argument
1009
+ for (var _i3 = 0; _i3 < tmpFunctionArguments.length; _i3++) {
1010
+ // Resolve the values for each subsequent entry
1011
+ tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2, tmpFunctionArguments[_i3]));
1012
+ }
1013
+ return pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues);
1014
+ }
1015
+ }
883
1016
  // Boxed elements look like this:
884
1017
  // MyValues[10]
885
1018
  // MyValues['Name']
@@ -889,7 +1022,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
889
1022
  // When we are passed SomeObject["Name"] this code below recurses as if it were SomeObject.Name
890
1023
  // The requirements to detect a boxed element are:
891
1024
  // 1) The start bracket is after character 0
892
- if (tmpBracketStartIndex > 0
1025
+ else if (tmpBracketStartIndex > 0
893
1026
  // 2) The end bracket has something between them
894
1027
  && tmpBracketStopIndex > tmpBracketStartIndex
895
1028
  // 3) There is data
@@ -946,11 +1079,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
946
1079
  }
947
1080
  var tmpInputArray = pObject[_tmpBoxedPropertyName5];
948
1081
  var tmpOutputArray = [];
949
- for (var _i3 = 0; _i3 < tmpInputArray.length; _i3++) {
1082
+ for (var _i4 = 0; _i4 < tmpInputArray.length; _i4++) {
950
1083
  // The filtering is complex but allows config-based metaprogramming directly from schema
951
- var tmpKeepRecord = this.checkRecordFilters(pAddress, tmpInputArray[_i3]);
1084
+ var tmpKeepRecord = this.checkRecordFilters(pAddress, tmpInputArray[_i4]);
952
1085
  if (tmpKeepRecord) {
953
- tmpOutputArray.push(tmpInputArray[_i3]);
1086
+ tmpOutputArray.push(tmpInputArray[_i4]);
954
1087
  }
955
1088
  }
956
1089
  return tmpOutputArray;
@@ -972,14 +1105,60 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
972
1105
  }
973
1106
  }
974
1107
  } else {
975
- var tmpSubObjectName = pAddress.substring(0, tmpSeparatorIndex);
976
- var tmpNewAddress = pAddress.substring(tmpSeparatorIndex + 1);
1108
+ //let tmpSubObjectName = pAddress.substring(0, tmpSeparatorIndex);
1109
+ //let tmpNewAddress = pAddress.substring(tmpSeparatorIndex+1);
1110
+ var tmpSubObjectName = tmpAddressPartBeginning;
1111
+ var tmpNewAddress = pAddress.substring(tmpAddressPartBeginning.length + 1);
977
1112
 
978
1113
  // BOXED ELEMENTS
979
1114
  // Test if the tmpNewAddress is an array or object
980
1115
  // Check if it's a boxed property
981
1116
  var _tmpBracketStartIndex3 = tmpSubObjectName.indexOf('[');
982
1117
  var _tmpBracketStopIndex3 = tmpSubObjectName.indexOf(']');
1118
+
1119
+ // Check if there is a function somewhere in the address... parenthesis start should only be in a function
1120
+ var _tmpFunctionStartIndex2 = tmpSubObjectName.indexOf('(');
1121
+
1122
+ // NOTE THAT FUNCTIONS MUST RESOLVE FIRST
1123
+ // Functions look like this
1124
+ // MyFunction()
1125
+ // MyFunction(Some.Address)
1126
+ // MyFunction(Some.Address,Some.Other.Address)
1127
+ // MyFunction(Some.Address,Some.Other.Address,Some.Third.Address)
1128
+ //
1129
+ // This could be enhanced to allow purely numeric and string values to be passed to the function. For now,
1130
+ // To heck with that. This is a simple function call.
1131
+ //
1132
+ // The requirements to detect a function are:
1133
+ // 1) The start bracket is after character 0
1134
+ if (_tmpFunctionStartIndex2 > 0
1135
+ // 2) The end bracket is after the start bracket
1136
+ && _MockFable.DataFormat.stringCountEnclosures(tmpSubObjectName) > 0) {
1137
+ var _tmpFunctionAddress2 = tmpSubObjectName.substring(0, _tmpFunctionStartIndex2).trim();
1138
+ tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
1139
+ if (!_typeof(pObject[_tmpFunctionAddress2]) == 'function') {
1140
+ // The address suggests it is a function, but it is not.
1141
+ return false;
1142
+ }
1143
+
1144
+ // Now see if the function has arguments.
1145
+ // Implementation notes: * ARGUMENTS MUST SHARE THE SAME ROOT OBJECT CONTEXT *
1146
+ var _tmpFunctionArguments = _MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(tmpSubObjectName.substring(_tmpFunctionAddress2.length), 0), ',');
1147
+ if (_tmpFunctionArguments.length == 0 || _tmpFunctionArguments[0] == '') {
1148
+ // No arguments... just call the function (bound to the scope of the object it is contained withing)
1149
+ return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject), tmpNewAddress, tmpParentAddress, tmpRootObject);
1150
+ } else {
1151
+ var _tmpArgumentValues = [];
1152
+ var _tmpRootObject3 = typeof pRootObject == 'undefined' ? pObject : pRootObject;
1153
+
1154
+ // Now get the value for each argument
1155
+ for (var _i5 = 0; _i5 < _tmpFunctionArguments.length; _i5++) {
1156
+ // Resolve the values for each subsequent entry
1157
+ _tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3, _tmpFunctionArguments[_i5]));
1158
+ }
1159
+ return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject, _tmpArgumentValues), tmpNewAddress, tmpParentAddress, _tmpRootObject3);
1160
+ }
1161
+ }
983
1162
  // Boxed elements look like this:
984
1163
  // MyValues[42]
985
1164
  // MyValues['Color']
@@ -989,7 +1168,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
989
1168
  // When we are passed SomeObject["Name"] this code below recurses as if it were SomeObject.Name
990
1169
  // The requirements to detect a boxed element are:
991
1170
  // 1) The start bracket is after character 0
992
- if (_tmpBracketStartIndex3 > 0
1171
+ else if (_tmpBracketStartIndex3 > 0
993
1172
  // 2) The end bracket has something between them
994
1173
  && _tmpBracketStopIndex3 > _tmpBracketStartIndex3
995
1174
  // 3) There is data
@@ -1059,9 +1238,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1059
1238
  tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(_tmpBoxedPropertyName7);
1060
1239
  // The container object is where we have the "Address":SOMEVALUE pairs
1061
1240
  var tmpContainerObject = {};
1062
- for (var _i4 = 0; _i4 < tmpArrayProperty.length; _i4++) {
1063
- var tmpPropertyParentAddress = "".concat(tmpParentAddress, "[").concat(_i4, "]");
1064
- var tmpValue = this.getValueAtAddress(pObject[_tmpBoxedPropertyName7][_i4], tmpNewAddress, tmpPropertyParentAddress, tmpRootObject);
1241
+ for (var _i6 = 0; _i6 < tmpArrayProperty.length; _i6++) {
1242
+ var tmpPropertyParentAddress = "".concat(tmpParentAddress, "[").concat(_i6, "]");
1243
+ var tmpValue = this.getValueAtAddress(pObject[_tmpBoxedPropertyName7][_i6], tmpNewAddress, tmpPropertyParentAddress, tmpRootObject);
1065
1244
  tmpContainerObject["".concat(tmpPropertyParentAddress, ".").concat(tmpNewAddress)] = tmpValue;
1066
1245
  }
1067
1246
  return tmpContainerObject;
@@ -1084,9 +1263,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1084
1263
  tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(_tmpObjectPropertyName2);
1085
1264
  // The container object is where we have the "Address":SOMEVALUE pairs
1086
1265
  var _tmpContainerObject2 = {};
1087
- for (var _i5 = 0; _i5 < tmpObjectPropertyKeys.length; _i5++) {
1088
- var _tmpPropertyParentAddress2 = "".concat(tmpParentAddress, ".").concat(tmpObjectPropertyKeys[_i5]);
1089
- var _tmpValue2 = this.getValueAtAddress(pObject[_tmpObjectPropertyName2][tmpObjectPropertyKeys[_i5]], tmpNewAddress, _tmpPropertyParentAddress2, tmpRootObject);
1266
+ for (var _i7 = 0; _i7 < tmpObjectPropertyKeys.length; _i7++) {
1267
+ var _tmpPropertyParentAddress2 = "".concat(tmpParentAddress, ".").concat(tmpObjectPropertyKeys[_i7]);
1268
+ var _tmpValue2 = this.getValueAtAddress(pObject[_tmpObjectPropertyName2][tmpObjectPropertyKeys[_i7]], tmpNewAddress, _tmpPropertyParentAddress2, tmpRootObject);
1090
1269
 
1091
1270
  // The filtering is complex but allows config-based metaprogramming directly from schema
1092
1271
  var _tmpKeepRecord2 = this.checkRecordFilters(pAddress, _tmpValue2);
@@ -1099,9 +1278,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1099
1278
 
1100
1279
  // If there is an object property already named for the sub object, but it isn't an object
1101
1280
  // then the system can't set the value in there. Error and abort!
1102
- if (pObject.hasOwnProperty(tmpSubObjectName) && _typeof(pObject[tmpSubObjectName]) !== 'object') {
1281
+ if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
1103
1282
  return undefined;
1104
- } else if (pObject.hasOwnProperty(tmpSubObjectName)) {
1283
+ } else if (tmpSubObjectName in pObject) {
1105
1284
  // If there is already a subobject pass that to the recursive thingy
1106
1285
  // Continue to manage the parent address for recursion
1107
1286
  tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
@@ -1120,11 +1299,266 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1120
1299
  ;
1121
1300
  module.exports = ManyfestObjectAddressResolverGetValue;
1122
1301
  }, {
1123
- "../source/Manyfest-ParseConditionals.js": 10,
1302
+ "../source/Manyfest-ParseConditionals.js": 11,
1124
1303
  "./Manyfest-CleanWrapCharacters.js": 2,
1125
- "./Manyfest-LogToConsole.js": 4
1304
+ "./Manyfest-LogToConsole.js": 4,
1305
+ "./Manyfest-ObjectAddress-Parser.js": 8
1126
1306
  }],
1127
1307
  8: [function (require, module, exports) {
1308
+ // TODO: This is an inelegant solution to delay the rewrite of Manyfest.
1309
+
1310
+ // Fable 3.0 has a service for data formatting that deals well with nested enclosures.
1311
+
1312
+ // The Manyfest library predates fable 3.0 and the services structure of it, so the functions
1313
+ // are more or less pure javascript and as functional as they can be made to be.
1314
+
1315
+ // Until we shift Manyfest to be a fable service, these three functions were pulled out of
1316
+ // fable to aid in parsing functions with nested enclosures.
1317
+
1318
+ module.exports = {
1319
+ /**
1320
+ * Count the number of segments in a string, respecting enclosures
1321
+ *
1322
+ * @param {string} pString
1323
+ * @param {string} pSeparator
1324
+ * @param {object} pEnclosureStartSymbolMap
1325
+ * @param {object} pEnclosureEndSymbolMap
1326
+ * @returns the count of segments in the string as a number
1327
+ */
1328
+ stringCountSegments: function stringCountSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
1329
+ var tmpString = typeof pString == 'string' ? pString : '';
1330
+ var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
1331
+ var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStart : {
1332
+ '{': 0,
1333
+ '[': 1,
1334
+ '(': 2
1335
+ };
1336
+ var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
1337
+ '}': 0,
1338
+ ']': 1,
1339
+ ')': 2
1340
+ };
1341
+ if (pString.length < 1) {
1342
+ return 0;
1343
+ }
1344
+ var tmpSegmentCount = 1;
1345
+ var tmpEnclosureStack = [];
1346
+ for (var i = 0; i < tmpString.length; i++) {
1347
+ // IF This is the start of a segment
1348
+ if (tmpString[i] == tmpSeparator
1349
+ // AND we are not in a nested portion of the string
1350
+ && tmpEnclosureStack.length == 0) {
1351
+ // Increment the segment count
1352
+ tmpSegmentCount++;
1353
+ }
1354
+ // IF This is the start of an enclosure
1355
+ else if (tmpString[i] in tmpEnclosureStartSymbolMap) {
1356
+ // Add it to the stack!
1357
+ tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
1358
+ }
1359
+ // IF This is the end of an enclosure
1360
+ else if (tmpString[i] in tmpEnclosureEndSymbolMap
1361
+ // AND it matches the current nest level symbol
1362
+ && tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
1363
+ // Pop it off the stack!
1364
+ tmpEnclosureStack.pop();
1365
+ }
1366
+ }
1367
+ return tmpSegmentCount;
1368
+ },
1369
+ /**
1370
+ * Get the first segment in a string, respecting enclosures
1371
+ *
1372
+ * @param {string} pString
1373
+ * @param {string} pSeparator
1374
+ * @param {object} pEnclosureStartSymbolMap
1375
+ * @param {object} pEnclosureEndSymbolMap
1376
+ * @returns the first segment in the string as a string
1377
+ */
1378
+ stringGetFirstSegment: function stringGetFirstSegment(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
1379
+ var tmpString = typeof pString == 'string' ? pString : '';
1380
+ var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
1381
+ var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStart : {
1382
+ '{': 0,
1383
+ '[': 1,
1384
+ '(': 2
1385
+ };
1386
+ var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
1387
+ '}': 0,
1388
+ ']': 1,
1389
+ ')': 2
1390
+ };
1391
+ if (pString.length < 1) {
1392
+ return 0;
1393
+ }
1394
+ var tmpEnclosureStack = [];
1395
+ for (var i = 0; i < tmpString.length; i++) {
1396
+ // IF This is the start of a segment
1397
+ if (tmpString[i] == tmpSeparator
1398
+ // AND we are not in a nested portion of the string
1399
+ && tmpEnclosureStack.length == 0) {
1400
+ // Return the segment
1401
+ return tmpString.substring(0, i);
1402
+ }
1403
+ // IF This is the start of an enclosure
1404
+ else if (tmpString[i] in tmpEnclosureStartSymbolMap) {
1405
+ // Add it to the stack!
1406
+ tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
1407
+ }
1408
+ // IF This is the end of an enclosure
1409
+ else if (tmpString[i] in tmpEnclosureEndSymbolMap
1410
+ // AND it matches the current nest level symbol
1411
+ && tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
1412
+ // Pop it off the stack!
1413
+ tmpEnclosureStack.pop();
1414
+ }
1415
+ }
1416
+ return tmpString;
1417
+ },
1418
+ /**
1419
+ * Get all segments in a string, respecting enclosures
1420
+ *
1421
+ * @param {string} pString
1422
+ * @param {string} pSeparator
1423
+ * @param {object} pEnclosureStartSymbolMap
1424
+ * @param {object} pEnclosureEndSymbolMap
1425
+ * @returns the first segment in the string as a string
1426
+ */
1427
+ stringGetSegments: function stringGetSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
1428
+ var tmpString = typeof pString == 'string' ? pString : '';
1429
+ var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
1430
+ var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStart : {
1431
+ '{': 0,
1432
+ '[': 1,
1433
+ '(': 2
1434
+ };
1435
+ var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
1436
+ '}': 0,
1437
+ ']': 1,
1438
+ ')': 2
1439
+ };
1440
+ var tmpCurrentSegmentStart = 0;
1441
+ var tmpSegmentList = [];
1442
+ if (pString.length < 1) {
1443
+ return tmpSegmentList;
1444
+ }
1445
+ var tmpEnclosureStack = [];
1446
+ for (var i = 0; i < tmpString.length; i++) {
1447
+ // IF This is the start of a segment
1448
+ if (tmpString[i] == tmpSeparator
1449
+ // AND we are not in a nested portion of the string
1450
+ && tmpEnclosureStack.length == 0) {
1451
+ // Return the segment
1452
+ tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart, i));
1453
+ tmpCurrentSegmentStart = i + 1;
1454
+ }
1455
+ // IF This is the start of an enclosure
1456
+ else if (tmpString[i] in tmpEnclosureStartSymbolMap) {
1457
+ // Add it to the stack!
1458
+ tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
1459
+ }
1460
+ // IF This is the end of an enclosure
1461
+ else if (tmpString[i] in tmpEnclosureEndSymbolMap
1462
+ // AND it matches the current nest level symbol
1463
+ && tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
1464
+ // Pop it off the stack!
1465
+ tmpEnclosureStack.pop();
1466
+ }
1467
+ }
1468
+ if (tmpCurrentSegmentStart < tmpString.length) {
1469
+ tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart));
1470
+ }
1471
+ return tmpSegmentList;
1472
+ },
1473
+ /**
1474
+ * Count the number of enclosures in a string based on the start and end characters.
1475
+ *
1476
+ * If no start or end characters are specified, it will default to parentheses. If the string is not a string, it will return 0.
1477
+ *
1478
+ * @param {string} pString
1479
+ * @param {string} pEnclosureStart
1480
+ * @param {string} pEnclosureEnd
1481
+ * @returns the count of full in the string
1482
+ */
1483
+ stringCountEnclosures: function stringCountEnclosures(pString, pEnclosureStart, pEnclosureEnd) {
1484
+ var tmpString = typeof pString == 'string' ? pString : '';
1485
+ var tmpEnclosureStart = typeof pEnclosureStart == 'string' ? pEnclosureStart : '(';
1486
+ var tmpEnclosureEnd = typeof pEnclosureEnd == 'string' ? pEnclosureEnd : ')';
1487
+ var tmpEnclosureCount = 0;
1488
+ var tmpEnclosureDepth = 0;
1489
+ for (var i = 0; i < tmpString.length; i++) {
1490
+ // This is the start of an enclosure
1491
+ if (tmpString[i] == tmpEnclosureStart) {
1492
+ if (tmpEnclosureDepth == 0) {
1493
+ tmpEnclosureCount++;
1494
+ }
1495
+ tmpEnclosureDepth++;
1496
+ } else if (tmpString[i] == tmpEnclosureEnd) {
1497
+ tmpEnclosureDepth--;
1498
+ }
1499
+ }
1500
+ return tmpEnclosureCount;
1501
+ },
1502
+ /**
1503
+ * Get the value of the enclosure at the specified index.
1504
+ *
1505
+ * If the index is not a number, it will default to 0. If the string is not a string, it will return an empty string. If the enclosure is not found, it will return an empty string. If the enclosure
1506
+ *
1507
+ * @param {string} pString
1508
+ * @param {number} pEnclosureIndexToGet
1509
+ * @param {string} pEnclosureStart
1510
+ * @param {string}} pEnclosureEnd
1511
+ * @returns {string}
1512
+ */
1513
+ stringGetEnclosureValueByIndex: function stringGetEnclosureValueByIndex(pString, pEnclosureIndexToGet, pEnclosureStart, pEnclosureEnd) {
1514
+ var tmpString = typeof pString == 'string' ? pString : '';
1515
+ var tmpEnclosureIndexToGet = typeof pEnclosureIndexToGet == 'number' ? pEnclosureIndexToGet : 0;
1516
+ var tmpEnclosureStart = typeof pEnclosureStart == 'string' ? pEnclosureStart : '(';
1517
+ var tmpEnclosureEnd = typeof pEnclosureEnd == 'string' ? pEnclosureEnd : ')';
1518
+ var tmpEnclosureCount = 0;
1519
+ var tmpEnclosureDepth = 0;
1520
+ var tmpMatchedEnclosureIndex = false;
1521
+ var tmpEnclosedValueStartIndex = 0;
1522
+ var tmpEnclosedValueEndIndex = 0;
1523
+ for (var i = 0; i < tmpString.length; i++) {
1524
+ // This is the start of an enclosure
1525
+ if (tmpString[i] == tmpEnclosureStart) {
1526
+ tmpEnclosureDepth++;
1527
+
1528
+ // Only count enclosures at depth 1, but still this parses both pairs of all of them.
1529
+ if (tmpEnclosureDepth == 1) {
1530
+ tmpEnclosureCount++;
1531
+ if (tmpEnclosureIndexToGet == tmpEnclosureCount - 1) {
1532
+ // This is the start of *the* enclosure
1533
+ tmpMatchedEnclosureIndex = true;
1534
+ tmpEnclosedValueStartIndex = i;
1535
+ }
1536
+ }
1537
+ }
1538
+ // This is the end of an enclosure
1539
+ else if (tmpString[i] == tmpEnclosureEnd) {
1540
+ tmpEnclosureDepth--;
1541
+
1542
+ // Again, only count enclosures at depth 1, but still this parses both pairs of all of them.
1543
+ if (tmpEnclosureDepth == 0 && tmpMatchedEnclosureIndex && tmpEnclosedValueEndIndex <= tmpEnclosedValueStartIndex) {
1544
+ tmpEnclosedValueEndIndex = i;
1545
+ tmpMatchedEnclosureIndex = false;
1546
+ }
1547
+ }
1548
+ }
1549
+ if (tmpEnclosureCount <= tmpEnclosureIndexToGet) {
1550
+ // Return an empty string if the enclosure is not found
1551
+ return '';
1552
+ }
1553
+ if (tmpEnclosedValueEndIndex > 0 && tmpEnclosedValueEndIndex > tmpEnclosedValueStartIndex) {
1554
+ return tmpString.substring(tmpEnclosedValueStartIndex + 1, tmpEnclosedValueEndIndex);
1555
+ } else {
1556
+ return tmpString.substring(tmpEnclosedValueStartIndex + 1);
1557
+ }
1558
+ }
1559
+ };
1560
+ }, {}],
1561
+ 9: [function (require, module, exports) {
1128
1562
  /**
1129
1563
  * @author <steven@velozo.com>
1130
1564
  */
@@ -1292,12 +1726,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1292
1726
 
1293
1727
  // If there is an object property already named for the sub object, but it isn't an object
1294
1728
  // then the system can't set the value in there. Error and abort!
1295
- if (pObject.hasOwnProperty(tmpSubObjectName) && _typeof(pObject[tmpSubObjectName]) !== 'object') {
1296
- if (!pObject.hasOwnProperty('__ERROR')) pObject['__ERROR'] = {};
1729
+ if (tmpSubObjectName in pObject && _typeof(pObject[tmpSubObjectName]) !== 'object') {
1730
+ if (!('__ERROR' in pObject)) pObject['__ERROR'] = {};
1297
1731
  // Put it in an error object so data isn't lost
1298
1732
  pObject['__ERROR'][pAddress] = pValue;
1299
1733
  return false;
1300
- } else if (pObject.hasOwnProperty(tmpSubObjectName)) {
1734
+ } else if (tmpSubObjectName in pObject) {
1301
1735
  // If there is already a subobject pass that to the recursive thingy
1302
1736
  return this.setValueAtAddress(pObject[tmpSubObjectName], tmpNewAddress, pValue);
1303
1737
  } else {
@@ -1315,7 +1749,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1315
1749
  "./Manyfest-CleanWrapCharacters.js": 2,
1316
1750
  "./Manyfest-LogToConsole.js": 4
1317
1751
  }],
1318
- 9: [function (require, module, exports) {
1752
+ 10: [function (require, module, exports) {
1319
1753
  /**
1320
1754
  * @author <steven@velozo.com>
1321
1755
  */
@@ -1410,8 +1844,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1410
1844
  tmpBaseAddress += '.';
1411
1845
  }
1412
1846
  var tmpObjectProperties = Object.keys(pObject);
1413
- for (var _i6 = 0; _i6 < tmpObjectProperties.length; _i6++) {
1414
- this.generateAddressses(pObject[tmpObjectProperties[_i6]], "".concat(tmpBaseAddress).concat(tmpObjectProperties[_i6]), tmpSchema);
1847
+ for (var _i8 = 0; _i8 < tmpObjectProperties.length; _i8++) {
1848
+ this.generateAddressses(pObject[tmpObjectProperties[_i8]], "".concat(tmpBaseAddress).concat(tmpObjectProperties[_i8]), tmpSchema);
1415
1849
  }
1416
1850
  }
1417
1851
  break;
@@ -1429,7 +1863,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1429
1863
  }, {
1430
1864
  "./Manyfest-LogToConsole.js": 4
1431
1865
  }],
1432
- 10: [function (require, module, exports) {
1866
+ 11: [function (require, module, exports) {
1433
1867
  // Given a string, parse out any conditional expressions and set whether or not to keep the record.
1434
1868
  //
1435
1869
  // For instance:
@@ -1450,7 +1884,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1450
1884
  var _ConditionalStanzaEndLength = _ConditionalStanzaEnd.length;
1451
1885
 
1452
1886
  // Ugh dependency injection. Can't wait to make these all fable services.
1453
- var libObjectAddressCheckAddressExists = new (require('./Manyfest-ObjectAddress-CheckAddressExists.js'))();
1887
+ //let libObjectAddressCheckAddressExists = new (require('./Manyfest-ObjectAddress-CheckAddressExists.js'))();
1454
1888
 
1455
1889
  // Test the condition of a value in a record
1456
1890
  var testCondition = function testCondition(pManyfest, pRecord, pSearchAddress, pSearchComparator, pValue) {
@@ -1463,7 +1897,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1463
1897
  break;
1464
1898
  case 'LNGT':
1465
1899
  case 'LENGTH_GREATER_THAN':
1466
- switch (_typeof(_typeof(pManyfest.getValueAtAddress(pRecord, pSearchAddress)))) {
1900
+ switch (_typeof(pManyfest.getValueAtAddress(pRecord, pSearchAddress))) {
1467
1901
  case 'string':
1468
1902
  return pManyfest.getValueAtAddress(pRecord, pSearchAddress).length > pValue;
1469
1903
  break;
@@ -1477,7 +1911,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1477
1911
  break;
1478
1912
  case 'LNLT':
1479
1913
  case 'LENGTH_LESS_THAN':
1480
- switch (_typeof(_typeof(pManyfest.getValueAtAddress(pRecord, pSearchAddress)))) {
1914
+ switch (_typeof(pManyfest.getValueAtAddress(pRecord, pSearchAddress))) {
1481
1915
  case 'string':
1482
1916
  return pManyfest.getValueAtAddress(pRecord, pSearchAddress).length < pValue;
1483
1917
  break;
@@ -1489,17 +1923,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1489
1923
  break;
1490
1924
  }
1491
1925
  break;
1492
- case 'FALSE':
1493
- return pManyfest.getValueAtAddress(pRecord, pSearchAddress) === false;
1494
- break;
1495
- case 'EX':
1496
- case 'EXISTS':
1497
- return libObjectAddressCheckAddressExists.checkAddressExists(pRecord, pSearchAddress);
1498
- break;
1499
- case 'DNEX':
1500
- case 'DOES_NOT_EXIST':
1501
- return !libObjectAddressCheckAddressExists.checkAddressExists(pRecord, pSearchAddress);
1502
- break;
1926
+ // TODO: Welcome to dependency hell. This fixes itself when we move to fable services.
1927
+ // case 'EX':
1928
+ // case 'EXISTS':
1929
+ // return libObjectAddressCheckAddressExists.checkAddressExists(pRecord, pSearchAddress);
1930
+ // break;
1931
+ // case 'DNEX':
1932
+ // case 'DOES_NOT_EXIST':
1933
+ // return !libObjectAddressCheckAddressExists.checkAddressExists(pRecord, pSearchAddress);
1934
+ // break;
1503
1935
  case '!=':
1504
1936
  return pManyfest.getValueAtAddress(pRecord, pSearchAddress) != pValue;
1505
1937
  break;
@@ -1533,7 +1965,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1533
1965
  2. Find stop points within each start point
1534
1966
  3. Check the conditional
1535
1967
  */
1536
-
1537
1968
  var tmpStartIndex = pAddress.indexOf(_ConditionalStanzaStart);
1538
1969
  while (tmpStartIndex != -1) {
1539
1970
  var tmpStopIndex = pAddress.indexOf(_ConditionalStanzaEnd, tmpStartIndex + _ConditionalStanzaStartLength);
@@ -1565,10 +1996,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1565
1996
  return tmpKeepRecord;
1566
1997
  };
1567
1998
  module.exports = parseConditionals;
1568
- }, {
1569
- "./Manyfest-ObjectAddress-CheckAddressExists.js": 5
1570
- }],
1571
- 11: [function (require, module, exports) {
1999
+ }, {}],
2000
+ 12: [function (require, module, exports) {
1572
2001
  /**
1573
2002
  * @author <steven@velozo.com>
1574
2003
  */
@@ -1621,7 +2050,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1621
2050
  var tmpManyfestAddresses = Object.keys(pManyfestSchemaDescriptors);
1622
2051
  var tmpHashMapping = {};
1623
2052
  tmpManyfestAddresses.forEach(function (pAddress) {
1624
- if (pManyfestSchemaDescriptors[pAddress].hasOwnProperty('Hash')) {
2053
+ if ('Hash' in pManyfestSchemaDescriptors[pAddress]) {
1625
2054
  tmpHashMapping[pManyfestSchemaDescriptors[pAddress].Hash] = pAddress;
1626
2055
  }
1627
2056
  });
@@ -1632,9 +2061,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1632
2061
  var tmpDescriptor = false;
1633
2062
 
1634
2063
  // See if there is a matching descriptor either by Address directly or Hash
1635
- if (pManyfestSchemaDescriptors.hasOwnProperty(pInputAddress)) {
2064
+ if (pInputAddress in pManyfestSchemaDescriptors) {
1636
2065
  tmpOldDescriptorAddress = pInputAddress;
1637
- } else if (tmpHashMapping.hasOwnProperty(pInputAddress)) {
2066
+ } else if (pInputAddress in tmpHashMapping) {
1638
2067
  tmpOldDescriptorAddress = tmpHashMapping[pInputAddress];
1639
2068
  }
1640
2069
 
@@ -1675,7 +2104,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1675
2104
  // The first passed-in set of descriptors takes precedence.
1676
2105
  var tmpDescriptorAddresses = Object.keys(tmpSource);
1677
2106
  tmpDescriptorAddresses.forEach(function (pDescriptorAddress) {
1678
- if (!tmpNewManyfestSchemaDescriptors.hasOwnProperty(pDescriptorAddress)) {
2107
+ if (!(pDescriptorAddress in tmpNewManyfestSchemaDescriptors)) {
1679
2108
  tmpNewManyfestSchemaDescriptors[pDescriptorAddress] = tmpSource[pDescriptorAddress];
1680
2109
  }
1681
2110
  });
@@ -1687,7 +2116,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1687
2116
  }, {
1688
2117
  "./Manyfest-LogToConsole.js": 4
1689
2118
  }],
1690
- 12: [function (require, module, exports) {
2119
+ 13: [function (require, module, exports) {
1691
2120
  /**
1692
2121
  * @author <steven@velozo.com>
1693
2122
  */
@@ -1730,7 +2159,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1730
2159
  _this3.objectAddressGetValue = new libObjectAddressGetValue(_this3.logInfo, _this3.logError);
1731
2160
  _this3.objectAddressSetValue = new libObjectAddressSetValue(_this3.logInfo, _this3.logError);
1732
2161
  _this3.objectAddressDeleteValue = new libObjectAddressDeleteValue(_this3.logInfo, _this3.logError);
1733
- if (!_this3.options.hasOwnProperty('defaultValues')) {
2162
+ if (!('defaultValues' in _this3.options)) {
1734
2163
  _this3.options.defaultValues = {
1735
2164
  "String": "",
1736
2165
  "Number": 0,
@@ -1744,7 +2173,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1744
2173
  "Null": null
1745
2174
  };
1746
2175
  }
1747
- if (!_this3.options.hasOwnProperty('strict')) {
2176
+ if (!('strict' in _this3.options)) {
1748
2177
  _this3.options.strict = false;
1749
2178
  }
1750
2179
  _this3.scope = undefined;
@@ -1805,11 +2234,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1805
2234
  var tmpManifest = _typeof(pManifest) == 'object' ? pManifest : {};
1806
2235
  var tmpDescriptorKeys = Object.keys(_DefaultConfiguration);
1807
2236
  for (var i = 0; i < tmpDescriptorKeys.length; i++) {
1808
- if (!tmpManifest.hasOwnProperty(tmpDescriptorKeys[i])) {
2237
+ if (!(tmpDescriptorKeys[i] in tmpManifest)) {
1809
2238
  tmpManifest[tmpDescriptorKeys[i]] = JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));
1810
2239
  }
1811
2240
  }
1812
- if (tmpManifest.hasOwnProperty('Scope')) {
2241
+ if ('Scope' in tmpManifest) {
1813
2242
  if (typeof tmpManifest.Scope === 'string') {
1814
2243
  this.scope = tmpManifest.Scope;
1815
2244
  } else {
@@ -1818,11 +2247,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1818
2247
  } else {
1819
2248
  this.logError("(".concat(this.scope, ") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."), tmpManifest);
1820
2249
  }
1821
- if (tmpManifest.hasOwnProperty('Descriptors')) {
2250
+ if ('Descriptors' in tmpManifest) {
1822
2251
  if (_typeof(tmpManifest.Descriptors) === 'object') {
1823
2252
  var tmpDescriptionAddresses = Object.keys(tmpManifest.Descriptors);
1824
- for (var _i7 = 0; _i7 < tmpDescriptionAddresses.length; _i7++) {
1825
- this.addDescriptor(tmpDescriptionAddresses[_i7], tmpManifest.Descriptors[tmpDescriptionAddresses[_i7]]);
2253
+ for (var _i9 = 0; _i9 < tmpDescriptionAddresses.length; _i9++) {
2254
+ this.addDescriptor(tmpDescriptionAddresses[_i9], tmpManifest.Descriptors[tmpDescriptionAddresses[_i9]]);
1826
2255
  }
1827
2256
  } else {
1828
2257
  this.logError("(".concat(this.scope, ") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(_typeof(tmpManifest.Descriptors), "."), tmpManifest);
@@ -1830,9 +2259,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1830
2259
  } else {
1831
2260
  this.logError("(".concat(this.scope, ") Error loading object description from manifest object. Property \"Descriptors\" does not exist in the root of the Manifest object."), tmpManifest);
1832
2261
  }
1833
- if (tmpManifest.hasOwnProperty('HashTranslations')) {
2262
+ if ('HashTranslations' in tmpManifest) {
1834
2263
  if (_typeof(tmpManifest.HashTranslations) === 'object') {
1835
- for (var _i8 = 0; _i8 < tmpManifest.HashTranslations.length; _i8++) {
2264
+ for (var _i10 = 0; _i10 < tmpManifest.HashTranslations.length; _i10++) {
1836
2265
  // Each translation is
1837
2266
  }
1838
2267
  }
@@ -1861,10 +2290,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1861
2290
  value: function addDescriptor(pAddress, pDescriptor) {
1862
2291
  if (_typeof(pDescriptor) === 'object') {
1863
2292
  // Add the Address into the Descriptor if it doesn't exist:
1864
- if (!pDescriptor.hasOwnProperty('Address')) {
2293
+ if (!('Address' in pDescriptor)) {
1865
2294
  pDescriptor.Address = pAddress;
1866
2295
  }
1867
- if (!this.elementDescriptors.hasOwnProperty(pAddress)) {
2296
+ if (!(pAddress in this.elementDescriptors)) {
1868
2297
  this.elementAddresses.push(pAddress);
1869
2298
  }
1870
2299
 
@@ -1873,7 +2302,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1873
2302
 
1874
2303
  // Always add the address as a hash
1875
2304
  this.elementHashes[pAddress] = pAddress;
1876
- if (pDescriptor.hasOwnProperty('Hash')) {
2305
+ if ('Hash' in pDescriptor) {
1877
2306
  // TODO: Check if this is a good idea or not..
1878
2307
  // Collisions are bound to happen with both representations of the address/hash in here and developers being able to create their own hashes.
1879
2308
  this.elementHashes[pDescriptor.Hash] = pAddress;
@@ -1929,15 +2358,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1929
2358
  key: "resolveHashAddress",
1930
2359
  value: function resolveHashAddress(pHash) {
1931
2360
  var tmpAddress = undefined;
1932
- var tmpInElementHashTable = this.elementHashes.hasOwnProperty(pHash);
1933
- var tmpInTranslationTable = this.hashTranslations.translationTable.hasOwnProperty(pHash);
2361
+ var tmpInElementHashTable = (pHash in this.elementHashes);
2362
+ var tmpInTranslationTable = (pHash in this.hashTranslations.translationTable);
1934
2363
 
1935
2364
  // The most straightforward: the hash exists, no translations.
1936
2365
  if (tmpInElementHashTable && !tmpInTranslationTable) {
1937
2366
  tmpAddress = this.elementHashes[pHash];
1938
2367
  }
1939
2368
  // There is a translation from one hash to another, and, the elementHashes contains the pointer end
1940
- else if (tmpInTranslationTable && this.elementHashes.hasOwnProperty(this.hashTranslations.translate(pHash))) {
2369
+ else if (tmpInTranslationTable && this.hashTranslations.translate(pHash) in this.elementHashes) {
1941
2370
  tmpAddress = this.elementHashes[this.hashTranslations.translate(pHash)];
1942
2371
  }
1943
2372
  // Use the level of indirection only in the Translation Table
@@ -2091,13 +2520,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2091
2520
  if (_typeof(pDescriptor) != 'object') {
2092
2521
  return undefined;
2093
2522
  }
2094
- if (pDescriptor.hasOwnProperty('Default')) {
2523
+ if ('Default' in pDescriptor) {
2095
2524
  return pDescriptor.Default;
2096
2525
  } else {
2097
2526
  // Default to a null if it doesn't have a type specified.
2098
2527
  // This will ensure a placeholder is created but isn't misinterpreted.
2099
- var tmpDataType = pDescriptor.hasOwnProperty('DataType') ? pDescriptor.DataType : 'String';
2100
- if (this.options.defaultValues.hasOwnProperty(tmpDataType)) {
2528
+ var tmpDataType = 'DataType' in pDescriptor ? pDescriptor.DataType : 'String';
2529
+ if (tmpDataType in this.options.defaultValues) {
2101
2530
  return this.options.defaultValues[tmpDataType];
2102
2531
  } else {
2103
2532
  // give up and return null
@@ -2113,7 +2542,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2113
2542
  return this.populateObject(pObject, pOverwriteProperties,
2114
2543
  // This just sets up a simple filter to see if there is a default set.
2115
2544
  function (pDescriptor) {
2116
- return pDescriptor.hasOwnProperty('Default');
2545
+ return 'Default' in pDescriptor;
2117
2546
  });
2118
2547
  }
2119
2548
 
@@ -2154,10 +2583,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2154
2583
  "./Manyfest-ObjectAddress-CheckAddressExists.js": 5,
2155
2584
  "./Manyfest-ObjectAddress-DeleteValue.js": 6,
2156
2585
  "./Manyfest-ObjectAddress-GetValue.js": 7,
2157
- "./Manyfest-ObjectAddress-SetValue.js": 8,
2158
- "./Manyfest-ObjectAddressGeneration.js": 9,
2159
- "./Manyfest-SchemaManipulation.js": 11,
2586
+ "./Manyfest-ObjectAddress-SetValue.js": 9,
2587
+ "./Manyfest-ObjectAddressGeneration.js": 10,
2588
+ "./Manyfest-SchemaManipulation.js": 12,
2160
2589
  "fable-serviceproviderbase": 1
2161
2590
  }]
2162
- }, {}, [12])(12);
2591
+ }, {}, [13])(13);
2163
2592
  });