New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@teambit/semantics.entities.semantic-schema

Package Overview
Dependencies
Maintainers
17
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teambit/semantics.entities.semantic-schema - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

dist/schemas/inference-type.d.ts

2

dist/index.d.ts
export { APISchema } from './api-schema';
export type { SchemaNode } from './schema-node';
export { Export, Module, StaticProperties, FunctionSchema, Parameter, TypeRefSchema, VariableSchema, ClassSchema, ConstructorSchema, TypeSchema, TypeIntersectionSchema, TypeUnionSchema, TypeLiteralSchema, IndexSignatureSchema, InterfaceSchema, GetAccessorSchema, SetAccessorSchema, } from './schemas';
export { Export, Module, StaticProperties, FunctionSchema, Modifier, TypeRefSchema, VariableSchema, ClassSchema, ConstructorSchema, TypeSchema, TypeIntersectionSchema, TypeUnionSchema, TypeLiteralSchema, IndexSignatureSchema, InterfaceSchema, GetAccessorSchema, SetAccessorSchema, TypeQuerySchema, InferenceTypeSchema, LiteralTypeSchema, KeywordTypeSchema, TypeArraySchema, TypeOperatorSchema, TupleTypeSchema, ParameterSchema, } from './schemas';
export type { JSONSchema, JSONSchemaObject } from './json-schema';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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.FunctionSchema = exports.Module = exports.Export = exports.APISchema = void 0;
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.FunctionSchema = exports.Module = exports.Export = exports.APISchema = void 0;
var api_schema_1 = require("./api-schema");

@@ -22,2 +22,10 @@ Object.defineProperty(exports, "APISchema", { enumerable: true, get: function () { return api_schema_1.APISchema; } });

Object.defineProperty(exports, "SetAccessorSchema", { enumerable: true, get: function () { return schemas_1.SetAccessorSchema; } });
Object.defineProperty(exports, "TypeQuerySchema", { enumerable: true, get: function () { return schemas_1.TypeQuerySchema; } });
Object.defineProperty(exports, "InferenceTypeSchema", { enumerable: true, get: function () { return schemas_1.InferenceTypeSchema; } });
Object.defineProperty(exports, "LiteralTypeSchema", { enumerable: true, get: function () { return schemas_1.LiteralTypeSchema; } });
Object.defineProperty(exports, "KeywordTypeSchema", { enumerable: true, get: function () { return schemas_1.KeywordTypeSchema; } });
Object.defineProperty(exports, "TypeArraySchema", { enumerable: true, get: function () { return schemas_1.TypeArraySchema; } });
Object.defineProperty(exports, "TypeOperatorSchema", { enumerable: true, get: function () { return schemas_1.TypeOperatorSchema; } });
Object.defineProperty(exports, "TupleTypeSchema", { enumerable: true, get: function () { return schemas_1.TupleTypeSchema; } });
Object.defineProperty(exports, "ParameterSchema", { enumerable: true, get: function () { return schemas_1.ParameterSchema; } });
//# sourceMappingURL=index.js.map
import { SchemaNode } from '../schema-node';
import { Parameter } from './function';
import { ParameterSchema } from './parameter';
export declare class ConstructorSchema implements SchemaNode {
readonly args: Parameter[];
constructor(args: Parameter[]);
readonly params: ParameterSchema[];
constructor(params: ParameterSchema[]);
toString(): string;
toObject(): {
constructorName: string;
args: Parameter[];
args: {
constructorName: string;
name: string;
type: Record<string, any> & {
constructorName: string;
};
defaultValue: any;
description: string;
}[];
};
}

@@ -9,8 +9,8 @@ "use strict";

