@syncbridge/common 0.7.1 → 0.7.2
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 +1 -1
- package/decorators/component.decorator.js +2 -5
- package/decorators/processor.decorator.js +2 -5
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/utils/normalize-metadata.js +3 -2
- package/utils/uri-to-id.d.ts +1 -0
- package/utils/uri-to-id.js +7 -0
package/constants.js
CHANGED
|
@@ -4,6 +4,7 @@ import { omit } from '@jsopen/objects';
|
|
|
4
4
|
import callerCallsite from 'caller-callsite';
|
|
5
5
|
import { CLASS_METADATA, CLASS_TYPE } from '../constants.js';
|
|
6
6
|
import { resolvePackageJson } from '../utils/locate-package-json.js';
|
|
7
|
+
import { uriToId } from '../utils/uri-to-id.js';
|
|
7
8
|
import { defineOwnMetadata, parseNpmAuthor } from './decorator-helpers.js';
|
|
8
9
|
import { UseComponent as _UseComponent } from './use-component.decorator.js';
|
|
9
10
|
import { UseVariables as _UseVariables } from './use-variables.decorator.js';
|
|
@@ -33,11 +34,7 @@ export function Component(options) {
|
|
|
33
34
|
Reflect.defineMetadata(CLASS_TYPE, 'component', target);
|
|
34
35
|
const packageName = pkgjson.syncbridge?.name || pkgjson.name;
|
|
35
36
|
const uri = packageName + ':' + className;
|
|
36
|
-
const id = uri
|
|
37
|
-
.replace('@', '')
|
|
38
|
-
.replace(':', '__')
|
|
39
|
-
.replace(/\W/g, '_')
|
|
40
|
-
.toLowerCase();
|
|
37
|
+
const id = uriToId(uri);
|
|
41
38
|
const metadata = defineOwnMetadata(target, CLASS_METADATA, {
|
|
42
39
|
mergeBase: true,
|
|
43
40
|
overwrite: {
|
|
@@ -4,6 +4,7 @@ import { omit } from '@jsopen/objects';
|
|
|
4
4
|
import callerCallsite from 'caller-callsite';
|
|
5
5
|
import { CLASS_METADATA, CLASS_TYPE } from '../constants.js';
|
|
6
6
|
import { resolvePackageJson } from '../utils/locate-package-json.js';
|
|
7
|
+
import { uriToId } from '../utils/uri-to-id.js';
|
|
7
8
|
import { defineOwnMetadata } from './decorator-helpers.js';
|
|
8
9
|
import { OnCreateProfile as _OnCreateProfile, OnUpdateProfile as _OnUpdateProfile, } from './processor-events.decorator.js';
|
|
9
10
|
import { UseComponent as _UseComponent } from './use-component.decorator.js';
|
|
@@ -34,11 +35,7 @@ export function Processor(options) {
|
|
|
34
35
|
Reflect.defineMetadata(CLASS_TYPE, 'processor', target);
|
|
35
36
|
const packageName = pkgjson.syncbridge?.name || pkgjson.name;
|
|
36
37
|
const uri = packageName + ':' + className;
|
|
37
|
-
const id = uri
|
|
38
|
-
.replace('@', '')
|
|
39
|
-
.replace(':', '__')
|
|
40
|
-
.replace(/\W/g, '_')
|
|
41
|
-
.toLowerCase();
|
|
38
|
+
const id = uriToId(uri);
|
|
42
39
|
defineOwnMetadata(target, CLASS_METADATA, {
|
|
43
40
|
mergeBase: true,
|
|
44
41
|
overwrite: {
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { SbValidationError } from '../classes/sb-error.js';
|
|
|
3
3
|
import { ComponentMetadata, ProcessorMetadata, } from '../models/index.js';
|
|
4
4
|
import { initializeModelsDocument } from '../models-document.js';
|
|
5
5
|
import { resolvePromisesDeep } from './resolve-promises.js';
|
|
6
|
+
import { uriToId } from './uri-to-id.js';
|
|
6
7
|
export async function normalizeProcessorMetadata(metadata) {
|
|
7
8
|
const { metadata: out, issues } = await normalizeProcessorMetadataSilent(metadata);
|
|
8
9
|
if (issues?.length) {
|
|
@@ -23,7 +24,7 @@ export async function normalizeProcessorMetadata(metadata) {
|
|
|
23
24
|
export async function normalizeProcessorMetadataSilent(metadata) {
|
|
24
25
|
const decoder = await getProcMetadataTypeDecoder();
|
|
25
26
|
let cloned = deepClone({
|
|
26
|
-
id: metadata.id,
|
|
27
|
+
id: metadata.id || uriToId(metadata.uri),
|
|
27
28
|
uri: metadata.uri,
|
|
28
29
|
displayName: metadata.displayName,
|
|
29
30
|
description: metadata.description,
|
|
@@ -68,7 +69,7 @@ export async function normalizeComponentMetadata(metadata) {
|
|
|
68
69
|
export async function normalizeComponentMetadataSilent(metadata) {
|
|
69
70
|
const decoder = await getCompMetadataTypeDecoder();
|
|
70
71
|
let cloned = deepClone({
|
|
71
|
-
id: metadata.id,
|
|
72
|
+
id: metadata.id || uriToId(metadata.uri),
|
|
72
73
|
uri: metadata.uri,
|
|
73
74
|
displayName: metadata.displayName,
|
|
74
75
|
description: metadata.description,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function uriToId(uri: string): string;
|