@teambit/semantics.entities.semantic-schema
Advanced tools
Comparing version 0.0.46 to 0.0.47
@@ -9,3 +9,3 @@ import { Transform, plainToInstance } from 'class-transformer'; | ||
InterfaceSchema, | ||
Module, | ||
ModuleSchema, | ||
TypeRefSchema, | ||
@@ -22,3 +22,3 @@ TypeSchema, | ||
@Transform(schemaObjToInstance) | ||
readonly module: Module; | ||
readonly module: ModuleSchema; | ||
@@ -28,3 +28,3 @@ @Transform(componentIdTransformer) | ||
constructor(readonly location: Location, module: Module, componentId: ComponentID) { | ||
constructor(readonly location: Location, module: ModuleSchema, componentId: ComponentID) { | ||
super(); | ||
@@ -56,3 +56,3 @@ this.module = module; | ||
title + | ||
getSection(Module, 'Namespaces') + | ||
getSection(ModuleSchema, 'Namespaces') + | ||
getSection(ClassSchema, 'Classes') + | ||
@@ -80,3 +80,3 @@ getSection(InterfaceSchema, 'Interfaces') + | ||
{ filePath: '', line: 0, character: 0 }, | ||
new Module({ filePath: '', line: 0, character: 0 }, []), | ||
new ModuleSchema({ filePath: '', line: 0, character: 0 }, []), | ||
componentId | ||
@@ -83,0 +83,0 @@ ); |
@@ -39,2 +39,3 @@ import { plainToInstance, TransformationType, ClassConstructor } from 'class-transformer'; | ||
} | ||
return plainToInstance(SchemaClass, obj); | ||
@@ -41,0 +42,0 @@ } |
import { ComponentID } from '@teambit/component-id'; | ||
import { Module } from './schemas'; | ||
import { ModuleSchema } from './schemas'; | ||
import { Location, SchemaNode } from './schema-node'; | ||
export declare class APISchema extends SchemaNode { | ||
readonly location: Location; | ||
readonly module: Module; | ||
readonly module: ModuleSchema; | ||
readonly componentId: ComponentID; | ||
constructor(location: Location, module: Module, componentId: ComponentID); | ||
constructor(location: Location, module: ModuleSchema, componentId: ComponentID); | ||
toString(): string; | ||
@@ -10,0 +10,0 @@ toStringPerType(): string; |
@@ -39,3 +39,3 @@ "use strict"; | ||
return (title + | ||
getSection(schemas_1.Module, 'Namespaces') + | ||
getSection(schemas_1.ModuleSchema, 'Namespaces') + | ||
getSection(schemas_1.ClassSchema, 'Classes') + | ||
@@ -57,3 +57,3 @@ getSection(schemas_1.InterfaceSchema, 'Interfaces') + | ||
static empty(componentId) { | ||
return new APISchema({ filePath: '', line: 0, character: 0 }, new schemas_1.Module({ filePath: '', line: 0, character: 0 }, []), componentId); | ||
return new APISchema({ filePath: '', line: 0, character: 0 }, new schemas_1.ModuleSchema({ filePath: '', line: 0, character: 0 }, []), componentId); | ||
} | ||
@@ -60,0 +60,0 @@ } |
@@ -12,2 +12,3 @@ import { DocSchema } from './schemas'; | ||
readonly signature?: string; | ||
readonly name?: string; | ||
abstract toString(): string; | ||
@@ -14,0 +15,0 @@ toObject(): Record<string, any>; |
import { Location, SchemaNode } from '../schema-node'; | ||
import { DocSchema } from './docs'; | ||
import { ExpressionWithTypeArgumentsSchema } from './expression-with-arguments'; | ||
export declare class ClassSchema extends SchemaNode { | ||
readonly className: string; | ||
readonly name: string; | ||
readonly location: Location; | ||
readonly signature: string; | ||
readonly typeParams?: string[]; | ||
readonly extendsNodes?: ExpressionWithTypeArgumentsSchema[]; | ||
readonly implementNodes?: ExpressionWithTypeArgumentsSchema[]; | ||
readonly members: SchemaNode[]; | ||
readonly doc?: DocSchema; | ||
constructor(className: string, members: SchemaNode[], location: Location, doc?: DocSchema); | ||
constructor(name: string, members: SchemaNode[], location: Location, signature: string, doc?: DocSchema, typeParams?: string[], extendsNodes?: ExpressionWithTypeArgumentsSchema[], implementNodes?: ExpressionWithTypeArgumentsSchema[]); | ||
toString(): string; | ||
} |
@@ -18,6 +18,10 @@ "use strict"; | ||
class ClassSchema extends schema_node_1.SchemaNode { | ||
constructor(className, members, location, doc) { | ||
constructor(name, members, location, signature, doc, typeParams, extendsNodes, implementNodes) { | ||
super(); | ||
this.className = className; | ||
this.name = name; | ||
this.location = location; | ||
this.signature = signature; | ||
this.typeParams = typeParams; | ||
this.extendsNodes = extendsNodes; | ||
this.implementNodes = implementNodes; | ||
this.members = members; | ||
@@ -28,3 +32,3 @@ this.doc = doc; | ||
const membersStr = this.members.map((m) => `* ${m.toString()}`).join('\n'); | ||
return `${chalk_1.default.bold.underline(this.className)}\n${membersStr}`; | ||
return `${chalk_1.default.bold.underline(this.name)}\n${membersStr}`; | ||
} | ||
@@ -31,0 +35,0 @@ } |
@@ -5,5 +5,6 @@ import { Location, SchemaNode } from '../schema-node'; | ||
readonly location: Location; | ||
readonly signature?: string; | ||
readonly params: ParameterSchema[]; | ||
constructor(location: Location, params: ParameterSchema[]); | ||
constructor(location: Location, params: ParameterSchema[], signature?: string); | ||
toString(): string; | ||
} |
@@ -18,5 +18,6 @@ "use strict"; | ||
class ConstructorSchema extends schema_node_1.SchemaNode { | ||
constructor(location, params) { | ||
constructor(location, params, signature) { | ||
super(); | ||
this.location = location; | ||
this.signature = signature; | ||
this.params = params; | ||
@@ -23,0 +24,0 @@ } |
@@ -8,7 +8,7 @@ import { Location, SchemaNode } from '../../schema-node'; | ||
readonly location: Location; | ||
readonly paramName: string; | ||
readonly name: string; | ||
readonly comment?: string; | ||
readonly type?: SchemaNode; | ||
constructor(location: Location, paramName: string, comment?: string, type?: SchemaNode); | ||
constructor(location: Location, name: string, comment?: string, type?: SchemaNode); | ||
toString(): string; | ||
} |
@@ -17,6 +17,6 @@ "use strict"; | ||
class PropertyLikeTagSchema extends tag_1.TagSchema { | ||
constructor(location, paramName, comment, type) { | ||
constructor(location, name, comment, type) { | ||
super(location, tag_1.TagName.parameter, comment); | ||
this.location = location; | ||
this.paramName = paramName; | ||
this.name = name; | ||
this.comment = comment; | ||
@@ -28,3 +28,3 @@ this.type = type; | ||
const type = this.type ? ` {${this.type.toString()}} ` : ''; | ||
return `@${this.tagName} ${this.paramName}${type} ${comment}`; | ||
return `@${this.tagName} ${this.name}${type} ${comment}`; | ||
} | ||
@@ -31,0 +31,0 @@ } |
@@ -6,6 +6,7 @@ import { Location, SchemaNode } from '../schema-node'; | ||
readonly name: string; | ||
readonly members: string[]; | ||
readonly signature: string; | ||
readonly doc?: DocSchema; | ||
constructor(location: Location, name: string, members: string[], doc?: DocSchema); | ||
readonly members: SchemaNode[]; | ||
constructor(location: Location, name: string, members: SchemaNode[], signature: string, doc?: DocSchema); | ||
toString(): string; | ||
} |
@@ -18,8 +18,9 @@ "use strict"; | ||
class EnumSchema extends schema_node_1.SchemaNode { | ||
constructor(location, name, members, doc) { | ||
constructor(location, name, members, signature, doc) { | ||
super(); | ||
this.location = location; | ||
this.name = name; | ||
this.signature = signature; | ||
this.doc = doc; | ||
this.members = members; | ||
this.doc = doc; | ||
} | ||
@@ -34,3 +35,6 @@ toString() { | ||
], EnumSchema.prototype, "doc", void 0); | ||
__decorate([ | ||
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances) | ||
], EnumSchema.prototype, "members", void 0); | ||
exports.EnumSchema = EnumSchema; | ||
//# sourceMappingURL=enum.js.map |
@@ -1,2 +0,7 @@ | ||
export { Module } from './module'; | ||
/** | ||
* Ensure that any new Schema class ends with the word 'Schema' | ||
* This will make sure that the Class Name is not minimized during prod bundling process | ||
* and the schemaObjToClass can match and instantiate the Schema Class correctly | ||
*/ | ||
export { ModuleSchema } from './module'; | ||
export { FunctionLikeSchema, Modifier } from './function-like'; | ||
@@ -24,2 +29,3 @@ export { TypeRefSchema } from './type-ref'; | ||
export { EnumSchema } from './enum'; | ||
export { EnumMemberSchema } from './enum-member'; | ||
export { ParenthesizedTypeSchema } from './parenthesized-type'; | ||
@@ -34,3 +40,5 @@ export { TypePredicateSchema } from './type-predicate'; | ||
export { ConditionalTypeSchema } from './conditional-type'; | ||
export { ExpressionWithTypeArgumentsSchema } from './expression-with-arguments'; | ||
export { NamedTupleSchema } from './named-tuple'; | ||
export { UnImplementedSchema } from './unimplemented-schema'; | ||
export * from './docs'; |
@@ -17,5 +17,10 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UnImplementedSchema = exports.ConditionalTypeSchema = exports.UnresolvedSchema = exports.UnknownSchema = exports.ThisTypeSchema = 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.VariableLikeSchema = exports.TypeRefSchema = exports.FunctionLikeSchema = exports.Module = void 0; | ||
exports.UnImplementedSchema = exports.NamedTupleSchema = exports.ExpressionWithTypeArgumentsSchema = exports.ConditionalTypeSchema = exports.UnresolvedSchema = exports.UnknownSchema = exports.ThisTypeSchema = exports.TemplateLiteralTypeSpanSchema = exports.TemplateLiteralTypeSchema = exports.IndexedAccessSchema = exports.TypePredicateSchema = exports.ParenthesizedTypeSchema = exports.EnumMemberSchema = 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.VariableLikeSchema = exports.TypeRefSchema = exports.FunctionLikeSchema = exports.ModuleSchema = void 0; | ||
/** | ||
* Ensure that any new Schema class ends with the word 'Schema' | ||
* This will make sure that the Class Name is not minimized during prod bundling process | ||
* and the schemaObjToClass can match and instantiate the Schema Class correctly | ||
*/ | ||
var module_1 = require("./module"); | ||
Object.defineProperty(exports, "Module", { enumerable: true, get: function () { return module_1.Module; } }); | ||
Object.defineProperty(exports, "ModuleSchema", { enumerable: true, get: function () { return module_1.ModuleSchema; } }); | ||
var function_like_1 = require("./function-like"); | ||
@@ -65,2 +70,4 @@ Object.defineProperty(exports, "FunctionLikeSchema", { enumerable: true, get: function () { return function_like_1.FunctionLikeSchema; } }); | ||
Object.defineProperty(exports, "EnumSchema", { enumerable: true, get: function () { return enum_1.EnumSchema; } }); | ||
var enum_member_1 = require("./enum-member"); | ||
Object.defineProperty(exports, "EnumMemberSchema", { enumerable: true, get: function () { return enum_member_1.EnumMemberSchema; } }); | ||
var parenthesized_type_1 = require("./parenthesized-type"); | ||
@@ -84,2 +91,6 @@ Object.defineProperty(exports, "ParenthesizedTypeSchema", { enumerable: true, get: function () { return parenthesized_type_1.ParenthesizedTypeSchema; } }); | ||
Object.defineProperty(exports, "ConditionalTypeSchema", { enumerable: true, get: function () { return conditional_type_1.ConditionalTypeSchema; } }); | ||
var expression_with_arguments_1 = require("./expression-with-arguments"); | ||
Object.defineProperty(exports, "ExpressionWithTypeArgumentsSchema", { enumerable: true, get: function () { return expression_with_arguments_1.ExpressionWithTypeArgumentsSchema; } }); | ||
var named_tuple_1 = require("./named-tuple"); | ||
Object.defineProperty(exports, "NamedTupleSchema", { enumerable: true, get: function () { return named_tuple_1.NamedTupleSchema; } }); | ||
var unimplemented_schema_1 = require("./unimplemented-schema"); | ||
@@ -86,0 +97,0 @@ Object.defineProperty(exports, "UnImplementedSchema", { enumerable: true, get: function () { return unimplemented_schema_1.UnImplementedSchema; } }); |
@@ -16,3 +16,3 @@ "use strict"; | ||
toString() { | ||
if (this.name) { | ||
if (this.name && this.name !== this.type) { | ||
return `${this.name}: ${this.type}`; | ||
@@ -19,0 +19,0 @@ } |
import { Location, SchemaNode } from '../schema-node'; | ||
import { DocSchema } from './docs'; | ||
import { ExpressionWithTypeArgumentsSchema } from './expression-with-arguments'; | ||
export declare class InterfaceSchema extends SchemaNode { | ||
readonly location: Location; | ||
readonly name: string; | ||
readonly signature: string; | ||
readonly extendsNodes: ExpressionWithTypeArgumentsSchema[]; | ||
readonly typeParams?: string[]; | ||
readonly members: SchemaNode[]; | ||
readonly doc?: DocSchema; | ||
constructor(location: Location, name: string, members: SchemaNode[], doc?: DocSchema); | ||
constructor(location: Location, name: string, signature: string, extendsNodes: ExpressionWithTypeArgumentsSchema[], members: SchemaNode[], doc?: DocSchema, typeParams?: string[]); | ||
toString(): string; | ||
} |
@@ -18,6 +18,9 @@ "use strict"; | ||
class InterfaceSchema extends schema_node_1.SchemaNode { | ||
constructor(location, name, members, doc) { | ||
constructor(location, name, signature, extendsNodes, members, doc, typeParams) { | ||
super(); | ||
this.location = location; | ||
this.name = name; | ||
this.signature = signature; | ||
this.extendsNodes = extendsNodes; | ||
this.typeParams = typeParams; | ||
this.members = members; | ||
@@ -24,0 +27,0 @@ this.doc = doc; |
import { Location, SchemaNode } from '../schema-node'; | ||
export declare class Module extends SchemaNode { | ||
export declare class ModuleSchema extends SchemaNode { | ||
readonly location: Location; | ||
@@ -4,0 +4,0 @@ exports: SchemaNode[]; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Module = void 0; | ||
exports.ModuleSchema = void 0; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
@@ -18,3 +18,3 @@ const class_transformer_1 = require("class-transformer"); | ||
const class_transformers_1 = require("../class-transformers"); | ||
class Module extends schema_node_1.SchemaNode { | ||
class ModuleSchema extends schema_node_1.SchemaNode { | ||
constructor(location, exports) { | ||
@@ -34,3 +34,3 @@ super(); | ||
this.exports = this.exports.reduce((acc, exp) => { | ||
if (exp instanceof Module) { | ||
if (exp instanceof ModuleSchema) { | ||
exp.flatExportsRecursively(); | ||
@@ -53,4 +53,4 @@ if (exp.namespace) | ||
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances) | ||
], Module.prototype, "exports", void 0); | ||
exports.Module = Module; | ||
], ModuleSchema.prototype, "exports", void 0); | ||
exports.ModuleSchema = ModuleSchema; | ||
//# sourceMappingURL=module.js.map |
import { Location, SchemaNode } from '../schema-node'; | ||
export declare class TypeOperatorSchema extends SchemaNode { | ||
readonly location: Location; | ||
readonly operatorName: string; | ||
readonly name: string; | ||
type: SchemaNode; | ||
constructor(location: Location, operatorName: string, type: SchemaNode); | ||
constructor(location: Location, name: string, type: SchemaNode); | ||
toString(): string; | ||
} |
@@ -14,10 +14,10 @@ "use strict"; | ||
class TypeOperatorSchema extends schema_node_1.SchemaNode { | ||
constructor(location, operatorName, type) { | ||
constructor(location, name, type) { | ||
super(); | ||
this.location = location; | ||
this.operatorName = operatorName; | ||
this.name = name; | ||
this.type = type; | ||
} | ||
toString() { | ||
return `${this.operatorName} ${this.type.toString()}`; | ||
return `${this.name} ${this.type.toString()}`; | ||
} | ||
@@ -24,0 +24,0 @@ } |
@@ -17,7 +17,7 @@ import { Location, SchemaNode } from '../schema-node'; | ||
readonly location: Location; | ||
readonly parameterName: string; | ||
readonly name: string; | ||
readonly hasAssertsModifier: boolean; | ||
readonly type?: SchemaNode; | ||
constructor(location: Location, parameterName: string, type?: SchemaNode, hasAssertsModifier?: boolean); | ||
constructor(location: Location, name: string, type?: SchemaNode, hasAssertsModifier?: boolean); | ||
toString(): string; | ||
} |
@@ -27,6 +27,6 @@ "use strict"; | ||
class TypePredicateSchema extends schema_node_1.SchemaNode { | ||
constructor(location, parameterName, type, hasAssertsModifier = false) { | ||
constructor(location, name, type, hasAssertsModifier = false) { | ||
super(); | ||
this.location = location; | ||
this.parameterName = parameterName; | ||
this.name = name; | ||
this.hasAssertsModifier = hasAssertsModifier; | ||
@@ -38,3 +38,3 @@ this.type = type; | ||
const typeStr = this.type ? ` is ${this.type.toString()}` : ''; | ||
return assertsKeyword + this.parameterName + typeStr; | ||
return assertsKeyword + this.name + typeStr; | ||
} | ||
@@ -41,0 +41,0 @@ } |
@@ -9,6 +9,6 @@ import { Location, SchemaNode } from '../schema-node'; | ||
readonly location: Location; | ||
readonly schemaName: string; | ||
readonly name: string; | ||
readonly schemaObj: Record<string, any>; | ||
constructor(location: Location, schemaName: string, schemaObj: Record<string, any>); | ||
constructor(location: Location, name: string, schemaObj: Record<string, any>); | ||
toString(): string; | ||
} |
@@ -11,10 +11,10 @@ "use strict"; | ||
class UnknownSchema extends schema_node_1.SchemaNode { | ||
constructor(location, schemaName, schemaObj) { | ||
constructor(location, name, schemaObj) { | ||
super(); | ||
this.location = location; | ||
this.schemaName = schemaName; | ||
this.name = name; | ||
this.schemaObj = schemaObj; | ||
} | ||
toString() { | ||
return `<<unknown schema ${this.schemaName}>>`; | ||
return `<<unknown schema ${this.name}>>`; | ||
} | ||
@@ -21,0 +21,0 @@ } |
{ | ||
"name": "@teambit/semantics.entities.semantic-schema", | ||
"version": "0.0.46", | ||
"version": "0.0.47", | ||
"homepage": "https://bit.dev/teambit/semantics/entities/semantic-schema", | ||
@@ -9,3 +9,3 @@ "main": "dist/index.js", | ||
"name": "entities/semantic-schema", | ||
"version": "0.0.46" | ||
"version": "0.0.47" | ||
}, | ||
@@ -12,0 +12,0 @@ "dependencies": { |
@@ -14,2 +14,3 @@ import { instanceToPlain } from 'class-transformer'; | ||
readonly signature?: string; | ||
readonly name?: string; | ||
@@ -16,0 +17,0 @@ abstract toString(): string; |
@@ -6,2 +6,3 @@ import { Transform } from 'class-transformer'; | ||
import { DocSchema } from './docs'; | ||
import { ExpressionWithTypeArgumentsSchema } from './expression-with-arguments'; | ||
@@ -15,3 +16,12 @@ export class ClassSchema extends SchemaNode { | ||
constructor(readonly className: string, members: SchemaNode[], readonly location: Location, doc?: DocSchema) { | ||
constructor( | ||
readonly name: string, | ||
members: SchemaNode[], | ||
readonly location: Location, | ||
readonly signature: string, | ||
doc?: DocSchema, | ||
readonly typeParams?: string[], | ||
readonly extendsNodes?: ExpressionWithTypeArgumentsSchema[], | ||
readonly implementNodes?: ExpressionWithTypeArgumentsSchema[] | ||
) { | ||
super(); | ||
@@ -24,4 +34,4 @@ this.members = members; | ||
const membersStr = this.members.map((m) => `* ${m.toString()}`).join('\n'); | ||
return `${chalk.bold.underline(this.className)}\n${membersStr}`; | ||
return `${chalk.bold.underline(this.name)}\n${membersStr}`; | ||
} | ||
} |
@@ -10,3 +10,3 @@ import { Transform } from 'class-transformer'; | ||
readonly params: ParameterSchema[]; | ||
constructor(readonly location: Location, params: ParameterSchema[]) { | ||
constructor(readonly location: Location, params: ParameterSchema[], readonly signature?: string) { | ||
super(); | ||
@@ -13,0 +13,0 @@ this.params = params; |
@@ -12,3 +12,3 @@ import { Transform } from 'class-transformer'; | ||
readonly type?: SchemaNode; | ||
constructor(readonly location: Location, readonly paramName: string, readonly comment?: string, type?: SchemaNode) { | ||
constructor(readonly location: Location, readonly name: string, readonly comment?: string, type?: SchemaNode) { | ||
super(location, TagName.parameter, comment); | ||
@@ -21,4 +21,4 @@ this.type = type; | ||
const type = this.type ? ` {${this.type.toString()}} ` : ''; | ||
return `@${this.tagName} ${this.paramName}${type} ${comment}`; | ||
return `@${this.tagName} ${this.name}${type} ${comment}`; | ||
} | ||
} |
import { Transform } from 'class-transformer'; | ||
import chalk from 'chalk'; | ||
import { schemaObjToInstance } from '../class-transformers'; | ||
import { schemaObjArrayToInstances, schemaObjToInstance } from '../class-transformers'; | ||
import { Location, SchemaNode } from '../schema-node'; | ||
@@ -10,6 +10,15 @@ import { DocSchema } from './docs'; | ||
readonly doc?: DocSchema; | ||
@Transform(schemaObjArrayToInstances) | ||
readonly members: SchemaNode[]; | ||
constructor(readonly location: Location, readonly name: string, readonly members: string[], doc?: DocSchema) { | ||
constructor( | ||
readonly location: Location, | ||
readonly name: string, | ||
members: SchemaNode[], | ||
readonly signature: string, | ||
doc?: DocSchema | ||
) { | ||
super(); | ||
this.doc = doc; | ||
this.members = members; | ||
} | ||
@@ -16,0 +25,0 @@ |
@@ -1,2 +0,7 @@ | ||
export { Module } from './module'; | ||
/** | ||
* Ensure that any new Schema class ends with the word 'Schema' | ||
* This will make sure that the Class Name is not minimized during prod bundling process | ||
* and the schemaObjToClass can match and instantiate the Schema Class correctly | ||
*/ | ||
export { ModuleSchema } from './module'; | ||
export { FunctionLikeSchema, Modifier } from './function-like'; | ||
@@ -24,2 +29,3 @@ export { TypeRefSchema } from './type-ref'; | ||
export { EnumSchema } from './enum'; | ||
export { EnumMemberSchema } from './enum-member'; | ||
export { ParenthesizedTypeSchema } from './parenthesized-type'; | ||
@@ -34,3 +40,5 @@ export { TypePredicateSchema } from './type-predicate'; | ||
export { ConditionalTypeSchema } from './conditional-type'; | ||
export { ExpressionWithTypeArgumentsSchema } from './expression-with-arguments'; | ||
export { NamedTupleSchema } from './named-tuple'; | ||
export { UnImplementedSchema } from './unimplemented-schema'; | ||
export * from './docs'; |
@@ -12,3 +12,3 @@ import { Location, SchemaNode } from '../schema-node'; | ||
toString() { | ||
if (this.name) { | ||
if (this.name && this.name !== this.type) { | ||
return `${this.name}: ${this.type}`; | ||
@@ -15,0 +15,0 @@ } |
@@ -6,2 +6,3 @@ import { Transform } from 'class-transformer'; | ||
import { DocSchema } from './docs'; | ||
import { ExpressionWithTypeArgumentsSchema } from './expression-with-arguments'; | ||
@@ -15,3 +16,11 @@ export class InterfaceSchema extends SchemaNode { | ||
constructor(readonly location: Location, readonly name: string, members: SchemaNode[], doc?: DocSchema) { | ||
constructor( | ||
readonly location: Location, | ||
readonly name: string, | ||
readonly signature: string, | ||
readonly extendsNodes: ExpressionWithTypeArgumentsSchema[], | ||
members: SchemaNode[], | ||
doc?: DocSchema, | ||
readonly typeParams?: string[] | ||
) { | ||
super(); | ||
@@ -18,0 +27,0 @@ this.members = members; |
@@ -6,3 +6,3 @@ import chalk from 'chalk'; | ||
export class Module extends SchemaNode { | ||
export class ModuleSchema extends SchemaNode { | ||
@Transform(schemaObjArrayToInstances) | ||
@@ -26,3 +26,3 @@ exports: SchemaNode[]; | ||
this.exports = this.exports.reduce((acc, exp) => { | ||
if (exp instanceof Module) { | ||
if (exp instanceof ModuleSchema) { | ||
exp.flatExportsRecursively(); | ||
@@ -29,0 +29,0 @@ if (exp.namespace) return [...acc, exp]; |
@@ -8,3 +8,3 @@ import { Transform } from 'class-transformer'; | ||
type: SchemaNode; | ||
constructor(readonly location: Location, readonly operatorName: string, type: SchemaNode) { | ||
constructor(readonly location: Location, readonly name: string, type: SchemaNode) { | ||
super(); | ||
@@ -15,4 +15,4 @@ this.type = type; | ||
toString() { | ||
return `${this.operatorName} ${this.type.toString()}`; | ||
return `${this.name} ${this.type.toString()}`; | ||
} | ||
} |
@@ -23,3 +23,3 @@ import { Transform } from 'class-transformer'; | ||
readonly location: Location, | ||
readonly parameterName: string, | ||
readonly name: string, | ||
type?: SchemaNode, | ||
@@ -35,4 +35,4 @@ readonly hasAssertsModifier = false | ||
const typeStr = this.type ? ` is ${this.type.toString()}` : ''; | ||
return assertsKeyword + this.parameterName + typeStr; | ||
return assertsKeyword + this.name + typeStr; | ||
} | ||
} |
@@ -9,3 +9,3 @@ import { Location, SchemaNode } from '../schema-node'; | ||
export class UnknownSchema extends SchemaNode { | ||
constructor(readonly location: Location, readonly schemaName: string, readonly schemaObj: Record<string, any>) { | ||
constructor(readonly location: Location, readonly name: string, readonly schemaObj: Record<string, any>) { | ||
super(); | ||
@@ -15,4 +15,4 @@ } | ||
toString() { | ||
return `<<unknown schema ${this.schemaName}>>`; | ||
return `<<unknown schema ${this.name}>>`; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
211333
209
3551