manyfest 1.0.39 → 1.0.41
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/package.json +6 -3
- package/source/Manyfest-ObjectAddress-CheckAddressExists.js +7 -3
- package/source/Manyfest-ObjectAddress-SetValue.js +34 -6
- package/source/Manyfest.js +41 -4
- package/test/Manyfest_Object_Write_tests.js +46 -0
- package/tsconfig.json +15 -0
- package/types/Manyfest-Browser-Shim.d.ts +3 -0
- package/types/Manyfest-Browser-Shim.d.ts.map +1 -0
- package/types/Manyfest-CleanWrapCharacters.d.ts +3 -0
- package/types/Manyfest-CleanWrapCharacters.d.ts.map +1 -0
- package/types/Manyfest-HashTranslation.d.ts +29 -0
- package/types/Manyfest-HashTranslation.d.ts.map +1 -0
- package/types/Manyfest-LogToConsole.d.ts +9 -0
- package/types/Manyfest-LogToConsole.d.ts.map +1 -0
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts +28 -0
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts.map +1 -0
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts +30 -0
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts.map +1 -0
- package/types/Manyfest-ObjectAddress-GetValue.d.ts +30 -0
- package/types/Manyfest-ObjectAddress-GetValue.d.ts.map +1 -0
- package/types/Manyfest-ObjectAddress-Parser.d.ts +6 -0
- package/types/Manyfest-ObjectAddress-Parser.d.ts.map +1 -0
- package/types/Manyfest-ObjectAddress-SetValue.d.ts +27 -0
- package/types/Manyfest-ObjectAddress-SetValue.d.ts.map +1 -0
- package/types/Manyfest-ObjectAddressGeneration.d.ts +30 -0
- package/types/Manyfest-ObjectAddressGeneration.d.ts.map +1 -0
- package/types/Manyfest-ParseConditionals.d.ts +3 -0
- package/types/Manyfest-ParseConditionals.d.ts.map +1 -0
- package/types/Manyfest-SchemaManipulation.d.ts +15 -0
- package/types/Manyfest-SchemaManipulation.d.ts.map +1 -0
- package/types/Manyfest.d.ts +119 -0
- package/types/Manyfest.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "manyfest",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"description": "JSON Object Manifest for Data Description and Parsing",
|
|
5
5
|
"main": "source/Manyfest.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
"build": "npx quack build",
|
|
14
14
|
"build-compatible": "GULP_CUSTOM_BUILD_TARGET=compatible ./node_modules/.bin/gulp build",
|
|
15
15
|
"docker-dev-build": "docker build ./ -f Dockerfile_LUXURYCode -t manyfest-image:local",
|
|
16
|
-
"docker-dev-shell": "docker exec -it manyfest-dev /bin/bash"
|
|
16
|
+
"docker-dev-shell": "docker exec -it manyfest-dev /bin/bash",
|
|
17
|
+
"types": "tsc -p ."
|
|
17
18
|
},
|
|
19
|
+
"types": "types/Manyfest.d.ts",
|
|
18
20
|
"repository": {
|
|
19
21
|
"type": "git",
|
|
20
22
|
"url": "git+https://github.com/stevenvelozo/manyfest.git"
|
|
@@ -47,7 +49,8 @@
|
|
|
47
49
|
"fable-serviceproviderbase": "^3.0.15"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
|
-
"quackage": "^1.0.41"
|
|
52
|
+
"quackage": "^1.0.41",
|
|
53
|
+
"typescript": "^5.8.3"
|
|
51
54
|
},
|
|
52
55
|
"author": "steven velozo <steven@velozo.com>",
|
|
53
56
|
"license": "MIT",
|
|
@@ -28,9 +28,13 @@ let _MockFable = { DataFormat: require('./Manyfest-ObjectAddress-Parser.js') };
|
|
|
28
28
|
*/
|
|
29
29
|
class ManyfestObjectAddressResolverCheckAddressExists
|
|
30
30
|
{
|
|
31
|
-
constructor()
|
|
31
|
+
constructor(pInfoLog, pErrorLog)
|
|
32
32
|
{
|
|
33
|
-
|
|
33
|
+
// Wire in logging
|
|
34
|
+
this.logInfo = (typeof(pInfoLog) == 'function') ? pInfoLog : libSimpleLog;
|
|
35
|
+
this.logError = (typeof(pErrorLog) == 'function') ? pErrorLog : libSimpleLog;
|
|
36
|
+
|
|
37
|
+
this.getObjectValueClass = new libGetObjectValue(this.logInfo, this.logError);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
// Check if an address exists.
|
|
@@ -340,4 +344,4 @@ class ManyfestObjectAddressResolverCheckAddressExists
|
|
|
340
344
|
}
|
|
341
345
|
};
|
|
342
346
|
|
|
343
|
-
module.exports = ManyfestObjectAddressResolverCheckAddressExists;
|
|
347
|
+
module.exports = ManyfestObjectAddressResolverCheckAddressExists;
|
|
@@ -66,6 +66,24 @@ class ManyfestObjectAddressSetValue
|
|
|
66
66
|
// The "Name" of the Object contained too the left of the bracket
|
|
67
67
|
let tmpBoxedPropertyName = pAddress.substring(0, tmpBracketStartIndex).trim();
|
|
68
68
|
|
|
69
|
+
// The "Reference" to the property within it, either an array element or object property
|
|
70
|
+
let tmpBoxedPropertyReference = pAddress.substring(tmpBracketStartIndex+1, tmpBracketStopIndex).trim();
|
|
71
|
+
// Attempt to parse the reference as a number, which will be used as an array element
|
|
72
|
+
let tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
73
|
+
let tmpIndexIsNumeric = !isNaN(tmpBoxedPropertyNumber);
|
|
74
|
+
|
|
75
|
+
if (pObject[tmpBoxedPropertyName] == null)
|
|
76
|
+
{
|
|
77
|
+
if (tmpIndexIsNumeric)
|
|
78
|
+
{
|
|
79
|
+
pObject[tmpBoxedPropertyName] = [];
|
|
80
|
+
}
|
|
81
|
+
else
|
|
82
|
+
{
|
|
83
|
+
pObject[tmpBoxedPropertyName] = {};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
69
87
|
// If the subproperty doesn't test as a proper Object, none of the rest of this is possible.
|
|
70
88
|
// This is a rare case where Arrays testing as Objects is useful
|
|
71
89
|
if (typeof(pObject[tmpBoxedPropertyName]) !== 'object')
|
|
@@ -73,11 +91,6 @@ class ManyfestObjectAddressSetValue
|
|
|
73
91
|
return false;
|
|
74
92
|
}
|
|
75
93
|
|
|
76
|
-
// The "Reference" to the property within it, either an array element or object property
|
|
77
|
-
let tmpBoxedPropertyReference = pAddress.substring(tmpBracketStartIndex+1, tmpBracketStopIndex).trim();
|
|
78
|
-
// Attempt to parse the reference as a number, which will be used as an array element
|
|
79
|
-
let tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
80
|
-
|
|
81
94
|
// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
82
95
|
// This seems confusing to me at first read, so explaination:
|
|
83
96
|
// Is the Boxed Object an Array? TRUE
|
|
@@ -105,6 +118,7 @@ class ManyfestObjectAddressSetValue
|
|
|
105
118
|
}
|
|
106
119
|
|
|
107
120
|
// Return the value in the property
|
|
121
|
+
//TODO: For cases where we have chained [][] properties, this needs to recurse somehow
|
|
108
122
|
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference] = pValue;
|
|
109
123
|
return true;
|
|
110
124
|
}
|
|
@@ -156,6 +170,20 @@ class ManyfestObjectAddressSetValue
|
|
|
156
170
|
let tmpBoxedPropertyReference = tmpSubObjectName.substring(tmpBracketStartIndex+1, tmpBracketStopIndex).trim();
|
|
157
171
|
|
|
158
172
|
let tmpBoxedPropertyNumber = parseInt(tmpBoxedPropertyReference, 10);
|
|
173
|
+
let tmpIndexIsNumeric = !isNaN(tmpBoxedPropertyNumber);
|
|
174
|
+
|
|
175
|
+
//if (typeof(pObject[tmpBoxedPropertyName]) !== 'object')
|
|
176
|
+
if (pObject[tmpBoxedPropertyName] == null)
|
|
177
|
+
{
|
|
178
|
+
if (tmpIndexIsNumeric)
|
|
179
|
+
{
|
|
180
|
+
pObject[tmpBoxedPropertyName] = [];
|
|
181
|
+
}
|
|
182
|
+
else
|
|
183
|
+
{
|
|
184
|
+
pObject[tmpBoxedPropertyName] = {};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
159
187
|
|
|
160
188
|
// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
161
189
|
// This seems confusing to me at first read, so explaination:
|
|
@@ -171,7 +199,7 @@ class ManyfestObjectAddressSetValue
|
|
|
171
199
|
// BUT
|
|
172
200
|
// StudentData.Sections.Algebra.Students is an array, so the ["JaneDoe"].Grade is not possible to access
|
|
173
201
|
// TODO: Should this be an error or something? Should we keep a log of failures like this?
|
|
174
|
-
if (Array.isArray(pObject[tmpBoxedPropertyName])
|
|
202
|
+
if (Array.isArray(pObject[tmpBoxedPropertyName]) != tmpIndexIsNumeric)
|
|
175
203
|
{
|
|
176
204
|
return false;
|
|
177
205
|
}
|
package/source/Manyfest.js
CHANGED
|
@@ -15,6 +15,18 @@ let libSchemaManipulation = require('./Manyfest-SchemaManipulation.js');
|
|
|
15
15
|
|
|
16
16
|
const _DefaultConfiguration = { Scope:'DEFAULT', Descriptors: {} }
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {{
|
|
20
|
+
* Hash?: string,
|
|
21
|
+
* Name?: string,
|
|
22
|
+
* DataType?: string,
|
|
23
|
+
* Required?: boolean,
|
|
24
|
+
* Address?: string,
|
|
25
|
+
* Description?: string,
|
|
26
|
+
* [key: string]: any,
|
|
27
|
+
* }} ManifestDescriptor
|
|
28
|
+
*/
|
|
29
|
+
|
|
18
30
|
/**
|
|
19
31
|
* Manyfest object address-based descriptions and manipulations.
|
|
20
32
|
*
|
|
@@ -33,6 +45,9 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
33
45
|
super(pFable, pManifest, pServiceHash);
|
|
34
46
|
}
|
|
35
47
|
|
|
48
|
+
/** @type {Record<string, any>} */
|
|
49
|
+
this.options;
|
|
50
|
+
|
|
36
51
|
this.serviceType = 'Manifest';
|
|
37
52
|
|
|
38
53
|
// Wire in logging
|
|
@@ -204,7 +219,12 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
204
219
|
});
|
|
205
220
|
}
|
|
206
221
|
|
|
207
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Add a descriptor to the manifest
|
|
224
|
+
*
|
|
225
|
+
* @param {string} pAddress - The address of the element to add the descriptor for.
|
|
226
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor object to add.
|
|
227
|
+
*/
|
|
208
228
|
addDescriptor(pAddress, pDescriptor)
|
|
209
229
|
{
|
|
210
230
|
if (typeof(pDescriptor) === 'object')
|
|
@@ -246,17 +266,30 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
246
266
|
}
|
|
247
267
|
}
|
|
248
268
|
|
|
269
|
+
/**
|
|
270
|
+
* @param {string} pHash - The hash of the address to resolve.
|
|
271
|
+
*
|
|
272
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
273
|
+
*/
|
|
249
274
|
getDescriptorByHash(pHash)
|
|
250
275
|
{
|
|
251
276
|
return this.getDescriptor(this.resolveHashAddress(pHash));
|
|
252
277
|
}
|
|
253
278
|
|
|
279
|
+
/**
|
|
280
|
+
* @param {string} pAddress - The address of the element to get the descriptor for.
|
|
281
|
+
*
|
|
282
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
283
|
+
*/
|
|
254
284
|
getDescriptor(pAddress)
|
|
255
285
|
{
|
|
256
286
|
return this.elementDescriptors[pAddress];
|
|
257
287
|
}
|
|
258
288
|
|
|
259
|
-
|
|
289
|
+
/**
|
|
290
|
+
* execute an action function for each descriptor
|
|
291
|
+
* @param {(d: ManifestDescriptor) => void} fAction - The action function to execute for each descriptor.
|
|
292
|
+
*/
|
|
260
293
|
eachDescriptor(fAction)
|
|
261
294
|
{
|
|
262
295
|
let tmpDescriptorAddresses = Object.keys(this.elementDescriptors);
|
|
@@ -489,7 +522,11 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
489
522
|
return tmpValidationData;
|
|
490
523
|
}
|
|
491
524
|
|
|
492
|
-
|
|
525
|
+
/**
|
|
526
|
+
* Returns a default value, or, the default value for the data type (which is overridable with configuration)
|
|
527
|
+
*
|
|
528
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor definition.
|
|
529
|
+
*/
|
|
493
530
|
getDefaultValue(pDescriptor)
|
|
494
531
|
{
|
|
495
532
|
if (typeof(pDescriptor) != 'object')
|
|
@@ -560,4 +597,4 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
560
597
|
}
|
|
561
598
|
};
|
|
562
599
|
|
|
563
|
-
module.exports = Manyfest;
|
|
600
|
+
module.exports = Manyfest;
|
|
@@ -165,6 +165,52 @@ suite
|
|
|
165
165
|
fTestComplete();
|
|
166
166
|
}
|
|
167
167
|
);
|
|
168
|
+
test
|
|
169
|
+
(
|
|
170
|
+
'Indexed subobject are settable',
|
|
171
|
+
(fTestComplete)=>
|
|
172
|
+
{
|
|
173
|
+
let _Manyfest = new libManyfest({});
|
|
174
|
+
let _SimpleObject = {};
|
|
175
|
+
_Manyfest.setValueAtAddress(_SimpleObject, `_Object['SubObject'].Property`, '123');
|
|
176
|
+
Expect(_Manyfest.getValueAtAddress(_SimpleObject, `_Object.SubObject.Property`))
|
|
177
|
+
.to.equal('123');
|
|
178
|
+
Expect(_SimpleObject._Object.SubObject.Property)
|
|
179
|
+
.to.equal('123');
|
|
180
|
+
fTestComplete();
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
test
|
|
184
|
+
(
|
|
185
|
+
'Indexed subobject are settable unquoted',
|
|
186
|
+
(fTestComplete)=>
|
|
187
|
+
{
|
|
188
|
+
let _Manyfest = new libManyfest({});
|
|
189
|
+
let _SimpleObject = {};
|
|
190
|
+
_Manyfest.setValueAtAddress(_SimpleObject, `_Object[SubObject].Property`, '123');
|
|
191
|
+
Expect(_Manyfest.getValueAtAddress(_SimpleObject, `_Object.SubObject.Property`))
|
|
192
|
+
.to.equal('123');
|
|
193
|
+
Expect(_SimpleObject._Object.SubObject.Property)
|
|
194
|
+
.to.equal('123');
|
|
195
|
+
fTestComplete();
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
//TODO: known broken case for multiple bracketed properties
|
|
199
|
+
test.skip
|
|
200
|
+
(
|
|
201
|
+
'Indexed subobject are settable double brackets',
|
|
202
|
+
(fTestComplete)=>
|
|
203
|
+
{
|
|
204
|
+
let _Manyfest = new libManyfest({});
|
|
205
|
+
let _SimpleObject = {};
|
|
206
|
+
_Manyfest.setValueAtAddress(_SimpleObject, `_Object[SubObject]['Property']`, '123');
|
|
207
|
+
Expect(_Manyfest.getValueAtAddress(_SimpleObject, `_Object.SubObject.Property`))
|
|
208
|
+
.to.equal('123');
|
|
209
|
+
Expect(_SimpleObject._Object.SubObject.Property)
|
|
210
|
+
.to.equal('123');
|
|
211
|
+
fTestComplete();
|
|
212
|
+
}
|
|
213
|
+
);
|
|
168
214
|
}
|
|
169
215
|
);
|
|
170
216
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["source"],
|
|
3
|
+
"compilerOptions":
|
|
4
|
+
{
|
|
5
|
+
"lib": ["es5", "es6", "dom"],
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"outDir": "types",
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"resolveJsonModule": true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manyfest-Browser-Shim.d.ts","sourceRoot":"","sources":["../source/Manyfest-Browser-Shim.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manyfest-CleanWrapCharacters.d.ts","sourceRoot":"","sources":["../source/Manyfest-CleanWrapCharacters.js"],"names":[],"mappings":";AAeA,yEAUC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export = ManyfestHashTranslation;
|
|
2
|
+
/**
|
|
3
|
+
* Hash Translation
|
|
4
|
+
*
|
|
5
|
+
* This is a very simple translation table for hashes, which allows the same schema to resolve
|
|
6
|
+
* differently based on a loaded translation table.
|
|
7
|
+
*
|
|
8
|
+
* This is to prevent the requirement for mutating schemas over and over again when we want to
|
|
9
|
+
* reuse the structure but look up data elements by different addresses.
|
|
10
|
+
*
|
|
11
|
+
* One side-effect of this is that a translation table can "override" the built-in hashes, since
|
|
12
|
+
* this is always used to resolve hashes before any of the functionCallByHash(pHash, ...) perform
|
|
13
|
+
* their lookups by hash.
|
|
14
|
+
*
|
|
15
|
+
* @class ManyfestHashTranslation
|
|
16
|
+
*/
|
|
17
|
+
declare class ManyfestHashTranslation {
|
|
18
|
+
constructor(pInfoLog: any, pErrorLog: any);
|
|
19
|
+
logInfo: any;
|
|
20
|
+
logError: any;
|
|
21
|
+
translationTable: {};
|
|
22
|
+
translationCount(): number;
|
|
23
|
+
addTranslation(pTranslation: any): boolean;
|
|
24
|
+
removeTranslationHash(pTranslationHash: any): void;
|
|
25
|
+
removeTranslation(pTranslation: any): boolean;
|
|
26
|
+
clearTranslations(): void;
|
|
27
|
+
translate(pTranslation: any): any;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Manyfest-HashTranslation.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export = logToConsole;
|
|
2
|
+
/**
|
|
3
|
+
* @author <steven@velozo.com>
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Manyfest simple logging shim (for browser and dependency-free running)
|
|
7
|
+
*/
|
|
8
|
+
declare function logToConsole(pLogLine: any, pLogObject: any): void;
|
|
9
|
+
//# sourceMappingURL=Manyfest-LogToConsole.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manyfest-LogToConsole.d.ts","sourceRoot":"","sources":["../source/Manyfest-LogToConsole.js"],"names":[],"mappings":";AAAA;;EAEE;AAEF;;EAEE;AAEF,oEAOC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export = ManyfestObjectAddressResolverCheckAddressExists;
|
|
2
|
+
/**
|
|
3
|
+
* Object Address Resolver
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT NOTE: This code is intentionally more verbose than necessary, to
|
|
6
|
+
* be extremely clear what is going on in the recursion for
|
|
7
|
+
* each of the three address resolution functions.
|
|
8
|
+
*
|
|
9
|
+
* Although there is some opportunity to repeat ourselves a
|
|
10
|
+
* bit less in this codebase (e.g. with detection of arrays
|
|
11
|
+
* versus objects versus direct properties), it can make
|
|
12
|
+
* debugging.. challenging. The minified version of the code
|
|
13
|
+
* optimizes out almost anything repeated in here. So please
|
|
14
|
+
* be kind and rewind... meaning please keep the codebase less
|
|
15
|
+
* terse and more verbose so humans can comprehend it.
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* @class ManyfestObjectAddressResolverCheckAddressExists
|
|
19
|
+
*/
|
|
20
|
+
declare class ManyfestObjectAddressResolverCheckAddressExists {
|
|
21
|
+
constructor(pInfoLog: any, pErrorLog: any);
|
|
22
|
+
logInfo: any;
|
|
23
|
+
logError: any;
|
|
24
|
+
getObjectValueClass: libGetObjectValue;
|
|
25
|
+
checkAddressExists(pObject: any, pAddress: any, pRootObject: any): any;
|
|
26
|
+
}
|
|
27
|
+
import libGetObjectValue = require("./Manyfest-ObjectAddress-GetValue.js");
|
|
28
|
+
//# sourceMappingURL=Manyfest-ObjectAddress-CheckAddressExists.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export = ManyfestObjectAddressResolverDeleteValue;
|
|
2
|
+
/**
|
|
3
|
+
* Object Address Resolver - DeleteValue
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT NOTE: This code is intentionally more verbose than necessary, to
|
|
6
|
+
* be extremely clear what is going on in the recursion for
|
|
7
|
+
* each of the three address resolution functions.
|
|
8
|
+
*
|
|
9
|
+
* Although there is some opportunity to repeat ourselves a
|
|
10
|
+
* bit less in this codebase (e.g. with detection of arrays
|
|
11
|
+
* versus objects versus direct properties), it can make
|
|
12
|
+
* debugging.. challenging. The minified version of the code
|
|
13
|
+
* optimizes out almost anything repeated in here. So please
|
|
14
|
+
* be kind and rewind... meaning please keep the codebase less
|
|
15
|
+
* terse and more verbose so humans can comprehend it.
|
|
16
|
+
*
|
|
17
|
+
* TODO: Once we validate this pattern is good to go, break these out into
|
|
18
|
+
* three separate modules.
|
|
19
|
+
*
|
|
20
|
+
* @class ManyfestObjectAddressResolverDeleteValue
|
|
21
|
+
*/
|
|
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;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Manyfest-ObjectAddress-DeleteValue.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export = ManyfestObjectAddressResolverGetValue;
|
|
2
|
+
/**
|
|
3
|
+
* Object Address Resolver - GetValue
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT NOTE: This code is intentionally more verbose than necessary, to
|
|
6
|
+
* be extremely clear what is going on in the recursion for
|
|
7
|
+
* each of the three address resolution functions.
|
|
8
|
+
*
|
|
9
|
+
* Although there is some opportunity to repeat ourselves a
|
|
10
|
+
* bit less in this codebase (e.g. with detection of arrays
|
|
11
|
+
* versus objects versus direct properties), it can make
|
|
12
|
+
* debugging.. challenging. The minified version of the code
|
|
13
|
+
* optimizes out almost anything repeated in here. So please
|
|
14
|
+
* be kind and rewind... meaning please keep the codebase less
|
|
15
|
+
* terse and more verbose so humans can comprehend it.
|
|
16
|
+
*
|
|
17
|
+
* TODO: Once we validate this pattern is good to go, break these out into
|
|
18
|
+
* three separate modules.
|
|
19
|
+
*
|
|
20
|
+
* @class ManyfestObjectAddressResolverGetValue
|
|
21
|
+
*/
|
|
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;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Manyfest-ObjectAddress-GetValue.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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;
|
|
6
|
+
//# sourceMappingURL=Manyfest-ObjectAddress-Parser.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export = ManyfestObjectAddressSetValue;
|
|
2
|
+
/**
|
|
3
|
+
* Object Address Resolver - SetValue
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT NOTE: This code is intentionally more verbose than necessary, to
|
|
6
|
+
* be extremely clear what is going on in the recursion for
|
|
7
|
+
* each of the three address resolution functions.
|
|
8
|
+
*
|
|
9
|
+
* Although there is some opportunity to repeat ourselves a
|
|
10
|
+
* bit less in this codebase (e.g. with detection of arrays
|
|
11
|
+
* versus objects versus direct properties), it can make
|
|
12
|
+
* debugging.. challenging. The minified version of the code
|
|
13
|
+
* optimizes out almost anything repeated in here. So please
|
|
14
|
+
* be kind and rewind... meaning please keep the codebase less
|
|
15
|
+
* terse and more verbose so humans can comprehend it.
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* @class ManyfestObjectAddressSetValue
|
|
19
|
+
*/
|
|
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;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Manyfest-ObjectAddress-SetValue.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export = ManyfestObjectAddressGeneration;
|
|
2
|
+
/**
|
|
3
|
+
* Object Address Generation
|
|
4
|
+
*
|
|
5
|
+
* Automagically generate addresses and properties based on a passed-in object,
|
|
6
|
+
* to be used for easy creation of schemas. Meant to simplify the lives of
|
|
7
|
+
* developers wanting to create schemas without typing a bunch of stuff.
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT NOTE: This code is intentionally more verbose than necessary, to
|
|
10
|
+
* be extremely clear what is going on in the recursion for
|
|
11
|
+
* each of the three address resolution functions.
|
|
12
|
+
*
|
|
13
|
+
* Although there is some opportunity to repeat ourselves a
|
|
14
|
+
* bit less in this codebase (e.g. with detection of arrays
|
|
15
|
+
* versus objects versus direct properties), it can make
|
|
16
|
+
* debugging.. challenging. The minified version of the code
|
|
17
|
+
* optimizes out almost anything repeated in here. So please
|
|
18
|
+
* be kind and rewind... meaning please keep the codebase less
|
|
19
|
+
* terse and more verbose so humans can comprehend it.
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
* @class ManyfestObjectAddressGeneration
|
|
23
|
+
*/
|
|
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;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Manyfest-ObjectAddressGeneration.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manyfest-ParseConditionals.d.ts","sourceRoot":"","sources":["../source/Manyfest-ParseConditionals.js"],"names":[],"mappings":";AAiGA,yFAkDC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export = ManyfestSchemaManipulation;
|
|
2
|
+
/**
|
|
3
|
+
* Schema Manipulation Functions
|
|
4
|
+
*
|
|
5
|
+
* @class ManyfestSchemaManipulation
|
|
6
|
+
*/
|
|
7
|
+
declare class ManyfestSchemaManipulation {
|
|
8
|
+
constructor(pInfoLog: any, pErrorLog: any);
|
|
9
|
+
logInfo: any;
|
|
10
|
+
logError: any;
|
|
11
|
+
resolveAddressMappings(pManyfestSchemaDescriptors: any, pAddressMapping: any): boolean;
|
|
12
|
+
safeResolveAddressMappings(pManyfestSchemaDescriptors: any, pAddressMapping: any): any;
|
|
13
|
+
mergeAddressMappings(pManyfestSchemaDescriptorsDestination: any, pManyfestSchemaDescriptorsSource: any): any;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Manyfest-SchemaManipulation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manyfest-SchemaManipulation.d.ts","sourceRoot":"","sources":["../source/Manyfest-SchemaManipulation.js"],"names":[],"mappings":";AAKA;;;;EAIE;AACF;IAEC,2CAKC;IAFA,aAA0E;IAC1E,cAA6E;IAqB9E,uFA8DC;IAED,uFAMC;IAED,6GAwBC;CACD"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export = Manyfest;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {{
|
|
4
|
+
* Hash?: string,
|
|
5
|
+
* Name?: string,
|
|
6
|
+
* DataType?: string,
|
|
7
|
+
* Required?: boolean,
|
|
8
|
+
* Address?: string,
|
|
9
|
+
* Description?: string,
|
|
10
|
+
* [key: string]: any,
|
|
11
|
+
* }} ManifestDescriptor
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Manyfest object address-based descriptions and manipulations.
|
|
15
|
+
*
|
|
16
|
+
* @class Manyfest
|
|
17
|
+
*/
|
|
18
|
+
declare class Manyfest {
|
|
19
|
+
constructor(pFable: any, pManifest: any, pServiceHash: any);
|
|
20
|
+
/** @type {Record<string, any>} */
|
|
21
|
+
options: Record<string, any>;
|
|
22
|
+
serviceType: string;
|
|
23
|
+
logInfo: (pLogLine: any, pLogObject: any) => void;
|
|
24
|
+
logError: (pLogLine: any, pLogObject: any) => void;
|
|
25
|
+
objectAddressCheckAddressExists: libObjectAddressCheckAddressExists;
|
|
26
|
+
objectAddressGetValue: libObjectAddressGetValue;
|
|
27
|
+
objectAddressSetValue: libObjectAddressSetValue;
|
|
28
|
+
objectAddressDeleteValue: libObjectAddressDeleteValue;
|
|
29
|
+
scope: any;
|
|
30
|
+
elementAddresses: any[];
|
|
31
|
+
elementHashes: {};
|
|
32
|
+
elementDescriptors: {};
|
|
33
|
+
schemaManipulations: libSchemaManipulation;
|
|
34
|
+
objectAddressGeneration: libObjectAddressGeneration;
|
|
35
|
+
hashTranslations: libHashTranslation;
|
|
36
|
+
numberRegex: RegExp;
|
|
37
|
+
/*************************************************************************
|
|
38
|
+
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
39
|
+
*/
|
|
40
|
+
reset(): void;
|
|
41
|
+
clone(): import("./Manyfest.js");
|
|
42
|
+
deserialize(pManifestString: any): void;
|
|
43
|
+
loadManifest(pManifest: any): void;
|
|
44
|
+
serialize(): string;
|
|
45
|
+
getManifest(): {
|
|
46
|
+
Scope: any;
|
|
47
|
+
Descriptors: any;
|
|
48
|
+
HashTranslations: any;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Add a descriptor to the manifest
|
|
52
|
+
*
|
|
53
|
+
* @param {string} pAddress - The address of the element to add the descriptor for.
|
|
54
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor object to add.
|
|
55
|
+
*/
|
|
56
|
+
addDescriptor(pAddress: string, pDescriptor: ManifestDescriptor): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* @param {string} pHash - The hash of the address to resolve.
|
|
59
|
+
*
|
|
60
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
61
|
+
*/
|
|
62
|
+
getDescriptorByHash(pHash: string): ManifestDescriptor;
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} pAddress - The address of the element to get the descriptor for.
|
|
65
|
+
*
|
|
66
|
+
* @return {ManifestDescriptor} The descriptor for the address
|
|
67
|
+
*/
|
|
68
|
+
getDescriptor(pAddress: string): ManifestDescriptor;
|
|
69
|
+
/**
|
|
70
|
+
* execute an action function for each descriptor
|
|
71
|
+
* @param {(d: ManifestDescriptor) => void} fAction - The action function to execute for each descriptor.
|
|
72
|
+
*/
|
|
73
|
+
eachDescriptor(fAction: (d: ManifestDescriptor) => void): void;
|
|
74
|
+
/*************************************************************************
|
|
75
|
+
* Beginning of Object Manipulation (read & write) Functions
|
|
76
|
+
*/
|
|
77
|
+
checkAddressExistsByHash(pObject: any, pHash: any): any;
|
|
78
|
+
checkAddressExists(pObject: any, pAddress: any): any;
|
|
79
|
+
resolveHashAddress(pHash: any): any;
|
|
80
|
+
getValueByHash(pObject: any, pHash: any): any;
|
|
81
|
+
getValueAtAddress(pObject: any, pAddress: any): any;
|
|
82
|
+
setValueByHash(pObject: any, pHash: any, pValue: any): any;
|
|
83
|
+
setValueAtAddress(pObject: any, pAddress: any, pValue: any): any;
|
|
84
|
+
deleteValueByHash(pObject: any, pHash: any, pValue: any): any;
|
|
85
|
+
deleteValueAtAddress(pObject: any, pAddress: any, pValue: any): any;
|
|
86
|
+
validate(pObject: any): {
|
|
87
|
+
Error: any;
|
|
88
|
+
Errors: any[];
|
|
89
|
+
MissingElements: any[];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Returns a default value, or, the default value for the data type (which is overridable with configuration)
|
|
93
|
+
*
|
|
94
|
+
* @param {ManifestDescriptor} pDescriptor - The descriptor definition.
|
|
95
|
+
*/
|
|
96
|
+
getDefaultValue(pDescriptor: ManifestDescriptor): any;
|
|
97
|
+
populateDefaults(pObject: any, pOverwriteProperties: any): any;
|
|
98
|
+
populateObject(pObject: any, pOverwriteProperties: any, fFilter: any): any;
|
|
99
|
+
}
|
|
100
|
+
declare namespace Manyfest {
|
|
101
|
+
export { ManifestDescriptor };
|
|
102
|
+
}
|
|
103
|
+
import libObjectAddressCheckAddressExists = require("./Manyfest-ObjectAddress-CheckAddressExists.js");
|
|
104
|
+
import libObjectAddressGetValue = require("./Manyfest-ObjectAddress-GetValue.js");
|
|
105
|
+
import libObjectAddressSetValue = require("./Manyfest-ObjectAddress-SetValue.js");
|
|
106
|
+
import libObjectAddressDeleteValue = require("./Manyfest-ObjectAddress-DeleteValue.js");
|
|
107
|
+
import libSchemaManipulation = require("./Manyfest-SchemaManipulation.js");
|
|
108
|
+
import libObjectAddressGeneration = require("./Manyfest-ObjectAddressGeneration.js");
|
|
109
|
+
import libHashTranslation = require("./Manyfest-HashTranslation.js");
|
|
110
|
+
type ManifestDescriptor = {
|
|
111
|
+
Hash?: string;
|
|
112
|
+
Name?: string;
|
|
113
|
+
DataType?: string;
|
|
114
|
+
Required?: boolean;
|
|
115
|
+
Address?: string;
|
|
116
|
+
Description?: string;
|
|
117
|
+
[key: string]: any;
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=Manyfest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manyfest.d.ts","sourceRoot":"","sources":["../source/Manyfest.js"],"names":[],"mappings":";AAiBA;;;;;;;;;;GAUG;AAEH;;;;EAIE;AACF;IAEC,4DAkEC;IAvDA,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAClB;IAEN,oBAA6B;IAGnC,kDAA2B;IAC3B,mDAA4B;IAG5B,oEAA0G;IAC1G,gDAAsF;IACtF,gDAAsF;IACtF,sDAA4F;IAwB5F,WAAsB;IACtB,wBAAiC;IACjC,kBAA8B;IAC9B,uBAAmC;IASnC,2CAAiF;IACjF,oDAA0F;IAE1F,qCAA2E;IAE3E,oBAA8D;IAG/D;;OAEG;IAGH,cAMC;IAED,iCAWC;IAGD,wCAIC;IAGD,mCAiEC;IAGD,oBAGC;IAED;;;;MAQC;IAED;;;;;OAKG;IACH,wBAHW,MAAM,eACN,kBAAkB,WAyC5B;IAED;;;;OAIG;IACH,2BAJW,MAAM,GAEL,kBAAkB,CAK7B;IAED;;;;OAIG;IACH,wBAJW,MAAM,GAEL,kBAAkB,CAK7B;IAED;;;OAGG;IACH,wBAFW,CAAC,CAAC,EAAE,kBAAkB,KAAK,IAAI,QAUzC;IAED;;OAEG;IAEH,wDAGC;IAGD,qDAGC;IAGD,oCA8BC;IAGD,8CAWC;IAGD,oDAiBC;IAGD,2DAGC;IAGD,iEAGC;IAGD,8DAGC;IAGD,oEAGC;IAGD;;;;MAiHC;IAED;;;;OAIG;IACH,6BAFW,kBAAkB,OA4B5B;IAGD,+DAQC;IAID,2EA0BC;CACD;;;;;;;;;;;0BAnkBY;IACR,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACzB,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
|