manyfest 1.0.41 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/manyfest.compatible.js +498 -182
  2. package/dist/manyfest.compatible.js.map +1 -0
  3. package/dist/manyfest.compatible.min.js +1 -1
  4. package/dist/manyfest.compatible.min.js.map +1 -1
  5. package/dist/manyfest.js +487 -173
  6. package/dist/manyfest.js.map +1 -0
  7. package/dist/manyfest.min.js +1 -1
  8. package/dist/manyfest.min.js.map +1 -1
  9. package/package.json +3 -3
  10. package/source/Manyfest-CleanWrapCharacters.js +7 -1
  11. package/source/Manyfest-HashTranslation.js +29 -8
  12. package/source/Manyfest-ObjectAddress-CheckAddressExists.js +28 -13
  13. package/source/Manyfest-ObjectAddress-DeleteValue.js +20 -2
  14. package/source/Manyfest-ObjectAddress-GetValue.js +23 -4
  15. package/source/Manyfest-ObjectAddress-Parser.js +39 -32
  16. package/source/Manyfest-ObjectAddress-SetValue.js +14 -2
  17. package/source/Manyfest-ObjectAddressGeneration.js +23 -12
  18. package/source/Manyfest-ParseConditionals.js +3 -3
  19. package/source/Manyfest-SchemaManipulation.js +44 -21
  20. package/source/Manyfest.js +69 -9
  21. package/test/Manyfest_Object_Read_tests.js +13 -0
  22. package/test/Manyfest_Performance_tests.js +48 -0
  23. package/types/Manyfest-CleanWrapCharacters.d.ts +7 -1
  24. package/types/Manyfest-CleanWrapCharacters.d.ts.map +1 -1
  25. package/types/Manyfest-HashTranslation.d.ts +34 -7
  26. package/types/Manyfest-HashTranslation.d.ts.map +1 -1
  27. package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts +23 -4
  28. package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts.map +1 -1
  29. package/types/Manyfest-ObjectAddress-DeleteValue.d.ts +25 -6
  30. package/types/Manyfest-ObjectAddress-DeleteValue.d.ts.map +1 -1
  31. package/types/Manyfest-ObjectAddress-GetValue.d.ts +26 -6
  32. package/types/Manyfest-ObjectAddress-GetValue.d.ts.map +1 -1
  33. package/types/Manyfest-ObjectAddress-Parser.d.ts +5 -5
  34. package/types/Manyfest-ObjectAddress-Parser.d.ts.map +1 -1
  35. package/types/Manyfest-ObjectAddress-SetValue.d.ts +18 -5
  36. package/types/Manyfest-ObjectAddress-SetValue.d.ts.map +1 -1
  37. package/types/Manyfest-ObjectAddressGeneration.d.ts +25 -4
  38. package/types/Manyfest-ObjectAddressGeneration.d.ts.map +1 -1
  39. package/types/Manyfest-SchemaManipulation.d.ts +47 -6
  40. package/types/Manyfest-SchemaManipulation.d.ts.map +1 -1
  41. package/types/Manyfest.d.ts +36 -12
  42. package/types/Manyfest.d.ts.map +1 -1
@@ -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
@@ -197,18 +231,26 @@ class Manyfest extends libFableServiceProviderBase
197
231
  {
198
232
  for (let i = 0; i < tmpManifest.HashTranslations.length; i++)
199
233
  {
200
- // Each translation is
234
+ // Each translation is
235
+ //FIXME: ?????????
201
236
  }
202
237
  }
203
238
  }
204
239
  }
205
240
 
206
- // Serialize the Manifest to a string
241
+ /**
242
+ * Serialize the Manifest to a string
243
+ *
244
+ * @return {string} - The serialized manifest
245
+ */
207
246
  serialize()
208
247
  {
209
248
  return JSON.stringify(this.getManifest());
210
249
  }
211
250
 
251
+ /**
252
+ * @return {{ Scope: string, Descriptors: Record<string, ManifestDescriptor>, HashTranslations: Record<string, string> }} - A copy of the manifest state.
253
+ */
212
254
  getManifest()
