data-restructor 3.3.4 → 3.4.1

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 (49) hide show
  1. package/.auto-changelog +9 -0
  2. package/.auto-changelog-template.hbs +36 -0
  3. package/.github/workflows/codeql-analysis.yml +4 -4
  4. package/.github/workflows/continuous-integration.yaml +84 -0
  5. package/CHANGELOG.md +199 -94
  6. package/CONTRIBUTING.md +51 -43
  7. package/Commands.md +16 -15
  8. package/README.md +193 -137
  9. package/SECURITY.md +2 -2
  10. package/coverage/coverage-summary.json +3 -3
  11. package/coverage/datarestructor.js.html +133 -133
  12. package/coverage/describedfield.js.html +45 -45
  13. package/coverage/index.html +1 -1
  14. package/coverage/templateResolver.js.html +26 -26
  15. package/devdist/datarestructor-ie.js +1487 -1678
  16. package/devdist/datarestructor.js +1438 -1614
  17. package/devdist/describedfield-ie.js +260 -282
  18. package/devdist/describedfield.js +257 -279
  19. package/devdist/templateResolver-ie.js +221 -257
  20. package/devdist/templateResolver.js +192 -228
  21. package/dist/datarestructor-ie.js +1 -1
  22. package/dist/datarestructor-ie.js.map +1 -1
  23. package/dist/datarestructor.js +1 -1
  24. package/dist/datarestructor.js.map +1 -1
  25. package/dist/describedfield-ie.js +1 -1
  26. package/dist/describedfield-ie.js.map +1 -1
  27. package/dist/describedfield.js +1 -1
  28. package/dist/describedfield.js.map +1 -1
  29. package/dist/templateResolver-ie.js +1 -1
  30. package/dist/templateResolver-ie.js.map +1 -1
  31. package/dist/templateResolver.js +1 -1
  32. package/dist/templateResolver.js.map +1 -1
  33. package/docs/datarestructor.js.html +1 -1
  34. package/docs/describedfield.js.html +1 -1
  35. package/docs/index.html +54 -44
  36. package/docs/module-datarestructor.DescribedEntryCreator.html +94 -94
  37. package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
  38. package/docs/module-datarestructor.Restructor.html +1 -1
  39. package/docs/module-datarestructor.Transform.html +605 -605
  40. package/docs/module-datarestructor.html +959 -995
  41. package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
  42. package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
  43. package/docs/module-described_field.html +1 -37
  44. package/docs/module-template_resolver.Resolver.html +167 -167
  45. package/docs/module-template_resolver.html +1 -37
  46. package/docs/templateResolver.js.html +1 -1
  47. package/package.json +20 -14
  48. package/renovate.json +14 -0
  49. package/.github/workflows/action.yaml +0 -44
