web_api_base 4.0.8 → 5.0.0
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/package.json +3 -1
- package/readme.md +20 -0
- package/dist/Application.d.ts +0 -26
- package/dist/Application.js +0 -495
- package/dist/Application.js.map +0 -1
- package/dist/ApplicationConfiguration.d.ts +0 -20
- package/dist/ApplicationConfiguration.js +0 -132
- package/dist/ApplicationConfiguration.js.map +0 -1
- package/dist/bin/CreateApplication.d.ts +0 -1
- package/dist/bin/CreateApplication.js +0 -41
- package/dist/bin/CreateApplication.js.map +0 -1
- package/dist/bin/CreateController.d.ts +0 -1
- package/dist/bin/CreateController.js +0 -42
- package/dist/bin/CreateController.js.map +0 -1
- package/dist/controllers/AcceptedResult.d.ts +0 -4
- package/dist/controllers/AcceptedResult.js +0 -13
- package/dist/controllers/AcceptedResult.js.map +0 -1
- package/dist/controllers/ActionResult.d.ts +0 -5
- package/dist/controllers/ActionResult.js +0 -10
- package/dist/controllers/ActionResult.js.map +0 -1
- package/dist/controllers/BadRequestResult.d.ts +0 -4
- package/dist/controllers/BadRequestResult.js +0 -13
- package/dist/controllers/BadRequestResult.js.map +0 -1
- package/dist/controllers/CreatedResult.d.ts +0 -4
- package/dist/controllers/CreatedResult.js +0 -13
- package/dist/controllers/CreatedResult.js.map +0 -1
- package/dist/controllers/ErrorResult.d.ts +0 -4
- package/dist/controllers/ErrorResult.js +0 -13
- package/dist/controllers/ErrorResult.js.map +0 -1
- package/dist/controllers/ForbiddenResult.d.ts +0 -4
- package/dist/controllers/ForbiddenResult.js +0 -13
- package/dist/controllers/ForbiddenResult.js.map +0 -1
- package/dist/controllers/GenericResult.d.ts +0 -5
- package/dist/controllers/GenericResult.js +0 -13
- package/dist/controllers/GenericResult.js.map +0 -1
- package/dist/controllers/NoContentResult.d.ts +0 -4
- package/dist/controllers/NoContentResult.js +0 -13
- package/dist/controllers/NoContentResult.js.map +0 -1
- package/dist/controllers/NotFoundResult.d.ts +0 -4
- package/dist/controllers/NotFoundResult.js +0 -13
- package/dist/controllers/NotFoundResult.js.map +0 -1
- package/dist/controllers/OKResult.d.ts +0 -4
- package/dist/controllers/OKResult.js +0 -13
- package/dist/controllers/OKResult.js.map +0 -1
- package/dist/controllers/UnauthorizedResult.d.ts +0 -4
- package/dist/controllers/UnauthorizedResult.js +0 -13
- package/dist/controllers/UnauthorizedResult.js.map +0 -1
- package/dist/controllers/base/ControllerBase.d.ts +0 -28
- package/dist/controllers/base/ControllerBase.js +0 -65
- package/dist/controllers/base/ControllerBase.js.map +0 -1
- package/dist/decorators/controllers/ControllerDecorators.d.ts +0 -52
- package/dist/decorators/controllers/ControllerDecorators.js +0 -179
- package/dist/decorators/controllers/ControllerDecorators.js.map +0 -1
- package/dist/decorators/documentation/DocumentationDecorators.d.ts +0 -17
- package/dist/decorators/documentation/DocumentationDecorators.js +0 -39
- package/dist/decorators/documentation/DocumentationDecorators.js.map +0 -1
- package/dist/decorators/validations/ValidationDecorators.d.ts +0 -53
- package/dist/decorators/validations/ValidationDecorators.js +0 -181
- package/dist/decorators/validations/ValidationDecorators.js.map +0 -1
- package/dist/dependencyInjection/DependecyService.d.ts +0 -28
- package/dist/dependencyInjection/DependecyService.js +0 -136
- package/dist/dependencyInjection/DependecyService.js.map +0 -1
- package/dist/dependencyInjection/IDIContext.d.ts +0 -7
- package/dist/dependencyInjection/IDIContext.js +0 -3
- package/dist/dependencyInjection/IDIContext.js.map +0 -1
- package/dist/documentation/CSS.d.ts +0 -6
- package/dist/documentation/CSS.js +0 -302
- package/dist/documentation/CSS.js.map +0 -1
- package/dist/documentation/Documentation.d.ts +0 -7
- package/dist/documentation/Documentation.js +0 -82
- package/dist/documentation/Documentation.js.map +0 -1
- package/dist/documentation/HTML.d.ts +0 -4
- package/dist/documentation/HTML.js +0 -26
- package/dist/documentation/HTML.js.map +0 -1
- package/dist/documentation/JS.d.ts +0 -5
- package/dist/documentation/JS.js +0 -279
- package/dist/documentation/JS.js.map +0 -1
- package/dist/enums/httpVerbs/HttpVerbs.d.ts +0 -6
- package/dist/enums/httpVerbs/HttpVerbs.js +0 -11
- package/dist/enums/httpVerbs/HttpVerbs.js.map +0 -1
- package/dist/exceptions/ArgumentNullException.d.ts +0 -3
- package/dist/exceptions/ArgumentNullException.js +0 -10
- package/dist/exceptions/ArgumentNullException.js.map +0 -1
- package/dist/exceptions/BodyParseException.d.ts +0 -3
- package/dist/exceptions/BodyParseException.js +0 -10
- package/dist/exceptions/BodyParseException.js.map +0 -1
- package/dist/exceptions/ControllerLoadException.d.ts +0 -3
- package/dist/exceptions/ControllerLoadException.js +0 -10
- package/dist/exceptions/ControllerLoadException.js.map +0 -1
- package/dist/exceptions/Exception.d.ts +0 -4
- package/dist/exceptions/Exception.js +0 -10
- package/dist/exceptions/Exception.js.map +0 -1
- package/dist/exceptions/FindDependencyException.d.ts +0 -3
- package/dist/exceptions/FindDependencyException.js +0 -10
- package/dist/exceptions/FindDependencyException.js.map +0 -1
- package/dist/index.d.ts +0 -64
- package/dist/index.js +0 -195
- package/dist/index.js.map +0 -1
- package/dist/interfaces/IApplication.d.ts +0 -13
- package/dist/interfaces/IApplication.js +0 -3
- package/dist/interfaces/IApplication.js.map +0 -1
- package/dist/interfaces/IApplicationConfiguration.d.ts +0 -14
- package/dist/interfaces/IApplicationConfiguration.js +0 -3
- package/dist/interfaces/IApplicationConfiguration.js.map +0 -1
- package/dist/interfaces/IController.d.ts +0 -5
- package/dist/interfaces/IController.js +0 -3
- package/dist/interfaces/IController.js.map +0 -1
- package/dist/metadata/FunctionAnalizer.d.ts +0 -8
- package/dist/metadata/FunctionAnalizer.js +0 -23
- package/dist/metadata/FunctionAnalizer.js.map +0 -1
- package/dist/metadata/OwnMetaDataContainer.d.ts +0 -12
- package/dist/metadata/OwnMetaDataContainer.js +0 -33
- package/dist/metadata/OwnMetaDataContainer.js.map +0 -1
- package/dist/metadata/Type.d.ts +0 -5
- package/dist/metadata/Type.js +0 -49
- package/dist/metadata/Type.js.map +0 -1
- package/dist/midlewares/IMidleware.d.ts +0 -19
- package/dist/midlewares/IMidleware.js +0 -3
- package/dist/midlewares/IMidleware.js.map +0 -1
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const fs_1 = __importDefault(require("fs"));
|
|
39
|
-
const path_1 = __importDefault(require("path"));
|
|
40
|
-
const DependecyService_1 = __importStar(require("./dependencyInjection/DependecyService"));
|
|
41
|
-
class ApplicationConfiguration {
|
|
42
|
-
constructor() {
|
|
43
|
-
this.Host = "localhost";
|
|
44
|
-
this.Port = 60000;
|
|
45
|
-
this.EnviromentVariables = {};
|
|
46
|
-
this.CurrentWorkingDirectory = process.cwd();
|
|
47
|
-
this.ExecutablePath = process.argv[1];
|
|
48
|
-
this.RootPath = path_1.default.parse(this.ExecutablePath).dir;
|
|
49
|
-
if (process.argv.indexOf("--debug") > -1 || process.argv.indexOf("--DEBUG") > 1)
|
|
50
|
-
this.DEBUG = true;
|
|
51
|
-
else
|
|
52
|
-
this.DEBUG = false;
|
|
53
|
-
}
|
|
54
|
-
AddScoped(type, ctor, builder) {
|
|
55
|
-
if (ctor) {
|
|
56
|
-
DependecyService_1.default.RegisterFor(type, ctor, DependecyService_1.DIEscope.SCOPED, builder);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
DependecyService_1.default.Register(type, DependecyService_1.DIEscope.SCOPED, builder);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
AddTransient(type, ctor, builder) {
|
|
63
|
-
if (ctor) {
|
|
64
|
-
DependecyService_1.default.RegisterFor(type, ctor, DependecyService_1.DIEscope.TRANSIENT, builder);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
DependecyService_1.default.Register(type, DependecyService_1.DIEscope.TRANSIENT, builder);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
AddSingleton(type, ctor, builder) {
|
|
71
|
-
if (ctor) {
|
|
72
|
-
DependecyService_1.default.RegisterFor(type, ctor, DependecyService_1.DIEscope.SINGLETON, builder);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
DependecyService_1.default.Register(type, DependecyService_1.DIEscope.SINGLETON, builder);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
CheckFileAsync() {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
return new Promise((resolve, _) => resolve(fs_1.default.existsSync(`${this.RootPath}\\config.json`)));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
LoadAsync() {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
return new Promise((resolve, _) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
if (!(yield this.CheckFileAsync()))
|
|
87
|
-
return resolve(false);
|
|
88
|
-
fs_1.default.readFile(`${this.RootPath}\\config.json`, 'utf-8', (error, data) => {
|
|
89
|
-
if (error) {
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
try {
|
|
93
|
-
let json = JSON.parse(data);
|
|
94
|
-
for (let key in this) {
|
|
95
|
-
if (json[key] != undefined) {
|
|
96
|
-
this[key] = json[key];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (_a) { }
|
|
101
|
-
this.UpdateEnviroment();
|
|
102
|
-
resolve(true);
|
|
103
|
-
});
|
|
104
|
-
}));
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
SaveAsync() {
|
|
108
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
return new Promise((resolve, _) => {
|
|
110
|
-
let copy = JSON.parse(JSON.stringify(this));
|
|
111
|
-
delete copy.RootPath;
|
|
112
|
-
delete copy.DEBUG;
|
|
113
|
-
delete copy.CurrentWorkingDirectory;
|
|
114
|
-
delete copy.ExecutablePath;
|
|
115
|
-
fs_1.default.writeFile(`${this.RootPath}\\config.json`, JSON.stringify(copy), 'utf-8', error => {
|
|
116
|
-
this.UpdateEnviroment();
|
|
117
|
-
if (error) {
|
|
118
|
-
throw error;
|
|
119
|
-
}
|
|
120
|
-
resolve(true);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
UpdateEnviroment() {
|
|
126
|
-
for (let k in this.EnviromentVariables) {
|
|
127
|
-
process.env[k] = this.EnviromentVariables[k];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.default = ApplicationConfiguration;
|
|
132
|
-
//# sourceMappingURL=ApplicationConfiguration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationConfiguration.js","sourceRoot":"","sources":["../ApplicationConfiguration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAsB;AACtB,gDAAwB;AAExB,2FAAoF;AAEpF,MAAqB,wBAAwB;IAWzC;QARO,SAAI,GAAY,WAAW,CAAC;QAC5B,SAAI,GAAY,KAAK,CAAC;QAKtB,wBAAmB,GAA4B,EAAE,CAAC;QAIrD,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAE7C,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAEtC,IAAI,CAAC,QAAQ,GAAG,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC;QAEpD,IAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAI,CAAC;YAC3E,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;;YA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AAM,KAAK,CAAC;qBACf;oBAED,OAAO,CAAC,IAAI,CAAC,CAAC;gBAElB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAA;QAEN,CAAC;KAAA;IAEO,gBAAgB;QAEpB,KAAI,IAAI,CAAC,IAAI,IAAI,CAAC,mBAAmB,EACrC;YACI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;SAChD;IACL,CAAC;CAEJ;AAxID,2CAwIC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +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
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
var currentDirectoryPath = path_1.default.join(process.cwd());
|
|
9
|
-
var AppName = "App";
|
|
10
|
-
var app = `
|
|
11
|
-
import { Application, IApplicationConfiguration } from "web_api_base";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export default class ${AppName} extends Application
|
|
15
|
-
{
|
|
16
|
-
constructor()
|
|
17
|
-
{
|
|
18
|
-
super();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public override async ConfigureAsync(appConfig: IApplicationConfiguration): Promise<void>
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
this.UseCors();
|
|
25
|
-
|
|
26
|
-
await this.UseControllersAsync();
|
|
27
|
-
|
|
28
|
-
if(appConfig.DEBUG)
|
|
29
|
-
this.CreateDocumentation();
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}`;
|
|
35
|
-
if (fs_1.default.existsSync(path_1.default.join(currentDirectoryPath, `${AppName}.ts`)))
|
|
36
|
-
console.log(`The class ${AppName} already exists`);
|
|
37
|
-
else {
|
|
38
|
-
fs_1.default.writeFileSync(path_1.default.join(currentDirectoryPath, `${AppName}.ts`), app, 'utf-8');
|
|
39
|
-
console.log(`The cçass ${AppName} created : ${path_1.default.join(currentDirectoryPath, `${AppName}.ts`)}`);
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=CreateApplication.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateApplication.js","sourceRoot":"","sources":["../../bin/CreateApplication.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,4CAAoB;AAEpB,IAAI,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAEpD,IAAI,OAAO,GAAG,KAAK,CAAC;AAEpB,IAAI,GAAG,GAAG;;;;uBAIa,OAAO;;;;;;;;;;;;;;;;;;;;EAoB5B,CAAC;AAGH,IAAG,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,OAAO,KAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,iBAAiB,CAAC,CAAC;KAEnD;IACI,YAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,OAAO,KAAK,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,cAAc,cAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC;CACrG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +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
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
var currentDirectoryPath = path_1.default.join(process.cwd());
|
|
9
|
-
var controllerName = "SampleController";
|
|
10
|
-
var controller = `
|
|
11
|
-
import { ControllerBase, Route, Action, ProducesResponse } from "web_api_base";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@Route()
|
|
15
|
-
export default class ${controllerName} extends ControllerBase
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
constructor()
|
|
19
|
-
{
|
|
20
|
-
super();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@Action()
|
|
24
|
-
@ProducesResponse({ Status : 200, Description: "OK", JSON : JSON.stringify({status : "pong"}, null, 2)})
|
|
25
|
-
public Ping() : void
|
|
26
|
-
{
|
|
27
|
-
this.OK({status : "pong"});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}`;
|
|
31
|
-
if (!(currentDirectoryPath.endsWith("controllers/") || currentDirectoryPath.endsWith("controllers"))) {
|
|
32
|
-
currentDirectoryPath = path_1.default.join(currentDirectoryPath, "controllers");
|
|
33
|
-
if (!fs_1.default.existsSync(currentDirectoryPath))
|
|
34
|
-
fs_1.default.mkdirSync(currentDirectoryPath);
|
|
35
|
-
}
|
|
36
|
-
if (fs_1.default.existsSync(path_1.default.join(currentDirectoryPath, `${controllerName}.ts`)))
|
|
37
|
-
console.log(`The controller ${controllerName} already exists`);
|
|
38
|
-
else {
|
|
39
|
-
fs_1.default.writeFileSync(path_1.default.join(currentDirectoryPath, `${controllerName}.ts`), controller, 'utf-8');
|
|
40
|
-
console.log(`The controller ${controllerName} created : ${path_1.default.join(currentDirectoryPath, `${controllerName}.ts`)}`);
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=CreateController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateController.js","sourceRoot":"","sources":["../../bin/CreateController.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,4CAAoB;AAEpB,IAAI,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAEpD,IAAI,cAAc,GAAG,kBAAkB,CAAC;AAExC,IAAI,UAAU,GAAG;;;;;uBAKM,cAAc;;;;;;;;;;;;;;;EAenC,CAAC;AAEH,IAAG,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,oBAAoB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EACnG;IACI,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC;IAEtE,IAAG,CAAC,YAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC;QACnC,YAAE,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;CAC1C;AAED,IAAG,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,cAAc,KAAK,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,kBAAkB,cAAc,iBAAiB,CAAC,CAAC;KAE/D;IACI,YAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,cAAc,KAAK,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/F,OAAO,CAAC,GAAG,CAAC,kBAAkB,cAAc,cAAc,cAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,cAAc,KAAK,CAAC,EAAE,CAAC,CAAC;CACxH"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class AcceptedResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(202, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = AcceptedResult;
|
|
13
|
-
//# sourceMappingURL=AcceptedResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcceptedResult.js","sourceRoot":"","sources":["../../controllers/AcceptedResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,cAAkB,SAAQ,uBAAgB;IAE3D,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,iCAKC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class ActionResult {
|
|
4
|
-
constructor(status, result) {
|
|
5
|
-
this.Result = result;
|
|
6
|
-
this.StatusCode = status;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.default = ActionResult;
|
|
10
|
-
//# sourceMappingURL=ActionResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionResult.js","sourceRoot":"","sources":["../../controllers/ActionResult.ts"],"names":[],"mappings":";;AAAA,MAAqB,YAAY;IAK7B,YAAY,MAAc,EAAE,MAAa;QAErC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;IAC7B,CAAC;CACJ;AAVD,+BAUC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class BadRequestResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(400, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = BadRequestResult;
|
|
13
|
-
//# sourceMappingURL=BadRequestResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BadRequestResult.js","sourceRoot":"","sources":["../../controllers/BadRequestResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,gBAAoB,SAAQ,uBAAgB;IAE7D,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,mCAKC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class CreatedResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(201, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = CreatedResult;
|
|
13
|
-
//# sourceMappingURL=CreatedResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreatedResult.js","sourceRoot":"","sources":["../../controllers/CreatedResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,aAAiB,SAAQ,uBAAgB;IAE1D,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,gCAKC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class ErrorResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(500, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = ErrorResult;
|
|
13
|
-
//# sourceMappingURL=ErrorResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorResult.js","sourceRoot":"","sources":["../../controllers/ErrorResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,WAAe,SAAQ,uBAAgB;IAExD,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,8BAKC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class ForbiddenResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(403, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = ForbiddenResult;
|
|
13
|
-
//# sourceMappingURL=ForbiddenResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ForbiddenResult.js","sourceRoot":"","sources":["../../controllers/ForbiddenResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,eAAmB,SAAQ,uBAAgB;IAE5D,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,kCAKC"}
|
|
@@ -1,13 +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
|
-
const ActionResult_1 = __importDefault(require("./ActionResult"));
|
|
7
|
-
class GenericResult extends ActionResult_1.default {
|
|
8
|
-
constructor(status, result) {
|
|
9
|
-
super(status, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = GenericResult;
|
|
13
|
-
//# sourceMappingURL=GenericResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GenericResult.js","sourceRoot":"","sources":["../../controllers/GenericResult.ts"],"names":[],"mappings":";;;;;AAAA,kEAA0C;AAE1C,MAAqB,aAAiB,SAAQ,sBAAY;IAItD,YAAY,MAAc,EAAE,MAAU;QAClC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,CAAC;CACJ;AAPD,gCAOC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class NoContentResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(204, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = NoContentResult;
|
|
13
|
-
//# sourceMappingURL=NoContentResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoContentResult.js","sourceRoot":"","sources":["../../controllers/NoContentResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,eAAmB,SAAQ,uBAAgB;IAE5D,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,kCAKC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class NotFoundResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(404, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = NotFoundResult;
|
|
13
|
-
//# sourceMappingURL=NotFoundResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFoundResult.js","sourceRoot":"","sources":["../../controllers/NotFoundResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,cAAkB,SAAQ,uBAAgB;IAE3D,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,iCAKC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class OKResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(200, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = OKResult;
|
|
13
|
-
//# sourceMappingURL=OKResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OKResult.js","sourceRoot":"","sources":["../../controllers/OKResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,QAAY,SAAQ,uBAAgB;IAErD,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,2BAKC"}
|
|
@@ -1,13 +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
|
-
const GenericResult_1 = __importDefault(require("./GenericResult"));
|
|
7
|
-
class UnauthorizedResult extends GenericResult_1.default {
|
|
8
|
-
constructor(result) {
|
|
9
|
-
super(401, result);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = UnauthorizedResult;
|
|
13
|
-
//# sourceMappingURL=UnauthorizedResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UnauthorizedResult.js","sourceRoot":"","sources":["../../controllers/UnauthorizedResult.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAI5C,MAAqB,kBAAsB,SAAQ,uBAAgB;IAE/D,YAAY,MAAU;QAClB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACJ;AALD,qCAKC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import IDIContext, { IDIItem } from "../../dependencyInjection/IDIContext";
|
|
2
|
-
import IController from "../../interfaces/IController";
|
|
3
|
-
import { Request, Response } from 'express';
|
|
4
|
-
import AcceptedResult from "../AcceptedResult";
|
|
5
|
-
import BadRequestResult from "../BadRequestResult";
|
|
6
|
-
import CreatedResult from "../CreatedResult";
|
|
7
|
-
import ErrorResult from "../ErrorResult";
|
|
8
|
-
import ForbiddenResult from "../ForbiddenResult";
|
|
9
|
-
import NoContentResult from "../NoContentResult";
|
|
10
|
-
import NotFoundResult from "../NotFoundResult";
|
|
11
|
-
import OKResult from "../OKResult";
|
|
12
|
-
import UnauthorizedResult from "../UnauthorizedResult";
|
|
13
|
-
export declare class ControllerBase implements IController, IDIContext {
|
|
14
|
-
Request: Request;
|
|
15
|
-
Response: Response;
|
|
16
|
-
Intances: IDIItem[];
|
|
17
|
-
constructor();
|
|
18
|
-
OK<T>(result?: T): OKResult<T>;
|
|
19
|
-
Created<T>(result?: T): CreatedResult<T>;
|
|
20
|
-
Accepted<T>(result?: T): AcceptedResult<T>;
|
|
21
|
-
NoContent<T>(result?: T): NoContentResult<T>;
|
|
22
|
-
BadRequest<T>(result?: T): BadRequestResult<T>;
|
|
23
|
-
Unauthorized<T>(result?: T): UnauthorizedResult<T>;
|
|
24
|
-
Forbidden<T>(result?: T): ForbiddenResult<T>;
|
|
25
|
-
NotFound<T>(result?: T): NotFoundResult<T>;
|
|
26
|
-
Error<T>(result?: T): ErrorResult<T>;
|
|
27
|
-
SendResponse<T>(status: number, result?: T): T | undefined;
|
|
28
|
-
}
|
|
@@ -1,65 +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.ControllerBase = void 0;
|
|
7
|
-
const AcceptedResult_1 = __importDefault(require("../AcceptedResult"));
|
|
8
|
-
const BadRequestResult_1 = __importDefault(require("../BadRequestResult"));
|
|
9
|
-
const CreatedResult_1 = __importDefault(require("../CreatedResult"));
|
|
10
|
-
const ErrorResult_1 = __importDefault(require("../ErrorResult"));
|
|
11
|
-
const ForbiddenResult_1 = __importDefault(require("../ForbiddenResult"));
|
|
12
|
-
const NoContentResult_1 = __importDefault(require("../NoContentResult"));
|
|
13
|
-
const NotFoundResult_1 = __importDefault(require("../NotFoundResult"));
|
|
14
|
-
const OKResult_1 = __importDefault(require("../OKResult"));
|
|
15
|
-
const UnauthorizedResult_1 = __importDefault(require("../UnauthorizedResult"));
|
|
16
|
-
class ControllerBase {
|
|
17
|
-
constructor() {
|
|
18
|
-
this.Request = {};
|
|
19
|
-
this.Response = {};
|
|
20
|
-
this.Intances = [];
|
|
21
|
-
}
|
|
22
|
-
OK(result) {
|
|
23
|
-
return new OKResult_1.default(result);
|
|
24
|
-
}
|
|
25
|
-
Created(result) {
|
|
26
|
-
return new CreatedResult_1.default(result);
|
|
27
|
-
}
|
|
28
|
-
Accepted(result) {
|
|
29
|
-
return new AcceptedResult_1.default(result);
|
|
30
|
-
}
|
|
31
|
-
NoContent(result) {
|
|
32
|
-
return new NoContentResult_1.default(result);
|
|
33
|
-
}
|
|
34
|
-
BadRequest(result) {
|
|
35
|
-
return new BadRequestResult_1.default(result);
|
|
36
|
-
}
|
|
37
|
-
Unauthorized(result) {
|
|
38
|
-
return new UnauthorizedResult_1.default(result);
|
|
39
|
-
}
|
|
40
|
-
Forbidden(result) {
|
|
41
|
-
return new ForbiddenResult_1.default(result);
|
|
42
|
-
}
|
|
43
|
-
NotFound(result) {
|
|
44
|
-
return new NotFoundResult_1.default(result);
|
|
45
|
-
}
|
|
46
|
-
Error(result) {
|
|
47
|
-
return new ErrorResult_1.default(result);
|
|
48
|
-
}
|
|
49
|
-
SendResponse(status, result) {
|
|
50
|
-
this.Response.status(status);
|
|
51
|
-
if (result) {
|
|
52
|
-
if (typeof result == "object")
|
|
53
|
-
this.Response.json(result);
|
|
54
|
-
else if (typeof result == "number")
|
|
55
|
-
this.Response.send(result.toString());
|
|
56
|
-
else
|
|
57
|
-
this.Response.send(result);
|
|
58
|
-
}
|
|
59
|
-
else
|
|
60
|
-
this.Response.end();
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ControllerBase = ControllerBase;
|
|
65
|
-
//# sourceMappingURL=ControllerBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ControllerBase.js","sourceRoot":"","sources":["../../../controllers/base/ControllerBase.ts"],"names":[],"mappings":";;;;;;AAGA,uEAA+C;AAC/C,2EAAmD;AACnD,qEAA6C;AAC7C,iEAAyC;AACzC,yEAAiD;AACjD,yEAAiD;AACjD,uEAA+C;AAC/C,2DAAmC;AACnC,+EAAuD;AAKvD,MAAa,cAAc;IAMvB;QAJA,YAAO,GAAa,EAAa,CAAC;QAClC,aAAQ,GAAc,EAAc,CAAC;QACrC,aAAQ,GAAc,EAAE,CAAC;IAKzB,CAAC;IAEM,EAAE,CAAI,MAAW;QAEpB,OAAO,IAAI,kBAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAEM,OAAO,CAAI,MAAW;QAEzB,OAAO,IAAI,uBAAa,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAEM,QAAQ,CAAI,MAAW;QAE1B,OAAO,IAAI,wBAAc,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAEM,SAAS,CAAI,MAAW;QAE3B,OAAO,IAAI,yBAAe,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAEM,UAAU,CAAI,MAAW;QAE5B,OAAO,IAAI,0BAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAEM,YAAY,CAAI,MAAW;QAE9B,OAAO,IAAI,4BAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,SAAS,CAAI,MAAW;QAE3B,OAAO,IAAI,yBAAe,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAEM,QAAQ,CAAI,MAAW;QAE1B,OAAO,IAAI,wBAAc,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAI,MAAW;QAEvB,OAAO,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAEM,YAAY,CAAI,MAAe,EAAE,MA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