class ConstructorSchema {
constructor(args) {
this.args = args;
constructor(params) {
this.params = params;
}
toString() {
const argsStr = this.args.map((arg) => `${arg.name}: ${arg.type.toString()}`).join(', ');
return `${chalk_1.default.bold('constructor')}(${argsStr})`;
const paramsStr = this.params.map((param) => param.toString()).join(', ');
return `${chalk_1.default.bold('constructor')}(${paramsStr})`;
}

@@ -20,3 +20,3 @@ toObject() {

constructorName: this.constructor.name,
args: this.args,
args: this.params.map((arg) => arg.toObject()),
};

@@ -23,0 +23,0 @@ }

import { SchemaNode } from '../schema-node';
import { TypeRefSchema } from './type-ref';
export declare type Parameter = {
name: string;
type: TypeRefSchema;
defaultValue?: any;
description?: string;
};
import { ParameterSchema } from './parameter';
export declare type Modifier = 'static' | 'public' | 'private' | 'protected' | 'readonly' | 'abstract' | 'async' | 'override';
export declare class FunctionSchema implements SchemaNode {
readonly name: string;
readonly params: Parameter[];
readonly returnType: TypeRefSchema;
private signature;
constructor(name: string, params: Parameter[], returnType: TypeRefSchema, signature: string);
readonly params: ParameterSchema[];
readonly returnType: SchemaNode;
readonly signature: string;
readonly modifiers: Modifier[];
constructor(name: string, params: ParameterSchema[], returnType: SchemaNode, signature: string, modifiers?: Modifier[]);
serialize(): void;

@@ -21,12 +17,10 @@ toJsonSchema(): void;

name: string;
params: Parameter[];
returnType: {
params: ParameterSchema[];
returnType: Record<string, any> & {
constructorName: string;
name: string;
componentId: import("@teambit/component").ComponentID;
packageName: string;
};
signature: string;
modifiers: Modifier[];
};
toString(): string;
}

@@ -11,3 +11,3 @@ "use strict";

// readonly doc: any,
params, returnType, signature) {
params, returnType, signature, modifiers = []) {
this.name = name;

@@ -17,2 +17,3 @@ this.params = params;

this.signature = signature;
this.modifiers = modifiers;
}

@@ -31,7 +32,9 @@ serialize() { }

signature: this.signature,
modifiers: this.modifiers,
};
}
toString() {
const paramsStr = this.params.map((arg) => `${arg.name}: ${arg.type.toString()}`).join(', ');
return `${chalk_1.default.bold(this.name)}(${paramsStr}): ${this.returnType.toString()}`;
const paramsStr = this.params.map((param) => param.toString()).join(', ');
const modifiersStr = this.modifiers.length ? `${this.modifiers.join(' ')} ` : '';
return `${modifiersStr}${chalk_1.default.bold(this.name)}(${paramsStr}): ${this.returnType.toString()}`;
}

@@ -38,0 +41,0 @@ }

