componentsjs 4.3.0 → 5.0.0-beta.0

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 (57) hide show
  1. package/bin/compile-config.js +1 -1
  2. package/components/context.jsonld +40 -2
  3. package/index.d.ts +1 -0
  4. package/index.js +1 -0
  5. package/lib/construction/ConfigConstructor.js +10 -6
  6. package/lib/construction/argument/ArgumentConstructorHandlerHash.js +3 -2
  7. package/lib/construction/argument/ArgumentConstructorHandlerList.d.ts +11 -0
  8. package/lib/construction/argument/ArgumentConstructorHandlerList.js +19 -0
  9. package/lib/construction/strategy/ConstructionStrategyCommonJsString.js +3 -0
  10. package/lib/construction/strategy/IConstructionStrategy.d.ts +2 -2
  11. package/lib/loading/ComponentRegistry.d.ts +1 -1
  12. package/lib/loading/ComponentRegistry.js +1 -1
  13. package/lib/loading/ComponentRegistryFinalizer.js +18 -3
  14. package/lib/loading/ComponentsManagerBuilder.js +1 -1
  15. package/lib/loading/ConfigRegistry.d.ts +1 -1
  16. package/lib/preprocess/ConfigPreprocessorComponent.d.ts +1 -1
  17. package/lib/preprocess/ConfigPreprocessorComponent.js +17 -12
  18. package/lib/preprocess/ConfigPreprocessorComponentMapped.d.ts +3 -3
  19. package/lib/preprocess/ConfigPreprocessorComponentMapped.js +8 -11
  20. package/lib/preprocess/ParameterHandler.d.ts +2 -2
  21. package/lib/preprocess/ParameterHandler.js +20 -9
  22. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerCollectEntries.d.ts +1 -1
  23. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerCollectEntries.js +20 -8
  24. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerElements.d.ts +1 -1
  25. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerElements.js +7 -4
  26. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerFields.d.ts +1 -1
  27. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerFields.js +14 -8
  28. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerKeyValue.d.ts +3 -3
  29. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerKeyValue.js +7 -7
  30. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerList.d.ts +1 -1
  31. package/lib/preprocess/constructorargumentsmapping/ConstructorArgumentsElementMappingHandlerList.js +6 -21
  32. package/lib/preprocess/constructorargumentsmapping/IConstructorArgumentsElementMappingHandler.d.ts +1 -1
  33. package/lib/preprocess/constructorargumentsmapping/IConstructorArgumentsMapper.d.ts +2 -2
  34. package/lib/preprocess/parameterproperty/IParameterPropertyHandler.d.ts +2 -2
  35. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefault.d.ts +6 -3
  36. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefault.js +20 -3
  37. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefaultScoped.d.ts +2 -2
  38. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerDefaultScoped.js +16 -5
  39. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerFixed.d.ts +5 -3
  40. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerFixed.js +25 -2
  41. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerLazy.d.ts +2 -2
  42. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerLazy.js +10 -3
  43. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.d.ts +15 -4
  44. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js +141 -25
  45. package/lib/rdf/Iris.js +24 -24
  46. package/lib/rdf/RdfParser.d.ts +2 -2
  47. package/lib/rdf/RdfParser.js +17 -5
  48. package/lib/rdf/RdfStreamIncluder.d.ts +1 -1
  49. package/lib/rdf/RdfStreamIncluder.js +2 -2
  50. package/lib/util/ErrorResourcesContext.d.ts +3 -3
  51. package/lib/util/ErrorResourcesContext.js +6 -1
  52. package/package.json +10 -10
  53. package/CHANGELOG.md +0 -176
  54. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRequired.d.ts +0 -11
  55. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerRequired.js +0 -23
  56. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerUnique.d.ts +0 -12
  57. package/lib/preprocess/parameterproperty/ParameterPropertyHandlerUnique.js +0 -34
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { Readable } from 'stream';
3
- import type * as RDF from 'rdf-js';
3
+ import type * as RDF from '@rdfjs/types';
4
4
  import type { ParseOptions } from 'rdf-parse';
