web_api_base 2.5.4 → 2.6.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 (73) hide show
  1. package/dist/Application.js +1 -0
  2. package/dist/Application.js.map +1 -1
  3. package/dist/__tests__/classes/ControllerTest.d.ts +10 -0
  4. package/dist/__tests__/classes/{Controller.js → ControllerTest.js} +28 -19
  5. package/dist/__tests__/classes/ControllerTest.js.map +1 -0
  6. package/dist/__tests__/classes/SampleServiceTest.d.ts +9 -0
  7. package/dist/__tests__/classes/SampleServiceTest.js +19 -0
  8. package/dist/__tests__/classes/SampleServiceTest.js.map +1 -0
  9. package/dist/__tests__/{decorators → tests}/controllers/ControllerDecorators.spec.js +7 -6
  10. package/dist/__tests__/tests/controllers/ControllerDecorators.spec.js.map +1 -0
  11. package/dist/__tests__/tests/dependecyInjection/DependecyInjection.spec.js +45 -0
  12. package/dist/__tests__/tests/dependecyInjection/DependecyInjection.spec.js.map +1 -0
  13. package/dist/dependencyInjection/DependecyService.d.ts +9 -0
  14. package/dist/dependencyInjection/DependecyService.js +55 -2
  15. package/dist/dependencyInjection/DependecyService.js.map +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/{Index.js → index.js} +10 -1
  18. package/dist/index.js.map +1 -0
  19. package/dist/jest.config.js +5 -1
  20. package/dist/jest.config.js.map +1 -1
  21. package/package.json +11 -12
  22. package/readme.md +87 -0
  23. package/dist/App.js +0 -32
  24. package/dist/App.js.map +0 -1
  25. package/dist/Configuration.js +0 -69
  26. package/dist/Configuration.js.map +0 -1
  27. package/dist/Index.js.map +0 -1
  28. package/dist/__tests__/classes/Controller.d.ts +0 -8
  29. package/dist/__tests__/classes/Controller.js.map +0 -1
  30. package/dist/__tests__/decorators/controllers/ControllerDecorators.spec.js.map +0 -1
  31. package/dist/bin/create-webapi-app.js +0 -52
  32. package/dist/bin/create-webapi-app.js.map +0 -1
  33. package/dist/bin/temp/Application.d.ts +0 -6
  34. package/dist/bin/temp/Application.js +0 -33
  35. package/dist/bin/temp/Application.js.map +0 -1
  36. package/dist/bin/temp/Index.d.ts +0 -1
  37. package/dist/bin/temp/Index.js +0 -8
  38. package/dist/bin/temp/Index.js.map +0 -1
  39. package/dist/bin/temp/controllers/StatusController.d.ts +0 -5
  40. package/dist/bin/temp/controllers/StatusController.js +0 -33
  41. package/dist/bin/temp/controllers/StatusController.js.map +0 -1
  42. package/dist/config.json +0 -1
  43. package/dist/controllers/FileController.js +0 -162
  44. package/dist/controllers/FileController.js.map +0 -1
  45. package/dist/controllers/StatusController.js +0 -44
  46. package/dist/controllers/StatusController.js.map +0 -1
  47. package/dist/decorators/dependencyInjection/DependecyInjectionDecorators.d.ts +0 -13
  48. package/dist/decorators/dependencyInjection/DependecyInjectionDecorators.js +0 -32
  49. package/dist/decorators/dependencyInjection/DependecyInjectionDecorators.js.map +0 -1
  50. package/dist/interfaces/entities/IDirectory.d.ts +0 -5
  51. package/dist/interfaces/entities/IDirectory.js +0 -3
  52. package/dist/interfaces/entities/IDirectory.js.map +0 -1
  53. package/dist/services/FileService.js +0 -45
  54. package/dist/services/FileService.js.map +0 -1
  55. package/dist/services/IFileService.js +0 -8
  56. package/dist/services/IFileService.js.map +0 -1
  57. package/dist/services/fileService/FileService.d.ts +0 -10
  58. package/dist/services/fileService/FileService.js +0 -96
  59. package/dist/services/fileService/FileService.js.map +0 -1
  60. package/dist/services/fileService/FileServiceBase.d.ts +0 -10
  61. package/dist/services/fileService/FileServiceBase.js +0 -7
  62. package/dist/services/fileService/FileServiceBase.js.map +0 -1
  63. package/dist/temp/Application.d.ts +0 -6
  64. package/dist/temp/Application.js +0 -33
  65. package/dist/temp/Application.js.map +0 -1
  66. package/dist/temp/Index.d.ts +0 -1
  67. package/dist/temp/Index.js +0 -8
  68. package/dist/temp/Index.js.map +0 -1
  69. package/dist/temp/controllers/StatusController.d.ts +0 -6
  70. package/dist/temp/controllers/StatusController.js +0 -34
  71. package/dist/temp/controllers/StatusController.js.map +0 -1
  72. /package/dist/__tests__/{decorators → tests}/controllers/ControllerDecorators.spec.d.ts +0 -0
  73. /package/dist/{bin/create-webapi-app.d.ts → __tests__/tests/dependecyInjection/DependecyInjection.spec.d.ts} +0 -0
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const fs_1 = __importDefault(require("fs"));
16
- const promises_1 = __importDefault(require("fs/promises"));
17
- const path_1 = __importDefault(require("path"));
18
- const platform_folders_1 = require("platform-folders");
19
- const FileServiceBase_1 = __importDefault(require("./FileServiceBase"));
20
- class FileService extends FileServiceBase_1.default {
21
- GetDefaultDir() {
22
- return (0, platform_folders_1.getDesktopFolder)();
23
- }
24
- CreateDirectory(path) {
25
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
26
- try {
27
- return resolve(fs_1.default.mkdirSync(path));
28
- }
29
- catch (err) {
30
- return reject(err);
31
- }
32
- }));
33
- }
34
- FileExists(file) {
35
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
36
- try {
37
- return resolve(fs_1.default.existsSync(file) && fs_1.default.lstatSync(file).isFile());
38
- }
39
- catch (err) {
40
- return reject(err);
41
- }
42
- }));
43
- }
44
- DirectoryExists(path) {
45
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
46
- try {
47
- return resolve(fs_1.default.existsSync(path) && fs_1.default.lstatSync(path).isDirectory());
48
- }
49
- catch (err) {
50
- return reject(err);
51
- }
52
- }));
53
- }
54
- GetAllFiles(origin) {
55
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
56
- if (!fs_1.default.existsSync(origin))
57
- return reject(new Error(`The path ${origin} not exists`));
58
- try {
59
- let files = yield promises_1.default.readdir(origin, { withFileTypes: true });
60
- return resolve(files.filter(u => u.isFile()).map(u => path_1.default.join(origin, u.name)));
61
- }
62
- catch (err) {
63
- return reject(err);
64
- }
65
- }));
66
- }
67
- GetAllForders(origin) {
68
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
69
- if (!fs_1.default.existsSync(origin))
70
- return reject(new Error(`The path ${origin} not exists`));
71
- try {
72
- let files = yield promises_1.default.readdir(origin, { withFileTypes: true });
73
- return resolve(files.filter(u => u.isDirectory()).map(u => path_1.default.join(origin, u.name)));
74
- }
75
- catch (err) {
76
- return reject(err);
77
- }
78
- }));
79
- }
80
- CopyAsync(origin, dest) {
81
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
82
- try {
83
- yield fs_1.default.copyFile(origin, dest, (err) => {
84
- if (err)
85
- throw err;
86
- resolve();
87
- });
88
- }
89
- catch (err) {
90
- reject(err);
91
- }
92
- }));
93
- }
94
- }
95
- exports.default = FileService;
96
- //# sourceMappingURL=FileService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileService.js","sourceRoot":"","sources":["../../../services/fileService/FileService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,4CAAsB;AACtB,2DAAoC;AACpC,gDAAwB;AACxB,uDAAiD;AAEjD,wEAAgD;AAGhD,MAAqB,WAAY,SAAQ,yBAAe;IAIpC,aAAa;QAEzB,OAAO,IAAA,mCAAgB,GAAE,CAAC;IAC9B,CAAC;IAGe,eAAe,CAAC,IAAY;QAExC,OAAO,IAAI,OAAO,CAAO,CAAO,OA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AAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;oBAEtC,IAAG,GAAG;wBACF,MAAM,GAAG,CAAC;oBAEd,OAAO,EAAE,CAAC;gBACd,CAAC,CAAC,CAAA;aAEL;YAAA,OAAM,GAAG,EACV;gBACI,MAAM,CAAC,GAAG,CAAC,CAAC;aACf;QACL,CAAC,CAAA,CAAC,CAAA;IAEN,CAAC;CAEJ;AAlHD,8BAkHC"}
@@ -1,10 +0,0 @@
1
- export default abstract class FileServiceBase {
2
- constructor();
3
- abstract CopyAsync(origin: string, dest: string): Promise<void>;
4
- abstract GetAllFiles(origin: string): Promise<string[]>;
5
- abstract GetAllForders(origin: string): Promise<string[]>;
6
- abstract FileExists(file: string): Promise<boolean>;
7
- abstract DirectoryExists(path: string): Promise<boolean>;
8
- abstract CreateDirectory(path: string): Promise<void>;
9
- abstract GetDefaultDir(): string;
10
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class FileServiceBase {
4
- constructor() { }
5
- }
6
- exports.default = FileServiceBase;
7
- //# sourceMappingURL=FileServiceBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileServiceBase.js","sourceRoot":"","sources":["../../../services/fileService/FileServiceBase.ts"],"names":[],"mappings":";;AAEA,MAA8B,eAAe;IAEzC,gBAAc,CAAC;CAUlB;AAZD,kCAYC"}
@@ -1,6 +0,0 @@
1
- import { Application, IApplicationConfiguration } from "../index";
2
- export default class App extends Application {
3
- constructor();
4
- ConfigureAsync(appConfig: IApplicationConfiguration): Promise<void>;
5
- private AddDependencyInjection;
6
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const index_1 = require("../index");
16
- const StatusController_1 = __importDefault(require("./controllers/StatusController"));
17
- class App extends index_1.Application {
18
- constructor() {
19
- super();
20
- }
21
- ConfigureAsync(appConfig) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- let f = new StatusController_1.default();
24
- this.UseCors();
25
- this.AddDependencyInjection(appConfig);
26
- this.UseControllers();
27
- });
28
- }
29
- AddDependencyInjection(appConfig) {
30
- }
31
- }
32
- exports.default = App;
33
- //# sourceMappingURL=Application.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Application.js","sourceRoot":"","sources":["../../temp/Application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,oCAAwF;AACxF,sFAA8D;AAM9D,MAAqB,GAAI,SAAQ,mBAAW;IAExC;QAEI,KAAK,EAAE,CAAC;IACZ,CAAC;IAEqB,cAAc,CAAC,SAAoC;;YAGrE,IAAI,CAAC,GAAG,IAAI,0BAAgB,EAAE,CAAC;YAE/B,IAAI,CAAC,OAAO,EAAE,CAAC;YAEf,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;YAExC,IAAI,CAAC,cAAc,EAAE,CAAC;QAEzB,CAAC;KAAA;IAKO,sBAAsB,CAAC,SAAoC;IAGnE,CAAC;CAGJ;AA7BD,sBA6BC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +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 Application_1 = __importDefault(require("./Application"));
7
- new Application_1.default().StartAsync();
8
- //# sourceMappingURL=Index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Index.js","sourceRoot":"","sources":["../../temp/Index.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AAExC,IAAI,qBAAW,EAAE,CAAC,UAAU,EAAE,CAAC"}
@@ -1,6 +0,0 @@
1
- import { ControllerBase } from "../../index";
2
- export default class StatusController extends ControllerBase {
3
- Name: string;
4
- constructor();
5
- CheckStatus(): void;
6
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const index_1 = require("../../index");
13
- let StatusController = class StatusController extends index_1.ControllerBase {
14
- constructor() {
15
- super();
16
- this.Name = "";
17
- }
18
- CheckStatus() {
19
- this.OK({ status: "OK" });
20
- }
21
- };
22
- __decorate([
23
- index_1.ControllersDecorators.Verb(index_1.HTTPVerbs.GET),
24
- index_1.ControllersDecorators.Action("/check"),
25
- __metadata("design:type", Function),
26
- __metadata("design:paramtypes", []),
27
- __metadata("design:returntype", void 0)
28
- ], StatusController.prototype, "CheckStatus", null);
29
- StatusController = __decorate([
30
- index_1.ControllersDecorators.Route("/status"),
31
- __metadata("design:paramtypes", [])
32
- ], StatusController);
33
- exports.default = StatusController;
34
- //# sourceMappingURL=StatusController.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatusController.js","sourceRoot":"","sources":["../../../temp/controllers/StatusController.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAAmG;AAGnG,IAAqB,gBAAgB,GAArC,MAAqB,gBAAiB,SAAQ,sBAAc;IAKxD;QAEI,KAAK,EAAE,CAAC;QAJL,SAAI,GAAY,EAAE,CAAC;IAK1B,CAAC;IAIM,WAAW;QAEd,IAAI,CAAC,EAAE,CAAC,EAAC,MAAM,EAAG,IAAI,EAAC,CAAC,CAAC;IAC7B,CAAC;CAEJ,CAAA;AALG;IAFC,6BAAE,CAAC,IAAI,CAAC,iBAAK,CAAC,GAAG,CAAC;IAClB,6BAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;;;;mDAInB;AAfgB,gBAAgB;IADpC,6BAAE,CAAC,KAAK,CAAC,SAAS,CAAC;;GACC,gBAAgB,CAiBpC;kBAjBoB,gBAAgB"}