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.
Files changed (55) hide show
  1. package/README.md +91 -260
  2. package/dist/manyfest.compatible.js +279 -112
  3. package/dist/manyfest.compatible.js.map +1 -1
  4. package/dist/manyfest.compatible.min.js +1 -1
  5. package/dist/manyfest.compatible.min.js.map +1 -1
  6. package/dist/manyfest.js +280 -112
  7. package/dist/manyfest.js.map +1 -1
  8. package/dist/manyfest.min.js +1 -1
  9. package/dist/manyfest.min.js.map +1 -1
  10. package/docs/.nojekyll +0 -0
  11. package/docs/README.md +108 -0
  12. package/docs/_sidebar.md +17 -0
  13. package/docs/address-notation.md +244 -0
  14. package/docs/cover.md +11 -0
  15. package/docs/hash-translation.md +202 -0
  16. package/docs/index.html +51 -0
  17. package/docs/quickstart.md +203 -0
  18. package/docs/reading.md +339 -0
  19. package/docs/schema-manipulation.md +186 -0
  20. package/docs/schema.md +319 -0
  21. package/docs/validating.md +344 -0
  22. package/docs/writing.md +300 -0
  23. package/package.json +3 -3
  24. package/source/Manyfest-CleanWrapCharacters.js +7 -1
  25. package/source/Manyfest-HashTranslation.js +29 -8
  26. package/source/Manyfest-ObjectAddress-CheckAddressExists.js +31 -17
  27. package/source/Manyfest-ObjectAddress-DeleteValue.js +27 -7
  28. package/source/Manyfest-ObjectAddress-GetValue.js +25 -10
  29. package/source/Manyfest-ObjectAddress-Parser.js +42 -35
  30. package/source/Manyfest-ObjectAddress-SetValue.js +21 -6
  31. package/source/Manyfest-ObjectAddressGeneration.js +23 -12
  32. package/source/Manyfest-ParseConditionals.js +3 -16
  33. package/source/Manyfest-SchemaManipulation.js +44 -21
  34. package/source/Manyfest.js +72 -17
  35. package/test/Manyfest_Performance_tests.js +48 -0
  36. package/types/Manyfest-CleanWrapCharacters.d.ts +7 -1
  37. package/types/Manyfest-CleanWrapCharacters.d.ts.map +1 -1
  38. package/types/Manyfest-HashTranslation.d.ts +34 -7
  39. package/types/Manyfest-HashTranslation.d.ts.map +1 -1
  40. package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts +23 -4
  41. package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts.map +1 -1
  42. package/types/Manyfest-ObjectAddress-DeleteValue.d.ts +25 -6
  43. package/types/Manyfest-ObjectAddress-DeleteValue.d.ts.map +1 -1
  44. package/types/Manyfest-ObjectAddress-GetValue.d.ts +26 -6
  45. package/types/Manyfest-ObjectAddress-GetValue.d.ts.map +1 -1
  46. package/types/Manyfest-ObjectAddress-Parser.d.ts +5 -5
  47. package/types/Manyfest-ObjectAddress-Parser.d.ts.map +1 -1
  48. package/types/Manyfest-ObjectAddress-SetValue.d.ts +18 -5
  49. package/types/Manyfest-ObjectAddress-SetValue.d.ts.map +1 -1
  50. package/types/Manyfest-ObjectAddressGeneration.d.ts +25 -4
  51. package/types/Manyfest-ObjectAddressGeneration.d.ts.map +1 -1
  52. package/types/Manyfest-SchemaManipulation.d.ts +47 -6
  53. package/types/Manyfest-SchemaManipulation.d.ts.map +1 -1
  54. package/types/Manyfest.d.ts +35 -12
  55. package/types/Manyfest.d.ts.map +1 -1
@@ -27,20 +27,16 @@ const testCondition = (pManyfest, pRecord, pSearchAddress, pSearchComparator, pV
27
27
  {
28
28
  case 'TRUE':
29
29
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) === true);
30
- break;
31
30
  case 'FALSE':
32
31
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) === false);
33
- break;
34
32
  case 'LNGT':
35
33
  case 'LENGTH_GREATER_THAN':
36
34
  switch(typeof(pManyfest.getValueAtAddress(pRecord, pSearchAddress)))
37
35
  {
38
36
  case 'string':
39
37
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress).length > pValue);
40
- break;
41
38
  case 'object':
42
39
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress).length > pValue);
43
- break;
44
40
  default:
45
41
  return false;
46
42
  break;
@@ -52,10 +48,8 @@ const testCondition = (pManyfest, pRecord, pSearchAddress, pSearchComparator, pV
52
48
  {
53
49
  case 'string':
54
50
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress).length < pValue);
55
- break;
56
51
  case 'object':
57
52
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress).length < pValue);
58
- break;
59
53
  default:
60
54
  return false;
