@teambit/semantics.entities.semantic-schema 0.0.12 → 0.0.15

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 CHANGED
@@ -1,11 +1,13 @@
1
1
  import { Transform, plainToInstance } from 'class-transformer';
2
2
  import chalk from 'chalk';
3
+ import { ComponentID } from '@teambit/component-id';
3
4
  import {
4
5
  ClassSchema,
5
6
  EnumSchema,
6
7
  FunctionLikeSchema,
7
8
  InterfaceSchema,
8
9
  Module,
10
+ TypeRefSchema,
9
11
  TypeSchema,
10
12
  VariableSchema,
11
13
  } from './schemas';
@@ -16,9 +18,12 @@ export class APISchema extends SchemaNode {
16
18
  @Transform(schemaObjToInstance)
17
19
  readonly module: Module;
18
20
 
19
- constructor(readonly location: Location, module: Module) {
21
+ readonly componentId: ComponentID;
22
+
23
+ constructor(readonly location: Location, module: Module, componentId: ComponentID) {
20
24
  super();
21
25
  this.module = module;
26
+ this.componentId = componentId;
22
27
  }
23
28
 
24
29
  toString() {
@@ -30,6 +35,7 @@ export class APISchema extends SchemaNode {
30
35
  }
31
36
 
32
37
  toStringPerType() {
38
+ const title = chalk.inverse(`API Schema of ${this.componentId.toString()}\n`);
33
39
  const getSection = (ClassObj, sectionName: string) => {
34
40
  const objects = this.module.exports.filter((exp) => exp instanceof ClassObj);
35
41
  if (!objects.length) {
@@ -40,13 +46,15 @@ export class APISchema extends SchemaNode {
40
46
  };
41
47
 
42
48
  return (
49
+ title +
43
50
  getSection(Module, 'Namespaces') +
44
51
  getSection(ClassSchema, 'Classes') +
45
52
  getSection(InterfaceSchema, 'Interfaces') +
46
53
  getSection(FunctionLikeSchema, 'Functions') +
47
54
  getSection(VariableSchema, 'Variables') +
48
55
  getSection(TypeSchema, 'Types') +
49
- getSection(EnumSchema, 'Enums')
56
+ getSection(EnumSchema, 'Enums') +
57
+ getSection(TypeRefSchema, 'TypeReferences')
50
58
  );
51
59
  }
52
60
 
@@ -54,7 +62,7 @@ export class APISchema extends SchemaNode {
54
62
  return this.module.exports.map((exp) => exp.signature);
55
63
  }
56
64
 
57
- static fromSchema(obj: Record<string, any>): APISchema {
65
+ static fromObject(obj: Record<string, any>): APISchema {
58
66
  return plainToInstance(APISchema, obj);
59
67
  }
60
68
  }
@@ -1,11 +1,13 @@
1
+ import { ComponentID } from '@teambit/component-id';
1
2
  import { Module } from './schemas';
2
3
  import { Location, SchemaNode } from './schema-node';
3
4
  export declare class APISchema extends SchemaNode {
4
5
  readonly location: Location;
5
6
  readonly module: Module;
6
- constructor(location: Location, module: Module);
7
+ readonly componentId: ComponentID;
8
+ constructor(location: Location, module: Module, componentId: ComponentID);
7
9
  toString(): string;
8
10
  toStringPerType(): string;
9
11
  listSignatures(): string[];
10
- static fromSchema(obj: Record<string, any>): APISchema;
12
+ static fromObject(obj: Record<string, any>): APISchema;
11
13
  }
@@ -16,15 +16,17 @@ const schemas_1 = require("./schemas");
16
16
  const schema_node_1 = require("./schema-node");
17
17
  const schema_obj_to_class_1 = require("./schema-obj-to-class");
18
18
  class APISchema extends schema_node_1.SchemaNode {
19
- constructor(location, module) {
19
+ constructor(location, module, componentId) {
20
20
  super();
21
21
  this.location = location;
22
22
  this.module = module;
23
+ this.componentId = componentId;
23
24
  }
24
25
  toString() {
25
26
  return JSON.stringify(this.module.exports.map((exp) => exp.toObject()), undefined, 2);
26
27
  }
27
28
  toStringPerType() {
29
+ const title = chalk_1.default.inverse(`API Schema of ${this.componentId.toString()}\n`);
28
30
  const getSection = (ClassObj, sectionName) => {
29
31
  const objects = this.module.exports.filter((exp) => exp instanceof ClassObj);
30
32
  if (!objects.length) {
@@ -32,18 +34,20 @@ class APISchema extends schema_node_1.SchemaNode {
32
34
  }
33
35
  return `${chalk_1.default.green.bold(sectionName)}\n${objects.map((c) => c.toString()).join('\n')}\n\n`;
34
36
  };
35
- return (getSection(schemas_1.Module, 'Namespaces') +
37
+ return (title +
38
+ getSection(schemas_1.Module, 'Namespaces') +
36
39
  getSection(schemas_1.ClassSchema, 'Classes') +
37
40
  getSection(schemas_1.InterfaceSchema, 'Interfaces') +
38
41
  getSection(schemas_1.FunctionLikeSchema, 'Functions') +
39
42
  getSection(schemas_1.VariableSchema, 'Variables') +
40
43
  getSection(schemas_1.TypeSchema, 'Types') +
41
- getSection(schemas_1.EnumSchema, 'Enums'));
44
+ getSection(schemas_1.EnumSchema, 'Enums') +
45
+ getSection(schemas_1.TypeRefSchema, 'TypeReferences'));
42
46
  }
43
47
  listSignatures() {
44
48
  return this.module.exports.map((exp) => exp.signature);
45
49
  }
46
- static fromSchema(obj) {
50
+ static fromObject(obj) {
47
51
  return (0, class_transformer_1.plainToInstance)(APISchema, obj);
48
52
  }
49
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema.js","sourceRoot":"","sources":["../api-schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA+D;AAC/D,kDAA0B;AAC1B,uCAQmB;AACnB,+CAAqD;AACrD,+DAA4D;AAE5D,MAAa,SAAU,SAAQ,wBAAU;IAIvC,YAAqB,QAAkB,EAAE,MAAc;QACrD,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAU;QAErC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAChD,SAAS,EACT,CAAC,CACF,CAAC;IACJ,CAAC;IAED,eAAe;QACb,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,WAAmB,EAAE,EAAE;YACnD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,YAAY,QAAQ,CAAC,CAAC;YAC7E,IAAI,CAAC,OAAO,CAAC,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U,CAAC,uBAAa,EAAE,gBAAgB,CAAC,CAC5C,CAAC;IACJ,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,GAAwB;QACxC,OAAO,IAAA,mCAAe,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC;CACF;AAjDC;IADC,IAAA,6BAAS,EAAC,yCAAmB,CAAC;yCACP;AAF1B,8BAmDC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { APISchema } from './api-schema';
2
2
  export { Export, StaticProperties } from './export';
3
3
  export type { SchemaNode, Location } from './schema-node';
4
- export { Module, FunctionLikeSchema, Modifier, TypeRefSchema, VariableSchema, ClassSchema, ConstructorSchema, TypeSchema, TypeIntersectionSchema, TypeUnionSchema, TypeLiteralSchema, IndexSignatureSchema, InterfaceSchema, GetAccessorSchema, SetAccessorSchema, TypeQuerySchema, InferenceTypeSchema, LiteralTypeSchema, KeywordTypeSchema, TypeArraySchema, TypeOperatorSchema, TupleTypeSchema, ParameterSchema, EnumSchema, ParenthesizedTypeSchema, TypePredicateSchema, IndexedAccessSchema, } from './schemas';
4
+ export { Module, FunctionLikeSchema, Modifier, TypeRefSchema, VariableSchema, ClassSchema, ConstructorSchema, TypeSchema, TypeIntersectionSchema, TypeUnionSchema, TypeLiteralSchema, IndexSignatureSchema, InterfaceSchema, GetAccessorSchema, SetAccessorSchema, TypeQuerySchema, InferenceTypeSchema, LiteralTypeSchema, KeywordTypeSchema, TypeArraySchema, TypeOperatorSchema, TupleTypeSchema, ParameterSchema, EnumSchema, ParenthesizedTypeSchema, TypePredicateSchema, IndexedAccessSchema, TemplateLiteralTypeSchema, TemplateLiteralTypeSpanSchema, } from './schemas';
5
5
  export type { JSONSchema, JSONSchemaObject } from './json-schema';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IndexedAccessSchema = exports.TypePredicateSchema = exports.ParenthesizedTypeSchema = exports.EnumSchema = exports.ParameterSchema = exports.TupleTypeSchema = exports.TypeOperatorSchema = exports.TypeArraySchema = exports.KeywordTypeSchema = exports.LiteralTypeSchema = exports.InferenceTypeSchema = exports.TypeQuerySchema = exports.SetAccessorSchema = exports.GetAccessorSchema = exports.InterfaceSchema = exports.IndexSignatureSchema = exports.TypeLiteralSchema = exports.TypeUnionSchema = exports.TypeIntersectionSchema = exports.TypeSchema = exports.ConstructorSchema = exports.ClassSchema = exports.VariableSchema = exports.TypeRefSchema = exports.FunctionLikeSchema = exports.Module = exports.Export = exports.APISchema = void 0;
3
+ exports.TemplateLiteralTypeSpanSchema = exports.TemplateLiteralTypeSchema = exports.IndexedAccessSchema = exports.TypePredicateSchema = exports.ParenthesizedTypeSchema = exports.EnumSchema = exports.ParameterSchema = exports.TupleTypeSchema = exports.TypeOperatorSchema = exports.TypeArraySchema = exports.KeywordTypeSchema = exports.LiteralTypeSchema = exports.InferenceTypeSchema = exports.TypeQuerySchema = exports.SetAccessorSchema = exports.GetAccessorSchema = exports.InterfaceSchema = exports.IndexSignatureSchema = exports.TypeLiteralSchema = exports.TypeUnionSchema = exports.TypeIntersectionSchema = exports.TypeSchema = exports.ConstructorSchema = exports.ClassSchema = exports.VariableSchema = exports.TypeRefSchema = exports.FunctionLikeSchema = exports.Module = exports.Export = exports.APISchema = void 0;
4
4
  var api_schema_1 = require("./api-schema");
5
5
  Object.defineProperty(exports, "APISchema", { enumerable: true, get: function () { return api_schema_1.APISchema; } });
6
6
  var export_1 = require("./export");
@@ -32,4 +32,6 @@ Object.defineProperty(exports, "EnumSchema", { enumerable: true, get: function (
32
32
  Object.defineProperty(exports, "ParenthesizedTypeSchema", { enumerable: true, get: function () { return schemas_1.ParenthesizedTypeSchema; } });
33
33
  Object.defineProperty(exports, "TypePredicateSchema", { enumerable: true, get: function () { return schemas_1.TypePredicateSchema; } });
34
34
  Object.defineProperty(exports, "IndexedAccessSchema", { enumerable: true, get: function () { return schemas_1.IndexedAccessSchema; } });
35
+ Object.defineProperty(exports, "TemplateLiteralTypeSchema", { enumerable: true, get: function () { return schemas_1.TemplateLiteralTypeSchema; } });
36
+ Object.defineProperty(exports, "TemplateLiteralTypeSpanSchema", { enumerable: true, get: function () { return schemas_1.TemplateLiteralTypeSpanSchema; } });
35
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,mCAAoD;AAA3C,gGAAA,MAAM,OAAA;AAEf,qCA4BmB;AA3BjB,iGAAA,MAAM,OAAA;AACN,6GAAA,kBAAkB,OAAA;AAElB,wGAAA,aAAa,OAAA;AACb,yGAAA,cAAc,OAAA;AACd,sGAAA,WAAW,OAAA;AACX,4GAAA,iBAAiB,OAAA;AACjB,qGAAA,UAAU,OAAA;AACV,iHAAA,sBAAsB,OAAA;AACtB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA;AACjB,+GAAA,oBAAoB,OAAA;AACpB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,0GAAA,eAAe,OAAA;AACf,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,0GAAA,eAAe,OAAA;AACf,6GAAA,kBAAkB,OAAA;AAClB,0GAAA,eAAe,OAAA;AACf,0GAAA,eAAe,OAAA;AACf,qGAAA,UAAU,OAAA;AACV,kHAAA,uBAAuB,OAAA;AACvB,8GAAA,mBAAmB,OAAA;AACnB,8GAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,mCAAoD;AAA3C,gGAAA,MAAM,OAAA;AAEf,qCA8BmB;AA7BjB,iGAAA,MAAM,OAAA;AACN,6GAAA,kBAAkB,OAAA;AAElB,wGAAA,aAAa,OAAA;AACb,yGAAA,cAAc,OAAA;AACd,sGAAA,WAAW,OAAA;AACX,4GAAA,iBAAiB,OAAA;AACjB,qGAAA,UAAU,OAAA;AACV,iHAAA,sBAAsB,OAAA;AACtB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA;AACjB,+GAAA,oBAAoB,OAAA;AACpB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,0GAAA,eAAe,OAAA;AACf,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,0GAAA,eAAe,OAAA;AACf,6GAAA,kBAAkB,OAAA;AAClB,0GAAA,eAAe,OAAA;AACf,0GAAA,eAAe,OAAA;AACf,qGAAA,UAAU,OAAA;AACV,kHAAA,uBAAuB,OAAA;AACvB,8GAAA,mBAAmB,OAAA;AACnB,8GAAA,mBAAmB,OAAA;AACnB,oHAAA,yBAAyB,OAAA;AACzB,wHAAA,6BAA6B,OAAA"}
@@ -24,3 +24,5 @@ export { EnumSchema } from './enum';
24
24
  export { ParenthesizedTypeSchema } from './parenthesized-type';
25
25
  export { TypePredicateSchema } from './type-predicate';
26
26
  export { IndexedAccessSchema } from './indexed-access-type';
27
+ export { TemplateLiteralTypeSchema } from './template-literal-type';
28
+ export { TemplateLiteralTypeSpanSchema } from './template-literal-type-span';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IndexedAccessSchema = exports.TypePredicateSchema = exports.ParenthesizedTypeSchema = exports.EnumSchema = exports.ParameterSchema = exports.TupleTypeSchema = exports.TypeOperatorSchema = exports.TypeArraySchema = exports.KeywordTypeSchema = exports.LiteralTypeSchema = exports.InferenceTypeSchema = exports.TypeQuerySchema = exports.SetAccessorSchema = exports.GetAccessorSchema = exports.InterfaceSchema = exports.IndexSignatureSchema = exports.TypeLiteralSchema = exports.TypeUnionSchema = exports.TypeIntersectionSchema = exports.TypeSchema = exports.ConstructorSchema = exports.ClassSchema = exports.VariableSchema = exports.TypeRefSchema = exports.FunctionLikeSchema = exports.Module = void 0;
3
+ exports.TemplateLiteralTypeSpanSchema = exports.TemplateLiteralTypeSchema = exports.IndexedAccessSchema = exports.TypePredicateSchema = exports.ParenthesizedTypeSchema = exports.EnumSchema = exports.ParameterSchema = exports.TupleTypeSchema = exports.TypeOperatorSchema = exports.TypeArraySchema = exports.KeywordTypeSchema = exports.LiteralTypeSchema = exports.InferenceTypeSchema = exports.TypeQuerySchema = exports.SetAccessorSchema = exports.GetAccessorSchema = exports.InterfaceSchema = exports.IndexSignatureSchema = exports.TypeLiteralSchema = exports.TypeUnionSchema = exports.TypeIntersectionSchema = exports.TypeSchema = exports.ConstructorSchema = exports.ClassSchema = exports.VariableSchema = exports.TypeRefSchema = exports.FunctionLikeSchema = exports.Module = void 0;
4
4
  var module_1 = require("./module");
5
5
  Object.defineProperty(exports, "Module", { enumerable: true, get: function () { return module_1.Module; } });
6
6
  var function_like_1 = require("./function-like");
@@ -53,4 +53,8 @@ var type_predicate_1 = require("./type-predicate");
53
53
  Object.defineProperty(exports, "TypePredicateSchema", { enumerable: true, get: function () { return type_predicate_1.TypePredicateSchema; } });
54
54
  var indexed_access_type_1 = require("./indexed-access-type");
55
55
  Object.defineProperty(exports, "IndexedAccessSchema", { enumerable: true, get: function () { return indexed_access_type_1.IndexedAccessSchema; } });
56
+ var template_literal_type_1 = require("./template-literal-type");
57
+ Object.defineProperty(exports, "TemplateLiteralTypeSchema", { enumerable: true, get: function () { return template_literal_type_1.TemplateLiteralTypeSchema; } });
58
+ var template_literal_type_span_1 = require("./template-literal-type-span");
59
+ Object.defineProperty(exports, "TemplateLiteralTypeSpanSchema", { enumerable: true, get: function () { return template_literal_type_span_1.TemplateLiteralTypeSpanSchema; } });
56
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../schemas/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,iDAA+D;AAAtD,mHAAA,kBAAkB,OAAA;AAC3B,uCAA2C;AAAlC,yGAAA,aAAa,OAAA;AACtB,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AACvB,iCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,6CAAkD;AAAzC,gHAAA,iBAAiB,OAAA;AAC1B,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,yDAA6D;AAApD,2HAAA,sBAAsB,OAAA;AAC/B,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AACxB,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,qDAAyD;AAAhD,uHAAA,oBAAoB,OAAA;AAC7B,yCAA8C;AAArC,4GAAA,eAAe,OAAA;AACxB,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AACxB,mDAAuD;AAA9C,qHAAA,mBAAmB,OAAA;AAC5B,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AACxB,iDAAqD;AAA5C,mHAAA,kBAAkB,OAAA;AAC3B,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AACxB,yCAA8C;AAArC,4GAAA,eAAe,OAAA;AACxB,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;A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;AAA9C,qHAAA,mBAAmB,OAAA;AAC5B,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,iEAAoE;AAA3D,kIAAA,yBAAyB,OAAA;AAClC,2EAA6E;AAApE,2IAAA,6BAA6B,OAAA"}
@@ -0,0 +1,8 @@
1
+ import { Location, SchemaNode } from '../schema-node';
2
+ export declare class TemplateLiteralTypeSpanSchema extends SchemaNode {
3
+ readonly location: Location;
4
+ readonly literal: string;
5
+ type: SchemaNode;
6
+ constructor(location: Location, literal: string, type: SchemaNode);
7
+ toString(): string;
8
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TemplateLiteralTypeSpanSchema = void 0;
10
+ const class_transformer_1 = require("class-transformer");
11
+ const schema_node_1 = require("../schema-node");
12
+ const schema_obj_to_class_1 = require("../schema-obj-to-class");
13
+ class TemplateLiteralTypeSpanSchema extends schema_node_1.SchemaNode {
14
+ constructor(location, literal, type) {
15
+ super();
16
+ this.location = location;
17
+ this.literal = literal;
18
+ this.type = type;
19
+ }
20
+ toString() {
21
+ return `${this.type.toString()} ${this.literal}`;
22
+ }
23
+ }
24
+ __decorate([
25
+ (0, class_transformer_1.Transform)(schema_obj_to_class_1.schemaObjToInstance)
26
+ ], TemplateLiteralTypeSpanSchema.prototype, "type", void 0);
27
+ exports.TemplateLiteralTypeSpanSchema = TemplateLiteralTypeSpanSchema;
28
+ //# sourceMappingURL=template-literal-type-span.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-literal-type-span.js","sourceRoot":"","sources":["../../schemas/template-literal-type-span.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAA8C;AAC9C,gDAAsD;AACtD,gEAA6D;AAE7D,MAAa,6BAA8B,SAAQ,wBAAU;IAG3D,YAAqB,QAAkB,EAAW,OAAe,EAAE,IAAgB;QACjF,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAU;QAAW,YAAO,GAAP,OAAO,CAAQ;QAE/D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;IACnD,CAAC;CACF;AATC;IADC,IAAA,6BAAS,EAAC,yCAAmB,CAAC;2DACd;AAFnB,sEAWC"}
@@ -0,0 +1,9 @@
1
+ import { Location, SchemaNode } from '../schema-node';
2
+ import { TemplateLiteralTypeSpanSchema } from './template-literal-type-span';
3
+ export declare class TemplateLiteralTypeSchema extends SchemaNode {
4
+ readonly location: Location;
5
+ readonly head: string;
6
+ readonly templateSpans: TemplateLiteralTypeSpanSchema[];
7
+ constructor(location: Location, head: string, templateSpans: TemplateLiteralTypeSpanSchema[]);
8
+ toString(): string;
9
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TemplateLiteralTypeSchema = void 0;
10
+ const class_transformer_1 = require("class-transformer");
11
+ const schema_node_1 = require("../schema-node");
12
+ const schema_obj_to_class_1 = require("../schema-obj-to-class");
13
+ class TemplateLiteralTypeSchema extends schema_node_1.SchemaNode {
14
+ constructor(location, head, templateSpans) {
15
+ super();
16
+ this.location = location;
17
+ this.head = head;
18
+ this.templateSpans = templateSpans;
19
+ }
20
+ toString() {
21
+ const spans = this.templateSpans.map((span) => span.toString()).join('');
22
+ return `${this.head}${spans}`;
23
+ }
24
+ }
25
+ __decorate([
26
+ (0, class_transformer_1.Transform)(schema_obj_to_class_1.schemaObjArrayToInstances)
27
+ ], TemplateLiteralTypeSchema.prototype, "templateSpans", void 0);
28
+ exports.TemplateLiteralTypeSchema = TemplateLiteralTypeSchema;
29
+ //# sourceMappingURL=template-literal-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-literal-type.js","sourceRoot":"","sources":["../../schemas/template-literal-type.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAA8C;AAC9C,gDAAsD;AACtD,gEAAmE;AAGnE,MAAa,yBAA0B,SAAQ,wBAAU;IAGvD,YAAqB,QAAkB,EAAW,IAAY,EAAE,aAA8C;QAC5G,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAU;QAAW,SAAI,GAAJ,IAAI,CAAQ;QAE5D,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;IAChC,CAAC;CACF;AAVC;IADC,IAAA,6BAAS,EAAC,+CAAyB,CAAC;gEACmB;AAF1D,8DAYC"}
@@ -1,6 +1,6 @@
1
1
  import { Location, SchemaNode } from '../schema-node';
2
2
  /**
3
- * can be also a property.
3
+ * can be also a property or property-signature
4
4
  */
5
5
  export declare class VariableSchema extends SchemaNode {
6
6
  readonly location: Location;
@@ -15,7 +15,7 @@ const chalk_1 = __importDefault(require("chalk"));
15
15
  const schema_node_1 = require("../schema-node");
16
16
  const schema_obj_to_class_1 = require("../schema-obj-to-class");
17
17
  /**
18
- * can be also a property.
18
+ * can be also a property or property-signature
19
19
  */
20
20
  class VariableSchema extends schema_node_1.SchemaNode {
21
21
  constructor(location, name, signature, type) {
package/index.ts CHANGED
@@ -29,5 +29,7 @@ export {
29
29
  ParenthesizedTypeSchema,
30
30
  TypePredicateSchema,
31
31
  IndexedAccessSchema,
32
+ TemplateLiteralTypeSchema,
33
+ TemplateLiteralTypeSpanSchema,
32
34
  } from './schemas';
33
35
  export type { JSONSchema, JSONSchemaObject } from './json-schema';
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@teambit/semantics.entities.semantic-schema",
3
- "version": "0.0.12",
3
+ "version": "0.0.15",
4
4
  "homepage": "https://bit.dev/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.12"
9
+ "version": "0.0.15"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
13
13
  "class-transformer": "0.5.1",
14
14
  "json-schema": "0.4.0",
15
- "lodash": "4.17.21"
15
+ "lodash": "4.17.21",
16
+ "@teambit/component-id": "0.0.402"
16
17
  },
17
18
  "devDependencies": {
18
19
  "@types/json-schema": "7.0.9",
@@ -1 +1 @@
1
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_entities_semantic-schema@0.0.12/dist/semantic-schema.docs.md')]
1
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_entities_semantic-schema@0.0.15/dist/semantic-schema.docs.md')]
package/schemas/index.ts CHANGED
@@ -24,3 +24,5 @@ export { EnumSchema } from './enum';
24
24
  export { ParenthesizedTypeSchema } from './parenthesized-type';
25
25
  export { TypePredicateSchema } from './type-predicate';
26
26
  export { IndexedAccessSchema } from './indexed-access-type';
27
+ export { TemplateLiteralTypeSchema } from './template-literal-type';
28
+ export { TemplateLiteralTypeSpanSchema } from './template-literal-type-span';
@@ -0,0 +1,16 @@
1
+ import { Transform } from 'class-transformer';
2
+ import { Location, SchemaNode } from '../schema-node';
3
+ import { schemaObjToInstance } from '../schema-obj-to-class';
4
+
5
+ export class TemplateLiteralTypeSpanSchema extends SchemaNode {
6
+ @Transform(schemaObjToInstance)
7
+ type: SchemaNode;
8
+ constructor(readonly location: Location, readonly literal: string, type: SchemaNode) {
9
+ super();
10
+ this.type = type;
11
+ }
12
+
13
+ toString() {
14
+ return `${this.type.toString()} ${this.literal}`;
15
+ }
16
+ }
@@ -0,0 +1,18 @@
1
+ import { Transform } from 'class-transformer';
2
+ import { Location, SchemaNode } from '../schema-node';
3
+ import { schemaObjArrayToInstances } from '../schema-obj-to-class';
4
+ import { TemplateLiteralTypeSpanSchema } from './template-literal-type-span';
5
+
6
+ export class TemplateLiteralTypeSchema extends SchemaNode {
7
+ @Transform(schemaObjArrayToInstances)
8
+ readonly templateSpans: TemplateLiteralTypeSpanSchema[];
9
+ constructor(readonly location: Location, readonly head: string, templateSpans: TemplateLiteralTypeSpanSchema[]) {
10
+ super();
11
+ this.templateSpans = templateSpans;
12
+ }
13
+
14
+ toString() {
15
+ const spans = this.templateSpans.map((span) => span.toString()).join('');
16
+ return `${this.head}${spans}`;
17
+ }
18
+ }
@@ -4,7 +4,7 @@ import { Location, SchemaNode } from '../schema-node';
4
4
  import { schemaObjToInstance } from '../schema-obj-to-class';
5
5
 
6
6
  /**
7
- * can be also a property.
7
+ * can be also a property or property-signature
8
8
  */
9
9
  export class VariableSchema extends SchemaNode {
10
10
  @Transform(schemaObjToInstance)