datarestructor namespace and module declaration. It contains all functions to convert an object (e.g. parsed JSON) into uniform enumerated list of described field entries.
Transformation steps:
- JSON
- flatten
- mark and identify
- add array fields
- deduplicate
- group
- flatten again
- Source:
Classes
Namespaces
Type Definitions
DescribedEntry
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
category |
string | category of the result from the PropertyStructureDescription using a short name or e.g. a symbol character |
||||||||||||||||||||||||||
type |
string | type of the result from PropertyStructureDescription |
||||||||||||||||||||||||||
abbreviation |
string |
<optional> |
"" | one optional character, a symbol character or a short abbreviation of the category |
||||||||||||||||||||||||
image |
string |
<optional> |
"" | one optional path to an image resource |
||||||||||||||||||||||||
index |
string | array of numbers containing the split index. Example: "responses[2].hits.hits[4]._source.name" leads to an array with the two elements: [2,4] |
||||||||||||||||||||||||||
displayName |
string | display name extracted from the point separated hierarchical property name, e.g. "Name" |
||||||||||||||||||||||||||
fieldName |
string | field name extracted from the point separated hierarchical property name, e.g. "name" |
||||||||||||||||||||||||||
value |
string | content of the field |
||||||||||||||||||||||||||
groupNames |
Array.<string> | array of names of all dynamically added properties representing groups |
||||||||||||||||||||||||||
addGroupEntry |
module:datarestructor.addGroupEntryFunction | function, that adds an entry to the given group. If the group does not exist, it will be created. |
||||||||||||||||||||||||||
addGroupEntries |
module:datarestructor.addGroupEntriesFunction | function, that adds entries to the given group. If the group does not exist, it will be created. |
||||||||||||||||||||||||||
_isMatchingIndex |
boolean | true, when _identifier.index matches the described "indexStartsWith" |
||||||||||||||||||||||||||
_identifier |
Object | internal structure for identifier. Avoid using it outside since it may change. Properties
|
||||||||||||||||||||||||||
_description |
Object | PropertyStructureDescription for internal use. Avoid using it outside since it may change. |
- Source:
DescribedFieldRecursionContext
Describes the context type for the recursive DescribedDataField conversion, that contains everything that needs to be accessible throughout recursion regardless of the recursion depth.
Type:
- Object
- Source:
ExtractedIndices
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
pointDelimited |
string | bracket indices separated by points |
numberArray |
Array.<number> | as array of numbers |
- Source:
PropertyStructureDescription
Describes a selected part of the incoming data structure and defines, how the data should be transformed.
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string | ""(default). Some examples: "summary" for e.g. a list overview. "detail" e.g. when a summary is selected. "filter" e.g. for field/value pair results that can be selected as search parameters. |
||
category |
string | name of the category. Default = "". Could contain a short domain name like "product" or "vendor". |
||
abbreviation |
string |
<optional> |
"" | one optional character, a symbol character or a short abbreviation of the category |
image |
string |
<optional> |
"" | one optional path to an image resource |
propertyPatternTemplateMode |
boolean | "false"(default): property name needs to be equal to the pattern. "true" allows variables like "{{fieldName}}" inside the pattern. |
||
propertyPattern |
string | property name pattern (without array indices) to match |
||
indexStartsWith |
string | ""(default) matches all ids. String that needs to match the beginning of the id. E.g. "1." will match id="1.3.4" but not "0.1.2". |
||
getDisplayNameForPropertyName |
module:datarestructor.propertyNameFunction | display name for the property. ""(default) last property name element with upper case first letter. |
||
getFieldNameForPropertyName |
module:datarestructor.propertyNameFunction | field name for the property. "" (default) last property name element. |
||
groupName |
string | name of the property, that contains grouped entries. Default="group". |
||
groupPattern |
string | Pattern that describes how to group entries. "groupName" defines the name of this group. A pattern may contain variables in double curly brackets {{variable}}. |
||
groupDestinationPattern |
string | Pattern that describes where the group should be moved to. Default=""=Group will not be moved. A pattern may contain variables in double curly brackets {{variable}}. |
||
groupDestinationName |
string | (default=groupName) Name of the group when it had been moved to the destination. |
||
deduplicationPattern |
string | Pattern to use to remove duplicate entries. A pattern may contain variables in double curly brackets {{variable}}. |
- Source:
TransformConfig
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
debugMode |
boolean | enables/disables detailed logging |
||
maxRecursionDepth |
number |
<optional> |
8 | Maximum recursion depth |
removeDuplicationAboveRecursionDepth |
number |
<optional> |
1 | Duplications will be removed above the given recursion depth value and remain unchanged below it. |
- Source:
addGroupEntriesFunction(groupName, describedEntry)
Adds some group items/entries to the module:datarestructor.DescribedEntry.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
String | name of the group that should be added |
describedEntry |
Array.<module:datarestructor.DescribedEntry> | entries that should be added to the group |
- Source:
addGroupEntryFunction(groupName, describedEntry)
Adds a group item/entry to the module:datarestructor.DescribedEntry.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
String | name of the group that should be added |
describedEntry |
module:datarestructor.DescribedEntry | entry that should be added to the group |
- Source:
onEntryFoundFunction(groupName, foundEntry, allEntries)
Takes the full qualified original property name and extracts a simple name out of it.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | name of the group where the entry had been found. |
foundEntry |
module:datarestructor.DescribedEntry | the found entry itself. |
allEntries |
Array.<module:datarestructor.DescribedEntry> | the array of all entries where the found entry is an element of. |
- Source:
propertyNameFunction(propertyName) → {String}
Takes the full qualified original property name and extracts a simple name out of it.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
string | full qualified, point separated property name |
- Source:
Returns:
extracted, simple name
- Type
- String
stringFieldOfDescribedEntryFunction(entry) → {String}
Returns a field value of the given module:datarestructor.DescribedEntry.
Parameters:
Name | Type | Description |
---|---|---|
entry |
module:datarestructor.DescribedEntry | described entry that contains the field that should be returned |
- Source:
Returns:
field value
- Type
- String