61
55
  break;
@@ -72,26 +66,19 @@ const testCondition = (pManyfest, pRecord, pSearchAddress, pSearchComparator, pV
72
66
  // break;
73
67
  case '!=':
74
68
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) != pValue);
75
- break;
76
69
  case '<':
77
70
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) < pValue);
78
- break;
79
71
  case '>':
80
72
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) > pValue);
81
- break;
82
73
  case '<=':
83
74
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) <= pValue);
84
- break;
85
75
  case '>=':
86
76
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) >= pValue);
87
- break;
88
77
  case '===':
89
78
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) === pValue);
90
- break;
91
79
  case '==':
92
80
  default:
93
81
  return (pManyfest.getValueAtAddress(pRecord, pSearchAddress) == pValue);
94
- break;
95
82
  }
96
83
  };
97
84
 
@@ -123,7 +110,7 @@ const parseConditionals = (pManyfest, pAddress, pRecord) =>
123
110
  let tmpSearchComparator = 'EXISTS';
124
111
  if (tmpMagicComparisonPatternSet.length > 1)
125
112
  {
126
- tmpSearchComparator = tmpMagicComparisonPatternSet[1];
113
+ tmpSearchComparator = tmpMagicComparisonPatternSet[1];
127
114
  }
128
115
 
129
116
  // The value to search for
@@ -141,10 +128,10 @@ const parseConditionals = (pManyfest, pAddress, pRecord) =>
141
128
  {
142
129
  tmpStartIndex = -1;
143
130
  }
144
-
131
+
145
132
  }
146
133
 
147
134
  return tmpKeepRecord;
148
135
  }
149
136
 
150
- module.exports = parseConditionals;
137
+ module.exports = parseConditionals;
@@ -10,6 +10,10 @@ let libSimpleLog = require('./Manyfest-LogToConsole.js');
10
10
  */
11
11
  class ManyfestSchemaManipulation
12
12
  {
13
+ /**
14
+ * @param {function} [pInfoLog] - (optional) A logging function for info messages
15
+ * @param {function} [pErrorLog] - (optional) A logging function for error messages
16
+ */
13
17
  constructor(pInfoLog, pErrorLog)
14
18
  {
15
19
  // Wire in logging
@@ -17,24 +21,31 @@ class ManyfestSchemaManipulation
17
21
  this.logError = (typeof(pErrorLog) === 'function') ? pErrorLog : libSimpleLog;
18
22
  }
19
23
 
20
- // This translates the default address mappings to something different.
21
- //
22
- // For instance you can pass in manyfest schema descriptor object:
23
- // {
24
- // "Address.Of.a": { "Hash": "a", "Type": "Number" },
25
- // "Address.Of.b": { "Hash": "b", "Type": "Number" }
26
- // }
27
- //
28
- //
29
- // And then an address mapping (basically a Hash->Address map)
30
- // {
31
- // "a": "New.Address.Of.a",
32
- // "b": "New.Address.Of.b"
33
- // }
34
- //
35
- // NOTE: This mutates the schema object permanently, altering the base hash.
36
- // If there is a collision with an existing address, it can lead to overwrites.
37
- // TODO: Discuss what should happen on collisions.
24
+ /**
25
+ * This translates the default address mappings to something different.
26
+ *
27
+ * For instance you can pass in manyfest schema descriptor object:
28
+ * {
29
+ * "Address.Of.a": { "Hash": "a", "Type": "Number" },
30
+ * "Address.Of.b": { "Hash": "b", "Type": "Number" }
31
+ * }
32
+ *
33
+ *
34
+ * And then an address mapping (basically a Hash->Address map)
35
+ * {
36
+ * "a": "New.Address.Of.a",
37
+ * "b": "New.Address.Of.b"
38
+ * }
39
+ *
40
+ * NOTE: This mutates the schema object permanently, altering the base hash.
41
+ * If there is a collision with an existing address, it can lead to overwrites.
42
+ * TODO: Discuss what should happen on collisions.
43
+ *
44
+ * @param {object} pManyfestSchemaDescriptors - The manyfest schema descriptors to resolve address mappings for
45
+ * @param {object} pAddressMapping - The address mapping object to use for remapping
46
+ *
47
+ * @return {boolean} True if successful, false if there was an error
48
+ */
38
49
  resolveAddressMappings(pManyfestSchemaDescriptors, pAddressMapping)
39
50
  {
40
51
  if (typeof(pManyfestSchemaDescriptors) != 'object')
@@ -67,8 +78,8 @@ class ManyfestSchemaManipulation
67
78
  (pInputAddress) =>
68
79
  {
69
80
  let tmpNewDescriptorAddress = pAddressMapping[pInputAddress];
70
- let tmpOldDescriptorAddress = false;
71
- let tmpDescriptor = false;
81
+ let tmpOldDescriptorAddress = null;
82
+ let tmpDescriptor;
72
83
 
73
84
  // See if there is a matching descriptor either by Address directly or Hash
74
85
  if (pInputAddress in pManyfestSchemaDescriptors)
@@ -99,6 +110,12 @@ class ManyfestSchemaManipulation
99
110
  return true;
100
111
  }
101
112
 
113
+ /**
114
+ * @param {object} pManyfestSchemaDescriptors - The manyfest schema descriptors to resolve address mappings for
115
+ * @param {object} pAddressMapping - The address mapping object to use for remapping
116
+ *
117
+ * @return {object} A new object containing the remapped schema descriptors
118
+ */
102
119
  safeResolveAddressMappings(pManyfestSchemaDescriptors, pAddressMapping)
103
120
  {
104
121
  // This returns the descriptors as a new object, safely remapping without mutating the original schema Descriptors
@@ -107,6 +124,12 @@ class ManyfestSchemaManipulation
107
124
  return tmpManyfestSchemaDescriptors;
108
125
  }
109
126
 
127
+ /**
128
+ * @param {object} pManyfestSchemaDescriptorsDestination - The destination manyfest schema descriptors
129
+ * @param {object} pManyfestSchemaDescriptorsSource - The source manyfest schema descriptors
130
+ *
131
+ * @return {object} A new object containing the merged schema descriptors
132
+ */
110
133
  mergeAddressMappings(pManyfestSchemaDescriptorsDestination, pManyfestSchemaDescriptorsSource)
111
134
  {
112
135
  if ((typeof(pManyfestSchemaDescriptorsSource) != 'object') || (typeof(pManyfestSchemaDescriptorsDestination) != 'object'))
@@ -134,4 +157,4 @@ class ManyfestSchemaManipulation
134
157
  }
135
158
  }
136
159
 
137
- module.exports = ManyfestSchemaManipulation;
160
+ module.exports = ManyfestSchemaManipulation;
@@ -45,8 +45,14 @@ class Manyfest extends libFableServiceProviderBase
45
45
  super(pFable, pManifest, pServiceHash);
46
46
  }
