@teambit/semantics.entities.semantic-schema 0.0.78 → 0.0.80
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/dist/api-schema.d.ts +3 -3
- package/dist/api-schema.js +160 -115
- package/dist/api-schema.js.map +1 -1
- package/dist/export.d.ts +2 -2
- package/dist/export.js +27 -23
- package/dist/export.js.map +1 -1
- package/dist/index.js +134 -39
- package/dist/index.js.map +1 -1
- package/dist/schema-node-constructor.js +1 -1
- package/dist/schema-node-constructor.js.map +1 -1
- package/dist/schema-node.js +45 -40
- package/dist/schema-node.js.map +1 -1
- package/dist/schema-registry.js +36 -23
- package/dist/schema-registry.js.map +1 -1
- package/dist/schemas/array-literal-expression.js +43 -23
- package/dist/schemas/array-literal-expression.js.map +1 -1
- package/dist/schemas/class.d.ts +17 -17
- package/dist/schemas/class.js +116 -83
- package/dist/schemas/class.js.map +1 -1
- package/dist/schemas/conditional-type.js +58 -36
- package/dist/schemas/conditional-type.js.map +1 -1
- package/dist/schemas/constructor.js +46 -18
- package/dist/schemas/constructor.js.map +1 -1
- package/dist/schemas/decorator.d.ts +12 -12
- package/dist/schemas/decorator.js +64 -40
- package/dist/schemas/decorator.js.map +1 -1
- package/dist/schemas/docs/doc.d.ts +10 -10
- package/dist/schemas/docs/doc.js +66 -51
- package/dist/schemas/docs/doc.js.map +1 -1
- package/dist/schemas/docs/index.js +57 -10
- package/dist/schemas/docs/index.js.map +1 -1
- package/dist/schemas/docs/property-like-tag.d.ts +5 -5
- package/dist/schemas/docs/property-like-tag.js +51 -32
- package/dist/schemas/docs/property-like-tag.js.map +1 -1
- package/dist/schemas/docs/return-tag.d.ts +6 -6
- package/dist/schemas/docs/return-tag.js +47 -29
- package/dist/schemas/docs/return-tag.js.map +1 -1
- package/dist/schemas/docs/tag.d.ts +5 -5
- package/dist/schemas/docs/tag.js +68 -58
- package/dist/schemas/docs/tag.js.map +1 -1
- package/dist/schemas/enum-member.d.ts +11 -11
- package/dist/schemas/enum-member.js +59 -40
- package/dist/schemas/enum-member.js.map +1 -1
- package/dist/schemas/enum.d.ts +8 -8
- package/dist/schemas/enum.js +81 -52
- package/dist/schemas/enum.js.map +1 -1
- package/dist/schemas/export.d.ts +9 -9
- package/dist/schemas/export.js +84 -58
- package/dist/schemas/export.js.map +1 -1
- package/dist/schemas/expression-with-arguments.js +53 -31
- package/dist/schemas/expression-with-arguments.js.map +1 -1
- package/dist/schemas/function-like.d.ts +16 -16
- package/dist/schemas/function-like.js +136 -99
- package/dist/schemas/function-like.js.map +1 -1
- package/dist/schemas/get-accessor.js +67 -42
- package/dist/schemas/get-accessor.js.map +1 -1
- package/dist/schemas/ignored.d.ts +1 -1
- package/dist/schemas/ignored.js +49 -30
- package/dist/schemas/ignored.js.map +1 -1
- package/dist/schemas/index-signature.js +55 -28
- package/dist/schemas/index-signature.js.map +1 -1
- package/dist/schemas/index.js +620 -107
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/indexed-access-type.js +50 -30
- package/dist/schemas/indexed-access-type.js.map +1 -1
- package/dist/schemas/inference-type.d.ts +8 -8
- package/dist/schemas/inference-type.js +54 -38
- package/dist/schemas/inference-type.js.map +1 -1
- package/dist/schemas/interface.d.ts +11 -11
- package/dist/schemas/interface.js +100 -67
- package/dist/schemas/interface.js.map +1 -1
- package/dist/schemas/keyword-type.js +35 -22
- package/dist/schemas/keyword-type.js.map +1 -1
- package/dist/schemas/literal-type.js +35 -22
- package/dist/schemas/literal-type.js.map +1 -1
- package/dist/schemas/literal-value.js +36 -23
- package/dist/schemas/literal-value.js.map +1 -1
- package/dist/schemas/module.d.ts +1 -1
- package/dist/schemas/module.js +81 -57
- package/dist/schemas/module.js.map +1 -1
- package/dist/schemas/named-tuple.d.ts +3 -3
- package/dist/schemas/named-tuple.js +48 -28
- package/dist/schemas/named-tuple.js.map +1 -1
- package/dist/schemas/object-literal-expression.js +47 -30
- package/dist/schemas/object-literal-expression.js.map +1 -1
- package/dist/schemas/parameter.d.ts +5 -5
- package/dist/schemas/parameter.js +83 -61
- package/dist/schemas/parameter.js.map +1 -1
- package/dist/schemas/parenthesized-type.js +45 -26
- package/dist/schemas/parenthesized-type.js.map +1 -1
- package/dist/schemas/property-assignment.d.ts +10 -10
- package/dist/schemas/property-assignment.js +61 -34
- package/dist/schemas/property-assignment.js.map +1 -1
- package/dist/schemas/set-accessor.d.ts +2 -2
- package/dist/schemas/set-accessor.js +60 -35
- package/dist/schemas/set-accessor.js.map +1 -1
- package/dist/schemas/template-literal-type-span.js +48 -28
- package/dist/schemas/template-literal-type-span.js.map +1 -1
- package/dist/schemas/template-literal-type.js +47 -27
- package/dist/schemas/template-literal-type.js.map +1 -1
- package/dist/schemas/this-type.js +29 -19
- package/dist/schemas/this-type.js.map +1 -1
- package/dist/schemas/tuple-type.js +42 -23
- package/dist/schemas/tuple-type.js.map +1 -1
- package/dist/schemas/type-array.js +45 -26
- package/dist/schemas/type-array.js.map +1 -1
- package/dist/schemas/type-intersection.js +45 -26
- package/dist/schemas/type-intersection.js.map +1 -1
- package/dist/schemas/type-literal.js +56 -37
- package/dist/schemas/type-literal.js.map +1 -1
- package/dist/schemas/type-operator.js +48 -28
- package/dist/schemas/type-operator.js.map +1 -1
- package/dist/schemas/type-predicate.d.ts +1 -1
- package/dist/schemas/type-predicate.js +56 -36
- package/dist/schemas/type-predicate.js.map +1 -1
- package/dist/schemas/type-query.js +51 -31
- package/dist/schemas/type-query.js.map +1 -1
- package/dist/schemas/type-ref.d.ts +8 -8
- package/dist/schemas/type-ref.js +138 -101
- package/dist/schemas/type-ref.js.map +1 -1
- package/dist/schemas/type-union.js +50 -31
- package/dist/schemas/type-union.js.map +1 -1
- package/dist/schemas/type.js +74 -43
- package/dist/schemas/type.js.map +1 -1
- package/dist/schemas/unimplemented-schema.js +37 -24
- package/dist/schemas/unimplemented-schema.js.map +1 -1
- package/dist/schemas/unknown-schema.js +37 -24
- package/dist/schemas/unknown-schema.js.map +1 -1
- package/dist/schemas/unresolved-schema.js +32 -22
- package/dist/schemas/unresolved-schema.js.map +1 -1
- package/dist/schemas/variable-like.d.ts +11 -11
- package/dist/schemas/variable-like.js +84 -51
- package/dist/schemas/variable-like.js.map +1 -1
- package/dist/type.js +1 -1
- package/dist/type.js.map +1 -1
- package/dist/unknown-schema-factory.js +13 -7
- package/dist/unknown-schema-factory.js.map +1 -1
- package/package.json +4 -4
- package/types/asset.d.ts +15 -3
- package/dist/preview-1737084088495.js +0 -7
|
@@ -1,45 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.ConditionalTypeSchema = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
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
|
+
}
|
|
6
21
|
/**
|
|
7
22
|
* e.g. `T extends U ? Y : N`
|
|
8
23
|
*
|
|
9
24
|
*/
|
|
10
|
-
class ConditionalTypeSchema extends
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
class ConditionalTypeSchema extends _schemaNode().SchemaNode {
|
|
26
|
+
constructor(location, checkType, extendsType, trueType, falseType) {
|
|
27
|
+
super();
|
|
28
|
+
this.location = location;
|
|
29
|
+
this.checkType = checkType;
|
|
30
|
+
this.extendsType = extendsType;
|
|
31
|
+
this.trueType = trueType;
|
|
32
|
+
this.falseType = falseType;
|
|
33
|
+
}
|
|
34
|
+
getNodes() {
|
|
35
|
+
return [this.checkType, this.extendsType, this.trueType, this.falseType];
|
|
36
|
+
}
|
|
37
|
+
toString() {
|
|
38
|
+
return `${this.checkType.toString()} extends ${this.extendsType.toString()} ? ${this.trueType.toString()} : ${this.falseType.toString()}`;
|
|
39
|
+
}
|
|
40
|
+
toFullSignature(options) {
|
|
41
|
+
const checkTypeStr = this.checkType.toFullSignature(options);
|
|
42
|
+
const extendsTypeStr = this.extendsType.toFullSignature(options);
|
|
43
|
+
const trueTypeStr = this.trueType.toFullSignature(options);
|
|
44
|
+
const falseTypeStr = this.falseType.toFullSignature(options);
|
|
45
|
+
return `${checkTypeStr} extends ${extendsTypeStr} ? ${trueTypeStr} : ${falseTypeStr}`;
|
|
46
|
+
}
|
|
47
|
+
toObject() {
|
|
48
|
+
return {
|
|
49
|
+
...super.toObject(),
|
|
50
|
+
checkType: this.checkType.toObject(),
|
|
51
|
+
extendsType: this.extendsType.toObject(),
|
|
52
|
+
trueType: this.trueType.toObject(),
|
|
53
|
+
falseType: this.falseType.toObject()
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
static fromObject(obj) {
|
|
57
|
+
const location = obj.location;
|
|
58
|
+
const checkType = _schemaRegistry().SchemaRegistry.fromObject(obj.checkType);
|
|
59
|
+
const extendsType = _schemaRegistry().SchemaRegistry.fromObject(obj.extendsType);
|
|
60
|
+
const trueType = _schemaRegistry().SchemaRegistry.fromObject(obj.trueType);
|
|
61
|
+
const falseType = _schemaRegistry().SchemaRegistry.fromObject(obj.falseType);
|
|
62
|
+
return new ConditionalTypeSchema(location, checkType, extendsType, trueType, falseType);
|
|
63
|
+
}
|
|
43
64
|
}
|
|
44
65
|
exports.ConditionalTypeSchema = ConditionalTypeSchema;
|
|
66
|
+
|
|
45
67
|
//# sourceMappingURL=conditional-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_schemaNode","data","require","_schemaRegistry","ConditionalTypeSchema","SchemaNode","constructor","location","checkType","extendsType","trueType","falseType","getNodes","toString","toFullSignature","options","checkTypeStr","extendsTypeStr","trueTypeStr","falseTypeStr","toObject","fromObject","obj","SchemaRegistry","exports"],"sources":["conditional-type.ts"],"sourcesContent":["import { SchemaLocation, SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\n\n/**\n * e.g. `T extends U ? Y : N`\n *\n */\nexport class ConditionalTypeSchema extends SchemaNode {\n readonly checkType: SchemaNode;\n readonly extendsType: SchemaNode;\n readonly trueType: SchemaNode;\n readonly falseType: SchemaNode;\n\n constructor(\n readonly location: SchemaLocation,\n checkType: SchemaNode,\n extendsType: SchemaNode,\n trueType: SchemaNode,\n falseType: SchemaNode\n ) {\n super();\n this.checkType = checkType;\n this.extendsType = extendsType;\n this.trueType = trueType;\n this.falseType = falseType;\n }\n\n getNodes() {\n return [this.checkType, this.extendsType, this.trueType, this.falseType];\n }\n\n toString() {\n return `${this.checkType.toString()} extends ${this.extendsType.toString()} ? ${this.trueType.toString()} : ${this.falseType.toString()}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n const checkTypeStr = this.checkType.toFullSignature(options);\n const extendsTypeStr = this.extendsType.toFullSignature(options);\n const trueTypeStr = this.trueType.toFullSignature(options);\n const falseTypeStr = this.falseType.toFullSignature(options);\n\n return `${checkTypeStr} extends ${extendsTypeStr} ? ${trueTypeStr} : ${falseTypeStr}`;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n checkType: this.checkType.toObject(),\n extendsType: this.extendsType.toObject(),\n trueType: this.trueType.toObject(),\n falseType: this.falseType.toObject(),\n };\n }\n\n static fromObject(obj: Record<string, any>): ConditionalTypeSchema {\n const location = obj.location;\n const checkType = SchemaRegistry.fromObject(obj.checkType);\n const extendsType = SchemaRegistry.fromObject(obj.extendsType);\n const trueType = SchemaRegistry.fromObject(obj.trueType);\n const falseType = SchemaRegistry.fromObject(obj.falseType);\n return new ConditionalTypeSchema(location, checkType, extendsType, trueType, falseType);\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;AACO,MAAMG,qBAAqB,SAASC,wBAAU,CAAC;EAMpDC,WAAWA,CACAC,QAAwB,EACjCC,SAAqB,EACrBC,WAAuB,EACvBC,QAAoB,EACpBC,SAAqB,EACrB;IACA,KAAK,CAAC,CAAC;IAAC,KANCJ,QAAwB,GAAxBA,QAAwB;IAOjC,IAAI,CAACC,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC5B;EAEAC,QAAQA,CAAA,EAAG;IACT,OAAO,CAAC,IAAI,CAACJ,SAAS,EAAE,IAAI,CAACC,WAAW,EAAE,IAAI,CAACC,QAAQ,EAAE,IAAI,CAACC,SAAS,CAAC;EAC1E;EAEAE,QAAQA,CAAA,EAAG;IACT,OAAO,GAAG,IAAI,CAACL,SAAS,CAACK,QAAQ,CAAC,CAAC,YAAY,IAAI,CAACJ,WAAW,CAACI,QAAQ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c,CAACF,UAAU,CAACC,GAAG,CAACX,SAAS,CAAC;IAC1D,OAAO,IAAIP,qBAAqB,CAACG,QAAQ,EAAEC,SAAS,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,CAAC;EACzF;AACF;AAACa,OAAA,CAAApB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,23 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.ConstructorSchema = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
function _parameter() {
|
|
8
|
+
const data = require("./parameter");
|
|
9
|
+
_parameter = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _functionLike() {
|
|
15
|
+
const data = require("./function-like");
|
|
16
|
+
_functionLike = 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 _thisType() {
|
|
29
|
+
const data = require("./this-type");
|
|
30
|
+
_thisType = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
class ConstructorSchema extends _functionLike().FunctionLikeSchema {
|
|
36
|
+
constructor(location, params, returnType, signature, modifiers = [], doc) {
|
|
37
|
+
super(location, 'constructor', params, returnType, signature, modifiers, doc, undefined);
|
|
38
|
+
}
|
|
39
|
+
static fromObject(obj) {
|
|
40
|
+
const location = obj.location;
|
|
41
|
+
const params = obj.params.map(param => _parameter().ParameterSchema.fromObject(param));
|
|
42
|
+
const returns = _thisType().ThisTypeSchema.fromObject(obj.returnType);
|
|
43
|
+
const signature = obj.signature;
|
|
44
|
+
const modifiers = obj.modifiers;
|
|
45
|
+
const doc = obj.doc ? _docs().DocSchema.fromObject(obj.doc) : undefined;
|
|
46
|
+
return new ConstructorSchema(location, params, returns, signature, modifiers, doc);
|
|
47
|
+
}
|
|
21
48
|
}
|
|
22
49
|
exports.ConstructorSchema = ConstructorSchema;
|
|
50
|
+
|
|
23
51
|
//# sourceMappingURL=constructor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_parameter","data","require","_functionLike","_docs","_thisType","ConstructorSchema","FunctionLikeSchema","constructor","location","params","returnType","signature","modifiers","doc","undefined","fromObject","obj","map","param","ParameterSchema","returns","ThisTypeSchema","DocSchema","exports"],"sources":["constructor.ts"],"sourcesContent":["import { SchemaLocation } from '../schema-node';\nimport { ParameterSchema } from './parameter';\nimport { FunctionLikeSchema, Modifier } from './function-like';\nimport { DocSchema } from './docs';\nimport { ThisTypeSchema } from './this-type';\n\nexport class ConstructorSchema extends FunctionLikeSchema {\n constructor(\n location: SchemaLocation,\n params: ParameterSchema[],\n returnType: ThisTypeSchema,\n signature: string,\n modifiers: Modifier[] = [],\n doc?: DocSchema\n ) {\n super(location, 'constructor', params, returnType, signature, modifiers, doc, undefined);\n }\n\n static fromObject(obj: Record<string, any>): ConstructorSchema {\n const location = obj.location;\n const params = obj.params.map((param: any) => ParameterSchema.fromObject(param));\n const returns = ThisTypeSchema.fromObject(obj.returnType);\n const signature = obj.signature;\n const modifiers = obj.modifiers;\n const doc = obj.doc ? DocSchema.fromObject(obj.doc) : undefined;\n return new ConstructorSchema(location, params, returns, signature, modifiers, doc);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G,GAAG,CAACH,GAAG,GAAGS,iBAAS,CAACP,UAAU,CAACC,GAAG,CAACH,GAAG,CAAC,GAAGC,SAAS;IAC/D,OAAO,IAAIT,iBAAiB,CAACG,QAAQ,EAAEC,MAAM,EAAEW,OAAO,EAAET,SAAS,EAAEC,SAAS,EAAEC,GAAG,CAAC;EACpF;AACF;AAACU,OAAA,CAAAlB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -3,9 +3,9 @@ import { DocSchema } from './docs';
|
|
|
3
3
|
export declare class DecoratorSchema extends SchemaNode {
|
|
4
4
|
readonly location: SchemaLocation;
|
|
5
5
|
readonly name: string;
|
|
6
|
-
readonly doc?: DocSchema;
|
|
7
|
-
readonly args?: SchemaNode[];
|
|
8
|
-
constructor(location: SchemaLocation, name: string, doc?: DocSchema, args?: SchemaNode[]);
|
|
6
|
+
readonly doc?: DocSchema | undefined;
|
|
7
|
+
readonly args?: SchemaNode[] | undefined;
|
|
8
|
+
constructor(location: SchemaLocation, name: string, doc?: DocSchema | undefined, args?: SchemaNode[] | undefined);
|
|
9
9
|
getNodes(): SchemaNode[];
|
|
10
10
|
toString(): string;
|
|
11
11
|
toFullSignature(options?: {
|
|
@@ -15,21 +15,21 @@ export declare class DecoratorSchema extends SchemaNode {
|
|
|
15
15
|
name: string;
|
|
16
16
|
doc: {
|
|
17
17
|
__schema: string;
|
|
18
|
-
name: string;
|
|
18
|
+
name: string | undefined;
|
|
19
19
|
location: SchemaLocation;
|
|
20
|
-
signature: string;
|
|
20
|
+
signature: string | undefined;
|
|
21
21
|
raw: string;
|
|
22
|
-
comment: string;
|
|
22
|
+
comment: string | undefined;
|
|
23
23
|
tags: {
|
|
24
24
|
__schema: string;
|
|
25
25
|
location: SchemaLocation;
|
|
26
|
-
name: string;
|
|
27
|
-
signature: string;
|
|
26
|
+
name: string | undefined;
|
|
27
|
+
signature: string | undefined;
|
|
28
28
|
tagName: string;
|
|
29
|
-
comment: string;
|
|
30
|
-
}[];
|
|
31
|
-
};
|
|
32
|
-
args: Record<string, any>[];
|
|
29
|
+
comment: string | undefined;
|
|
30
|
+
}[] | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
args: Record<string, any>[] | undefined;
|
|
33
33
|
};
|
|
34
34
|
static fromObject(obj: Record<string, any>): DecoratorSchema;
|
|
35
35
|
}
|
|
@@ -1,46 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.DecoratorSchema = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
+
function _docs() {
|
|
22
|
+
const data = require("./docs");
|
|
23
|
+
_docs = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
class DecoratorSchema extends _schemaNode().SchemaNode {
|
|
29
|
+
constructor(location, name, doc, args) {
|
|
30
|
+
super();
|
|
31
|
+
this.location = location;
|
|
32
|
+
this.name = name;
|
|
33
|
+
this.doc = doc;
|
|
34
|
+
this.args = args;
|
|
35
|
+
}
|
|
36
|
+
getNodes() {
|
|
37
|
+
return this.args || [];
|
|
38
|
+
}
|
|
39
|
+
toString() {
|
|
40
|
+
const argsStr = this.args?.map(arg => arg.toString()).join(', ');
|
|
41
|
+
return `@${this.name}${argsStr ? `(${argsStr})` : ''}`;
|
|
42
|
+
}
|
|
43
|
+
toFullSignature(options) {
|
|
44
|
+
let result = '';
|
|
45
|
+
if (options?.showDocs && this.doc) {
|
|
46
|
+
result += `${this.doc.toFullSignature()}\n`;
|
|
43
47
|
}
|
|
48
|
+
const argsStr = this.args?.map(arg => arg.toFullSignature(options)).join(', ');
|
|
49
|
+
result += `@${this.name}${argsStr ? `(${argsStr})` : ''}`;
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
toObject() {
|
|
53
|
+
return {
|
|
54
|
+
...super.toObject(),
|
|
55
|
+
name: this.name,
|
|
56
|
+
doc: this.doc?.toObject(),
|
|
57
|
+
args: this.args?.map(arg => arg.toObject())
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static fromObject(obj) {
|
|
61
|
+
const location = obj.location;
|
|
62
|
+
const name = obj.name;
|
|
63
|
+
const doc = obj.doc ? _docs().DocSchema.fromObject(obj.doc) : undefined;
|
|
64
|
+
const args = obj.args ? obj.args.map(arg => _schemaRegistry().SchemaRegistry.fromObject(arg)) : undefined;
|
|
65
|
+
return new DecoratorSchema(location, name, doc, args);
|
|
66
|
+
}
|
|
44
67
|
}
|
|
45
68
|
exports.DecoratorSchema = DecoratorSchema;
|
|
69
|
+
|
|
46
70
|
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_schemaNode","data","require","_schemaRegistry","_docs","DecoratorSchema","SchemaNode","constructor","location","name","doc","args","getNodes","toString","argsStr","map","arg","join","toFullSignature","options","result","showDocs","toObject","fromObject","obj","DocSchema","undefined","SchemaRegistry","exports"],"sources":["decorator.ts"],"sourcesContent":["import { SchemaLocation, SchemaNode } from '../schema-node';\nimport { SchemaRegistry } from '../schema-registry';\nimport { DocSchema } from './docs';\n\nexport class DecoratorSchema extends SchemaNode {\n constructor(\n readonly location: SchemaLocation,\n readonly name: string,\n readonly doc?: DocSchema,\n readonly args?: SchemaNode[]\n ) {\n super();\n }\n\n getNodes() {\n return this.args || [];\n }\n\n toString() {\n const argsStr = this.args?.map((arg) => arg.toString()).join(', ');\n return `@${this.name}${argsStr ? `(${argsStr})` : ''}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n let result = '';\n\n if (options?.showDocs && this.doc) {\n result += `${this.doc.toFullSignature()}\\n`;\n }\n\n const argsStr = this.args?.map((arg) => arg.toFullSignature(options)).join(', ');\n\n result += `@${this.name}${argsStr ? `(${argsStr})` : ''}`;\n\n return result;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n doc: this.doc?.toObject(),\n args: this.args?.map((arg) => arg.toObject()),\n };\n }\n\n static fromObject(obj: Record<string, any>): DecoratorSchema {\n const location = obj.location;\n const name = obj.name;\n const doc = obj.doc ? DocSchema.fromObject(obj.doc) : undefined;\n const args = obj.args ? obj.args.map((arg) => SchemaRegistry.fromObject(arg)) : undefined;\n return new DecoratorSchema(location, name, doc, args);\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,OAA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AG,EAAE,EAAE;IAEzD,OAAOM,MAAM;EACf;EAEAE,QAAQA,CAAA,EAAG;IACT,OAAO;MACL,GAAG,KAAK,CAACA,QAAQ,CAAC,CAAC;MACnBb,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,GAAG,EAAE,IAAI,CAACA,GAAG,EAAEY,QAAQ,CAAC,CAAC;MACzBX,IAAI,EAAE,IAAI,CAACA,IAAI,EAAEI,GAAG,CAAEC,GAAG,IAAKA,GAAG,CAACM,QAAQ,CAAC,CAAC;IAC9C,CAAC;EACH;EAEA,OAAOC,UAAUA,CAACC,GAAwB,EAAmB;IAC3D,MAAMhB,QAAQ,GAAGgB,GAAG,CAAChB,QAAQ;IAC7B,MAAMC,IAAI,GAAGe,GAAG,CAACf,IAAI;IACrB,MAAMC,GAAG,GAAGc,GAAG,CAACd,GAAG,GAAGe,iBAAS,CAACF,UAAU,CAACC,GAAG,CAACd,GAAG,CAAC,GAAGgB,SAAS;IAC/D,MAAMf,IAAI,GAAGa,GAAG,CAACb,IAAI,GAAGa,GAAG,CAACb,IAAI,CAACI,GAAG,CAAEC,GAAG,IAAKW,gCAAc,CAACJ,UAAU,CAACP,GAAG,CAAC,CAAC,GAAGU,SAAS;IACzF,OAAO,IAAIrB,eAAe,CAACG,QAAQ,EAAEC,IAAI,EAAEC,GAAG,EAAEC,IAAI,CAAC;EACvD;AACF;AAACiB,OAAA,CAAAvB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -3,28 +3,28 @@ import { TagName, TagSchema } from './tag';
|
|
|
3
3
|
export declare class DocSchema extends SchemaNode {
|
|
4
4
|
readonly location: SchemaLocation;
|
|
5
5
|
readonly raw: string;
|
|
6
|
-
readonly comment?: string;
|
|
6
|
+
readonly comment?: string | undefined;
|
|
7
7
|
readonly tags?: TagSchema[];
|
|
8
|
-
constructor(location: SchemaLocation, raw: string, comment?: string, tags?: TagSchema[]);
|
|
8
|
+
constructor(location: SchemaLocation, raw: string, comment?: string | undefined, tags?: TagSchema[]);
|
|
9
9
|
toString(): string;
|
|
10
10
|
toFullSignature(): string;
|
|
11
11
|
hasTag(tagName: TagName): boolean;
|
|
12
|
-
findTag(tagName: TagName): TagSchema;
|
|
12
|
+
findTag(tagName: TagName): TagSchema | undefined;
|
|
13
13
|
toObject(): {
|
|
14
14
|
__schema: string;
|
|
15
|
-
name: string;
|
|
15
|
+
name: string | undefined;
|
|
16
16
|
location: SchemaLocation;
|
|
17
|
-
signature: string;
|
|
17
|
+
signature: string | undefined;
|
|
18
18
|
raw: string;
|
|
19
|
-
comment: string;
|
|
19
|
+
comment: string | undefined;
|
|
20
20
|
tags: {
|
|
21
21
|
__schema: string;
|
|
22
22
|
location: SchemaLocation;
|
|
23
|
-
name: string;
|
|
24
|
-
signature: string;
|
|
23
|
+
name: string | undefined;
|
|
24
|
+
signature: string | undefined;
|
|
25
25
|
tagName: string;
|
|
26
|
-
comment: string;
|
|
27
|
-
}[];
|
|
26
|
+
comment: string | undefined;
|
|
27
|
+
}[] | undefined;
|
|
28
28
|
};
|
|
29
29
|
static fromObject(obj: Record<string, any>): DocSchema;
|
|
30
30
|
}
|
package/dist/schemas/docs/doc.js
CHANGED
|
@@ -1,59 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.DocSchema = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return Boolean(this.findTag(tagName));
|
|
36
|
-
}
|
|
37
|
-
findTag(tagName) {
|
|
38
|
-
var _a;
|
|
39
|
-
return (_a = this.tags) === null || _a === void 0 ? void 0 : _a.find((tag) => tag.tagName === tagName);
|
|
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 DocSchema extends _schemaNode().SchemaNode {
|
|
22
|
+
constructor(location, raw, comment, tags) {
|
|
23
|
+
super();
|
|
24
|
+
this.location = location;
|
|
25
|
+
this.raw = raw;
|
|
26
|
+
this.comment = comment;
|
|
27
|
+
this.tags = tags;
|
|
28
|
+
}
|
|
29
|
+
toString() {
|
|
30
|
+
const comment = this.comment ? `${this.comment}\n` : '';
|
|
31
|
+
const tags = this.tags ? this.tags.map(tag => tag.toString()).join('\n') : '';
|
|
32
|
+
return `${comment}${tags}`;
|
|
33
|
+
}
|
|
34
|
+
toFullSignature() {
|
|
35
|
+
const lines = [];
|
|
36
|
+
if (this.comment) {
|
|
37
|
+
lines.push(...this.comment.split('\n').map(line => ` * ${line.trim()}`));
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
location: this.location,
|
|
46
|
-
signature: this.signature,
|
|
47
|
-
raw: this.raw,
|
|
48
|
-
comment: this.comment,
|
|
49
|
-
tags: this.tags ? this.tags.map((tag) => tag.toObject()) : undefined,
|
|
50
|
-
};
|
|
39
|
+
if (this.tags && this.tags.length > 0) {
|
|
40
|
+
for (const tag of this.tags) {
|
|
41
|
+
lines.push(` * ${tag.toString().trim()}`);
|
|
42
|
+
}
|
|
51
43
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const tags = obj.tags ? obj.tags.map((tag) => schema_registry_1.SchemaRegistry.fromObject(tag)) : undefined;
|
|
55
|
-
return new DocSchema(location, obj.raw, obj.comment, tags);
|
|
44
|
+
if (lines.length === 0) {
|
|
45
|
+
return '';
|
|
56
46
|
}
|
|
47
|
+
return `/**\n${lines.join('\n')}\n */`;
|
|
48
|
+
}
|
|
49
|
+
hasTag(tagName) {
|
|
50
|
+
return Boolean(this.findTag(tagName));
|
|
51
|
+
}
|
|
52
|
+
findTag(tagName) {
|
|
53
|
+
return this.tags?.find(tag => tag.tagName === tagName);
|
|
54
|
+
}
|
|
55
|
+
toObject() {
|
|
56
|
+
return {
|
|
57
|
+
__schema: this.__schema,
|
|
58
|
+
name: this.name,
|
|
59
|
+
location: this.location,
|
|
60
|
+
signature: this.signature,
|
|
61
|
+
raw: this.raw,
|
|
62
|
+
comment: this.comment,
|
|
63
|
+
tags: this.tags ? this.tags.map(tag => tag.toObject()) : undefined
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
static fromObject(obj) {
|
|
67
|
+
const location = obj.location;
|
|
68
|
+
const tags = obj.tags ? obj.tags.map(tag => _schemaRegistry().SchemaRegistry.fromObject(tag)) : undefined;
|
|
69
|
+
return new DocSchema(location, obj.raw, obj.comment, tags);
|
|
70
|
+
}
|
|
57
71
|
}
|
|
58
72
|
exports.DocSchema = DocSchema;
|
|
73
|
+
|
|
59
74
|
//# sourceMappingURL=doc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_schemaNode","data","require","_schemaRegistry","DocSchema","SchemaNode","constructor","location","raw","comment","tags","toString","map","tag","join","toFullSignature","lines","push","split","line","trim","length","hasTag","tagName","Boolean","findTag","find","toObject","__schema","name","signature","undefined","fromObject","obj","SchemaRegistry","exports"],"sources":["doc.ts"],"sourcesContent":["import { SchemaLocation, SchemaNode } from '../../schema-node';\nimport { SchemaRegistry } from '../../schema-registry';\nimport { TagName, TagSchema } from './tag';\n\nexport class DocSchema extends SchemaNode {\n readonly tags?: TagSchema[];\n\n constructor(\n readonly location: SchemaLocation,\n readonly raw: string,\n readonly comment?: string,\n tags?: TagSchema[]\n ) {\n super();\n this.tags = tags;\n }\n\n toString() {\n const comment = this.comment ? `${this.comment}\\n` : '';\n const tags = this.tags ? this.tags.map((tag) => tag.toString()).join('\\n') : '';\n return `${comment}${tags}`;\n }\n\n toFullSignature(): string {\n const lines: string[] = [];\n\n if (this.comment) {\n lines.push(...this.comment.split('\\n').map((line) => ` * ${line.trim()}`));\n }\n\n if (this.tags && this.tags.length > 0) {\n for (const tag of this.tags) {\n lines.push(` * ${tag.toString().trim()}`);\n }\n }\n\n if (lines.length === 0) {\n return '';\n }\n\n return `/**\\n${lines.join('\\n')}\\n */`;\n }\n\n hasTag(tagName: TagName) {\n return Boolean(this.findTag(tagName));\n }\n\n findTag(tagName: TagName) {\n return this.tags?.find((tag) => tag.tagName === tagName);\n }\n\n toObject() {\n return {\n __schema: this.__schema,\n name: this.name,\n location: this.location,\n signature: this.signature,\n raw: this.raw,\n comment: this.comment,\n tags: this.tags ? this.tags.map((tag) => tag.toObject()) : undefined,\n };\n }\n\n static fromObject(obj: Record<string, any>): DocSchema {\n const location = obj.location;\n const tags = obj.tags ? obj.tags.map((tag: any) => SchemaRegistry.fromObject(tag)) : undefined;\n return new DocSchema(location, obj.raw, obj.comment, tags);\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,OAA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