@teambit/semantics.entities.semantic-schema 0.0.15 → 0.0.18
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 +3 -1
- package/class-transformers/comp-id-transformer.ts +22 -0
- package/class-transformers/index.ts +2 -0
- package/{schema-obj-to-class.ts → class-transformers/schema-obj-to-class.ts} +12 -3
- package/dist/api-schema.js +6 -2
- package/dist/api-schema.js.map +1 -1
- package/dist/class-transformers/comp-id-transformer.d.ts +6 -0
- package/dist/class-transformers/comp-id-transformer.js +20 -0
- package/dist/class-transformers/comp-id-transformer.js.map +1 -0
- package/dist/class-transformers/index.d.ts +2 -0
- package/dist/class-transformers/index.js +9 -0
- package/dist/class-transformers/index.js.map +1 -0
- package/dist/{schema-obj-to-class.d.ts → class-transformers/schema-obj-to-class.d.ts} +3 -3
- package/dist/{schema-obj-to-class.js → class-transformers/schema-obj-to-class.js} +5 -2
- package/dist/class-transformers/schema-obj-to-class.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -30
- package/dist/index.js.map +1 -1
- package/dist/schema-node.d.ts +2 -0
- package/dist/schema-node.js.map +1 -1
- package/dist/schemas/class.d.ts +3 -1
- package/dist/schemas/class.js +7 -3
- package/dist/schemas/class.js.map +1 -1
- package/dist/schemas/constructor.js +2 -2
- package/dist/schemas/constructor.js.map +1 -1
- package/dist/schemas/docs/doc.d.ts +11 -0
- package/dist/schemas/docs/doc.js +37 -0
- package/dist/schemas/docs/doc.js.map +1 -0
- package/dist/schemas/docs/index.d.ts +3 -0
- package/dist/schemas/docs/index.js +10 -0
- package/dist/schemas/docs/index.js.map +1 -0
- package/dist/schemas/docs/return-tag.d.ts +13 -0
- package/dist/schemas/docs/return-tag.js +22 -0
- package/dist/schemas/docs/return-tag.js.map +1 -0
- package/dist/schemas/docs/tag.d.ts +33 -0
- package/dist/schemas/docs/tag.js +44 -0
- package/dist/schemas/docs/tag.js.map +1 -0
- package/dist/schemas/function-like.d.ts +6 -2
- package/dist/schemas/function-like.js +21 -10
- package/dist/schemas/function-like.js.map +1 -1
- package/dist/schemas/get-accessor.js +2 -2
- package/dist/schemas/get-accessor.js.map +1 -1
- package/dist/schemas/index-signature.js +3 -3
- package/dist/schemas/index-signature.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +14 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/indexed-access-type.js +3 -3
- package/dist/schemas/indexed-access-type.js.map +1 -1
- package/dist/schemas/interface.js +2 -2
- package/dist/schemas/interface.js.map +1 -1
- package/dist/schemas/keyword-type.d.ts +1 -1
- package/dist/schemas/keyword-type.js.map +1 -1
- package/dist/schemas/module.js +2 -2
- package/dist/schemas/module.js.map +1 -1
- package/dist/schemas/parameter.d.ts +2 -1
- package/dist/schemas/parameter.js +5 -4
- package/dist/schemas/parameter.js.map +1 -1
- package/dist/schemas/parenthesized-type.js +2 -2
- package/dist/schemas/parenthesized-type.js.map +1 -1
- package/dist/schemas/set-accessor.js +2 -2
- package/dist/schemas/set-accessor.js.map +1 -1
- package/dist/schemas/template-literal-type-span.js +2 -2
- package/dist/schemas/template-literal-type-span.js.map +1 -1
- package/dist/schemas/template-literal-type.js +2 -2
- package/dist/schemas/template-literal-type.js.map +1 -1
- package/dist/schemas/this-type.d.ts +9 -0
- package/dist/schemas/this-type.js +18 -0
- package/dist/schemas/this-type.js.map +1 -0
- package/dist/schemas/tuple-type.js +2 -2
- package/dist/schemas/tuple-type.js.map +1 -1
- package/dist/schemas/type-array.js +2 -2
- package/dist/schemas/type-array.js.map +1 -1
- package/dist/schemas/type-intersection.js +2 -2
- package/dist/schemas/type-intersection.js.map +1 -1
- package/dist/schemas/type-literal.js +2 -2
- package/dist/schemas/type-literal.js.map +1 -1
- package/dist/schemas/type-operator.js +2 -2
- package/dist/schemas/type-operator.js.map +1 -1
- package/dist/schemas/type-predicate.js +2 -2
- package/dist/schemas/type-predicate.js.map +1 -1
- package/dist/schemas/type-query.js +2 -2
- package/dist/schemas/type-query.js.map +1 -1
- package/dist/schemas/type-ref.d.ts +1 -4
- package/dist/schemas/type-ref.js +7 -3
- package/dist/schemas/type-ref.js.map +1 -1
- package/dist/schemas/type-union.js +2 -2
- package/dist/schemas/type-union.js.map +1 -1
- package/dist/schemas/type.js +2 -2
- package/dist/schemas/type.js.map +1 -1
- package/dist/schemas/variable.d.ts +2 -1
- package/dist/schemas/variable.js +5 -4
- package/dist/schemas/variable.js.map +1 -1
- package/dist/tsconfig.json +32 -0
- package/index.ts +2 -32
- package/package-tar/teambit-semantics.entities.semantic-schema-0.0.18.tgz +0 -0
- package/package.json +2 -4
- package/{preview-1653535588073.js → preview-1654572446572.js} +1 -1
- package/schema-node.ts +2 -0
- package/schemas/class.ts +8 -2
- package/schemas/constructor.ts +1 -1
- package/schemas/docs/doc.ts +27 -0
- package/schemas/docs/index.ts +3 -0
- package/schemas/docs/return-tag.ts +21 -0
- package/schemas/docs/tag.ts +38 -0
- package/schemas/function-like.ts +22 -9
- package/schemas/get-accessor.ts +1 -1
- package/schemas/index-signature.ts +1 -1
- package/schemas/index.ts +2 -0
- package/schemas/indexed-access-type.ts +1 -1
- package/schemas/interface.ts +1 -1
- package/schemas/keyword-type.ts +1 -1
- package/schemas/module.ts +1 -1
- package/schemas/parameter.ts +3 -2
- package/schemas/parenthesized-type.ts +1 -1
- package/schemas/set-accessor.ts +1 -1
- package/schemas/template-literal-type-span.ts +1 -1
- package/schemas/template-literal-type.ts +1 -1
- package/schemas/this-type.ts +14 -0
- package/schemas/tuple-type.ts +1 -1
- package/schemas/type-array.ts +1 -1
- package/schemas/type-intersection.ts +1 -1
- package/schemas/type-literal.ts +1 -1
- package/schemas/type-operator.ts +1 -1
- package/schemas/type-predicate.ts +1 -1
- package/schemas/type-query.ts +1 -1
- package/schemas/type-ref.ts +7 -10
- package/schemas/type-union.ts +1 -1
- package/schemas/type.ts +1 -1
- package/schemas/variable.ts +9 -3
- package/tsconfig.json +6 -1
- package/dist/json-schema.d.ts +0 -1
- package/dist/json-schema.js +0 -3
- package/dist/json-schema.js.map +0 -1
- package/dist/schema-obj-to-class.js.map +0 -1
- package/json-schema.ts +0 -1
- package/package-tar/teambit-semantics.entities.semantic-schema-0.0.15.tgz +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Location, SchemaNode } from '../schema-node';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* e.g. `class A { createA(): this {} }`
|
|
5
|
+
*/
|
|
6
|
+
export class ThisTypeSchema extends SchemaNode {
|
|
7
|
+
constructor(readonly location: Location) {
|
|
8
|
+
super();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
toString() {
|
|
12
|
+
return 'this';
|
|
13
|
+
}
|
|
14
|
+
}
|
package/schemas/tuple-type.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import { Location, SchemaNode } from '../schema-node';
|
|
3
|
-
import { schemaObjArrayToInstances } from '../
|
|
3
|
+
import { schemaObjArrayToInstances } from '../class-transformers';
|
|
4
4
|
|
|
5
5
|
export class TupleTypeSchema extends SchemaNode {
|
|
6
6
|
@Transform(schemaObjArrayToInstances)
|
package/schemas/type-array.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import { Location, SchemaNode } from '../schema-node';
|
|
3
|
-
import { schemaObjToInstance } from '../
|
|
3
|
+
import { schemaObjToInstance } from '../class-transformers';
|
|
4
4
|
|
|
5
5
|
export class TypeArraySchema extends SchemaNode {
|
|
6
6
|
@Transform(schemaObjToInstance)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import { Location, SchemaNode } from '../schema-node';
|
|
3
|
-
import { schemaObjArrayToInstances } from '../
|
|
3
|
+
import { schemaObjArrayToInstances } from '../class-transformers';
|
|
4
4
|
|
|
5
5
|
export class TypeIntersectionSchema extends SchemaNode {
|
|
6
6
|
@Transform(schemaObjArrayToInstances)
|
package/schemas/type-literal.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import { Location, SchemaNode } from '../schema-node';
|
|
3
|
-
import { schemaObjArrayToInstances } from '../
|
|
3
|
+
import { schemaObjArrayToInstances } from '../class-transformers';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* e.g. `{ a: string; b: number }`
|
package/schemas/type-operator.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import { Location, SchemaNode } from '../schema-node';
|
|
3
|
-
import { schemaObjToInstance } from '../
|
|
3
|
+
import { schemaObjToInstance } from '../class-transformers';
|
|
4
4
|
|
|
5
5
|
export class TypeOperatorSchema extends SchemaNode {
|
|
6
6
|
@Transform(schemaObjToInstance)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import { Location, SchemaNode } from '../schema-node';
|
|
3
|
-
import { schemaObjToInstance } from '../
|
|
3
|
+
import { schemaObjToInstance } from '../class-transformers';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* e.g. `function f(str: any): str is string {}`
|
package/schemas/type-query.ts
CHANGED
package/schemas/type-ref.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { Transform } from 'class-transformer';
|
|
|
2
2
|
import { ComponentID } from '@teambit/component';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { Location, SchemaNode } from '../schema-node';
|
|
5
|
-
import { schemaObjArrayToInstances } from '../
|
|
5
|
+
import { schemaObjArrayToInstances } from '../class-transformers';
|
|
6
|
+
import { componentIdTransformer } from '../class-transformers/comp-id-transformer';
|
|
6
7
|
|
|
7
8
|
export type PlainTypeRefSchema = {
|
|
8
9
|
name: string;
|
|
@@ -23,6 +24,9 @@ export class TypeRefSchema extends SchemaNode {
|
|
|
23
24
|
*/
|
|
24
25
|
typeArgs?: SchemaNode[];
|
|
25
26
|
|
|
27
|
+
@Transform(componentIdTransformer)
|
|
28
|
+
readonly componentId?: ComponentID;
|
|
29
|
+
|
|
26
30
|
constructor(
|
|
27
31
|
readonly location: Location,
|
|
28
32
|
/**
|
|
@@ -33,7 +37,7 @@ export class TypeRefSchema extends SchemaNode {
|
|
|
33
37
|
/**
|
|
34
38
|
* target component id. existing if the type is defined in another component.
|
|
35
39
|
*/
|
|
36
|
-
|
|
40
|
+
componentId?: ComponentID,
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
43
|
* target package name. existing if type is defined in different package.
|
|
@@ -41,6 +45,7 @@ export class TypeRefSchema extends SchemaNode {
|
|
|
41
45
|
readonly packageName?: string
|
|
42
46
|
) {
|
|
43
47
|
super();
|
|
48
|
+
this.componentId = componentId;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
toString() {
|
|
@@ -70,12 +75,4 @@ export class TypeRefSchema extends SchemaNode {
|
|
|
70
75
|
isFromThisComponent() {
|
|
71
76
|
return !this.componentId && !this.packageName;
|
|
72
77
|
}
|
|
73
|
-
|
|
74
|
-
// static from(plainSchema: PlainTypeRefSchema) {
|
|
75
|
-
// return new TypeRefSchema(
|
|
76
|
-
// plainSchema.name,
|
|
77
|
-
// plainSchema.componentId ? ComponentID.fromString(plainSchema.componentId) : undefined,
|
|
78
|
-
// plainSchema.packageName
|
|
79
|
-
// );
|
|
80
|
-
// }
|
|
81
78
|
}
|
package/schemas/type-union.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import { Location, SchemaNode } from '../schema-node';
|
|
3
|
-
import { schemaObjArrayToInstances } from '../
|
|
3
|
+
import { schemaObjArrayToInstances } from '../class-transformers';
|
|
4
4
|
|
|
5
5
|
export class TypeUnionSchema extends SchemaNode {
|
|
6
6
|
@Transform(schemaObjArrayToInstances)
|
package/schemas/type.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { Location, SchemaNode } from '../schema-node';
|
|
4
|
-
import { schemaObjToInstance } from '../
|
|
4
|
+
import { schemaObjToInstance } from '../class-transformers';
|
|
5
5
|
|
|
6
6
|
export class TypeSchema extends SchemaNode {
|
|
7
7
|
@Transform(schemaObjToInstance)
|
package/schemas/variable.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transform } from 'class-transformer';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { Location, SchemaNode } from '../schema-node';
|
|
4
|
-
import { schemaObjToInstance } from '../
|
|
4
|
+
import { schemaObjToInstance } from '../class-transformers';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* can be also a property or property-signature
|
|
@@ -9,12 +9,18 @@ import { schemaObjToInstance } from '../schema-obj-to-class';
|
|
|
9
9
|
export class VariableSchema extends SchemaNode {
|
|
10
10
|
@Transform(schemaObjToInstance)
|
|
11
11
|
type: SchemaNode;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(
|
|
13
|
+
readonly location: Location,
|
|
14
|
+
readonly name: string,
|
|
15
|
+
readonly signature: string,
|
|
16
|
+
type: SchemaNode,
|
|
17
|
+
readonly isOptional: boolean
|
|
18
|
+
) {
|
|
13
19
|
super();
|
|
14
20
|
this.type = type;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
toString() {
|
|
18
|
-
return `${chalk.bold(this.name)}: ${this.type.toString()}`;
|
|
24
|
+
return `${chalk.bold(this.name)}${this.isOptional ? '?' : ''}: ${this.type.toString()}`;
|
|
19
25
|
}
|
|
20
26
|
}
|
package/tsconfig.json
CHANGED
package/dist/json-schema.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { JSONSchema7 as JSONSchema, JSONSchema7Object as JSONSchemaObject } from 'json-schema';
|
package/dist/json-schema.js
DELETED
package/dist/json-schema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../json-schema.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-obj-to-class.js","sourceRoot":"","sources":["../schema-obj-to-class.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA0F;AAC1F,mCAAiC;AAEjC,mDAAqC;AAErC,SAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAqD;IAC1G,IAAI,IAAI,KAAK,sCAAkB,CAAC,cAAc,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC,CAAC;AAChE,CAAC;AALD,8DAKC;AAED,SAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,EAA4D;IAC3G,IAAI,IAAI,KAAK,sCAAkB,CAAC,cAAc,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,6BAA6B,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AALD,kDAKC;AAED,SAAS,6BAA6B,CAAC,GAAwB;IAC7D,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;KACtG;IACD,MAAM,WAAW,GAAG,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvD,OAAO,IAAA,mCAAe,EAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAkB;IAC9C,MAAM,cAAc,GAAG,IAAA,gBAAO,EAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAChF,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,0BAA0B,UAAU;EACtD,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAC/C;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/json-schema.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { JSONSchema7 as JSONSchema, JSONSchema7Object as JSONSchemaObject } from 'json-schema';
|
|
Binary file
|