manyfest 1.0.42 → 1.0.44
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/README.md +91 -260
- package/dist/manyfest.compatible.js +279 -112
- package/dist/manyfest.compatible.js.map +1 -1
- package/dist/manyfest.compatible.min.js +1 -1
- package/dist/manyfest.compatible.min.js.map +1 -1
- package/dist/manyfest.js +280 -112
- package/dist/manyfest.js.map +1 -1
- package/dist/manyfest.min.js +1 -1
- package/dist/manyfest.min.js.map +1 -1
- package/docs/.nojekyll +0 -0
- package/docs/README.md +108 -0
- package/docs/_sidebar.md +17 -0
- package/docs/address-notation.md +244 -0
- package/docs/cover.md +11 -0
- package/docs/hash-translation.md +202 -0
- package/docs/index.html +51 -0
- package/docs/quickstart.md +203 -0
- package/docs/reading.md +339 -0
- package/docs/schema-manipulation.md +186 -0
- package/docs/schema.md +319 -0
- package/docs/validating.md +344 -0
- package/docs/writing.md +300 -0
- package/package.json +3 -3
- package/source/Manyfest-CleanWrapCharacters.js +7 -1
- package/source/Manyfest-HashTranslation.js +29 -8
- package/source/Manyfest-ObjectAddress-CheckAddressExists.js +31 -17
- package/source/Manyfest-ObjectAddress-DeleteValue.js +27 -7
- package/source/Manyfest-ObjectAddress-GetValue.js +25 -10
- package/source/Manyfest-ObjectAddress-Parser.js +42 -35
- package/source/Manyfest-ObjectAddress-SetValue.js +21 -6
- package/source/Manyfest-ObjectAddressGeneration.js +23 -12
- package/source/Manyfest-ParseConditionals.js +3 -16
- package/source/Manyfest-SchemaManipulation.js +44 -21
- package/source/Manyfest.js +72 -17
- package/test/Manyfest_Performance_tests.js +48 -0
- package/types/Manyfest-CleanWrapCharacters.d.ts +7 -1
- package/types/Manyfest-CleanWrapCharacters.d.ts.map +1 -1
- package/types/Manyfest-HashTranslation.d.ts +34 -7
- package/types/Manyfest-HashTranslation.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts +23 -4
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts +25 -6
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-GetValue.d.ts +26 -6
- package/types/Manyfest-ObjectAddress-GetValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-Parser.d.ts +5 -5
- package/types/Manyfest-ObjectAddress-Parser.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-SetValue.d.ts +18 -5
- package/types/Manyfest-ObjectAddress-SetValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddressGeneration.d.ts +25 -4
- package/types/Manyfest-ObjectAddressGeneration.d.ts.map +1 -1
- package/types/Manyfest-SchemaManipulation.d.ts +47 -6
- package/types/Manyfest-SchemaManipulation.d.ts.map +1 -1
- package/types/Manyfest.d.ts +35 -12
- package/types/Manyfest.d.ts.map +1 -1
|
@@ -190,6 +190,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
190
190
|
//
|
|
191
191
|
// TODO: Should template literals be processed? If so what state do they have access to? That should happen here if so.
|
|
192
192
|
// TODO: Make a simple class include library with these
|
|
193
|
+
/**
|
|
194
|
+
* @param {string} pCharacter - The character to remove from the start and end of the string
|
|
195
|
+
* @param {string} pString - The string to clean
|
|
196
|
+
*
|
|
197
|
+
* @return {string} The cleaned string
|
|
198
|
+
*/
|
|
193
199
|
var cleanWrapCharacters = function cleanWrapCharacters(pCharacter, pString) {
|
|
194
200
|
if (pString.startsWith(pCharacter) && pString.endsWith(pCharacter)) {
|
|
195
201
|
return pString.substring(1, pString.length - 1);
|
|
@@ -221,6 +227,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
221
227
|
* @class ManyfestHashTranslation
|
|
222
228
|
*/
|
|
223
229
|
var ManyfestHashTranslation = /*#__PURE__*/function () {
|
|
230
|
+
/**
|
|
231
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
232
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
233
|
+
*/
|
|
224
234
|
function ManyfestHashTranslation(pInfoLog, pErrorLog) {
|
|
225
235
|
_classCallCheck(this, ManyfestHashTranslation);
|
|
226
236
|
// Wire in logging
|
|
@@ -228,11 +238,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
228
238
|
this.logError = typeof pErrorLog === 'function' ? pErrorLog : libSimpleLog;
|
|
229
239
|
this.translationTable = {};
|
|
230
240
|
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @return {number} The number of translations in the table
|
|
244
|
+
*/
|
|
231
245
|
return _createClass(ManyfestHashTranslation, [{
|
|
232
246
|
key: "translationCount",
|
|
233
247
|
value: function translationCount() {
|
|
234
248
|
return Object.keys(this.translationTable).length;
|
|
235
249
|
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param {object} pTranslation - An object containing source:destination hash pairs to add to the translation table
|
|
253
|
+
*/
|
|
236
254
|
}, {
|
|
237
255
|
key: "addTranslation",
|
|
238
256
|
value: function addTranslation(pTranslation) {
|
|
@@ -252,17 +270,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
252
270
|
}
|
|
253
271
|
});
|
|
254
272
|
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @param {string} pTranslationHash - The source hash to remove from the translation table
|
|
276
|
+
*/
|
|
255
277
|
}, {
|
|
256
278
|
key: "removeTranslationHash",
|
|
257
279
|
value: function removeTranslationHash(pTranslationHash) {
|
|
258
|
-
|
|
259
|
-
delete this.translationTable[pTranslationHash];
|
|
260
|
-
}
|
|
280
|
+
delete this.translationTable[pTranslationHash];
|
|
261
281
|
}
|
|
262
282
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
283
|
+
/**
|
|
284
|
+
* This removes translations.
|
|
285
|
+
* If passed a string, just removes the single one.
|
|
286
|
+
* If passed an object, it does all the source keys.
|
|
287
|
+
*
|
|
288
|
+
* @param {string|object} pTranslation - Either a source hash string to remove, or an object containing source:destination hash pairs to remove
|
|
289
|
+
*
|
|
290
|
+
* @return {boolean} True if the removal was successful, false otherwise
|
|
291
|
+
*/
|
|
266
292
|
}, {
|
|
267
293
|
key: "removeTranslation",
|
|
268
294
|
value: function removeTranslation(pTranslation) {
|
|
@@ -286,6 +312,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
286
312
|
value: function clearTranslations() {
|
|
287
313
|
this.translationTable = {};
|
|
288
314
|
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @param {string} pTranslation - The source hash to translate
|
|
318
|
+
*
|
|
319
|
+
* @return {string} The translated hash, or the original if no translation exists
|
|
320
|
+
*/
|
|
289
321
|
}, {
|
|
290
322
|
key: "translate",
|
|
291
323
|
value: function translate(pTranslation) {
|
|
@@ -324,6 +356,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
324
356
|
var libSimpleLog = require('./Manyfest-LogToConsole.js');
|
|
325
357
|
// This is for resolving functions mid-address
|
|
326
358
|
var libGetObjectValue = require('./Manyfest-ObjectAddress-GetValue.js');
|
|
359
|
+
var fCleanWrapCharacters = require('./Manyfest-CleanWrapCharacters.js');
|
|
327
360
|
|
|
328
361
|
// TODO: Just until this is a fable service.
|
|
329
362
|
var _MockFable = {
|
|
@@ -349,20 +382,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
349
382
|
* @class ManyfestObjectAddressResolverCheckAddressExists
|
|
350
383
|
*/
|
|
351
384
|
var ManyfestObjectAddressResolverCheckAddressExists = /*#__PURE__*/function () {
|
|
385
|
+
/**
|
|
386
|
+
* @param {function} [pInfoLog] - (optional) Function to use for info logging
|
|
387
|
+
* @param {function} [pErrorLog] - (optional) Function to use for error logging
|
|
388
|
+
*/
|
|
352
389
|
function ManyfestObjectAddressResolverCheckAddressExists(pInfoLog, pErrorLog) {
|
|
353
390
|
_classCallCheck(this, ManyfestObjectAddressResolverCheckAddressExists);
|
|
354
391
|
// Wire in logging
|
|
355
392
|
this.logInfo = typeof pInfoLog == 'function' ? pInfoLog : libSimpleLog;
|
|
356
393
|
this.logError = typeof pErrorLog == 'function' ? pErrorLog : libSimpleLog;
|
|
357
394
|
this.getObjectValueClass = new libGetObjectValue(this.logInfo, this.logError);
|
|
395
|
+
this.cleanWrapCharacters = fCleanWrapCharacters;
|
|
358
396
|
}
|
|
359
397
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
398
|
+
/**
|
|
399
|
+
* Check if an address exists.
|
|
400
|
+
*
|
|
401
|
+
* This is necessary because the getValueAtAddress function is ambiguous on
|
|
402
|
+
* whether the element/property is actually there or not (it returns
|
|
403
|
+
* undefined whether the property exists or not). This function checks for
|
|
404
|
+
* existance and returns true or false dependent.
|
|
405
|
+
*
|
|
406
|
+
* @param {object} pObject - The object to check within
|
|
407
|
+
* @param {string} pAddress - The address to check for
|
|
408
|
+
* @param {object} [pRootObject] - (optional) The root object for function resolution context
|
|
409
|
+
*
|
|
410
|
+
* @return {boolean} - True if the address exists, false if it does not
|
|
411
|
+
*/
|
|
366
412
|
return _createClass(ManyfestObjectAddressResolverCheckAddressExists, [{
|
|
367
413
|
key: "checkAddressExists",
|
|
368
414
|
value: function checkAddressExists(pObject, pAddress, pRootObject) {
|
|
@@ -497,7 +543,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
497
543
|
var _tmpFunctionAddress = tmpSubObjectName.substring(0, _tmpFunctionStartIndex).trim();
|
|
498
544
|
//tmpParentAddress = `${tmpParentAddress}${(tmpParentAddress.length > 0) ? '.' : ''}${tmpSubObjectName}`;
|
|
499
545
|
|
|
500
|
-
if (
|
|
546
|
+
if (typeof pObject[_tmpFunctionAddress] !== 'function') {
|
|
501
547
|
// The address suggests it is a function, but it is not.
|
|
502
548
|
return false;
|
|
503
549
|
}
|
|
@@ -512,12 +558,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
512
558
|
return this.checkAddressExists(pObject[_tmpFunctionAddress].apply(pObject), tmpNewAddress, tmpRootObject);
|
|
513
559
|
} catch (pError) {
|
|
514
560
|
// The function call failed, so the address doesn't exist
|
|
515
|
-
libSimpleLog
|
|
561
|
+
libSimpleLog("Error calling function ".concat(_tmpFunctionAddress, " (address [").concat(pAddress, "]): ").concat(pError.message));
|
|
516
562
|
return false;
|
|
517
563
|
}
|
|
518
564
|
} else {
|
|
519
565
|
// The function doesn't exist, so the address doesn't exist
|
|
520
|
-
libSimpleLog
|
|
566
|
+
libSimpleLog("Function ".concat(_tmpFunctionAddress, " does not exist (address [").concat(pAddress, "])"));
|
|
521
567
|
return false;
|
|
522
568
|
}
|
|
523
569
|
} else {
|
|
@@ -537,12 +583,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
537
583
|
return this.checkAddressExists(pObject[_tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, _tmpRootObject);
|
|
538
584
|
} catch (pError) {
|
|
539
585
|
// The function call failed, so the address doesn't exist
|
|
540
|
-
libSimpleLog
|
|
586
|
+
libSimpleLog("Error calling function ".concat(_tmpFunctionAddress, " (address [").concat(pAddress, "]): ").concat(pError.message));
|
|
541
587
|
return false;
|
|
542
588
|
}
|
|
543
589
|
} else {
|
|
544
590
|
// The function doesn't exist, so the address doesn't exist
|
|
545
|
-
libSimpleLog
|
|
591
|
+
libSimpleLog("Function ".concat(_tmpFunctionAddress, " does not exist (address [").concat(pAddress, "])"));
|
|
546
592
|
return false;
|
|
547
593
|
}
|
|
548
594
|
}
|
|
@@ -618,9 +664,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
618
664
|
}
|
|
619
665
|
}]);
|
|
620
666
|
}();
|
|
621
|
-
;
|
|
622
667
|
module.exports = ManyfestObjectAddressResolverCheckAddressExists;
|
|
623
668
|
}, {
|
|
669
|
+
"./Manyfest-CleanWrapCharacters.js": 3,
|
|
624
670
|
"./Manyfest-LogToConsole.js": 5,
|
|
625
671
|
"./Manyfest-ObjectAddress-GetValue.js": 8,
|
|
626
672
|
"./Manyfest-ObjectAddress-Parser.js": 9
|
|
@@ -654,6 +700,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
654
700
|
* @class ManyfestObjectAddressResolverDeleteValue
|
|
655
701
|
*/
|
|
656
702
|
var ManyfestObjectAddressResolverDeleteValue = /*#__PURE__*/function () {
|
|
703
|
+
/**
|
|
704
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
705
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
706
|
+
*/
|
|
657
707
|
function ManyfestObjectAddressResolverDeleteValue(pInfoLog, pErrorLog) {
|
|
658
708
|
_classCallCheck(this, ManyfestObjectAddressResolverDeleteValue);
|
|
659
709
|
// Wire in logging
|
|
@@ -663,13 +713,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
663
713
|
}
|
|
664
714
|
|
|
665
715
|
// TODO: Dry me
|
|
716
|
+
/**
|
|
717
|
+
* @param {string} pAddress - The address being evaluated
|
|
718
|
+
* @param {object} pRecord - The record being evaluated
|
|
719
|
+
*
|
|
720
|
+
* @return {boolean} True if the record passes the filters, false if it does not
|
|
721
|
+
*/
|
|
666
722
|
return _createClass(ManyfestObjectAddressResolverDeleteValue, [{
|
|
667
723
|
key: "checkRecordFilters",
|
|
668
724
|
value: function checkRecordFilters(pAddress, pRecord) {
|
|
669
725
|
return fParseConditionals(this, pAddress, pRecord);
|
|
670
726
|
}
|
|
671
727
|
|
|
672
|
-
|
|
728
|
+
/**
|
|
729
|
+
* Delete the value of an element at an address
|
|
730
|
+
*
|
|
731
|
+
* @param {object} pObject - The object to delete the value from
|
|
732
|
+
* @param {string} pAddress - The address to delete the value at
|
|
733
|
+
* @param {string} [pParentAddress] - (optional) The parent address for recursion
|
|
734
|
+
*
|
|
735
|
+
* @return {boolean|object|undefined} - True if the value was deleted, false if it could not be deleted, undefined on error
|
|
736
|
+
*/
|
|
673
737
|
}, {
|
|
674
738
|
key: "deleteValueAtAddress",
|
|
675
739
|
value: function deleteValueAtAddress(pObject, pAddress, pParentAddress) {
|
|
@@ -972,6 +1036,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
972
1036
|
* @class ManyfestObjectAddressResolverGetValue
|
|
973
1037
|
*/
|
|
974
1038
|
var ManyfestObjectAddressResolverGetValue = /*#__PURE__*/function () {
|
|
1039
|
+
/**
|
|
1040
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
1041
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
1042
|
+
*/
|
|
975
1043
|
function ManyfestObjectAddressResolverGetValue(pInfoLog, pErrorLog) {
|
|
976
1044
|
_classCallCheck(this, ManyfestObjectAddressResolverGetValue);
|
|
977
1045
|
// Wire in logging
|
|
@@ -979,13 +1047,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
979
1047
|
this.logError = typeof pErrorLog == 'function' ? pErrorLog : libSimpleLog;
|
|
980
1048
|
this.cleanWrapCharacters = fCleanWrapCharacters;
|
|
981
1049
|
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* @param {string} pAddress - The address of the record to check
|
|
1053
|
+
* @param {object} pRecord - The record to check against the filters
|
|
1054
|
+
*
|
|
1055
|
+
* @return {boolean} - True if the record passes the filters, false otherwise
|
|
1056
|
+
*/
|
|
982
1057
|
return _createClass(ManyfestObjectAddressResolverGetValue, [{
|
|
983
1058
|
key: "checkRecordFilters",
|
|
984
1059
|
value: function checkRecordFilters(pAddress, pRecord) {
|
|
985
1060
|
return fParseConditionals(this, pAddress, pRecord);
|
|
986
1061
|
}
|
|
987
1062
|
|
|
988
|
-
|
|
1063
|
+
/**
|
|
1064
|
+
* Get the value of an element at an address
|
|
1065
|
+
*
|
|
1066
|
+
* @param {object} pObject - The object to resolve the address against
|
|
1067
|
+
* @param {string} pAddress - The address to resolve
|
|
1068
|
+
* @param {string} [pParentAddress] - (optional) The parent address for back-navigation
|
|
1069
|
+
* @param {object} [pRootObject] - (optional) The root object for function argument resolution
|
|
1070
|
+
*
|
|
1071
|
+
* @return {any} The value at the address, or undefined if not found
|
|
1072
|
+
*/
|
|
989
1073
|
}, {
|
|
990
1074
|
key: "getValueAtAddress",
|
|
991
1075
|
value: function getValueAtAddress(pObject, pAddress, pParentAddress, pRootObject) {
|
|
@@ -1075,7 +1159,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1075
1159
|
// 2) The end bracket is after the start bracket
|
|
1076
1160
|
&& _MockFable.DataFormat.stringCountEnclosures(pAddress) > 0) {
|
|
1077
1161
|
var tmpFunctionAddress = pAddress.substring(0, tmpFunctionStartIndex).trim();
|
|
1078
|
-
if (
|
|
1162
|
+
if (typeof pObject[tmpFunctionAddress] !== 'function') {
|
|
1079
1163
|
// The address suggests it is a function, but it is not.
|
|
1080
1164
|
return false;
|
|
1081
1165
|
}
|
|
@@ -1252,7 +1336,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1252
1336
|
&& _MockFable.DataFormat.stringCountEnclosures(tmpSubObjectName) > 0) {
|
|
1253
1337
|
var _tmpFunctionAddress2 = tmpSubObjectName.substring(0, _tmpFunctionStartIndex2).trim();
|
|
1254
1338
|
tmpParentAddress = "".concat(tmpParentAddress).concat(tmpParentAddress.length > 0 ? '.' : '').concat(tmpSubObjectName);
|
|
1255
|
-
if (
|
|
1339
|
+
if (typeof pObject[_tmpFunctionAddress2] !== 'function') {
|
|
1256
1340
|
// The address suggests it is a function, but it is not.
|
|
1257
1341
|
return false;
|
|
1258
1342
|
}
|
|
@@ -1462,29 +1546,32 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1462
1546
|
// Until we shift Manyfest to be a fable service, these three functions were pulled out of
|
|
1463
1547
|
// fable to aid in parsing functions with nested enclosures.
|
|
1464
1548
|
|
|
1549
|
+
var DEFAULT_START_SYMBOL_MAP = {
|
|
1550
|
+
'{': 0,
|
|
1551
|
+
'[': 1,
|
|
1552
|
+
'(': 2
|
|
1553
|
+
};
|
|
1554
|
+
var DEFAULT_END_SYMBOL_MAP = {
|
|
1555
|
+
'}': 0,
|
|
1556
|
+
']': 1,
|
|
1557
|
+
')': 2
|
|
1558
|
+
};
|
|
1465
1559
|
module.exports = {
|
|
1466
1560
|
/**
|
|
1467
1561
|
* Count the number of segments in a string, respecting enclosures
|
|
1468
|
-
*
|
|
1469
|
-
* @param {string} pString
|
|
1470
|
-
* @param {string} pSeparator
|
|
1471
|
-
* @param {
|
|
1472
|
-
* @param {
|
|
1473
|
-
*
|
|
1562
|
+
*
|
|
1563
|
+
* @param {string} pString
|
|
1564
|
+
* @param {string} [pSeparator]
|
|
1565
|
+
* @param {Record<string, number>} [pEnclosureStartSymbolMap]
|
|
1566
|
+
* @param {Record<string, number>} [pEnclosureEndSymbolMap]
|
|
1567
|
+
*
|
|
1568
|
+
* @return {number} - The number of segments in the string
|
|
1474
1569
|
*/
|
|
1475
1570
|
stringCountSegments: function stringCountSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1476
1571
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1477
1572
|
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1478
|
-
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ?
|
|
1479
|
-
|
|
1480
|
-
'[': 1,
|
|
1481
|
-
'(': 2
|
|
1482
|
-
};
|
|
1483
|
-
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1484
|
-
'}': 0,
|
|
1485
|
-
']': 1,
|
|
1486
|
-
')': 2
|
|
1487
|
-
};
|
|
1573
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStartSymbolMap : DEFAULT_START_SYMBOL_MAP;
|
|
1574
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEndSymbolMap : DEFAULT_END_SYMBOL_MAP;
|
|
1488
1575
|
if (pString.length < 1) {
|
|
1489
1576
|
return 0;
|
|
1490
1577
|
}
|
|
@@ -1515,28 +1602,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1515
1602
|
},
|
|
1516
1603
|
/**
|
|
1517
1604
|
* Get the first segment in a string, respecting enclosures
|
|
1518
|
-
*
|
|
1519
|
-
* @param {string} pString
|
|
1520
|
-
* @param {string} pSeparator
|
|
1521
|
-
* @param {
|
|
1522
|
-
* @param {
|
|
1523
|
-
*
|
|
1605
|
+
*
|
|
1606
|
+
* @param {string} pString
|
|
1607
|
+
* @param {string} [pSeparator]
|
|
1608
|
+
* @param {Record<string, number>} [pEnclosureStartSymbolMap]
|
|
1609
|
+
* @param {Record<string, number>} [pEnclosureEndSymbolMap]
|
|
1610
|
+
*
|
|
1611
|
+
* @return {string} - the first segment in the string as a string
|
|
1524
1612
|
*/
|
|
1525
1613
|
stringGetFirstSegment: function stringGetFirstSegment(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1526
1614
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1527
1615
|
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1528
|
-
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ?
|
|
1529
|
-
|
|
1530
|
-
'[': 1,
|
|
1531
|
-
'(': 2
|
|
1532
|
-
};
|
|
1533
|
-
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1534
|
-
'}': 0,
|
|
1535
|
-
']': 1,
|
|
1536
|
-
')': 2
|
|
1537
|
-
};
|
|
1616
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStartSymbolMap : DEFAULT_START_SYMBOL_MAP;
|
|
1617
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEndSymbolMap : DEFAULT_END_SYMBOL_MAP;
|
|
1538
1618
|
if (pString.length < 1) {
|
|
1539
|
-
return
|
|
1619
|
+
return '';
|
|
1540
1620
|
}
|
|
1541
1621
|
var tmpEnclosureStack = [];
|
|
1542
1622
|
for (var i = 0; i < tmpString.length; i++) {
|
|
@@ -1564,26 +1644,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1564
1644
|
},
|
|
1565
1645
|
/**
|
|
1566
1646
|
* Get all segments in a string, respecting enclosures
|
|
1567
|
-
*
|
|
1568
|
-
* @param {string} pString
|
|
1569
|
-
* @param {string} pSeparator
|
|
1570
|
-
* @param {
|
|
1571
|
-
* @param {
|
|
1572
|
-
*
|
|
1647
|
+
*
|
|
1648
|
+
* @param {string} pString
|
|
1649
|
+
* @param {string} [pSeparator]
|
|
1650
|
+
* @param {Record<string, number>} [pEnclosureStartSymbolMap]
|
|
1651
|
+
* @param {Record<string, number>} [pEnclosureEndSymbolMap]
|
|
1652
|
+
*
|
|
1653
|
+
* @return {Array<string>} - the segments in the string as an array of strings
|
|
1573
1654
|
*/
|
|
1574
1655
|
stringGetSegments: function stringGetSegments(pString, pSeparator, pEnclosureStartSymbolMap, pEnclosureEndSymbolMap) {
|
|
1575
1656
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
1576
1657
|
var tmpSeparator = typeof pSeparator == 'string' ? pSeparator : '.';
|
|
1577
|
-
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ?
|
|
1578
|
-
|
|
1579
|
-
'[': 1,
|
|
1580
|
-
'(': 2
|
|
1581
|
-
};
|
|
1582
|
-
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEnd : {
|
|
1583
|
-
'}': 0,
|
|
1584
|
-
']': 1,
|
|
1585
|
-
')': 2
|
|
1586
|
-
};
|
|
1658
|
+
var tmpEnclosureStartSymbolMap = _typeof(pEnclosureStartSymbolMap) == 'object' ? pEnclosureStartSymbolMap : DEFAULT_START_SYMBOL_MAP;
|
|
1659
|
+
var tmpEnclosureEndSymbolMap = _typeof(pEnclosureEndSymbolMap) == 'object' ? pEnclosureEndSymbolMap : DEFAULT_END_SYMBOL_MAP;
|
|
1587
1660
|
var tmpCurrentSegmentStart = 0;
|
|
1588
1661
|
var tmpSegmentList = [];
|
|
1589
1662
|
if (pString.length < 1) {
|
|
@@ -1623,8 +1696,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1623
1696
|
* If no start or end characters are specified, it will default to parentheses. If the string is not a string, it will return 0.
|
|
1624
1697
|
*
|
|
1625
1698
|
* @param {string} pString
|
|
1626
|
-
* @param {string} pEnclosureStart
|
|
1627
|
-
* @param {string} pEnclosureEnd
|
|
1699
|
+
* @param {string} [pEnclosureStart]
|
|
1700
|
+
* @param {string} [pEnclosureEnd]
|
|
1628
1701
|
* @returns the count of full in the string
|
|
1629
1702
|
*/
|
|
1630
1703
|
stringCountEnclosures: function stringCountEnclosures(pString, pEnclosureStart, pEnclosureEnd) {
|
|
@@ -1653,9 +1726,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1653
1726
|
*
|
|
1654
1727
|
* @param {string} pString
|
|
1655
1728
|
* @param {number} pEnclosureIndexToGet
|
|
1656
|
-
* @param {string} pEnclosureStart
|
|
1657
|
-
* @param {string}
|
|
1658
|
-
*
|
|
1729
|
+
* @param {string} [pEnclosureStart]
|
|
1730
|
+
* @param {string} [pEnclosureEnd]
|
|
1731
|
+
*
|
|
1732
|
+
* @return {string} - The value of the enclosure at the specified index
|
|
1659
1733
|
*/
|
|
1660
1734
|
stringGetEnclosureValueByIndex: function stringGetEnclosureValueByIndex(pString, pEnclosureIndexToGet, pEnclosureStart, pEnclosureEnd) {
|
|
1661
1735
|
var tmpString = typeof pString == 'string' ? pString : '';
|
|
@@ -1731,6 +1805,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1731
1805
|
* @class ManyfestObjectAddressSetValue
|
|
1732
1806
|
*/
|
|
1733
1807
|
var ManyfestObjectAddressSetValue = /*#__PURE__*/function () {
|
|
1808
|
+
/**
|
|
1809
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
1810
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
1811
|
+
*/
|
|
1734
1812
|
function ManyfestObjectAddressSetValue(pInfoLog, pErrorLog) {
|
|
1735
1813
|
_classCallCheck(this, ManyfestObjectAddressSetValue);
|
|
1736
1814
|
// Wire in logging
|
|
@@ -1739,7 +1817,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1739
1817
|
this.cleanWrapCharacters = fCleanWrapCharacters;
|
|
1740
1818
|
}
|
|
1741
1819
|
|
|
1742
|
-
|
|
1820
|
+
/**
|
|
1821
|
+
* Set the value of an element at an address
|
|
1822
|
+
*
|
|
1823
|
+
* @param {object} pObject - The object to set the value in
|
|
1824
|
+
* @param {string} pAddress - The address to set the value at
|
|
1825
|
+
* @param {any} pValue - The value to set at the address
|
|
1826
|
+
*
|
|
1827
|
+
* @return {boolean} True if the value was set, false otherwise
|
|
1828
|
+
*/
|
|
1743
1829
|
return _createClass(ManyfestObjectAddressSetValue, [{
|
|
1744
1830
|
key: "setValueAtAddress",
|
|
1745
1831
|
value: function setValueAtAddress(pObject, pAddress, pValue) {
|
|
@@ -1961,6 +2047,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1961
2047
|
* @class ManyfestObjectAddressGeneration
|
|
1962
2048
|
*/
|
|
1963
2049
|
var ManyfestObjectAddressGeneration = /*#__PURE__*/function () {
|
|
2050
|
+
/**
|
|
2051
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
2052
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
2053
|
+
*/
|
|
1964
2054
|
function ManyfestObjectAddressGeneration(pInfoLog, pErrorLog) {
|
|
1965
2055
|
_classCallCheck(this, ManyfestObjectAddressGeneration);
|
|
1966
2056
|
// Wire in logging
|
|
@@ -1968,15 +2058,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1968
2058
|
this.logError = typeof pErrorLog == 'function' ? pErrorLog : libSimpleLog;
|
|
1969
2059
|
}
|
|
1970
2060
|
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2061
|
+
/**
|
|
2062
|
+
* generateAddressses
|
|
2063
|
+
*
|
|
2064
|
+
* This flattens an object into a set of key:value pairs for *EVERY SINGLE
|
|
2065
|
+
* POSSIBLE ADDRESS* in the object. It can get ... really insane really
|
|
2066
|
+
* quickly. This is not meant to be used directly to generate schemas, but
|
|
2067
|
+
* instead as a starting point for scripts or UIs.
|
|
2068
|
+
*
|
|
2069
|
+
* This will return a mega set of key:value pairs with all possible schema
|
|
2070
|
+
* permutations and default values (when not an object) and everything else.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {any} pObject - The object to generate addresses for
|
|
2073
|
+
* @param {string} [pBaseAddress] - (optional) The base address to start from
|
|
2074
|
+
* @param {object} [pSchema] - (optional) The schema object to append to
|
|
2075
|
+
*
|
|
2076
|
+
* @return {object} The generated schema object
|
|
2077
|
+
*/
|
|
1980
2078
|
return _createClass(ManyfestObjectAddressGeneration, [{
|
|
1981
2079
|
key: "generateAddressses",
|
|
1982
2080
|
value: function generateAddressses(pObject, pBaseAddress, pSchema) {
|
|
@@ -1991,7 +2089,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1991
2089
|
InSchema: false
|
|
1992
2090
|
};
|
|
1993
2091
|
if (tmpObjectType == 'object' && pObject == null) {
|
|
1994
|
-
tmpObjectType = '
|
|
2092
|
+
tmpObjectType = 'undefined';
|
|
1995
2093
|
}
|
|
1996
2094
|
switch (tmpObjectType) {
|
|
1997
2095
|
case 'string':
|
|
@@ -2006,7 +2104,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2006
2104
|
tmpSchema[tmpBaseAddress] = tmpSchemaObjectEntry;
|
|
2007
2105
|
break;
|
|
2008
2106
|
case 'undefined':
|
|
2009
|
-
case 'null':
|
|
2010
2107
|
tmpSchemaObjectEntry.DataType = 'Any';
|
|
2011
2108
|
tmpSchemaObjectEntry.Default = pObject;
|
|
2012
2109
|
tmpSchema[tmpBaseAddress] = tmpSchemaObjectEntry;
|
|
@@ -2192,6 +2289,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2192
2289
|
* @class ManyfestSchemaManipulation
|
|
2193
2290
|
*/
|
|
2194
2291
|
var ManyfestSchemaManipulation = /*#__PURE__*/function () {
|
|
2292
|
+
/**
|
|
2293
|
+
* @param {function} [pInfoLog] - (optional) A logging function for info messages
|
|
2294
|
+
* @param {function} [pErrorLog] - (optional) A logging function for error messages
|
|
2295
|
+
*/
|
|
2195
2296
|
function ManyfestSchemaManipulation(pInfoLog, pErrorLog) {
|
|
2196
2297
|
_classCallCheck(this, ManyfestSchemaManipulation);
|
|
2197
2298
|
// Wire in logging
|
|
@@ -2199,24 +2300,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2199
2300
|
this.logError = typeof pErrorLog === 'function' ? pErrorLog : libSimpleLog;
|
|
2200
2301
|
}
|
|
2201
2302
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2303
|
+
/**
|
|
2304
|
+
* This translates the default address mappings to something different.
|
|
2305
|
+
*
|
|
2306
|
+
* For instance you can pass in manyfest schema descriptor object:
|
|
2307
|
+
* {
|
|
2308
|
+
* "Address.Of.a": { "Hash": "a", "Type": "Number" },
|
|
2309
|
+
* "Address.Of.b": { "Hash": "b", "Type": "Number" }
|
|
2310
|
+
* }
|
|
2311
|
+
*
|
|
2312
|
+
*
|
|
2313
|
+
* And then an address mapping (basically a Hash->Address map)
|
|
2314
|
+
* {
|
|
2315
|
+
* "a": "New.Address.Of.a",
|
|
2316
|
+
* "b": "New.Address.Of.b"
|
|
2317
|
+
* }
|
|
2318
|
+
*
|
|
2319
|
+
* NOTE: This mutates the schema object permanently, altering the base hash.
|
|
2320
|
+
* If there is a collision with an existing address, it can lead to overwrites.
|
|
2321
|
+
* TODO: Discuss what should happen on collisions.
|
|
2322
|
+
*
|
|
2323
|
+
* @param {object} pManyfestSchemaDescriptors - The manyfest schema descriptors to resolve address mappings for
|
|
2324
|
+
* @param {object} pAddressMapping - The address mapping object to use for remapping
|
|
2325
|
+
*
|
|
2326
|
+
* @return {boolean} True if successful, false if there was an error
|
|
2327
|
+
*/
|
|
2220
2328
|
return _createClass(ManyfestSchemaManipulation, [{
|
|
2221
2329
|
key: "resolveAddressMappings",
|
|
2222
2330
|
value: function resolveAddressMappings(pManyfestSchemaDescriptors, pAddressMapping) {
|
|
@@ -2240,8 +2348,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2240
2348
|
var tmpAddressMappingSet = Object.keys(pAddressMapping);
|
|
2241
2349
|
tmpAddressMappingSet.forEach(function (pInputAddress) {
|
|
2242
2350
|
var tmpNewDescriptorAddress = pAddressMapping[pInputAddress];
|
|
2243
|
-
var tmpOldDescriptorAddress =
|
|
2244
|
-
var tmpDescriptor
|
|
2351
|
+
var tmpOldDescriptorAddress = null;
|
|
2352
|
+
var tmpDescriptor;
|
|
2245
2353
|
|
|
2246
2354
|
// See if there is a matching descriptor either by Address directly or Hash
|
|
2247
2355
|
if (pInputAddress in pManyfestSchemaDescriptors) {
|
|
@@ -2266,6 +2374,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2266
2374
|
});
|
|
2267
2375
|
return true;
|
|
2268
2376
|
}
|
|
2377
|
+
|
|
2378
|
+
/**
|
|
2379
|
+
* @param {object} pManyfestSchemaDescriptors - The manyfest schema descriptors to resolve address mappings for
|
|
2380
|
+
* @param {object} pAddressMapping - The address mapping object to use for remapping
|
|
2381
|
+
*
|
|
2382
|
+
* @return {object} A new object containing the remapped schema descriptors
|
|
2383
|
+
*/
|
|
2269
2384
|
}, {
|
|
2270
2385
|
key: "safeResolveAddressMappings",
|
|
2271
2386
|
value: function safeResolveAddressMappings(pManyfestSchemaDescriptors, pAddressMapping) {
|
|
@@ -2274,6 +2389,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2274
2389
|
this.resolveAddressMappings(tmpManyfestSchemaDescriptors, pAddressMapping);
|
|
2275
2390
|
return tmpManyfestSchemaDescriptors;
|
|
2276
2391
|
}
|
|
2392
|
+
|
|
2393
|
+
/**
|
|
2394
|
+
* @param {object} pManyfestSchemaDescriptorsDestination - The destination manyfest schema descriptors
|
|
2395
|
+
* @param {object} pManyfestSchemaDescriptorsSource - The source manyfest schema descriptors
|
|
2396
|
+
*
|
|
2397
|
+
* @return {object} A new object containing the merged schema descriptors
|
|
2398
|
+
*/
|
|
2277
2399
|
}, {
|
|
2278
2400
|
key: "mergeAddressMappings",
|
|
2279
2401
|
value: function mergeAddressMappings(pManyfestSchemaDescriptorsDestination, pManyfestSchemaDescriptorsSource) {
|
|
@@ -2344,8 +2466,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2344
2466
|
_this3 = _callSuper(this, Manyfest, [pFable, pManifest, pServiceHash]);
|
|
2345
2467
|
}
|
|
2346
2468
|
|
|
2469
|
+
/** @type {import('fable')} */
|
|
2470
|
+
_this3.fable;
|
|
2347
2471
|
/** @type {Record<string, any>} */
|
|
2348
2472
|
_this3.options;
|
|
2473
|
+
/** @type {string} */
|
|
2474
|
+
_this3.Hash;
|
|
2475
|
+
/** @type {string} */
|
|
2476
|
+
_this3.UUID;
|
|
2349
2477
|
_this3.serviceType = 'Manifest';
|
|
2350
2478
|
|
|
2351
2479
|
// Wire in logging
|
|
@@ -2375,9 +2503,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2375
2503
|
if (!('strict' in _this3.options)) {
|
|
2376
2504
|
_this3.options.strict = false;
|
|
2377
2505
|
}
|
|
2506
|
+
|
|
2507
|
+
/** @type {string} */
|
|
2378
2508
|
_this3.scope = undefined;
|
|
2509
|
+
/** @type {Array<string>} */
|
|
2379
2510
|
_this3.elementAddresses = undefined;
|
|
2511
|
+
/** @type {Record<string, string>} */
|
|
2380
2512
|
_this3.elementHashes = undefined;
|
|
2513
|
+
/** @type {Record<string, ManifestDescriptor>} */
|
|
2381
2514
|
_this3.elementDescriptors = undefined;
|
|
2382
2515
|
_this3.reset();
|
|
2383
2516
|
if (_typeof(_this3.options) === 'object') {
|
|
@@ -2409,7 +2542,26 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2409
2542
|
value: function clone() {
|
|
2410
2543
|
// Make a copy of the options in-place
|
|
2411
2544
|
var tmpNewOptions = JSON.parse(JSON.stringify(this.options));
|
|
2412
|
-
var tmpNewManyfest = new Manyfest(this.
|
|
2545
|
+
var tmpNewManyfest = new Manyfest(this.fable, tmpNewOptions, this.Hash);
|
|
2546
|
+
tmpNewManyfest.logInfo = this.logInfo;
|
|
2547
|
+
tmpNewManyfest.logError = this.logError;
|
|
2548
|
+
//FIXME: mostly written by co-pilot
|
|
2549
|
+
var _this$getManifest = this.getManifest(),
|
|
2550
|
+
Scope = _this$getManifest.Scope,
|
|
2551
|
+
Descriptors = _this$getManifest.Descriptors,
|
|
2552
|
+
HashTranslations = _this$getManifest.HashTranslations;
|
|
2553
|
+
tmpNewManyfest.scope = Scope;
|
|
2554
|
+
tmpNewManyfest.elementDescriptors = Descriptors;
|
|
2555
|
+
tmpNewManyfest.elementAddresses = Object.keys(Descriptors);
|
|
2556
|
+
// Rebuild the element hashes
|
|
2557
|
+
for (var i = 0; i < tmpNewManyfest.elementAddresses.length; i++) {
|
|
2558
|
+
var tmpAddress = tmpNewManyfest.elementAddresses[i];
|
|
2559
|
+
var tmpDescriptor = tmpNewManyfest.elementDescriptors[tmpAddress];
|
|
2560
|
+
tmpNewManyfest.elementHashes[tmpAddress] = tmpAddress;
|
|
2561
|
+
if ('Hash' in tmpDescriptor) {
|
|
2562
|
+
tmpNewManyfest.elementHashes[tmpDescriptor.Hash] = tmpAddress;
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2413
2565
|
|
|
2414
2566
|
// Import the hash translations
|
|
2415
2567
|
tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);
|
|
@@ -2417,11 +2569,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2417
2569
|
}
|
|
2418
2570
|
|
|
2419
2571
|
// Deserialize a Manifest from a string
|
|
2572
|
+
/**
|
|
2573
|
+
* @param {string} pManifestString - The manifest string to deserialize
|
|
2574
|
+
*
|
|
2575
|
+
* @return {Manyfest} The deserialized manifest
|
|
2576
|
+
*/
|
|
2420
2577
|
}, {
|
|
2421
2578
|
key: "deserialize",
|
|
2422
2579
|
value: function deserialize(pManifestString) {
|
|
2423
2580
|
// TODO: Add guards for bad manifest string
|
|
2424
|
-
|
|
2581
|
+
this.loadManifest(JSON.parse(pManifestString));
|
|
2582
|
+
return this;
|
|
2425
2583
|
}
|
|
2426
2584
|
|
|
2427
2585
|
// Load a manifest from an object
|
|
@@ -2462,18 +2620,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2462
2620
|
if ('HashTranslations' in tmpManifest) {
|
|
2463
2621
|
if (_typeof(tmpManifest.HashTranslations) === 'object') {
|
|
2464
2622
|
for (var _i0 = 0; _i0 < tmpManifest.HashTranslations.length; _i0++) {
|
|
2465
|
-
// Each translation is
|
|
2623
|
+
// Each translation is
|
|
2624
|
+
//FIXME: ?????????
|
|
2466
2625
|
}
|
|
2467
2626
|
}
|
|
2468
2627
|
}
|
|
2469
2628
|
}
|
|
2470
2629
|
|
|
2471
|
-
|
|
2630
|
+
/**
|
|
2631
|
+
* Serialize the Manifest to a string
|
|
2632
|
+
*
|
|
2633
|
+
* @return {string} - The serialized manifest
|
|
2634
|
+
*/
|
|
2472
2635
|
}, {
|
|
2473
2636
|
key: "serialize",
|
|
2474
2637
|
value: function serialize() {
|
|
2475
2638
|
return JSON.stringify(this.getManifest());
|
|
2476
2639
|
}
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* @return {{ Scope: string, Descriptors: Record<string, ManifestDescriptor>, HashTranslations: Record<string, string> }} - A copy of the manifest state.
|
|
2643
|
+
*/
|
|
2477
2644
|
}, {
|
|
2478
2645
|
key: "getManifest",
|
|
2479
2646
|
value: function getManifest() {
|