import { SchemaNode } from '../schema-node';
import { TypeRefSchema } from './type-ref';
export declare class GetAccessorSchema implements SchemaNode {

@@ -7,3 +6,3 @@ private name;

private signature;
constructor(name: string, type: TypeRefSchema, signature: string);
constructor(name: string, type: SchemaNode, signature: string);
getSignature(): string;

@@ -13,7 +12,4 @@ toObject(): {

name: string;
type: {
type: Record<string, any> & {
constructorName: string;
name: string;
componentId: import("@teambit/component").ComponentID;
packageName: string;
};

@@ -20,0 +16,0 @@ signature: string;

import { SchemaNode } from '../schema-node';
import { Parameter } from './function';
import { TypeRefSchema } from './type-ref';
import { ParameterSchema } from './parameter';
/**

@@ -9,13 +8,10 @@ * e.g. `{ [key: string]: boolean };`

export declare class IndexSignatureSchema implements SchemaNode {
private parameters;
private params;
private type;
constructor(parameters: Parameter[], type: TypeRefSchema);
constructor(params: ParameterSchema[], type: SchemaNode);
toObject(): {
constructorName: string;
parameters: Parameter[];
type: {
parameters: ParameterSchema[];
type: Record<string, any> & {
constructorName: string;
name: string;
componentId: import("@teambit/component").ComponentID;
packageName: string;
};

@@ -22,0 +18,0 @@ };

@@ -9,4 +9,4 @@ "use strict";

class IndexSignatureSchema {
constructor(parameters, type) {
this.parameters = parameters;
constructor(params, type) {
this.params = params;
this.type = type;

@@ -17,3 +17,3 @@ }

constructorName: this.constructor.name,
parameters: this.parameters,
parameters: this.params,
type: this.type.toObject(),

@@ -23,4 +23,4 @@ };

toString() {
const parameters = this.parameters.map((arg) => `${arg.name}: ${arg.type.toString()}`).join(', ');
return `[${parameters}]: ${this.type.toString()}`;
const paramsStr = this.params.map((param) => param.toString()).join(', ');
return `[${paramsStr}]: ${this.type.toString()}`;
}

@@ -27,0 +27,0 @@ }

export { Module } from './module';
export { Export, StaticProperties } from './export';
export { FunctionSchema, Parameter } from './function';
export { FunctionSchema, Modifier } from './function';
export { TypeRefSchema } from './type-ref';

@@ -16,1 +16,9 @@ export { VariableSchema } from './variable';

export { SetAccessorSchema } from './set-accessor';
export { TypeQuerySchema } from './type-query';
export { InferenceTypeSchema } from './inference-type';
export { LiteralTypeSchema } from './literal-type';
export { KeywordTypeSchema } from './keyword-type';
export { TypeArraySchema } from './type-array';
export { TypeOperatorSchema } from './type-operator';
export { TupleTypeSchema } from './tuple-type';
export { ParameterSchema } from './parameter';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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.FunctionSchema = exports.Export = exports.Module = void 0;
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.FunctionSchema = exports.Export = exports.Module = void 0;
var module_1 = require("./module");

@@ -34,2 +34,18 @@ Object.defineProperty(exports, "Module", { enumerable: true, get: function () { return module_1.Module; } });

Object.defineProperty(exports, "SetAccessorSchema", { enumerable: true, get: function () { return set_accessor_1.SetAccessorSchema; } });
var type_query_1 = require("./type-query");
Object.defineProperty(exports, "TypeQuerySchema", { enumerable: true, get: function () { return type_query_1.TypeQuerySchema; } });
var inference_type_1 = require("./inference-type");
Object.defineProperty(exports, "InferenceTypeSchema", { enumerable: true, get: function () { return inference_type_1.InferenceTypeSchema; } });
var literal_type_1 = require("./literal-type");
Object.defineProperty(exports, "LiteralTypeSchema", { enumerable: true, get: function () { return literal_type_1.LiteralTypeSchema; } });
var keyword_type_1 = require("./keyword-type");
Object.defineProperty(exports, "KeywordTypeSchema", { enumerable: true, get: function () { return keyword_type_1.KeywordTypeSchema; } });
var type_array_1 = require("./type-array");
Object.defineProperty(exports, "TypeArraySchema", { enumerable: true, get: function () { return type_array_1.TypeArraySchema; } });
var type_operator_1 = require("./type-operator");
Object.defineProperty(exports, "TypeOperatorSchema", { enumerable: true, get: function () { return type_operator_1.TypeOperatorSchema; } });
var tuple_type_1 = require("./tuple-type");
Object.defineProperty(exports, "TupleTypeSchema", { enumerable: true, get: function () { return tuple_type_1.TupleTypeSchema; } });
var parameter_1 = require("./parameter");
Object.defineProperty(exports, "ParameterSchema", { enumerable: true, get: function () { return parameter_1.ParameterSchema; } });
//# sourceMappingURL=index.js.map

@@ -1,3 +0,3 @@

import { Parameter } from '.';
import { SchemaNode } from '../schema-node';
import { ParameterSchema } from './parameter';
export declare class SetAccessorSchema implements SchemaNode {

@@ -7,3 +7,3 @@ private name;

private signature;
constructor(name: string, param: Parameter, signature: string);
constructor(name: string, param: ParameterSchema, signature: string);
getSignature(): string;

@@ -13,3 +13,3 @@ toObject(): {

name: string;
param: Parameter;
param: ParameterSchema;
signature: string;

@@ -16,0 +16,0 @@ };

@@ -26,3 +26,3 @@ "use strict";

toString() {
return `set ${chalk_1.default.bold(this.name)}(${this.param.name}: ${this.param.type})`;
return `set ${chalk_1.default.bold(this.name)}(${this.param.toString()})`;
}

@@ -29,0 +29,0 @@ }

@@ -7,3 +7,2 @@ import { ComponentID } from '@teambit/component';

packageName?: string;
node?: SchemaNode;
};

@@ -23,3 +22,2 @@ export declare class TypeRefSchema implements SchemaNode {

readonly packageName?: string;
readonly node?: SchemaNode;
constructor(

@@ -37,3 +35,3 @@ /**

*/
packageName?: string, node?: SchemaNode);
packageName?: string);
toObject(): {

@@ -46,3 +44,7 @@ constructorName: string;

toString(): string;
/**
* whether this type was already exported in this component
*/
isFromThisComponent(): boolean;
static from(plainSchema: PlainTypeRefSchema): TypeRefSchema;
}

@@ -22,7 +22,6 @@ "use strict";

*/
packageName, node) {
packageName) {
this.name = name;
this.componentId = componentId;
this.packageName = packageName;
this.node = node;
}