47
47
 
48
+ /** @type {import('fable')} */
49
+ this.fable;
48
50
  /** @type {Record<string, any>} */
49
51
  this.options;
52
+ /** @type {string} */
53
+ this.Hash;
54
+ /** @type {string} */
55
+ this.UUID;
50
56
 
51
57
  this.serviceType = 'Manifest';
52
58
 
@@ -82,9 +88,13 @@ class Manyfest extends libFableServiceProviderBase
82
88
  this.options.strict = false;
83
89
  }
84
90
 
91
+ /** @type {string} */
85
92
  this.scope = undefined;
93
+ /** @type {Array<string>} */
86
94
  this.elementAddresses = undefined;
95
+ /** @type {Record<string, string>} */
87
96
  this.elementHashes = undefined;
97
+ /** @type {Record<string, ManifestDescriptor>} */
88
98
  this.elementDescriptors = undefined;
89
99
 
90
100
  this.reset();
@@ -120,7 +130,25 @@ class Manyfest extends libFableServiceProviderBase
120
130
  // Make a copy of the options in-place
121
131
  let tmpNewOptions = JSON.parse(JSON.stringify(this.options));
122
132
 
123
- let tmpNewManyfest = new Manyfest(this.getManifest(), this.logInfo, this.logError, tmpNewOptions);
133
+ let tmpNewManyfest = new Manyfest(this.fable, tmpNewOptions, this.Hash);
134
+ tmpNewManyfest.logInfo = this.logInfo;
135
+ tmpNewManyfest.logError = this.logError;
136
+ //FIXME: mostly written by co-pilot
137
+ const { Scope, Descriptors, HashTranslations } = this.getManifest();
138
+ tmpNewManyfest.scope = Scope;
139
+ tmpNewManyfest.elementDescriptors = Descriptors;
140
+ tmpNewManyfest.elementAddresses = Object.keys(Descriptors);
141
+ // Rebuild the element hashes
142
+ for (let i = 0; i < tmpNewManyfest.elementAddresses.length; i++)
143
+ {
144
+ let tmpAddress = tmpNewManyfest.elementAddresses[i];
145
+ let tmpDescriptor = tmpNewManyfest.elementDescriptors[tmpAddress];
146
+ tmpNewManyfest.elementHashes[tmpAddress] = tmpAddress;
147
+ if ('Hash' in tmpDescriptor)
148
+ {
149
+ tmpNewManyfest.elementHashes[tmpDescriptor.Hash] = tmpAddress;
150
+ }
151
+ }
124
152
 
125
153
  // Import the hash translations
126
154
  tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);
@@ -129,10 +157,16 @@ class Manyfest extends libFableServiceProviderBase
129
157
  }
130
158
 
131
159
  // Deserialize a Manifest from a string
