componentsjs 4.5.0 → 5.0.0-beta.3

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 (51) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/README.md +16 -0
  3. package/components/context.jsonld +87 -2
  4. package/lib/ComponentsManager.js +3 -5
  5. package/lib/construction/ConfigConstructor.js +7 -14
  6. package/lib/construction/argument/ArgumentConstructorHandlerHash.js +3 -2
  7. package/lib/construction/strategy/ConstructionStrategyCommonJsString.js +3 -0
  8. package/lib/construction/strategy/IConstructionStrategy.d.ts +2 -2
  9. package/lib/loading/ComponentRegistry.js +1 -1
  10. package/lib/loading/ComponentRegistryFinalizer.js +25 -4
  11. package/lib/preprocess/ConfigPreprocessorComponent.d.ts +3 -1
  12. package/lib/preprocess/ConfigPreprocessorComponent.js +34 -12
  13. package/lib/preprocess/ConfigPreprocessorComponentMapped.d.ts +4 -3
  14. package/lib/preprocess/ConfigPreprocessorComponentMapped.js +17 -18
  15. package/lib/preprocess/GenericsContext.d.ts +74 -0
  16. package/lib/preprocess/GenericsContext.js +326 -0
  17. package/lib/preprocess/ParameterHandler.d.ts +6 -2
  18. package/lib/preprocess/ParameterHandler.js +23 -21
  19. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerCollectEntries.d.ts +3 -2
  20. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerCollectEntries.js +24 -10
  21. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerElements.d.ts +2 -1
  22. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerElements.js +8 -5
  23. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerFields.d.ts +2 -1
  24. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerFields.js +16 -9
  25. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerKeyValue.d.ts +4 -3
  26. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerKeyValue.js +12 -12
  27. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerList.d.ts +2 -1
  28. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerList.js +9 -22
  29. package/lib/preprocess/constructorargumentsmapping/IConstructorArgumentsElementMappingHandler.d.ts +5 -2
  30. package/lib/preprocess/constructorargumentsmapping/IConstructorArgumentsMapper.d.ts +5 -2
  31. package/lib/preprocess/parameterproperty/IParameterPropertyHandler.d.ts +5 -2
  32. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefault.d.ts +6 -3
  33. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefault.js +20 -3
  34. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefaultScoped.d.ts +2 -2
  35. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefaultScoped.js +16 -5
  36. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerFixed.d.ts +5 -3
  37. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerFixed.js +25 -2
  38. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerLazy.d.ts +2 -2
  39. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerLazy.js +10 -3
  40. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.d.ts +38 -4
  41. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js +412 -31
  42. package/lib/rdf/RdfParser.d.ts +1 -1
  43. package/lib/rdf/RdfParser.js +16 -4
  44. package/lib/rdf/RdfStreamIncluder.js +1 -1
  45. package/lib/util/ErrorResourcesContext.d.ts +11 -14
  46. package/lib/util/ErrorResourcesContext.js +44 -22
  47. package/package.json +2 -2
  48. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRequired.d.ts +0 -11
  49. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRequired.js +0 -23
  50. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerUnique.d.ts +0 -12
  51. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerUnique.js +0 -34