@@ -0,0 +1,9 @@
1
+ {
2
+ "output": "CHANGELOG.md",
3
+ "template": "./.auto-changelog-template.hbs",
4
+ "ignoreCommitPattern": "Continuous Integration Build Artifacts",
5
+ "startingVersion": "v3.4.0",
6
+ "package": true,
7
+ "unreleased": true,
8
+ "commitLimit": false
9
+ }
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## References
6
+
7
+ - [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
8
+ - [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
9
+ - [`auto-changelog`](https://github.com/CookPete/auto-changelog)
10
+
11
+ {{#each releases}}
12
+ {{#if tag}}
13
+ {{#if href}}
14
+ ## [{{title}}]({{href}}) ({{niceDate}})
15
+ {{else}}
16
+ ## {{title}} ({{niceDate}})
17
+ {{/if}}
18
+ {{else}}
19
+ ## [{{title}}](https://github.com/JohT/data-restructor-js/compare/{{diff}}.master) (upcoming)
20
+ {{/if}}
21
+
22
+ {{#if summary}}
23
+ {{summary}}
24
+ {{/if}}
25
+
26
+ {{! List merges except for dependency updates }}
27
+ {{#commit-list merges heading='### Changes' exclude='(Update dependency .+to .+\d+)|(Update .+to .+\d+)'}}
28
+ - {{message}} {{#if href}}[`#{{id}}`]({{href}}){{/if}}
29
+ {{/commit-list}}
30
+
31
+ {{! List merges with `Update dependency ` somewhere in the message }}
32
+ {{#commit-list merges heading='### Dependency Updates' message='(Update dependency .+to .+\d+)|(Update .+to .+\d+)'}}
33
+ - {{message}} {{#if href}}[`#{{id}}`]({{href}}){{/if}}
34
+ {{/commit-list}}
35
+
36
+ {{/each}}
@@ -39,11 +39,11 @@ jobs:
39
39
 
40
40
  steps:
41
41
  - name: Checkout repository
42
- uses: actions/checkout@v2
42
+ uses: actions/checkout@v3
43
43
 
44
44
  # Initializes the CodeQL tools for scanning.
45
45
  - name: Initialize CodeQL
46
- uses: github/codeql-action/init@v1
46
+ uses: github/codeql-action/init@v2
47
47
  with:
48
48
  languages: ${{ matrix.language }}
49
49
  # If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +54,7 @@ jobs:
54
54
  # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55
55
  # If this step fails, then you should remove it and run the build manually (see below)
56
56
  - name: Autobuild
57
- uses: github/codeql-action/autobuild@v1
57
+ uses: github/codeql-action/autobuild@v2
58
58
 
59
59
  # ℹ️ Command-line programs to run using the OS shell.
60
60
  # 📚 https://git.io/JvXDl
@@ -68,4 +68,4 @@ jobs:
68
68
  # make release
69
69
 
70
70
  - name: Perform CodeQL Analysis
71
- uses: github/codeql-action/analyze@v1
71
+ uses: github/codeql-action/analyze@v2
@@ -0,0 +1,84 @@
1
+ name: Continuous Integration
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ # Ignore changes in folders with generated contents or documentation.
8
+ # Need to match git add parameters below.
9
+ paths-ignore:
10
+ - 'coverage/**'
11
+ - 'devdist/**'
12
+ - 'dist/**'
13
+ - 'docs/**'
14
+ - '**/*.md'
15
+ pull_request:
16
+ branches:
17
+ - master
18
+
19
+ jobs:
20
+ build:
21
+ runs-on: ubuntu-latest
22
+ env:
23
+ CI_COMMIT_MESSAGE: Continuous Integration Build Artifacts
24
+ CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ with:
28
+ token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
29
+
30
+ # Build
31
+ - uses: actions/setup-node@v3
32
+ with:
33
+ node-version: '18'
34
+ - name: Install node packages
35
+ run: npm ci
36
+ - name: Build package (lint, test, build, package, merge)
37
+ run: npm run package
38
+
39
+ # Archive generated or updated files
40
+ - name: Archive code coverage results
41
+ uses: actions/upload-artifact@v3
42
+ with:
43
+ name: test-code-coverage-report
44
+ path: coverage
45
+ retention-days: 14
46
+ if-no-files-found: error
47
+ - name: Archive documentation
48
+ uses: actions/upload-artifact@v3
49
+ with:
50
+ name: documentation
51
+ path: docs
52
+ retention-days: 14
53
+ if-no-files-found: error
54
+ - name: Archive build artifacts
55
+ uses: actions/upload-artifact@v3
56
+ with:
57
+ name: distribution-production
58
+ path: dist
59
+ retention-days: 14
60
+ if-no-files-found: error
61
+ - name: Archive build artifacts
62
+ uses: actions/upload-artifact@v3
63
+ with:
64
+ name: distribution-development
65
+ path: devdist
66
+ retention-days: 14
67
+ if-no-files-found: error
68
+
69
+ # Commit and push all changed files
70
+ - name: Display event name
71
+ if: env.is-auto-commit == false
72
+ run: echo "github.event_name=${{ github.event_name }}"
73
+ - name: Commit build artifacts (dist, devdist, docs, coverage)
74
+ # Only run when a pull request gets merged or a commit is pushed to the main branch
75
+ # git add parameters need to match paths-ignore parameters above
76
+ # Git pull before add/commit/push to reduce race conditions on parallel builds
77
+ if: github.event_name == 'push'
78
+ run: |
79
+ git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
80
+ git config --global user.email 'joht@users.noreply.github.com'
81
+ git pull
82
+ git add coverage devdist dist docs *.md
83
+ git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
84
+ git push
package/CHANGELOG.md CHANGED
@@ -1,17 +1,105 @@
1
- # CHANGELOG.md
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## References
6
+
7
+ - [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
8
+ - [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
9
+ - [`auto-changelog`](https://github.com/CookPete/auto-changelog)
10
+
11
+ ## [v3.4.1](https://github.com/JohT/data-restructor-js/compare/v3.4.0...master) (upcoming)
12
+
13
+ ### Changes
14
+
15
+ - Pin dependency auto-changelog to 2.4.0 [`#141`](https://github.com/JohT/data-restructor-js/pull/141)
16
+ - Generate CHANGELOG.md using auto-changelog [`#140`](https://github.com/JohT/data-restructor-js/pull/140)
17
+ - Update/node-18 [`#132`](https://github.com/JohT/data-restructor-js/pull/132)
18
+
19
+ ### Dependency Updates
20
+
21
+ - Update dependency eslint to v8.35.0 [`#139`](https://github.com/JohT/data-restructor-js/pull/139)
22
+ - Update dependency jsdoc to v4.0.2 [`#137`](https://github.com/JohT/data-restructor-js/pull/137)
23
+ - Update dependency jsdoc to v4.0.1 [`#136`](https://github.com/JohT/data-restructor-js/pull/136)
24
+ - Update dependency parcel to v2.8.3 [`#134`](https://github.com/JohT/data-restructor-js/pull/134)
25
+ - Update dependency eslint to v8.34.0 [`#135`](https://github.com/JohT/data-restructor-js/pull/135)
26
+ - Update dependency lmdb to v2.7.9 [`#131`](https://github.com/JohT/data-restructor-js/pull/131)
27
+ - Update dependency lmdb to v2.7.8 [`#130`](https://github.com/JohT/data-restructor-js/pull/130)
28
+ - Update dependency lmdb to v2.7.7 [`#129`](https://github.com/JohT/data-restructor-js/pull/129)
29
+ - Update dependency eslint to v8.32.0 [`#124`](https://github.com/JohT/data-restructor-js/pull/124)
30
+ - Update dependency lmdb to v2.7.2 [`#119`](https://github.com/JohT/data-restructor-js/pull/119)
31
+ - Update dependency lmdb to v2.7.0 [`#114`](https://github.com/JohT/data-restructor-js/pull/114)
32
+ - Update dependency eslint to v8.27.0 [`#113`](https://github.com/JohT/data-restructor-js/pull/113)
33
+ - Update dependency jsdoc to v4 [`#112`](https://github.com/JohT/data-restructor-js/pull/112)
34
+
35
+ ## [v3.4.0](https://github.com/JohT/data-restructor-js/compare/v3.3.4...v3.4.0) (31 October 2022)
36
+
37
+ ### Changes
38
+
39
+ - resolve markdown linter warnings [`#110`](https://github.com/JohT/data-restructor-js/pull/110)
40
+ - Fix build error [`#91`](https://github.com/JohT/data-restructor-js/pull/91)
41
+ - Auto commit with protected branch [`#55`](https://github.com/JohT/data-restructor-js/pull/55)
42
+ - issue #44 further simplify auto commit on push [`#54`](https://github.com/JohT/data-restructor-js/pull/54)
43
+ - Simplify auto commit on push [`#51`](https://github.com/JohT/data-restructor-js/pull/51)
44
+ - Also consider auto commit author [`#49`](https://github.com/JohT/data-restructor-js/pull/49)
45
+ - Auto commit build artifacts on push [`#47`](https://github.com/JohT/data-restructor-js/pull/47)
46
+ - Auto commit build artifacts only on push [`#46`](https://github.com/JohT/data-restructor-js/pull/46)
47
+ - Automatically push Continuous Integration build artifacts when Pull Request is merged [`#45`](https://github.com/JohT/data-restructor-js/pull/45)
48
+ - Automate MergerJS [`#43`](https://github.com/JohT/data-restructor-js/pull/43)
49
+ - Pin dependency jasmine to v3.7.0 [`#17`](https://github.com/JohT/data-restructor-js/pull/17)
50
+ - Pin dependencies [`#16`](https://github.com/JohT/data-restructor-js/pull/16)
51
+ - Configure Renovate [`#15`](https://github.com/JohT/data-restructor-js/pull/15)
52
+
53
+ ### Dependency Updates
54
+
55
+ - Update Node.js to v18 [`#108`](https://github.com/JohT/data-restructor-js/pull/108)
56
+ - Update dependency eslint to v8.26.0 [`#107`](https://github.com/JohT/data-restructor-js/pull/107)
57
+ - Update dependency eslint to v8.24.0 [`#103`](https://github.com/JohT/data-restructor-js/pull/103)
58
+ - Update dependency eslint to v8.23.1 [`#101`](https://github.com/JohT/data-restructor-js/pull/101)
59
+ - Update dependency inquirer to v9.1.1 [`#99`](https://github.com/JohT/data-restructor-js/pull/99)
60
+ - Update dependency eslint to v8.22.0 [`#97`](https://github.com/JohT/data-restructor-js/pull/97)
61
+ - Update dependency inquirer to v9.1.0 [`#96`](https://github.com/JohT/data-restructor-js/pull/96)
62
+ - Update dependency eslint to v8.21.0 [`#95`](https://github.com/JohT/data-restructor-js/pull/95)
63
+ - Update dependency jsdoc to v3.6.11 [`#93`](https://github.com/JohT/data-restructor-js/pull/93)
64
+ - Update dependency eslint to v8.19.0 [`#88`](https://github.com/JohT/data-restructor-js/pull/88)
65
+ - Update dependency inquirer to v9 [`#85`](https://github.com/JohT/data-restructor-js/pull/85)
66
+ - Update github/codeql-action action to v2 [`#75`](https://github.com/JohT/data-restructor-js/pull/75)
67
+ - Update actions/upload-artifact action to v3 [`#67`](https://github.com/JohT/data-restructor-js/pull/67)
68
+ - Update actions/setup-node action to v3 [`#64`](https://github.com/JohT/data-restructor-js/pull/64)
69
+ - Update actions/checkout action to v3 [`#66`](https://github.com/JohT/data-restructor-js/pull/66)
70
+ - Update dependency node-forge to 1.0.0 [SECURITY] [`#62`](https://github.com/JohT/data-restructor-js/pull/62)
71
+ - Update dependency nanoid to 3.1.31 [SECURITY] [`#61`](https://github.com/JohT/data-restructor-js/pull/61)
72
+ - Update dependency jasmine to v4 [`#41`](https://github.com/JohT/data-restructor-js/pull/41)
73
+ - Update dependency istanbul-badges-readme to v1.8.1 [`#37`](https://github.com/JohT/data-restructor-js/pull/37)
74
+ - Update dependency eslint to v8.4.0 [`#35`](https://github.com/JohT/data-restructor-js/pull/35)
75
+ - Update Node.js to v16 [`#30`](https://github.com/JohT/data-restructor-js/pull/30)
76
+ - Update Node.js to v14 [`#22`](https://github.com/JohT/data-restructor-js/pull/22)
77
+ - Update dependency parcel to v2.0.0-rc.0 [`#19`](https://github.com/JohT/data-restructor-js/pull/19)
78
+ - Update dependency jasmine to v3.9.0 [`#21`](https://github.com/JohT/data-restructor-js/pull/21)
79
+ - Update dependency eslint to v7.32.0 [`#20`](https://github.com/JohT/data-restructor-js/pull/20)
80
+
81
+ <!-- auto-changelog-above -->
82
+ ### Automation
83
+
84
+ - [#42](https://github.com/JohT/data-restructor-js/issues/42) The command `npm run merger` is now able to run automatically.
85
+ - [#44](https://github.com/JohT/data-restructor-js/issues/44) Push Continuous Integration build artifacts into the repository.
86
+
87
+ ## [v3.3.4](https://github.com/JohT/data-restructor-js/compare/v3.3.3...v3.3.4) Remove duplicate groups within recursion (17 June 2021)
88
+
89
+ ### Fixes
2
90
 
3
- ## **v3.3.4** Remove duplicate groups within recursion (latest)
4
-
5
- ### Fixes:
6
91
  - #12 Zero recursion duplication should be possible
7
92
 
8
- ## **v3.3.3** IE support fix
93
+ ## [v3.3.3](https://github.com/JohT/data-restructor-js/compare/v3.3.2...v3.3.3) IE support fix (6 June 2021)
94
+
95
+ ### Fixes
9
96
 
10
- ### Fixes:
11
97
  - Use classic property definitions idiom instead of [ES6 PropertyShorthand](http://es6-features.org/#PropertyShorthand) for internet explorer (IE) support.
12
98
 
13
- ## **v3.3.2** Encourage Open Source Contributing
14
- ### Features:
99
+ ## [v3.3.2](https://github.com/JohT/data-restructor-js/compare/v3.3.1...v3.3.2) Encourage Open Source Contributing (6 June 2021)
100
+
101
+ ### Features
102
+
15
103
  - [README.md](README.md#build-all) contains a description on how to build the module.
16
104
  - [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) sets the standard for an open, welcoming,
17
105
  diverse, inclusive, and healthy community.
@@ -20,79 +108,95 @@ diverse, inclusive, and healthy community.
20
108
  - [PARCEL v2](https://v2.parceljs.org) migration
21
109
  - Update dependency versions
22
110
 
23
- ## **v3.3.1** Output folder fixed
111
+ ### Changes
112
+
113
+ - Setup CodeQL Analysis [`#10`](https://github.com/JohT/data-restructor-js/pull/10)
114
+ - Encourage Open Source Contribution [`#9`](https://github.com/JohT/data-restructor-js/pull/9)
115
+
116
+ ## [v3.3.1](https://github.com/JohT/data-restructor-js/compare/v3.3.0...v3.3.1) Output folder fixed (9 May 2021)
117
+
118
+ ### Fixes
24
119
 
25
- ### Fixes:
26
120
  - Minified output destination fixed. Minified files are now correctly written into the "dist" folder (instead of "dev").
27
121
 
28
- ## **v3.3.0** Merged source files for direct use without module system
122
+ ## [v3.3.0](https://github.com/JohT/data-restructor-js/compare/v3.2.0...v3.3.0) Merged source files for direct use without module system (9 May 2021)
29
123
 
30
- ### Features:
124
+ ### Features
31
125
 
32
126
  - #7 Add merged global JavaScript files in "dist" and "devdist" to use them without module system
33
127
  - security vulnerability CVE-2021-23358 https://github.com/advisories/GHSA-cf4h-3jhx-xvhq addressed
34
128
  - [README.md](README.md#credits) now contains a lists of credits
35
129
  - [COMMANDS.MD](COMMANDS.MD#most-important-commands-for-development) now contains a separate list for commands, that are used on a regular basis
36
- ## **v3.2.0** Configurable recursion depth above which duplications will be removed
37
130
 
38
- ### Features:
131
+ ### Changes
132
+
133
+ - Support direct use of modules in "dist" and "devdist" folder [`#8`](https://github.com/JohT/data-restructor-js/pull/8)
134
+
135
+ ## [v3.2.0](https://github.com/JohT/data-restructor-js/compare/v3.1.0...v3.2.0) Configurable recursion depth above which duplications will be removed (21 April 2021)
39
136
 
40
- - #5 Configurable recursion depth above which duplications will be removed.
137
+ ### Features
41
138
 
42
- ## **v3.1.0** Configurable recursion depth for sub groups
139
+ - Configurable recursion depth above which duplications will be removed [`#6`](https://github.com/JohT/data-restructor-js/pull/6)
43
140
 
44
- ### Features:
141
+ ## [v3.1.0](https://github.com/JohT/data-restructor-js/compare/v3.0.0...v3.1.0) Configurable recursion depth for sub groups (21 March 2021)
45
142
 
46
- - Configurable maximum recursion depth for field groups inside groups inside groups...
143
+ ### Features
144
+
145
+ - Configurable sub group level depth [`#4`](https://github.com/JohT/data-restructor-js/pull/4)
47
146
  - Improved JSDoc structure and contents
48
- ### Fixes:
49
147
 
50
- - [#3](https://github.com/JohT/data-restructor-js/issues/3) Group hierarchy limited to 1 since v3.0.0
148
+ ### Fixes
149
+
150
+ - Group hierarchy limited to 1 since v3.0.0 [`#3`](https://github.com/JohT/data-restructor-js/issues/3)
51
151
 
52
- ### Deprecated:
152
+ ### Deprecated
53
153
 
54
154
  - `datarestructor.Restructor.processJsonUsingDescriptions(jsonData, descriptions)` is deprecated.
55
155
  Please use `new datarestructor.Transform(descriptions).processJson(jsonData)` instead.
56
156
 
57
- ## **v3.0.0** Introducing DescribedDataField
58
- ### Features:
157
+ ## [v3.0.0](https://github.com/JohT/data-restructor-js/compare/v2.3.0...v3.0.0) Introducing DescribedDataField (13 March 2021)
158
+
159
+ ### Features
160
+
161
+ - Introducing DescribedDataField [`#2`](https://github.com/JohT/data-restructor-js/pull/2)
162
+ - Pure, non cyclic data result that can be converted to json without using additional functions
59
163
 
60
- - Pure, non cyclic data result that can be converted to json without using additional functions
164
+ ### Breaking Changes
61
165
 
62
- ### Breaking Changes:
166
+ - DescribedDataField replaces DescribedEntry as an element for the restructured output
167
+ - DescribedEntry remains only for internal use
168
+ - DescribedEntry function "resolveTemplate" is removed. "templateResolver.js" can be used instead.
169
+ - DescribedEntry function "publicFieldsJson" is removed. `JSON.stringify(describedEntry.describedField)` can be used instead.
63
170
 
64
- - DescribedDataField replaces DescribedEntry as an element for the restructured output
65
- - DescribedEntry remains only for internal use
66
- - DescribedEntry function "resolveTemplate" is removed. "templateResolver.js" can be used instead.
67
- - DescribedEntry function "publicFieldsJson" is removed. `JSON.stringify(describedEntry.describedField)` can be used instead.
68
- ## **v2.3.0** Continuous Integration
171
+ ## [v2.3.0](https://github.com/JohT/data-restructor-js/compare/v2.2.0...v2.3.0) Continuous Integration (6 February 2021)
69
172
 
70
- ### Features:
173
+ ### Features
71
174
 
72
- - Continuous Integration using GitHub Actions
73
- - Build using nodes package manager (npm)
74
- - Bundle (minification,...) using Parcel Bundler
75
- - Automated already existing unit tests using Jasmine
76
- - Unit-Test coverage measurement using nyc
77
- - Documentation Generation using JSDoc
78
- - Static code analysis using ESLint
79
- - Updated documentation
80
- ## **v2.2.0** Resolving template with described fields
175
+ - Continuous Integration using GitHub Actions introduced [`#1`](https://github.com/JohT/data-restructor-js/pull/1)
176
+ - Build using nodes package manager (npm)
177
+ - Bundle (minification,...) using Parcel Bundler
178
+ - Automated already existing unit tests using Jasmine
179
+ - Unit-Test coverage measurement using nyc
180
+ - Documentation Generation using JSDoc
181
+ - Static code analysis using ESLint
182
+ - Updated documentation
81
183
 
82
- ### Features:
184
+ ## [v2.2.0](https://github.com/JohT/data-restructor-js/compare/v2.1.0...v2.2.0) Resolving template with described fields (9 January 2021)
83
185
 
84
- - Since v1.2.0 templates containing variables in double curly brackets can be resolved by the function `resolveTemplate(templateString)`. Now, it is not only possible to resolve the contained meta data,
85
- but also the described fields directly. Based on the JSON below, the resolver would now provide these results:
186
+ ### Features
86
187
 
87
- - `"{{customerNumber}}"`-> `"123"`
88
- - `"{{details.name}}"`-> `"Smith"`
89
- - `"{{details.age}}"`-> `"31"`
188
+ - Since v1.2.0 templates containing variables in double curly brackets can be resolved by the function `resolveTemplate(templateString)`. Now, it is not only possible to resolve the contained meta data,
189
+ but also the described fields directly. Based on the JSON below, the resolver would now provide these results:
90
190
 
91
- Previously (since v1.2.0), these results could only be obtained with (remains unchanged):
191
+ - `"{{customerNumber}}"`-> `"123"`
192
+ - `"{{details.name}}"`-> `"Smith"`
193
+ - `"{{details.age}}"`-> `"31"`
92
194
 
93
- - `"{{value}}"`-> `"123"`
94
- - `"{{details[0].value}}"`-> `"Smith"`
95
- - `"{{details[1].value}}"`-> `"31"`
195
+ Previously (since v1.2.0), these results could only be obtained with (remains unchanged):
196
+
197
+ - `"{{value}}"`-> `"123"`
198
+ - `"{{details[0].value}}"`-> `"Smith"`
199
+ - `"{{details[1].value}}"`-> `"31"`
96
200
 
97
201
  ```JSON
98
202
  {
@@ -120,31 +224,32 @@ Please use `new datarestructor.Transform(descriptions).processJson(jsonData)` in
120
224
  }
121
225
  ```
122
226
 
123
- ## **v2.1.0** new optional fields "abbreviation" and "image" (2020-12-25)
227
+ ## [v2.1.0](https://github.com/JohT/data-restructor-js/compare/v2.0.0...v2.1.0) New optional fields "abbreviation" and "image" (25 December 2020)
124
228
 
125
- ### Features:
229
+ ### Features
126
230
 
127
- - With the two new optional fields **abbreviation** and **image**, that can be specified for each `PropertyStructureDescription`, it is easier to separate display related fields from e.g. the category. These fields are transferred directly into the resulting `DescribedEntry` and do not affect other behavior (grouping, filtering...) in any kind.
128
- - If the variable `{{fieldName}}` is missing in the property pattern in "template mode", the right most part of the property name is used as field name. This corresponds to the behavior of the "equal mode". Previously this led to an error that forced the use of the "equal mode" in that case.
231
+ - With the two new optional fields **abbreviation** and **image**, that can be specified for each `PropertyStructureDescription`, it is easier to separate display related fields from e.g. the category. These fields are transferred directly into the resulting `DescribedEntry` and do not affect other behavior (grouping, filtering...) in any kind.
129
232
 
130
- ### Fix:
233
+ - If the variable `{{fieldName}}` is missing in the property pattern in "template mode", the right most part of the property name is used as field name. This corresponds to the behavior of the "equal mode". Previously this led to an error that forced the use of the "equal mode" in that case.
131
234
 
132
- - Some minor refactoring
235
+ ### Fix
133
236
 
237
+ - Some minor refactoring
134
238
 
135
- ## **v2.0.0** Added "publicFieldsJson" to "DescribedEntry" (2014-12-12)
239
+ ## [v2.0.0](https://github.com/JohT/data-restructor-js/compare/v1.2.0...v2.0.0) Added "publicFieldsJson" to "DescribedEntry" (12 December 2020)
136
240
 
137
- ### Features:
241
+ ### Features
138
242
 
139
- - It is now possible to convert the public fields of an `DescribedEntry` to JSON using its function `publicFieldsJson`.
140
- This includes all contained groups, that may contain `DescribedEntry`s themselves.
141
- Prior to this release, the following error occurred when calling `JSON.stringify(describedEntry)`:
142
- `TypeError: Converting circular structure to JSON`
243
+ - It is now possible to convert the public fields of an `DescribedEntry` to JSON using its function `publicFieldsJson`.
244
+ This includes all contained groups, that may contain `DescribedEntry`s themselves.
245
+ Prior to this release, the following error occurred when calling `JSON.stringify(describedEntry)`:
246
+ `TypeError: Converting circular structure to JSON`
143
247
 
144
248
  **Note:**
145
249
  The property `isMatchingIndex` of the `DescribedEntry` had been renamed to `_isMatchingIndex` since it is an internal property and should not be used outside. Since this is a "breaking change" (in theory), it lead to a new major version.
146
250
 
147
251
  This example shows how the returned JSON looks like using parameter "space" = 2 (pretty print with 2 spaces indentation) when the `DescribedEntry` contains the group `options`:
252
+
148
253
  ```JSON
149
254
  {
150
255
  "category": "account",
@@ -171,48 +276,48 @@ Please use `new datarestructor.Transform(descriptions).processJson(jsonData)` in
171
276
  }
172
277
  ```
173
278
 
279
+ ## [v1.2.0](https://github.com/JohT/data-restructor-js/compare/v1.1.0...v1.2.0) Resolving template containing properties of the described entry as variables (29 November 2020)
174
280
 
175
- ## **v1.2.0** Resolving template containing properties of the described entry as variables (2014-11-29)
281
+ ### Features
176
282
 
177
- ### Features:
178
- - It is now possible to resolve a string containing variables in double curly brackets of an `DecribedEntry` using the function `resolveTemplate(templateString)`.
283
+ - It is now possible to resolve a string containing variables in double curly brackets of an `DecribedEntry` using the function `resolveTemplate(templateString)`.
179
284
 
180
- #### Variables that can be used:
181
- - `"{{fieldName}}"`
182
- - `"{{displayName}}"`
183
- - `"{{value}}"`
184
- - `"{{index}}"`
185
- - `"{{index[1]}}"`
285
+ #### Variables that can be used
186
286
 
187
- #### Example:
188
- ```javascript
189
- var rawEntry = { name: "responses[0].hits.hits[3]._source.name", value: "Smith" };
190
- var description = new datarestructor.PropertyStructureDescriptionBuilder().type("testtype").category("testcategory").build();
191
- var describedEntry = new datarestructor.DescribedEntryCreator(rawEntry, description);
287
+ - `"{{fieldName}}"`
288
+ - `"{{displayName}}"`
289
+ - `"{{value}}"`
290
+ - `"{{index}}"`
291
+ - `"{{index[1]}}"`
192
292
 
193
- var resolved = describedEntry.resolveTemplate("{{displayName}}: {{value}}");
194
- // resolved is: "Name: Smith"
195
- ```
293
+ #### Example
196
294
 
295
+ ```javascript
296
+ var rawEntry = { name: "responses[0].hits.hits[3]._source.name", value: "Smith" };
297
+ var description = new datarestructor.PropertyStructureDescriptionBuilder().type("testtype").category("testcategory").build();
298
+ var describedEntry = new datarestructor.DescribedEntryCreator(rawEntry, description);
197
299
 
198
- ## **v1.1.0** Joining and renaming groups (2014-11-08)
300
+ var resolved = describedEntry.resolveTemplate("{{displayName}}: {{value}}");
301
+ // resolved is: "Name: Smith"
302
+ ```
199
303
 
200
- ### Features:
304
+ ## [v1.1.0](https://github.com/JohT/data-restructor-js/compare/v1.0.0...v1.1.0) Joining and renaming groups (8 November 2020)
201
305
 
202
- - Group destination name and joining (JohT@534c368bcb835c110e1255508ed44c790972955c)
203
- - Groups can now be renamed, when they get moved to another destination.
204
- - If more than one source group (array) is moved into a single destination, they get joined.
205
- Previously, only the last one remained, which made it impossible to structure data within one single (e.g. main) entry.
206
- - Debug mode introduced (JohT@72232e7f23ced9655c1d2693a3a5b3163c312221)
207
- - Minor refactorings (JohT@14094fe247c1c1551ff518a1378a26b0cfc074c9)
306
+ ### Features
208
307
 
308
+ - [Group destination name and joining](https://github.com/JohT/data-restructor-js/commit/534c368bcb835c110e1255508ed44c790972955c)
309
+ - Groups can now be renamed, when they get moved to another destination.
310
+ - If more than one source group (array) is moved into a single destination, they get joined.
311
+ Previously, only the last one remained, which made it impossible to structure data within one single (e.g. main) entry.
312
+ - [Debug mode introduced](https://github.com/JohT/data-restructor-js/commit/72232e7f23ced9655c1d2693a3a5b3163c312221)
313
+ - [Minor refactoring](https://github.com/JohT/data-restructor-js/commit/14094fe247c1c1551ff518a1378a26b0cfc074c9)
209
314
 
210
- ## **v1.0.0** Initial Release (2014-10-25)
315
+ ## [v1.0.0](https://github.com/JohT/data-restructor-js/releases/tag/v1.0.0) Initial Release (2020-10-25)
211
316
 
212
- ### Features:
317
+ ### Features
213
318
 
214
- - Adapter that takes e.g. parsed JSON and transforms it into a standardized structure
215
- - Multiple transformation steps including flattening, removing duplicates, grouping, ...
216
- - Takes descriptions that reflect the incoming structure and define the standardized output
217
- - Reusable and flexible
218
- - Supports most browser including ie5
319
+ - Adapter that takes e.g. parsed JSON and transforms it into a standardized structure
320
+ - Multiple transformation steps including flattening, removing duplicates, grouping, ...
321
+ - Takes descriptions that reflect the incoming structure and define the standardized output
322
+ - Reusable and flexible
323
+ - Supports most browser including IE 5