@@ -46,4 +45,10 @@ toObject() {

}
/**
* whether this type was already exported in this component
*/
isFromThisComponent() {
return !this.componentId && !this.packageName;
}
static from(plainSchema) {
return new TypeRefSchema(plainSchema.name, plainSchema.componentId ? component_1.ComponentID.fromString(plainSchema.componentId) : undefined, plainSchema.packageName, plainSchema.node);
return new TypeRefSchema(plainSchema.name, plainSchema.componentId ? component_1.ComponentID.fromString(plainSchema.componentId) : undefined, plainSchema.packageName);
}

@@ -50,0 +55,0 @@ }

import { SchemaNode } from '../schema-node';
import { TypeRefSchema } from './type-ref';
export declare class VariableSchema implements SchemaNode {

@@ -7,3 +6,3 @@ readonly name: string;

private type;
constructor(name: string, signature: string, type: TypeRefSchema);
constructor(name: string, signature: string, type: SchemaNode);
getSignature(): string;

@@ -14,7 +13,4 @@ toObject(): {

signature: string;
type: {
type: Record<string, any> & {
constructorName: string;
name: string;
componentId: import("@teambit/component").ComponentID;
packageName: string;
};

@@ -21,0 +17,0 @@ };

@@ -8,3 +8,3 @@ export { APISchema } from './api-schema';

FunctionSchema,
Parameter,
Modifier,
TypeRefSchema,

@@ -22,3 +22,11 @@ VariableSchema,

SetAccessorSchema,
TypeQuerySchema,
InferenceTypeSchema,
LiteralTypeSchema,
KeywordTypeSchema,
TypeArraySchema,
TypeOperatorSchema,
TupleTypeSchema,
ParameterSchema,
} from './schemas';
export type { JSONSchema, JSONSchemaObject } from './json-schema';
{
"name": "@teambit/semantics.entities.semantic-schema",
"version": "0.0.8",
"version": "0.0.9",
"homepage": "https://bit.dev/teambit/semantics/entities/semantic-schema",

@@ -9,3 +9,3 @@ "main": "dist/index.js",

"name": "entities/semantic-schema",
"version": "0.0.8"
"version": "0.0.9"
},

@@ -12,0 +12,0 @@ "dependencies": {

import chalk from 'chalk';
import { SchemaNode } from '../schema-node';
import { Parameter } from './function';
import { ParameterSchema } from './parameter';
export class ConstructorSchema implements SchemaNode {
constructor(readonly args: Parameter[]) {}
constructor(readonly params: ParameterSchema[]) {}
toString() {
const argsStr = this.args.map((arg) => `${arg.name}: ${arg.type.toString()}`).join(', ');
return `${chalk.bold('constructor')}(${argsStr})`;
const paramsStr = this.params.map((param) => param.toString()).join(', ');
return `${chalk.bold('constructor')}(${paramsStr})`;
}

@@ -16,5 +16,5 @@

constructorName: this.constructor.name,
args: this.args,
args: this.params.map((arg) => arg.toObject()),
};
}
}
import chalk from 'chalk';
import { SchemaNode } from '../schema-node';
import { TypeRefSchema } from './type-ref';
import { ParameterSchema } from './parameter';
export type Parameter = {
name: string;
type: TypeRefSchema;
defaultValue?: any;
description?: string;
};
export type Modifier = 'static' | 'public' | 'private' | 'protected' | 'readonly' | 'abstract' | 'async' | 'override';

@@ -16,6 +11,7 @@ export class FunctionSchema implements SchemaNode {

// readonly doc: any,
readonly params: Parameter[],
readonly params: ParameterSchema[],
readonly returnType: TypeRefSchema,
private signature: string
readonly returnType: SchemaNode,
readonly signature: string,
readonly modifiers: Modifier[] = []
) {}

@@ -38,2 +34,3 @@

signature: this.signature,
modifiers: this.modifiers,
};

@@ -43,5 +40,6 @@ }

