@trapi/metadata 0.2.0 → 0.2.1

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 +10 -8
  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 +8 -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,145 +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.default = {
10
- // Class
11
- CLASS_PATH: {
12
- id: 'Path',
13
- properties: {
14
- DEFAULT: { type: 'element', srcArgumentType: 'argument' },
15
- },
16
- },
17
- // Class + Method
18
- REQUEST_ACCEPT: undefined,
19
- RESPONSE_EXAMPLE: {
20
- id: 'Example',
21
- properties: {
22
- TYPE: { isType: true, srcArgumentType: 'typeArgument' },
23
- PAYLOAD: { type: 'element', srcArgumentType: 'argument' },
24
- },
25
- },
26
- RESPONSE_DESCRIPTION: {
27
- id: 'Response',
28
- properties: {
29
- TYPE: { type: 'element', srcArgumentType: 'typeArgument' },
30
- STATUS_CODE: { type: 'element', srcArgumentType: 'argument', srcPosition: 0 },
31
- DESCRIPTION: { type: 'element', srcArgumentType: 'argument', srcPosition: 1 },
32
- PAYLOAD: { type: 'element', srcArgumentType: 'argument', srcPosition: 2 },
33
- },
34
- },
35
- // Method
36
- ALL: {
37
- id: 'ALL',
38
- properties: {},
39
- },
40
- GET: {
41
- id: 'GET',
42
- properties: {},
43
- },
44
- POST: {
45
- id: 'POST',
46
- properties: {},
47
- },
48
- PUT: {
49
- id: 'PUT',
50
- properties: {},
51
- },
52
- DELETE: {
53
- id: 'DELETE',
54
- properties: {},
55
- },
56
- PATCH: {
57
- id: 'PATCH',
58
- properties: {},
59
- },
60
- OPTIONS: {
61
- id: 'OPTIONS',
62
- properties: {},
63
- },
64
- HEAD: {
65
- id: 'HEAD',
66
- properties: {},
67
- },
68
- METHOD_PATH: {
69
- id: 'Path',
70
- properties: {
71
- DEFAULT: { type: 'element', srcArgumentType: 'argument' },
72
- },
73
- },
74
- // Parameter
75
- SERVER_CONTEXT: [
76
- {
77
- id: 'Context',
78
- },
79
- {
80
- id: 'ContextRequest',
81
- },
82
- {
83
- id: 'ContextResponse',
84
- },
85
- {
86
- id: 'ContextNext',
87
- },
88
- {
89
- id: 'ContextLanguage',
90
- },
91
- {
92
- id: 'ContextAccept',
93
- },
94
- ],
95
- SERVER_PARAMS: {
96
- id: 'Param',
97
- properties: {
98
- DEFAULT: {},
99
- },
100
- },
101
- SERVER_QUERY: {
102
- id: 'QueryParam',
103
- properties: {
104
- DEFAULT: {},
105
- },
106
- },
107
- SERVER_FORM: {
108
- id: 'FormParam',
109
- properties: {
110
- DEFAULT: {},
111
- },
112
- },
113
- SERVER_BODY: undefined,
114
- SERVER_HEADERS: {
115
- id: 'HeaderParam',
116
- properties: {
117
- DEFAULT: {},
118
- },
119
- },
120
- SERVER_COOKIES: {
121
- id: 'CookieParam',
122
- properties: {
123
- DEFAULT: {},
124
- },
125
- },
126
- SERVER_PATH_PARAMS: {
127
- id: 'PathParam',
128
- properties: {
129
- DEFAULT: {},
130
- },
131
- },
132
- SERVER_FILES_PARAM: {
133
- id: 'FilesParam',
134
- properties: {
135
- DEFAULT: {},
136
- },
137
- },
138
- SERVER_FILE_PARAM: {
139
- id: 'FileParam',
140
- properties: {
141
- DEFAULT: {},
142
- },
143
- },
144
- };
145
- //# sourceMappingURL=typescript-rest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typescript-rest.js","sourceRoot":"","sources":["../../../../src/decorator/mapper/maps/typescript-rest.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAIH,kBAAe;IACX,QAAQ;IACR,UAAU,EAAE;QACR,EAAE,EAAE,MAAM;QACV,UAAU,EAAE;YACR,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE;SAC5D;KACJ;IAED,iBAAiB;IACjB,cAAc,EAAE,SAAS;IACzB,gBAAgB,EAAE;QACd,EAAE,EAAE,SAAS;QACb,UAAU,EAAE;YACR,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE;YACvD,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE;SAC5D;KACJ;IACD,oBAAoB,EAAE;QAClB,EAAE,EAAE,UAAU;QACd,UAAU,EAAE;YACR,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE;YAC1D,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,EAAE;YAC7E,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EA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AE,YAAY;QAChB,UAAU,EAAE;YACR,OAAO,EAAE,EAAE;SACd;KACJ;IACD,WAAW,EAAE;QACT,EAAE,EAAE,WAAW;QACf,UAAU,EAAE;YACR,OAAO,EAAE,EAAE;SACd;KACJ;IACD,WAAW,EAAE,SAAS;IACtB,cAAc,EAAE;QACZ,EAAE,EAAE,aAAa;QACjB,UAAU,EAAE;YACR,OAAO,EAAE,EAAE;SACd;KACJ;IACD,cAAc,EAAE;QACZ,EAAE,EAAE,aAAa;QACjB,UAAU,EAAE;YACR,OAAO,EAAE,EAAE;SACd;KACJ;IACD,kBAAkB,EAAE;QAChB,EAAE,EAAE,WAAW;QACf,UAAU,EAAE;YACR,OAAO,EAAE,EAAE;SACd;KACJ;IACD,kBAAkB,EAAE;QAChB,EAAE,EAAE,YAAY;QAChB,UAAU,EAAE;YACR,OAAO,EAAE,EAAE;SACd;KACJ;IACD,iBAAiB,EAAE;QACf,EAAE,EAAE,WAAW;QACf,UAAU,EAAE;YACR,OAAO,EAAE,EAAE;SACd;KACJ;CACwC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { Decorator } from '../type';
2
- /**
3
- *
4
- *
5
- * @param mapping
6
- * @param reducer
7
- */
8
- export declare function reduceTypeRepresentationMapping(mapping: Partial<Decorator.TypeRepresentationMap>, reducer: (type: Decorator.Type) => boolean): Partial<Decorator.TypeRepresentationMap>;
9
- /**
10
- *
11
- *
12
- * @param type
13
- * @param config
14
- */
15
- export declare function isMappingTypeIncluded(type: Decorator.Type, config: Decorator.TypeRepresentationConfig): boolean;
16
- export declare function getDecoratorMap(name: string): Partial<Decorator.TypeRepresentationMap>;
17
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/decorator/mapper/utils.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC3C,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,EACjD,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,OAAO,GAC3C,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAgB1C;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,SAAS,CAAC,IAAI,EACpB,MAAM,EAAE,SAAS,CAAC,wBAAwB,GAC3C,OAAO,CAeT;AAID,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAI,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAUvF"}
@@ -1,73 +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.getDecoratorMap = exports.isMappingTypeIncluded = exports.reduceTypeRepresentationMapping = void 0;
10
- const metadata_utils_1 = require("@trapi/metadata-utils");
11
- /**
12
- *
13
- *
14
- * @param mapping
15
- * @param reducer
16
- */
17
- function reduceTypeRepresentationMapping(mapping, reducer) {
18
- const mappingKeys = Object.keys(mapping);
19
- const allowedTypes = mappingKeys
20
- .filter(reducer);
21
- if (mappingKeys.length === allowedTypes.length) {
22
- return mapping;
23
- }
24
- const result = {};
25
- for (let i = 0; i < allowedTypes.length; i++) {
26
- // @ts-ignore
27
- result[allowedTypes[i]] = mapping[allowedTypes[i]];
28
- }
29
- return result;
30
- }
31
- exports.reduceTypeRepresentationMapping = reduceTypeRepresentationMapping;
32
- /**
33
- *
34
- *
35
- * @param type
36
- * @param config
37
- */
38
- function isMappingTypeIncluded(type, config) {
39
- const allowedType = Object.prototype.toString.call(config);
40
- switch (allowedType) {
41
- case '[object Boolean]':
42
- return !!config;
43
- case '[object String]':
44
- return config === type;
45
- case '[object Array]':
46
- return config.indexOf(type) !== -1;
47
- case '[object Object]':
48
- return (0, metadata_utils_1.hasOwnProperty)(config, type) && config[type];
49
- }
50
- /* istanbul ignore next */
51
- return false;
52
- }
53
- exports.isMappingTypeIncluded = isMappingTypeIncluded;
54
- const decoratorMap = {};
55
- function getDecoratorMap(name) {
56
- if ((0, metadata_utils_1.hasOwnProperty)(decoratorMap, name)) {
57
- return decoratorMap[name];
58
- }
59
- const content = loadDecoratorMap(name);
60
- decoratorMap[name] = content;
61
- return content;
62
- }
63
- exports.getDecoratorMap = getDecoratorMap;
64
- /* istanbul ignore next */
65
- function loadDecoratorMap(library) {
66
- const exp = require(`./maps/${library}`);
67
- if ((0, metadata_utils_1.hasOwnProperty)(exp, 'default')) {
68
- return exp.default;
69
- }
70
- /* istanbul ignore next */
71
- return exp;
72
- }
73
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/decorator/mapper/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,0DAAuD;AAGvD;;;;;GAKG;AACH,SAAgB,+BAA+B,CAC3C,OAAiD,EACjD,OAA0C;IAE1C,MAAM,WAAW,GAAsB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAsB,CAAC;IACjF,MAAM,YAAY,GAAqB,WAAW;SAC7C,MAAM,CAAC,OAAO,CAAC,CAAC;IAErB,IAAI,WAAW,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE;QAC5C,OAAO,OAAO,CAAC;KAClB;IAED,MAAM,MAAM,GAA6C,EAAE,CAAC;IAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,aAAa;QACb,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;KACtD;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAnBD,0EAmBC;AAED;;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= Decorator.TypePropertyMap;
3
- export declare class RepresentationManager<T extends Decorator.Type> {
4
- protected representation: Decorator.Representation<T>;
5
- decorators: Decorator.Data[];
6
- protected extendedProperties: Partial<Decorator.RepresentationProperties<Decorator.TypePropertyMap[T]>>;
7
- constructor(representation: Decorator.Representation<T>, decorators: Decorator.Data[]);
8
- /**
9
- * Get one or more specific value(s) of the decorator arguments or typeArguments.
10
- * @param type
11
- * @param decoratorOrIndex
12
- */
13
- getPropertyValue<P extends keyof Decorator.TypePropertyMap[T]>(type: P, decoratorOrIndex?: number | Decorator.Data): TypePropertyMaps[T][P] | undefined;
14
- getPropertyConfiguration(type: keyof Decorator.TypePropertyMap[T]): Decorator.Property | undefined;
15
- protected extendProperty<P extends keyof Decorator.TypePropertyMap[T]>(type: P): Decorator.Property;
16
- }
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorator/representation/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,gBAAgB,GAAG,SAAS,CAAC,eAAe,CAAC;AAEpD,qBAAa,qBAAqB,CAAC,CAAC,SAAS,SAAS,CAAC,IAAI;IAInD,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAC9C,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE;IAJvC,SAAS,CAAC,kBAAkB,EAAG,OAAO,CAAC,SAAS,CAAC,wBAAwB,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAM;gBAGhG,cAAc,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,EAC9C,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE;IAOvC;;;;OAIG;IACI,gBAAgB,CAAC,CAAC,SAAS,MAAM,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,EAChE,IAAI,EAAE,CAAC,EACP,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,GAC1C,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;IA2B/B,wBAAwB,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,GAAI,SAAS,CAAC,QAAQ,GAAG,SAAS;IAU1G,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAI,SAAS,CAAC,QAAQ;CAUvG"}
@@ -1,61 +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.RepresentationManager = void 0;
10
- const metadata_utils_1 = require("@trapi/metadata-utils");
11
- const utils_1 = require("./property/utils");
12
- class RepresentationManager {
13
- constructor(representation, decorators) {
14
- this.representation = representation;
15
- this.decorators = decorators;
16
- this.extendedProperties = {};
17
- }
18
- // -------------------------------------------
19
- /**
20
- * Get one or more specific value(s) of the decorator arguments or typeArguments.
21
- * @param type
22
- * @param decoratorOrIndex
23
- */
24
- getPropertyValue(type, decoratorOrIndex) {
25
- const config = this.getPropertyConfiguration(type);
26
- if (typeof config === 'undefined') {
27
- return undefined;
28
- }
29
- let decorator;
30
- if (typeof decoratorOrIndex === 'number' ||
31
- typeof decoratorOrIndex === 'undefined') {
32
- decoratorOrIndex = decoratorOrIndex !== null && decoratorOrIndex !== void 0 ? decoratorOrIndex : 0;
33
- if (decoratorOrIndex < 0 || decoratorOrIndex >= this.decorators.length) {
34
- return undefined;
35
- }
36
- decorator = this.decorators[decoratorOrIndex];
37
- }
38
- else {
39
- decorator = decoratorOrIndex;
40
- }
41
- return (0, utils_1.extractRepresentationPropertyValue)(decorator, config);
42
- }
43
- // -------------------------------------------
44
- getPropertyConfiguration(type) {
45
- if (!(0, metadata_utils_1.hasOwnProperty)(this.representation.properties, type)) {
46
- return undefined;
47
- }
48
- return this.extendProperty(type);
49
- }
50
- // -------------------------------------------
51
- extendProperty(type) {
52
- if ((0, metadata_utils_1.hasOwnProperty)(this.extendedProperties, type)) {
53
- return this.extendedProperties[type];
54
- }
55
- const property = this.representation.properties[type];
56
- this.extendedProperties[type] = (0, utils_1.extendRepresentationPropertyConfig)(property);
57
- return this.extendedProperties[type];
58
- }
59
- }
60
- exports.RepresentationManager = RepresentationManager;
61
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorator/representation/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,0DAAuD;AAEvD,4CAA0G;AAG1G,MAAa,qBAAqB;IAG9B,YACc,cAA2C,EAC9C,UAA4B;QADzB,mBAAc,GAAd,cAAc,CAA6B;QAC9C,eAAU,GAAV,UAAU,CAAkB;QAJ7B,uBAAkB,GAA+E,EAAE,CAAC;IAO9G,CAAC;IAED,8CAA8C;IAE9C;;;;OAIG;IACI,gBAAgB,CACnB,IAAO,EACP,gBAA0C;QAE1C,MAAM,MAAM,GAAwB,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACxE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC/B,OAAO,SAAS,CAAC;SACpB;QAED,IAAI,SAA0B,CAAC;QAE/B,IACI,OAAO,gBAAgB,KAAK,QAAQ;YACpC,OAAO,gBAAgB,KAAK,WAAW,EACzC;YACE,gBAAgB,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,CAAC,CAAC;YACzC,IAAI,gBAAgB,GAAG,CAAC,IAAI,gBAAgB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;gBACpE,OAAO,SAAS,CAAC;aACpB;YAED,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;SACjD;aAAM;YACH,SAAS,GAAG,gBAAgB,CAAC;SAChC;QAED,OAAO,IAAA,0CAAkC,EAAO,SAAS,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED,8CAA8C;IAEvC,wBAAwB,CAAC,IAAwC;QACpE,IAAI,CAAC,IAAA,+BAAc,EAAC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE;YACvD,OAAO,SAAS,CAAC;SACpB;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,8CAA8C;IAEpC,cAAc,CAA+C,IAAO;QAC1E,IAAI,IAAA,+BAAc,EAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE;YAC/C,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;SACxC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,IAAA,0CAAkC,EAAC,QAAQ,CAAC,CAAC;QAE7E,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACJ;AAnED,sDAmEC"}
@@ -1,6 +0,0 @@
1
- import { Decorator } from '../../type';
2
- export declare function extendRepresentationPropertyConfig(property: Decorator.Property): Decorator.Property;
3
- export declare function extractRepresentationPropertyValue<T extends Decorator.Type, P extends keyof Decorator.TypePropertyMap[T]>(decorator: Decorator.Data, config: Decorator.Property): Decorator.TypePropertyMap[T][P] | undefined;
4
- export declare function mergeObjectArguments(data: unknown[]): Record<string, any>;
5
- export declare function mergeArrayArguments(data: unknown[]): unknown[];
6
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/decorator/representation/property/utils.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAqBnG;AAED,wBAAgB,kCAAkC,CAC9C,CAAC,SAAS,SAAS,CAAC,IAAI,EACxB,CAAC,SAAS,MAAM,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,EAE5C,SAAS,EAAE,SAAS,CAAC,IAAI,EACzB,MAAM,EAAE,SAAS,CAAC,QAAQ,GAC3B,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CA8D7C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,uBAUnD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,aAWlD"}
@@ -1,120 +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.mergeArrayArguments = exports.mergeObjectArguments = exports.extractRepresentationPropertyValue = exports.extendRepresentationPropertyConfig = void 0;
10
- const metadata_utils_1 = require("@trapi/metadata-utils");
11
- const resolver_1 = require("../../../resolver");
12
- function extendRepresentationPropertyConfig(property) {
13
- if (typeof property.isType === 'undefined') {
14
- property.isType = false;
15
- }
16
- if (typeof property.type === 'undefined') {
17
- property.type = 'element';
18
- }
19
- if (typeof property.srcArgumentType === 'undefined') {
20
- property.srcArgumentType = 'argument';
21
- }
22
- if (property.type === 'element' &&
23
- typeof property.srcPosition === 'undefined') {
24
- property.srcPosition = 0;
25
- }
26
- return property;
27
- }
28
- exports.extendRepresentationPropertyConfig = extendRepresentationPropertyConfig;
29
- function extractRepresentationPropertyValue(decorator, config) {
30
- var _a, _b, _c;
31
- let items = [];
32
- switch (config.srcArgumentType) {
33
- case 'typeArgument':
34
- items = decorator.typeArguments;
35
- break;
36
- case 'argument':
37
- items = decorator.arguments;
38
- break;
39
- }
40
- if (!config.isType) {
41
- items = extractValueFromArgumentType(items);
42
- }
43
- const srcPosition = (_a = config.srcPosition) !== null && _a !== void 0 ? _a : 0;
44
- const srcAmount = (_b = config.srcAmount) !== null && _b !== void 0 ? _b : 1;
45
- if (items.length <= srcPosition) {
46
- switch (config.type) {
47
- case 'element':
48
- return undefined;
49
- case 'array':
50
- return [];
51
- }
52
- }
53
- const data = srcAmount >= 1 ? items.slice(srcPosition, srcPosition + srcAmount) : items.slice(srcPosition);
54
- if (data.length === 0) {
55
- return (config.type === 'array' ? [] : undefined);
56
- }
57
- const srcStrategy = (_c = config.srcStrategy) !== null && _c !== void 0 ? _c : 'none';
58
- switch (srcStrategy) {
59
- case 'merge':
60
- switch (config.type) {
61
- case 'array':
62
- return mergeArrayArguments(data);
63
- case 'element':
64
- default:
65
- return mergeObjectArguments(data);
66
- }
67
- case 'none':
68
- // if we dont have any merge strategy, we just return the first argument.
69
- switch (config.type) {
70
- case 'array':
71
- const arr = Array.isArray(data[0]) ? data[0] : [data[0]];
72
- return arr;
73
- case 'element':
74
- default:
75
- return data[0];
76
- }
77
- default:
78
- if (typeof config.srcStrategy === 'function') {
79
- return config.srcStrategy(data);
80
- }
81
- return (config.type === 'array' ? [] : undefined);
82
- }
83
- }
84
- exports.extractRepresentationPropertyValue = extractRepresentationPropertyValue;
85
- function mergeObjectArguments(data) {
86
- let output = {};
87
- for (let i = 0; i < data.length; i++) {
88
- const prototype = Object.prototype.toString.call(data[i]);
89
- if (prototype === '[object Object]') {
90
- output = Object.assign(output, data[i]);
91
- }
92
- }
93
- return output;
94
- }
95
- exports.mergeObjectArguments = mergeObjectArguments;
96
- function mergeArrayArguments(data) {
97
- let merged = [];
98
- for (let i = 0; i < data.length; i++) {
99
- if (Array.isArray(data[i])) {
100
- merged = [...merged, ...data[i]];
101
- }
102
- else {
103
- merged.push(data[i]);
104
- }
105
- }
106
- return merged;
107
- }
108
- exports.mergeArrayArguments = mergeArrayArguments;
109
- function extractValueFromArgumentType(argument) {
110
- const values = [];
111
- for (let i = 0; i < argument.length; i++) {
112
- if (!(0, metadata_utils_1.hasOwnProperty)(argument[i], 'kind')) {
113
- values.push(argument[i]);
114
- continue;
115
- }
116
- values.push((0, resolver_1.getInitializerValue)(argument[i]));
117
- }
118
- return values;
119
- }
120
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/decorator/representation/property/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAKH,0DAAuD;AAEvD,gDAAwD;AAExD,SAAgB,kCAAkC,CAAC,QAA4B;IAC3E,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,WAAW,EAAE;QACxC,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;KAC3B;IAED,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,WAAW,EAAE;QACtC,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC;KAC7B;IAED,IAAI,OAAO,QAAQ,CAAC,eAAe,KAAK,WAAW,EAAE;QACjD,QAAQ,CAAC,eAAe,GAAG,UAAU,CAAC;KACzC;IAED,IACI,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC3B,OAAO,QAAQ,CAAC,WAAW,KAAK,WAAW,EAC7C;QACE,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC;KAC5B;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AArBD,gFAqBC;AAED,SAAgB,kCAAkC,CAI9C,SAAyB,EACzB,MAA0B;;IAE1B,IAAI,KAAK,GAAe,EAAE,CAAC;IAE3B,QAAQ,MAAM,CAAC,eAAe,EAAE;QAC5B,KAAK,cAAc;YACf,KAAK,GAAG,SAAS,CAAC,aAAa,CAAC;YAChC,MAAM;QACV,KAAK,UAAU;YACX,KAAK,GAAG,SAAS,CAAC,SAA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EAAE,GAAG,IAAI,CAAC,CAAC,CAAc,CAAC,CAAC;SACjD;aAAM;YACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAXD,kDAWC;AAED,SAAS,4BAA4B,CAAC,QAAmB;IACrD,MAAM,MAAM,GAAe,EAAE,CAAC;IAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,CAAC,IAAA,+BAAc,EAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACzB,SAAS;SACZ;QAED,MAAM,CAAC,IAAI,CAAC,IAAA,8BAAmB,EAAC,QAAQ,CAAC,CAAC,CAAe,CAAC,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -1,178 +0,0 @@
1
- export declare namespace Decorator {
2
- interface Data {
3
- text: string;
4
- arguments: any[];
5
- typeArguments: any[];
6
- }
7
- interface Config {
8
- /**
9
- * Use a pre defined third party TypeRepresentationMap in full scope or
10
- * only use a partial amount of defined type representations.
11
- *
12
- * Default: []
13
- */
14
- library?: ConfigLibrary;
15
- /**
16
- * Use all internal defined type representations or only use a subset.
17
- * Default: true
18
- */
19
- internal?: TypeRepresentationConfig;
20
- /**
21
- * Set up self defined type representations.
22
- */
23
- map?: Partial<TypeRepresentationMap>;
24
- }
25
- /**
26
- * These are the current by default supported third party libraries.
27
- */
28
- type Library = 'typescript-rest' | 'decorators-express';
29
- type ConfigLibrary = Library | Library[] | Record<string, TypeRepresentationConfig>;
30
- /**
31
- * Activate/Deactivate specific type representations of a TypeRepresentationMap.
32
- */
33
- type TypeRepresentationConfig = boolean | Type | Type[] | {
34
- [K in Type]?: boolean;
35
- };
36
- /**
37
- * This type maps a decorator type to its representation config.
38
- */
39
- type TypeRepresentationMap = {
40
- [T in keyof TypePropertyMap]: Representation<T> | Array<Representation<T>>;
41
- };
42
- /**
43
- * The id property is the name/text of the defined decorator.
44
- */
45
- interface Representation<T extends keyof TypePropertyMap> {
46
- id: string;
47
- properties?: RepresentationProperties<TypePropertyMap[T]>;
48
- }
49
- type RepresentationProperties<P> = {
50
- [K in keyof P]: Property;
51
- };
52
- /**
53
- * A decorator type is an identifier which is associated
54
- * to specific decorator names.
55
- */
56
- interface TypePropertyMap {
57
- SWAGGER_TAGS: {
58
- DEFAULT: string[];
59
- };
60
- CLASS_PATH: {
61
- DEFAULT: string;
62
- };
63
- REQUEST_ACCEPT: undefined;
64
- RESPONSE_EXAMPLE: {
65
- TYPE: unknown;
66
- PAYLOAD: unknown | unknown[];
67
- };
68
- RESPONSE_DESCRIPTION: {
69
- TYPE: unknown;
70
- STATUS_CODE: number | string;
71
- DESCRIPTION: string;
72
- PAYLOAD: unknown | unknown[];
73
- };
74
- REQUEST_CONSUMES: {
75
- DEFAULT: string[];
76
- };
77
- RESPONSE_PRODUCES: {
78
- DEFAULT: string[];
79
- };
80
- HIDDEN: {};
81
- EXTENSION: {
82
- KEY: string;
83
- VALUE: unknown | unknown[];
84
- };
85
- METHOD_PATH: {
86
- DEFAULT: string;
87
- };
88
- DEPRECATED: undefined;
89
- ALL: {
90
- DEFAULT?: string;
91
- };
92
- GET: {
93
- DEFAULT?: string;
94
- };
95
- POST: {
96
- DEFAULT?: string;
97
- };
98
- PUT: {
99
- DEFAULT?: string;
100
- };
101
- DELETE: {
102
- DEFAULT?: string;
103
- };
104
- PATCH: {
105
- DEFAULT?: string;
106
- };
107
- OPTIONS: {
108
- DEFAULT?: string;
109
- };
110
- HEAD: {
111
- DEFAULT?: string;
112
- };
113
- IS_INT: undefined;
114
- IS_LONG: undefined;
115
- IS_FlOAT: undefined;
116
- IS_DOUBLE: undefined;
117
- SERVER_CONTEXT: {};
118
- SERVER_PARAMS: {
119
- DEFAULT?: string;
120
- };
121
- SERVER_QUERY: {
122
- DEFAULT?: string;
123
- OPTIONS?: Record<string, any>;
124
- } | undefined;
125
- SERVER_FORM: {
126
- DEFAULT?: string;
127
- } | undefined;
128
- SERVER_BODY: {
129
- DEFAULT?: string;
130
- };
131
- SERVER_HEADERS: {
132
- DEFAULT?: string;
133
- };
134
- SERVER_COOKIES: {
135
- DEFAULT?: string;
136
- };
137
- SERVER_PATH_PARAMS: {
138
- DEFAULT?: string;
139
- };
140
- SERVER_FILE_PARAM: {
141
- DEFAULT?: string;
142
- };
143
- SERVER_FILES_PARAM: {
144
- DEFAULT?: string;
145
- };
146
- }
147
- type Type = keyof TypePropertyMap;
148
- type MethodHttpVerbType = Extract<Type, 'ALL' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD'>;
149
- type ParameterServerType = Extract<Type, 'SERVER_CONTEXT' | 'SERVER_PARAMS' | 'SERVER_QUERY' | 'SERVER_FORM' | 'SERVER_BODY' | 'SERVER_HEADERS' | 'SERVER_COOKIES' | 'SERVER_PATH_PARAMS' | 'SERVER_FILE_PARAM' | 'SERVER_FILES_PARAM'>;
150
- type PropertyStrategy = 'merge' | 'none' | ((...items: unknown[] | unknown[][]) => unknown | unknown[]);
151
- interface Property {
152
- /**
153
- * Default: 'element'
154
- */
155
- type?: 'element' | 'array';
156
- /**
157
- * Default: false
158
- */
159
- isType?: boolean;
160
- /**
161
- * Default: 'argument'
162
- */
163
- srcArgumentType?: 'argument' | 'typeArgument';
164
- /**
165
- * Default: 0
166
- */
167
- srcPosition?: number;
168
- /**
169
- * Default: undefined
170
- */
171
- srcAmount?: number;
172
- /**
173
- * Default: 'none'
174
- */
175
- srcStrategy?: PropertyStrategy;
176
- }
177
- }
178
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/decorator/type.ts"],"names":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