@teambit/semantics.entities.semantic-schema 0.0.0-e4ef0e951da794f03096a5cc407420f4cde8b878
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 +167 -0
- package/dist/api-schema.d.ts +36 -0
- package/dist/api-schema.js +171 -0
- package/dist/api-schema.js.map +1 -0
- package/dist/export.d.ts +38 -0
- package/dist/export.js +37 -0
- package/dist/export.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +137 -0
- package/dist/index.js.map +1 -0
- 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 +51 -0
- package/dist/schema-node.js +67 -0
- package/dist/schema-node.js.map +1 -0
- package/dist/schema-registry.d.ts +17 -0
- package/dist/schema-registry.js +63 -0
- package/dist/schema-registry.js.map +1 -0
- package/dist/schemas/array-literal-expression.d.ts +15 -0
- package/dist/schemas/array-literal-expression.js +48 -0
- package/dist/schemas/array-literal-expression.js.map +1 -0
- package/dist/schemas/class.d.ts +59 -0
- package/dist/schemas/class.js +126 -0
- package/dist/schemas/class.js.map +1 -0
- package/dist/schemas/conditional-type.d.ts +25 -0
- package/dist/schemas/conditional-type.js +67 -0
- package/dist/schemas/conditional-type.js.map +1 -0
- package/dist/schemas/constructor.d.ts +9 -0
- package/dist/schemas/constructor.js +51 -0
- package/dist/schemas/constructor.js.map +1 -0
- package/dist/schemas/decorator.d.ts +35 -0
- package/dist/schemas/decorator.js +70 -0
- package/dist/schemas/decorator.js.map +1 -0
- package/dist/schemas/docs/doc.d.ts +30 -0
- package/dist/schemas/docs/doc.js +74 -0
- package/dist/schemas/docs/doc.js.map +1 -0
- package/dist/schemas/docs/index.d.ts +4 -0
- package/dist/schemas/docs/index.js +59 -0
- package/dist/schemas/docs/index.js.map +1 -0
- package/dist/schemas/docs/property-like-tag.d.ts +26 -0
- package/dist/schemas/docs/property-like-tag.js +59 -0
- package/dist/schemas/docs/property-like-tag.js.map +1 -0
- package/dist/schemas/docs/return-tag.d.ts +25 -0
- package/dist/schemas/docs/return-tag.js +55 -0
- package/dist/schemas/docs/return-tag.js.map +1 -0
- package/dist/schemas/docs/tag.d.ts +45 -0
- package/dist/schemas/docs/tag.js +75 -0
- package/dist/schemas/docs/tag.js.map +1 -0
- package/dist/schemas/enum-member.d.ts +36 -0
- package/dist/schemas/enum-member.js +66 -0
- package/dist/schemas/enum-member.js.map +1 -0
- package/dist/schemas/enum.d.ts +37 -0
- package/dist/schemas/enum.js +87 -0
- package/dist/schemas/enum.js.map +1 -0
- package/dist/schemas/export.d.ts +41 -0
- package/dist/schemas/export.js +92 -0
- package/dist/schemas/export.js.map +1 -0
- package/dist/schemas/expression-with-arguments.d.ts +19 -0
- package/dist/schemas/expression-with-arguments.js +59 -0
- package/dist/schemas/expression-with-arguments.js.map +1 -0
- package/dist/schemas/function-like.d.ts +66 -0
- package/dist/schemas/function-like.js +147 -0
- package/dist/schemas/function-like.js.map +1 -0
- package/dist/schemas/get-accessor.d.ts +22 -0
- package/dist/schemas/get-accessor.js +73 -0
- package/dist/schemas/get-accessor.js.map +1 -0
- package/dist/schemas/ignored.d.ts +17 -0
- package/dist/schemas/ignored.js +54 -0
- package/dist/schemas/ignored.js.map +1 -0
- package/dist/schemas/index-signature.d.ts +23 -0
- package/dist/schemas/index-signature.js +65 -0
- package/dist/schemas/index-signature.js.map +1 -0
- package/dist/schemas/index.d.ts +49 -0
- package/dist/schemas/index.js +623 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/indexed-access-type.d.ts +17 -0
- package/dist/schemas/indexed-access-type.js +55 -0
- package/dist/schemas/indexed-access-type.js.map +1 -0
- package/dist/schemas/inference-type.d.ts +22 -0
- package/dist/schemas/inference-type.js +65 -0
- package/dist/schemas/inference-type.js.map +1 -0
- package/dist/schemas/interface.d.ts +49 -0
- package/dist/schemas/interface.js +108 -0
- package/dist/schemas/interface.js.map +1 -0
- package/dist/schemas/keyword-type.d.ts +15 -0
- package/dist/schemas/keyword-type.js +43 -0
- package/dist/schemas/keyword-type.js.map +1 -0
- package/dist/schemas/literal-type.d.ts +15 -0
- package/dist/schemas/literal-type.js +43 -0
- package/dist/schemas/literal-type.js.map +1 -0
- package/dist/schemas/literal-value.d.ts +12 -0
- package/dist/schemas/literal-value.js +41 -0
- package/dist/schemas/literal-value.js.map +1 -0
- package/dist/schemas/module.d.ts +22 -0
- package/dist/schemas/module.js +87 -0
- package/dist/schemas/module.js.map +1 -0
- package/dist/schemas/named-tuple.d.ts +19 -0
- package/dist/schemas/named-tuple.js +53 -0
- package/dist/schemas/named-tuple.js.map +1 -0
- package/dist/schemas/object-literal-expression.d.ts +18 -0
- package/dist/schemas/object-literal-expression.js +52 -0
- package/dist/schemas/object-literal-expression.js.map +1 -0
- package/dist/schemas/parameter.d.ts +27 -0
- package/dist/schemas/parameter.js +95 -0
- package/dist/schemas/parameter.js.map +1 -0
- package/dist/schemas/parenthesized-type.d.ts +21 -0
- package/dist/schemas/parenthesized-type.js +54 -0
- package/dist/schemas/parenthesized-type.js.map +1 -0
- package/dist/schemas/property-assignment.d.ts +37 -0
- package/dist/schemas/property-assignment.js +67 -0
- package/dist/schemas/property-assignment.js.map +1 -0
- package/dist/schemas/set-accessor.d.ts +28 -0
- package/dist/schemas/set-accessor.js +65 -0
- package/dist/schemas/set-accessor.js.map +1 -0
- package/dist/schemas/template-literal-type-span.d.ts +19 -0
- package/dist/schemas/template-literal-type-span.js +53 -0
- package/dist/schemas/template-literal-type-span.js.map +1 -0
- package/dist/schemas/template-literal-type.d.ts +22 -0
- package/dist/schemas/template-literal-type.js +52 -0
- package/dist/schemas/template-literal-type.js.map +1 -0
- package/dist/schemas/this-type.d.ts +12 -0
- package/dist/schemas/this-type.js +37 -0
- package/dist/schemas/this-type.js.map +1 -0
- package/dist/schemas/tuple-type.d.ts +16 -0
- package/dist/schemas/tuple-type.js +47 -0
- package/dist/schemas/tuple-type.js.map +1 -0
- package/dist/schemas/type-array.d.ts +17 -0
- package/dist/schemas/type-array.js +50 -0
- package/dist/schemas/type-array.js.map +1 -0
- package/dist/schemas/type-intersection.d.ts +17 -0
- package/dist/schemas/type-intersection.js +50 -0
- package/dist/schemas/type-intersection.js.map +1 -0
- package/dist/schemas/type-literal.d.ts +18 -0
- package/dist/schemas/type-literal.js +64 -0
- package/dist/schemas/type-literal.js.map +1 -0
- package/dist/schemas/type-operator.d.ts +19 -0
- package/dist/schemas/type-operator.js +53 -0
- package/dist/schemas/type-operator.js.map +1 -0
- package/dist/schemas/type-predicate.d.ts +33 -0
- package/dist/schemas/type-predicate.js +75 -0
- package/dist/schemas/type-predicate.js.map +1 -0
- package/dist/schemas/type-query.d.ts +23 -0
- package/dist/schemas/type-query.js +59 -0
- package/dist/schemas/type-query.js.map +1 -0
- package/dist/schemas/type-ref.d.ts +80 -0
- package/dist/schemas/type-ref.js +159 -0
- package/dist/schemas/type-ref.js.map +1 -0
- package/dist/schemas/type-union.d.ts +17 -0
- package/dist/schemas/type-union.js +56 -0
- package/dist/schemas/type-union.js.map +1 -0
- package/dist/schemas/type.d.ts +23 -0
- package/dist/schemas/type.js +80 -0
- package/dist/schemas/type.js.map +1 -0
- package/dist/schemas/unimplemented-schema.d.ts +14 -0
- package/dist/schemas/unimplemented-schema.js +43 -0
- package/dist/schemas/unimplemented-schema.js.map +1 -0
- package/dist/schemas/unknown-schema.d.ts +18 -0
- package/dist/schemas/unknown-schema.js +47 -0
- package/dist/schemas/unknown-schema.js.map +1 -0
- package/dist/schemas/unresolved-schema.d.ts +14 -0
- package/dist/schemas/unresolved-schema.js +41 -0
- package/dist/schemas/unresolved-schema.js.map +1 -0
- package/dist/schemas/variable-like.d.ts +47 -0
- package/dist/schemas/variable-like.js +95 -0
- package/dist/schemas/variable-like.js.map +1 -0
- package/dist/semantic-schema.docs.md +6 -0
- package/dist/type.d.ts +1 -0
- package/dist/type.js +3 -0
- package/dist/type.js.map +1 -0
- package/dist/unknown-schema-factory.d.ts +4 -0
- package/dist/unknown-schema-factory.js +19 -0
- package/dist/unknown-schema-factory.js.map +1 -0
- package/export.ts +31 -0
- package/index.ts +13 -0
- package/package.json +46 -0
- package/schema-node-constructor.ts +8 -0
- package/schema-node.ts +96 -0
- package/schema-registry.ts +53 -0
- package/schemas/array-literal-expression.ts +33 -0
- package/schemas/class.ts +135 -0
- package/schemas/conditional-type.ts +63 -0
- package/schemas/constructor.ts +28 -0
- package/schemas/decorator.ts +54 -0
- package/schemas/docs/doc.ts +69 -0
- package/schemas/docs/index.ts +4 -0
- package/schemas/docs/property-like-tag.ts +47 -0
- package/schemas/docs/return-tag.ts +44 -0
- package/schemas/docs/tag.ts +66 -0
- package/schemas/enum-member.ts +57 -0
- package/schemas/enum.ts +73 -0
- package/schemas/export.ts +91 -0
- package/schemas/expression-with-arguments.ts +51 -0
- package/schemas/function-like.ts +154 -0
- package/schemas/get-accessor.ts +57 -0
- package/schemas/ignored.ts +43 -0
- package/schemas/index-signature.ts +49 -0
- package/schemas/index.ts +49 -0
- package/schemas/indexed-access-type.ts +47 -0
- package/schemas/inference-type.ts +60 -0
- package/schemas/interface.ts +94 -0
- package/schemas/keyword-type.ts +34 -0
- package/schemas/literal-type.ts +34 -0
- package/schemas/literal-value.ts +32 -0
- package/schemas/module.ts +87 -0
- package/schemas/named-tuple.ts +39 -0
- package/schemas/object-literal-expression.ts +42 -0
- package/schemas/parameter.ts +104 -0
- package/schemas/parenthesized-type.ts +42 -0
- package/schemas/property-assignment.ts +50 -0
- package/schemas/set-accessor.ts +47 -0
- package/schemas/template-literal-type-span.ts +42 -0
- package/schemas/template-literal-type.ts +40 -0
- package/schemas/this-type.ts +27 -0
- package/schemas/tuple-type.ts +35 -0
- package/schemas/type-array.ts +39 -0
- package/schemas/type-intersection.ts +39 -0
- package/schemas/type-literal.ts +60 -0
- package/schemas/type-operator.ts +41 -0
- package/schemas/type-predicate.ts +64 -0
- package/schemas/type-query.ts +49 -0
- package/schemas/type-ref.ts +143 -0
- package/schemas/type-union.ts +41 -0
- package/schemas/type.ts +61 -0
- package/schemas/unimplemented-schema.ts +35 -0
- package/schemas/unknown-schema.ts +38 -0
- package/schemas/unresolved-schema.ts +32 -0
- package/schemas/variable-like.ts +76 -0
- package/semantic-schema.docs.md +6 -0
- package/type.ts +1 -0
- package/types/asset.d.ts +41 -0
- package/types/style.d.ts +42 -0
- package/unknown-schema-factory.ts +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_schemaNode","data","require","_schemaRegistry","TypePredicateSchema","SchemaNode","constructor","location","name","type","hasAssertsModifier","toString","options","assertsKeyword","typeStr","toFullSignature","typeSignature","signature","showDocs","doc","docString","toObject","fromObject","obj","SchemaRegistry","undefined","exports"],"sources":["type-predicate.ts"],"sourcesContent":["import { SchemaLocation, SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\n\n/**\n * e.g. `function f(str: any): str is string {}`\n *\n * example when the type is empty:\n * ```ts\n * function assert(condition: any, msg?: string): asserts condition {\n * if (!condition) {\n * throw new AssertionError(msg);\n * }\n * }\n * ```\n *\n */\nexport class TypePredicateSchema extends SchemaNode {\n readonly type?: SchemaNode;\n constructor(\n readonly location: SchemaLocation,\n readonly name: string,\n type?: SchemaNode,\n readonly hasAssertsModifier = false\n ) {\n super();\n this.type = type;\n }\n\n toString(options?: { color?: boolean }) {\n const assertsKeyword = this.hasAssertsModifier ? 'asserts ' : '';\n const typeStr = this.type ? ` is ${this.type.toString(options)}` : '';\n return assertsKeyword + this.name + typeStr;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n const assertsKeyword = this.hasAssertsModifier ? 'asserts ' : '';\n const typeSignature = this.type ? ` is ${this.type.toFullSignature(options)}` : '';\n let signature = `${assertsKeyword}${this.name}${typeSignature}`;\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n type: this.type?.toObject(),\n hasAssertsModifier: this.hasAssertsModifier,\n };\n }\n\n static fromObject(obj: Record<string, any>): TypePredicateSchema {\n const location = obj.location;\n const name = obj.name;\n const type = obj.type ? SchemaRegistry.fromObject(obj.type) : undefined;\n const hasAssertsModifier = obj.hasAssertsModifier;\n return new TypePredicateSchema(location, name, type, hasAssertsModifier);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,mBAAmB,SAASC,wBAAU,CAAC;EAElDC,WAAWA,CACAC,QAAwB,EACxBC,IAAY,EACrBC,IAAiB,EACRC,kBAAkB,GAAG,KAAK,EACnC;IACA,KAAK,CAAC,CAAC;IAAC,KALCH,QAAwB,GAAxBA,QAAwB;IAAA,KACxBC,IAAY,GAAZA,IAAY;IAAA,KAEZE,kBAAkB,GAAlBA,kBAAkB;IAG3B,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;EAEAE,QAAQA,CAACC,OAA6B,EAAE;IACtC,MAAMC,cAAc,GAAG,IAAI,CAACH,kBAAkB,GAAG,UAAU,GAAG,EAAE;IAChE,MAAMI,OAAO,GAAG,IAAI,CAACL,IAAI,GAAG,OAAO,IAAI,CAACA,IAAI,CAACE,QAAQ,CAACC,OAAO,CAAC,EAAE,GAAG,EAAE;IACrE,OAAOC,cAAc,GAAG,IAAI,CAACL,IAAI,GAAGM,OAAO;EAC7C;EAEAC,eAAeA,CAACH,OAAgC,EAAU;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aLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
/**
|
|
3
|
+
* e.g. `typeof Foo`
|
|
4
|
+
*/
|
|
5
|
+
export declare class TypeQuerySchema extends SchemaNode {
|
|
6
|
+
readonly location: SchemaLocation;
|
|
7
|
+
readonly signature: string;
|
|
8
|
+
readonly type: SchemaNode;
|
|
9
|
+
constructor(location: SchemaLocation, type: SchemaNode, signature: string);
|
|
10
|
+
getNodes(): SchemaNode[];
|
|
11
|
+
getSignature(): string;
|
|
12
|
+
toString(options?: {
|
|
13
|
+
color?: boolean;
|
|
14
|
+
}): string;
|
|
15
|
+
toFullSignature(options?: {
|
|
16
|
+
showDocs?: boolean;
|
|
17
|
+
}): string;
|
|
18
|
+
toObject(): {
|
|
19
|
+
type: Record<string, any>;
|
|
20
|
+
signature: string;
|
|
21
|
+
};
|
|
22
|
+
static fromObject(obj: Record<string, any>): TypeQuerySchema;
|
|
23
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TypeQuerySchema = void 0;
|
|
7
|
+
function _schemaNode() {
|
|
8
|
+
const data = require("../schema-node");
|
|
9
|
+
_schemaNode = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _schemaRegistry() {
|
|
15
|
+
const data = require("../schema-registry");
|
|
16
|
+
_schemaRegistry = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* e.g. `typeof Foo`
|
|
23
|
+
*/
|
|
24
|
+
class TypeQuerySchema extends _schemaNode().SchemaNode {
|
|
25
|
+
constructor(location, type, signature) {
|
|
26
|
+
super();
|
|
27
|
+
this.location = location;
|
|
28
|
+
this.signature = signature;
|
|
29
|
+
this.type = type;
|
|
30
|
+
}
|
|
31
|
+
getNodes() {
|
|
32
|
+
return [this.type];
|
|
33
|
+
}
|
|
34
|
+
getSignature() {
|
|
35
|
+
return this.signature;
|
|
36
|
+
}
|
|
37
|
+
toString(options) {
|
|
38
|
+
return `typeof ${this.type.toString(options)}`;
|
|
39
|
+
}
|
|
40
|
+
toFullSignature(options) {
|
|
41
|
+
return `typeof ${this.type.toFullSignature(options)}`;
|
|
42
|
+
}
|
|
43
|
+
toObject() {
|
|
44
|
+
return {
|
|
45
|
+
...super.toObject(),
|
|
46
|
+
type: this.type.toObject(),
|
|
47
|
+
signature: this.signature
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
static fromObject(obj) {
|
|
51
|
+
const location = obj.location;
|
|
52
|
+
const type = _schemaRegistry().SchemaRegistry.fromObject(obj.type);
|
|
53
|
+
const signature = obj.signature;
|
|
54
|
+
return new TypeQuerySchema(location, type, signature);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.TypeQuerySchema = TypeQuerySchema;
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=type-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_schemaNode","data","require","_schemaRegistry","TypeQuerySchema","SchemaNode","constructor","location","type","signature","getNodes","getSignature","toString","options","toFullSignature","toObject","fromObject","obj","SchemaRegistry","exports"],"sources":["type-query.ts"],"sourcesContent":["import { SchemaLocation, SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\n\n/**\n * e.g. `typeof Foo`\n */\nexport class TypeQuerySchema extends SchemaNode {\n readonly type: SchemaNode;\n\n constructor(\n readonly location: SchemaLocation,\n type: SchemaNode,\n readonly signature: string\n ) {\n super();\n this.type = type;\n }\n\n getNodes() {\n return [this.type];\n }\n\n getSignature() {\n return this.signature;\n }\n\n toString(options?: { color?: boolean }) {\n return `typeof ${this.type.toString(options)}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n return `typeof ${this.type.toFullSignature(options)}`;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n type: this.type.toObject(),\n signature: this.signature,\n };\n }\n\n static fromObject(obj: Record<string, any>): TypeQuerySchema {\n const location = obj.location;\n const type = SchemaRegistry.fromObject(obj.type);\n const signature = obj.signature;\n return new TypeQuerySchema(location, type, signature);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACO,MAAMG,eAAe,SAASC,wBAAU,CAAC;EAG9CC,WAAWA,CACAC,QAAwB,EACjCC,IAAgB,EACPC,SAAiB,EAC1B;IACA,KAAK,CAAC,CAAC;IAAC,KAJCF,QAAwB,GAAxBA,QAAwB;IAAA,KAExBE,SAAiB,GAAjBA,SAAiB;IAG1B,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;EAEAE,QAAQA,CAAA,EAAG;IACT,OAAO,CAAC,IAAI,CAACF,IAAI,CAAC;EACpB;EAEAG,YAAYA,CAAA,EAAG;IACb,OAAO,IAAI,CAACF,SAAS;EACvB;EAEAG,QAAQA,CAACC,OAA6B,EAAE;IACtC,OAAO,UAAU,IAAI,CAACL,IAAI,CAACI,QAAQ,CAACC,OAAO,CAAC,EAAE;EAChD;EAEAC,eAAeA,CAACD,OAAgC,EAAU;IACxD,OAAO,UAAU,IAAI,CAACL,IAAI,CAACM,eAAe,CAACD,OAAO,CAAC,EAAE;EACvD;EAEAE,QAAQA,CAAA,EAAG;IACT,OAAO;MACL,GAAG,KAAK,CAACA,QAAQ,CAAC,CAAC;MACnBP,IAAI,EAAE,IAAI,CAACA,IAAI,CAACO,QAAQ,CAAC,CAAC;MAC1BN,SAAS,EAAE,IAAI,CAACA;IAClB,CAAC;EACH;EAEA,OAAOO,UAAUA,CAACC,GAAwB,EAAmB;IAC3D,MAAMV,QAAQ,GAAGU,GAAG,CAACV,QAAQ;IAC7B,MAAMC,IAAI,GAAGU,gCAAc,CAACF,UAAU,CAACC,GAAG,CAACT,IAAI,CAAC;IAChD,MAAMC,SAAS,GAAGQ,GAAG,CAACR,SAAS;IAC/B,OAAO,IAAIL,eAAe,CAACG,QAAQ,EAAEC,IAAI,EAAEC,SAAS,CAAC;EACvD;AACF;AAACU,OAAA,CAAAf,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ComponentID } from '@teambit/component';
|
|
2
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
3
|
+
export type PlainTypeRefSchema = {
|
|
4
|
+
name: string;
|
|
5
|
+
componentId?: string;
|
|
6
|
+
packageName?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* can be one of the following:
|
|
10
|
+
* 1. a reference to another "export" in the same component
|
|
11
|
+
* 2 a reference to another declaration in the same file (internal)
|
|
12
|
+
* 3. a reference to another component.
|
|
13
|
+
* 4. a reference to a package.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TypeRefSchema extends SchemaNode {
|
|
16
|
+
readonly location: SchemaLocation;
|
|
17
|
+
/**
|
|
18
|
+
* name of the reference to type.
|
|
19
|
+
*/
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/**
|
|
22
|
+
* target package name. existing if type is defined in different package.
|
|
23
|
+
*/
|
|
24
|
+
readonly packageName?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* if the reference is not exported from the component, it can be internal to the file.
|
|
27
|
+
*/
|
|
28
|
+
readonly internalFilePath?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* optional type arguments, e.g. type Foo = Bar<X, Y>. The X and Y are type arguments.
|
|
31
|
+
*/
|
|
32
|
+
typeArgs?: SchemaNode[];
|
|
33
|
+
readonly componentId?: ComponentID;
|
|
34
|
+
constructor(location: SchemaLocation,
|
|
35
|
+
/**
|
|
36
|
+
* name of the reference to type.
|
|
37
|
+
*/
|
|
38
|
+
name: string,
|
|
39
|
+
/**
|
|
40
|
+
* target component id. existing if the type is defined in another component.
|
|
41
|
+
*/
|
|
42
|
+
componentId?: ComponentID,
|
|
43
|
+
/**
|
|
44
|
+
* target package name. existing if type is defined in different package.
|
|
45
|
+
*/
|
|
46
|
+
packageName?: string | undefined,
|
|
47
|
+
/**
|
|
48
|
+
* if the reference is not exported from the component, it can be internal to the file.
|
|
49
|
+
*/
|
|
50
|
+
internalFilePath?: string | undefined);
|
|
51
|
+
getNodes(): SchemaNode[];
|
|
52
|
+
withTypeArgs(typeArgs: SchemaNode[]): this;
|
|
53
|
+
toString(options?: {
|
|
54
|
+
color?: boolean;
|
|
55
|
+
}): string;
|
|
56
|
+
private nameToString;
|
|
57
|
+
toFullSignature(options?: {
|
|
58
|
+
showDocs?: boolean;
|
|
59
|
+
}): string;
|
|
60
|
+
/**
|
|
61
|
+
* whether this type was already exported in this component
|
|
62
|
+
*/
|
|
63
|
+
isFromThisComponent(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* whether this type is internal to the file.
|
|
66
|
+
*/
|
|
67
|
+
isInternalReference(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* whether this type is exported from this component.
|
|
70
|
+
*/
|
|
71
|
+
isExported(): boolean;
|
|
72
|
+
toObject(): {
|
|
73
|
+
name: string;
|
|
74
|
+
componentId: import("@teambit/component-id").ComponentIdObj | undefined;
|
|
75
|
+
packageName: string | undefined;
|
|
76
|
+
internalFilePath: string | undefined;
|
|
77
|
+
typeArgs: Record<string, any>[] | undefined;
|
|
78
|
+
};
|
|
79
|
+
static fromObject(obj: Record<string, any>): TypeRefSchema;
|
|
80
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TypeRefSchema = void 0;
|
|
7
|
+
function _component() {
|
|
8
|
+
const data = require("@teambit/component");
|
|
9
|
+
_component = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _chalk() {
|
|
15
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
16
|
+
_chalk = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _schemaNode() {
|
|
22
|
+
const data = require("../schema-node");
|
|
23
|
+
_schemaNode = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _schemaRegistry() {
|
|
29
|
+
const data = require("../schema-registry");
|
|
30
|
+
_schemaRegistry = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
|
+
/**
|
|
37
|
+
* can be one of the following:
|
|
38
|
+
* 1. a reference to another "export" in the same component
|
|
39
|
+
* 2 a reference to another declaration in the same file (internal)
|
|
40
|
+
* 3. a reference to another component.
|
|
41
|
+
* 4. a reference to a package.
|
|
42
|
+
*/
|
|
43
|
+
class TypeRefSchema extends _schemaNode().SchemaNode {
|
|
44
|
+
/**
|
|
45
|
+
* optional type arguments, e.g. type Foo = Bar<X, Y>. The X and Y are type arguments.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
constructor(location,
|
|
49
|
+
/**
|
|
50
|
+
* name of the reference to type.
|
|
51
|
+
*/
|
|
52
|
+
name,
|
|
53
|
+
/**
|
|
54
|
+
* target component id. existing if the type is defined in another component.
|
|
55
|
+
*/
|
|
56
|
+
componentId,
|
|
57
|
+
/**
|
|
58
|
+
* target package name. existing if type is defined in different package.
|
|
59
|
+
*/
|
|
60
|
+
packageName,
|
|
61
|
+
/**
|
|
62
|
+
* if the reference is not exported from the component, it can be internal to the file.
|
|
63
|
+
*/
|
|
64
|
+
internalFilePath) {
|
|
65
|
+
super();
|
|
66
|
+
this.location = location;
|
|
67
|
+
this.name = name;
|
|
68
|
+
this.packageName = packageName;
|
|
69
|
+
this.internalFilePath = internalFilePath;
|
|
70
|
+
this.componentId = componentId;
|
|
71
|
+
}
|
|
72
|
+
getNodes() {
|
|
73
|
+
return this.typeArgs || [];
|
|
74
|
+
}
|
|
75
|
+
withTypeArgs(typeArgs) {
|
|
76
|
+
this.typeArgs = typeArgs;
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
toString(options) {
|
|
80
|
+
const name = this.nameToString(options);
|
|
81
|
+
if (!this.typeArgs) {
|
|
82
|
+
return name;
|
|
83
|
+
}
|
|
84
|
+
const args = this.typeArgs.map(arg => arg.toString(options)).join(', ');
|
|
85
|
+
return `${name}<${args}>`;
|
|
86
|
+
}
|
|
87
|
+
nameToString(options) {
|
|
88
|
+
const dim = options?.color ? _chalk().default.dim : str => str;
|
|
89
|
+
if (this.componentId) {
|
|
90
|
+
const compStr = dim(`(component: ${this.componentId.toStringWithoutVersion()})`);
|
|
91
|
+
return `${compStr} ${this.name}`;
|
|
92
|
+
}
|
|
93
|
+
if (this.packageName) {
|
|
94
|
+
const pkgStr = dim(`(package: ${this.packageName})`);
|
|
95
|
+
return `${pkgStr} ${this.name}`;
|
|
96
|
+
}
|
|
97
|
+
return this.name;
|
|
98
|
+
}
|
|
99
|
+
toFullSignature(options) {
|
|
100
|
+
let signature = this.name;
|
|
101
|
+
if (this.typeArgs && this.typeArgs.length > 0) {
|
|
102
|
+
const argsSignatures = this.typeArgs.map(arg => arg.toFullSignature(options)).join(', ');
|
|
103
|
+
signature += `<${argsSignatures}>`;
|
|
104
|
+
}
|
|
105
|
+
if (options?.showDocs && this.doc) {
|
|
106
|
+
const docString = this.doc.toFullSignature();
|
|
107
|
+
signature = `${docString}\n${signature}`;
|
|
108
|
+
}
|
|
109
|
+
return signature;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* whether this type was already exported in this component
|
|
114
|
+
*/
|
|
115
|
+
isFromThisComponent() {
|
|
116
|
+
return !this.componentId && !this.packageName;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* whether this type is internal to the file.
|
|
121
|
+
*/
|
|
122
|
+
isInternalReference() {
|
|
123
|
+
return !!this.internalFilePath && this.isFromThisComponent();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* whether this type is exported from this component.
|
|
128
|
+
*/
|
|
129
|
+
isExported() {
|
|
130
|
+
return this.isFromThisComponent() && !this.isInternalReference();
|
|
131
|
+
}
|
|
132
|
+
toObject() {
|
|
133
|
+
return {
|
|
134
|
+
...super.toObject(),
|
|
135
|
+
name: this.name,
|
|
136
|
+
componentId: this.componentId ? this.componentId.toObject() : undefined,
|
|
137
|
+
packageName: this.packageName,
|
|
138
|
+
internalFilePath: this.internalFilePath,
|
|
139
|
+
typeArgs: this.typeArgs?.map(type => type.toObject())
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
static fromObject(obj) {
|
|
143
|
+
const location = obj.location;
|
|
144
|
+
const name = obj.name;
|
|
145
|
+
let componentId;
|
|
146
|
+
try {
|
|
147
|
+
componentId = obj.componentId ? _component().ComponentID.fromObject(obj.componentId) : undefined;
|
|
148
|
+
} catch {
|
|
149
|
+
componentId = undefined;
|
|
150
|
+
}
|
|
151
|
+
const packageName = obj.packageName;
|
|
152
|
+
const internalFilePath = obj.internalFilePath;
|
|
153
|
+
const typeArgs = obj.typeArgs?.map(type => _schemaRegistry().SchemaRegistry.fromObject(type));
|
|
154
|
+
return new TypeRefSchema(location, name, componentId, packageName, internalFilePath).withTypeArgs(typeArgs);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.TypeRefSchema = TypeRefSchema;
|
|
158
|
+
|
|
159
|
+
//# sourceMappingURL=type-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_component","data","require","_chalk","_interopRequireDefault","_schemaNode","_schemaRegistry","e","__esModule","default","TypeRefSchema","SchemaNode","constructor","location","name","componentId","packageName","internalFilePath","getNodes","typeArgs","withTypeArgs","toString","options","nameToString","args","map","arg","join","dim","color","chalk","str","compStr","toStringWithoutVersion","pkgStr","toFullSignature","signature","length","argsSignatures","showDocs","doc","docString","isFromThisComponent","isInternalReference","isExported","toObject","undefined","type","fromObject","obj","ComponentID","SchemaRegistry","exports"],"sources":["type-ref.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport { SchemaLocation, SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\n\nexport type PlainTypeRefSchema = {\n name: string;\n componentId?: string;\n packageName?: string;\n};\n\n/**\n * can be one of the following:\n * 1. a reference to another \"export\" in the same component\n * 2 a reference to another declaration in the same file (internal)\n * 3. a reference to another component.\n * 4. a reference to a package.\n */\nexport class TypeRefSchema extends SchemaNode {\n /**\n * optional type arguments, e.g. type Foo = Bar<X, Y>. The X and Y are type arguments.\n */\n typeArgs?: SchemaNode[];\n\n readonly componentId?: ComponentID;\n\n constructor(\n readonly location: SchemaLocation,\n /**\n * name of the reference to type.\n */\n readonly name: string,\n /**\n * target component id. existing if the type is defined in another component.\n */\n componentId?: ComponentID,\n /**\n * target package name. existing if type is defined in different package.\n */\n readonly packageName?: string,\n /**\n * if the reference is not exported from the component, it can be internal to the file.\n */\n readonly internalFilePath?: string\n ) {\n super();\n this.componentId = componentId;\n }\n\n getNodes(): SchemaNode[] {\n return this.typeArgs || [];\n }\n\n withTypeArgs(typeArgs: SchemaNode[]) {\n this.typeArgs = typeArgs;\n return this;\n }\n\n toString(options?: { color?: boolean }) {\n const name = this.nameToString(options);\n if (!this.typeArgs) {\n return name;\n }\n const args = this.typeArgs.map((arg) => arg.toString(options)).join(', ');\n return `${name}<${args}>`;\n }\n\n private nameToString(options?: { color?: boolean }) {\n const dim = options?.color ? chalk.dim : (str: string) => str;\n if (this.componentId) {\n const compStr = dim(`(component: ${this.componentId.toStringWithoutVersion()})`);\n return `${compStr} ${this.name}`;\n }\n if (this.packageName) {\n const pkgStr = dim(`(package: ${this.packageName})`);\n return `${pkgStr} ${this.name}`;\n }\n return this.name;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n let signature = this.name;\n\n if (this.typeArgs && this.typeArgs.length > 0) {\n const argsSignatures = this.typeArgs.map((arg) => arg.toFullSignature(options)).join(', ');\n signature += `<${argsSignatures}>`;\n }\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n\n /**\n * whether this type was already exported in this component\n */\n isFromThisComponent() {\n return !this.componentId && !this.packageName;\n }\n\n /**\n * whether this type is internal to the file.\n */\n isInternalReference() {\n return !!this.internalFilePath && this.isFromThisComponent();\n }\n\n /**\n * whether this type is exported from this component.\n */\n isExported() {\n return this.isFromThisComponent() && !this.isInternalReference();\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n componentId: this.componentId ? this.componentId.toObject() : undefined,\n packageName: this.packageName,\n internalFilePath: this.internalFilePath,\n typeArgs: this.typeArgs?.map((type) => type.toObject()),\n };\n }\n\n static fromObject(obj: Record<string, any>): TypeRefSchema {\n const location = obj.location;\n const name = obj.name;\n let componentId;\n try {\n componentId = obj.componentId ? ComponentID.fromObject(obj.componentId) : undefined;\n } catch {\n componentId = undefined;\n }\n const packageName = obj.packageName;\n const internalFilePath = obj.internalFilePath;\n const typeArgs = obj.typeArgs?.map((type: any) => SchemaRegistry.fromObject(type));\n return new TypeRefSchema(location, name, componentId, packageName, internalFilePath).withTypeArgs(typeArgs);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA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,GAAG,CAACnC,IAAI;IACrB,IAAIC,WAAW;IACf,IAAI;MACFA,WAAW,GAAGkC,GAAG,CAAClC,WAAW,GAAGmC,wBAAW,CAACF,UAAU,CAACC,GAAG,CAAClC,WAAW,CAAC,GAAG+B,SAAS;IACrF,CAAC,CAAC,MAAM;MACN/B,WAAW,GAAG+B,SAAS;IACzB;IACA,MAAM9B,WAAW,GAAGiC,GAAG,CAACjC,WAAW;IACnC,MAAMC,gBAAgB,GAAGgC,GAAG,CAAChC,gBAAgB;IAC7C,MAAME,QAAQ,GAAG8B,GAAG,CAAC9B,QAAQ,EAAEM,GAAG,CAAEsB,IAAS,IAAKI,gCAAc,CAACH,UAAU,CAACD,IAAI,CAAC,CAAC;IAClF,OAAO,IAAIrC,aAAa,CAACG,QAAQ,EAAEC,IAAI,EAAEC,WAAW,EAAEC,WAAW,EAAEC,gBAAgB,CAAC,CAACG,YAAY,CAACD,QAAQ,CAAC;EAC7G;AACF;AAACiC,OAAA,CAAA1C,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
export declare class TypeUnionSchema extends SchemaNode {
|
|
3
|
+
readonly location: SchemaLocation;
|
|
4
|
+
readonly types: SchemaNode[];
|
|
5
|
+
constructor(location: SchemaLocation, types: SchemaNode[]);
|
|
6
|
+
toString(options?: {
|
|
7
|
+
color?: boolean;
|
|
8
|
+
}): string;
|
|
9
|
+
toFullSignature(options?: {
|
|
10
|
+
showDocs?: boolean;
|
|
11
|
+
}): string;
|
|
12
|
+
getNodes(): SchemaNode[];
|
|
13
|
+
toObject(): {
|
|
14
|
+
types: Record<string, any>[];
|
|
15
|
+
};
|
|
16
|
+
static fromObject(obj: Record<string, any>): TypeUnionSchema;
|
|
17
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TypeUnionSchema = void 0;
|
|
7
|
+
function _schemaNode() {
|
|
8
|
+
const data = require("../schema-node");
|
|
9
|
+
_schemaNode = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _schemaRegistry() {
|
|
15
|
+
const data = require("../schema-registry");
|
|
16
|
+
_schemaRegistry = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
class TypeUnionSchema extends _schemaNode().SchemaNode {
|
|
22
|
+
constructor(location, types) {
|
|
23
|
+
super();
|
|
24
|
+
this.location = location;
|
|
25
|
+
this.types = types;
|
|
26
|
+
}
|
|
27
|
+
toString(options) {
|
|
28
|
+
return `${this.types.map(type => type.toString(options)).join(' | ')}`;
|
|
29
|
+
}
|
|
30
|
+
toFullSignature(options) {
|
|
31
|
+
const typeSignatures = this.types.map(type => type.toFullSignature(options));
|
|
32
|
+
let signature = typeSignatures.join(' | ');
|
|
33
|
+
if (options?.showDocs && this.doc) {
|
|
34
|
+
const docString = this.doc.toFullSignature();
|
|
35
|
+
signature = `${docString}\n${signature}`;
|
|
36
|
+
}
|
|
37
|
+
return signature;
|
|
38
|
+
}
|
|
39
|
+
getNodes() {
|
|
40
|
+
return this.types;
|
|
41
|
+
}
|
|
42
|
+
toObject() {
|
|
43
|
+
return {
|
|
44
|
+
...super.toObject(),
|
|
45
|
+
types: this.types.map(type => type.toObject())
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static fromObject(obj) {
|
|
49
|
+
const location = obj.location;
|
|
50
|
+
const types = obj.types.map(type => _schemaRegistry().SchemaRegistry.fromObject(type));
|
|
51
|
+
return new TypeUnionSchema(location, types);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.TypeUnionSchema = TypeUnionSchema;
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=type-union.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_schemaNode","data","require","_schemaRegistry","TypeUnionSchema","SchemaNode","constructor","location","types","toString","options","map","type","join","toFullSignature","typeSignatures","signature","showDocs","doc","docString","getNodes","toObject","fromObject","obj","SchemaRegistry","exports"],"sources":["type-union.ts"],"sourcesContent":["import { SchemaLocation, SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\n\nexport class TypeUnionSchema extends SchemaNode {\n readonly types: SchemaNode[];\n constructor(\n readonly location: SchemaLocation,\n types: SchemaNode[]\n ) {\n super();\n this.types = types;\n }\n toString(options?: { color?: boolean }) {\n return `${this.types.map((type) => type.toString(options)).join(' | ')}`;\n }\n toFullSignature(options?: { showDocs?: boolean }): string {\n const typeSignatures = this.types.map((type) => type.toFullSignature(options));\n let signature = typeSignatures.join(' | ');\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n getNodes() {\n return this.types;\n }\n toObject() {\n return {\n ...super.toObject(),\n types: this.types.map((type) => type.toObject()),\n };\n }\n static fromObject(obj: Record<string, any>): TypeUnionSchema {\n const location = obj.location;\n const types = obj.types.map((type: any) => SchemaRegistry.fromObject(type));\n return new TypeUnionSchema(location, types);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,eAAe,SAASC,wBAAU,CAAC;EAE9CC,WAAWA,CACAC,QAAwB,EACjCC,KAAmB,EACnB;IACA,KAAK,CAAC,CAAC;IAAC,KAHCD,QA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ACiB,OAAA,CAAArB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
import { DocSchema } from './docs';
|
|
3
|
+
export declare class TypeSchema extends SchemaNode {
|
|
4
|
+
readonly location: SchemaLocation;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly signature: string;
|
|
7
|
+
readonly type: SchemaNode;
|
|
8
|
+
readonly doc?: DocSchema;
|
|
9
|
+
constructor(location: SchemaLocation, name: string, type: SchemaNode, signature: string, doc?: DocSchema);
|
|
10
|
+
toString(options?: {
|
|
11
|
+
color?: boolean;
|
|
12
|
+
}): string;
|
|
13
|
+
toFullSignature(options?: {
|
|
14
|
+
showDocs?: boolean;
|
|
15
|
+
}): string;
|
|
16
|
+
getNodes(): SchemaNode[];
|
|
17
|
+
toObject(): {
|
|
18
|
+
name: string;
|
|
19
|
+
type: Record<string, any>;
|
|
20
|
+
signature: string;
|
|
21
|
+
};
|
|
22
|
+
static fromObject(obj: Record<string, any>): TypeSchema;
|
|
23
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TypeSchema = void 0;
|
|
7
|
+
function _chalk() {
|
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
9
|
+
_chalk = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _schemaNode() {
|
|
15
|
+
const data = require("../schema-node");
|
|
16
|
+
_schemaNode = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _docs() {
|
|
22
|
+
const data = require("./docs");
|
|
23
|
+
_docs = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _schemaRegistry() {
|
|
29
|
+
const data = require("../schema-registry");
|
|
30
|
+
_schemaRegistry = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
|
+
class TypeSchema extends _schemaNode().SchemaNode {
|
|
37
|
+
constructor(location, name, type, signature, doc) {
|
|
38
|
+
super();
|
|
39
|
+
this.location = location;
|
|
40
|
+
this.name = name;
|
|
41
|
+
this.signature = signature;
|
|
42
|
+
this.type = type;
|
|
43
|
+
this.doc = doc;
|
|
44
|
+
}
|
|
45
|
+
toString(options) {
|
|
46
|
+
const bold = options?.color ? _chalk().default.bold : str => str;
|
|
47
|
+
return `type ${bold(this.name)}: ${this.type.toString(options)}`;
|
|
48
|
+
}
|
|
49
|
+
toFullSignature(options) {
|
|
50
|
+
const typeSignature = this.type.toFullSignature(options);
|
|
51
|
+
let signature = `type ${this.name}: ${typeSignature}`;
|
|
52
|
+
if (options?.showDocs && this.doc) {
|
|
53
|
+
const docString = this.doc.toFullSignature();
|
|
54
|
+
signature = `${docString}\n${signature}`;
|
|
55
|
+
}
|
|
56
|
+
return signature;
|
|
57
|
+
}
|
|
58
|
+
getNodes() {
|
|
59
|
+
return [this.type];
|
|
60
|
+
}
|
|
61
|
+
toObject() {
|
|
62
|
+
return {
|
|
63
|
+
...super.toObject(),
|
|
64
|
+
name: this.name,
|
|
65
|
+
type: this.type.toObject(),
|
|
66
|
+
signature: this.signature
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static fromObject(obj) {
|
|
70
|
+
const location = obj.location;
|
|
71
|
+
const name = obj.name;
|
|
72
|
+
const type = _schemaRegistry().SchemaRegistry.fromObject(obj.type);
|
|
73
|
+
const signature = obj.signature;
|
|
74
|
+
const doc = obj.doc ? _docs().DocSchema.fromObject(obj.doc) : undefined;
|
|
75
|
+
return new TypeSchema(location, name, type, signature, doc);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.TypeSchema = TypeSchema;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_schemaNode","_docs","_schemaRegistry","e","__esModule","default","TypeSchema","SchemaNode","constructor","location","name","type","signature","doc","toString","options","bold","color","chalk","str","toFullSignature","typeSignature","showDocs","docString","getNodes","toObject","fromObject","obj","SchemaRegistry","DocSchema","undefined","exports"],"sources":["type.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { SchemaLocation, SchemaNode } from '../schema-node';\nimport { DocSchema } from './docs';\nimport { SchemaRegistry } from '../schema-registry';\n\nexport class TypeSchema extends SchemaNode {\n readonly type: SchemaNode;\n readonly doc?: DocSchema;\n\n constructor(\n readonly location: SchemaLocation,\n readonly name: string,\n type: SchemaNode,\n readonly signature: string,\n doc?: DocSchema\n ) {\n super();\n this.type = type;\n this.doc = doc;\n }\n\n toString(options?: { color?: boolean }) {\n const bold = options?.color ? chalk.bold : (str: string) => str;\n return `type ${bold(this.name)}: ${this.type.toString(options)}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n const typeSignature = this.type.toFullSignature(options);\n\n let signature = `type ${this.name}: ${typeSignature}`;\n\n if (options?.showDocs && this.doc) {\n const docString = this.doc.toFullSignature();\n signature = `${docString}\\n${signature}`;\n }\n\n return signature;\n }\n\n getNodes() {\n return [this.type];\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n type: this.type.toObject(),\n signature: this.signature,\n };\n }\n\n static fromObject(obj: Record<string, any>): TypeSchema {\n const location = obj.location;\n const name = obj.name;\n const type = SchemaRegistry.fromObject(obj.type);\n const signature = obj.signature;\n const doc = obj.doc ? DocSchema.fromObject(obj.doc) : undefined;\n return new TypeSchema(location, name, type, signature, doc);\n }\n}\n"],"mappings":";;;;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oreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
export declare class UnImplementedSchema extends SchemaNode {
|
|
3
|
+
readonly location: SchemaLocation;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly type: string;
|
|
6
|
+
readonly displaySchemaName = "Unimplemented Schemas";
|
|
7
|
+
constructor(location: SchemaLocation, name: string, type: string);
|
|
8
|
+
toString(): string;
|
|
9
|
+
toFullSignature(): string;
|
|
10
|
+
toObject(): {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
static fromObject(obj: Record<string, any>): UnImplementedSchema;
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnImplementedSchema = void 0;
|
|
7
|
+
function _schemaNode() {
|
|
8
|
+
const data = require("../schema-node");
|
|
9
|
+
_schemaNode = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
class UnImplementedSchema extends _schemaNode().SchemaNode {
|
|
15
|
+
displaySchemaName = 'Unimplemented Schemas';
|
|
16
|
+
constructor(location, name, type) {
|
|
17
|
+
super();
|
|
18
|
+
this.location = location;
|
|
19
|
+
this.name = name;
|
|
20
|
+
this.type = type;
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
|
+
return `<<unimplemented schema ${this.name} of type ${this.type}>>`;
|
|
24
|
+
}
|
|
25
|
+
toFullSignature() {
|
|
26
|
+
return `<<unimplemented schema ${this.name} of type ${this.type}>>`;
|
|
27
|
+
}
|
|
28
|
+
toObject() {
|
|
29
|
+
return {
|
|
30
|
+
...super.toObject(),
|
|
31
|
+
type: this.type
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static fromObject(obj) {
|
|
35
|
+
const location = obj.location;
|
|
36
|
+
const name = obj.name;
|
|
37
|
+
const type = obj.type;
|
|
38
|
+
return new UnImplementedSchema(location, name, type);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.UnImplementedSchema = UnImplementedSchema;
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=unimplemented-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_schemaNode","data","require","UnImplementedSchema","SchemaNode","displaySchemaName","constructor","location","name","type","toString","toFullSignature","toObject","fromObject","obj","exports"],"sources":["unimplemented-schema.ts"],"sourcesContent":["import { SchemaLocation, SchemaNode } from '../schema-node';\n\nexport class UnImplementedSchema extends SchemaNode {\n readonly displaySchemaName = 'Unimplemented Schemas';\n\n constructor(\n readonly location: SchemaLocation,\n readonly name: string,\n readonly type: string\n ) {\n super();\n }\n\n toString() {\n return `<<unimplemented schema ${this.name} of type ${this.type}>>`;\n }\n\n toFullSignature(): string {\n return `<<unimplemented schema ${this.name} of type ${this.type}>>`;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n type: this.type,\n };\n }\n\n static fromObject(obj: Record<string, any>): UnImplementedSchema {\n const location = obj.location;\n const name = obj.name;\n const type = obj.type;\n return new UnImplementedSchema(location, name, type);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,mBAAmB,SAASC,wBAAU,CAAC;EACzCC,iBAAiB,GAAG,uBAAuB;EAEpDC,WAAWA,CACAC,QAAwB,EACxBC,IAAY,EACZC,IAAY,EACrB;IACA,KAAK,CAAC,CAAC;IAAC,KAJCF,QAAwB,GAAxBA,QAAwB;IAAA,KACxBC,IAAY,GAAZA,IAAY;IAAA,KACZC,IAAY,GAAZA,IAAY;EAGvB;EAEAC,QAAQA,CAAA,EAAG;IACT,OAAO,0BAA0B,IAAI,CAACF,IAAI,YAAY,IAAI,CAACC,IAAI,IAAI;EACrE;EAEAE,eAAeA,CAAA,EAAW;IACxB,OAAO,0BAA0B,IAAI,CAACH,IAAI,YAAY,IAAI,CAACC,IAAI,IAAI;EACrE;EAEAG,QAAQA,CAAA,EAAG;IACT,OAAO;MACL,GAAG,KAAK,CAACA,QAAQ,CAAC,CAAC;MACnBH,IAAI,EAAE,IAAI,CAACA;IACb,CAAC;EACH;EAEA,OAAOI,UAAUA,CAACC,GAAwB,EAAuB;IAC/D,MAAMP,QAAQ,GAAGO,GAAG,CAACP,QAAQ;IAC7B,MAAMC,IAAI,GAAGM,GAAG,CAACN,IAAI;IACrB,MAAMC,IAAI,GAAGK,GAAG,CAACL,IAAI;IACrB,OAAO,IAAIN,mBAAmB,CAACI,QAAQ,EAAEC,IAAI,EAAEC,IAAI,CAAC;EACtD;AACF;AAACM,OAAA,CAAAZ,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
/**
|
|
3
|
+
* needed for better backward and forward compatibility.
|
|
4
|
+
* in case a previous version of the semantic-schema had a schema class that doesn't exist anymore, then it'll be
|
|
5
|
+
* wrapped in this class.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UnknownSchema extends SchemaNode {
|
|
8
|
+
readonly location: SchemaLocation;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly schemaObj: Record<string, any>;
|
|
11
|
+
constructor(location: SchemaLocation, name: string, schemaObj: Record<string, any>);
|
|
12
|
+
toString(): string;
|
|
13
|
+
toFullSignature(): string;
|
|
14
|
+
toObject(): {
|
|
15
|
+
schemaObj: Record<string, any>;
|
|
16
|
+
};
|
|
17
|
+
static fromObject(obj: Record<string, any>): UnknownSchema;
|
|
18
|
+
}
|