160
+ /**
161
+ * @param {string} pManifestString - The manifest string to deserialize
162
+ *
163
+ * @return {Manyfest} The deserialized manifest
164
+ */
132
165
  deserialize(pManifestString)
133
166
  {
134
167
  // TODO: Add guards for bad manifest string
135
- return this.loadManifest(JSON.parse(pManifestString));
168
+ this.loadManifest(JSON.parse(pManifestString));
169
+ return this;
136
170
  }
137
171
 
138
172
  // Load a manifest from an object
@@ -195,20 +229,25 @@ class Manyfest extends libFableServiceProviderBase
195
229
  {
196
230
  if (typeof(tmpManifest.HashTranslations) === 'object')
197
231
  {
198
- for (let i = 0; i < tmpManifest.HashTranslations.length; i++)
199
- {
200
- // Each translation is
201
- }
232
+ // HashTranslations is serialized as a plain object of source:target pairs
233
+ this.hashTranslations.addTranslation(tmpManifest.HashTranslations);
202
234
  }
203
235
  }
204
236
  }
205
237
 
206
- // Serialize the Manifest to a string
238
+ /**
239
+ * Serialize the Manifest to a string
240
+ *
241
+ * @return {string} - The serialized manifest
242
+ */
207
243
  serialize()
208
244
  {
209
245
  return JSON.stringify(this.getManifest());
210
246
  }
211
247
 
248
+ /**
249
+ * @return {{ Scope: string, Descriptors: Record<string, ManifestDescriptor>, HashTranslations: Record<string, string> }} - A copy of the manifest state.
250
+ */
212
251
  getManifest()
