web_api_base 6.0.3 → 6.1.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 (155) hide show
  1. package/package.json +4 -5
  2. package/readme.md +36 -12
  3. package/dist/Application.d.ts +0 -28
  4. package/dist/Application.js +0 -643
  5. package/dist/Application.js.map +0 -1
  6. package/dist/ApplicationConfiguration.d.ts +0 -20
  7. package/dist/ApplicationConfiguration.js +0 -132
  8. package/dist/ApplicationConfiguration.js.map +0 -1
  9. package/dist/bin/CreateApplication.d.ts +0 -1
  10. package/dist/bin/CreateApplication.js +0 -6
  11. package/dist/bin/CreateApplication.js.map +0 -1
  12. package/dist/bin/CreateController.d.ts +0 -1
  13. package/dist/bin/CreateController.js +0 -5
  14. package/dist/bin/CreateController.js.map +0 -1
  15. package/dist/bin/Factory.d.ts +0 -2
  16. package/dist/bin/Factory.js +0 -81
  17. package/dist/bin/Factory.js.map +0 -1
  18. package/dist/controllers/AcceptedResult.d.ts +0 -4
  19. package/dist/controllers/AcceptedResult.js +0 -13
  20. package/dist/controllers/AcceptedResult.js.map +0 -1
  21. package/dist/controllers/ActionResult.d.ts +0 -5
  22. package/dist/controllers/ActionResult.js +0 -10
  23. package/dist/controllers/ActionResult.js.map +0 -1
  24. package/dist/controllers/BadRequestResult.d.ts +0 -4
  25. package/dist/controllers/BadRequestResult.js +0 -13
  26. package/dist/controllers/BadRequestResult.js.map +0 -1
  27. package/dist/controllers/CreatedResult.d.ts +0 -4
  28. package/dist/controllers/CreatedResult.js +0 -13
  29. package/dist/controllers/CreatedResult.js.map +0 -1
  30. package/dist/controllers/DownloadFileResult.d.ts +0 -4
  31. package/dist/controllers/DownloadFileResult.js +0 -13
  32. package/dist/controllers/DownloadFileResult.js.map +0 -1
  33. package/dist/controllers/ErrorResult.d.ts +0 -4
  34. package/dist/controllers/ErrorResult.js +0 -13
  35. package/dist/controllers/ErrorResult.js.map +0 -1
  36. package/dist/controllers/ForbiddenResult.d.ts +0 -4
  37. package/dist/controllers/ForbiddenResult.js +0 -13
  38. package/dist/controllers/ForbiddenResult.js.map +0 -1
  39. package/dist/controllers/GenericResult.d.ts +0 -5
  40. package/dist/controllers/GenericResult.js +0 -13
  41. package/dist/controllers/GenericResult.js.map +0 -1
  42. package/dist/controllers/NoContentResult.d.ts +0 -4
  43. package/dist/controllers/NoContentResult.js +0 -13
  44. package/dist/controllers/NoContentResult.js.map +0 -1
  45. package/dist/controllers/NotFoundResult.d.ts +0 -4
  46. package/dist/controllers/NotFoundResult.js +0 -13
  47. package/dist/controllers/NotFoundResult.js.map +0 -1
  48. package/dist/controllers/OKResult.d.ts +0 -4
  49. package/dist/controllers/OKResult.js +0 -13
  50. package/dist/controllers/OKResult.js.map +0 -1
  51. package/dist/controllers/SendFileResult.d.ts +0 -4
  52. package/dist/controllers/SendFileResult.js +0 -13
  53. package/dist/controllers/SendFileResult.js.map +0 -1
  54. package/dist/controllers/UnauthorizedResult.d.ts +0 -4
  55. package/dist/controllers/UnauthorizedResult.js +0 -13
  56. package/dist/controllers/UnauthorizedResult.js.map +0 -1
  57. package/dist/controllers/base/ControllerBase.d.ts +0 -32
  58. package/dist/controllers/base/ControllerBase.js +0 -84
  59. package/dist/controllers/base/ControllerBase.js.map +0 -1
  60. package/dist/decorators/controllers/ControllerDecorators.d.ts +0 -65
  61. package/dist/decorators/controllers/ControllerDecorators.js +0 -256
  62. package/dist/decorators/controllers/ControllerDecorators.js.map +0 -1
  63. package/dist/decorators/documentation/DocumentationDecorators.d.ts +0 -23
  64. package/dist/decorators/documentation/DocumentationDecorators.js +0 -69
  65. package/dist/decorators/documentation/DocumentationDecorators.js.map +0 -1
  66. package/dist/decorators/validations/ValidationDecorators.d.ts +0 -53
  67. package/dist/decorators/validations/ValidationDecorators.js +0 -181
  68. package/dist/decorators/validations/ValidationDecorators.js.map +0 -1
  69. package/dist/dependencyInjection/DependecyService.d.ts +0 -28
  70. package/dist/dependencyInjection/DependecyService.js +0 -136
  71. package/dist/dependencyInjection/DependecyService.js.map +0 -1
  72. package/dist/dependencyInjection/IDIContext.d.ts +0 -7
  73. package/dist/dependencyInjection/IDIContext.js +0 -3
  74. package/dist/dependencyInjection/IDIContext.js.map +0 -1
  75. package/dist/documentation/CSS.d.ts +0 -6
  76. package/dist/documentation/CSS.js +0 -302
  77. package/dist/documentation/CSS.js.map +0 -1
  78. package/dist/documentation/Documentation.d.ts +0 -7
  79. package/dist/documentation/Documentation.js +0 -89
  80. package/dist/documentation/Documentation.js.map +0 -1
  81. package/dist/documentation/HTML.d.ts +0 -4
  82. package/dist/documentation/HTML.js +0 -26
  83. package/dist/documentation/HTML.js.map +0 -1
  84. package/dist/documentation/JS.d.ts +0 -5
  85. package/dist/documentation/JS.js +0 -416
  86. package/dist/documentation/JS.js.map +0 -1
  87. package/dist/enums/httpVerbs/HttpVerbs.d.ts +0 -6
  88. package/dist/enums/httpVerbs/HttpVerbs.js +0 -11
  89. package/dist/enums/httpVerbs/HttpVerbs.js.map +0 -1
  90. package/dist/exceptions/ArgumentNullException.d.ts +0 -3
  91. package/dist/exceptions/ArgumentNullException.js +0 -10
  92. package/dist/exceptions/ArgumentNullException.js.map +0 -1
  93. package/dist/exceptions/BodyParseException.d.ts +0 -3
  94. package/dist/exceptions/BodyParseException.js +0 -10
  95. package/dist/exceptions/BodyParseException.js.map +0 -1
  96. package/dist/exceptions/ControllerLoadException.d.ts +0 -3
  97. package/dist/exceptions/ControllerLoadException.js +0 -10
  98. package/dist/exceptions/ControllerLoadException.js.map +0 -1
  99. package/dist/exceptions/DecoratorException.d.ts +0 -3
  100. package/dist/exceptions/DecoratorException.js +0 -10
  101. package/dist/exceptions/DecoratorException.js.map +0 -1
  102. package/dist/exceptions/Exception.d.ts +0 -4
  103. package/dist/exceptions/Exception.js +0 -10
  104. package/dist/exceptions/Exception.js.map +0 -1
  105. package/dist/exceptions/FileNotFoundException.d.ts +0 -3
  106. package/dist/exceptions/FileNotFoundException.js +0 -10
  107. package/dist/exceptions/FileNotFoundException.js.map +0 -1
  108. package/dist/exceptions/FindDependencyException.d.ts +0 -3
  109. package/dist/exceptions/FindDependencyException.js +0 -10
  110. package/dist/exceptions/FindDependencyException.js.map +0 -1
  111. package/dist/exceptions/InvalidEntityException.d.ts +0 -3
  112. package/dist/exceptions/InvalidEntityException.js +0 -10
  113. package/dist/exceptions/InvalidEntityException.js.map +0 -1
  114. package/dist/file/AbstractFileService.d.ts +0 -11
  115. package/dist/file/AbstractFileService.js +0 -6
  116. package/dist/file/AbstractFileService.js.map +0 -1
  117. package/dist/file/AbstractMultiPartRequestService.d.ts +0 -16
  118. package/dist/file/AbstractMultiPartRequestService.js +0 -12
  119. package/dist/file/AbstractMultiPartRequestService.js.map +0 -1
  120. package/dist/file/File.d.ts +0 -5
  121. package/dist/file/File.js +0 -10
  122. package/dist/file/File.js.map +0 -1
  123. package/dist/file/FileService.d.ts +0 -12
  124. package/dist/file/FileService.js +0 -136
  125. package/dist/file/FileService.js.map +0 -1
  126. package/dist/file/FormidableMultiPartRequestService.d.ts +0 -4
  127. package/dist/file/FormidableMultiPartRequestService.js +0 -73
  128. package/dist/file/FormidableMultiPartRequestService.js.map +0 -1
  129. package/dist/index.d.ts +0 -76
  130. package/dist/index.js +0 -225
  131. package/dist/index.js.map +0 -1
  132. package/dist/interfaces/IApplication.d.ts +0 -14
  133. package/dist/interfaces/IApplication.js +0 -3
  134. package/dist/interfaces/IApplication.js.map +0 -1
  135. package/dist/interfaces/IApplicationConfiguration.d.ts +0 -14
  136. package/dist/interfaces/IApplicationConfiguration.js +0 -3
  137. package/dist/interfaces/IApplicationConfiguration.js.map +0 -1
  138. package/dist/interfaces/IController.d.ts +0 -5
  139. package/dist/interfaces/IController.js +0 -3
  140. package/dist/interfaces/IController.js.map +0 -1
  141. package/dist/metadata/FunctionAnalizer.d.ts +0 -9
  142. package/dist/metadata/FunctionAnalizer.js +0 -57
  143. package/dist/metadata/FunctionAnalizer.js.map +0 -1
  144. package/dist/metadata/OwnMetaDataContainer.d.ts +0 -12
  145. package/dist/metadata/OwnMetaDataContainer.js +0 -33
  146. package/dist/metadata/OwnMetaDataContainer.js.map +0 -1
  147. package/dist/metadata/Type.d.ts +0 -7
  148. package/dist/metadata/Type.js +0 -139
  149. package/dist/metadata/Type.js.map +0 -1
  150. package/dist/midlewares/IMidleware.d.ts +0 -19
  151. package/dist/midlewares/IMidleware.js +0 -3
  152. package/dist/midlewares/IMidleware.js.map +0 -1
  153. package/dist/utils/Utils.d.ts +0 -3
  154. package/dist/utils/Utils.js +0 -11
  155. package/dist/utils/Utils.js.map +0 -1
