@syncbridge/common 0.6.12 → 0.7.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 (38) hide show
  1. package/classes/base-element.d.ts +3 -0
  2. package/classes/base-element.js +3 -0
  3. package/constants.d.ts +2 -3
  4. package/constants.js +3 -11
  5. package/decorators/component.decorator.d.ts +5 -7
  6. package/decorators/component.decorator.js +57 -10
  7. package/decorators/decorator-helpers.d.ts +6 -1
  8. package/decorators/decorator-helpers.js +45 -10
  9. package/decorators/processor-events.decorator.js +14 -8
  10. package/decorators/processor.decorator.d.ts +6 -8
  11. package/decorators/processor.decorator.js +48 -3
  12. package/decorators/use-component.decorator.d.ts +1 -1
  13. package/decorators/use-component.decorator.js +12 -14
  14. package/decorators/use-variables.decorator.js +5 -6
  15. package/models/metadata/component-metadata.js +1 -1
  16. package/models/metadata/element-component-metadata.d.ts +1 -2
  17. package/models/metadata/element-component-metadata.js +4 -13
  18. package/models/metadata/element-metadata.d.ts +2 -1
  19. package/models/metadata/element-metadata.js +12 -4
  20. package/models/profile/profile-component.d.ts +1 -1
  21. package/models/profile/profile-component.js +3 -3
  22. package/models/profile/profile.d.ts +1 -1
  23. package/models/profile/profile.js +3 -3
  24. package/package.json +2 -1
  25. package/processor-factory.d.ts +2 -1
  26. package/processor-factory.js +26 -8
  27. package/registry/extension-package.d.ts +23 -13
  28. package/registry/extension-package.js +28 -22
  29. package/registry/extension-registry.d.ts +22 -15
  30. package/registry/extension-registry.js +122 -88
  31. package/utils/decode-profile.js +1 -1
  32. package/utils/locate-package-json.d.ts +5 -0
  33. package/{registry → utils}/locate-package-json.js +9 -2
  34. package/utils/materialize-metadata.js +24 -41
  35. package/utils/normalize-metadata.js +4 -2
  36. package/decorators/finalize-element-metadata.d.ts +0 -4
  37. package/decorators/finalize-element-metadata.js +0 -30
  38. package/registry/locate-package-json.d.ts +0 -4
@@ -3,6 +3,9 @@ import { ServiceStatus } from '../models/index.js';
3
3
  import type { ComponentBase } from './component-base.js';
4
4
  import { Runnable } from './runnable.js';
