@trapi/metadata 0.2.0 → 0.2.2

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.
Files changed (147) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +10 -34
  3. package/dist/generator/controller.d.ts +2 -2
  4. package/dist/generator/controller.d.ts.map +1 -1
  5. package/dist/generator/controller.js.map +1 -1
  6. package/dist/generator/endpoint.d.ts +4 -5
  7. package/dist/generator/endpoint.d.ts.map +1 -1
  8. package/dist/generator/endpoint.js +6 -8
  9. package/dist/generator/endpoint.js.map +1 -1
  10. package/dist/generator/index.d.ts +1 -0
  11. package/dist/generator/index.d.ts.map +1 -1
  12. package/dist/generator/index.js +1 -0
  13. package/dist/generator/index.js.map +1 -1
  14. package/dist/generator/method.d.ts +2 -2
  15. package/dist/generator/method.d.ts.map +1 -1
  16. package/dist/generator/method.js +11 -13
  17. package/dist/generator/method.js.map +1 -1
  18. package/dist/generator/module.d.ts +6 -7
  19. package/dist/generator/module.d.ts.map +1 -1
  20. package/dist/generator/module.js +13 -9
  21. package/dist/generator/module.js.map +1 -1
  22. package/dist/generator/parameter.d.ts +2 -2
  23. package/dist/generator/parameter.d.ts.map +1 -1
  24. package/dist/generator/parameter.js +10 -7
  25. package/dist/generator/parameter.js.map +1 -1
  26. package/dist/generator/utils.d.ts +5 -0
  27. package/dist/generator/utils.d.ts.map +1 -0
  28. package/dist/generator/utils.js +18 -0
  29. package/dist/generator/utils.js.map +1 -0
  30. package/dist/index.d.ts +1 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/module.d.ts +4 -0
  35. package/dist/module.d.ts.map +1 -0
  36. package/dist/module.js +16 -0
  37. package/dist/module.js.map +1 -0
  38. package/dist/type.d.ts +14 -23
  39. package/dist/type.d.ts.map +1 -1
  40. package/dist/utils/index.d.ts +3 -2
  41. package/dist/utils/index.d.ts.map +1 -1
  42. package/dist/utils/index.js +3 -2
  43. package/dist/utils/index.js.map +1 -1
  44. package/dist/utils/object.d.ts +2 -0
  45. package/dist/utils/object.d.ts.map +1 -0
  46. package/dist/utils/object.js +14 -0
  47. package/dist/utils/object.js.map +1 -0
  48. package/dist/utils/path.d.ts +2 -0
  49. package/dist/utils/path.d.ts.map +1 -0
  50. package/dist/utils/path.js +17 -0
  51. package/dist/utils/path.js.map +1 -0
  52. package/dist/utils/typescript.d.ts +8 -0
  53. package/dist/utils/typescript.d.ts.map +1 -0
  54. package/dist/utils/typescript.js +41 -0
  55. package/dist/utils/typescript.js.map +1 -0
  56. package/dist/utils/validator.d.ts.map +1 -1
  57. package/dist/utils/validator.js +2 -2
  58. package/dist/utils/validator.js.map +1 -1
  59. package/package.json +9 -8
  60. package/dist/decorator/functions.d.ts +0 -99
  61. package/dist/decorator/functions.d.ts.map +0 -1
  62. package/dist/decorator/functions.js +0 -140
  63. package/dist/decorator/functions.js.map +0 -1
  64. package/dist/decorator/index.d.ts +0 -7
  65. package/dist/decorator/index.d.ts.map +0 -1
  66. package/dist/decorator/index.js +0 -29
  67. package/dist/decorator/index.js.map +0 -1
  68. package/dist/decorator/mapper/index.d.ts +0 -25
  69. package/dist/decorator/mapper/index.d.ts.map +0 -1
  70. package/dist/decorator/mapper/index.js +0 -115
  71. package/dist/decorator/mapper/index.js.map +0 -1
  72. package/dist/decorator/mapper/maps/decorators-express.d.ts +0 -4
  73. package/dist/decorator/mapper/maps/decorators-express.d.ts.map +0 -1
  74. package/dist/decorator/mapper/maps/decorators-express.js +0 -115
  75. package/dist/decorator/mapper/maps/decorators-express.js.map +0 -1
  76. package/dist/decorator/mapper/maps/internal.d.ts +0 -4
  77. package/dist/decorator/mapper/maps/internal.d.ts.map +0 -1
  78. package/dist/decorator/mapper/maps/internal.js +0 -94
  79. package/dist/decorator/mapper/maps/internal.js.map +0 -1
  80. package/dist/decorator/mapper/maps/typescript-rest.d.ts +0 -4
  81. package/dist/decorator/mapper/maps/typescript-rest.d.ts.map +0 -1
  82. package/dist/decorator/mapper/maps/typescript-rest.js +0 -145
  83. package/dist/decorator/mapper/maps/typescript-rest.js.map +0 -1
  84. package/dist/decorator/mapper/utils.d.ts +0 -17
  85. package/dist/decorator/mapper/utils.d.ts.map +0 -1
  86. package/dist/decorator/mapper/utils.js +0 -73
  87. package/dist/decorator/mapper/utils.js.map +0 -1
  88. package/dist/decorator/representation/index.d.ts +0 -17
  89. package/dist/decorator/representation/index.d.ts.map +0 -1
  90. package/dist/decorator/representation/index.js +0 -61
  91. package/dist/decorator/representation/index.js.map +0 -1
  92. package/dist/decorator/representation/property/utils.d.ts +0 -6
  93. package/dist/decorator/representation/property/utils.d.ts.map +0 -1
  94. package/dist/decorator/representation/property/utils.js +0 -120
  95. package/dist/decorator/representation/property/utils.js.map +0 -1
  96. package/dist/decorator/type.d.ts +0 -178
  97. package/dist/decorator/type.d.ts.map +0 -1
  98. package/dist/decorator/type.js +0 -9
  99. package/dist/decorator/type.js.map +0 -1
  100. package/dist/decorator/utils/index.d.ts +0 -3
  101. package/dist/decorator/utils/index.d.ts.map +0 -1
  102. package/dist/decorator/utils/index.js +0 -25
  103. package/dist/decorator/utils/index.js.map +0 -1
  104. package/dist/decorator/utils/node.d.ts +0 -10
  105. package/dist/decorator/utils/node.d.ts.map +0 -1
  106. package/dist/decorator/utils/node.js +0 -49
  107. package/dist/decorator/utils/node.js.map +0 -1
  108. package/dist/decorator/utils/validator.d.ts +0 -4
  109. package/dist/decorator/utils/validator.d.ts.map +0 -1
  110. package/dist/decorator/utils/validator.js +0 -86
  111. package/dist/decorator/utils/validator.js.map +0 -1
  112. package/dist/resolver/error.d.ts +0 -7
  113. package/dist/resolver/error.d.ts.map +0 -1
  114. package/dist/resolver/error.js +0 -40
  115. package/dist/resolver/error.js.map +0 -1
  116. package/dist/resolver/index.d.ts +0 -5
  117. package/dist/resolver/index.d.ts.map +0 -1
  118. package/dist/resolver/index.js +0 -27
  119. package/dist/resolver/index.js.map +0 -1
  120. package/dist/resolver/type-node.d.ts +0 -53
  121. package/dist/resolver/type-node.d.ts.map +0 -1
  122. package/dist/resolver/type-node.js +0 -1045
  123. package/dist/resolver/type-node.js.map +0 -1
  124. package/dist/resolver/type.d.ts +0 -118
  125. package/dist/resolver/type.d.ts.map +0 -1
  126. package/dist/resolver/type.js +0 -57
  127. package/dist/resolver/type.js.map +0 -1
  128. package/dist/resolver/utils/index.d.ts +0 -3
  129. package/dist/resolver/utils/index.d.ts.map +0 -1
  130. package/dist/resolver/utils/index.js +0 -25
  131. package/dist/resolver/utils/index.js.map +0 -1
  132. package/dist/resolver/utils/initializer.d.ts +0 -5
  133. package/dist/resolver/utils/initializer.d.ts.map +0 -1
  134. package/dist/resolver/utils/initializer.js +0 -97
  135. package/dist/resolver/utils/initializer.js.map +0 -1
  136. package/dist/resolver/utils/validator.d.ts +0 -4
  137. package/dist/resolver/utils/validator.d.ts.map +0 -1
  138. package/dist/resolver/utils/validator.js +0 -131
  139. package/dist/resolver/utils/validator.js.map +0 -1
  140. package/dist/utils/generator.d.ts +0 -6
  141. package/dist/utils/generator.d.ts.map +0 -1
  142. package/dist/utils/generator.js +0 -33
  143. package/dist/utils/generator.js.map +0 -1
  144. package/dist/utils/js-doc.d.ts +0 -8
  145. package/dist/utils/js-doc.d.ts.map +0 -1
  146. package/dist/utils/js-doc.js +0 -102
  147. package/dist/utils/js-doc.js.map +0 -1
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/decorator/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -1,3 +0,0 @@
1
- export * from './node';
2
- export * from './validator';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorator/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- __exportStar(require("./node"), exports);
24
- __exportStar(require("./validator"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorator/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,yCAAuB;AACvB,8CAA4B"}
@@ -1,10 +0,0 @@
1
- import { Node } from 'typescript';
2
- import { Decorator } from '../type';
3
- /**
4
- * Get Decorators for a specific node.
5
- *
6
- * @param node
7
- * @param isMatching
8
- */
9
- export declare function getNodeDecorators(node: Node, isMatching?: (data: Decorator.Data) => boolean): Decorator.Data[];
10
- //# sourceMappingURL=node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/decorator/utils/node.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,IAAI,EACP,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,IAAI,EACV,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,OAAO,GAC/C,SAAS,CAAC,IAAI,EAAE,CAsClB"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getNodeDecorators = void 0;
10
- const typescript_1 = require("typescript");
11
- /**
12
- * Get Decorators for a specific node.
13
- *
14
- * @param node
15
- * @param isMatching
16
- */
17
- function getNodeDecorators(node, isMatching) {
18
- const { decorators } = node;
19
- if (!decorators || !decorators.length) {
20
- return [];
21
- }
22
- const items = decorators
23
- .map((d) => {
24
- const result = {
25
- arguments: [],
26
- typeArguments: [],
27
- };
28
- let x = d.expression;
29
- if ((0, typescript_1.isCallExpression)(x)) {
30
- if (x.arguments) {
31
- result.arguments = x.arguments.map((argument) => {
32
- if ((0, typescript_1.isStringLiteral)(argument) || (0, typescript_1.isNumericLiteral)(argument)) {
33
- return argument.text;
34
- }
35
- return argument;
36
- });
37
- }
38
- if (x.typeArguments) {
39
- result.typeArguments = x.typeArguments;
40
- }
41
- x = x.expression;
42
- }
43
- result.text = x.text || x.name.text;
44
- return result;
45
- });
46
- return typeof isMatching === 'undefined' ? items : items.filter(isMatching);
47
- }
48
- exports.getNodeDecorators = getNodeDecorators;
49
- //# sourceMappingURL=node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/decorator/utils/node.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAEoB;AAGpB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chemaOf } from 'yup';
2
- import { Decorator } from '../type';
3
- export declare function useDecoratorConfigValidator(): SchemaOf<Decorator.Config>;
4
- //# sourceMappingURL=validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/decorator/utils/validator.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,QAAQ,EACX,MAAM,KAAK,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC,wBAAgB,2BAA2B,IAAK,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAwFzE"}
@@ -1,86 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.useDecoratorConfigValidator = void 0;
10
- const yup_1 = require("yup");
11
- const metadata_utils_1 = require("@trapi/metadata-utils");
12
- let validatorInstance;
13
- function useDecoratorConfigValidator() {
14
- if (typeof validatorInstance !== 'undefined') {
15
- return validatorInstance;
16
- }
17
- const configMappingOptionValidator = (0, yup_1.lazy)((value) => {
18
- if (typeof value === 'boolean') {
19
- return (0, yup_1.boolean)();
20
- }
21
- if (typeof value === 'string') {
22
- return (0, yup_1.string)();
23
- }
24
- if (Array.isArray(value)) {
25
- return (0, yup_1.array)().of((0, yup_1.string)());
26
- }
27
- if (Object.prototype.toString.call(value) === '[object Object]') {
28
- // todo: setup type key check :)
29
- return (0, yup_1.object)((0, metadata_utils_1.mapYupRuleForDictionary)(value, (0, yup_1.boolean)())).optional().default({});
30
- }
31
- return (0, yup_1.mixed)().optional().default(undefined);
32
- });
33
- const useLibraryValidator = (0, yup_1.lazy)((value) => {
34
- if (typeof value === 'string') {
35
- return (0, yup_1.string)();
36
- }
37
- if (Array.isArray(value)) {
38
- return (0, yup_1.array)().of((0, yup_1.string)());
39
- }
40
- if (Object.prototype.toString.call(value) === '[object Object]') {
41
- // todo: setup library key check :)
42
- return (0, yup_1.object)((0, metadata_utils_1.mapYupRuleForDictionary)(value, configMappingOptionValidator));
43
- }
44
- return (0, yup_1.mixed)().optional().default(undefined);
45
- });
46
- const representationPropertyValidator = (0, yup_1.object)({
47
- type: (0, yup_1.mixed)().oneOf(['element', 'array']),
48
- isType: (0, yup_1.boolean)().optional().default(undefined),
49
- srcArgumentType: (0, yup_1.mixed)().oneOf(['argument', 'typeArgument']),
50
- srcPosition: (0, yup_1.number)().min(0).optional().default(0),
51
- srcAmount: (0, yup_1.number)().optional().default(undefined),
52
- // todo: check if 'merge', 'none' or function
53
- srcStrategy: (0, yup_1.mixed)().optional().default(undefined),
54
- });
55
- const representationValidator = (0, yup_1.object)({
56
- id: (0, yup_1.string)().required(),
57
- properties: (0, yup_1.lazy)((value) => {
58
- if (Object.prototype.toString.call(value) === '[object Object]') {
59
- return (0, yup_1.object)((0, metadata_utils_1.mapYupRuleForDictionary)(value, representationPropertyValidator)).optional().default({});
60
- }
61
- return (0, yup_1.mixed)().optional().default(undefined);
62
- }),
63
- });
64
- const overrideValidator = (0, yup_1.lazy)((value) => {
65
- if (Object.prototype.toString.call(value) === '[object Object]') {
66
- return (0, yup_1.object)((0, metadata_utils_1.mapYupRuleForDictionary)(value, (0, yup_1.lazy)((val) => {
67
- if (Array.isArray(val)) {
68
- return (0, yup_1.array)().of(representationValidator);
69
- }
70
- return representationValidator;
71
- })));
72
- }
73
- return (0, yup_1.mixed)().optional().default(undefined);
74
- });
75
- validatorInstance = (0, yup_1.object)({
76
- library: useLibraryValidator,
77
- internal: configMappingOptionValidator,
78
- map: overrideValidator,
79
- }).optional().default({
80
- library: ['typescript-rest', '@decorators/express'],
81
- internal: true,
82
- });
83
- return validatorInstance;
84
- }
85
- exports.useDecoratorConfigValidator = useDecoratorConfigValidator;
86
- //# sourceMappingURL=validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources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declare class ResolverError extends Error {
3
- constructor(message?: string, node?: Node | TypeNode, onlyCurrent?: boolean);
4
- }
5
- export declare function prettyLocationOfNode(node: Node | TypeNode): string;
6
- export declare function prettyTroubleCause(node: Node | TypeNode, onlyCurrent?: boolean): string;
7
- //# sourceMappingURL=error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/resolver/error.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5C,qBAAa,aAAc,SAAQ,KAAK;gBACxB,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,QAAQ,EAAE,WAAW,UAAQ;CAO5E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,UAOzD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,EAAE,WAAW,UAAQ,UAQ5E"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.prettyTroubleCause = exports.prettyLocationOfNode = exports.ResolverError = void 0;
10
- const path_1 = require("path");
11
- class ResolverError extends Error {
12
- constructor(message, node, onlyCurrent = false) {
13
- super(message);
14
- if (node) {
15
- this.message = `${message}\n${prettyLocationOfNode(node)}\n${prettyTroubleCause(node, onlyCurrent)}`;
16
- }
17
- }
18
- }
19
- exports.ResolverError = ResolverError;
20
- function prettyLocationOfNode(node) {
21
- const sourceFile = node.getSourceFile();
22
- const token = node.getFirstToken() || node.parent.getFirstToken();
23
- const start = token ? `:${sourceFile.getLineAndCharacterOfPosition(token.getStart()).line + 1}` : '';
24
- const end = token ? `:${sourceFile.getLineAndCharacterOfPosition(token.getEnd()).line + 1}` : '';
25
- const normalizedPath = (0, path_1.normalize)(`${sourceFile.fileName}${start}${end}`);
26
- return `At: ${normalizedPath}.`;
27
- }
28
- exports.prettyLocationOfNode = prettyLocationOfNode;
29
- function prettyTroubleCause(node, onlyCurrent = false) {
30
- let name;
31
- if (onlyCurrent || !node.parent) {
32
- name = node.pos !== -1 ? node.getText() : node.name.text;
33
- }
34
- else {
35
- name = node.parent.pos !== -1 ? node.parent.getText() : node.parent.name.text;
36
- }
37
- return `This was caused by '${name}'`;
38
- }
39
- exports.prettyTroubleCause = prettyTroubleCause;
40
- //# sourceMappingURL=error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/resolver/error.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAAiC;AAGjC,MAAa,aAAc,SAAQ,KAAK;IACpC,YAAY,OAAgB,EAAE,IAAsB,EAAE,WAAW,GAAG,KAAK;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,OAAO,GAAG,GAAG,OAAQ,KAAK,oBAAoB,CAAC,IAAI,CAAC,KAAK,kBAAkB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC;SACzG;IACL,CAAC;CACJ;AARD,sCAQC;AAED,SAAgB,oBAAoB,CAAC,IAAqB;IACtD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;IAClE,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,6BAA6B,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACrG,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,6BAA6B,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjG,MAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,GAAG,UAAU,CAAC,QAAQ,GAAG,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC;IACzE,OAAO,OAAO,cAAc,GAAG,CAAC;AACpC,CAAC;AAPD,oDAOC;AAED,SAAgB,kBAAkB,CAAC,IAAqB,EAAE,WAAW,GAAG,KAAK;IACzE,IAAI,IAAY,CAAC;IACjB,IAAI,WAAW,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAC7B,IAAI,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAE,IAAY,CAAC,IAAI,CAAC,IAAI,CAAC;KACrE;SAAM;QACH,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAE,IAAY,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;KAC1F;IACD,OAAO,uBAAuB,IAAI,GAAG,CAAC;AAC1C,CAAC;AARD,gDAQC"}
@@ -1,5 +0,0 @@
1
- export * from './error';
2
- export * from './type';
3
- export * from './type-node';
4
- export * from './utils/initializer';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolver/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- __exportStar(require("./error"), exports);
24
- __exportStar(require("./type"), exports);
25
- __exportStar(require("./type-node"), exports);
26
- __exportStar(require("./utils/initializer"), exports);
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resolver/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,sDAAoC"}
@@ -1,53 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { MetadataGenerator } from '../generator';
3
- import { Resolver } from './type';
4
- interface TypeNodeResolverContext {
5
- [name: string]: ts.TypeReferenceNode | ts.TypeNode;
6
- }
7
- export declare class TypeNodeResolver {
8
- private readonly typeNode;
9
- private readonly current;
10
- private readonly parentNode?;
11
- private context;
12
- private readonly referencer?;
13
- constructor(typeNode: ts.TypeNode, current: MetadataGenerator, parentNode?: ts.Node, context?: TypeNodeResolverContext, referencer?: ts.TypeNode);
14
- static clearCache(): void;
15
- resolve(): Resolver.Type;
16
- private static isSupportedUtilityType;
17
- private static getUtilityTypeOptions;
18
- private filterUtilityProperties;
19
- private static resolveSpecialReference;
20
- private static getLiteralValue;
21
- private getPrimitiveType;
22
- private getDateType;
23
- private static getDesignatedModels;
24
- private getEnumerateType;
25
- private getReferenceType;
26
- private getTypeAliasReference;
27
- private getModelReference;
28
- private static getRefTypeName;
29
- private attemptToResolveKindToPrimitive;
30
- private contextualizedName;
31
- private handleCachingAndCircularReferences;
32
- private createCircularDependencyResolver;
33
- private static nodeIsUsable;
34
- private static resolveLeftmostIdentifier;
35
- private static resolveRightMostIdentifier;
36
- private findMatchingModuleOrEnumDeclaration;
37
- private resolveModelTypeScope;
38
- private getModelTypeDeclaration;
39
- private getModelProperties;
40
- private propertyFromSignature;
41
- private propertyFromDeclaration;
42
- private getModelAdditionalProperties;
43
- private typeArgumentsToContext;
44
- private getModelInheritedProperties;
45
- private hasPublicModifier;
46
- private hasStaticModifier;
47
- private isAccessibleParameter;
48
- private getNodeDescription;
49
- private static getNodeFormat;
50
- private static getNodeExample;
51
- }
52
- export {};
53
- //# sourceMappingURL=type-node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-node.d.ts","sourceRoot":"","sources":["../../src/resolver/type-node.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAOjD,OAAO,EACH,QAAQ,EACX,MAAM,QAAQ,CAAC;AAUhB,UAAU,uBAAuB;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,iBAAiB,GAAG,EAAE,CAAC,QAAQ,CAAC;CACtD;AAWD,qBAAa,gBAAgB;IAErB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC5B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAJX,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACrB,OAAO,EAAE,iBAAiB,EAC1B,UA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