@syncbridge/common 0.9.0 → 0.9.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.
package/constants.js
CHANGED
|
@@ -19,6 +19,14 @@ export { ElementComponentMetadataRecord };
|
|
|
19
19
|
let ElementComponentMetadata = class ElementComponentMetadata {
|
|
20
20
|
propertyKey;
|
|
21
21
|
};
|
|
22
|
+
__decorate([
|
|
23
|
+
ApiField({
|
|
24
|
+
label: 'Abstract',
|
|
25
|
+
description: 'Determines if the component uri is set in profile or it not. If set true an explicit uri is required.',
|
|
26
|
+
examples: ['@syncbridge/net:TcpClient', '@syncbridge/sqb:SqbClient'],
|
|
27
|
+
}),
|
|
28
|
+
__metadata("design:type", Boolean)
|
|
29
|
+
], ElementComponentMetadata.prototype, "abstract", void 0);
|
|
22
30
|
__decorate([
|
|
23
31
|
ApiField({
|
|
24
32
|
label: 'Class URI',
|
package/package.json
CHANGED
|
@@ -59,35 +59,42 @@ function _materializeComponents(stackExecutor, srcMetadata, profile) {
|
|
|
59
59
|
for (const [componentName, metadataComponent,] of Object.entries(srcMetadata)) {
|
|
60
60
|
stackExecutor.execute(componentName, () => {
|
|
61
61
|
/** Check if component defined in profile */
|
|
62
|
+
let materializedComponent;
|
|
62
63
|
const profileComponent = profile?.components?.[componentName];
|
|
63
64
|
if (!profileComponent) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
materializedComponent = {
|
|
66
|
+
abstract: true,
|
|
67
|
+
uri: metadataComponent.uri,
|
|
68
|
+
description: metadataComponent.description,
|
|
69
|
+
required: metadataComponent.required,
|
|
70
|
+
};
|
|
71
|
+
out[componentName] = materializedComponent;
|
|
67
72
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
73
|
+
else {
|
|
74
|
+
/** istanbul ignore next */
|
|
75
|
+
if (!profileComponent.uri)
|
|
76
|
+
throw new SbValidationError(`"uri" property required`);
|
|
77
|
+
const reg = ExtensionRegistry.getComponent(profileComponent.uri);
|
|
78
|
+
if (!(profileComponent.uri === metadataComponent.uri ||
|
|
79
|
+
reg.metadata.interfaces?.includes(metadataComponent.uri)))
|
|
80
|
+
throw new SbValidationError(`Selected component "${profileComponent.uri}" do not implement ${metadataComponent.uri}.`);
|
|
81
|
+
materializedComponent = {
|
|
82
|
+
uri: profileComponent.uri,
|
|
83
|
+
...omit(metadataComponent, ['uri', 'variables']),
|
|
84
|
+
};
|
|
85
|
+
materializedComponent.variables = merge({}, [reg.metadata.variables || {}, metadataComponent.variables || {}], { deep: 'full' });
|
|
86
|
+
materializedComponent.variables = sortVariables(materializedComponent.variables);
|
|
87
|
+
out[componentName] = materializedComponent;
|
|
88
|
+
/** Remove ignored variables */
|
|
89
|
+
for (const [k, variable] of Object.entries(materializedComponent.variables)) {
|
|
90
|
+
if (variable.ignored)
|
|
91
|
+
delete materializedComponent.variables[k];
|
|
92
|
+
}
|
|
93
|
+
if (reg.metadata.components) {
|
|
94
|
+
stackExecutor.execute('components', () => {
|
|
95
|
+
materializedComponent.components = _materializeComponents(stackExecutor, reg.metadata.components, profileComponent);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
91
98
|
}
|
|
92
99
|
});
|
|
93
100
|
}
|