@teambit/semantics.entities.semantic-schema 0.0.59 → 0.0.60
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/api-schema.ts +8 -3
- package/dist/api-schema.d.ts +1 -1
- package/dist/api-schema.js +7 -2
- package/dist/api-schema.js.map +1 -1
- package/dist/{preview-1695807370382.js → preview-1704113440840.js} +1 -1
- package/dist/schemas/index-signature.d.ts +8 -15
- package/dist/schemas/index-signature.js +11 -11
- package/dist/schemas/index-signature.js.map +1 -1
- package/package.json +5 -3
- package/schemas/index-signature.ts +14 -14
- package/class-transformers/comp-id-transformer.ts +0 -22
- package/class-transformers/index.ts +0 -2
- package/class-transformers/schema-obj-to-class.ts +0 -56
- package/dist/class-transformers/comp-id-transformer.d.ts +0 -0
- package/dist/class-transformers/comp-id-transformer.js +0 -22
- package/dist/class-transformers/comp-id-transformer.js.map +0 -1
- package/dist/class-transformers/index.d.ts +0 -0
- package/dist/class-transformers/index.js +0 -3
- package/dist/class-transformers/index.js.map +0 -1
- package/dist/class-transformers/schema-obj-to-class.d.ts +0 -0
- package/dist/class-transformers/schema-obj-to-class.js +0 -50
- package/dist/class-transformers/schema-obj-to-class.js.map +0 -1
package/api-schema.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from './schemas';
|
|
14
14
|
import { SchemaLocation, SchemaNode } from './schema-node';
|
|
15
15
|
import { TagName } from './schemas/docs/tag';
|
|
16
|
+
import { SchemaRegistry } from './schema-registry';
|
|
16
17
|
|
|
17
18
|
export class APISchema extends SchemaNode {
|
|
18
19
|
readonly module: ModuleSchema; // index
|
|
@@ -27,13 +28,17 @@ export class APISchema extends SchemaNode {
|
|
|
27
28
|
readonly location: SchemaLocation,
|
|
28
29
|
module: ModuleSchema,
|
|
29
30
|
internals: ModuleSchema[],
|
|
30
|
-
componentId: ComponentID
|
|
31
|
+
componentId: ComponentID,
|
|
32
|
+
taggedModuleExports: SchemaNode[] = []
|
|
31
33
|
) {
|
|
32
34
|
super();
|
|
33
35
|
this.module = module;
|
|
34
36
|
this.internals = internals;
|
|
35
37
|
this.componentId = componentId;
|
|
36
38
|
this.taggedModuleExports = this.listTaggedExports(module);
|
|
39
|
+
if (taggedModuleExports.length > 0) {
|
|
40
|
+
this.taggedModuleExports = this.taggedModuleExports.concat(taggedModuleExports);
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
listTaggedExports(module?: ModuleSchema) {
|
|
@@ -93,8 +98,8 @@ export class APISchema extends SchemaNode {
|
|
|
93
98
|
const module: ModuleSchema = ModuleSchema.fromObject(obj.module);
|
|
94
99
|
const internals: ModuleSchema[] = (obj.internals || []).map((i: any) => ModuleSchema.fromObject(i));
|
|
95
100
|
const componentId: ComponentID = ComponentID.fromObject(obj.componentId);
|
|
96
|
-
|
|
97
|
-
return new APISchema(location, module, internals, componentId);
|
|
101
|
+
const taggedModuleExports = (obj.taggedModuleExports || []).map((e: any) => SchemaRegistry.fromObject(e));
|
|
102
|
+
return new APISchema(location, module, internals, componentId, taggedModuleExports);
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
static empty(componentId: ComponentID) {
|
package/dist/api-schema.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class APISchema extends SchemaNode {
|
|
|
7
7
|
readonly internals: ModuleSchema[];
|
|
8
8
|
readonly componentId: ComponentID;
|
|
9
9
|
readonly taggedModuleExports: SchemaNode[];
|
|
10
|
-
constructor(location: SchemaLocation, module: ModuleSchema, internals: ModuleSchema[], componentId: ComponentID);
|
|
10
|
+
constructor(location: SchemaLocation, module: ModuleSchema, internals: ModuleSchema[], componentId: ComponentID, taggedModuleExports?: SchemaNode[]);
|
|
11
11
|
listTaggedExports(module?: ModuleSchema): SchemaNode[];
|
|
12
12
|
toString(): string;
|
|
13
13
|
toStringPerType(): string;
|
package/dist/api-schema.js
CHANGED
|
@@ -9,14 +9,18 @@ const component_id_1 = require("@teambit/component-id");
|
|
|
9
9
|
const schemas_1 = require("./schemas");
|
|
10
10
|
const schema_node_1 = require("./schema-node");
|
|
11
11
|
const tag_1 = require("./schemas/docs/tag");
|
|
12
|
+
const schema_registry_1 = require("./schema-registry");
|
|
12
13
|
class APISchema extends schema_node_1.SchemaNode {
|
|
13
|
-
constructor(location, module, internals, componentId) {
|
|
14
|
+
constructor(location, module, internals, componentId, taggedModuleExports = []) {
|
|
14
15
|
super();
|
|
15
16
|
this.location = location;
|
|
16
17
|
this.module = module;
|
|
17
18
|
this.internals = internals;
|
|
18
19
|
this.componentId = componentId;
|
|
19
20
|
this.taggedModuleExports = this.listTaggedExports(module);
|
|
21
|
+
if (taggedModuleExports.length > 0) {
|
|
22
|
+
this.taggedModuleExports = this.taggedModuleExports.concat(taggedModuleExports);
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
listTaggedExports(module) {
|
|
22
26
|
if (!module)
|
|
@@ -57,7 +61,8 @@ class APISchema extends schema_node_1.SchemaNode {
|
|
|
57
61
|
const module = schemas_1.ModuleSchema.fromObject(obj.module);
|
|
58
62
|
const internals = (obj.internals || []).map((i) => schemas_1.ModuleSchema.fromObject(i));
|
|
59
63
|
const componentId = component_id_1.ComponentID.fromObject(obj.componentId);
|
|
60
|
-
|
|
64
|
+
const taggedModuleExports = (obj.taggedModuleExports || []).map((e) => schema_registry_1.SchemaRegistry.fromObject(e));
|
|
65
|
+
return new APISchema(location, module, internals, componentId, taggedModuleExports);
|
|
61
66
|
}
|
|
62
67
|
static empty(componentId) {
|
|
63
68
|
return new APISchema({ filePath: '', line: 0, character: 0 }, new schemas_1.ModuleSchema({ filePath: '', line: 0, character: 0 }, [], []), [], componentId);
|
package/dist/api-schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-schema.js","sourceRoot":"","sources":["../api-schema.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,wDAAoD;AACpD,uCAUmB;AACnB,+CAA2D;AAC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,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EACjE,EAAE,EACF,WAAW,CACZ,CAAC;IACJ,CAAC;CACF;AA/FD,8BA+FC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_entities_semantic-schema@0.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_entities_semantic-schema@0.0.60/dist/semantic-schema.docs.md';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
2
|
import { ParameterSchema } from './parameter';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* [key: number]: string
|
|
5
|
+
* keyType: number
|
|
6
|
+
* valueType: string
|
|
6
7
|
*/
|
|
7
8
|
export declare class IndexSignatureSchema extends SchemaNode {
|
|
8
9
|
readonly location: SchemaLocation;
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
constructor(location: SchemaLocation,
|
|
10
|
+
readonly keyType: SchemaNode;
|
|
11
|
+
readonly valueType: SchemaNode;
|
|
12
|
+
constructor(location: SchemaLocation, keyType: ParameterSchema, valueType: SchemaNode);
|
|
12
13
|
toString(): string;
|
|
13
14
|
toObject(): {
|
|
14
15
|
location: SchemaLocation;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: Record<string, any>;
|
|
18
|
-
isOptional: boolean;
|
|
19
|
-
defaultValue: any;
|
|
20
|
-
description: string;
|
|
21
|
-
objectBindingNodes: Record<string, any>[];
|
|
22
|
-
isSpread: boolean;
|
|
23
|
-
}[];
|
|
24
|
-
type: Record<string, any>;
|
|
16
|
+
keyType: Record<string, any>;
|
|
17
|
+
valueType: Record<string, any>;
|
|
25
18
|
};
|
|
26
19
|
static fromObject(obj: Record<string, any>): IndexSignatureSchema;
|
|
27
20
|
}
|
|
@@ -5,28 +5,28 @@ const schema_node_1 = require("../schema-node");
|
|
|
5
5
|
const schema_registry_1 = require("../schema-registry");
|
|
6
6
|
const parameter_1 = require("./parameter");
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* [key: number]: string
|
|
9
|
+
* keyType: number
|
|
10
|
+
* valueType: string
|
|
10
11
|
*/
|
|
11
12
|
class IndexSignatureSchema extends schema_node_1.SchemaNode {
|
|
12
|
-
constructor(location,
|
|
13
|
+
constructor(location, keyType, valueType) {
|
|
13
14
|
super();
|
|
14
15
|
this.location = location;
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
16
|
+
this.keyType = keyType;
|
|
17
|
+
this.valueType = valueType;
|
|
17
18
|
}
|
|
18
19
|
toString() {
|
|
19
|
-
|
|
20
|
-
return `[${paramsStr}]: ${this.type.toString()}`;
|
|
20
|
+
return `[${this.keyType.toString()}]: ${this.valueType.toString()}`;
|
|
21
21
|
}
|
|
22
22
|
toObject() {
|
|
23
|
-
return Object.assign(Object.assign({}, super.toObject()), { location: this.location,
|
|
23
|
+
return Object.assign(Object.assign({}, super.toObject()), { location: this.location, keyType: this.keyType.toObject(), valueType: this.valueType.toObject() });
|
|
24
24
|
}
|
|
25
25
|
static fromObject(obj) {
|
|
26
26
|
const location = obj.location;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
return new IndexSignatureSchema(location,
|
|
27
|
+
const keyType = parameter_1.ParameterSchema.fromObject(obj.keyType);
|
|
28
|
+
const valueType = schema_registry_1.SchemaRegistry.fromObject(obj.valueType);
|
|
29
|
+
return new IndexSignatureSchema(location, keyType, valueType);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.IndexSignatureSchema = IndexSignatureSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-signature.js","sourceRoot":"","sources":["../../schemas/index-signature.ts"],"names":[],"mappings":";;;AAAA,gDAA4D;AAC5D,wDAAoD;AACpD,2CAA8C;AAE9C
|
|
1
|
+
{"version":3,"file":"index-signature.js","sourceRoot":"","sources":["../../schemas/index-signature.ts"],"names":[],"mappings":";;;AAAA,gDAA4D;AAC5D,wDAAoD;AACpD,2CAA8C;AAE9C;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,wBAAU;IAGlD,YAAqB,QAAwB,EAAE,OAAwB,EAAE,SAAqB;QAC5F,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAgB;QAE3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;IACtE,CAAC;IAED,QAAQ;QACN,uCACK,KAAK,CAAC,QAAQ,EAAE,KACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAChC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IACpC;IACJ,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,GAAwB;QACxC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAC9B,MAAM,OAAO,GAAG,2BAAe,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,SAAS,GAAG,gCAAc,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC3D,OAAO,IAAI,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AA5BD,oDA4BC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/semantics.entities.semantic-schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/semantics/entities/semantic-schema",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.semantics",
|
|
8
8
|
"name": "entities/semantic-schema",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.60"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
13
13
|
"lodash": "4.17.21",
|
|
14
|
-
"@teambit/component-id": "
|
|
14
|
+
"@teambit/component-id": "1.2.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/lodash": "4.14.165",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
|
+
"optionalDependencies": {},
|
|
26
|
+
"peerDependenciesMeta": {},
|
|
25
27
|
"private": false,
|
|
26
28
|
"engines": {
|
|
27
29
|
"node": ">=12.22.0"
|
|
@@ -3,36 +3,36 @@ import { SchemaRegistry } from '../schema-registry';
|
|
|
3
3
|
import { ParameterSchema } from './parameter';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* [key: number]: string
|
|
7
|
+
* keyType: number
|
|
8
|
+
* valueType: string
|
|
8
9
|
*/
|
|
9
10
|
export class IndexSignatureSchema extends SchemaNode {
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
constructor(readonly location: SchemaLocation,
|
|
11
|
+
readonly keyType: SchemaNode;
|
|
12
|
+
readonly valueType: SchemaNode;
|
|
13
|
+
constructor(readonly location: SchemaLocation, keyType: ParameterSchema, valueType: SchemaNode) {
|
|
13
14
|
super();
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
15
|
+
this.keyType = keyType;
|
|
16
|
+
this.valueType = valueType;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
toString() {
|
|
19
|
-
|
|
20
|
-
return `[${paramsStr}]: ${this.type.toString()}`;
|
|
20
|
+
return `[${this.keyType.toString()}]: ${this.valueType.toString()}`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
toObject() {
|
|
24
24
|
return {
|
|
25
25
|
...super.toObject(),
|
|
26
26
|
location: this.location,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
keyType: this.keyType.toObject(),
|
|
28
|
+
valueType: this.valueType.toObject(),
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
static fromObject(obj: Record<string, any>): IndexSignatureSchema {
|
|
33
33
|
const location = obj.location;
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
return new IndexSignatureSchema(location,
|
|
34
|
+
const keyType = ParameterSchema.fromObject(obj.keyType);
|
|
35
|
+
const valueType = SchemaRegistry.fromObject(obj.valueType);
|
|
36
|
+
return new IndexSignatureSchema(location, keyType, valueType);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// import { ComponentID, ComponentIdObj } from '@teambit/component-id';
|
|
2
|
-
// import { TransformationType } from 'class-transformer';
|
|
3
|
-
|
|
4
|
-
// export function componentIdTransformer({
|
|
5
|
-
// value,
|
|
6
|
-
// type,
|
|
7
|
-
// }: {
|
|
8
|
-
// value: ComponentID | ComponentIdObj | undefined;
|
|
9
|
-
// type: TransformationType;
|
|
10
|
-
// }): ComponentID | ComponentIdObj | undefined {
|
|
11
|
-
// if (!value) {
|
|
12
|
-
// return undefined;
|
|
13
|
-
// }
|
|
14
|
-
// if (type === TransformationType.PLAIN_TO_CLASS) {
|
|
15
|
-
// return ComponentID.fromObject(value as ComponentIdObj);
|
|
16
|
-
// }
|
|
17
|
-
// if (type === TransformationType.CLASS_TO_CLASS) {
|
|
18
|
-
// return value as ComponentID;
|
|
19
|
-
// }
|
|
20
|
-
// // it's CLASS_TO_PLAIN
|
|
21
|
-
// return (value as ComponentID).toObject();
|
|
22
|
-
// }
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// import { plainToInstance, TransformationType, ClassConstructor } from 'class-transformer';
|
|
2
|
-
// import { compact } from 'lodash';
|
|
3
|
-
// import { SchemaNode } from '../schema-node';
|
|
4
|
-
// import * as Schemas from '../schemas';
|
|
5
|
-
// import { UnknownSchema } from '../schemas/unknown-schema';
|
|
6
|
-
|
|
7
|
-
// const SchemaClasses = { ...Schemas };
|
|
8
|
-
|
|
9
|
-
// export function registerSchemaClass(schema: ClassConstructor<SchemaNode>) {
|
|
10
|
-
// SchemaClasses[schema.name] = schema;
|
|
11
|
-
// }
|
|
12
|
-
|
|
13
|
-
// export function schemaObjArrayToInstances({ value, type }: { value: SchemaNode[]; type: TransformationType }) {
|
|
14
|
-
// if (type !== TransformationType.PLAIN_TO_CLASS) {
|
|
15
|
-
// return value;
|
|
16
|
-
// }
|
|
17
|
-
// return value.map((obj) => transformFromObjectToInstance(obj));
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
// export function schemaObjToInstance({
|
|
21
|
-
// value,
|
|
22
|
-
// type,
|
|
23
|
-
// }: {
|
|
24
|
-
// value: Record<string, any> | undefined;
|
|
25
|
-
// type: TransformationType;
|
|
26
|
-
// }) {
|
|
27
|
-
// if (type !== TransformationType.PLAIN_TO_CLASS) {
|
|
28
|
-
// return value;
|
|
29
|
-
// }
|
|
30
|
-
// if (!value) {
|
|
31
|
-
// return undefined;
|
|
32
|
-
// }
|
|
33
|
-
// return transformFromObjectToInstance(value);
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// function transformFromObjectToInstance(obj: Record<string, any>): SchemaNode {
|
|
37
|
-
// if (!obj.__schema) {
|
|
38
|
-
// throw new Error(`fatal: "__schema" is missing, make sure the transformer is set on SchemaNode type`);
|
|
39
|
-
// }
|
|
40
|
-
// const SchemaClass = getClassBySchemaName(obj.__schema);
|
|
41
|
-
// if (!SchemaClass) {
|
|
42
|
-
// // for backward and forward compatibility, to not break the users, it's better to return an unknown schema than throwing.
|
|
43
|
-
// return new UnknownSchema(obj.location || { path: '', line: 0, character: 0 }, obj.__schema, obj);
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
// return plainToInstance(SchemaClass, obj);
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
// function getClassBySchemaName(schemaName: string): ClassConstructor<SchemaNode> | null {
|
|
50
|
-
// const schemasClasses = compact(Object.values(SchemaClasses));
|
|
51
|
-
// const schemaClass = schemasClasses.find((schema) => schema.name === schemaName);
|
|
52
|
-
// if (!schemaClass) {
|
|
53
|
-
// return null;
|
|
54
|
-
// }
|
|
55
|
-
// return schemaClass;
|
|
56
|
-
// }
|
|
File without changes
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// import { ComponentID, ComponentIdObj } from '@teambit/component-id';
|
|
2
|
-
// import { TransformationType } from 'class-transformer';
|
|
3
|
-
// export function componentIdTransformer({
|
|
4
|
-
// value,
|
|
5
|
-
// type,
|
|
6
|
-
// }: {
|
|
7
|
-
// value: ComponentID | ComponentIdObj | undefined;
|
|
8
|
-
// type: TransformationType;
|
|
9
|
-
// }): ComponentID | ComponentIdObj | undefined {
|
|
10
|
-
// if (!value) {
|
|
11
|
-
// return undefined;
|
|
12
|
-
// }
|
|
13
|
-
// if (type === TransformationType.PLAIN_TO_CLASS) {
|
|
14
|
-
// return ComponentID.fromObject(value as ComponentIdObj);
|
|
15
|
-
// }
|
|
16
|
-
// if (type === TransformationType.CLASS_TO_CLASS) {
|
|
17
|
-
// return value as ComponentID;
|
|
18
|
-
// }
|
|
19
|
-
// // it's CLASS_TO_PLAIN
|
|
20
|
-
// return (value as ComponentID).toObject();
|
|
21
|
-
// }
|
|
22
|
-
//# sourceMappingURL=comp-id-transformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comp-id-transformer.js","sourceRoot":"","sources":["../../class-transformers/comp-id-transformer.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,0DAA0D;AAE1D,2CAA2C;AAC3C,WAAW;AACX,UAAU;AACV,OAAO;AACP,qDAAqD;AACrD,8BAA8B;AAC9B,iDAAiD;AACjD,kBAAkB;AAClB,wBAAwB;AACxB,MAAM;AACN,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM;AACN,sDAAsD;AACtD,mCAAmC;AACnC,MAAM;AACN,2BAA2B;AAC3B,8CAA8C;AAC9C,IAAI"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../class-transformers/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,kEAAkE"}
|
|
File without changes
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import { plainToInstance, TransformationType, ClassConstructor } from 'class-transformer';
|
|
2
|
-
// import { compact } from 'lodash';
|
|
3
|
-
// import { SchemaNode } from '../schema-node';
|
|
4
|
-
// import * as Schemas from '../schemas';
|
|
5
|
-
// import { UnknownSchema } from '../schemas/unknown-schema';
|
|
6
|
-
// const SchemaClasses = { ...Schemas };
|
|
7
|
-
// export function registerSchemaClass(schema: ClassConstructor<SchemaNode>) {
|
|
8
|
-
// SchemaClasses[schema.name] = schema;
|
|
9
|
-
// }
|
|
10
|
-
// export function schemaObjArrayToInstances({ value, type }: { value: SchemaNode[]; type: TransformationType }) {
|
|
11
|
-
// if (type !== TransformationType.PLAIN_TO_CLASS) {
|
|
12
|
-
// return value;
|
|
13
|
-
// }
|
|
14
|
-
// return value.map((obj) => transformFromObjectToInstance(obj));
|
|
15
|
-
// }
|
|
16
|
-
// export function schemaObjToInstance({
|
|
17
|
-
// value,
|
|
18
|
-
// type,
|
|
19
|
-
// }: {
|
|
20
|
-
// value: Record<string, any> | undefined;
|
|
21
|
-
// type: TransformationType;
|
|
22
|
-
// }) {
|
|
23
|
-
// if (type !== TransformationType.PLAIN_TO_CLASS) {
|
|
24
|
-
// return value;
|
|
25
|
-
// }
|
|
26
|
-
// if (!value) {
|
|
27
|
-
// return undefined;
|
|
28
|
-
// }
|
|
29
|
-
// return transformFromObjectToInstance(value);
|
|
30
|
-
// }
|
|
31
|
-
// function transformFromObjectToInstance(obj: Record<string, any>): SchemaNode {
|
|
32
|
-
// if (!obj.__schema) {
|
|
33
|
-
// throw new Error(`fatal: "__schema" is missing, make sure the transformer is set on SchemaNode type`);
|
|
34
|
-
// }
|
|
35
|
-
// const SchemaClass = getClassBySchemaName(obj.__schema);
|
|
36
|
-
// if (!SchemaClass) {
|
|
37
|
-
// // for backward and forward compatibility, to not break the users, it's better to return an unknown schema than throwing.
|
|
38
|
-
// return new UnknownSchema(obj.location || { path: '', line: 0, character: 0 }, obj.__schema, obj);
|
|
39
|
-
// }
|
|
40
|
-
// return plainToInstance(SchemaClass, obj);
|
|
41
|
-
// }
|
|
42
|
-
// function getClassBySchemaName(schemaName: string): ClassConstructor<SchemaNode> | null {
|
|
43
|
-
// const schemasClasses = compact(Object.values(SchemaClasses));
|
|
44
|
-
// const schemaClass = schemasClasses.find((schema) => schema.name === schemaName);
|
|
45
|
-
// if (!schemaClass) {
|
|
46
|
-
// return null;
|
|
47
|
-
// }
|
|
48
|
-
// return schemaClass;
|
|
49
|
-
// }
|
|
50
|
-
//# sourceMappingURL=schema-obj-to-class.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-obj-to-class.js","sourceRoot":"","sources":["../../class-transformers/schema-obj-to-class.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,oCAAoC;AACpC,+CAA+C;AAC/C,yCAAyC;AACzC,6DAA6D;AAE7D,wCAAwC;AAExC,8EAA8E;AAC9E,yCAAyC;AACzC,IAAI;AAEJ,kHAAkH;AAClH,sDAAsD;AACtD,oBAAoB;AACpB,MAAM;AACN,mEAAmE;AACnE,IAAI;AAEJ,wCAAwC;AACxC,WAAW;AACX,UAAU;AACV,OAAO;AACP,4CAA4C;AAC5C,8BAA8B;AAC9B,OAAO;AACP,sDAAsD;AACtD,oBAAoB;AACpB,MAAM;AACN,kBAAkB;AAClB,wBAAwB;AACxB,MAAM;AACN,iDAAiD;AACjD,IAAI;AAEJ,iFAAiF;AACjF,yBAAyB;AACzB,4GAA4G;AAC5G,MAAM;AACN,4DAA4D;AAC5D,wBAAwB;AACxB,gIAAgI;AAChI,wGAAwG;AACxG,MAAM;AAEN,8CAA8C;AAC9C,IAAI;AAEJ,2FAA2F;AAC3F,kEAAkE;AAClE,qFAAqF;AACrF,wBAAwB;AACxB,mBAAmB;AACnB,MAAM;AACN,wBAAwB;AACxB,IAAI"}
|