213
255
  {
214
256
  return (
@@ -362,21 +404,37 @@ class Manyfest extends libFableServiceProviderBase
362
404
  return tmpValue;
363
405
  }
364
406
 
407
+ lintAddress(pAddress)
408
+ {
409
+ let tmpLintedAddress = pAddress.trim();
410
+ // Check for a single . (but not a ..) at the end of the address and remove it.
411
+ if (tmpLintedAddress.endsWith('..'))
412
+ {
413
+ tmpLintedAddress = tmpLintedAddress.slice(0, -1);
414
+ }
415
+ else if (tmpLintedAddress.endsWith('.'))
416
+ {
417
+ tmpLintedAddress = tmpLintedAddress.slice(0, -1);
418
+ }
419
+
420
+ return tmpLintedAddress;
421
+ }
422
+
365
423
  // Get the value of an element at an address
366
424
  getValueAtAddress (pObject, pAddress)
367
425
  {
368
- let tmpLintedAddress = pAddress.trim();
426
+ let tmpLintedAddress = this.lintAddress(pAddress);
369
427
  if (tmpLintedAddress == '')
370
428
  {
371
429
  this.logError(`(${this.scope}) Error getting value at address; address is an empty string.`, pObject);
372
430
  return undefined;
373
431
  }
374
- let tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject, pAddress);
432
+ let tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject, tmpLintedAddress);
375
433
 
376
434
  if (typeof(tmpValue) == 'undefined')
377
435
  {
378
436
  // Try to get a default if it exists
379
- tmpValue = this.getDefaultValue(this.getDescriptor(pAddress));
437
+ tmpValue = this.getDefaultValue(this.getDescriptor(tmpLintedAddress));
380
438
  }
381
439
 
382
440
  return tmpValue;
@@ -391,7 +449,8 @@ class Manyfest extends libFableServiceProviderBase
391
449
  // Set the value of an element at an address
392
450
  setValueAtAddress (pObject, pAddress, pValue)
393
451
  {
394
- return this.objectAddressSetValue.setValueAtAddress(pObject, pAddress, pValue);
452
+ let tmpLintedAddress = this.lintAddress(pAddress);
453
+ return this.objectAddressSetValue.setValueAtAddress(pObject, tmpLintedAddress, pValue);
395
454
  }
396
455
 
397
456
  // Delete the value of an element by its hash
@@ -403,7 +462,8 @@ class Manyfest extends libFableServiceProviderBase
403
462
  // Delete the value of an element at an address
404
463
  deleteValueAtAddress (pObject, pAddress, pValue)
405
464
  {
406
- return this.objectAddressDeleteValue.deleteValueAtAddress(pObject, pAddress, pValue);
465
+ let tmpLintedAddress = this.lintAddress(pAddress);
466
+ return this.objectAddressDeleteValue.deleteValueAtAddress(pObject, tmpLintedAddress, pValue);
407
467
  }
408
468
 
409
469
  // Validate the consistency of an object against the schema
@@ -160,6 +160,19 @@ suite
160
160
  }
161
161
  );
162
162
  test