@@ -1,53 +0,0 @@
1
- import 'reflect-metadata';
2
- export default class ValidationDecorators {
3
- constructor();
4
- private static _requiredKeyMetadata;
5
- private static _maxlenghtKeyMetadata;
6
- private static _minlenghtKeyMetadata;
7
- private static _regexKeyMetadata;
8
- private static _ruleKeyMetadata;
9
- private static _maxValueKeyMetadata;
10
- private static _minValueKeyMetadata;
11
- private static _keysToValidateKeyMetada;
12
- static AddField(target: Object, property: string): void;
13
- static GetFields(target: Object): string[];
14
- static Required(message?: string): (target: Object, property: string) => void;
15
- static IsRequired(target: Object, property: string): {
16
- Message: string;
17
- } | undefined;
18
- static MaxLenght(max: number, message?: string): (target: Object, property: string) => void;
19
- static GetMaxlenght(target: Object, property: string): {
20
- Message: string;
21
- Max: number;
22
- } | undefined;
23
- static MinLenght(min: number, message?: string): (target: Object, property: string) => void;
24
- static GetMinlenght(target: Object, property: string): {
25
- Message: string;
26
- Min: number;
27
- } | undefined;
28
- static MinValue(min: number, message?: string): (target: Object, property: string) => void;
29
- static GetMinValue(target: Object, property: string): {
30
- Message: string;
31
- Min: number;
32
- } | undefined;
33
- static MaxValue(max: number, message?: string): (target: Object, property: string) => void;
34
- static GetMaxValue(target: Object, property: string): {
35
- Message: string;
36
- Max: number;
37
- } | undefined;
38
- static Regex(regex: RegExp, message?: string): (target: Object, property: string) => void;
39
- static GetRegex(target: Object, property: string): {
40
- Message: string;
41
- RegExp: RegExp;
42
- } | undefined;
43
- static Rule<T>(validationFunction: (arg: T) => boolean, message?: string): (target: Object, property: string) => void;
44
- static GetRule<T>(target: Object, property: string): {
45
- Message: string;
46
- Function: (arg: T) => boolean;
47
- } | undefined;
48
- static Validate<T>(object: T): {
49
- Field: string;
50
- Message: string;
51
- }[];
52
- private static TryGetValue;
53
- }
@@ -1,181 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- require("reflect-metadata");
7
- const OwnMetaDataContainer_1 = __importDefault(require("../../metadata/OwnMetaDataContainer"));
8
- class ValidationDecorators {
9
- constructor() {
10
- }
11
- static AddField(target, property) {
12
- let meta = this.GetFields(target);
13
- meta.push(property);
14
- Reflect.defineMetadata(ValidationDecorators._keysToValidateKeyMetada, meta, target.constructor);
15
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._keysToValidateKeyMetada, undefined, meta);
16
- }
17
- static GetFields(target) {
18
- var _a;
19
- let meta = (_a = Reflect.getMetadata(ValidationDecorators._keysToValidateKeyMetada, target)) !== null && _a !== void 0 ? _a : Reflect.getMetadata(ValidationDecorators._keysToValidateKeyMetada, target.constructor);
20
- if (!meta) {
21
- let ownMeta = OwnMetaDataContainer_1.default.Get(target, ValidationDecorators._keysToValidateKeyMetada);
22
- if (ownMeta)
23
- meta = ownMeta.Value;
24
- else
25
- meta = [];
26
- }
27
- return meta;
28
- }
29
- static Required(message) {
30
- return function (target, property) {
31
- ValidationDecorators.AddField(target, property);
32
- let msg = message !== null && message !== void 0 ? message : `The field ${target.constructor.name}.${property} is required`;
33
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._requiredKeyMetadata, property, { Message: msg });
34
- Reflect.defineMetadata(ValidationDecorators._requiredKeyMetadata, { Message: msg }, target, property);
35
- };
36
- }
37
- static IsRequired(target, property) {
38
- return ValidationDecorators.TryGetValue(target, property, ValidationDecorators._requiredKeyMetadata);
39
- }
40
- static MaxLenght(max, message) {
41
- return function (target, property) {
42
- ValidationDecorators.AddField(target, property);
43
- let msg = message !== null && message !== void 0 ? message : `The field ${target.constructor.name}.${property} must be a maximum of ${max} caracteres`;
44
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._maxlenghtKeyMetadata, property, { Message: msg, Max: max });
45
- Reflect.defineMetadata(ValidationDecorators._maxlenghtKeyMetadata, { Message: msg, Max: max }, target, property);
46
- };
47
- }
48
- static GetMaxlenght(target, property) {
49
- return ValidationDecorators.TryGetValue(target, property, ValidationDecorators._maxlenghtKeyMetadata);
50
- }
51
- static MinLenght(min, message) {
52
- return function (target, property) {
53
- ValidationDecorators.AddField(target, property);
54
- let msg = message !== null && message !== void 0 ? message : `The field ${target.constructor.name}.${property} must be a minimum of ${min} caracteres`;
55
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._minlenghtKeyMetadata, property, { Message: msg, Min: min });
56
- Reflect.defineMetadata(ValidationDecorators._minlenghtKeyMetadata, { Message: msg, Min: min }, target, property);
57
- };
58
- }
59
- static GetMinlenght(target, property) {
60
- return ValidationDecorators.TryGetValue(target, property, ValidationDecorators._minlenghtKeyMetadata);
61
- }
62
- static MinValue(min, message) {
63
- return function (target, property) {
64
- ValidationDecorators.AddField(target, property);
65
- let msg = message !== null && message !== void 0 ? message : `The field ${target.constructor.name}.${property} must be a minimum value of ${min}`;
66
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._minValueKeyMetadata, property, { Message: msg, Min: min });
67
- Reflect.defineMetadata(ValidationDecorators._minValueKeyMetadata, { Message: msg, Min: min }, target, property);
68
- };
69
- }
70
- static GetMinValue(target, property) {
71
- return ValidationDecorators.TryGetValue(target, property, ValidationDecorators._minValueKeyMetadata);
72
- }
73
- static MaxValue(max, message) {
74
- return function (target, property) {
75
- ValidationDecorators.AddField(target, property);
76
- let msg = message !== null && message !== void 0 ? message : `The field ${target.constructor.name}.${property} must be a maximun value of ${max}`;
77
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._maxValueKeyMetadata, property, { Message: msg, Max: max });
78
- Reflect.defineMetadata(ValidationDecorators._maxValueKeyMetadata, { Message: msg, Max: max }, target, property);
79
- };
80
- }
81
- static GetMaxValue(target, property) {
82
- return ValidationDecorators.TryGetValue(target, property, ValidationDecorators._maxValueKeyMetadata);
83
- }
84
- static Regex(regex, message) {
85
- return function (target, property) {
86
- ValidationDecorators.AddField(target, property);
87
- let msg = message !== null && message !== void 0 ? message : `The field ${target.constructor.name}.${property} fails on validation expression`;
88
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._regexKeyMetadata, property, { Message: msg, RegExp: regex });
89
- Reflect.defineMetadata(ValidationDecorators._regexKeyMetadata, { Message: msg, RegExp: regex }, target, property);
90
- };
91
- }
92
- static GetRegex(target, property) {
93
- return Reflect.getMetadata(ValidationDecorators._regexKeyMetadata, target, property);
94
- }
95
- static Rule(validationFunction, message) {
96
- return function (target, property) {
97
- ValidationDecorators.AddField(target, property);
98
- let msg = message !== null && message !== void 0 ? message : `The field ${target.constructor.name}.${property} fails on validation expression`;
99
- OwnMetaDataContainer_1.default.Set(target.constructor, ValidationDecorators._ruleKeyMetadata, property, { Message: msg, Function: validationFunction });
100
- Reflect.defineMetadata(ValidationDecorators._ruleKeyMetadata, { Message: msg, Function: validationFunction }, target, property);
101
- };
102
- }
103
- static GetRule(target, property) {
104
- return Reflect.getMetadata(ValidationDecorators._ruleKeyMetadata, target, property);
105
- }
106
- static Validate(object) {
107
- let result = [];
108
- let o = object;
109
- let cache = [];
110
- for (let k of ValidationDecorators.GetFields(o)) {
111
- let required = ValidationDecorators.IsRequired(o, k);
112
- let maxLenght = ValidationDecorators.GetMaxlenght(o, k);
113
- let minLenght = ValidationDecorators.GetMinlenght(o, k);
114
- let maxValue = ValidationDecorators.GetMaxValue(o, k);
115
- let minValue = ValidationDecorators.GetMinValue(o, k);
116
- let regex = ValidationDecorators.GetRegex(o, k);
117
- let action = ValidationDecorators.GetRule(o, k);
118
- if (required && cache.filter(c => c.f == k && c.k == "r").length == 0) {
119
- cache.push({ f: k, k: "r" });
120
- if (!o[k])
121
- result.push({ Field: k, Message: required.Message });
122
- }
123
- if (maxLenght && cache.filter(c => c.f == k && c.k == "ml").length == 0) {
124
- cache.push({ f: k, k: "ml" });
125
- if (o[k] && (typeof o[k] == "string" && o[k].length > maxLenght.Max))
126
- result.push({ Field: k, Message: maxLenght.Message });
127
- }
128
- if (minLenght && cache.filter(c => c.f == k && c.k == "nl").length == 0) {
129
- cache.push({ f: k, k: "nl" });
130
- if (!o[k] || (typeof o[k] == "string" && o[k].length < minLenght.Min))
131
- result.push({ Field: k, Message: minLenght.Message });
132
- }
133
- if (regex && cache.filter(c => c.f == k && c.k == "rg").length == 0) {
134
- cache.push({ f: k, k: "rg" });
135
- if (!o[k] || (typeof o[k] == "string" && !regex.RegExp.test(o[k])))
136
- result.push({ Field: k, Message: regex.Message });
137
- }
138
- if (minValue && cache.filter(c => c.f == k && c.k == "mv").length == 0) {
139
- cache.push({ f: k, k: "mv" });
140
- if (!o[k] || (typeof o[k] == "number" && o[k] < minValue.Min))
141
- result.push({ Field: k, Message: minValue.Message });
142
- }
143
- if (maxValue && cache.filter(c => c.f == k && c.k == "nv").length == 0) {
144
- cache.push({ f: k, k: "nv" });
145
- if (!o[k] || (typeof o[k] == "number" && o[k] > maxValue.Max))
146
- result.push({ Field: k, Message: maxValue.Message });
147
- }
148
- if (action && cache.filter(c => c.f == k && c.k == "a").length == 0) {
149
- cache.push({ f: k, k: "a" });
150
- let actionResult = false;
151
- try {
152
- actionResult = action.Function(o[k]);
153
- }
154
- catch (_a) { }
155
- if (!actionResult)
156
- result.push({ Field: k, Message: action.Message });
157
- }
158
- }
159
- return result;
160
- }
161
- static TryGetValue(target, property, key) {
162
- var _a;
163
- let meta = (_a = Reflect.getMetadata(key, target, property)) !== null && _a !== void 0 ? _a : Reflect.getMetadata(key, target.constructor, property);
164
- if (!meta) {
165
- let ownMeta = OwnMetaDataContainer_1.default.Get(target, key, property);
166
- if (ownMeta)
167
- meta = ownMeta.Value;
168
- }
169
- return meta;
170
- }
171
- }
172
- ValidationDecorators._requiredKeyMetadata = "meta:validation-required";
173
- ValidationDecorators._maxlenghtKeyMetadata = "meta:validation-maxLenght";
174
- ValidationDecorators._minlenghtKeyMetadata = "meta:validation-minLenght";
175
- ValidationDecorators._regexKeyMetadata = "meta:validation-regex";
176
- ValidationDecorators._ruleKeyMetadata = "meta:validation-rule";
177
- ValidationDecorators._maxValueKeyMetadata = "meta:validation-maxValue";
178
- ValidationDecorators._minValueKeyMetadata = "meta:validation-minValue";
179
- ValidationDecorators._keysToValidateKeyMetada = "meta:mustValidate";
180
- exports.default = ValidationDecorators;
181
- //# sourceMappingURL=ValidationDecorators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ValidationDecorators.js","sourceRoot":"","sources":["../../../decorators/validations/ValidationDecorators.ts"],"names":[],"mappings":";;;;;AAAA,4BAA0B;AAC1B,+FAAqE;AAGrE,MAAqB,oBAAoB;IAErC;IAGA,CAAC;IAYM,MAAM,CAAC,QAAQ,CAAC,MAAe,EAAE,QAAiB;QAErD,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpB,OAAO,CAAC,cAAc,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAChG,8BAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,oBAAoB,CAAC,wBAAwB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/G,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,MAAe;;QAEnC,IAAI,IAAI,GAAG,MAAA,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,w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AAC;IACrB,CAAC;;AAjPc,yCAAoB,GAAG,0BAA0B,CAAC;AAClD,0CAAqB,GAAG,2BAA2B,CAAC;AACpD,0CAAqB,GAAG,2BAA2B,CAAC;AACpD,sCAAiB,GAAG,uBAAuB,CAAC;AAC5C,qCAAgB,GAAG,sBAAsB,CAAC;AAC1C,yCAAoB,GAAG,0BAA0B,CAAC;AAClD,yCAAoB,GAAG,0BAA0B,CAAC;AAClD,6CAAwB,GAAG,mBAAmB,CAAC;kBAd7C,oBAAoB"}
@@ -1,28 +0,0 @@
1
- import 'reflect-metadata';
2
- import IDIContext from './IDIContext';
3
- export default class DependecyService {
4
- private static _services;
5
- private static _injectableKey;
6
- private static _injectableTypeKey;
7
- static RegisterFor(type: Function, ctor: {
8
- new (...args: any[]): any;
9
- }, scope?: DIEscope, builder?: () => any): void;
10
- static Register(type: Function, scope?: DIEscope, builder?: () => any): void;
11
- private static DefaultObjectBuilder;
12
- static Resolve<T>(type: Function, context?: IDIContext): T | undefined;
13
- static ResolveCtor(ctor: Function, context?: IDIContext): any | undefined;
14
- static Injectable(): (target: Object, property: string | symbol) => void;
15
- static IsInjectable(target: object, property: string): boolean;
16
- static InjectOne(cTor: Function): (target: Object, property: string | symbol) => void;
17
- static GetDIType(target: object, property: string): {
18
- new (...args: any[]): unknown;
19
- } | undefined;
20
- static CheckForDependenciesAndResolve(object: any, context?: IDIContext): void;
21
- static Build<T extends Function>(Ctor: T): T;
22
- private static IsDIConext;
23
- }
24
- export declare enum DIEscope {
25
- SCOPED = 0,
26
- TRANSIENT = 1,
27
- SINGLETON = 2
28
- }
@@ -1,136 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DIEscope = void 0;
7
- require("reflect-metadata");
8
- const FindDependencyException_1 = __importDefault(require("../exceptions/FindDependencyException"));
9
- class DependecyService {
10
- static RegisterFor(type, ctor, scope, builder) {
11
- let defaultBuilder = DependecyService.DefaultObjectBuilder(type, ctor);
12
- let exist = this._services.find(s => s.Type == type);
13
- if (exist === undefined)
14
- this._services.push({ Type: type, Builder: builder !== null && builder !== void 0 ? builder : defaultBuilder, Scope: scope !== null && scope !== void 0 ? scope : DIEscope.TRANSIENT });
15
- else {
16
- exist.Scope = scope !== null && scope !== void 0 ? scope : exist.Scope;
17
- exist.Builder = builder !== null && builder !== void 0 ? builder : defaultBuilder;
18
- }
19
- }
20
- static Register(type, scope, builder) {
21
- let defaultBuilder = DependecyService.DefaultObjectBuilder(type);
22
- let exist = this._services.find(s => s.Type == type);
23
- if (exist === undefined)
24
- this._services.push({ Type: type, Builder: builder !== null && builder !== void 0 ? builder : defaultBuilder, Scope: scope !== null && scope !== void 0 ? scope : DIEscope.TRANSIENT });
25
- else {
26
- exist.Scope = scope !== null && scope !== void 0 ? scope : exist.Scope;
27
- exist.Builder = builder !== null && builder !== void 0 ? builder : defaultBuilder;
28
- }
29
- }
30
- static DefaultObjectBuilder(type, ctor) {
31
- return function (context) {
32
- let service = DependecyService._services.find(u => u.Type == type);
33
- if (context && context.Intances && (service === null || service === void 0 ? void 0 : service.Scope) == DIEscope.SCOPED) {
34
- let scopped = context.Intances.filter(s => s.Type == type);
35
- if (scopped.length > 0 && scopped[0].Object) {
36
- return scopped[0].Object;
37
- }
38
- }
39
- let insance = Reflect.construct(ctor !== null && ctor !== void 0 ? ctor : type, []);
40
- DependecyService.CheckForDependenciesAndResolve(insance, (context !== null && context !== void 0 ? context : DependecyService.IsDIConext(insance)) ? insance : undefined);
41
- return insance;
42
- };
43
- }
44
- static Resolve(type, context) {
45
- let service = this._services.find(u => u.Type == type);
46
- if (!service)
47
- return undefined;
48
- let insance = service.Builder(context);
49
- if (service.Scope == DIEscope.SINGLETON) {
50
- service.Builder = () => insance;
51
- }
52
- return insance;
53
- }
54
- static ResolveCtor(ctor, context) {
55
- let service = this._services.find(u => u.Type == ctor);
56
- if (!service)
57
- return undefined;
58
- let insance = service.Builder(context);
59
- if (service.Scope == DIEscope.SINGLETON) {
60
- service.Builder = () => insance;
61
- }
62
- return insance;
63
- }
64
- static Injectable() {
65
- return function (target, property) {
66
- Reflect.defineMetadata(DependecyService._injectableKey, true, target.constructor, property);
67
- };
68
- }
69
- static IsInjectable(target, property) {
70
- var _a;
71
- let marked = (_a = Reflect.getMetadata(DependecyService._injectableKey, target, property)) !== null && _a !== void 0 ? _a : false;
72
- let type = Reflect.getMetadata(DependecyService._injectableTypeKey, target, property) != undefined;
73
- return marked || type;
74
- }
75
- static InjectOne(cTor) {
76
- return function (target, property) {
77
- Reflect.defineMetadata(DependecyService._injectableTypeKey, cTor, target.constructor, property);
78
- };
79
- }
80
- static GetDIType(target, property) {
81
- let type = Reflect.getMetadata(DependecyService._injectableTypeKey, target.constructor, property);
82
- if (!type)
83
- type = Reflect.getMetadata("design:type", target, property);
84
- return type;
85
- }
86
- static CheckForDependenciesAndResolve(object, context) {
87
- for (let k of Object.keys(object)) {
88
- if (object[k] != 'function') {
89
- if (DependecyService.IsInjectable(object.constructor, k)) {
90
- let tp = DependecyService.GetDIType(object, k);
91
- if (tp == undefined)
92
- throw new FindDependencyException_1.default(`Can not resolve the dependecy of ${object.constructor.name}.${k}`);
93
- let service = this._services.find(u => u.Type == tp);
94
- if (context && context.Intances && (service === null || service === void 0 ? void 0 : service.Scope) == DIEscope.SCOPED) {
95
- let scopped = context.Intances.filter(s => s.Type == tp);
96
- if (scopped.length > 0 && scopped[0]) {
97
- object[k] = scopped[0].Object;
98
- continue;
99
- }
100
- }
101
- let instance = DependecyService.Resolve(tp);
102
- if (instance == undefined)
103
- throw new FindDependencyException_1.default(`Can not resolve the dependecy of ${object.constructor.name}.${k}`);
104
- if (DependecyService.IsDIConext(object) && (service === null || service === void 0 ? void 0 : service.Scope) == DIEscope.SCOPED) {
105
- if (!object.Intances)
106
- object.Intances = [];
107
- object.Intances.push({
108
- Object: instance,
109
- Type: tp
110
- });
111
- }
112
- object[k] = instance;
113
- }
114
- }
115
- }
116
- }
117
- static Build(Ctor) {
118
- let object = Reflect.construct(Ctor, []);
119
- this.CheckForDependenciesAndResolve(object);
120
- return object;
121
- }
122
- static IsDIConext(object) {
123
- return "Intances" in object;
124
- }
125
- }
126
- DependecyService._services = [];
127
- DependecyService._injectableKey = "di:injectable";
128
- DependecyService._injectableTypeKey = "di:injectable-type";
129
- exports.default = DependecyService;
130
- var DIEscope;
131
- (function (DIEscope) {
132
- DIEscope[DIEscope["SCOPED"] = 0] = "SCOPED";
133
- DIEscope[DIEscope["TRANSIENT"] = 1] = "TRANSIENT";
134
- DIEscope[DIEscope["SINGLETON"] = 2] = "SINGLETON";
135
- })(DIEscope || (exports.DIEscope = DIEscope = {}));
136
- //# sourceMappingURL=DependecyService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DependecyService.js","sourceRoot":"","sources":["../../dependencyInjection/DependecyService.ts"],"names":[],"mappings":";;;;;;AAAA,4BAA0B;AAG1B,oGAA4E;AAE5E,MAAqB,gBAAgB;IAO1B,MAAM,CAAC,WAAW,CAAC,IAAe,EAAE,IAAsC,EAAE,KAAkB,EAAE,OAAoB;QAEvH,IAAI,cAAc,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEvE,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAErD,IAAG,KAAK,KAAK,SAAS;YAClB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAG,IAAI,EAAE,OAAO,EAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,cAAc,EAAE,KAAK,EAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;aAC/G,CAAC;YACD,KAAK,CAAC,KAAK,GA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,CAAA;AACb,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB"}
@@ -1,7 +0,0 @@
1
- export default interface IDIContext {
2
- Intances: IDIItem[];
3
- }
4
- export interface IDIItem {
5
- Object: any;
6
- Type: Function;
7
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IDIContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IDIContext.js","sourceRoot":"","sources":["../../dependencyInjection/IDIContext.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- export default class CSS {
2
- private static _dark;
3
- private static _light;
4
- private static _css;
5
- static Save(): void;
6
- }