@teambit/semantics.entities.semantic-schema 0.0.13 → 0.0.16
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 +13 -3
- package/class-transformers/comp-id-transformer.ts +22 -0
- package/class-transformers/index.ts +2 -0
- package/{schema-obj-to-class.ts → class-transformers/schema-obj-to-class.ts} +12 -3
- package/dist/api-schema.d.ts +3 -1
- package/dist/api-schema.js +13 -5
- package/dist/api-schema.js.map +1 -1
- package/dist/class-transformers/comp-id-transformer.d.ts +6 -0
- package/dist/class-transformers/comp-id-transformer.js +20 -0
- package/dist/class-transformers/comp-id-transformer.js.map +1 -0
- package/dist/class-transformers/index.d.ts +2 -0
- package/dist/class-transformers/index.js +9 -0
- package/dist/class-transformers/index.js.map +1 -0
- package/dist/{schema-obj-to-class.d.ts → class-transformers/schema-obj-to-class.d.ts} +3 -3
- package/dist/{schema-obj-to-class.js → class-transformers/schema-obj-to-class.js} +5 -2
- package/dist/class-transformers/schema-obj-to-class.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -28
- package/dist/index.js.map +1 -1
- package/dist/schema-node.d.ts +2 -0
- package/dist/schema-node.js.map +1 -1
- package/dist/schemas/class.d.ts +3 -1
- package/dist/schemas/class.js +7 -3
- package/dist/schemas/class.js.map +1 -1
- package/dist/schemas/constructor.js +2 -2
- package/dist/schemas/constructor.js.map +1 -1
- package/dist/schemas/docs/doc.d.ts +11 -0
- package/dist/schemas/docs/doc.js +37 -0
- package/dist/schemas/docs/doc.js.map +1 -0
- package/dist/schemas/docs/index.d.ts +3 -0
- package/dist/schemas/docs/index.js +10 -0
- package/dist/schemas/docs/index.js.map +1 -0
- package/dist/schemas/docs/return-tag.d.ts +13 -0
- package/dist/schemas/docs/return-tag.js +22 -0
- package/dist/schemas/docs/return-tag.js.map +1 -0
- package/dist/schemas/docs/tag.d.ts +33 -0
- package/dist/schemas/docs/tag.js +44 -0
- package/dist/schemas/docs/tag.js.map +1 -0
- package/dist/schemas/function-like.d.ts +5 -2
- package/dist/schemas/function-like.js +17 -7
- package/dist/schemas/function-like.js.map +1 -1
- package/dist/schemas/get-accessor.js +2 -2
- package/dist/schemas/get-accessor.js.map +1 -1
- package/dist/schemas/index-signature.js +3 -3
- package/dist/schemas/index-signature.js.map +1 -1
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/index.js +18 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/indexed-access-type.js +3 -3
- package/dist/schemas/indexed-access-type.js.map +1 -1
- package/dist/schemas/interface.js +2 -2
- package/dist/schemas/interface.js.map +1 -1
- package/dist/schemas/keyword-type.d.ts +1 -1
- package/dist/schemas/keyword-type.js.map +1 -1
- package/dist/schemas/module.js +2 -2
- package/dist/schemas/module.js.map +1 -1
- package/dist/schemas/parameter.js +2 -2
- package/dist/schemas/parameter.js.map +1 -1
- package/dist/schemas/parenthesized-type.js +2 -2
- package/dist/schemas/parenthesized-type.js.map +1 -1
- package/dist/schemas/set-accessor.js +2 -2
- package/dist/schemas/set-accessor.js.map +1 -1
- package/dist/schemas/template-literal-type-span.d.ts +8 -0
- package/dist/schemas/template-literal-type-span.js +28 -0
- package/dist/schemas/template-literal-type-span.js.map +1 -0
- package/dist/schemas/template-literal-type.d.ts +9 -0
- package/dist/schemas/template-literal-type.js +29 -0
- package/dist/schemas/template-literal-type.js.map +1 -0
- package/dist/schemas/this-type.d.ts +9 -0
- package/dist/schemas/this-type.js +18 -0
- package/dist/schemas/this-type.js.map +1 -0
- package/dist/schemas/tuple-type.js +2 -2
- package/dist/schemas/tuple-type.js.map +1 -1
- package/dist/schemas/type-array.js +2 -2
- package/dist/schemas/type-array.js.map +1 -1
- package/dist/schemas/type-intersection.js +2 -2
- package/dist/schemas/type-intersection.js.map +1 -1
- package/dist/schemas/type-literal.js +2 -2
- package/dist/schemas/type-literal.js.map +1 -1
- package/dist/schemas/type-operator.js +2 -2
- package/dist/schemas/type-operator.js.map +1 -1
- package/dist/schemas/type-predicate.js +2 -2
- package/dist/schemas/type-predicate.js.map +1 -1
- package/dist/schemas/type-query.js +2 -2
- package/dist/schemas/type-query.js.map +1 -1
- package/dist/schemas/type-ref.d.ts +1 -4
- package/dist/schemas/type-ref.js +7 -3
- package/dist/schemas/type-ref.js.map +1 -1
- package/dist/schemas/type-union.js +2 -2
- package/dist/schemas/type-union.js.map +1 -1
- package/dist/schemas/type.js +2 -2
- package/dist/schemas/type.js.map +1 -1
- package/dist/schemas/variable.d.ts +1 -1
- package/dist/schemas/variable.js +3 -3
- package/dist/schemas/variable.js.map +1 -1
- package/index.ts +2 -30
- package/package-tar/teambit-semantics.entities.semantic-schema-0.0.16.tgz +0 -0
- package/package.json +4 -5
- package/{preview-1653449228788.js → preview-1653708349111.js} +1 -1
- package/schema-node.ts +2 -0
- package/schemas/class.ts +8 -2
- package/schemas/constructor.ts +1 -1
- package/schemas/docs/doc.ts +27 -0
- package/schemas/docs/index.ts +3 -0
- package/schemas/docs/return-tag.ts +21 -0
- package/schemas/docs/tag.ts +38 -0
- package/schemas/function-like.ts +17 -6
- package/schemas/get-accessor.ts +1 -1
- package/schemas/index-signature.ts +1 -1
- package/schemas/index.ts +4 -0
- package/schemas/indexed-access-type.ts +1 -1
- package/schemas/interface.ts +1 -1
- package/schemas/keyword-type.ts +1 -1
- package/schemas/module.ts +1 -1
- package/schemas/parameter.ts +1 -1
- package/schemas/parenthesized-type.ts +1 -1
- package/schemas/set-accessor.ts +1 -1
- package/schemas/template-literal-type-span.ts +16 -0
- package/schemas/template-literal-type.ts +18 -0
- package/schemas/this-type.ts +14 -0
- package/schemas/tuple-type.ts +1 -1
- package/schemas/type-array.ts +1 -1
- package/schemas/type-intersection.ts +1 -1
- package/schemas/type-literal.ts +1 -1
- package/schemas/type-operator.ts +1 -1
- package/schemas/type-predicate.ts +1 -1
- package/schemas/type-query.ts +1 -1
- package/schemas/type-ref.ts +7 -10
- package/schemas/type-union.ts +1 -1
- package/schemas/type.ts +1 -1
- package/schemas/variable.ts +2 -2
- package/dist/json-schema.d.ts +0 -1
- package/dist/json-schema.js +0 -3
- package/dist/json-schema.js.map +0 -1
- package/dist/schema-obj-to-class.js.map +0 -1
- package/json-schema.ts +0 -1
- package/package-tar/teambit-semantics.entities.semantic-schema-0.0.13.tgz +0 -0
package/api-schema.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { Transform, plainToInstance } from 'class-transformer';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
+
import { ComponentID } from '@teambit/component-id';
|
|
3
4
|
import {
|
|
4
5
|
ClassSchema,
|
|
5
6
|
EnumSchema,
|
|
6
7
|
FunctionLikeSchema,
|
|
7
8
|
InterfaceSchema,
|
|
8
9
|
Module,
|
|
10
|
+
TypeRefSchema,
|
|
9
11
|
TypeSchema,
|
|
10
12
|
VariableSchema,
|
|
11
13
|
} from './schemas';
|
|
12
14
|
import { Location, SchemaNode } from './schema-node';
|
|
13
|
-
import { schemaObjToInstance } from './
|
|
15
|
+
import { schemaObjToInstance } from './class-transformers';
|
|
16
|
+
import { componentIdTransformer } from './class-transformers/comp-id-transformer';
|
|
14
17
|
|
|
15
18
|
export class APISchema extends SchemaNode {
|
|
16
19
|
@Transform(schemaObjToInstance)
|
|
17
20
|
readonly module: Module;
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
@Transform(componentIdTransformer)
|
|
23
|
+
readonly componentId: ComponentID;
|
|
24
|
+
|
|
25
|
+
constructor(readonly location: Location, module: Module, componentId: ComponentID) {
|
|
20
26
|
super();
|
|
21
27
|
this.module = module;
|
|
28
|
+
this.componentId = componentId;
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
toString() {
|
|
@@ -30,6 +37,7 @@ export class APISchema extends SchemaNode {
|
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
toStringPerType() {
|
|
40
|
+
const title = chalk.inverse(`API Schema of ${this.componentId.toString()}\n`);
|
|
33
41
|
const getSection = (ClassObj, sectionName: string) => {
|
|
34
42
|
const objects = this.module.exports.filter((exp) => exp instanceof ClassObj);
|
|
35
43
|
if (!objects.length) {
|
|
@@ -40,13 +48,15 @@ export class APISchema extends SchemaNode {
|
|
|
40
48
|
};
|
|
41
49
|
|
|
42
50
|
return (
|
|
51
|
+
title +
|
|
43
52
|
getSection(Module, 'Namespaces') +
|
|
44
53
|
getSection(ClassSchema, 'Classes') +
|
|
45
54
|
getSection(InterfaceSchema, 'Interfaces') +
|
|
46
55
|
getSection(FunctionLikeSchema, 'Functions') +
|
|
47
56
|
getSection(VariableSchema, 'Variables') +
|
|
48
57
|
getSection(TypeSchema, 'Types') +
|
|
49
|
-
getSection(EnumSchema, 'Enums')
|
|
58
|
+
getSection(EnumSchema, 'Enums') +
|
|
59
|
+
getSection(TypeRefSchema, 'TypeReferences')
|
|
50
60
|
);
|
|
51
61
|
}
|
|
52
62
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentID, ComponentIdObj } from '@teambit/component-id';
|
|
2
|
+
import { TransformationType } from 'class-transformer';
|
|
3
|
+
|
|
4
|
+
export function componentIdTransformer({
|
|
5
|
+
value,
|
|
6
|
+
type,
|
|
7
|
+
}: {
|
|
8
|
+
value: ComponentID | ComponentIdObj | undefined;
|
|
9
|
+
type: TransformationType;
|
|
10
|
+
}): ComponentID | ComponentIdObj | undefined {
|
|
11
|
+
if (!value) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (type === TransformationType.PLAIN_TO_CLASS) {
|
|
15
|
+
return ComponentID.fromObject(value as ComponentIdObj);
|
|
16
|
+
}
|
|
17
|
+
if (type === TransformationType.CLASS_TO_CLASS) {
|
|
18
|
+
return value as ComponentID;
|
|
19
|
+
}
|
|
20
|
+
// it's CLASS_TO_PLAIN
|
|
21
|
+
return (value as ComponentID).toObject();
|
|
22
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { plainToInstance, TransformationType, ClassConstructor } from 'class-transformer';
|
|
2
2
|
import { compact } from 'lodash';
|
|
3
|
-
import { SchemaNode } from '
|
|
4
|
-
import * as Schemas from '
|
|
3
|
+
import { SchemaNode } from '../schema-node';
|
|
4
|
+
import * as Schemas from '../schemas';
|
|
5
5
|
|
|
6
6
|
export function schemaObjArrayToInstances({ value, type }: { value: SchemaNode[]; type: TransformationType }) {
|
|
7
7
|
if (type !== TransformationType.PLAIN_TO_CLASS) {
|
|
@@ -10,10 +10,19 @@ export function schemaObjArrayToInstances({ value, type }: { value: SchemaNode[]
|
|
|
10
10
|
return value.map((obj) => transformFromObjectToInstance(obj));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function schemaObjToInstance({
|
|
13
|
+
export function schemaObjToInstance({
|
|
14
|
+
value,
|
|
15
|
+
type,
|
|
16
|
+
}: {
|
|
17
|
+
value: Record<string, any> | undefined;
|
|
18
|
+
type: TransformationType;
|
|
19
|
+
}) {
|
|
14
20
|
if (type !== TransformationType.PLAIN_TO_CLASS) {
|
|
15
21
|
return value;
|
|
16
22
|
}
|
|
23
|
+
if (!value) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
17
26
|
return transformFromObjectToInstance(value);
|
|
18
27
|
}
|
|
19
28
|
|
package/dist/api-schema.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
|
1
2
|
import { Module } from './schemas';
|
|
2
3
|
import { Location, SchemaNode } from './schema-node';
|
|
3
4
|
export declare class APISchema extends SchemaNode {
|
|
4
5
|
readonly location: Location;
|
|
5
6
|
readonly module: Module;
|
|
6
|
-
|
|
7
|
+
readonly componentId: ComponentID;
|
|
8
|
+
constructor(location: Location, module: Module, componentId: ComponentID);
|
|
7
9
|
toString(): string;
|
|
8
10
|
toStringPerType(): string;
|
|
9
11
|
listSignatures(): string[];
|
package/dist/api-schema.js
CHANGED
|
@@ -14,17 +14,20 @@ const class_transformer_1 = require("class-transformer");
|
|
|
14
14
|
const chalk_1 = __importDefault(require("chalk"));
|
|
15
15
|
const schemas_1 = require("./schemas");
|
|
16
16
|
const schema_node_1 = require("./schema-node");
|
|
17
|
-
const
|
|
17
|
+
const class_transformers_1 = require("./class-transformers");
|
|
18
|
+
const comp_id_transformer_1 = require("./class-transformers/comp-id-transformer");
|
|
18
19
|
class APISchema extends schema_node_1.SchemaNode {
|
|
19
|
-
constructor(location, module) {
|
|
20
|
+
constructor(location, module, componentId) {
|
|
20
21
|
super();
|
|
21
22
|
this.location = location;
|
|
22
23
|
this.module = module;
|
|
24
|
+
this.componentId = componentId;
|
|
23
25
|
}
|
|
24
26
|
toString() {
|
|
25
27
|
return JSON.stringify(this.module.exports.map((exp) => exp.toObject()), undefined, 2);
|
|
26
28
|
}
|
|
27
29
|
toStringPerType() {
|
|
30
|
+
const title = chalk_1.default.inverse(`API Schema of ${this.componentId.toString()}\n`);
|
|
28
31
|
const getSection = (ClassObj, sectionName) => {
|
|
29
32
|
const objects = this.module.exports.filter((exp) => exp instanceof ClassObj);
|
|
30
33
|
if (!objects.length) {
|
|
@@ -32,13 +35,15 @@ class APISchema extends schema_node_1.SchemaNode {
|
|
|
32
35
|
}
|
|
33
36
|
return `${chalk_1.default.green.bold(sectionName)}\n${objects.map((c) => c.toString()).join('\n')}\n\n`;
|
|
34
37
|
};
|
|
35
|
-
return (
|
|
38
|
+
return (title +
|
|
39
|
+
getSection(schemas_1.Module, 'Namespaces') +
|
|
36
40
|
getSection(schemas_1.ClassSchema, 'Classes') +
|
|
37
41
|
getSection(schemas_1.InterfaceSchema, 'Interfaces') +
|
|
38
42
|
getSection(schemas_1.FunctionLikeSchema, 'Functions') +
|
|
39
43
|
getSection(schemas_1.VariableSchema, 'Variables') +
|
|
40
44
|
getSection(schemas_1.TypeSchema, 'Types') +
|
|
41
|
-
getSection(schemas_1.EnumSchema, 'Enums')
|
|
45
|
+
getSection(schemas_1.EnumSchema, 'Enums') +
|
|
46
|
+
getSection(schemas_1.TypeRefSchema, 'TypeReferences'));
|
|
42
47
|
}
|
|
43
48
|
listSignatures() {
|
|
44
49
|
return this.module.exports.map((exp) => exp.signature);
|
|
@@ -48,7 +53,10 @@ class APISchema extends schema_node_1.SchemaNode {
|
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
__decorate([
|
|
51
|
-
(0, class_transformer_1.Transform)(
|
|
56
|
+
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjToInstance)
|
|
52
57
|
], APISchema.prototype, "module", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, class_transformer_1.Transform)(comp_id_transformer_1.componentIdTransformer)
|
|
60
|
+
], APISchema.prototype, "componentId", void 0);
|
|
53
61
|
exports.APISchema = APISchema;
|
|
54
62
|
//# sourceMappingURL=api-schema.js.map
|
package/dist/api-schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-schema.js","sourceRoot":"","sources":["../api-schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA+D;AAC/D,kDAA0B;
|
|
1
|
+
{"version":3,"file":"api-schema.js","sourceRoot":"","sources":["../api-schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA+D;AAC/D,kDAA0B;AAE1B,uCASmB;AACnB,+CAAqD;AACrD,6DAA2D;AAC3D,kFAAkF;AAElF,MAAa,SAAU,SAAQ,wBAAU;IAOvC,YAAqB,QAAkB,EAAE,MAAc,EAAE,WAAwB;QAC/E,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAU;QAErC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAChD,SAAS,EACT,CAAC,CACF,CAAC;IACJ,CAAC;IAED,eAAe;QACb,MAAM,KAAK,GAAG,eAAK,CAAC,OAAO,CAAC,iBAAiB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC9E,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,WAAmB,EAAE,EAAE;YACnD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,YAAY,QAAQ,CAAC,CAAC;YAC7E,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBACnB,OAAO,EAAE,CAAC;aACX;YAED,OAAO,GAAG,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChG,CAAC,CAAC;QAEF,OAAO,CACL,KAAK;YACL,UAAU,CAAC,gBAAM,EAAE,YAAY,CAAC;YAChC,UAAU,CAAC,qBAAW,EAAE,SAAS,CAAC;YAClC,UAAU,CAAC,yBAAe,EAAE,YAAY,CAAC;YACzC,UAAU,CAAC,4BAAkB,EAAE,WAAW,CAAC;YAC3C,UAAU,CAAC,wBAAc,EAAE,WAAW,CAAC;YACvC,UAAU,CAAC,oBAAU,EAAE,OAAO,CAAC;YAC/B,UAAU,CAAC,oBAAU,EAAE,OAAO,CAAC;YAC/B,UAAU,CAAC,uBAAa,EAAE,gBAAgB,CAAC,CAC5C,CAAC;IACJ,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,GAAwB;QACxC,OAAO,IAAA,mCAAe,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC;CACF;AAlDC;IADC,IAAA,6BAAS,EAAC,wCAAmB,CAAC;yCACP;AAGxB;IADC,IAAA,6BAAS,EAAC,4CAAsB,CAAC;8CACA;AALpC,8BAoDC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentID, ComponentIdObj } from '@teambit/component-id';
|
|
2
|
+
import { TransformationType } from 'class-transformer';
|
|
3
|
+
export declare function componentIdTransformer({ value, type, }: {
|
|
4
|
+
value: ComponentID | ComponentIdObj | undefined;
|
|
5
|
+
type: TransformationType;
|
|
6
|
+
}): ComponentID | ComponentIdObj | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentIdTransformer = void 0;
|
|
4
|
+
const component_id_1 = require("@teambit/component-id");
|
|
5
|
+
const class_transformer_1 = require("class-transformer");
|
|
6
|
+
function componentIdTransformer({ value, type, }) {
|
|
7
|
+
if (!value) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
if (type === class_transformer_1.TransformationType.PLAIN_TO_CLASS) {
|
|
11
|
+
return component_id_1.ComponentID.fromObject(value);
|
|
12
|
+
}
|
|
13
|
+
if (type === class_transformer_1.TransformationType.CLASS_TO_CLASS) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
// it's CLASS_TO_PLAIN
|
|
17
|
+
return value.toObject();
|
|
18
|
+
}
|
|
19
|
+
exports.componentIdTransformer = componentIdTransformer;
|
|
20
|
+
//# sourceMappingURL=comp-id-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comp-id-transformer.js","sourceRoot":"","sources":["../../class-transformers/comp-id-transformer.ts"],"names":[],"mappings":";;;AAAA,wDAAoE;AACpE,yDAAuD;AAEvD,SAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,IAAI,GAIL;IACC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,IAAI,KAAK,sCAAkB,CAAC,cAAc,EAAE;QAC9C,OAAO,0BAAW,CAAC,UAAU,CAAC,KAAuB,CAAC,CAAC;KACxD;IACD,IAAI,IAAI,KAAK,sCAAkB,CAAC,cAAc,EAAE;QAC9C,OAAO,KAAoB,CAAC;KAC7B;IACD,sBAAsB;IACtB,OAAQ,KAAqB,CAAC,QAAQ,EAAE,CAAC;AAC3C,CAAC;AAlBD,wDAkBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentIdTransformer = exports.schemaObjToInstance = exports.schemaObjArrayToInstances = void 0;
|
|
4
|
+
var schema_obj_to_class_1 = require("./schema-obj-to-class");
|
|
5
|
+
Object.defineProperty(exports, "schemaObjArrayToInstances", { enumerable: true, get: function () { return schema_obj_to_class_1.schemaObjArrayToInstances; } });
|
|
6
|
+
Object.defineProperty(exports, "schemaObjToInstance", { enumerable: true, get: function () { return schema_obj_to_class_1.schemaObjToInstance; } });
|
|
7
|
+
var comp_id_transformer_1 = require("./comp-id-transformer");
|
|
8
|
+
Object.defineProperty(exports, "componentIdTransformer", { enumerable: true, get: function () { return comp_id_transformer_1.componentIdTransformer; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../class-transformers/index.ts"],"names":[],"mappings":";;;AAAA,6DAAuF;AAA9E,gIAAA,yBAAyB,OAAA;AAAE,0HAAA,mBAAmB,OAAA;AACvD,6DAA+D;AAAtD,6HAAA,sBAAsB,OAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TransformationType } from 'class-transformer';
|
|
2
|
-
import { SchemaNode } from '
|
|
2
|
+
import { SchemaNode } from '../schema-node';
|
|
3
3
|
export declare function schemaObjArrayToInstances({ value, type }: {
|
|
4
4
|
value: SchemaNode[];
|
|
5
5
|
type: TransformationType;
|
|
6
6
|
}): SchemaNode[];
|
|
7
|
-
export declare function schemaObjToInstance({ value, type }: {
|
|
8
|
-
value: Record<string, any
|
|
7
|
+
export declare function schemaObjToInstance({ value, type, }: {
|
|
8
|
+
value: Record<string, any> | undefined;
|
|
9
9
|
type: TransformationType;
|
|
10
10
|
}): Record<string, any>;
|
|
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
22
|
exports.schemaObjToInstance = exports.schemaObjArrayToInstances = void 0;
|
|
23
23
|
const class_transformer_1 = require("class-transformer");
|
|
24
24
|
const lodash_1 = require("lodash");
|
|
25
|
-
const Schemas = __importStar(require("
|
|
25
|
+
const Schemas = __importStar(require("../schemas"));
|
|
26
26
|
function schemaObjArrayToInstances({ value, type }) {
|
|
27
27
|
if (type !== class_transformer_1.TransformationType.PLAIN_TO_CLASS) {
|
|
28
28
|
return value;
|
|
@@ -30,10 +30,13 @@ function schemaObjArrayToInstances({ value, type }) {
|
|
|
30
30
|
return value.map((obj) => transformFromObjectToInstance(obj));
|
|
31
31
|
}
|
|
32
32
|
exports.schemaObjArrayToInstances = schemaObjArrayToInstances;
|
|
33
|
-
function schemaObjToInstance({ value, type }) {
|
|
33
|
+
function schemaObjToInstance({ value, type, }) {
|
|
34
34
|
if (type !== class_transformer_1.TransformationType.PLAIN_TO_CLASS) {
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
|
+
if (!value) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
37
40
|
return transformFromObjectToInstance(value);
|
|
38
41
|
}
|
|
39
42
|
exports.schemaObjToInstance = schemaObjToInstance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-obj-to-class.js","sourceRoot":"","sources":["../../class-transformers/schema-obj-to-class.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA0F;AAC1F,mCAAiC;AAEjC,oDAAsC;AAEtC,SAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAqD;IAC1G,IAAI,IAAI,KAAK,sCAAkB,CAAC,cAAc,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC,CAAC;AAChE,CAAC;AALD,8DAKC;AAED,SAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,IAAI,GAIL;IACC,IAAI,IAAI,KAAK,sCAAkB,CAAC,cAAc,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,6BAA6B,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AAdD,kDAcC;AAED,SAAS,6BAA6B,CAAC,GAAwB;IAC7D,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;KACtG;IACD,MAAM,WAAW,GAAG,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvD,OAAO,IAAA,mCAAe,EAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAkB;IAC9C,MAAM,cAAc,GAAG,IAAA,gBAAO,EAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAChF,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,0BAA0B,UAAU;EACtD,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAC/C;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { APISchema } from './api-schema';
|
|
2
2
|
export { Export, StaticProperties } from './export';
|
|
3
3
|
export type { SchemaNode, Location } from './schema-node';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export * from './schemas';
|
|
5
|
+
export { TagName } from './schemas/docs/tag';
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
13
|
+
exports.TagName = exports.Export = exports.APISchema = void 0;
|
|
4
14
|
var api_schema_1 = require("./api-schema");
|
|
5
15
|
Object.defineProperty(exports, "APISchema", { enumerable: true, get: function () { return api_schema_1.APISchema; } });
|
|
6
16
|
var export_1 = require("./export");
|
|
7
17
|
Object.defineProperty(exports, "Export", { enumerable: true, get: function () { return export_1.Export; } });
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
Object.defineProperty(exports, "TypeRefSchema", { enumerable: true, get: function () { return schemas_1.TypeRefSchema; } });
|
|
12
|
-
Object.defineProperty(exports, "VariableSchema", { enumerable: true, get: function () { return schemas_1.VariableSchema; } });
|
|
13
|
-
Object.defineProperty(exports, "ClassSchema", { enumerable: true, get: function () { return schemas_1.ClassSchema; } });
|
|
14
|
-
Object.defineProperty(exports, "ConstructorSchema", { enumerable: true, get: function () { return schemas_1.ConstructorSchema; } });
|
|
15
|
-
Object.defineProperty(exports, "TypeSchema", { enumerable: true, get: function () { return schemas_1.TypeSchema; } });
|
|
16
|
-
Object.defineProperty(exports, "TypeIntersectionSchema", { enumerable: true, get: function () { return schemas_1.TypeIntersectionSchema; } });
|
|
17
|
-
Object.defineProperty(exports, "TypeUnionSchema", { enumerable: true, get: function () { return schemas_1.TypeUnionSchema; } });
|
|
18
|
-
Object.defineProperty(exports, "TypeLiteralSchema", { enumerable: true, get: function () { return schemas_1.TypeLiteralSchema; } });
|
|
19
|
-
Object.defineProperty(exports, "IndexSignatureSchema", { enumerable: true, get: function () { return schemas_1.IndexSignatureSchema; } });
|
|
20
|
-
Object.defineProperty(exports, "InterfaceSchema", { enumerable: true, get: function () { return schemas_1.InterfaceSchema; } });
|
|
21
|
-
Object.defineProperty(exports, "GetAccessorSchema", { enumerable: true, get: function () { return schemas_1.GetAccessorSchema; } });
|
|
22
|
-
Object.defineProperty(exports, "SetAccessorSchema", { enumerable: true, get: function () { return schemas_1.SetAccessorSchema; } });
|
|
23
|
-
Object.defineProperty(exports, "TypeQuerySchema", { enumerable: true, get: function () { return schemas_1.TypeQuerySchema; } });
|
|
24
|
-
Object.defineProperty(exports, "InferenceTypeSchema", { enumerable: true, get: function () { return schemas_1.InferenceTypeSchema; } });
|
|
25
|
-
Object.defineProperty(exports, "LiteralTypeSchema", { enumerable: true, get: function () { return schemas_1.LiteralTypeSchema; } });
|
|
26
|
-
Object.defineProperty(exports, "KeywordTypeSchema", { enumerable: true, get: function () { return schemas_1.KeywordTypeSchema; } });
|
|
27
|
-
Object.defineProperty(exports, "TypeArraySchema", { enumerable: true, get: function () { return schemas_1.TypeArraySchema; } });
|
|
28
|
-
Object.defineProperty(exports, "TypeOperatorSchema", { enumerable: true, get: function () { return schemas_1.TypeOperatorSchema; } });
|
|
29
|
-
Object.defineProperty(exports, "TupleTypeSchema", { enumerable: true, get: function () { return schemas_1.TupleTypeSchema; } });
|
|
30
|
-
Object.defineProperty(exports, "ParameterSchema", { enumerable: true, get: function () { return schemas_1.ParameterSchema; } });
|
|
31
|
-
Object.defineProperty(exports, "EnumSchema", { enumerable: true, get: function () { return schemas_1.EnumSchema; } });
|
|
32
|
-
Object.defineProperty(exports, "ParenthesizedTypeSchema", { enumerable: true, get: function () { return schemas_1.ParenthesizedTypeSchema; } });
|
|
33
|
-
Object.defineProperty(exports, "TypePredicateSchema", { enumerable: true, get: function () { return schemas_1.TypePredicateSchema; } });
|
|
34
|
-
Object.defineProperty(exports, "IndexedAccessSchema", { enumerable: true, get: function () { return schemas_1.IndexedAccessSchema; } });
|
|
18
|
+
__exportStar(require("./schemas"), exports);
|
|
19
|
+
var tag_1 = require("./schemas/docs/tag");
|
|
20
|
+
Object.defineProperty(exports, "TagName", { enumerable: true, get: function () { return tag_1.TagName; } });
|
|
35
21
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,mCAAoD;AAA3C,gGAAA,MAAM,OAAA;AAEf,4CAA0B;AAC1B,0CAA6C;AAApC,8FAAA,OAAO,OAAA"}
|
package/dist/schema-node.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DocSchema } from './schemas';
|
|
1
2
|
/**
|
|
2
3
|
* a convenient abstract class for all schema to extend.
|
|
3
4
|
* the reason for having it as an abstract class and not an interface, for now, is mostly for the `__schema` prop.
|
|
@@ -6,6 +7,7 @@
|
|
|
6
7
|
export declare abstract class SchemaNode {
|
|
7
8
|
readonly __schema: string;
|
|
8
9
|
abstract readonly location: Location;
|
|
10
|
+
readonly doc?: DocSchema;
|
|
9
11
|
readonly signature?: string;
|
|
10
12
|
abstract toString(): string;
|
|
11
13
|
toObject(): Record<string, any>;
|
package/dist/schema-node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-node.js","sourceRoot":"","sources":["../schema-node.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;
|
|
1
|
+
{"version":3,"file":"schema-node.js","sourceRoot":"","sources":["../schema-node.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AAGpD;;;;GAIG;AACH,MAAsB,UAAU;IAAhC;QACW,aAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAU5C,CAAC;IAHC,QAAQ;QACN,OAAO,IAAA,mCAAe,EAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAXD,gCAWC"}
|
package/dist/schemas/class.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Location, SchemaNode } from '../schema-node';
|
|
2
|
+
import { DocSchema } from './docs';
|
|
2
3
|
export declare class ClassSchema extends SchemaNode {
|
|
3
4
|
readonly className: string;
|
|
4
5
|
readonly location: Location;
|
|
5
6
|
readonly members: SchemaNode[];
|
|
6
|
-
|
|
7
|
+
readonly doc?: DocSchema;
|
|
8
|
+
constructor(className: string, members: SchemaNode[], location: Location, doc?: DocSchema);
|
|
7
9
|
toString(): string;
|
|
8
10
|
}
|
package/dist/schemas/class.js
CHANGED
|
@@ -13,13 +13,14 @@ exports.ClassSchema = void 0;
|
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const chalk_1 = __importDefault(require("chalk"));
|
|
15
15
|
const schema_node_1 = require("../schema-node");
|
|
16
|
-
const
|
|
16
|
+
const class_transformers_1 = require("../class-transformers");
|
|
17
17
|
class ClassSchema extends schema_node_1.SchemaNode {
|
|
18
|
-
constructor(className, members, location) {
|
|
18
|
+
constructor(className, members, location, doc) {
|
|
19
19
|
super();
|
|
20
20
|
this.className = className;
|
|
21
21
|
this.location = location;
|
|
22
22
|
this.members = members;
|
|
23
|
+
this.doc = doc;
|
|
23
24
|
}
|
|
24
25
|
toString() {
|
|
25
26
|
const membersStr = this.members.map((m) => `* ${m.toString()}`).join('\n');
|
|
@@ -27,7 +28,10 @@ class ClassSchema extends schema_node_1.SchemaNode {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
__decorate([
|
|
30
|
-
(0, class_transformer_1.Transform)(
|
|
31
|
+
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances)
|
|
31
32
|
], ClassSchema.prototype, "members", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjToInstance)
|
|
35
|
+
], ClassSchema.prototype, "doc", void 0);
|
|
32
36
|
exports.ClassSchema = ClassSchema;
|
|
33
37
|
//# sourceMappingURL=class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../schemas/class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,kDAA0B;AAC1B,gDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../schemas/class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,kDAA0B;AAC1B,gDAAsD;AACtD,8DAAuF;AAGvF,MAAa,WAAY,SAAQ,wBAAU;IAOzC,YAAqB,SAAiB,EAAE,OAAqB,EAAW,QAAkB,EAAE,GAAe;QACzG,KAAK,EAAE,CAAC;QADW,cAAS,GAAT,SAAS,CAAQ;QAAkC,aAAQ,GAAR,QAAQ,CAAU;QAExF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,QAAQ;QACN,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3E,OAAO,GAAG,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,UAAU,EAAE,CAAC;IAClE,CAAC;CACF;AAfC;IADC,IAAA,6BAAS,EAAC,8CAAyB,CAAC;4CACN;AAG/B;IADC,IAAA,6BAAS,EAAC,wCAAmB,CAAC;wCACN;AAL3B,kCAiBC"}
|
|
@@ -13,7 +13,7 @@ exports.ConstructorSchema = void 0;
|
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const chalk_1 = __importDefault(require("chalk"));
|
|
15
15
|
const schema_node_1 = require("../schema-node");
|
|
16
|
-
const
|
|
16
|
+
const class_transformers_1 = require("../class-transformers");
|
|
17
17
|
class ConstructorSchema extends schema_node_1.SchemaNode {
|
|
18
18
|
constructor(location, params) {
|
|
19
19
|
super();
|
|
@@ -26,7 +26,7 @@ class ConstructorSchema extends schema_node_1.SchemaNode {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
__decorate([
|
|
29
|
-
(0, class_transformer_1.Transform)(
|
|
29
|
+
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances)
|
|
30
30
|
], ConstructorSchema.prototype, "params", void 0);
|
|
31
31
|
exports.ConstructorSchema = ConstructorSchema;
|
|
32
32
|
//# sourceMappingURL=constructor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructor.js","sourceRoot":"","sources":["../../schemas/constructor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,kDAA0B;AAC1B,gDAAsD;AAEtD,
|
|
1
|
+
{"version":3,"file":"constructor.js","sourceRoot":"","sources":["../../schemas/constructor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,kDAA0B;AAC1B,gDAAsD;AAEtD,8DAAkE;AAElE,MAAa,iBAAkB,SAAQ,wBAAU;IAG/C,YAAqB,QAAkB,EAAE,MAAyB;QAChE,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAU;QAErC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1E,OAAO,GAAG,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,SAAS,GAAG,CAAC;IACtD,CAAC;CACF;AAVC;IADC,IAAA,6BAAS,EAAC,8CAAyB,CAAC;iDACF;AAFrC,8CAYC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Location, SchemaNode } from '../../schema-node';
|
|
2
|
+
import { TagName, TagSchema } from './tag';
|
|
3
|
+
export declare class DocSchema extends SchemaNode {
|
|
4
|
+
readonly location: Location;
|
|
5
|
+
readonly comment?: string;
|
|
6
|
+
readonly tags?: TagSchema[];
|
|
7
|
+
constructor(location: Location, comment?: string, tags?: TagSchema[]);
|
|
8
|
+
toString(): string;
|
|
9
|
+
hasTag(tagName: TagName): boolean;
|
|
10
|
+
findTag(tagName: TagName): TagSchema;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.DocSchema = void 0;
|
|
10
|
+
const class_transformer_1 = require("class-transformer");
|
|
11
|
+
const class_transformers_1 = require("../../class-transformers");
|
|
12
|
+
const schema_node_1 = require("../../schema-node");
|
|
13
|
+
class DocSchema extends schema_node_1.SchemaNode {
|
|
14
|
+
constructor(location, comment, tags) {
|
|
15
|
+
super();
|
|
16
|
+
this.location = location;
|
|
17
|
+
this.comment = comment;
|
|
18
|
+
this.tags = tags;
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
const comment = this.comment ? `${this.comment}\n` : '';
|
|
22
|
+
const tags = this.tags ? this.tags.map((tag) => tag.toString()).join('\n') : '';
|
|
23
|
+
return `${comment}${tags}`;
|
|
24
|
+
}
|
|
25
|
+
hasTag(tagName) {
|
|
26
|
+
return Boolean(this.findTag(tagName));
|
|
27
|
+
}
|
|
28
|
+
findTag(tagName) {
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = this.tags) === null || _a === void 0 ? void 0 : _a.find((tag) => tag.tagName === tagName);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_transformer_1.Transform)(class_transformers_1.schemaObjArrayToInstances)
|
|
35
|
+
], DocSchema.prototype, "tags", void 0);
|
|
36
|
+
exports.DocSchema = DocSchema;
|
|
37
|
+
//# sourceMappingURL=doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../../../schemas/docs/doc.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAA8C;AAC9C,iEAAqE;AACrE,mDAAyD;AAGzD,MAAa,SAAU,SAAQ,wBAAU;IAGvC,YAAqB,QAAkB,EAAW,OAAgB,EAAE,IAAkB;QACpF,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAU;QAAW,YAAO,GAAP,OAAO,CAAS;QAEhE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,OAAO,GAAG,OAAO,GAAG,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,OAAgB;QACrB,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,CAAC,OAAgB;;QACtB,OAAO,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAnBC;IADC,IAAA,6BAAS,EAAC,8CAAyB,CAAC;uCACT;AAF9B,8BAqBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReturnTagSchema = exports.TagSchema = exports.DocSchema = void 0;
|
|
4
|
+
var doc_1 = require("./doc");
|
|
5
|
+
Object.defineProperty(exports, "DocSchema", { enumerable: true, get: function () { return doc_1.DocSchema; } });
|
|
6
|
+
var tag_1 = require("./tag");
|
|
7
|
+
Object.defineProperty(exports, "TagSchema", { enumerable: true, get: function () { return tag_1.TagSchema; } });
|
|
8
|
+
var return_tag_1 = require("./return-tag");
|
|
9
|
+
Object.defineProperty(exports, "ReturnTagSchema", { enumerable: true, get: function () { return return_tag_1.ReturnTagSchema; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schemas/docs/index.ts"],"names":[],"mappings":";;;AAAA,6BAAkC;AAAzB,gGAAA,SAAS,OAAA;AAClB,6BAAkC;AAAzB,gGAAA,SAAS,OAAA;AAClB,2CAA+C;AAAtC,6GAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Location, SchemaNode } from '../../schema-node';
|
|
2
|
+
import { TagName, TagSchema } from './tag';
|
|
3
|
+
/**
|
|
4
|
+
* e.g. `@return {string} some comment`
|
|
5
|
+
*/
|
|
6
|
+
export declare class ReturnTagSchema extends TagSchema {
|
|
7
|
+
readonly location: Location;
|
|
8
|
+
readonly tagName: TagName;
|
|
9
|
+
readonly comment?: string;
|
|
10
|
+
readonly type?: SchemaNode;
|
|
11
|
+
constructor(location: Location, tagName?: TagName, comment?: string, type?: SchemaNode);
|
|
12
|
+
toString(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReturnTagSchema = void 0;
|
|
4
|
+
const tag_1 = require("./tag");
|
|
5
|
+
/**
|
|
6
|
+
* e.g. `@return {string} some comment`
|
|
7
|
+
*/
|
|
8
|
+
class ReturnTagSchema extends tag_1.TagSchema {
|
|
9
|
+
constructor(location, tagName = tag_1.TagName.return, comment, type) {
|
|
10
|
+
super(location, tagName, comment);
|
|
11
|
+
this.location = location;
|
|
12
|
+
this.tagName = tagName;
|
|
13
|
+
this.comment = comment;
|
|
14
|
+
this.type = type;
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
const comment = this.comment ? ` ${this.comment}` : '';
|
|
18
|
+
return `@${this.tagName}${comment}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ReturnTagSchema = ReturnTagSchema;
|
|
22
|
+
//# sourceMappingURL=return-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"return-tag.js","sourceRoot":"","sources":["../../../schemas/docs/return-tag.ts"],"names":[],"mappings":";;;AACA,+BAA2C;AAE3C;;GAEG;AACH,MAAa,eAAgB,SAAQ,eAAS;IAC5C,YACW,QAAkB,EAClB,UAAU,aAAO,CAAC,MAAM,EACxB,OAAgB,EAChB,IAAiB;QAE1B,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QALzB,aAAQ,GAAR,QAAQ,CAAU;QAClB,YAAO,GAAP,OAAO,CAAiB;QACxB,YAAO,GAAP,OAAO,CAAS;QAChB,SAAI,GAAJ,IAAI,CAAa;IAG5B,CAAC;IAED,QAAQ;QACN,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,OAAO,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC;IACtC,CAAC;CACF;AAdD,0CAcC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Location, SchemaNode } from '../../schema-node';
|
|
2
|
+
/**
|
|
3
|
+
* e.g. `@deprecated please use something else`
|
|
4
|
+
*/
|
|
5
|
+
export declare class TagSchema extends SchemaNode {
|
|
6
|
+
readonly location: Location;
|
|
7
|
+
readonly tagName: TagName | string;
|
|
8
|
+
readonly comment?: string;
|
|
9
|
+
constructor(location: Location, tagName: TagName | string, comment?: string);
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|
|
12
|
+
export declare enum TagName {
|
|
13
|
+
augments = "augments",
|
|
14
|
+
author = "author",
|
|
15
|
+
class = "class",
|
|
16
|
+
callback = "callback",
|
|
17
|
+
public = "public",
|
|
18
|
+
private = "private",
|
|
19
|
+
protected = "protected",
|
|
20
|
+
readonly = "readonly",
|
|
21
|
+
override = "override",
|
|
22
|
+
see = "see",
|
|
23
|
+
enum = "enum",
|
|
24
|
+
parameter = "parameter",
|
|
25
|
+
this = "this",
|
|
26
|
+
type = "type",
|
|
27
|
+
template = "template",
|
|
28
|
+
typedef = "typedef",
|
|
29
|
+
property = "property",
|
|
30
|
+
implements = "implements",
|
|
31
|
+
return = "return",
|
|
32
|
+
deprecated = "deprecated"
|
|
33
|
+
}
|