163
+ (
164
+ 'Access relative objects with invalid dots',
165
+ (fTestComplete)=>
166
+ {
167
+ let _Manyfest = new libManyfest();
168
+ Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'location.city')).to.equal('Sunnyvale');
169
+ Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'location.city.')).to.equal('Sunnyvale');
170
+ Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'current_observation.wind.').chill).to.equal(59);
171
+ Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'current_observation.BadObjectPropertyName.')).to.equal(undefined);
172
+ fTestComplete();
173
+ }
174
+ );
175
+ test
163
176
  (
164
177
  'Access specific array elements',
165
178
  (fTestComplete)=>
@@ -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"}
@@ -18,10 +18,23 @@ export = ManyfestObjectAddressSetValue;
18
18
  * @class ManyfestObjectAddressSetValue
19
19
  */
20
20
  declare class ManyfestObjectAddressSetValue {
21
- constructor(pInfoLog: any, pErrorLog: any);
22
- logInfo: any;
23
- logError: any;
24
- cleanWrapCharacters: (pCharacter: any, pString: any) => any;
25
- setValueAtAddress(pObject: any, pAddress: any, pValue: any): any;
21
+ /**
22
+ * @param {function} [pInfoLog] - (optional) A logging function for info messages
23
+ * @param {function} [pErrorLog] - (optional) A logging function for error messages
24
+ */
25
+ constructor(pInfoLog?: Function, pErrorLog?: Function);
26
+ logInfo: Function;
27
+ logError: Function;
28
+ cleanWrapCharacters: (pCharacter: string, pString: string) => string;
29
+ /**
30
+ * Set the value of an element at an address
31
+ *
32
+ * @param {object} pObject - The object to set the value in
33
+ * @param {string} pAddress - The address to set the value at
34
+ * @param {any} pValue - The value to set at the address
35
+ *
36
+ * @return {boolean} True if the value was set, false otherwise
37
+ */
38
+ setValueAtAddress(pObject: object, pAddress: string, pValue: any): boolean;
26
39
  }
27
40
  //# sourceMappingURL=Manyfest-ObjectAddress-SetValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-ObjectAddress-SetValue.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-SetValue.js"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;;;;EAiBE;AACF;IAEC,2CAOC;IAJA,aAAyE;IACzE,cAA4E;IAE5E,4DAA+C;IAIhD,iEAgOC;CACD"}
1
+ {"version":3,"file":"Manyfest-ObjectAddress-SetValue.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddress-SetValue.js"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;;;;EAiBE;AACF;IAEC;;;OAGG;IACH,uDAOC;IAJA,kBAAyE;IACzE,mBAA4E;IAE5E,qEAA+C;IAGhD;;;;;;;;OAQG;IACH,2BANW,MAAM,YACN,MAAM,UACN,GAAG,GAEF,OAAO,CAkOlB;CACD"}
@@ -22,9 +22,30 @@ export = ManyfestObjectAddressGeneration;
22
22
  * @class ManyfestObjectAddressGeneration
23
23
  */
24
24
  declare class ManyfestObjectAddressGeneration {
25
- constructor(pInfoLog: any, pErrorLog: any);
26
- logInfo: any;
27
- logError: any;
28
- generateAddressses(pObject: any, pBaseAddress: any, pSchema: any): any;
25
+ /**
26
+ * @param {function} [pInfoLog] - (optional) A logging function for info messages
27
+ * @param {function} [pErrorLog] - (optional) A logging function for error messages
28
+ */
29
+ constructor(pInfoLog?: Function, pErrorLog?: Function);
30
+ logInfo: Function;
31
+ logError: Function;
32
+ /**
33
+ * generateAddressses
34
+ *
35
+ * This flattens an object into a set of key:value pairs for *EVERY SINGLE
36
+ * POSSIBLE ADDRESS* in the object. It can get ... really insane really
37
+ * quickly. This is not meant to be used directly to generate schemas, but
38
+ * instead as a starting point for scripts or UIs.
39
+ *
40
+ * This will return a mega set of key:value pairs with all possible schema
41
+ * permutations and default values (when not an object) and everything else.
42
+ *
43
+ * @param {any} pObject - The object to generate addresses for
44
+ * @param {string} [pBaseAddress] - (optional) The base address to start from
45
+ * @param {object} [pSchema] - (optional) The schema object to append to
46
+ *
47
+ * @return {object} The generated schema object
48
+ */
49
+ generateAddressses(pObject: any, pBaseAddress?: string, pSchema?: object): object;
29
50
  }
30
51
  //# sourceMappingURL=Manyfest-ObjectAddressGeneration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manyfest-ObjectAddressGeneration.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddressGeneration.js"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;;;;;;;;EAqBE;AACF;IAEC,2CAKC;IAFA,aAAyE;IACzE,cAA4E;IAY7E,uEA+EC;CACD"}
1
+ {"version":3,"file":"Manyfest-ObjectAddressGeneration.d.ts","sourceRoot":"","sources":["../source/Manyfest-ObjectAddressGeneration.js"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;;;;;;;;EAqBE;AACF;IAEC;;;OAGG;IACH,uDAKC;IAFA,kBAAyE;IACzE,mBAA4E;IAG7E;;;;;;;;;;;;;;;;OAgBG;IACH,4BANW,GAAG,iBACH,MAAM,YACN,MAAM,GAEL,MAAM,CAgFjB;CACD"}