5
5
  export declare abstract class BaseElement<TEvents extends BaseElement.Events = BaseElement.Events> extends Runnable<TEvents> {
6
+ static id: string;
7
+ static uri: string;
8
+ static packageName: string;
6
9
  static className: string;
7
10
  static interfaces: string[];
8
11
  protected _context: BaseElement.Context;
@@ -1,6 +1,9 @@
1
1
  import { ServiceStatus } from '../models/index.js';
2
2
  import { Runnable } from './runnable.js';
3
3
  export class BaseElement extends Runnable {
4
+ static id;
5
+ static uri;
6
+ static packageName;
4
7
  static className;
5
8
  static interfaces;
6
9
  name;
package/constants.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export declare const version = "1";
2
- export declare const OWN_ELEMENT_METADATA: unique symbol;
3
- export declare const COMPONENT_OPTIONS: unique symbol;
4
- export declare const PROCESSOR_OPTIONS: unique symbol;
2
+ export declare const CLASS_METADATA: unique symbol;
3
+ export declare const CLASS_TYPE: unique symbol;
5
4
  export declare const VARIABLE_CONTAINER: unique symbol;
6
5
  export declare const noOp: () => undefined;
7
6
  export declare const NODE_ENV: string;
package/constants.js CHANGED
@@ -1,14 +1,6 @@
1
- export const version = '0.6.12';
2
- export const OWN_ELEMENT_METADATA = Symbol.for('OWN_ELEMENT_METADATA');
3
- export const COMPONENT_OPTIONS = Symbol.for('COMPONENT_OPTIONS');
4
- export const PROCESSOR_OPTIONS = Symbol.for('PROCESSOR_OPTIONS');
5
- // export const USE_COMPONENT_OPTIONS_STORE = Symbol.for(
6
- // 'USE_COMPONENT_OPTIONS_STORE',
7
- // );
8
- // export const USE_VARIABLES_OPTIONS_STORE = Symbol.for(
9
- // 'USE_VARIABLE_OPTIONS_STORE',
10
- // );
11
- // export const USE_VARIABLES_PROPERTY = Symbol.for('USE_VARIABLE_PROPERTY');
1
+ export const version = '0.7.0';
2
+ export const CLASS_METADATA = Symbol.for('CLASS_METADATA');
3
+ export const CLASS_TYPE = Symbol.for('CLASS_TYPE');
12
4
  export const VARIABLE_CONTAINER = Symbol.for('VARIABLE_CONTAINER');
13
5
  export const noOp = () => undefined;
14
6
  export const NODE_ENV = process.env.NODE_ENV === 'test'
@@ -1,15 +1,13 @@
1
1
  import 'reflect-metadata';
2
- import { DeepPartial, PartialSome, StrictOmit, Type } from 'ts-gems';
2
+ import { DeepPartial, StrictOmit, Type } from 'ts-gems';
3
3
  import { ComponentBase } from '../classes/component-base.js';
4
- import { ComponentMetadata, ElementComponentMetadata, VariableMetadataRecord } from '../models/index.js';
4
+ import { ComponentMetadata } from '../models/index.js';
5
5
  import { UseComponent as _UseComponent } from './use-component.decorator.js';
6
6
  export declare function Component<T extends ComponentBase>(options: Component.Options): (target: Type<T>) => void;
7
7
  export declare namespace Component {
8
- interface Options extends PartialSome<StrictOmit<ComponentMetadata, 'components' | 'variables'>, 'className' | 'displayName' | 'tags' | 'interfaces' | 'author'> {
9
- abstract?: boolean;
10
- components?: Record<string, Partial<ElementComponentMetadata>>;
11
- variables?: DeepPartial<VariableMetadataRecord>;
12
- }
8
+ type Options = DeepPartial<StrictOmit<ComponentMetadata, 'components' | 'variables'>> & {
9
+ className?: string;
10
+ };
13
11
  function UseVariables<T extends ComponentBase>(variablesClass?: Type): (target: T, propertyKey: "values") => void;
14
12
  function UseComponent<T extends ComponentBase>(options: _UseComponent.Options): (target: T, propertyKey: string | symbol) => void;
15
13
  }
@@ -1,19 +1,66 @@
1
1
  import 'reflect-metadata';
2
- import { COMPONENT_OPTIONS } from '../constants.js';
3
- import { finalizeElementMetadata } from './finalize-element-metadata.js';
2
+ import path from 'node:path';
3
+ import { omit } from '@jsopen/objects';
4
+ import callerCallsite from 'caller-callsite';
5
+ import { CLASS_METADATA, CLASS_TYPE } from '../constants.js';
6
+ import { resolvePackageJson } from '../utils/locate-package-json.js';
7
+ import { defineOwnMetadata, parseNpmAuthor } from './decorator-helpers.js';
4
8
  import { UseComponent as _UseComponent } from './use-component.decorator.js';
5
9
  import { UseVariables as _UseVariables } from './use-variables.decorator.js';
6
10
  const NAME_PATTERN = /^(.*?)(Component)?$/;
7
11
  export function Component(options) {
12
+ const callerFile = callerCallsite()?.getFileName();
13
+ const pkgjson = callerFile && resolvePackageJson(path.dirname(callerFile));
14
+ if (!pkgjson)
15
+ throw new Error('Could not find package.json');
8
16
  return function (target) {
9
- finalizeElementMetadata(target, options, COMPONENT_OPTIONS, NAME_PATTERN);
10
- const metadata = Reflect.getMetadata(COMPONENT_OPTIONS, target);
11
- metadata.interfaces = [
12
- ...(metadata.interfaces || []),
13
- ...(options.interfaces || [metadata.className]),
14
- ];
15
- target.className = metadata.className;
16
- target.interfaces = [...metadata.interfaces];
17
+ const classType = Reflect.getMetadata(CLASS_TYPE, target);
18
+ if (classType && classType !== 'component')
19
+ throw new TypeError(`${target.name} already decorated as "${classType}"`);
20
+ /** Determine class name */
21
+ let className = options.className;
22
+ if (!className) {
23
+ const m = NAME_PATTERN.exec(target.name);
24
+ if (!m)
25
+ throw new TypeError('Class name must be PascalCase and should contains only letters and numbers. Example: MyProcessor ');
26
+ if (m)
27
+ className = m[1];
28
+ }
29
+ /* c8 ignore next */
30
+ if (!className)
31
+ throw new TypeError('Class name is required');
32
+ /** Determine uri */
33
+ Reflect.defineMetadata(CLASS_TYPE, 'component', target);
34
+ const packageName = pkgjson.syncbridge?.name || pkgjson.name;
35
+ const uri = packageName + ':' + className;
36
+ const id = uri
37
+ .replace('@', '')
38
+ .replace(':', '__')
39
+ .replace(/\W/g, '_')
40
+ .toLowerCase();
41
+ const metadata = defineOwnMetadata(target, CLASS_METADATA, {
42
+ mergeBase: true,
43
+ overwrite: {
44
+ id,
45
+ uri,
46
+ displayName: className,
47
+ version: pkgjson.version,
48
+ author: parseNpmAuthor(pkgjson.author),
49
+ ...omit(options, ['uri']),
50
+ },
51
+ });
52
+ const base = Object.getPrototypeOf(target);
53
+ const baseMetadata = Reflect.getMetadata(CLASS_METADATA, base);
54
+ if (baseMetadata) {
55
+ metadata.interfaces = Array.from(new Set([...(baseMetadata?.interfaces || []), base.uri]));
56
+ }
57
+ target.id = id;
58
+ target.uri = uri;
59
+ target.packageName = packageName;
60
+ target.className = className;
61
+ target.interfaces = metadata.interfaces
62
+ ? [...metadata.interfaces]
63
+ : [];
17
64
  };
18
65
  }
19
66
  (function (Component) {
@@ -1,2 +1,7 @@
1
1
  import 'reflect-metadata';
2
- export declare function defineMergeMetadata(target: any, metadataKey: any, metadata: any): any;
2
+ import { AuthorMetadata } from '../models/index.js';
3
+ export declare function defineOwnMetadata(target: any, metadataKey: string | symbol, options?: {
4
+ overwrite?: any;
5
+ mergeBase?: boolean;
6
+ }): any;
7
+ export declare function parseNpmAuthor(value: any): AuthorMetadata | undefined;
@@ -1,13 +1,48 @@
1
1
  import 'reflect-metadata';
2
2
  import { merge } from '@jsopen/objects';
3
- export function defineMergeMetadata(target, metadataKey, metadata) {
4
- const oldMetadata = Reflect.getMetadata(metadataKey, target);
5
- const finalMetadata = merge({}, [oldMetadata || {}, metadata], {
6
- deep: 'full',
7
- mergeArrays: true,
8
- ignoreNulls: false,
9
- ignoreUndefined: false,
10
- });
11
- Reflect.defineMetadata(metadataKey, finalMetadata, target);
12
- return finalMetadata;
3
+ import { AuthorMetadata } from '../models/index.js';
4
+ export function defineOwnMetadata(target, metadataKey, options) {
5
+ let metadata = Reflect.getOwnMetadata(metadataKey, target);
6
+ const sources = [];
7
+ if (!metadata) {
8
+ metadata = {};
9
+ if (options?.mergeBase) {
10
+ const base = Object.getPrototypeOf(target);
11
+ const baseMetadata = Reflect.getMetadata(metadataKey, base);
12
+ if (baseMetadata)
13
+ sources.push(baseMetadata);
14
+ }
15
+ }
16
+ if (options?.overwrite)
17
+ sources.push(options?.overwrite);
18
+ if (sources.length)
19
+ merge(metadata, sources, {
20
+ deep: 'full',
21
+ mergeArrays: true,
22
+ ignoreNulls: false,
23
+ ignoreUndefined: false,
24
+ });
25
+ Reflect.defineMetadata(metadataKey, metadata, target);
26
+ return metadata;
27
+ }
28
+ const AUTHOR_PATTERN = /^\s*([^<(]+?)\s*(?:<([^>]+)>)?\s*(?:\(([^)]+)\))?\s*$/;
29
+ export function parseNpmAuthor(value) {
30
+ if (!value)
31
+ return;
32
+ if (typeof value === 'string') {
33
+ const m = AUTHOR_PATTERN.exec(value);
34
+ if (m)
35
+ return new AuthorMetadata({
36
+ name: m[1],
37
+ email: m[2],
38
+ url: m[3],
39
+ });
40
+ }
41
+ else if (typeof value === 'object') {
42
+ return new AuthorMetadata({
43
+ name: value.name,
44
+ email: value.email,
45
+ url: value.url,
46
+ });
47
+ }
13
48
  }
@@ -1,20 +1,26 @@
1
1
  import 'reflect-metadata';
2
- import { OWN_ELEMENT_METADATA } from '../constants.js';
3
- import { defineMergeMetadata } from './decorator-helpers.js';
2
+ import { CLASS_METADATA } from '../constants.js';
3
+ import { defineOwnMetadata } from './decorator-helpers.js';
4
4
  export function OnCreateProfile() {
5
5
  return function (target, propertyKey) {
6
- defineMergeMetadata(target, OWN_ELEMENT_METADATA, {
7
- staticEvents: {
8
- onCreateProfile: propertyKey,
6
+ defineOwnMetadata(target, CLASS_METADATA, {
7
+ mergeBase: true,
8
+ overwrite: {
9
+ staticEvents: {
10
+ onCreateProfile: propertyKey,
11
+ },
9
12
  },
10
13
  });
11
14
  };
12
15
  }
13
16
  export function OnUpdateProfile() {
14
17
  return function (target, propertyKey) {
15
- defineMergeMetadata(target, OWN_ELEMENT_METADATA, {
16
- staticEvents: {
17
- onUpdateProfile: propertyKey,
18
+ defineOwnMetadata(target, CLASS_METADATA, {
19
+ mergeBase: true,
20
+ overwrite: {
21
+ staticEvents: {
22
+ onUpdateProfile: propertyKey,
23
+ },
18
24
  },
19
25
  });
20
26
  };
@@ -1,7 +1,7 @@
1
1
  import 'reflect-metadata';
2
- import { DeepPartial, PartialSome, StrictOmit, Type } from 'ts-gems';
2
+ import { DeepPartial, StrictOmit, Type } from 'ts-gems';
3
3
  import type { ProcessorBase } from '../classes/processor-base.js';
4
- import { ElementComponentMetadata, ProcessorMetadata, VariableMetadataRecord } from '../models/index.js';
4
+ import { ProcessorMetadata } from '../models/index.js';
5
5
  import { UseComponent as _UseComponent } from './use-component.decorator.js';
6
6
  export declare function Processor<T extends ProcessorBase>(options: Processor.Options): (target: Type<T>) => void;
7
7
  export declare namespace Processor {
@@ -12,7 +12,7 @@ export declare namespace Processor {
12
12
  /**
13
13
  *
14
14
  */
15
- function UseComponent<T extends ProcessorBase>(options: _UseComponent.Options): (target: T, propertyKey: string | symbol) => void;
15
+ function UseComponent<T extends ProcessorBase>(options?: _UseComponent.Options): (target: T, propertyKey: string | symbol) => void;
16
16
  /**
17
17
  *
18
18
  */
@@ -23,9 +23,7 @@ export declare namespace Processor {
23
23
  function OnUpdateProfile<T extends ProcessorBase>(): (target: Type<T>, propertyKey: string | symbol) => void;
24
24
  }
25
25
  export declare namespace Processor {
26
- interface Options extends PartialSome<StrictOmit<ProcessorMetadata, 'components' | 'variables'>, 'className' | 'displayName' | 'tags' | 'author'> {
27
- abstract?: boolean;
28
- components?: Record<string, Partial<ElementComponentMetadata>>;
29
- variables?: DeepPartial<VariableMetadataRecord>;
30
- }
26
+ type Options = DeepPartial<StrictOmit<ProcessorMetadata, 'components' | 'variables'>> & {
27
+ className?: string;
28
+ };
31
29
  }
@@ -1,13 +1,58 @@
1
1
  import 'reflect-metadata';
2
- import { PROCESSOR_OPTIONS } from '../constants.js';
3
- import { finalizeElementMetadata } from './finalize-element-metadata.js';
2
+ import path from 'node:path';
3
+ import { omit } from '@jsopen/objects';
4
+ import callerCallsite from 'caller-callsite';
5
+ import { CLASS_METADATA, CLASS_TYPE } from '../constants.js';
6
+ import { resolvePackageJson } from '../utils/locate-package-json.js';
7
+ import { defineOwnMetadata } from './decorator-helpers.js';
4
8
  import { OnCreateProfile as _OnCreateProfile, OnUpdateProfile as _OnUpdateProfile, } from './processor-events.decorator.js';
5
9
  import { UseComponent as _UseComponent } from './use-component.decorator.js';
6
10
  import { UseVariables as _UseVariables } from './use-variables.decorator.js';
7
11
  const NAME_PATTERN = /^(.*?)(Processor)?$/;
8
12
  export function Processor(options) {
13
+ const callerFile = callerCallsite()?.getFileName();
14
+ const pkgjson = callerFile && resolvePackageJson(path.dirname(callerFile));
15
+ if (!pkgjson)
16
+ throw new Error('Could not find package.json');
9
17
  return function (target) {
10
- finalizeElementMetadata(target, options, PROCESSOR_OPTIONS, NAME_PATTERN);
18
+ const classType = Reflect.getMetadata(CLASS_TYPE, target);
19
+ if (classType && classType !== 'processor')
20
+ throw new TypeError(`${target.name} already decorated as "${classType}"`);
21
+ /** Determine class name */
22
+ let className = options.className;
23
+ if (!className) {
24
+ const m = NAME_PATTERN.exec(target.name);
25
+ if (!m)
26
+ throw new TypeError('Class name must be PascalCase and should contains only letters and numbers. Example: MyProcessor ');
27
+ if (m)
28
+ className = m[1];
29
+ }
30
+ /* c8 ignore next */
31
+ if (!className)
32
+ throw new TypeError('Class name is required');
33
+ /** Determine uri */
34
+ Reflect.defineMetadata(CLASS_TYPE, 'processor', target);
35
+ const packageName = pkgjson.syncbridge?.name || pkgjson.name;
36
+ const uri = packageName + ':' + className;
37
+ const id = uri
38
+ .replace('@', '')
39
+ .replace(':', '__')
40
+ .replace(/\W/g, '_')
41
+ .toLowerCase();
42
+ defineOwnMetadata(target, CLASS_METADATA, {
43
+ mergeBase: true,
44
+ overwrite: {
45
+ id,
46
+ uri,
47
+ displayName: className,
48
+ version: pkgjson.version,
49
+ ...omit(options, ['uri']),
50
+ },
51
+ });
52
+ target.id = id;
53
+ target.uri = uri;
54
+ target.packageName = packageName;
55
+ target.className = className;
11
56
  };
12
57
  }
13
58
  (function (Processor) {
@@ -2,7 +2,7 @@ import 'reflect-metadata';
2
2
  import { ComponentBase } from '../classes/component-base.js';
3
3
  import { ProcessorBase } from '../classes/processor-base.js';
4
4
  import { ElementComponentMetadata } from '../models/index.js';
5
- export declare function UseComponent<T extends ProcessorBase | ComponentBase>(options: UseComponent.Options): (target: T, propertyKey: string | symbol) => void;
5
+ export declare function UseComponent<T extends ProcessorBase | ComponentBase>(options?: UseComponent.Options): (target: T, propertyKey: string | symbol) => void;
6
6
  export declare namespace UseComponent {
7
7
  interface Options extends Partial<ElementComponentMetadata> {
8
8
  }
@@ -1,24 +1,22 @@
1
1
  import 'reflect-metadata';
2
- import { OWN_ELEMENT_METADATA } from '../constants.js';
3
- import { defineMergeMetadata } from './decorator-helpers.js';
4
- export function UseComponent(options) {
2
+ import { CLASS_METADATA } from '../constants.js';
3
+ import { defineOwnMetadata } from './decorator-helpers.js';
4
+ export function UseComponent(options = {}) {
5
5
  return function (target, propertyKey) {
6
6
  /** c8 ignore next */
7
7
  if (typeof propertyKey !== 'string')
8
8
  throw new TypeError('Property key must be a string');
9
- if (!options.className && !options.interfaces) {
9
+ if (!options.uri) {
10
10
  const designType = Reflect.getMetadata('design:type', target, propertyKey);
11
- if (typeof designType === 'function' && designType.interfaces) {
12
- options.interfaces = [...designType.interfaces];
11
+ if (typeof designType === 'function' && designType.uri) {
12
+ options.uri = designType.uri;
13
13
  }
14
14
  }
15
- defineMergeMetadata(target.constructor, OWN_ELEMENT_METADATA, {
16
- components: {
17
- [propertyKey]: {
18
- ...options,
19
- propertyKey,
20
- },
21
- },
22
- });
15
+ const metadata = defineOwnMetadata(target.constructor, CLASS_METADATA);
16
+ metadata.components = metadata.components || {};
17
+ metadata.components[propertyKey] = {
18
+ ...options,
19
+ propertyKey,
20
+ };
23
21
  };
24
22
  }
@@ -1,6 +1,6 @@
1
1
  import 'reflect-metadata';
2
- import { OWN_ELEMENT_METADATA, VARIABLE_CONTAINER } from '../constants.js';
3
- import { defineMergeMetadata } from './decorator-helpers.js';
2
+ import { CLASS_METADATA, VARIABLE_CONTAINER } from '../constants.js';
3
+ import { defineOwnMetadata } from './decorator-helpers.js';
4
4
  export function UseVariables(variablesClass) {
5
5
  return function (target, propertyKey) {
6
6
  /** c8 ignore next */
@@ -11,9 +11,8 @@ export function UseVariables(variablesClass) {
11
11
  if (!(typeof variablesClass === 'function')) {
12
12
  throw new TypeError('type of "variables" must be a class');
13
13
  }
14
- const metadata = Reflect.getMetadata(VARIABLE_CONTAINER, variablesClass.prototype) || {};
15
- defineMergeMetadata(target.constructor, OWN_ELEMENT_METADATA, {
16
- variables: metadata,
17
- });
14
+ const metadata = defineOwnMetadata(target.constructor, CLASS_METADATA);
15
+ metadata.variables =
16
+ Reflect.getMetadata(VARIABLE_CONTAINER, variablesClass.prototype) || {};
18
17
  };
19
18
  }
@@ -12,7 +12,7 @@ let ComponentMetadata = class ComponentMetadata extends ElementMetadata {
12
12
  __decorate([
13
13
  ApiField({
14
14
  label: 'Interfaces',
15
- description: 'Interfaces which this component implemented',
15
+ description: 'List of component URIs which this component implemented',
16
16
  type: ArrayType('string'),
17
17
  }),
18
18
  __metadata("design:type", Array)
@@ -10,9 +10,8 @@ export declare class ElementComponentMetadataRecord {
10
10
  */
11
11
  export declare class ElementComponentMetadata {
12
12
  propertyKey?: string;
13
- className?: string;
13
+ uri: string;
14
14
  description?: string;
15
- interfaces?: string[];
16
15
  required?: boolean;
17
16
  variables?: VariableMetadataRecord;
18
17
  components?: ElementComponentMetadataRecord;
@@ -21,11 +21,12 @@ let ElementComponentMetadata = class ElementComponentMetadata {
21
21
  };
22
22
  __decorate([
23
23
  ApiField({
24
- label: 'Class Name',
25
- description: 'Class name of the component',
24
+ label: 'Class URI',
25
+ description: 'URI of the class',
26
+ examples: ['@syncbridge/net:TcpClient', '@syncbridge/sqb:SqbClient'],
26
27
  }),
27
28
  __metadata("design:type", String)
28
- ], ElementComponentMetadata.prototype, "className", void 0);
29
+ ], ElementComponentMetadata.prototype, "uri", void 0);
29
30
  __decorate([
30
31
  ApiField({
31
32
  label: 'Description',
@@ -33,16 +34,6 @@ __decorate([
33
34
  }),
34
35
  __metadata("design:type", String)
35
36
  ], ElementComponentMetadata.prototype, "description", void 0);
36
- __decorate([
37
- ApiField({
38
- label: 'Interfaces',
39
- description: 'Interfaces should be implemented by the component. This value is ignored if className is set',
40
- type: 'string',
41
- required: true,
42
- examples: ['IoComponent'],
43
- }),
44
- __metadata("design:type", Array)
45
- ], ElementComponentMetadata.prototype, "interfaces", void 0);
46
37
  __decorate([
47
38
  ApiField({
48
39
  label: 'Required',
@@ -7,7 +7,8 @@ import { VariableMetadataRecord } from './variable-metadata.js';
7
7
  export declare class ElementMetadata {
8
8
  constructor(init?: Partial<ElementMetadata>);
9
9
  abstract?: boolean;
10
- className: string;
10
+ id: string;
11
+ uri: string;
11
12
  displayName: string;
12
13
  iconUrl?: string;
13
14
  description?: string;
@@ -14,12 +14,20 @@ let ElementMetadata = class ElementMetadata {
14
14
  };
15
15
  __decorate([
16
16
  ApiField({
17
- label: 'Class Name',
18
- description: 'Uniquely identifies the element (camelCase, PascalCase)',
19
- required: true,
17
+ label: 'Id',
18
+ description: 'Web friendly unique identifier',
19
+ examples: ['syncbridge_net__tcpclient', 'syncbridge_sqb__sqbclient'],
20
+ }),
21
+ __metadata("design:type", String)
22
+ ], ElementMetadata.prototype, "id", void 0);
23
+ __decorate([
24
+ ApiField({
25
+ label: 'Class URI',
26
+ description: 'URI of the class',
27
+ examples: ['@syncbridge/net:TcpClient', '@syncbridge/sqb:SqbClient'],
20
28
  }),
21
29
  __metadata("design:type", String)
22
- ], ElementMetadata.prototype, "className", void 0);
30
+ ], ElementMetadata.prototype, "uri", void 0);
23
31
  __decorate([
24
32
  ApiField({
25
33
  label: 'Name',
@@ -16,7 +16,7 @@ export declare class ProfileComponentSettings {
16
16
  * ProfileComponent
17
17
  */
18
18
  export declare class ProfileComponent {
19
- className: string;
19
+ uri: string;
20
20
  values?: Record<string, any>;
21
21
  components?: WorkerComponentRecord;
22
22
  settings?: ProfileComponentSettings;
@@ -42,11 +42,11 @@ let ProfileComponent = class ProfileComponent {
42
42
  };
43
43
  __decorate([
44
44
  ApiField({
45
- description: 'Class name of the component',
46
- examples: ['TcpClient', 'SerialClient'],
45
+ description: 'URI of the component',
46
+ examples: ['@syncbridge/net:TcpClient', '@syncbridge/serial:SerialClient'],
47
47
  }),
48
48
  __metadata("design:type", String)
49
- ], ProfileComponent.prototype, "className", void 0);
49
+ ], ProfileComponent.prototype, "uri", void 0);
50
50
  __decorate([
51
51
  ApiField({
52
52
  label: 'Values',
@@ -15,7 +15,7 @@ export declare class Profile {
15
15
  constructor(init?: Partial<Profile>);
16
16
  id: string;
17
17
  displayName: string;
18
- processorClass: string;
18
+ processorUri: string;
19
19
  processorVersion?: string;
20
20
  group?: string;
21
21
  description?: string;
@@ -59,12 +59,12 @@ __decorate([
59
59
  ], Profile.prototype, "displayName", void 0);
60
60
  __decorate([
61
61
  ApiField({
62
- label: 'Processor Class',
63
- description: 'Class name of the processor',
62
+ label: 'Processor URI',
63
+ description: 'URI of the processor',
64
64
  required: true,
65
65
  }),
66
66
  __metadata("design:type", String)
67
- ], Profile.prototype, "processorClass", void 0);
67
+ ], Profile.prototype, "processorUri", void 0);
68
68
  __decorate([
69
69
  ApiField({
70
70
  label: 'Processor Version',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncbridge/common",
3
- "version": "0.6.12",
3
+ "version": "0.7.0",
4
4
  "description": "SyncBridge Common utilities",
5
5
  "author": "Panates Inc",
6
6
  "license": "MIT",
@@ -8,6 +8,7 @@
8
8
  "@jsopen/objects": "^2.2.0",
9
9
  "fast-deep-equal": "^3.1.3",
10
10
  "node-events-async": "^1.5.2",
11
+ "caller-callsite": "^6.0.0",
11
12
  "reflect-metadata": "^0.2.2",
12
13
  "semver": "^7.7.4",
13
14
  "ts-gems": "^3.11.5",
@@ -9,7 +9,8 @@ export declare namespace ProcessorFactory {
9
9
  logger?: ILogger;
10
10
  dataDirectory?: string;
11
11
  }
12
- function createProcessor<T extends ProcessorBase>(profile: Profile, options?: ProcessorOptions): Promise<{
12
+ function createProcessor<T extends ProcessorBase>(profile: Profile, options?: ProcessorOptions): Promise<T>;
13
+ function createProcessorSilent<T extends ProcessorBase>(profile: Profile, options?: ProcessorOptions): Promise<{
13
14
  processor: T;
14
15
  issues: StackExecutor.Issue[];
15
16
  }>;