toString() {
const paramsStr = this.params.map((arg) => `${arg.name}: ${arg.type.toString()}`).join(', ');
return `${chalk.bold(this.name)}(${paramsStr}): ${this.returnType.toString()}`;
const paramsStr = this.params.map((param) => param.toString()).join(', ');
const modifiersStr = this.modifiers.length ? `${this.modifiers.join(' ')} ` : '';
return `${modifiersStr}${chalk.bold(this.name)}(${paramsStr}): ${this.returnType.toString()}`;
}
}
import chalk from 'chalk';
import { SchemaNode } from '../schema-node';
import { TypeRefSchema } from './type-ref';
export class GetAccessorSchema implements SchemaNode {
constructor(private name: string, private type: TypeRefSchema, private signature: string) {}
constructor(private name: string, private type: SchemaNode, private signature: string) {}
getSignature() {

@@ -8,0 +7,0 @@ return this.signature;

import { SchemaNode } from '../schema-node';
import { Parameter } from './function';
import { TypeRefSchema } from './type-ref';
import { ParameterSchema } from './parameter';

@@ -10,7 +9,7 @@ /**

export class IndexSignatureSchema implements SchemaNode {
constructor(private parameters: Parameter[], private type: TypeRefSchema) {}
constructor(private params: ParameterSchema[], private type: SchemaNode) {}
toObject() {
return {
constructorName: this.constructor.name,
parameters: this.parameters,
parameters: this.params,
type: this.type.toObject(),

@@ -20,5 +19,5 @@ };

toString() {
const parameters = this.parameters.map((arg) => `${arg.name}: ${arg.type.toString()}`).join(', ');
return `[${parameters}]: ${this.type.toString()}`;
const paramsStr = this.params.map((param) => param.toString()).join(', ');
return `[${paramsStr}]: ${this.type.toString()}`;
}
}
export { Module } from './module';
export { Export, StaticProperties } from './export';
export { FunctionSchema, Parameter } from './function';
export { FunctionSchema, Modifier } from './function';
export { TypeRefSchema } from './type-ref';

@@ -16,1 +16,9 @@ export { VariableSchema } from './variable';

export { SetAccessorSchema } from './set-accessor';
export { TypeQuerySchema } from './type-query';
export { InferenceTypeSchema } from './inference-type';
export { LiteralTypeSchema } from './literal-type';
export { KeywordTypeSchema } from './keyword-type';
export { TypeArraySchema } from './type-array';
export { TypeOperatorSchema } from './type-operator';
export { TupleTypeSchema } from './tuple-type';
export { ParameterSchema } from './parameter';
import chalk from 'chalk';
import { Parameter } from '.';
import { SchemaNode } from '../schema-node';
import { ParameterSchema } from './parameter';
export class SetAccessorSchema implements SchemaNode {
constructor(private name: string, private param: Parameter, private signature: string) {}
constructor(private name: string, private param: ParameterSchema, private signature: string) {}
getSignature() {

@@ -21,4 +21,4 @@ return this.signature;

toString() {
return `set ${chalk.bold(this.name)}(${this.param.name}: ${this.param.type})`;
return `set ${chalk.bold(this.name)}(${this.param.toString()})`;
}
}

@@ -9,3 +9,2 @@ import { ComponentID } from '@teambit/component';

packageName?: string;
node?: SchemaNode;
};

@@ -28,5 +27,3 @@

*/
readonly packageName?: string,
readonly node?: SchemaNode
readonly packageName?: string
) {}

@@ -53,2 +50,9 @@

/**
* whether this type was already exported in this component
*/
isFromThisComponent() {
return !this.componentId && !this.packageName;
}
static from(plainSchema: PlainTypeRefSchema) {

@@ -58,6 +62,5 @@ return new TypeRefSchema(

plainSchema.componentId ? ComponentID.fromString(plainSchema.componentId) : undefined,
plainSchema.packageName,
plainSchema.node
plainSchema.packageName
);
}
}
import chalk from 'chalk';
import { SchemaNode } from '../schema-node';
import { TypeRefSchema } from './type-ref';
export class VariableSchema implements SchemaNode {
constructor(readonly name: string, private signature: string, private type: TypeRefSchema) {}
constructor(readonly name: string, private signature: string, private type: SchemaNode) {}
getSignature() {

@@ -8,0 +7,0 @@ return this.signature;

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc