manyfest 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug/Harness.js +12 -14
- package/dist/manyfest.compatible.js +502 -66
- package/dist/manyfest.compatible.min.js +1 -1
- package/dist/manyfest.compatible.min.js.map +1 -1
- package/dist/manyfest.js +491 -54
- package/dist/manyfest.min.js +1 -1
- package/dist/manyfest.min.js.map +1 -1
- package/package.json +1 -1
- package/source/Manyfest-ObjectAddress-GetValue.js +16 -2
- package/test/Manyfest_Object_Read_tests.js +45 -0
|
@@ -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
|
-
//
|
|
316
|
-
|
|
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 (
|
|
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 (pObject.hasOwnProperty(tmpFunctionAddress) && 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
|
|
@@ -377,13 +416,59 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
377
416
|
return pObject.hasOwnProperty(pAddress);
|
|
378
417
|
}
|
|
379
418
|
} else {
|
|
380
|
-
var tmpSubObjectName =
|
|
381
|
-
var tmpNewAddress = pAddress.substring(
|
|
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,10 +517,10 @@ 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
|
|
|
@@ -445,11 +530,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
445
530
|
return false;
|
|
446
531
|
} else if (pObject.hasOwnProperty(tmpSubObjectName)) {
|
|
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.
|
|
@@ -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":
|
|
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
|
-
//
|
|
839
|
-
var
|
|
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 (
|
|
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 =
|
|
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 (
|
|
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,55 @@ 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
|
+
if (tmpFunctionArguments[_i3][0] == "'" && tmpFunctionArguments[_i3][tmpFunctionArguments[_i3].length - 1] == "'") {
|
|
1011
|
+
tmpArgumentValues.push(tmpFunctionArguments[_i3].substring(1, tmpFunctionArguments[_i3].length - 1));
|
|
1012
|
+
} else if (tmpFunctionArguments[_i3][0] == '"' && tmpFunctionArguments[_i3][tmpFunctionArguments[_i3].length - 1] == '"') {
|
|
1013
|
+
tmpArgumentValues.push(tmpFunctionArguments[_i3].substring(1, tmpFunctionArguments[_i3].length - 1));
|
|
1014
|
+
} else if (tmpFunctionArguments[_i3][0] == "`" && tmpFunctionArguments[_i3][tmpFunctionArguments[_i3].length - 1] == "`") {
|
|
1015
|
+
tmpArgumentValues.push(tmpFunctionArguments[_i3].substring(1, tmpFunctionArguments[_i3].length - 1));
|
|
1016
|
+
} else {
|
|
1017
|
+
tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2, tmpFunctionArguments[_i3]));
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
883
1023
|
// Boxed elements look like this:
|
|
884
1024
|
// MyValues[10]
|
|
885
1025
|
// MyValues['Name']
|
|
@@ -889,7 +1029,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
889
1029
|
// When we are passed SomeObject["Name"] this code below recurses as if it were SomeObject.Name
|
|
890
1030
|
// The requirements to detect a boxed element are:
|
|
891
1031
|
// 1) The start bracket is after character 0
|
|
892
|
-
if (tmpBracketStartIndex > 0
|
|
1032
|
+
else if (tmpBracketStartIndex > 0
|
|
893
1033
|
// 2) The end bracket has something between them
|
|
894
1034
|
&& tmpBracketStopIndex > tmpBracketStartIndex
|
|
895
1035
|
// 3) There is data
|
|
@@ -946,11 +1086,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
946
1086
|
}
|
|
947
1087
|
var tmpInputArray = pObject[_tmpBoxedPropertyName5];
|
|
948
1088
|
var tmpOutputArray = [];
|
|
949
|
-
for (var
|
|
1089
|
+
for (var _i4 = 0; _i4 < tmpInputArray.length; _i4++) {
|
|
950
1090
|
// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
951
|
-
var tmpKeepRecord = this.checkRecordFilters(pAddress, tmpInputArray[
|
|
1091
|
+
var tmpKeepRecord = this.checkRecordFilters(pAddress, tmpInputArray[_i4]);
|
|
952
1092
|
if (tmpKeepRecord) {
|
|
953
|
-
tmpOutputArray.push(tmpInputArray[
|
|
1093
|
+
tmpOutputArray.push(tmpInputArray[_i4]);
|
|
954
1094
|
}
|
|
955
1095
|
}
|
|
956
1096
|
return tmpOutputArray;
|
|
@@ -972,14 +1112,60 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
972
1112
|
}
|
|
973
1113
|
}
|
|
974
1114
|
} else {
|
|
975
|
-
|
|
976
|
-
|
|
1115
|
+
//let tmpSubObjectName = pAddress.substring(0, tmpSeparatorIndex);
|
|
1116
|
+
//let tmpNewAddress = pAddress.substring(tmpSeparatorIndex+1);
|
|
1117
|
+
var tmpSubObjectName = tmpAddressPartBeginning;
|
|
1118
|
+
var tmpNewAddress = pAddress.substring(tmpAddressPartBeginning.length + 1);
|
|
977
1119
|
|
|
978
1120
|
// BOXED ELEMENTS
|
|
979
1121
|
// Test if the tmpNewAddress is an array or object
|
|
980
1122
|
// Check if it's a boxed property
|
|
981
1123
|
var _tmpBracketStartIndex3 = tmpSubObjectName.indexOf('[');
|
|
982
1124
|
var _tmpBracketStopIndex3 = tmpSubObjectName.indexOf(']');
|
|
1125
|
+
|
|
1126
|
+
// Check if there is a function somewhere in the address... parenthesis start should only be in a function
|
|
1127
|
+
var _tmpFunctionStartIndex2 = tmpSubObjectName.indexOf('(');
|
|
1128
|
+
|
|
1129
|
+
// NOTE THAT FUNCTIONS MUST RESOLVE FIRST
|
|
1130
|
+
// Functions look like this
|
|
1131
|
+
// MyFunction()
|
|
1132
|
+
// MyFunction(Some.Address)
|
|
1133
|
+
// MyFunction(Some.Address,Some.Other.Address)
|
|
1134
|
+
// MyFunction(Some.Address,Some.Other.Address,Some.Third.Address)
|
|
1135
|
+
//
|
|
1136
|
+
// This could be enhanced to allow purely numeric and string values to be passed to the function. For now,
|
|
1137
|
+
// To heck with that. This is a simple function call.
|
|
1138
|
+
//
|
|
1139
|
+
// The requirements to detect a function are:
|
|
1140
|
+
// 1) The start bracket is after character 0
|
|
1141
|
+
if (_tmpFunctionStartIndex2 > 0
|
|
1142
|
+
// 2) The end bracket is after the start bracket
|
|
1143
|
+
&& _MockFable.DataFormat.stringCountEnclosures(tmpSubObjectName) > 0) {
|
|
1144
|
+
var _tmpFunctionAddress2 = tmpSubObjectName.substring(0, _tmpFunctionStartIndex2).trim();
|
|
1145
|
+
tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
|
|
1146
|
+
if (!_typeof(pObject[_tmpFunctionAddress2]) == 'function') {
|
|
1147
|
+
// The address suggests it is a function, but it is not.
|
|
1148
|
+
return false;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// Now see if the function has arguments.
|
|
1152
|
+
// Implementation notes: * ARGUMENTS MUST SHARE THE SAME ROOT OBJECT CONTEXT *
|
|
1153
|
+
var _tmpFunctionArguments = _MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(tmpSubObjectName.substring(_tmpFunctionAddress2.length), 0), ',');
|
|
1154
|
+
if (_tmpFunctionArguments.length == 0 || _tmpFunctionArguments[0] == '') {
|
|
1155
|
+
// No arguments... just call the function (bound to the scope of the object it is contained withing)
|
|
1156
|
+
return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject), tmpNewAddress, tmpParentAddress, tmpRootObject);
|
|
1157
|
+
} else {
|
|
1158
|
+
var _tmpArgumentValues = [];
|
|
1159
|
+
var _tmpRootObject3 = typeof pRootObject == 'undefined' ? pObject : pRootObject;
|
|
1160
|
+
|
|
1161
|
+
// Now get the value for each argument
|
|
1162
|
+
for (var _i5 = 0; _i5 < _tmpFunctionArguments.length; _i5++) {
|
|
1163
|
+
// Resolve the values for each subsequent entry
|
|
1164
|
+
_tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3, _tmpFunctionArguments[_i5]));
|
|
1165
|
+
}
|
|
1166
|
+
return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject, _tmpArgumentValues), tmpNewAddress, tmpParentAddress, _tmpRootObject3);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
983
1169
|
// Boxed elements look like this:
|
|
984
1170
|
// MyValues[42]
|
|
985
1171
|
// MyValues['Color']
|
|
@@ -989,7 +1175,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
989
1175
|
// When we are passed SomeObject["Name"] this code below recurses as if it were SomeObject.Name
|
|
990
1176
|
// The requirements to detect a boxed element are:
|
|
991
1177
|
// 1) The start bracket is after character 0
|
|
992
|
-
if (_tmpBracketStartIndex3 > 0
|
|
1178
|
+
else if (_tmpBracketStartIndex3 > 0
|
|
993
1179
|
// 2) The end bracket has something between them
|
|
994
1180
|
&& _tmpBracketStopIndex3 > _tmpBracketStartIndex3
|
|
995
1181
|
// 3) There is data
|
|
@@ -1059,9 +1245,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1059
1245
|
tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(_tmpBoxedPropertyName7);
|
|
1060
1246
|
// The container object is where we have the "Address":SOMEVALUE pairs
|
|
1061
1247
|
var tmpContainerObject = {};
|
|
1062
|
-
for (var
|
|
1063
|
-
var tmpPropertyParentAddress = "".concat(tmpParentAddress, "[").concat(
|
|
1064
|
-
var tmpValue = this.getValueAtAddress(pObject[_tmpBoxedPropertyName7][
|
|
1248
|
+
for (var _i6 = 0; _i6 < tmpArrayProperty.length; _i6++) {
|
|
1249
|
+
var tmpPropertyParentAddress = "".concat(tmpParentAddress, "[").concat(_i6, "]");
|
|
1250
|
+
var tmpValue = this.getValueAtAddress(pObject[_tmpBoxedPropertyName7][_i6], tmpNewAddress, tmpPropertyParentAddress, tmpRootObject);
|
|
1065
1251
|
tmpContainerObject["".concat(tmpPropertyParentAddress, ".").concat(tmpNewAddress)] = tmpValue;
|
|
1066
1252
|
}
|
|
1067
1253
|
return tmpContainerObject;
|
|
@@ -1084,9 +1270,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1084
1270
|
tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(_tmpObjectPropertyName2);
|
|
1085
1271
|
// The container object is where we have the "Address":SOMEVALUE pairs
|
|
1086
1272
|
var _tmpContainerObject2 = {};
|
|
1087
|
-
for (var
|
|
1088
|
-
var _tmpPropertyParentAddress2 = "".concat(tmpParentAddress, ".").concat(tmpObjectPropertyKeys[
|
|
1089
|
-
var _tmpValue2 = this.getValueAtAddress(pObject[_tmpObjectPropertyName2][tmpObjectPropertyKeys[
|
|
1273
|
+
for (var _i7 = 0; _i7 < tmpObjectPropertyKeys.length; _i7++) {
|
|
1274
|
+
var _tmpPropertyParentAddress2 = "".concat(tmpParentAddress, ".").concat(tmpObjectPropertyKeys[_i7]);
|
|
1275
|
+
var _tmpValue2 = this.getValueAtAddress(pObject[_tmpObjectPropertyName2][tmpObjectPropertyKeys[_i7]], tmpNewAddress, _tmpPropertyParentAddress2, tmpRootObject);
|
|
1090
1276
|
|
|
1091
1277
|
// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
1092
1278
|
var _tmpKeepRecord2 = this.checkRecordFilters(pAddress, _tmpValue2);
|
|
@@ -1120,11 +1306,266 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1120
1306
|
;
|
|
1121
1307
|
module.exports = ManyfestObjectAddressResolverGetValue;
|
|
1122
1308
|
}, {
|
|
1123
|
-
"../source/Manyfest-ParseConditionals.js":
|
|
1309
|
+
"../source/Manyfest-ParseConditionals.js": 11,
|
|
1124
1310
|
"./Manyfest-CleanWrapCharacters.js": 2,
|
|
1125
|
-
"./Manyfest-LogToConsole.js": 4
|
|
1311
|
+
"./Manyfest-LogToConsole.js": 4,
|
|
1312
|
+
"./Manyfest-ObjectAddress-Parser.js": 8
|
|
1126
1313
|
}],
|
|
1127
1314
|
8: [function (require, module, exports) {
|
|
1315
|
+
// TODO: This is an inelegant solution to delay the rewrite of Manyfest.
|
|
1316
|
+
|
|
1317
|
+
// Fable 3.0 has a service for data formatting that deals well with nested enclosures.
|
|
1318
|
+
|
|
1319
|
+
// The Manyfest library predates fable 3.0 and the services structure of it, so the functions
|
|
1320
|
+
// are more or less pure javascript and as functional as they can be made to be.
|
|
1321
|
+
|
|
1322
|
+
// Until we shift Manyfest to be a fable service, these three functions were pulled out of
|
|
1323
|
+
// fable to aid in parsing functions with nested enclosures.
|
|
1324
|
+
|
|
1325
|
+
module.exports = {
|
|
1326
|
+
/**
|
|
1327
|
+
* Count the number of segments in a string, respecting enclosures
|
|
1328
|
+
*
|
|
1329
|
+
* @param {string} pString
|
|
1330
|
+
* @param {string} pSeparator
|
|
1331
|
+
* @param {object} pEnclosureStartSymbolMap
|
|
1332
|
+
* @param {object} pEnclosureEndSymbolMap
|
|
1333
|
+
* @returns the count of segments in the string as a number
|
|
1334
|
+
*/
|
|
1335
|
+
stringCountSegments: function stringCountSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1336
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1337
|
+
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1338
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStart : {
|
|
1339
|
+
'{': 0,
|
|
1340
|
+
'[': 1,
|
|
1341
|
+
'(': 2
|
|
1342
|
+
};
|
|
1343
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1344
|
+
'}': 0,
|
|
1345
|
+
']': 1,
|
|
1346
|
+
')': 2
|
|
1347
|
+
};
|
|
1348
|
+
if (pString.length < 1) {
|
|
1349
|
+
return 0;
|
|
1350
|
+
}
|
|
1351
|
+
var tmpSegmentCount = 1;
|
|
1352
|
+
var tmpEnclosureStack = [];
|
|
1353
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
1354
|
+
// IF This is the start of a segment
|
|
1355
|
+
if (tmpString[i] == tmpSeparator
|
|
1356
|
+
// AND we are not in a nested portion of the string
|
|
1357
|
+
&& tmpEnclosureStack.length == 0) {
|
|
1358
|
+
// Increment the segment count
|
|
1359
|
+
tmpSegmentCount++;
|
|
1360
|
+
}
|
|
1361
|
+
// IF This is the start of an enclosure
|
|
1362
|
+
else if (tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])) {
|
|
1363
|
+
// Add it to the stack!
|
|
1364
|
+
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
1365
|
+
}
|
|
1366
|
+
// IF This is the end of an enclosure
|
|
1367
|
+
else if (tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])
|
|
1368
|
+
// AND it matches the current nest level symbol
|
|
1369
|
+
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
|
|
1370
|
+
// Pop it off the stack!
|
|
1371
|
+
tmpEnclosureStack.pop();
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
return tmpSegmentCount;
|
|
1375
|
+
},
|
|
1376
|
+
/**
|
|
1377
|
+
* Get the first segment in a string, respecting enclosures
|
|
1378
|
+
*
|
|
1379
|
+
* @param {string} pString
|
|
1380
|
+
* @param {string} pSeparator
|
|
1381
|
+
* @param {object} pEnclosureStartSymbolMap
|
|
1382
|
+
* @param {object} pEnclosureEndSymbolMap
|
|
1383
|
+
* @returns the first segment in the string as a string
|
|
1384
|
+
*/
|
|
1385
|
+
stringGetFirstSegment: function stringGetFirstSegment(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1386
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1387
|
+
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1388
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStart : {
|
|
1389
|
+
'{': 0,
|
|
1390
|
+
'[': 1,
|
|
1391
|
+
'(': 2
|
|
1392
|
+
};
|
|
1393
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1394
|
+
'}': 0,
|
|
1395
|
+
']': 1,
|
|
1396
|
+
')': 2
|
|
1397
|
+
};
|
|
1398
|
+
if (pString.length < 1) {
|
|
1399
|
+
return 0;
|
|
1400
|
+
}
|
|
1401
|
+
var tmpEnclosureStack = [];
|
|
1402
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
1403
|
+
// IF This is the start of a segment
|
|
1404
|
+
if (tmpString[i] == tmpSeparator
|
|
1405
|
+
// AND we are not in a nested portion of the string
|
|
1406
|
+
&& tmpEnclosureStack.length == 0) {
|
|
1407
|
+
// Return the segment
|
|
1408
|
+
return tmpString.substring(0, i);
|
|
1409
|
+
}
|
|
1410
|
+
// IF This is the start of an enclosure
|
|
1411
|
+
else if (tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])) {
|
|
1412
|
+
// Add it to the stack!
|
|
1413
|
+
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
1414
|
+
}
|
|
1415
|
+
// IF This is the end of an enclosure
|
|
1416
|
+
else if (tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])
|
|
1417
|
+
// AND it matches the current nest level symbol
|
|
1418
|
+
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
|
|
1419
|
+
// Pop it off the stack!
|
|
1420
|
+
tmpEnclosureStack.pop();
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
return tmpString;
|
|
1424
|
+
},
|
|
1425
|
+
/**
|
|
1426
|
+
* Get all segments in a string, respecting enclosures
|
|
1427
|
+
*
|
|
1428
|
+
* @param {string} pString
|
|
1429
|
+
* @param {string} pSeparator
|
|
1430
|
+
* @param {object} pEnclosureStartSymbolMap
|
|
1431
|
+
* @param {object} pEnclosureEndSymbolMap
|
|
1432
|
+
* @returns the first segment in the string as a string
|
|
1433
|
+
*/
|
|
1434
|
+
stringGetSegments: function stringGetSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1435
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1436
|
+
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1437
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStart : {
|
|
1438
|
+
'{': 0,
|
|
1439
|
+
'[': 1,
|
|
1440
|
+
'(': 2
|
|
1441
|
+
};
|
|
1442
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1443
|
+
'}': 0,
|
|
1444
|
+
']': 1,
|
|
1445
|
+
')': 2
|
|
1446
|
+
};
|
|
1447
|
+
var tmpCurrentSegmentStart = 0;
|
|
1448
|
+
var tmpSegmentList = [];
|
|
1449
|
+
if (pString.length < 1) {
|
|
1450
|
+
return tmpSegmentList;
|
|
1451
|
+
}
|
|
1452
|
+
var tmpEnclosureStack = [];
|
|
1453
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
1454
|
+
// IF This is the start of a segment
|
|
1455
|
+
if (tmpString[i] == tmpSeparator
|
|
1456
|
+
// AND we are not in a nested portion of the string
|
|
1457
|
+
&& tmpEnclosureStack.length == 0) {
|
|
1458
|
+
// Return the segment
|
|
1459
|
+
tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart, i));
|
|
1460
|
+
tmpCurrentSegmentStart = i + 1;
|
|
1461
|
+
}
|
|
1462
|
+
// IF This is the start of an enclosure
|
|
1463
|
+
else if (tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])) {
|
|
1464
|
+
// Add it to the stack!
|
|
1465
|
+
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
1466
|
+
}
|
|
1467
|
+
// IF This is the end of an enclosure
|
|
1468
|
+
else if (tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])
|
|
1469
|
+
// AND it matches the current nest level symbol
|
|
1470
|
+
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1]) {
|
|
1471
|
+
// Pop it off the stack!
|
|
1472
|
+
tmpEnclosureStack.pop();
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
if (tmpCurrentSegmentStart < tmpString.length) {
|
|
1476
|
+
tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart));
|
|
1477
|
+
}
|
|
1478
|
+
return tmpSegmentList;
|
|
1479
|
+
},
|
|
1480
|
+
/**
|
|
1481
|
+
* Count the number of enclosures in a string based on the start and end characters.
|
|
1482
|
+
*
|
|
1483
|
+
* If no start or end characters are specified, it will default to parentheses. If the string is not a string, it will return 0.
|
|
1484
|
+
*
|
|
1485
|
+
* @param {string} pString
|
|
1486
|
+
* @param {string} pEnclosureStart
|
|
1487
|
+
* @param {string} pEnclosureEnd
|
|
1488
|
+
* @returns the count of full in the string
|
|
1489
|
+
*/
|
|
1490
|
+
stringCountEnclosures: function stringCountEnclosures(pString, pEnclosureStart, pEnclosureEnd) {
|
|
1491
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1492
|
+
var tmpEnclosureStart = typeof pEnclosureStart == 'string' ? pEnclosureStart : '(';
|
|
1493
|
+
var tmpEnclosureEnd = typeof pEnclosureEnd == 'string' ? pEnclosureEnd : ')';
|
|
1494
|
+
var tmpEnclosureCount = 0;
|
|
1495
|
+
var tmpEnclosureDepth = 0;
|
|
1496
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
1497
|
+
// This is the start of an enclosure
|
|
1498
|
+
if (tmpString[i] == tmpEnclosureStart) {
|
|
1499
|
+
if (tmpEnclosureDepth == 0) {
|
|
1500
|
+
tmpEnclosureCount++;
|
|
1501
|
+
}
|
|
1502
|
+
tmpEnclosureDepth++;
|
|
1503
|
+
} else if (tmpString[i] == tmpEnclosureEnd) {
|
|
1504
|
+
tmpEnclosureDepth--;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
return tmpEnclosureCount;
|
|
1508
|
+
},
|
|
1509
|
+
/**
|
|
1510
|
+
* Get the value of the enclosure at the specified index.
|
|
1511
|
+
*
|
|
1512
|
+
* 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
|
|
1513
|
+
*
|
|
1514
|
+
* @param {string} pString
|
|
1515
|
+
* @param {number} pEnclosureIndexToGet
|
|
1516
|
+
* @param {string} pEnclosureStart
|
|
1517
|
+
* @param {string}} pEnclosureEnd
|
|
1518
|
+
* @returns {string}
|
|
1519
|
+
*/
|
|
1520
|
+
stringGetEnclosureValueByIndex: function stringGetEnclosureValueByIndex(pString, pEnclosureIndexToGet, pEnclosureStart, pEnclosureEnd) {
|
|
1521
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1522
|
+
var tmpEnclosureIndexToGet = typeof pEnclosureIndexToGet == 'number' ? pEnclosureIndexToGet : 0;
|
|
1523
|
+
var tmpEnclosureStart = typeof pEnclosureStart == 'string' ? pEnclosureStart : '(';
|
|
1524
|
+
var tmpEnclosureEnd = typeof pEnclosureEnd == 'string' ? pEnclosureEnd : ')';
|
|
1525
|
+
var tmpEnclosureCount = 0;
|
|
1526
|
+
var tmpEnclosureDepth = 0;
|
|
1527
|
+
var tmpMatchedEnclosureIndex = false;
|
|
1528
|
+
var tmpEnclosedValueStartIndex = 0;
|
|
1529
|
+
var tmpEnclosedValueEndIndex = 0;
|
|
1530
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
1531
|
+
// This is the start of an enclosure
|
|
1532
|
+
if (tmpString[i] == tmpEnclosureStart) {
|
|
1533
|
+
tmpEnclosureDepth++;
|
|
1534
|
+
|
|
1535
|
+
// Only count enclosures at depth 1, but still this parses both pairs of all of them.
|
|
1536
|
+
if (tmpEnclosureDepth == 1) {
|
|
1537
|
+
tmpEnclosureCount++;
|
|
1538
|
+
if (tmpEnclosureIndexToGet == tmpEnclosureCount - 1) {
|
|
1539
|
+
// This is the start of *the* enclosure
|
|
1540
|
+
tmpMatchedEnclosureIndex = true;
|
|
1541
|
+
tmpEnclosedValueStartIndex = i;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
// This is the end of an enclosure
|
|
1546
|
+
else if (tmpString[i] == tmpEnclosureEnd) {
|
|
1547
|
+
tmpEnclosureDepth--;
|
|
1548
|
+
|
|
1549
|
+
// Again, only count enclosures at depth 1, but still this parses both pairs of all of them.
|
|
1550
|
+
if (tmpEnclosureDepth == 0 && tmpMatchedEnclosureIndex && tmpEnclosedValueEndIndex <= tmpEnclosedValueStartIndex) {
|
|
1551
|
+
tmpEnclosedValueEndIndex = i;
|
|
1552
|
+
tmpMatchedEnclosureIndex = false;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
if (tmpEnclosureCount <= tmpEnclosureIndexToGet) {
|
|
1557
|
+
// Return an empty string if the enclosure is not found
|
|
1558
|
+
return '';
|
|
1559
|
+
}
|
|
1560
|
+
if (tmpEnclosedValueEndIndex > 0 && tmpEnclosedValueEndIndex > tmpEnclosedValueStartIndex) {
|
|
1561
|
+
return tmpString.substring(tmpEnclosedValueStartIndex + 1, tmpEnclosedValueEndIndex);
|
|
1562
|
+
} else {
|
|
1563
|
+
return tmpString.substring(tmpEnclosedValueStartIndex + 1);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
}, {}],
|
|
1568
|
+
9: [function (require, module, exports) {
|
|
1128
1569
|
/**
|
|
1129
1570
|
* @author <steven@velozo.com>
|
|
1130
1571
|
*/
|
|
@@ -1315,7 +1756,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1315
1756
|
"./Manyfest-CleanWrapCharacters.js": 2,
|
|
1316
1757
|
"./Manyfest-LogToConsole.js": 4
|
|
1317
1758
|
}],
|
|
1318
|
-
|
|
1759
|
+
10: [function (require, module, exports) {
|
|
1319
1760
|
/**
|
|
1320
1761
|
* @author <steven@velozo.com>
|
|
1321
1762
|
*/
|
|
@@ -1410,8 +1851,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1410
1851
|
tmpBaseAddress += '.';
|
|
1411
1852
|
}
|
|
1412
1853
|
var tmpObjectProperties = Object.keys(pObject);
|
|
1413
|
-
for (var
|
|
1414
|
-
this.generateAddressses(pObject[tmpObjectProperties[
|
|
1854
|
+
for (var _i8 = 0; _i8 < tmpObjectProperties.length; _i8++) {
|
|
1855
|
+
this.generateAddressses(pObject[tmpObjectProperties[_i8]], "".concat(tmpBaseAddress).concat(tmpObjectProperties[_i8]), tmpSchema);
|
|
1415
1856
|
}
|
|
1416
1857
|
}
|
|
1417
1858
|
break;
|
|
@@ -1429,7 +1870,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1429
1870
|
}, {
|
|
1430
1871
|
"./Manyfest-LogToConsole.js": 4
|
|
1431
1872
|
}],
|
|
1432
|
-
|
|
1873
|
+
11: [function (require, module, exports) {
|
|
1433
1874
|
// Given a string, parse out any conditional expressions and set whether or not to keep the record.
|
|
1434
1875
|
//
|
|
1435
1876
|
// For instance:
|
|
@@ -1450,7 +1891,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1450
1891
|
var _ConditionalStanzaEndLength = _ConditionalStanzaEnd.length;
|
|
1451
1892
|
|
|
1452
1893
|
// Ugh dependency injection. Can't wait to make these all fable services.
|
|
1453
|
-
|
|
1894
|
+
//let libObjectAddressCheckAddressExists = new (require('./Manyfest-ObjectAddress-CheckAddressExists.js'))();
|
|
1454
1895
|
|
|
1455
1896
|
// Test the condition of a value in a record
|
|
1456
1897
|
var testCondition = function testCondition(pManyfest, pRecord, pSearchAddress, pSearchComparator, pValue) {
|
|
@@ -1463,7 +1904,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1463
1904
|
break;
|
|
1464
1905
|
case 'LNGT':
|
|
1465
1906
|
case 'LENGTH_GREATER_THAN':
|
|
1466
|
-
switch (_typeof(
|
|
1907
|
+
switch (_typeof(pManyfest.getValueAtAddress(pRecord, pSearchAddress))) {
|
|
1467
1908
|
case 'string':
|
|
1468
1909
|
return pManyfest.getValueAtAddress(pRecord, pSearchAddress).length > pValue;
|
|
1469
1910
|
break;
|
|
@@ -1477,7 +1918,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1477
1918
|
break;
|
|
1478
1919
|
case 'LNLT':
|
|
1479
1920
|
case 'LENGTH_LESS_THAN':
|
|
1480
|
-
switch (_typeof(
|
|
1921
|
+
switch (_typeof(pManyfest.getValueAtAddress(pRecord, pSearchAddress))) {
|
|
1481
1922
|
case 'string':
|
|
1482
1923
|
return pManyfest.getValueAtAddress(pRecord, pSearchAddress).length < pValue;
|
|
1483
1924
|
break;
|
|
@@ -1489,17 +1930,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1489
1930
|
break;
|
|
1490
1931
|
}
|
|
1491
1932
|
break;
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
return !libObjectAddressCheckAddressExists.checkAddressExists(pRecord, pSearchAddress);
|
|
1502
|
-
break;
|
|
1933
|
+
// TODO: Welcome to dependency hell. This fixes itself when we move to fable services.
|
|
1934
|
+
// case 'EX':
|
|
1935
|
+
// case 'EXISTS':
|
|
1936
|
+
// return libObjectAddressCheckAddressExists.checkAddressExists(pRecord, pSearchAddress);
|
|
1937
|
+
// break;
|
|
1938
|
+
// case 'DNEX':
|
|
1939
|
+
// case 'DOES_NOT_EXIST':
|
|
1940
|
+
// return !libObjectAddressCheckAddressExists.checkAddressExists(pRecord, pSearchAddress);
|
|
1941
|
+
// break;
|
|
1503
1942
|
case '!=':
|
|
1504
1943
|
return pManyfest.getValueAtAddress(pRecord, pSearchAddress) != pValue;
|
|
1505
1944
|
break;
|
|
@@ -1533,7 +1972,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1533
1972
|
2. Find stop points within each start point
|
|
1534
1973
|
3. Check the conditional
|
|
1535
1974
|
*/
|
|
1536
|
-
|
|
1537
1975
|
var tmpStartIndex = pAddress.indexOf(_ConditionalStanzaStart);
|
|
1538
1976
|
while (tmpStartIndex != -1) {
|
|
1539
1977
|
var tmpStopIndex = pAddress.indexOf(_ConditionalStanzaEnd, tmpStartIndex + _ConditionalStanzaStartLength);
|
|
@@ -1565,10 +2003,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1565
2003
|
return tmpKeepRecord;
|
|
1566
2004
|
};
|
|
1567
2005
|
module.exports = parseConditionals;
|
|
1568
|
-
}, {
|
|
1569
|
-
|
|
1570
|
-
}],
|
|
1571
|
-
11: [function (require, module, exports) {
|
|
2006
|
+
}, {}],
|
|
2007
|
+
12: [function (require, module, exports) {
|
|
1572
2008
|
/**
|
|
1573
2009
|
* @author <steven@velozo.com>
|
|
1574
2010
|
*/
|
|
@@ -1687,7 +2123,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1687
2123
|
}, {
|
|
1688
2124
|
"./Manyfest-LogToConsole.js": 4
|
|
1689
2125
|
}],
|
|
1690
|
-
|
|
2126
|
+
13: [function (require, module, exports) {
|
|
1691
2127
|
/**
|
|
1692
2128
|
* @author <steven@velozo.com>
|
|
1693
2129
|
*/
|
|
@@ -1821,8 +2257,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1821
2257
|
if (tmpManifest.hasOwnProperty('Descriptors')) {
|
|
1822
2258
|
if (_typeof(tmpManifest.Descriptors) === 'object') {
|
|
1823
2259
|
var tmpDescriptionAddresses = Object.keys(tmpManifest.Descriptors);
|
|
1824
|
-
for (var
|
|
1825
|
-
this.addDescriptor(tmpDescriptionAddresses[
|
|
2260
|
+
for (var _i9 = 0; _i9 < tmpDescriptionAddresses.length; _i9++) {
|
|
2261
|
+
this.addDescriptor(tmpDescriptionAddresses[_i9], tmpManifest.Descriptors[tmpDescriptionAddresses[_i9]]);
|
|
1826
2262
|
}
|
|
1827
2263
|
} else {
|
|
1828
2264
|
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);
|
|
@@ -1832,7 +2268,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1832
2268
|
}
|
|
1833
2269
|
if (tmpManifest.hasOwnProperty('HashTranslations')) {
|
|
1834
2270
|
if (_typeof(tmpManifest.HashTranslations) === 'object') {
|
|
1835
|
-
for (var
|
|
2271
|
+
for (var _i10 = 0; _i10 < tmpManifest.HashTranslations.length; _i10++) {
|
|
1836
2272
|
// Each translation is
|
|
1837
2273
|
}
|
|
1838
2274
|
}
|
|
@@ -2154,10 +2590,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2154
2590
|
"./Manyfest-ObjectAddress-CheckAddressExists.js": 5,
|
|
2155
2591
|
"./Manyfest-ObjectAddress-DeleteValue.js": 6,
|
|
2156
2592
|
"./Manyfest-ObjectAddress-GetValue.js": 7,
|
|
2157
|
-
"./Manyfest-ObjectAddress-SetValue.js":
|
|
2158
|
-
"./Manyfest-ObjectAddressGeneration.js":
|
|
2159
|
-
"./Manyfest-SchemaManipulation.js":
|
|
2593
|
+
"./Manyfest-ObjectAddress-SetValue.js": 9,
|
|
2594
|
+
"./Manyfest-ObjectAddressGeneration.js": 10,
|
|
2595
|
+
"./Manyfest-SchemaManipulation.js": 12,
|
|
2160
2596
|
"fable-serviceproviderbase": 1
|
|
2161
2597
|
}]
|
|
2162
|
-
}, {}, [
|
|
2598
|
+
}, {}, [13])(13);
|
|
2163
2599
|
});
|