@teambit/semantics.entities.semantic-schema 0.0.53 → 0.0.56
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 +23 -10
- package/class-transformers/comp-id-transformer.ts +21 -21
- package/class-transformers/index.ts +2 -2
- package/class-transformers/schema-obj-to-class.ts +51 -45
- package/dist/api-schema.d.ts +17 -3
- package/dist/api-schema.js +9 -22
- package/dist/api-schema.js.map +1 -1
- package/dist/class-transformers/comp-id-transformer.d.ts +0 -6
- package/dist/class-transformers/comp-id-transformer.js +21 -19
- package/dist/class-transformers/comp-id-transformer.js.map +1 -1
- package/dist/class-transformers/index.d.ts +0 -2
- package/dist/class-transformers/index.js +2 -8
- package/dist/class-transformers/index.js.map +1 -1
- package/dist/class-transformers/schema-obj-to-class.d.ts +0 -10
- package/dist/class-transformers/schema-obj-to-class.js +49 -66
- package/dist/class-transformers/schema-obj-to-class.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/{preview-1678246516830.js → preview-1695124733440.js} +1 -1
- package/dist/schema-node-constructor.d.ts +7 -0
- package/dist/schema-node-constructor.js +3 -0
- package/dist/schema-node-constructor.js.map +1 -0
- package/dist/schema-node.d.ts +20 -4
- package/dist/schema-node.js +36 -2
- package/dist/schema-node.js.map +1 -1
- package/dist/schema-registry.d.ts +9 -0
- package/dist/schema-registry.js +31 -0
- package/dist/schema-registry.js.map +1 -0
- package/dist/schemas/class.d.ts +39 -3
- package/dist/schemas/class.js +22 -14
- package/dist/schemas/class.js.map +1 -1
- package/dist/schemas/conditional-type.d.ts +11 -3
- package/dist/schemas/conditional-type.js +15 -20
- package/dist/schemas/conditional-type.js.map +1 -1
- package/dist/schemas/constructor.d.ts +3 -2
- package/dist/schemas/constructor.js +14 -2
- package/dist/schemas/constructor.js.map +1 -1
- package/dist/schemas/docs/doc.d.ts +20 -3
- package/dist/schemas/docs/doc.js +17 -11
- package/dist/schemas/docs/doc.js.map +1 -1
- package/dist/schemas/docs/property-like-tag.d.ts +13 -3
- package/dist/schemas/docs/property-like-tag.js +12 -11
- package/dist/schemas/docs/property-like-tag.js.map +1 -1
- package/dist/schemas/docs/return-tag.d.ts +13 -3
- package/dist/schemas/docs/return-tag.js +11 -11
- package/dist/schemas/docs/return-tag.js.map +1 -1
- package/dist/schemas/docs/tag.d.ts +12 -3
- package/dist/schemas/docs/tag.js +16 -0
- package/dist/schemas/docs/tag.js.map +1 -1
- package/dist/schemas/enum-member.d.ts +25 -3
- package/dist/schemas/enum-member.js +13 -11
- package/dist/schemas/enum-member.js.map +1 -1
- package/dist/schemas/enum.d.ts +26 -3
- package/dist/schemas/enum.js +17 -14
- package/dist/schemas/enum.js.map +1 -1
- package/dist/schemas/expression-with-arguments.d.ts +10 -3
- package/dist/schemas/expression-with-arguments.js +11 -14
- package/dist/schemas/expression-with-arguments.js.map +1 -1
- package/dist/schemas/function-like.d.ts +40 -4
- package/dist/schemas/function-like.js +28 -18
- package/dist/schemas/function-like.js.map +1 -1
- package/dist/schemas/get-accessor.d.ts +10 -3
- package/dist/schemas/get-accessor.js +14 -11
- package/dist/schemas/get-accessor.js.map +1 -1
- package/dist/schemas/index-signature.d.ts +17 -3
- package/dist/schemas/index-signature.js +11 -14
- package/dist/schemas/index-signature.js.map +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/indexed-access-type.d.ts +9 -3
- package/dist/schemas/indexed-access-type.js +13 -14
- package/dist/schemas/indexed-access-type.js.map +1 -1
- package/dist/schemas/inference-type.d.ts +9 -3
- package/dist/schemas/inference-type.js +12 -1
- package/dist/schemas/inference-type.js.map +1 -1
- package/dist/schemas/interface.d.ts +33 -3
- package/dist/schemas/interface.js +21 -14
- package/dist/schemas/interface.js.map +1 -1
- package/dist/schemas/keyword-type.d.ts +7 -3
- package/dist/schemas/keyword-type.js +8 -0
- package/dist/schemas/keyword-type.js.map +1 -1
- package/dist/schemas/literal-type.d.ts +4 -4
- package/dist/schemas/literal-type.js +6 -4
- package/dist/schemas/literal-type.js.map +1 -1
- package/dist/schemas/module.d.ts +9 -7
- package/dist/schemas/module.js +15 -20
- package/dist/schemas/module.js.map +1 -1
- package/dist/schemas/named-tuple.d.ts +9 -3
- package/dist/schemas/named-tuple.js +13 -0
- package/dist/schemas/named-tuple.js.map +1 -1
- package/dist/schemas/parameter.d.ts +16 -5
- package/dist/schemas/parameter.js +20 -16
- package/dist/schemas/parameter.js.map +1 -1
- package/dist/schemas/parenthesized-type.d.ts +8 -3
- package/dist/schemas/parenthesized-type.js +12 -11
- package/dist/schemas/parenthesized-type.js.map +1 -1
- package/dist/schemas/set-accessor.d.ts +17 -3
- package/dist/schemas/set-accessor.js +11 -11
- package/dist/schemas/set-accessor.js.map +1 -1
- package/dist/schemas/template-literal-type-span.d.ts +9 -3
- package/dist/schemas/template-literal-type-span.js +13 -11
- package/dist/schemas/template-literal-type-span.js.map +1 -1
- package/dist/schemas/template-literal-type.d.ts +11 -3
- package/dist/schemas/template-literal-type.js +10 -11
- package/dist/schemas/template-literal-type.js.map +1 -1
- package/dist/schemas/this-type.d.ts +4 -3
- package/dist/schemas/this-type.js +4 -0
- package/dist/schemas/this-type.js.map +1 -1
- package/dist/schemas/tuple-type.d.ts +7 -3
- package/dist/schemas/tuple-type.js +9 -11
- package/dist/schemas/tuple-type.js.map +1 -1
- package/dist/schemas/type-array.d.ts +8 -3
- package/dist/schemas/type-array.js +12 -11
- package/dist/schemas/type-array.js.map +1 -1
- package/dist/schemas/type-intersection.d.ts +8 -3
- package/dist/schemas/type-intersection.js +12 -11
- package/dist/schemas/type-intersection.js.map +1 -1
- package/dist/schemas/type-literal.d.ts +8 -3
- package/dist/schemas/type-literal.js +12 -11
- package/dist/schemas/type-literal.js.map +1 -1
- package/dist/schemas/type-operator.d.ts +9 -3
- package/dist/schemas/type-operator.js +13 -11
- package/dist/schemas/type-operator.js.map +1 -1
- package/dist/schemas/type-predicate.d.ts +9 -3
- package/dist/schemas/type-predicate.js +12 -11
- package/dist/schemas/type-predicate.js.map +1 -1
- package/dist/schemas/type-query.d.ts +9 -3
- package/dist/schemas/type-query.js +13 -11
- package/dist/schemas/type-query.js.map +1 -1
- package/dist/schemas/type-ref.d.ts +28 -4
- package/dist/schemas/type-ref.js +43 -16
- package/dist/schemas/type-ref.js.map +1 -1
- package/dist/schemas/type-union.d.ts +8 -3
- package/dist/schemas/type-union.js +12 -11
- package/dist/schemas/type-union.js.map +1 -1
- package/dist/schemas/type.d.ts +10 -3
- package/dist/schemas/type.js +16 -14
- package/dist/schemas/type.js.map +1 -1
- package/dist/schemas/unimplemented-schema.d.ts +7 -3
- package/dist/schemas/unimplemented-schema.js +9 -0
- package/dist/schemas/unimplemented-schema.js.map +1 -1
- package/dist/schemas/unknown-schema.d.ts +7 -3
- package/dist/schemas/unknown-schema.js +9 -0
- package/dist/schemas/unknown-schema.js.map +1 -1
- package/dist/schemas/unresolved-schema.d.ts +5 -3
- package/dist/schemas/unresolved-schema.js +8 -0
- package/dist/schemas/unresolved-schema.js.map +1 -1
- package/dist/schemas/variable-like.d.ts +29 -3
- package/dist/schemas/variable-like.js +21 -15
- package/dist/schemas/variable-like.js.map +1 -1
- package/dist/unknown-schema-factory.d.ts +4 -0
- package/dist/unknown-schema-factory.js +13 -0
- package/dist/unknown-schema-factory.js.map +1 -0
- package/index.ts +10 -2
- package/package.json +3 -4
- package/schema-node-constructor.ts +8 -0
- package/schema-node.ts +62 -6
- package/schema-registry.ts +33 -0
- package/schemas/class.ts +32 -7
- package/schemas/conditional-type.ts +27 -11
- package/schemas/constructor.ts +14 -4
- package/schemas/docs/doc.ts +22 -5
- package/schemas/docs/property-like-tag.ts +19 -5
- package/schemas/docs/return-tag.ts +18 -5
- package/schemas/docs/tag.ts +20 -2
- package/schemas/enum-member.ts +21 -5
- package/schemas/enum.ts +26 -6
- package/schemas/expression-with-arguments.ts +26 -7
- package/schemas/function-like.ts +51 -10
- package/schemas/get-accessor.ts +24 -5
- package/schemas/index-signature.ts +19 -6
- package/schemas/index.ts +1 -1
- package/schemas/indexed-access-type.ts +24 -6
- package/schemas/inference-type.ts +23 -2
- package/schemas/interface.ts +30 -7
- package/schemas/keyword-type.ts +15 -2
- package/schemas/literal-type.ts +9 -3
- package/schemas/module.ts +24 -14
- package/schemas/named-tuple.ts +22 -2
- package/schemas/parameter.ts +43 -11
- package/schemas/parenthesized-type.ts +20 -5
- package/schemas/set-accessor.ts +26 -5
- package/schemas/template-literal-type-span.ts +23 -5
- package/schemas/template-literal-type.ts +22 -5
- package/schemas/this-type.ts +7 -2
- package/schemas/tuple-type.ts +17 -5
- package/schemas/type-array.ts +21 -5
- package/schemas/type-intersection.ts +21 -5
- package/schemas/type-literal.ts +21 -5
- package/schemas/type-operator.ts +22 -5
- package/schemas/type-predicate.ts +20 -5
- package/schemas/type-query.ts +24 -5
- package/schemas/type-ref.ts +51 -10
- package/schemas/type-union.ts +17 -5
- package/schemas/type.ts +25 -7
- package/schemas/unimplemented-schema.ts +16 -2
- package/schemas/unknown-schema.ts +16 -2
- package/schemas/unresolved-schema.ts +12 -2
- package/schemas/variable-like.ts +33 -8
- package/unknown-schema-factory.ts +10 -0
- package/package-tar/teambit-semantics.entities.semantic-schema-0.0.53.tgz +0 -0
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
2
|
|
|
3
3
|
export class UnImplementedSchema extends SchemaNode {
|
|
4
|
-
constructor(readonly location:
|
|
4
|
+
constructor(readonly location: SchemaLocation, readonly name: string, readonly type: string) {
|
|
5
5
|
super();
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
toString() {
|
|
9
9
|
return `<<unimplemented schema ${this.name} of type ${this.type}>>`;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
toObject() {
|
|
13
|
+
return {
|
|
14
|
+
...super.toObject(),
|
|
15
|
+
type: this.type,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static fromObject(obj: Record<string, any>): UnImplementedSchema {
|
|
20
|
+
const location = obj.location;
|
|
21
|
+
const name = obj.name;
|
|
22
|
+
const type = obj.type;
|
|
23
|
+
return new UnImplementedSchema(location, name, type);
|
|
24
|
+
}
|
|
11
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* needed for better backward and forward compatibility.
|
|
@@ -6,11 +6,25 @@ import { Location, SchemaNode } from '../schema-node';
|
|
|
6
6
|
* wrapped in this class.
|
|
7
7
|
*/
|
|
8
8
|
export class UnknownSchema extends SchemaNode {
|
|
9
|
-
constructor(readonly location:
|
|
9
|
+
constructor(readonly location: SchemaLocation, readonly name: string, readonly schemaObj: Record<string, any>) {
|
|
10
10
|
super();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
toString() {
|
|
14
14
|
return `<<unknown schema ${this.name}>>`;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
toObject() {
|
|
18
|
+
return {
|
|
19
|
+
...super.toObject(),
|
|
20
|
+
schemaObj: this.schemaObj,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static fromObject(obj: Record<string, any>): UnknownSchema {
|
|
25
|
+
const location = obj.location;
|
|
26
|
+
const name = obj.name;
|
|
27
|
+
const schemaObj = obj.schemaObj;
|
|
28
|
+
return new UnknownSchema(location, name, schemaObj);
|
|
29
|
+
}
|
|
16
30
|
}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* needed for cases when the exported entity could not be resolved.
|
|
5
5
|
* e.g. exporting mdx variables in the main index.ts file.
|
|
6
6
|
*/
|
|
7
7
|
export class UnresolvedSchema extends SchemaNode {
|
|
8
|
-
constructor(readonly location:
|
|
8
|
+
constructor(readonly location: SchemaLocation, readonly name: string) {
|
|
9
9
|
super();
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
toString() {
|
|
13
13
|
return this.name;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
toObject() {
|
|
17
|
+
return super.toObject();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static fromObject(obj: Record<string, any>): UnresolvedSchema {
|
|
21
|
+
const location = obj.location;
|
|
22
|
+
const name = obj.name;
|
|
23
|
+
return new UnresolvedSchema(location, name);
|
|
24
|
+
}
|
|
15
25
|
}
|
package/schemas/variable-like.ts
CHANGED
|
@@ -1,32 +1,57 @@
|
|
|
1
|
-
import { Transform } from 'class-transformer';
|
|
2
1
|
import chalk from 'chalk';
|
|
3
|
-
import {
|
|
4
|
-
import { schemaObjToInstance } from '../class-transformers';
|
|
2
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
5
3
|
import { DocSchema } from './docs';
|
|
4
|
+
import { SchemaRegistry } from '../schema-registry';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* can be also a property or property-signature
|
|
9
8
|
*/
|
|
10
9
|
export class VariableLikeSchema extends SchemaNode {
|
|
11
|
-
@Transform(schemaObjToInstance)
|
|
12
10
|
type: SchemaNode;
|
|
13
|
-
|
|
14
|
-
@Transform(schemaObjToInstance)
|
|
15
11
|
readonly doc?: DocSchema;
|
|
12
|
+
|
|
16
13
|
constructor(
|
|
17
|
-
readonly location:
|
|
14
|
+
readonly location: SchemaLocation,
|
|
18
15
|
readonly name: string,
|
|
19
16
|
readonly signature: string,
|
|
20
17
|
type: SchemaNode,
|
|
21
18
|
readonly isOptional: boolean,
|
|
22
|
-
doc?: DocSchema
|
|
19
|
+
doc?: DocSchema,
|
|
20
|
+
readonly defaultValue?: string
|
|
23
21
|
) {
|
|
24
22
|
super();
|
|
25
23
|
this.type = type;
|
|
26
24
|
this.doc = doc;
|
|
27
25
|
}
|
|
28
26
|
|
|
27
|
+
getNodes() {
|
|
28
|
+
return [this.type];
|
|
29
|
+
}
|
|
30
|
+
|
|
29
31
|
toString() {
|
|
30
32
|
return `${chalk.bold(this.name)}${this.isOptional ? '?' : ''}: ${this.type.toString()}`;
|
|
31
33
|
}
|
|
34
|
+
|
|
35
|
+
toObject() {
|
|
36
|
+
return {
|
|
37
|
+
...super.toObject(),
|
|
38
|
+
name: this.name,
|
|
39
|
+
signature: this.signature,
|
|
40
|
+
type: this.type.toObject(),
|
|
41
|
+
isOptional: this.isOptional,
|
|
42
|
+
doc: this.doc?.toObject(),
|
|
43
|
+
defaultValue: this.defaultValue,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static fromObject(obj: Record<string, any>): VariableLikeSchema {
|
|
48
|
+
const location = obj.location;
|
|
49
|
+
const name = obj.name;
|
|
50
|
+
const signature = obj.signature;
|
|
51
|
+
const type = SchemaRegistry.fromObject(obj.type);
|
|
52
|
+
const isOptional = obj.isOptional;
|
|
53
|
+
const doc = obj.doc ? DocSchema.fromObject(obj.doc) : undefined;
|
|
54
|
+
const defaultValue = obj.defaultValue;
|
|
55
|
+
return new VariableLikeSchema(location, name, signature, type, isOptional, doc, defaultValue);
|
|
56
|
+
}
|
|
32
57
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SchemaLocation } from './schema-node';
|
|
2
|
+
|
|
3
|
+
export class UnknownSchemaFactory {
|
|
4
|
+
static create(location: SchemaLocation, name: string, schemaObj: Record<string, any>): any {
|
|
5
|
+
// dynamic require() to import UnknownSchema at runtime when it's needed, which breaks the circular dependency.
|
|
6
|
+
// eslint-disable-next-line global-require
|
|
7
|
+
const { UnknownSchema } = require('./schemas/unknown-schema');
|
|
8
|
+
return new UnknownSchema(location, name, schemaObj);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
Binary file
|