package/CHANGELOG.md ADDED
@@ -0,0 +1,261 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ <a name="v5.0.0-beta.3"></a>
5
+ ## [v5.0.0-beta.3](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v5.0.0-beta.2...v5.0.0-beta.3) - 2022-01-17
6
+
7
+ ### Added
8
+ * [Add support for wildcard parameter ranges](https://github.com/LinkedSoftwareDependencies/Components.js/commit/83238a9fa08877f29326be562d7d3d5fff860c69)
9
+ * Improve error reporting:
10
+ * [Add causes for param check failures in error messages](https://github.com/LinkedSoftwareDependencies/Components.js/commit/9be1fd0899ffb8a77ea99e5fb86e661526ef6d1a)
11
+ * [Improve error message on invalid generic type instantiations](https://github.com/LinkedSoftwareDependencies/Components.js/commit/6ecb9798eeb84f09fece68b3a47454fa8c857ba4)
12
+ * [Move error context to error state file](https://github.com/LinkedSoftwareDependencies/Components.js/commit/dbf26e072bdc63168814ef4d503777efaf4745eb)
13
+
14
+ ### Fixed
15
+ * Resolve several issues related to generics:
16
+ * [Throw error on invalid ParameterRangeGenericComponent](https://github.com/LinkedSoftwareDependencies/Components.js/commit/c692ab6175ce466fb32fbe38b973644e2601b2e6)
17
+ * [Fix generic components not accepting specific types](https://github.com/LinkedSoftwareDependencies/Components.js/commit/c7739182fddcb92d46a86fe3e33d6e29fd1134b6)
18
+ * [Support generic type instantiation during component extension](https://github.com/LinkedSoftwareDependencies/Components.js/commit/98f70e350cc3f9bf8a4ea632db546f74624ddda7)
19
+ * [Support generic components in params with fixed generics](https://github.com/LinkedSoftwareDependencies/Components.js/commit/d8b30972e1306e9fe9db391d4693aa6000917e60)
20
+ * [Use GenericComponentExtension to refer to wrapped generic comp extensions](https://github.com/LinkedSoftwareDependencies/Components.js/commit/239895accfdb7f09a7ac8454928bd3e0be5e5f15)
21
+ * [Fix invalid range display with multiple generics](https://github.com/LinkedSoftwareDependencies/Components.js/commit/b98baf0bcf4546b60299ae548f929693345292bc)
22
+ * [Handle range merging if left or right is union](https://github.com/LinkedSoftwareDependencies/Components.js/commit/637e140106691b95f0f546cf88eb39f3f80dc61d)
23
+ * [Handle sub-types when merging param ranges](https://github.com/LinkedSoftwareDependencies/Components.js/commit/43290525b2e244f5fbb6d5f344760b863329c31b)
24
+ * [Allow merging of generic component param types](https://github.com/LinkedSoftwareDependencies/Components.js/commit/ee8de7d9b8d18bf6968a17078e493946e5fca8cd)
25
+ * [Allow param range merging with generic components](https://github.com/LinkedSoftwareDependencies/Components.js/commit/bcea7dcff288ce7068ee244c49c12134208c89da)
26
+ * [Fix generics crash when doing repeated param type checking](https://github.com/LinkedSoftwareDependencies/Components.js/commit/237572cb8a9c546b098582041ccd7a457b41aecd)
27
+
28
+ <a name="v5.0.0-beta.2"></a>
29
+ ## [v5.0.0-beta.2](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v5.0.0-beta.1...v5.0.0-beta.2) - 2021-12-09
30
+
31
+ ### Added
32
+ * [Handle keyof parameter ranges](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0f55ba05bff5311d111ca97256aaa2e7be7ae83b)
33
+
34
+ <a name="v5.0.0-beta.1"></a>
35
+ ## [v5.0.0-beta.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v5.0.0-beta.0...v5.0.0-beta.1) - 2021-12-07
36
+
37
+ ### Added
38
+ * [Handle generics in nested components](https://github.com/LinkedSoftwareDependencies/Components.js/commit/d33d4c2668974087873943b3d5c66300fa3df65b)
39
+ * [Handle generics in parameter ranges](https://github.com/LinkedSoftwareDependencies/Components.js/commit/d3358b74ab25a3aca13d6dfc97b16cfd836d4ba9)
40
+ * [Add generic vocabulary changes to context](https://github.com/LinkedSoftwareDependencies/Components.js/commit/b8af018bb8f344833c07d1ef795a6b08d414c2ad)
41
+
42
+ <a name="v5.0.0-beta.0"></a>
43
+ ## [v5.0.0-beta.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.5.0...v5.0.0-beta.0) - 2021-11-30
44
+
45
+ ### BREAKING CHANGES
46
+ * [Remove required and unique param flags in favor of parameter ranges](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0df26318e4803b06660b3458fc75d565c4b60f67):
47
+ This allows more complex ranges to be defined, such as nested arrays, or arrays of union types.
48
+ **Because of this change, arrays now must always be explicitly defined within an RDF list (or @list in JSON-LD).**
49
+ If one param value is provided, it is considered a singular value.
50
+ If the param value contains an RDF list, it is considered an array.
51
+ If multiple param values are provided without RDF list, an error is thrown.
52
+
53
+ ### Added
54
+ * Validate parameter values by type:
55
+ * [Validate param ranges with union and intersection types](https://github.com/LinkedSoftwareDependencies/Components.js/commit/d08ecdb94051d3e88e7e1ea09f0f77518fb0debf)
56
+ * [Validate types of resource-based param values](https://github.com/LinkedSoftwareDependencies/Components.js/commit/2be90ccb416215261ef9c785e89302f3c4ef9264)
57
+ * [Validate param ranges with tuple types](https://github.com/LinkedSoftwareDependencies/Components.js/commit/05d84c4c1d4bde6bcb5a99d53df4e66ca69536bf)
58
+ * [Validate param ranges with literal types](https://github.com/LinkedSoftwareDependencies/Components.js/commit/7373b0fc06bdaf95a8099b9f58b741cd6f4f1b9d)
59
+
60
+ ### Changed
61
+ * [Allow IRIs to be casted to string params](https://github.com/LinkedSoftwareDependencies/Components.js/commit/978985684dcba67629d44bfd0e5cf75293c5ea7a)
62
+ * [Allow components to be registered to multiple modules](https://github.com/LinkedSoftwareDependencies/Components.js/commit/e575e64ebd26092a6bb005d837023e35877e9308)
63
+ * [Make relative IRIs make use of importPaths-based URLs if possible](https://github.com/LinkedSoftwareDependencies/Components.js/commit/6a2e18c3bf6a1b95f826b66ee0ef8b154f10c3cc)
64
+
65
+ ### Fixed
66
+ * [Fix raw JSON values not being serializable to strings](https://github.com/LinkedSoftwareDependencies/Components.js/commit/96fe46eda1e153e87b29689196506ce6fbbdae58)
67
+
68
+ <a name="v4.5.0"></a>
69
+ ## [v4.5.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.4.1...v4.5.0) - 2021-08-30
70
+
71
+ ### Changed
72
+ * [Migrate to @rdfjs/types](https://github.com/LinkedSoftwareDependencies/Components.js/commit/b2f9f2e0c5512e743b324f48f332d96e4214ec84)
73
+
74
+ <a name="v4.4.1"></a>
75
+ ## [v4.4.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.4.0...v4.4.1) - 2021-07-26
76
+
77
+ ### Fixed
78
+ * [Fix RDF lists not being accepted for all params](https://github.com/LinkedSoftwareDependencies/Components.js/commit/a01e3c80a3a5ce28180f57e8358327c53774b9ba)
79
+
80
+ <a name="v4.4.0"></a>
81
+ ## [v4.4.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.2.1...v4.4.0) - 2021-06-30
82
+
83
+ ### Added
84
+ * [Accept RDF lists as argument values, #47](https://github.com/LinkedSoftwareDependencies/Components.js/commit/3501a0fe676d1bc43c2d3ad329fca0adef48c8cd)
85
+
86
+ ### Changed
87
+ * [Allow arrays of resources to be passed to ErrorResourcesContext](https://github.com/LinkedSoftwareDependencies/Components.js/commit/aedd53a3e923e030bf0d8433c27f1259183a0a14)
88
+
89
+ <a name="v4.3.0"></a>
90
+ ## [v4.3.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.2.1...v4.3.0) - 2021-06-14
91
+
92
+ ### Added
93
+ * [Support JSON param ranges via rdf:JSON, Closes #37](https://github.com/LinkedSoftwareDependencies/Components.js/commit/339d2219915bc618991a42adcd8b63a3d6caa9b5)
94
+
95
+ <a name="v4.2.1"></a>
96
+ ## [v4.2.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.2.0...v4.2.1) - 2021-05-26
97
+
98
+ ### Fixed
99
+ * [Allow configs to have multiple identical types, comunica/examples#11](https://github.com/LinkedSoftwareDependencies/Components.js/commit/5285f8e68fefb13d46538c6949238200055a2047)
100
+
101
+ <a name="v4.2.0"></a>
102
+ ## [v4.2.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.1.0...v4.2.0) - 2021-05-19
103
+
104
+ ### Added
105
+ * [Expose RdfObjectLoader ctor from ComponentsManagerBuilder](https://github.com/LinkedSoftwareDependencies/Components.js/commit/1b1c85adb50855eed5b628788ccea3609aa841ca)
106
+
107
+ <a name="v4.1.0"></a>
108
+ ## [v4.1.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.6...v4.1.0) - 2021-04-27
109
+
110
+ ### Added
111
+ * [Allow JSON-LD context validation to be skipped](https://github.com/LinkedSoftwareDependencies/Components.js/commit/40931625dc0a577800c60e0cb4aa12393eb26bab)
112
+
113
+ <a name="v4.0.6"></a>
114
+ ## [v4.0.6](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.5...v4.0.6) - 2021-01-27
115
+
116
+ ### Fixed
117
+ * [Fix undefined root constructor args missing instead of being undefined](https://github.com/LinkedSoftwareDependencies/Components.js/commit/de14c611122ddb031d2973d4e667efa5b13bdf45)
118
+
119
+ <a name="v4.0.5"></a>
120
+ ## [v4.0.5](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.4...v4.0.5) - 2021-01-18
121
+
122
+ ### Fixed
123
+ * [Allow module discovery in packages without package.json](https://github.com/LinkedSoftwareDependencies/Components.js/commit/a0ac0cb47b2ed07ef7a88619133af15ba71f3577)
124
+
125
+ <a name="v4.0.4"></a>
126
+ ## [v4.0.4](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.3...v4.0.4) - 2021-01-15
127
+
128
+ ### Changed
129
+ * [Bump rdf-parse with updated components.js context URL](https://github.com/LinkedSoftwareDependencies/Components.js/commit/7525a027c683890f30f4e47402c89dcca7dd89d7)
130
+
131
+ <a name="v4.0.3"></a>
132
+ ## [v4.0.3](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.2...v4.0.3) - 2021-01-15
133
+
134
+ ### Fixed
135
+ * [Fix broken infinite recursion workaround, #31](https://github.com/LinkedSoftwareDependencies/Components.js/commit/e9f2fdc78eca77f3070663c4dc360e93b1f4c0bb)
136
+
137
+ <a name="v4.0.2"></a>
138
+ ## [v4.0.2](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.1...v4.0.2) - 2021-01-15
139
+
140
+ ### Fixed
141
+ * [Fix instances being created multiple times, Closes #31](https://github.com/LinkedSoftwareDependencies/Components.js/commit/94ce08874b24bf9c64d7f722beb2d5556aa9c7e9)
142
+ * [Fix value inheritance happening multiple times](https://github.com/LinkedSoftwareDependencies/Components.js/commit/1855178930d2babd2c3a4c6cdad66087c1db79cd)
143
+
144
+ <a name="v4.0.1"></a>
145
+ ## [v4.0.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.0...v4.0.1) - 2021-01-14
146
+
147
+ ### Fixed
148
+ * [Fix module resolution failure when outside main module](https://github.com/LinkedSoftwareDependencies/Components.js/commit/2fb4de8abda5d5e91d39942edcc0bafd29acd8ce)
149
+
150
+ <a name="v4.0.0"></a>
151
+ ## [v4.0.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.6.0...v4.0.0) - 2021-01-14
152
+
153
+ This release contains breaking changes in the programmatic API,
154
+ but module and configuration files remain backwards-compatible.
155
+
156
+ ### Added
157
+ * Developer convenience
158
+ * [Allow `lsd:module` to be set to true in package.json](https://github.com/LinkedSoftwareDependencies/Components.js/commit/afeac8ab11e801376d265d3e42b5df7e113bfce4)
159
+ * [Emit warning when a remote context lookup is being done](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0f3968c26ff5c3d38e3cc8282c6039ff1221b4fd)
160
+ * [Emit warning on potentially invalid parameters in config](https://github.com/LinkedSoftwareDependencies/Components.js/commit/a3ebb95a8d0e18ad062269c47b65cc2d9d1b603a)
161
+ * [Emit warning on potentially invalid IRIs](https://github.com/LinkedSoftwareDependencies/Components.js/commit/18f9f974965d049fd3808ae3a725a36bf264183b)
162
+ * [Generate componentsjs-error-state.json on error](https://github.com/LinkedSoftwareDependencies/Components.js/commit/bd47b17ba3fe82b2486e86bc678d950a9c478d18)
163
+ * [Validate multiple key-value occurences in collectEntries](https://github.com/LinkedSoftwareDependencies/Components.js/commit/ab88b14aa5f2c0c18b34668d6ca1aed8d611de11)
164
+ * [Improve printing of Resources in error reporting](https://github.com/LinkedSoftwareDependencies/Components.js/commit/48d2df7196a1e80e1bb55ac5c6518394b0942d4d)
165
+ * [Rewrite injection of custom JSON-LD document loader](https://github.com/LinkedSoftwareDependencies/Components.js/commit/98ae62f9ddb6589a8651f3a4b9bac6b2bb6642b4)
166
+ * [Migrate RDF loading logic to rdf-object](https://github.com/LinkedSoftwareDependencies/Components.js/commit/e5eb9d27e04a4a333487d5805ce5b0d17cd578a7)
167
+
168
+ ### Changed
169
+ * [Use rdfs:seeAlso instead of owl:imports for importing](https://github.com/LinkedSoftwareDependencies/Components.js/commit/4e4227cca2c588e008259440e211af90e6756949)
170
+ * [Handle semver on multiple occurrences of module packages](https://github.com/LinkedSoftwareDependencies/Components.js/commit/c8b2e3377d397179505064e43c4408e19447df6f)
171
+ * [Improve performance of module state loading through parallelization](https://github.com/LinkedSoftwareDependencies/Components.js/commit/4c475b0ee4d7fae31a818dc72fe28223827fd1f1)
172
+ * Refactoring
173
+ * [Accept loading from RDF/JS streams, Closes #1](https://github.com/LinkedSoftwareDependencies/Components.js/commit/749a7e7b5166414f68b5aabd285e5fd747b4dac4)
174
+ * [Add logger](https://github.com/LinkedSoftwareDependencies/Components.js/commit/a5497590d3dabf06c00831f53d95da1554305b10)
175
+ * [Split up Loader into ComponentsManager and loading classes](https://github.com/LinkedSoftwareDependencies/Components.js/commit/687b15c61ea8766b49dadf132fd38b0151f7f6ac)
176
+ * [Split parameter property handling into seperate handlers](https://github.com/LinkedSoftwareDependencies/Components.js/commit/e60a2a8bddc8a89b834cc21db51964bb2f8c3a93)
177
+ * [Create dedicated ParameterHandler component](https://github.com/LinkedSoftwareDependencies/Components.js/commit/408d299f77bc172e61a46d7dfbc4a6c931cecff6)
178
+ * [Reorganize relevant classes into construction package](https://github.com/LinkedSoftwareDependencies/Components.js/commit/aa6b56328fd4442886a82fcad187bd7380c05f27)
179
+ * [Split arguments creation into separate handlers](https://github.com/LinkedSoftwareDependencies/Components.js/commit/f3e995bd603369fb6e21d9be041ce96bec3b475b)
180
+ * [Split constructor args handling into separate handlers](https://github.com/LinkedSoftwareDependencies/Components.js/commit/33f678c5e5df96277243feca893d46882ebdd927)
181
+ * [Refactor component factories as config preprocessors](https://github.com/LinkedSoftwareDependencies/Components.js/commit/181b165f929cfcab206bc6d5ba22032f76d723c8)
182
+ * [Remove Util.PREFIXES in favour if Iris](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0c0c671b18bd8fe2161d56fd39ee8645adc12c63)
183
+ * [Decouple CommonJS instantiation and serialization into strategies](https://github.com/LinkedSoftwareDependencies/Components.js/commit/4756e0ce2f52711d7eb6df7afcc1011da210dbf0)
184
+ * [Decouple instantiation logic from Loader class](https://github.com/LinkedSoftwareDependencies/Components.js/commit/02dd0e64e37c9961be68beba09f03a3b52d0c00f)
185
+ * [Rewrite RdfStreamIncluder as Transform stream](https://github.com/LinkedSoftwareDependencies/Components.js/commit/edf6c61b28f06d2539bcdc8498f10586272a2632)
186
+ * [Delay module registration until finalization phase](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0de3b7940277fd207d7729da4921e62063434e20)
187
+ * [Refactor module loading into ModuleStateBuilder](https://github.com/LinkedSoftwareDependencies/Components.js/commit/6e6e54b498efb3e922466ef9868995926cd20ca8)
188
+
189
+ ### Removed
190
+ * [Remove feature to use global modules](https://github.com/LinkedSoftwareDependencies/Components.js/commit/fc0f943ac7e1cda4f84b3a65e2ad05ad1c7c42dc)
191
+
192
+ ### Fixed
193
+ * [Fix config compilation using wrong file path](https://github.com/LinkedSoftwareDependencies/Components.js/commit/fd3f806fe9cbb4f74a433e2a31212b5acdddf056)
194
+ * [Fix mapped components only keeping first element of root arrays](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0d33a9d88d473f930ce60c80949d13f5679b0df0)
195
+
196
+ <a name="v3.6.1"></a>
197
+ ## [v3.6.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.6.0...v3.6.1) - 2020-11-25
198
+
199
+ ### Fixed
200
+ * [Fix Array checks.](https://github.com/LinkedSoftwareDependencies/Components.js/commit/fdd48f6910ce395c72607992056f724953729f32)
201
+ * [Fix function check.](https://github.com/LinkedSoftwareDependencies/Components.js/commit/b685468cfc9de39c74207a1f79cc9efae2bffa4e)
202
+
203
+ <a name="v3.6.0"></a>
204
+ ## [v3.6.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.5.0...v3.6.0) - 2020-09-14
205
+
206
+ ### Added
207
+ * [Supporting variables in config compilation](https://github.com/LinkedSoftwareDependencies/Components.js/commit/5eb5def9d77b7755d9e121b07c9d23676684a5f1)
208
+
209
+ <a name="v3.5.0"></a>
210
+ ## [v3.5.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.4.2...v3.5.0) - 2020-09-11
211
+
212
+ ### Added
213
+ * [Accept variables as parameter values, that can be set at init](https://github.com/LinkedSoftwareDependencies/Components.js/commit/cbd6f115cabf2bfcdcc8466f434d5cf52a4c23d5)
214
+
215
+ <a name="v3.4.2"></a>
216
+ ## [v3.4.2](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.4.1...v3.4.2) - 2020-08-27
217
+
218
+ ### Fixed
219
+ * [Fix empty list class loading failure](https://github.com/LinkedSoftwareDependencies/Components.js/commit/3590171287d2d765417469ea85012b651c88064b)
220
+
221
+ <a name="v3.4.1"></a>
222
+ ## [v3.4.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.4.0...v3.4.1) - 2020-07-01
223
+
224
+ ### Changed
225
+ * [Make types proper dependencies](https://github.com/LinkedSoftwareDependencies/Components.js/commit/d50005517d606798de130a6cb2a4a4456683574c)
226
+
227
+ <a name="v3.4.0"></a>
228
+ ## [v3.4.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.3.0...v3.4.0) - 2020-04-06
229
+
230
+ ### Added
231
+ * [Add requireNoConstructor option for raw requireElements](https://github.com/LinkedSoftwareDependencies/Components.js/commit/2d3144b8baad1464d590b691da10b752f7b83342)
232
+
233
+ ### Fixed
234
+ * [Fix incorrect error message for invalid dynamic entries](https://github.com/LinkedSoftwareDependencies/Components.js/commit/91b3a543973c06e3a0f3b6f667cc04a49e499103)
235
+
236
+ <a name="v3.3.0"></a>
237
+ ## [v3.3.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.2.1...v3.3.0) - 2019-10-21
238
+
239
+ ### Added
240
+ * [Allow requireName to be a relative path inside the module](https://github.com/LinkedSoftwareDependencies/Components.js/commit/562470dfbe6d3b1ab50e1202d8319adfafda024c)
241
+
242
+ ### Changed
243
+ * [Return error code on failure to compile](https://github.com/LinkedSoftwareDependencies/Components.js/commit/06aa3420911a41963a97586cabbf34ae477084b1)
244
+
245
+ <a name="v3.2.1"></a>
246
+ ## [v3.2.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.2.0...v3.2.1) - 2019-02-21
247
+
248
+ ### Fixed
249
+ * [Fix issues where context and component files would conflict](https://github.com/LinkedSoftwareDependencies/Components.js/commit/9e4812b23f6bc70099672172d480fc4855775622)
250
+ * [Fix incorrect comment context entry](https://github.com/LinkedSoftwareDependencies/Components.js/commit/21873b34a0dfc366f02ee1ad7dbd580795254ba5)
251
+
252
+ <a name="v3.2.0"></a>
253
+ ## [v3.2.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/2.0.0...v3.2.0) - 2018-11-13
254
+
255
+ ### Changed
256
+ * [Prioritize main modules when instantiating](https://github.com/LinkedSoftwareDependencies/Components.js/commit/c97f104d101f8dac96b501def69698615f58385b)
257
+
258
+ <a name="v3.1.0"></a>
259
+ ## [v3.1.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/2.0.0...v3.1.0) - 2018-11-13
260
+
261
+ _Start tracking of changelog_
package/README.md CHANGED
@@ -202,6 +202,22 @@ const myInstance = await manager.instantiate('http://example.org/myInstance');
202
202
  [RDF]: https://www.w3.org/RDF/
203
203
  [JSON-LD]: https://json-ld.org/
204
204
 
205
+ ## Cite
206
+
207
+ If you are using or extending Components.js as part of a scientific publication,
208
+ we would appreciate a citation of our [article](https://linkedsoftwaredependencies.github.io/Article-System-Components/).
209
+
210
+ ```bibtex
211
+ @article{taelman_swj_componentsjs_2022,
212
+ author = {Taelman, Ruben and Van Herwegen, Joachim and Vander Sande, Miel and Verborgh, Ruben},
213
+ title = {Components.js: Semantic Dependency Injection},
214
+ journal = {Semantic Web Journal},
215
+ year = {2022},
216
+ month = jan,
217
+ url = {https://linkedsoftwaredependencies.github.io/Article-System-Components/}
218
+ }
219
+ ```
220
+
205
221
  ## License
206
222
  Components.js is written by [Ruben Taelman](http://www.rubensworks.net/).
207
223
 
@@ -2,6 +2,9 @@
2
2
  "@context": {
3
3
  "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
4
4
  "xsd": "http://www.w3.org/2001/XMLSchema#",
5
+ "type": {
6
+ "@id": "rdf:type"
7
+ },
5
8
  "types": {
6
9
  "@id": "rdf:type"
7
10
  },
@@ -22,9 +25,19 @@
22
25
  "components": {
23
26
  "@id": "oo:component"
24
27
  },
28
+ "component": {
29
+ "@id": "oo:component",
30
+ "@type": "@id"
31
+ },
25
32
  "parameters": {
26
33
  "@id": "oo:parameter"
27
34
  },
35
+ "memberKeys": {
36
+ "@id": "oo:memberKey"
37
+ },
38
+ "genericTypeParameters": {
39
+ "@id": "oo:genericTypeParameter"
40
+ },
28
41
  "constructorArguments": {
29
42
  "@id": "oo:constructorArguments",
30
43
  "@container": "@list"
@@ -61,6 +74,76 @@
61
74
  "undefined": {
62
75
  "@id": "oo:isUndefined"
63
76
  },
77
+ "ParameterRange": {
78
+ "@id": "oo:ParameterRange"
79
+ },
80
+ "ParameterRangeUndefined": {
81
+ "@id": "oo:ParameterRangeUndefined"
82
+ },
83
+ "ParameterRangeWildcard": {
84
+ "@id": "oo:ParameterRangeWildcard"
85
+ },
86
+ "ParameterRangeArray": {
87
+ "@id": "oo:ParameterRangeArray"
88
+ },
89
+ "ParameterRangeRest": {
90
+ "@id": "oo:ParameterRangeRest"
91
+ },
92
+ "ParameterRangeKeyof": {
93
+ "@id": "oo:ParameterRangeKeyof"
94
+ },
95
+ "ParameterRangeLiteral": {
96
+ "@id": "oo:ParameterRangeLiteral"
97
+ },
98
+ "parameterRangeValue": {
99
+ "@id": "oo:parameterRangeValue",
100
+ "@type": "@id"
101
+ },
102
+ "parameterRangeValueLiteral": {
103
+ "@id": "oo:parameterRangeValue"
104
+ },
105
+ "ParameterRangeUnion": {
106
+ "@id": "oo:ParameterRangeUnion"
107
+ },
108
+ "ParameterRangeIntersection": {
109
+ "@id": "oo:ParameterRangeIntersection"
110
+ },
111
+ "parameterRangeElements": {
112
+ "@id": "oo:parameterRangeElements",
113
+ "@type": "@id"
114
+ },
115
+ "ParameterRangeCollectEntries": {
116
+ "@id": "oo:ParameterRangeCollectEntries"
117
+ },
118
+ "parameterRangeCollectEntriesParameters": {
119
+ "@id": "oo:parameterRangeCollectEntriesParameter",
120
+ "@type": "@id"
121
+ },
122
+ "ParameterRangeGenericComponent": {
123
+ "@id": "oo:ParameterRangeGenericComponent"
124
+ },
125
+ "genericTypeInstancesComponentScope": {
126
+ "@id": "oo:genericTypeInstancesComponentScope",
127
+ "@type": "@id"
128
+ },
129
+ "genericTypeInstances": {
130
+ "@id": "oo:genericTypeInstance",
131
+ "@type": "@id"
132
+ },
133
+ "ParameterRangeGenericTypeReference": {
134
+ "@id": "oo:ParameterRangeGenericTypeReference"
135
+ },
136
+ "parameterRangeGenericType": {
137
+ "@id": "oo:parameterRangeGenericType",
138
+ "@type": "@id"
139
+ },
140
+ "parameterRangeGenericBindings": {
141
+ "@id": "oo:parameterRangeGenericBindings",
142
+ "@type": "@id"
143
+ },
144
+ "GenericComponentExtension": {
145
+ "@id": "oo:GenericComponentExtension"
146
+ },
64
147
 
65
148
  "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
66
149
  "comment": {
@@ -116,7 +199,8 @@
116
199
  },
117
200
  "fields": {
118
201
  "@id": "om:field",
119
- "@type": "om:ObjectMapEntry"
202
+ "@type": "om:ObjectMapEntry",
203
+ "@container": "@list"
120
204
  },
121
205
  "elements": {
122
206
  "@id": "om:elements",
@@ -125,7 +209,8 @@
125
209
  },
126
210
  "collectEntries": {
127
211
  "@id": "om:collectsEntriesFrom",
128
- "@type": "@id"
212
+ "@type": "@id",
213
+ "@container": "@list"
129
214
  },
130
215
  "keyRaw": {
131
216
  "@id": "om:fieldName"
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentsManager = void 0;
4
4
  const fs = require("fs");
5
5
  const ComponentsManagerBuilder_1 = require("./loading/ComponentsManagerBuilder");
6
+ const ErrorResourcesContext_1 = require("./util/ErrorResourcesContext");
6
7
  /**
7
8
  * A components manager can instantiate components.
8
9
  * This manager should be created using {@link ComponentsManager.build}.
@@ -51,17 +52,14 @@ class ComponentsManager {
51
52
  */
52
53
  generateErrorLog(error) {
53
54
  if (this.dumpErrorState) {
54
- const contents = JSON.stringify({
55
- componentTypes: Object.keys(this.componentResources),
56
- moduleState: {
55
+ const contents = JSON.stringify(Object.assign(Object.assign({}, error instanceof ErrorResourcesContext_1.ErrorResourcesContext ? error.exportContext() : {}), { componentTypes: Object.keys(this.componentResources), moduleState: {
57
56
  mainModulePath: this.moduleState.mainModulePath,
58
57
  componentModules: this.moduleState.componentModules,
59
58
  importPaths: this.moduleState.importPaths,
60
59
  contexts: this.moduleState.contexts,
61
60
  nodeModuleImportPaths: this.moduleState.nodeModuleImportPaths,
62
61
  nodeModulePaths: this.moduleState.nodeModulePaths,
63
- },
64
- }, null, ' ');
62
+ } }), null, ' ');
65
63
  fs.writeFileSync('componentsjs-error-state.json', contents, 'utf8');
66
64
  this.logger.error(`Detected fatal error. Generated 'componentsjs-error-state.json' with more information.`);
67
65
  }
@@ -31,22 +31,15 @@ class ConfigConstructor {
31
31
  this.moduleState = options.moduleState;
32
32
  }
33
33
  async getArgumentValues(values, settings) {
34
- // Unwrap unique values out of the array
35
- if (values.length > 0 && values[0].property.unique && values[0].property.unique.value === 'true') {
36
- return this.getArgumentValue(values[0], settings);
34
+ if (values.length === 0) {
35
+ return this.constructionStrategy.createUndefined();
37
36
  }
38
- // Unwrap RDF list-based values out of the array
39
- if (values.length > 0 && values.some(value => value.list)) {
40
- if (values.length > 1) {
41
- throw new ErrorResourcesContext_1.ErrorResourcesContext(`Detected multiple values for an argument while only a single RDF list is allowed`, {
42
- arguments: values.flatMap(value => value.list ? value.list : [value]),
43
- });
44
- }
45
- return this.getArgumentValue(values[0], settings);
37
+ if (values.length > 1) {
38
+ throw new ErrorResourcesContext_1.ErrorResourcesContext(`Detected multiple values for an argument. RDF lists should be used for defining multiple values.`, {
39
+ arguments: values,
40
+ });
46
41
  }
47
- // Otherwise, keep the array form
48
- const elements = await Promise.all(values.map(element => this.getArgumentValue(element, settings)));
49
- return this.constructionStrategy.createArray({ settings, elements });
42
+ return this.getArgumentValue(values[0], settings);
50
43
  }
51
44
  async getArgumentValue(value, settings) {
52
45
  // Check if this args resource can be handled by one of the built-in handlers.
@@ -7,11 +7,12 @@ const ErrorResourcesContext_1 = require("../../util/ErrorResourcesContext");
7
7
  */
8
8
  class ArgumentConstructorHandlerHash {
9
9
  canHandle(value, settings, argsCreator) {
10
- return Boolean(value.property.fields || value.property.hasFields);
10
+ return Boolean(value.property.fields);
11
11
  }
12
12
  async handle(argument, settings, argsCreator) {
13
+ const fields = argument.property.fields.list || [];
13
14
  // Determine all key-value pairs
14
- const entries = await Promise.all(argument.properties.fields.map(async (entry) => {
15
+ const entries = await Promise.all(fields.map(async (entry) => {
15
16
  // Validate entry
16
17
  if (!entry.property.key) {
17
18
  throw new ErrorResourcesContext_1.ErrorResourcesContext(`Missing key in fields entry`, { entry, argument });
@@ -103,6 +103,9 @@ class ConstructionStrategyCommonJsString {
103
103
  return `new function() { return Promise.resolve(${await options.supplier()}); }`;
104
104
  }
105
105
  createPrimitive(options) {
106
+ if (typeof options.value === 'object') {
107
+ return JSON.stringify(options.value);
108
+ }
106
109
  return typeof options.value === 'string' ? `'${options.value}'` : `${options.value}`;
107
110
  }
108
111
  getVariableValue(options) {
@@ -111,9 +111,9 @@ export interface ICreationStrategyPrimitiveOptions<Instance> {
111
111
  */
112
112
  settings: IConstructionSettings;
113
113
  /**
114
- * A string or number value.
114
+ * A string, number or object value.
115
115
  */
116
- value: string | number;
116
+ value: string | number | any;
117
117
  }
118
118
  export interface ICreationStrategyVariableOptions<Instance> {
119
119
  /**
@@ -55,7 +55,7 @@ class ComponentRegistry {
55
55
  registerModuleResource(moduleResource) {
56
56
  if (moduleResource.property.components) {
57
57
  for (const component of moduleResource.properties.components) {
58
- component.property.module = moduleResource;
58
+ component.properties.module.push(moduleResource);
59
59
  this.registerComponent(component);
60
60
  }
61
61
  }
@@ -41,7 +41,13 @@ class ComponentRegistryFinalizer {
41
41
  * @param superComponents The components to inherit from.
42
42
  */
43
43
  inheritParameters(component, superComponents) {
44
- for (const superComponent of superComponents) {
44
+ var _a;
45
+ for (let superComponent of superComponents) {
46
+ // Check if the super component is wrapped in a generic component instantiation
47
+ if (((_a = superComponent.property.type) === null || _a === void 0 ? void 0 : _a.value) === this.objectLoader.contextResolved
48
+ .expandTerm('oo:GenericComponentExtension')) {
49
+ superComponent = superComponent.property.component;
50
+ }
45
51
  this.componentRegistry.requireValidComponent(superComponent, component);
46
52
  for (const parameter of superComponent.properties.parameters) {
47
53
  if (!component.properties.parameters.includes(parameter)) {
@@ -75,11 +81,26 @@ class ComponentRegistryFinalizer {
75
81
  * @param extendingConstructorArgs The constructor argument resources to inherit from.
76
82
  */
77
83
  inheritConstructorArgumentsEntry(constructorArg, extendingConstructorArgs) {
84
+ // Make sure that we have fields in list-form
85
+ if (constructorArg.property.fields && !constructorArg.property.fields.list) {
86
+ if (constructorArg.properties.fields.length > 1) {
87
+ throw new ErrorResourcesContext_1.ErrorResourcesContext(`Invalid fields: Only one value can be defined, or an RDF list must be provided`, {
88
+ constructorArg,
89
+ });
90
+ }
91
+ constructorArg.property.fields = this.objectLoader.createCompactedResource({
92
+ list: constructorArg.properties.fields,
93
+ });
94
+ }
78
95
  for (const extendingConstructorArg of extendingConstructorArgs) {
79
96
  if (extendingConstructorArg.property.fields) {
80
- for (const field of extendingConstructorArg.properties.fields) {
81
- if (!constructorArg.properties.fields.includes(field)) {
82
- constructorArg.properties.fields.push(field);
97
+ // Inherit fields
98
+ for (const field of extendingConstructorArg.property.fields.list || extendingConstructorArg.properties.fields) {
99
+ if (!constructorArg.property.fields) {
100
+ constructorArg.property.fields = this.objectLoader.createCompactedResource({ list: [] });
101
+ }
102
+ if (!constructorArg.property.fields.list.includes(field)) {
103
+ constructorArg.property.fields.list.push(field);
83
104
  }
84
105
  }
85
106
  }
@@ -1,5 +1,6 @@
1
1
  import type { Resource, RdfObjectLoader } from 'rdf-object';
2
2
  import type { Logger } from 'winston';
3
+ import { GenericsContext } from './GenericsContext';
3
4
  import type { IConfigPreprocessor } from './IConfigPreprocessor';
4
5
  import type { ParameterHandler } from './ParameterHandler';
5
6
  /**
@@ -15,12 +16,13 @@ export declare class ConfigPreprocessorComponent implements IConfigPreprocessor<
15
16
  constructor(options: IComponentConfigPreprocessorOptions);
16
17
  canHandle(config: Resource): IComponentConfigPreprocessorHandleResponse | undefined;
17
18
  transform(config: Resource, handleResponse: IComponentConfigPreprocessorHandleResponse): Resource;
19
+ protected createGenericsContext(handleResponse: IComponentConfigPreprocessorHandleResponse, config: Resource): GenericsContext;
18
20
  /**
19
21
  * Determine the constructor arguments of the given config.
20
22
  * @param config A config.
21
23
  * @param handleResponse Return value of the {#canHandle}.
22
24
  */
23
- transformConstructorArguments(config: Resource, handleResponse: IComponentConfigPreprocessorHandleResponse): Resource[];
25
+ transformConstructorArguments(config: Resource, handleResponse: IComponentConfigPreprocessorHandleResponse): Resource;
24
26
  /**
25
27
  * Let this config inherit parameter values from previously instantiated configs.
26
28
  * This will check for inheritanceValues that are defined on the component,