5
5
  import type { Logger } from 'winston';
6
6
  /**
@@ -41,7 +41,7 @@ export declare type RdfParserOptions = ParseOptions & {
41
41
  */
42
42
  contexts?: Record<string, any>;
43
43
  /**
44
- * The cached import paths.
44
+ * The cached import paths. (URL -> file)
45
45
  */
46
46
  importPaths?: Record<string, string>;
47
47
  /**
@@ -20,10 +20,22 @@ class RdfParser {
20
20
  // Parsing libraries don't work as expected if path contains backslashes
21
21
  options.path = options.path.replace(/\\+/gu, '/');
22
22
  if (!options.baseIRI) {
23
- options.baseIRI = options.path;
24
- // Windows paths always contain a ':'
25
- if (!options.baseIRI.includes(':') || /^[A-Za-z]:[/\\][^/]/u.test(options.baseIRI)) {
26
- options.baseIRI = `file://${options.baseIRI}`;
23
+ // Try converting path to URL using defined import paths
24
+ if (options.importPaths) {
25
+ for (const [url, file] of Object.entries(options.importPaths)) {
26
+ if (options.path.startsWith(file)) {
27
+ options.baseIRI = `${url}${options.path.slice(file.length)}`;
28
+ break;
29
+ }
30
+ }
31
+ }
32
+ // Fallback to a baseIRI using the file scheme
33
+ if (!options.baseIRI) {
34
+ options.baseIRI = options.path;
35
+ // Windows paths always contain a ':'
36
+ if (!options.baseIRI.includes(':') || /^[A-Za-z]:[/\\][^/]/u.test(options.baseIRI)) {
37
+ options.baseIRI = `file://${options.baseIRI}`;
38
+ }
27
39
  }
28
40
  }
29
41
  // Set JSON-LD parser options
@@ -61,7 +73,7 @@ class RdfParser {
61
73
  if (!(await fs.stat(pathOrUrl)).isFile()) {
62
74
  throw new Error(`Path does not refer to a valid file: ${pathOrUrl}`);
63
75
  }
64
- return fs_1.createReadStream(pathOrUrl);
76
+ return (0, fs_1.createReadStream)(pathOrUrl);
65
77
  }
66
78
  /**
67
79
  * Add the path to an error message.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import type { TransformCallback } from 'stream';
3
3
  import { Transform } from 'stream';
4
- import type * as RDF from 'rdf-js';
4
+ import type * as RDF from '@rdfjs/types';
5
5
  import type { RdfParserOptions } from './RdfParser';
6
6
  /**
7
7
  * A RdfStreamIncluder takes a triple stream and detects owl:includes to automatically include other files.
@@ -51,7 +51,7 @@ class RdfStreamIncluder extends stream_1.Transform {
51
51
  // Recursively call the parser
52
52
  RdfParser_1.RdfParser.fetchFileOrUrl(relativeFilePath)
53
53
  .then((rawStream) => {
54
- const data = new RdfParser_1.RdfParser().parse(rawStream, Object.assign(Object.assign({}, this.parserOptions), { path: relativeFilePath, importedFromPath: this.parserOptions.path }));
54
+ const data = new RdfParser_1.RdfParser().parse(rawStream, Object.assign(Object.assign({}, this.parserOptions), { baseIRI: undefined, path: relativeFilePath, importedFromPath: this.parserOptions.path }));
55
55
  data
56
56
  .on('data', (subData) => this.push(subData))
57
57
  .on('error', (error) => this.emit('error', error))
@@ -70,7 +70,7 @@ class RdfStreamIncluder extends stream_1.Transform {
70
70
  */