213
252
  {
214
253
  return (
@@ -364,13 +403,15 @@ class Manyfest extends libFableServiceProviderBase
364
403
 
365
404
  lintAddress(pAddress)
366
405
  {
367
- let tmpLintedAddress = pAddress.trim();
368
- // Check for a single . (but not a ..) at the end of the address and remove it.
369
- if (tmpLintedAddress.endsWith('..'))
406
+ // Guard against non-string input
407
+ if (typeof(pAddress) != 'string')
370
408
  {
371
- tmpLintedAddress = tmpLintedAddress.slice(0, -1);
409
+ return '';
372
410
  }
373
- else if (tmpLintedAddress.endsWith('.'))
411
+ let tmpLintedAddress = pAddress.trim();
412
+ // Check for a single trailing . (but not a ..) at the end of the address and remove it.
413
+ // We must not strip '..' because that is back-navigation syntax.
414
+ if (tmpLintedAddress.endsWith('.') && !tmpLintedAddress.endsWith('..'))
374
415
  {
375
416
  tmpLintedAddress = tmpLintedAddress.slice(0, -1);
376
417
  }
@@ -412,16 +453,16 @@ class Manyfest extends libFableServiceProviderBase
412
453
  }
413
454
 
414
455
  // Delete the value of an element by its hash
415
- deleteValueByHash(pObject, pHash, pValue)
456
+ deleteValueByHash(pObject, pHash)
416
457
  {
417
- return this.deleteValueAtAddress(pObject, this.resolveHashAddress(pHash), pValue);
458
+ return this.deleteValueAtAddress(pObject, this.resolveHashAddress(pHash));
418
459
  }
419
460
 
420
461
  // Delete the value of an element at an address
421
- deleteValueAtAddress (pObject, pAddress, pValue)
462
+ deleteValueAtAddress (pObject, pAddress)
422
463
  {
423
464
  let tmpLintedAddress = this.lintAddress(pAddress);
424
- return this.objectAddressDeleteValue.deleteValueAtAddress(pObject, tmpLintedAddress, pValue);
465
+ return this.objectAddressDeleteValue.deleteValueAtAddress(pObject, tmpLintedAddress);
425
466
  }
426
467
 
427
468
  // Validate the consistency of an object against the schema
@@ -518,12 +559,20 @@ class Manyfest extends libFableServiceProviderBase
518
559
  }
519
560
  break;
520
561
 
562
+ case 'boolean':
563
+ if (tmpElementType != 'boolean')
564
+ {
565
+ addValidationError(tmpDescriptor.Address, `has a DataType ${tmpDescriptor.DataType} but is of the type ${tmpElementType}`);
566
+ }
567
+ break;
568
+
521
569
  case 'datetime':
522
570
  let tmpValueDate = new Date(tmpValue);
523
571
  if (tmpValueDate.toString() == 'Invalid Date')
524
572
  {
525
573
  addValidationError(tmpDescriptor.Address, `has a DataType ${tmpDescriptor.DataType} but is not parsable as a Date by Javascript`);
526
574
  }
575
+ break;
527
576
 
528
577
  default:
529
578
  // Check if this is a string, in the default case
@@ -563,7 +612,13 @@ class Manyfest extends libFableServiceProviderBase
563
612
  let tmpDataType = ('DataType' in pDescriptor) ? pDescriptor.DataType : 'String';
564
613
  if (tmpDataType in this.options.defaultValues)
565
614
  {
566
- return this.options.defaultValues[tmpDataType];
615
+ let tmpDefaultValue = this.options.defaultValues[tmpDataType];
616
+ // Return a copy of mutable defaults (Array and Object) to prevent shared state
617
+ if (typeof(tmpDefaultValue) == 'object' && tmpDefaultValue !== null)
618
+ {
619
+ return JSON.parse(JSON.stringify(tmpDefaultValue));
620
+ }
621
+ return tmpDefaultValue;
567
622
  }
568
623
  else
569
624
  {
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Unit tests for Manyfest
3
+ *
4
+ * @license MIT
5
+ *
6
+ * @author Steven Velozo <steven@velozo.com>
7
+ */
8
+
9
+ var Chai = require('chai');
10
+ var Expect = Chai.expect;
11
+
12
+ let libManyfest = require('../source/Manyfest.js');
13
+
14
+ suite
15
+ (
16
+ 'Manyfest Performance',
17
+ function()
18
+ {
19
+ suite
20
+ (
21
+ 'Brute Force Performance Tests',
22
+ ()=>
23
+ {
24
+ test
25
+ (
26
+ 'Deep Address Performance Test',
27
+ ()=>
28
+ {
29
+ let _Manyfest = new libManyfest();
30
+ const tmpData = {};
31
+ const tmpValueAddress = 'level1.level2.level3.level4.level5';
32
+ const tmpNumIterations = 200000;
33
+ // start timing
34
+ console.time('Brute Force Initial Load Performance Test');
35
+ for (let i = 0; i < tmpNumIterations; i++)
36
+ {
37
+ const tmpUpdatedValue = (_Manyfest.getValueAtAddress(tmpData, tmpValueAddress) || 0) + 1;
38
+ _Manyfest.setValueAtAddress(tmpData, tmpValueAddress, tmpUpdatedValue);
39
+ }
40
+ // stop timing
41
+ console.timeEnd('Brute Force Initial Load Performance Test', { tmpData });
42
+ Expect(_Manyfest.getValueAtAddress(tmpData, tmpValueAddress)).to.equal(tmpNumIterations);
43
+ }
44
+ );
45
+ }
46
+ );
47
+ }
48
+ );
@@ -1,3 +1,9 @@
1
1
  export = cleanWrapCharacters;
2
- declare function cleanWrapCharacters(pCharacter: any, pString: any): any;
2
+ /**
3
+ * @param {string} pCharacter - The character to remove from the start and end of the string
4
+ * @param {string} pString - The string to clean
5
+ *
6
+ * @return {string} The cleaned string
7
+ */
8
+ declare function cleanWrapCharacters(pCharacter: string, pString: string): string;
3
9
  //# sourceMappingURL=Manyfest-CleanWrapCharacters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-CleanWrapCharacters.d.ts","sourceRoot":"","sources":["../source/Manyfest-CleanWrapCharacters.js"],"names":[],"mappings":";AAeA,yEAUC"}
1
+ {"version":3,"file":"Manyfest-CleanWrapCharacters.d.ts","sourceRoot":"","sources":["../source/Manyfest-CleanWrapCharacters.js"],"names":[],"mappings":";AAeA;;;;;GAKG;AACH,iDALW,MAAM,WACN,MAAM,GAEL,MAAM,CAYjB"}
@@ -15,15 +15,42 @@ export = ManyfestHashTranslation;
15
15
  * @class ManyfestHashTranslation
16
16
  */
17
17
  declare class ManyfestHashTranslation {
18
- constructor(pInfoLog: any, pErrorLog: any);
19
- logInfo: any;
20
- logError: any;
18
+ /**
19
+ * @param {function} [pInfoLog] - (optional) A logging function for info messages
20
+ * @param {function} [pErrorLog] - (optional) A logging function for error messages
21
+ */
22
+ constructor(pInfoLog?: Function, pErrorLog?: Function);
23
+ logInfo: Function;
24
+ logError: Function;
21
25
  translationTable: {};
26
+ /**
27
+ * @return {number} The number of translations in the table
28
+ */
22
29
  translationCount(): number;
23
- addTranslation(pTranslation: any): boolean;
24
- removeTranslationHash(pTranslationHash: any): void;
25
- removeTranslation(pTranslation: any): boolean;
30
+ /**
31
+ * @param {object} pTranslation - An object containing source:destination hash pairs to add to the translation table
32
+ */
33
+ addTranslation(pTranslation: object): boolean;
34
+ /**
35
+ * @param {string} pTranslationHash - The source hash to remove from the translation table
36
+ */
37
+ removeTranslationHash(pTranslationHash: string): void;
38
+ /**
39
+ * This removes translations.
40
+ * If passed a string, just removes the single one.
41
+ * If passed an object, it does all the source keys.
42
+ *
43
+ * @param {string|object} pTranslation - Either a source hash string to remove, or an object containing source:destination hash pairs to remove
44
+ *
45
+ * @return {boolean} True if the removal was successful, false otherwise
46
+ */
47
+ removeTranslation(pTranslation: string | object): boolean;
26
48
  clearTranslations(): void;
27
- translate(pTranslation: any): any;
49
+ /**
50
+ * @param {string} pTranslation - The source hash to translate
51
+ *
52
+ * @return {string} The translated hash, or the original if no translation exists
53
+ */
54
+ translate(pTranslation: string): string;
28
55
  }
29
56
  //# sourceMappingURL=Manyfest-HashTranslation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-HashTranslation.d.ts","sourceRoot":"","sources":["../source/Manyfest-HashTranslation.js"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;EAcE;AACF;IAEC,2CAOC;IAJA,aAA0E;IAC1E,cAA6E;IAEvE,qBAA0B;IAG9B,2BAGC;IAED,2CAwBC;IAED,mDAMC;IAKD,8CAuBC;IAED,0BAGC;IAED,kCAUC;CACJ"}
1
+ {"version":3,"file":"Manyfest-HashTranslation.d.ts","sourceRoot":"","sources":["../source/Manyfest-HashTranslation.js"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;EAcE;AACF;IAEI;;;OAGG;IACN,uDAOC;IAJA,kBAA0E;IAC1E,mBAA6E;IAEvE,qBAA0B;IAG9B;;OAEG;IACH,oBAFY,MAAM,CAKjB;IAED;;OAEG;IACH,6BAFW,MAAM,WA0BhB;IAED;;OAEG;IACH,wCAFW,MAAM,QAKhB;IAED;;;;;;;;OAQG;IACH,gCAJW,MAAM,GAAC,MAAM,GAEZ,OAAO,CAyBlB;IAED,0BAGC;IAED;;;;OAIG;IACH,wBAJW,MAAM,GAEL,MAAM,CAYjB;CACJ"}
@@ -18,11 +18,30 @@ export = ManyfestObjectAddressResolverCheckAddressExists;
18
18
  * @class ManyfestObjectAddressResolverCheckAddressExists
19
19
  */
20
20
  declare class ManyfestObjectAddressResolverCheckAddressExists {
21
- constructor(pInfoLog: any, pErrorLog: any);
22
- logInfo: any;
23
- logError: any;
21
+ /**
22
+ * @param {function} [pInfoLog] - (optional) Function to use for info logging
23
+ * @param {function} [pErrorLog] - (optional) Function to use for error logging
24
+ */
25
+ constructor(pInfoLog?: Function, pErrorLog?: Function);
26
+ logInfo: Function;
27
+ logError: Function;
24
28
  getObjectValueClass: libGetObjectValue;
25
- checkAddressExists(pObject: any, pAddress: any, pRootObject: any): any;
29
+ cleanWrapCharacters: (pCharacter: string, pString: string) => string;
30
+ /**
31
+ * Check if an address exists.
32
+ *
33
+ * This is necessary because the getValueAtAddress function is ambiguous on
34
+ * whether the element/property is actually there or not (it returns
35
+ * undefined whether the property exists or not). This function checks for
36
+ * existance and returns true or false dependent.
37
+ *
38
+ * @param {object} pObject - The object to check within
39
+ * @param {string} pAddress - The address to check for
40
+ * @param {object} [pRootObject] - (optional) The root object for function resolution context
41
+ *
42
+ * @return {boolean} - True if the address exists, false if it does not
43
+ */
44
+ checkAddressExists(pObject: object, pAddress: string, pRootObject?: object): boolean;
26
45
  }
27
46
  import libGetObjectValue = require("./Manyfest-ObjectAddress-GetValue.js");
28
47
  //# sourceMappingURL=Manyfest-ObjectAddress-CheckAddressExists.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-ObjectAddress-CheckAddressExists.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-CheckAddressExists.js"],"names":[],"mappings":";AAUA;;;;;;;;;;;;;;;;;EAiBE;AACF;IAEC,2CAOC;IAJA,aAAyE;IACzE,cAA4E;IAE5E,uCAA6E;IAS9E,uEA0SC;CACD"}
1
+ {"version":3,"file":"Manyfest-ObjectAddress-CheckAddressExists.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-CheckAddressExists.js"],"names":[],"mappings":";AAYA;;;;;;;;;;;;;;;;;EAiBE;AACF;IAEC;;;OAGG;IACH,uDAQC;IALA,kBAAyE;IACzE,mBAA4E;IAE5E,uCAA6E;IAC7E,qEAA+C;IAGhD;;;;;;;;;;;;;OAaG;IACH,4BANW,MAAM,YACN,MAAM,gBACN,MAAM,GAEL,OAAO,CA4SlB;CACD"}
@@ -20,11 +20,30 @@ export = ManyfestObjectAddressResolverDeleteValue;
20
20
  * @class ManyfestObjectAddressResolverDeleteValue
21
21
  */
22
22
  declare class ManyfestObjectAddressResolverDeleteValue {
23
- constructor(pInfoLog: any, pErrorLog: any);
24
- logInfo: any;
25
- logError: any;
26
- cleanWrapCharacters: (pCharacter: any, pString: any) => any;
27
- checkRecordFilters(pAddress: any, pRecord: any): boolean;
28
- deleteValueAtAddress(pObject: any, pAddress: any, pParentAddress: any): any;
23
+ /**
24
+ * @param {function} [pInfoLog] - (optional) A logging function for info messages
25
+ * @param {function} [pErrorLog] - (optional) A logging function for error messages
26
+ */
27
+ constructor(pInfoLog?: Function, pErrorLog?: Function);
28
+ logInfo: Function;
29
+ logError: Function;
30
+ cleanWrapCharacters: (pCharacter: string, pString: string) => string;
31
+ /**
32
+ * @param {string} pAddress - The address being evaluated
33
+ * @param {object} pRecord - The record being evaluated
34
+ *
35
+ * @return {boolean} True if the record passes the filters, false if it does not
36
+ */
37
+ checkRecordFilters(pAddress: string, pRecord: object): boolean;
38
+ /**
39
+ * Delete the value of an element at an address
40
+ *
41
+ * @param {object} pObject - The object to delete the value from
42
+ * @param {string} pAddress - The address to delete the value at
43
+ * @param {string} [pParentAddress] - (optional) The parent address for recursion
44
+ *
45
+ * @return {boolean|object|undefined} - True if the value was deleted, false if it could not be deleted, undefined on error
46
+ */
47
+ deleteValueAtAddress(pObject: object, pAddress: string, pParentAddress?: string): boolean | object | undefined;
29
48
  }
30
49
  //# sourceMappingURL=Manyfest-ObjectAddress-DeleteValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-ObjectAddress-DeleteValue.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-DeleteValue.js"],"names":[],"mappings":";AAOA;;;;;;;;;;;;;;;;;;;EAmBE;AACF;IAEC,2CAOC;IAJA,aAAyE;IACzE,cAA4E;IAE5E,4DAA+C;IAIhD,yDAGC;IAGD,4EAkTC;CACD"}
1
+ {"version":3,"file":"Manyfest-ObjectAddress-DeleteValue.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-DeleteValue.js"],"names":[],"mappings":";AAOA;;;;;;;;;;;;;;;;;;;EAmBE;AACF;IAEC;;;OAGG;IACH,uDAOC;IAJA,kBAAyE;IACzE,mBAA4E;IAE5E,qEAA+C;IAIhD;;;;;OAKG;IACH,6BALW,MAAM,WACN,MAAM,GAEL,OAAO,CAKlB;IAED;;;;;;;;OAQG;IACH,8BANW,MAAM,YACN,MAAM,mBACN,MAAM,GAEL,OAAO,GAAC,MAAM,GAAC,SAAS,CAoTnC;CACD"}
@@ -20,11 +20,31 @@ export = ManyfestObjectAddressResolverGetValue;
20
20
  * @class ManyfestObjectAddressResolverGetValue
21
21
  */
22
22
  declare class ManyfestObjectAddressResolverGetValue {
23
- constructor(pInfoLog: any, pErrorLog: any);
24
- logInfo: any;
25
- logError: any;
26
- cleanWrapCharacters: (pCharacter: any, pString: any) => any;
27
- checkRecordFilters(pAddress: any, pRecord: any): boolean;
28
- getValueAtAddress(pObject: any, pAddress: any, pParentAddress: any, pRootObject: any): any;
23
+ /**
24
+ * @param {function} [pInfoLog] - (optional) A logging function for info messages
25
+ * @param {function} [pErrorLog] - (optional) A logging function for error messages
26
+ */
27
+ constructor(pInfoLog?: Function, pErrorLog?: Function);
28
+ logInfo: Function;
29
+ logError: Function;
30
+ cleanWrapCharacters: (pCharacter: string, pString: string) => string;
31
+ /**
32
+ * @param {string} pAddress - The address of the record to check
33
+ * @param {object} pRecord - The record to check against the filters
34
+ *
35
+ * @return {boolean} - True if the record passes the filters, false otherwise
36
+ */
37
+ checkRecordFilters(pAddress: string, pRecord: object): boolean;
38
+ /**
39
+ * Get the value of an element at an address
40
+ *
41
+ * @param {object} pObject - The object to resolve the address against
42
+ * @param {string} pAddress - The address to resolve
43
+ * @param {string} [pParentAddress] - (optional) The parent address for back-navigation
44
+ * @param {object} [pRootObject] - (optional) The root object for function argument resolution
45
+ *
46
+ * @return {any} The value at the address, or undefined if not found
47
+ */
48
+ getValueAtAddress(pObject: object, pAddress: string, pParentAddress?: string, pRootObject?: object): any;
29
49
  }
30
50
  //# sourceMappingURL=Manyfest-ObjectAddress-GetValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-ObjectAddress-GetValue.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-GetValue.js"],"names":[],"mappings":";AASA;;;;;;;;;;;;;;;;;;;EAmBE;AACF;IAEC,2CAOC;IAJA,aAAyE;IACzE,cAA4E;IAE5E,4DAA+C;IAGhD,yDAGC;IAGD,2FAwkBC;CACD"}
1
+ {"version":3,"file":"Manyfest-ObjectAddress-GetValue.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-GetValue.js"],"names":[],"mappings":";AASA;;;;;;;;;;;;;;;;;;;EAmBE;AACF;IAEC;;;OAGG;IACH,uDAOC;IAJA,kBAAyE;IACzE,mBAA4E;IAE5E,qEAA+C;IAGhD;;;;;OAKG;IACH,6BALW,MAAM,WACN,MAAM,GAEL,OAAO,CAKlB;IAED;;;;;;;;;OASG;IACH,2BAPW,MAAM,YACN,MAAM,mBACN,MAAM,gBACN,MAAM,GAEL,GAAG,CA0kBd;CACD"}
@@ -1,6 +1,6 @@
1
- export function stringCountSegments(pString: string, pSeparator: string, pEnclosureStartSymbolMap: object, pEnclosureEndSymbolMap: object): number;
2
- export function stringGetFirstSegment(pString: string, pSeparator: string, pEnclosureStartSymbolMap: object, pEnclosureEndSymbolMap: object): string | 0;
3
- export function stringGetSegments(pString: string, pSeparator: string, pEnclosureStartSymbolMap: object, pEnclosureEndSymbolMap: object): any[];
4
- export function stringCountEnclosures(pString: string, pEnclosureStart: string, pEnclosureEnd: string): number;
5
- export function stringGetEnclosureValueByIndex(pString: string, pEnclosureIndexToGet: number, pEnclosureStart: string, pEnclosureEnd: any): string;
1
+ export function stringCountSegments(pString: string, pSeparator?: string, pEnclosureStartSymbolMap?: Record<string, number>, pEnclosureEndSymbolMap?: Record<string, number>): number;
2
+ export function stringGetFirstSegment(pString: string, pSeparator?: string, pEnclosureStartSymbolMap?: Record<string, number>, pEnclosureEndSymbolMap?: Record<string, number>): string;
3
+ export function stringGetSegments(pString: string, pSeparator?: string, pEnclosureStartSymbolMap?: Record<string, number>, pEnclosureEndSymbolMap?: Record<string, number>): Array<string>;
4
+ export function stringCountEnclosures(pString: string, pEnclosureStart?: string, pEnclosureEnd?: string): number;
5
+ export function stringGetEnclosureValueByIndex(pString: string, pEnclosureIndexToGet: number, pEnclosureStart?: string, pEnclosureEnd?: string): string;
6
6
  //# sourceMappingURL=Manyfest-ObjectAddress-Parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-ObjectAddress-Parser.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-Parser.js"],"names":[],"mappings":"AAoBsB,6CANV,MAAM,cACN,MAAM,4BACN,MAAM,0BACN,MAAM,UA+ChB;AAWsB,+CANZ,MAAM,cACN,MAAM,4BACN,MAAM,0BACN,MAAM,cA8ChB;AAWkB,2CANR,MAAM,cACN,MAAM,4BACN,MAAM,0BACN,MAAM,SAuDhB;AAYsB,+CALZ,MAAM,mBACN,MAAM,iBACN,MAAM,UA6BhB;AAc+B,wDANrB,MAAM,wBACN,MAAM,mBACN,MAAM,uBAEJ,MAAM,CAiElB"}
1
+ {"version":3,"file":"Manyfest-ObjectAddress-Parser.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-Parser.js"],"names":[],"mappings":"AAwBsB,6CAPV,MAAM,eACN,MAAM,6BACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,2BACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAErB,MAAM,CA8CjB;AAYsB,+CAPZ,MAAM,eACN,MAAM,6BACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,2BACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAErB,MAAM,CA6CjB;AAYkB,2CAPR,MAAM,eACN,MAAM,6BACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,2BACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAErB,KAAK,CAAC,MAAM,CAAC,CAsDxB;AAYsB,+CALZ,MAAM,oBACN,MAAM,kBACN,MAAM,UA6BhB;AAe+B,wDAPrB,MAAM,wBACN,MAAM,oBACN,MAAM,kBACN,MAAM,GAEL,MAAM,CAiEjB"}