@syncbridge/common 0.9.2 → 0.9.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.
package/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = '0.9.2';
1
+ export const version = '0.9.3';
2
2
  export const CLASS_METADATA = Symbol.for('CLASS_METADATA');
3
3
  export const CLASS_TYPE = Symbol.for('CLASS_TYPE');
4
4
  export const VARIABLE_CONTAINER = Symbol.for('VARIABLE_CONTAINER');
@@ -9,5 +9,5 @@ export declare namespace Component {
9
9
  className?: string;
10
10
  };
11
11
  function UseVariables<T extends ComponentBase>(variablesClass?: Type): (target: T, propertyKey: "values") => void;
12
- function UseComponent<T extends ComponentBase>(options: _UseComponent.Options): (target: T, propertyKey: string | symbol) => void;
12
+ function UseComponent<T extends ComponentBase>(options?: _UseComponent.Options): (target: T, propertyKey: string | symbol) => void;
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncbridge/common",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "SyncBridge Common utilities",
5
5
  "author": "Panates Inc",
6
6
  "license": "MIT",
@@ -3,11 +3,11 @@ import { ProcessorMetadata, Profile } from '../models/index.js';
3
3
  /**
4
4
  * Materializes metadata from profile.
5
5
  */
6
- export declare function materializeMetadata(profile: Profile, returnUndefinedComponentsAsAbstract?: boolean): ProcessorMetadata;
6
+ export declare function materializeMetadata(profile: Profile): ProcessorMetadata;
7
7
  /**
8
8
  *
9
9
  */
10
- export declare function materializeMetadataSilent(profile: Profile, returnUndefinedComponentsAsAbstract?: boolean): {
10
+ export declare function materializeMetadataSilent(profile: Profile): {
11
11
  metadata: ProcessorMetadata;
12
12
  issues?: StackExecutor.Issue[];
13
13
  };
@@ -6,8 +6,8 @@ import { ExtensionRegistry } from '../registry/extension-registry.js';
6
6
  /**
7
7
  * Materializes metadata from profile.
8
8
  */
9
- export function materializeMetadata(profile, returnUndefinedComponentsAsAbstract) {
10
- const { metadata, issues } = materializeMetadataSilent(profile, returnUndefinedComponentsAsAbstract);
9
+ export function materializeMetadata(profile) {
10
+ const { metadata, issues } = materializeMetadataSilent(profile);
11
11
  if (issues?.length) {
12
12
  const msg = 'Worker profile validation error.\n ' +
13
13
  issues
@@ -27,7 +27,7 @@ export function materializeMetadata(profile, returnUndefinedComponentsAsAbstract
27
27
  /**
28
28
  *
29
29
  */
30
- export function materializeMetadataSilent(profile, returnUndefinedComponentsAsAbstract) {
30
+ export function materializeMetadataSilent(profile) {
31
31
  const stackExecutor = new StackExecutor();
32
32
  const processorRec = ExtensionRegistry.getProcessor(profile.processorUri);
33
33
  const metadata = omitUndefined(clone({
@@ -43,7 +43,7 @@ export function materializeMetadataSilent(profile, returnUndefinedComponentsAsAb
43
43
  }, { deep: 'full' }));
44
44
  if (metadata.components) {
45
45
  stackExecutor.execute('components', () => {
46
- metadata.components = _materializeComponents(stackExecutor, metadata.components, profile, returnUndefinedComponentsAsAbstract);
46
+ metadata.components = _materializeComponents(stackExecutor, metadata.components, profile);
47
47
  });
48
48
  }
49
49
  if (stackExecutor.issues?.length)
@@ -54,7 +54,7 @@ export function materializeMetadataSilent(profile, returnUndefinedComponentsAsAb
54
54
  *
55
55
  * @private
56
56
  */
57
- function _materializeComponents(stackExecutor, srcMetadata, profile, returnUndefinedComponentsAsAbstract) {
57
+ function _materializeComponents(stackExecutor, srcMetadata, profile) {
58
58
  const out = {};
59
59
  for (const [componentName, metadataComponent,] of Object.entries(srcMetadata)) {
60
60
  stackExecutor.execute(componentName, () => {
@@ -62,18 +62,9 @@ function _materializeComponents(stackExecutor, srcMetadata, profile, returnUndef
62
62
  let materializedComponent;
63
63
  const profileComponent = profile?.components?.[componentName];
64
64
  if (!profileComponent) {
65
- if (!returnUndefinedComponentsAsAbstract) {
66
- if (metadataComponent.required)
67
- throw new SbValidationError(`Component "${componentName}" should be configured`);
68
- return;
69
- }
70
- materializedComponent = {
71
- abstract: true,
72
- uri: metadataComponent.uri,
73
- description: metadataComponent.description,
74
- required: metadataComponent.required,
75
- };
76
- out[componentName] = materializedComponent;
65
+ if (metadataComponent.required)
66
+ throw new SbValidationError(`Component "${componentName}" should be configured`);
67
+ return;
77
68
  }
78
69
  else {
79
70
  /** istanbul ignore next */
@@ -97,7 +88,7 @@ function _materializeComponents(stackExecutor, srcMetadata, profile, returnUndef
97
88
  }
98
89
  if (reg.metadata.components) {
99
90
  stackExecutor.execute('components', () => {
100
- materializedComponent.components = _materializeComponents(stackExecutor, reg.metadata.components, profileComponent, returnUndefinedComponentsAsAbstract);
91
+ materializedComponent.components = _materializeComponents(stackExecutor, reg.metadata.components, profileComponent);
101
92
  });
102
93
  }
103
94
  }