71
71
  validateIris(quad) {
72
72
  if (this.parserOptions.logger) {
73
- for (const term of rdf_terms_1.getNamedNodes(rdf_terms_1.getTerms(quad))) {
73
+ for (const term of (0, rdf_terms_1.getNamedNodes)((0, rdf_terms_1.getTerms)(quad))) {
74
74
  if (!RdfStreamIncluder.isValidIri(term.value)) {
75
75
  this.parserOptions.logger.warn(`Detected potentially invalid IRI '${term.value}' in ${this.parserOptions.path}`);
76
76
  }
@@ -3,9 +3,9 @@ import type { Resource } from 'rdf-object';
3
3
  * An error that can include a context containing resources for display.
4
4
  */
5
5
  export declare class ErrorResourcesContext extends Error {
6
- readonly context: Record<string, Resource | string>;
7
- constructor(message: string, context: Record<string, Resource | string>);
8
- static contextToString(context: Record<string, Resource | string>): string;
6
+ readonly context: Record<string, Resource | Resource[] | string>;
7
+ constructor(message: string, context: Record<string, Resource | Resource[] | string>);
8
+ static contextToString(context: Record<string, Resource | Resource[] | string>): string;
9
9
  /**
10
10
  * Convert the given resource to a compact string.
11
11
  * Mainly used for error reporting.
@@ -13,7 +13,12 @@ class ErrorResourcesContext extends Error {
13
13
  }
14
14
  static contextToString(context) {
15
15
  return Object.entries(context)
16
- .map(([key, value]) => `${key}: ${typeof value === 'string' ? value : ErrorResourcesContext.resourceToString(value)}`)
16
+ .map(([key, value]) => `${key}: ${typeof value === 'string' ?
17
+ value :
18
+ // eslint-disable-next-line @typescript-eslint/no-extra-parens
19
+ (Array.isArray(value) ?
20
+ value.map(valueSub => ErrorResourcesContext.resourceToString(valueSub)) :
21
+ ErrorResourcesContext.resourceToString(value))}`)
17
22
  .join('\n');
18
23
  }
19
24
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "componentsjs",
3
- "version": "4.3.0",
3
+ "version": "5.0.0-beta.0",
4
4
  "description": "A semantic dependency injection framework",
5
5
  "lsd:contexts": {
6
6
  "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^3.0.0/components/context.jsonld": "components/context.jsonld"
@@ -33,17 +33,17 @@
33
33
  "version": "manual-git-changelog onversion"
34
34
  },
35
35
  "dependencies": {
36
+ "@rdfjs/types": "*",
36
37
  "@types/minimist": "^1.2.0",
37
38
  "@types/node": "^14.14.7",
38
- "@types/rdf-js": "*",
39
39
  "@types/semver": "^7.3.4",
40
40
  "jsonld-context-parser": "^2.1.1",
41
41
  "minimist": "^1.2.0",
42
- "rdf-data-factory": "^1.0.4",
43
- "rdf-object": "^1.8.0",
44
- "rdf-parse": "^1.8.1",
42
+ "rdf-data-factory": "^1.1.0",
43
+ "rdf-object": "^1.12.0",
44
+ "rdf-parse": "^1.9.1",
45
45
  "rdf-quad": "^1.5.0",
46
- "rdf-terms": "^1.6.2",
46
+ "rdf-terms": "^1.7.0",
47
47
  "semver": "^7.3.2",
48
48
  "winston": "^3.3.3"
49
49
  },
@@ -51,7 +51,7 @@
51
51
  "@rubensworks/eslint-config": "^1.0.1",
52
52
  "@typescript-eslint/eslint-plugin": "^4.6.1",
53
53
  "@typescript-eslint/parser": "^4.6.1",
54
- "@types/jest": "^26.0.23",
54
+ "@types/jest": "^27.0.0",
55
55
  "eslint": "^7.12.1",
56
56
  "eslint-config-es": "3.25.3",
57
57
  "eslint-import-resolver-typescript": "^2.3.0",
@@ -60,14 +60,14 @@
60
60
  "eslint-plugin-tsdoc": "^0.2.7",
61
61
  "eslint-plugin-unused-imports": "^1.0.0",
62
62
  "jest": "^27.0.1",
63
- "jest-rdf": "^1.6.0",
63
+ "jest-rdf": "^1.7.0",
64
64
  "jshint": "^2.1.10",
65
65
  "manual-git-changelog": "^1.0.1",
66
- "n3": "^1.6.3",
66
+ "n3": "^1.11.1",
67
67
  "pre-commit": "^1.2.2",
68
68
  "streamify-string": "^1.0.1",
69
69
  "ts-jest": "^27.0.1",
70
- "typescript": "^4.0.3"
70
+ "typescript": "^4.3.5"
71
71
  },
72
72
  "files": [
73
73
  "components",
package/CHANGELOG.md DELETED
@@ -1,176 +0,0 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file.
3
-
4
- <a name="v4.3.0"></a>
5
- ## [v4.3.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.2.1...v4.3.0) - 2021-06-14
6
-
7
- ### Added
8
- * [Support JSON param ranges via rdf:JSON, Closes #37](https://github.com/LinkedSoftwareDependencies/Components.js/commit/339d2219915bc618991a42adcd8b63a3d6caa9b5)
9
-
10
- <a name="v4.2.1"></a>
11
- ## [v4.2.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.2.0...v4.2.1) - 2021-05-26
12
-
13
- ### Fixed
14
- * [Allow configs to have multiple identical types, comunica/examples#11](https://github.com/LinkedSoftwareDependencies/Components.js/commit/5285f8e68fefb13d46538c6949238200055a2047)
15
-
16
- <a name="v4.2.0"></a>
17
- ## [v4.2.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.1.0...v4.2.0) - 2021-05-19
18
-
19
- ### Added
20
- * [Expose RdfObjectLoader ctor from ComponentsManagerBuilder](https://github.com/LinkedSoftwareDependencies/Components.js/commit/1b1c85adb50855eed5b628788ccea3609aa841ca)
21
-
22
- <a name="v4.1.0"></a>
23
- ## [v4.1.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.6...v4.1.0) - 2021-04-27
24
-
25
- ### Added
26
- * [Allow JSON-LD context validation to be skipped](https://github.com/LinkedSoftwareDependencies/Components.js/commit/40931625dc0a577800c60e0cb4aa12393eb26bab)
27
-
28
- <a name="v4.0.6"></a>
29
- ## [v4.0.6](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.5...v4.0.6) - 2021-01-27
30
-
31
- ### Fixed
32
- * [Fix undefined root constructor args missing instead of being undefined](https://github.com/LinkedSoftwareDependencies/Components.js/commit/de14c611122ddb031d2973d4e667efa5b13bdf45)
33
-
34
- <a name="v4.0.5"></a>
35
- ## [v4.0.5](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.4...v4.0.5) - 2021-01-18
36
-
37
- ### Fixed
38
- * [Allow module discovery in packages without package.json](https://github.com/LinkedSoftwareDependencies/Components.js/commit/a0ac0cb47b2ed07ef7a88619133af15ba71f3577)
39
-
40
- <a name="v4.0.4"></a>
41
- ## [v4.0.4](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.3...v4.0.4) - 2021-01-15
42
-
43
- ### Changed
44
- * [Bump rdf-parse with updated components.js context URL](https://github.com/LinkedSoftwareDependencies/Components.js/commit/7525a027c683890f30f4e47402c89dcca7dd89d7)
45
-
46
- <a name="v4.0.3"></a>
47
- ## [v4.0.3](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.2...v4.0.3) - 2021-01-15
48
-
49
- ### Fixed
50
- * [Fix broken infinite recursion workaround, #31](https://github.com/LinkedSoftwareDependencies/Components.js/commit/e9f2fdc78eca77f3070663c4dc360e93b1f4c0bb)
51
-
52
- <a name="v4.0.2"></a>
53
- ## [v4.0.2](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.1...v4.0.2) - 2021-01-15
54
-
55
- ### Fixed
56
- * [Fix instances being created multiple times, Closes #31](https://github.com/LinkedSoftwareDependencies/Components.js/commit/94ce08874b24bf9c64d7f722beb2d5556aa9c7e9)
57
- * [Fix value inheritance happening multiple times](https://github.com/LinkedSoftwareDependencies/Components.js/commit/1855178930d2babd2c3a4c6cdad66087c1db79cd)
58
-
59
- <a name="v4.0.1"></a>
60
- ## [v4.0.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v4.0.0...v4.0.1) - 2021-01-14
61
-
62
- ### Fixed
63
- * [Fix module resolution failure when outside main module](https://github.com/LinkedSoftwareDependencies/Components.js/commit/2fb4de8abda5d5e91d39942edcc0bafd29acd8ce)
64
-
65
- <a name="v4.0.0"></a>
66
- ## [v4.0.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.6.0...v4.0.0) - 2021-01-14
67
-
68
- This release contains breaking changes in the programmatic API,
69
- but module and configuration files remain backwards-compatible.
70
-
71
- ### Added
72
- * Developer convenience
73
- * [Allow `lsd:module` to be set to true in package.json](https://github.com/LinkedSoftwareDependencies/Components.js/commit/afeac8ab11e801376d265d3e42b5df7e113bfce4)
74
- * [Emit warning when a remote context lookup is being done](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0f3968c26ff5c3d38e3cc8282c6039ff1221b4fd)
75
- * [Emit warning on potentially invalid parameters in config](https://github.com/LinkedSoftwareDependencies/Components.js/commit/a3ebb95a8d0e18ad062269c47b65cc2d9d1b603a)
76
- * [Emit warning on potentially invalid IRIs](https://github.com/LinkedSoftwareDependencies/Components.js/commit/18f9f974965d049fd3808ae3a725a36bf264183b)
77
- * [Generate componentsjs-error-state.json on error](https://github.com/LinkedSoftwareDependencies/Components.js/commit/bd47b17ba3fe82b2486e86bc678d950a9c478d18)
78
- * [Validate multiple key-value occurences in collectEntries](https://github.com/LinkedSoftwareDependencies/Components.js/commit/ab88b14aa5f2c0c18b34668d6ca1aed8d611de11)
79
- * [Improve printing of Resources in error reporting](https://github.com/LinkedSoftwareDependencies/Components.js/commit/48d2df7196a1e80e1bb55ac5c6518394b0942d4d)
80
- * [Rewrite injection of custom JSON-LD document loader](https://github.com/LinkedSoftwareDependencies/Components.js/commit/98ae62f9ddb6589a8651f3a4b9bac6b2bb6642b4)
81
- * [Migrate RDF loading logic to rdf-object](https://github.com/LinkedSoftwareDependencies/Components.js/commit/e5eb9d27e04a4a333487d5805ce5b0d17cd578a7)
82
-
83
- ### Changed
84
- * [Use rdfs:seeAlso instead of owl:imports for importing](https://github.com/LinkedSoftwareDependencies/Components.js/commit/4e4227cca2c588e008259440e211af90e6756949)
85
- * [Handle semver on multiple occurrences of module packages](https://github.com/LinkedSoftwareDependencies/Components.js/commit/c8b2e3377d397179505064e43c4408e19447df6f)
86
- * [Improve performance of module state loading through parallelization](https://github.com/LinkedSoftwareDependencies/Components.js/commit/4c475b0ee4d7fae31a818dc72fe28223827fd1f1)
87
- * Refactoring
88
- * [Accept loading from RDF/JS streams, Closes #1](https://github.com/LinkedSoftwareDependencies/Components.js/commit/749a7e7b5166414f68b5aabd285e5fd747b4dac4)
89
- * [Add logger](https://github.com/LinkedSoftwareDependencies/Components.js/commit/a5497590d3dabf06c00831f53d95da1554305b10)
90
- * [Split up Loader into ComponentsManager and loading classes](https://github.com/LinkedSoftwareDependencies/Components.js/commit/687b15c61ea8766b49dadf132fd38b0151f7f6ac)
91
- * [Split parameter property handling into seperate handlers](https://github.com/LinkedSoftwareDependencies/Components.js/commit/e60a2a8bddc8a89b834cc21db51964bb2f8c3a93)
92
- * [Create dedicated ParameterHandler component](https://github.com/LinkedSoftwareDependencies/Components.js/commit/408d299f77bc172e61a46d7dfbc4a6c931cecff6)
93
- * [Reorganize relevant classes into construction package](https://github.com/LinkedSoftwareDependencies/Components.js/commit/aa6b56328fd4442886a82fcad187bd7380c05f27)
94
- * [Split arguments creation into separate handlers](https://github.com/LinkedSoftwareDependencies/Components.js/commit/f3e995bd603369fb6e21d9be041ce96bec3b475b)
95
- * [Split constructor args handling into separate handlers](https://github.com/LinkedSoftwareDependencies/Components.js/commit/33f678c5e5df96277243feca893d46882ebdd927)
96
- * [Refactor component factories as config preprocessors](https://github.com/LinkedSoftwareDependencies/Components.js/commit/181b165f929cfcab206bc6d5ba22032f76d723c8)
97
- * [Remove Util.PREFIXES in favour if Iris](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0c0c671b18bd8fe2161d56fd39ee8645adc12c63)
98
- * [Decouple CommonJS instantiation and serialization into strategies](https://github.com/LinkedSoftwareDependencies/Components.js/commit/4756e0ce2f52711d7eb6df7afcc1011da210dbf0)
99
- * [Decouple instantiation logic from Loader class](https://github.com/LinkedSoftwareDependencies/Components.js/commit/02dd0e64e37c9961be68beba09f03a3b52d0c00f)
100
- * [Rewrite RdfStreamIncluder as Transform stream](https://github.com/LinkedSoftwareDependencies/Components.js/commit/edf6c61b28f06d2539bcdc8498f10586272a2632)
101
- * [Delay module registration until finalization phase](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0de3b7940277fd207d7729da4921e62063434e20)
102
- * [Refactor module loading into ModuleStateBuilder](https://github.com/LinkedSoftwareDependencies/Components.js/commit/6e6e54b498efb3e922466ef9868995926cd20ca8)
103
-
104
- ### Removed
105
- * [Remove feature to use global modules](https://github.com/LinkedSoftwareDependencies/Components.js/commit/fc0f943ac7e1cda4f84b3a65e2ad05ad1c7c42dc)
106
-
107
- ### Fixed
108
- * [Fix config compilation using wrong file path](https://github.com/LinkedSoftwareDependencies/Components.js/commit/fd3f806fe9cbb4f74a433e2a31212b5acdddf056)
109
- * [Fix mapped components only keeping first element of root arrays](https://github.com/LinkedSoftwareDependencies/Components.js/commit/0d33a9d88d473f930ce60c80949d13f5679b0df0)
110
-
111
- <a name="v3.6.1"></a>
112
- ## [v3.6.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.6.0...v3.6.1) - 2020-11-25
113
-
114
- ### Fixed
115
- * [Fix Array checks.](https://github.com/LinkedSoftwareDependencies/Components.js/commit/fdd48f6910ce395c72607992056f724953729f32)
116
- * [Fix function check.](https://github.com/LinkedSoftwareDependencies/Components.js/commit/b685468cfc9de39c74207a1f79cc9efae2bffa4e)
117
-
118
- <a name="v3.6.0"></a>
119
- ## [v3.6.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.5.0...v3.6.0) - 2020-09-14
120
-
121
- ### Added
122
- * [Supporting variables in config compilation](https://github.com/LinkedSoftwareDependencies/Components.js/commit/5eb5def9d77b7755d9e121b07c9d23676684a5f1)
123
-
124
- <a name="v3.5.0"></a>
125
- ## [v3.5.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.4.2...v3.5.0) - 2020-09-11
126
-
127
- ### Added
128
- * [Accept variables as parameter values, that can be set at init](https://github.com/LinkedSoftwareDependencies/Components.js/commit/cbd6f115cabf2bfcdcc8466f434d5cf52a4c23d5)
129
-
130
- <a name="v3.4.2"></a>
131
- ## [v3.4.2](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.4.1...v3.4.2) - 2020-08-27
132
-
133
- ### Fixed
134
- * [Fix empty list class loading failure](https://github.com/LinkedSoftwareDependencies/Components.js/commit/3590171287d2d765417469ea85012b651c88064b)
135
-
136
- <a name="v3.4.1"></a>
137
- ## [v3.4.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.4.0...v3.4.1) - 2020-07-01
138
-
139
- ### Changed
140
- * [Make types proper dependencies](https://github.com/LinkedSoftwareDependencies/Components.js/commit/d50005517d606798de130a6cb2a4a4456683574c)
141
-
142
- <a name="v3.4.0"></a>
143
- ## [v3.4.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.3.0...v3.4.0) - 2020-04-06
144
-
145
- ### Added
146
- * [Add requireNoConstructor option for raw requireElements](https://github.com/LinkedSoftwareDependencies/Components.js/commit/2d3144b8baad1464d590b691da10b752f7b83342)
147
-
148
- ### Fixed
149
- * [Fix incorrect error message for invalid dynamic entries](https://github.com/LinkedSoftwareDependencies/Components.js/commit/91b3a543973c06e3a0f3b6f667cc04a49e499103)
150
-
151
- <a name="v3.3.0"></a>
152
- ## [v3.3.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.2.1...v3.3.0) - 2019-10-21
153
-
154
- ### Added
155
- * [Allow requireName to be a relative path inside the module](https://github.com/LinkedSoftwareDependencies/Components.js/commit/562470dfbe6d3b1ab50e1202d8319adfafda024c)
156
-
157
- ### Changed
158
- * [Return error code on failure to compile](https://github.com/LinkedSoftwareDependencies/Components.js/commit/06aa3420911a41963a97586cabbf34ae477084b1)
159
-
160
- <a name="v3.2.1"></a>
161
- ## [v3.2.1](https://github.com/LinkedSoftwareDependencies/Components.js/compare/v3.2.0...v3.2.1) - 2019-02-21
162
-
163
- ### Fixed
164
- * [Fix issues where context and component files would conflict](https://github.com/LinkedSoftwareDependencies/Components.js/commit/9e4812b23f6bc70099672172d480fc4855775622)
165
- * [Fix incorrect comment context entry](https://github.com/LinkedSoftwareDependencies/Components.js/commit/21873b34a0dfc366f02ee1ad7dbd580795254ba5)
166
-
167
- <a name="v3.2.0"></a>
168
- ## [v3.2.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/2.0.0...v3.2.0) - 2018-11-13
169
-
170
- ### Changed
171
- * [Prioritize main modules when instantiating](https://github.com/LinkedSoftwareDependencies/Components.js/commit/c97f104d101f8dac96b501def69698615f58385b)
172
-
173
- <a name="v3.1.0"></a>
174
- ## [v3.1.0](https://github.com/LinkedSoftwareDependencies/Components.js/compare/2.0.0...v3.1.0) - 2018-11-13
175
-
176
- _Start tracking of changelog_
@@ -1,11 +0,0 @@
1
- import type { RdfObjectLoader, Resource } from 'rdf-object';
2
- import type { IParameterPropertyHandler } from './IParameterPropertyHandler';
3
- /**
4
- * If no value has been set, but a value is required, throw.
5
- */
6
- export declare class ParameterPropertyHandlerRequired implements IParameterPropertyHandler {
7
- private readonly objectLoader;
8
- constructor(objectLoader: RdfObjectLoader);
9
- canHandle(value: Resource[], configRoot: Resource, parameter: Resource, configElement: Resource): boolean;
10
- handle(value: Resource[], configRoot: Resource, parameter: Resource, configElement: Resource): Resource[];
11
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParameterPropertyHandlerRequired = void 0;
4
- const ErrorResourcesContext_1 = require("../../util/ErrorResourcesContext");
5
- /**
6
- * If no value has been set, but a value is required, throw.
7
- */
8
- class ParameterPropertyHandlerRequired {
9
- constructor(objectLoader) {
10
- this.objectLoader = objectLoader;
11
- }
12
- canHandle(value, configRoot, parameter, configElement) {
13
- return Boolean(value.length === 0 && parameter.property.required);
14
- }
15
- handle(value, configRoot, parameter, configElement) {
16
- throw new ErrorResourcesContext_1.ErrorResourcesContext(`No value was set for required parameter "${parameter.value}"`, {
17
- config: configElement,
18
- parameter,
19
- });
20
- }
21
- }
22
- exports.ParameterPropertyHandlerRequired = ParameterPropertyHandlerRequired;
23
- //# sourceMappingURL=ParameterPropertyHandlerRequired.js.map
@@ -1,12 +0,0 @@
1
- import type { RdfObjectLoader } from 'rdf-object';
2
- import { Resource } from 'rdf-object';
3
- import type { IParameterPropertyHandler } from './IParameterPropertyHandler';
4
- /**
5
- * If the value is singular, and the value should be unique, transform to a single element.
6
- */
7
- export declare class ParameterPropertyHandlerUnique implements IParameterPropertyHandler {
8
- private readonly objectLoader;
9
- constructor(objectLoader: RdfObjectLoader);
10
- canHandle(value: Resource[], configRoot: Resource, parameter: Resource, configElement: Resource): boolean;
11
- handle(value: Resource[], configRoot: Resource, parameter: Resource, configElement: Resource): Resource[];
12
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParameterPropertyHandlerUnique = void 0;
4
- const rdf_object_1 = require("rdf-object");
5
- /**
6
- * If the value is singular, and the value should be unique, transform to a single element.
7
- */
8
- class ParameterPropertyHandlerUnique {
9
- constructor(objectLoader) {
10
- this.objectLoader = objectLoader;
11
- }
12
- canHandle(value, configRoot, parameter, configElement) {
13
- return Boolean(parameter.property.unique && parameter.property.unique.value === 'true' && value.length > 0);
14
- }
15
- handle(value, configRoot, parameter, configElement) {
16
- value = [value[0]];
17
- // !!!Hack incoming!!!
18
- // We make a manual resource to ensure uniqueness from other resources.
19
- // This is needed because literals may occur different times in param values.
20
- // This ensures that the unique label is only applied to the current occurrence, instead of all occurrences.
21
- // TODO: improve this
22
- const newValue = new rdf_object_1.Resource({ term: value[0].term, context: this.objectLoader.contextResolved });
23
- for (const key of Object.keys(value[0].properties)) {
24
- for (const subValue of value[0].properties[key]) {
25
- newValue.properties[key].push(subValue);
26
- }
27
- }
28
- value = [newValue];
29
- value[0].property.unique = parameter.property.unique;
30
- return value;
31
- }
32
- }
33
- exports.ParameterPropertyHandlerUnique = ParameterPropertyHandlerUnique;
34
- //# sourceMappingURL=ParameterPropertyHandlerUnique.js.map