@mini2/core 1.0.1 → 1.0.5

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 (92) hide show
  1. package/Readme.MD +75 -2
  2. package/dist/app.d.ts +14 -0
  3. package/dist/app.d.ts.map +1 -0
  4. package/dist/app.js +65 -0
  5. package/dist/app.js.map +1 -0
  6. package/dist/container.d.ts +4 -0
  7. package/dist/container.d.ts.map +1 -0
  8. package/dist/container.js +11 -0
  9. package/dist/container.js.map +1 -0
  10. package/dist/expections/http.expection.d.ts +79 -0
  11. package/dist/expections/http.expection.d.ts.map +1 -0
  12. package/dist/expections/http.expection.js +140 -0
  13. package/dist/expections/http.expection.js.map +1 -0
  14. package/dist/index.d.ts +19 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +52 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/interfaces/app.interface.d.ts +6 -0
  19. package/dist/interfaces/app.interface.d.ts.map +1 -0
  20. package/dist/interfaces/app.interface.js +3 -0
  21. package/dist/interfaces/app.interface.js.map +1 -0
  22. package/dist/interfaces/authenticated.interface.d.ts +5 -0
  23. package/dist/interfaces/authenticated.interface.d.ts.map +1 -0
  24. package/dist/interfaces/authenticated.interface.js +3 -0
  25. package/dist/interfaces/authenticated.interface.js.map +1 -0
  26. package/dist/interfaces/config.interface.d.ts +6 -0
  27. package/dist/interfaces/config.interface.d.ts.map +1 -0
  28. package/dist/interfaces/config.interface.js +3 -0
  29. package/dist/interfaces/config.interface.js.map +1 -0
  30. package/dist/interfaces/queue.interface.d.ts +6 -0
  31. package/dist/interfaces/queue.interface.d.ts.map +1 -0
  32. package/dist/interfaces/queue.interface.js +3 -0
  33. package/dist/interfaces/queue.interface.js.map +1 -0
  34. package/dist/interfaces/repository.interface.d.ts +34 -0
  35. package/dist/interfaces/repository.interface.d.ts.map +1 -0
  36. package/dist/interfaces/repository.interface.js +3 -0
  37. package/dist/interfaces/repository.interface.js.map +1 -0
  38. package/dist/middlewares/authenticated.middleware.d.ts +4 -0
  39. package/dist/middlewares/authenticated.middleware.d.ts.map +1 -0
  40. package/dist/middlewares/authenticated.middleware.js +14 -0
  41. package/dist/middlewares/authenticated.middleware.js.map +1 -0
  42. package/dist/middlewares/authorized.middleware.d.ts +7 -0
  43. package/dist/middlewares/authorized.middleware.d.ts.map +1 -0
  44. package/dist/middlewares/authorized.middleware.js +16 -0
  45. package/dist/middlewares/authorized.middleware.js.map +1 -0
  46. package/dist/middlewares/validation.middleware.d.ts +4 -0
  47. package/dist/middlewares/validation.middleware.d.ts.map +1 -0
  48. package/dist/middlewares/validation.middleware.js +65 -0
  49. package/dist/middlewares/validation.middleware.js.map +1 -0
  50. package/dist/response-builder.d.ts +26 -0
  51. package/dist/response-builder.d.ts.map +1 -0
  52. package/dist/response-builder.js +45 -0
  53. package/dist/response-builder.js.map +1 -0
  54. package/dist/rest.d.ts +43 -0
  55. package/dist/rest.d.ts.map +1 -0
  56. package/dist/rest.js +213 -0
  57. package/dist/rest.js.map +1 -0
  58. package/dist/swagger.d.ts +30 -0
  59. package/dist/swagger.d.ts.map +1 -0
  60. package/dist/swagger.js +214 -0
  61. package/dist/swagger.js.map +1 -0
  62. package/dist/types.d.ts +4 -0
  63. package/dist/types.d.ts.map +1 -0
  64. package/dist/types.js +7 -0
  65. package/dist/types.js.map +1 -0
  66. package/dist/utils/array-unify.d.ts +2 -0
  67. package/dist/utils/array-unify.d.ts.map +1 -0
  68. package/dist/utils/array-unify.js +8 -0
  69. package/dist/utils/array-unify.js.map +1 -0
  70. package/dist/utils/math.d.ts +2 -0
  71. package/dist/utils/math.d.ts.map +1 -0
  72. package/dist/utils/math.js +7 -0
  73. package/dist/utils/math.js.map +1 -0
  74. package/package.json +38 -5
  75. package/__tests__/controller.test.ts +0 -349
  76. package/app.ts +0 -51
  77. package/container.ts +0 -7
  78. package/expections/http.expection.ts +0 -147
  79. package/interfaces/app.interface.ts +0 -6
  80. package/interfaces/authenticated.interface.ts +0 -3
  81. package/interfaces/config.interface.ts +0 -5
  82. package/interfaces/queue.interface.ts +0 -5
  83. package/interfaces/repository.interface.ts +0 -32
  84. package/middlewares/authenticated.middleware.ts +0 -15
  85. package/middlewares/authorized.middleware.ts +0 -19
  86. package/middlewares/validation.middleware.ts +0 -76
  87. package/response-builder.ts +0 -61
  88. package/rest.ts +0 -254
  89. package/swagger.ts +0 -265
  90. package/types.ts +0 -3
  91. package/utils/array-unify.ts +0 -4
  92. package/utils/math.ts +0 -3
@@ -0,0 +1,214 @@
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.SwaggerIntegration = void 0;
7
+ require("reflect-metadata");
8
+ const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
9
+ const rest_1 = require("./rest");
10
+ const class_validator_jsonschema_1 = require("class-validator-jsonschema");
11
+ class SwaggerIntegration {
12
+ constructor(options = {}) {
13
+ this.options = {
14
+ title: 'Mini Framework API',
15
+ description: 'API documentation for Mini Framework',
16
+ version: '1.0.0',
17
+ servers: [
18
+ { url: 'http://localhost:3000', description: 'Development server' },
19
+ ],
20
+ docsPath: '/api-docs',
21
+ jsonPath: '/api-docs.json',
22
+ ...options,
23
+ };
24
+ }
25
+ generateSwaggerSpec(controllers) {
26
+ const paths = {};
27
+ const components = {
28
+ securitySchemes: {
29
+ bearerAuth: {
30
+ type: 'http',
31
+ scheme: 'bearer',
32
+ bearerFormat: 'JWT',
33
+ },
34
+ },
35
+ schemas: (0, class_validator_jsonschema_1.validationMetadatasToSchemas)(),
36
+ };
37
+ controllers.forEach((controller) => {
38
+ const controllerPath = Reflect.getMetadata(rest_1.keyOfPath, controller.constructor);
39
+ if (!controllerPath) {
40
+ console.log(`❌ No path metadata found for ${controller.constructor.name}`);
41
+ return;
42
+ }
43
+ const allProperties = Object.getOwnPropertyNames(Object.getPrototypeOf(controller));
44
+ allProperties.forEach((property) => {
45
+ const routeOptions = Reflect.getMetadata(rest_1.keyOfRouteOptions, controller, property);
46
+ if (!routeOptions || !routeOptions.path || !routeOptions.method) {
47
+ if (property !== 'constructor') {
48
+ console.log(`⚠️ Skipping ${property} - no valid route options`);
49
+ }
50
+ return;
51
+ }
52
+ const fullPath = controllerPath + routeOptions.path;
53
+ const method = routeOptions.method.toLowerCase();
54
+ if (!paths[fullPath]) {
55
+ paths[fullPath] = {};
56
+ }
57
+ // Generate OpenAPI operation
58
+ const operation = {
59
+ summary: this.generateSummary(method, fullPath),
60
+ description: this.generateDescription(method, fullPath),
61
+ tags: [this.extractControllerTag(controllerPath)],
62
+ responses: {
63
+ '200': {
64
+ description: 'Success',
65
+ content: {
66
+ 'application/json': {
67
+ schema: {
68
+ type: 'object',
69
+ },
70
+ },
71
+ },
72
+ },
73
+ },
74
+ };
75
+ // Add parameters from path
76
+ const pathParams = this.extractPathParameters(routeOptions.path);
77
+ if (pathParams.length > 0) {
78
+ operation.parameters = pathParams.map((param) => ({
79
+ name: param,
80
+ in: 'path',
81
+ required: true,
82
+ schema: {
83
+ type: 'string',
84
+ },
85
+ }));
86
+ }
87
+ // Add request body for POST/PUT/PATCH
88
+ if (['post', 'put', 'patch'].includes(method) && routeOptions.validations) {
89
+ const bodyValidation = routeOptions.validations?.find((v) => v.body);
90
+ if (bodyValidation) {
91
+ operation.requestBody = {
92
+ required: true,
93
+ content: {
94
+ 'application/json': {
95
+ schema: this.generateSchemaFromValidation(bodyValidation.body),
96
+ },
97
+ },
98
+ };
99
+ }
100
+ }
101
+ // Add security if authenticated
102
+ if (routeOptions.authenticated) {
103
+ operation.security = [{ bearerAuth: [] }];
104
+ }
105
+ // Add error responses
106
+ if (routeOptions.authenticated) {
107
+ operation.responses['401'] = {
108
+ description: 'Unauthorized',
109
+ };
110
+ }
111
+ if (routeOptions.permissions && routeOptions.permissions.length > 0) {
112
+ operation.responses['403'] = {
113
+ description: 'Forbidden',
114
+ };
115
+ }
116
+ operation.responses['400'] = {
117
+ description: 'Bad Request',
118
+ };
119
+ paths[fullPath][method] = operation;
120
+ });
121
+ });
122
+ this.swaggerSpec = {
123
+ openapi: '3.0.0',
124
+ info: {
125
+ title: this.options.title,
126
+ description: this.options.description,
127
+ version: this.options.version,
128
+ contact: {
129
+ name: 'API Support',
130
+ email: 'support@example.com',
131
+ },
132
+ },
133
+ servers: this.options.servers,
134
+ paths,
135
+ components,
136
+ };
137
+ }
138
+ generateSummary(method, path) {
139
+ const action = method.toUpperCase();
140
+ const resource = this.extractResourceName(path);
141
+ const actionMap = {
142
+ GET: path.includes('/:') ? `Get ${resource} by ID` : `Get all ${resource}`,
143
+ POST: `Create ${resource}`,
144
+ PUT: `Update ${resource}`,
145
+ PATCH: `Partially update ${resource}`,
146
+ DELETE: `Delete ${resource}`,
147
+ };
148
+ return actionMap[action] || `${action} ${resource}`;
149
+ }
150
+ generateDescription(method, path) {
151
+ const action = method.toLowerCase();
152
+ const resource = this.extractResourceName(path);
153
+ const descriptions = {
154
+ get: path.includes('/:')
155
+ ? `Retrieve a specific ${resource} by its ID`
156
+ : `Retrieve all ${resource} records`,
157
+ post: `Create a new ${resource} record`,
158
+ put: `Update an existing ${resource} record`,
159
+ patch: `Partially update an existing ${resource} record`,
160
+ delete: `Delete a ${resource} record`,
161
+ };
162
+ return descriptions[action] || `${action} operation on ${resource}`;
163
+ }
164
+ extractControllerTag(controllerPath) {
165
+ const segments = controllerPath.split('/').filter(Boolean);
166
+ const lastSegment = segments[segments.length - 1];
167
+ return lastSegment.charAt(0).toUpperCase() + lastSegment.slice(1);
168
+ }
169
+ extractResourceName(path) {
170
+ const segments = path.split('/').filter(Boolean);
171
+ let resource = segments[segments.length - 1];
172
+ // Remove path parameters (e.g., :id)
173
+ if (resource.startsWith(':')) {
174
+ resource = segments[segments.length - 2] || 'Resource';
175
+ }
176
+ return resource.charAt(0).toUpperCase() + resource.slice(1);
177
+ }
178
+ extractPathParameters(path) {
179
+ const matches = path.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/g);
180
+ return matches ? matches.map((match) => match.substring(1)) : [];
181
+ }
182
+ generateSchemaFromValidation(validationClass) {
183
+ const className = validationClass.name;
184
+ return { $ref: `#/components/schemas/${className}` };
185
+ }
186
+ setupSwagger(app) {
187
+ // Swagger UI middleware
188
+ app.use(this.options.docsPath, swagger_ui_express_1.default.serve, swagger_ui_express_1.default.setup(this.swaggerSpec, {
189
+ explorer: true,
190
+ customCss: '.swagger-ui .topbar { display: none }',
191
+ customSiteTitle: this.options.title,
192
+ swaggerOptions: {
193
+ docExpansion: 'list',
194
+ filter: true,
195
+ showRequestHeaders: true,
196
+ tryItOutEnabled: true,
197
+ persistAuthorization: true,
198
+ },
199
+ }));
200
+ // JSON endpoint for OpenAPI spec
201
+ app.get(this.options.jsonPath, (_req, res) => {
202
+ res.setHeader('Content-Type', 'application/json');
203
+ res.send(this.swaggerSpec);
204
+ });
205
+ console.log(`📚 Swagger UI available at: ${this.options.docsPath}`);
206
+ console.log(`📄 OpenAPI JSON spec available at: ${this.options.jsonPath}`);
207
+ }
208
+ getSwaggerSpec() {
209
+ return this.swaggerSpec;
210
+ }
211
+ }
212
+ exports.SwaggerIntegration = SwaggerIntegration;
213
+ exports.default = SwaggerIntegration;
214
+ //# sourceMappingURL=swagger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.js","sourceRoot":"","sources":["../swagger.ts"],"names":[],"mappings":";;;;;;AAAA,4BAA0B;AAC1B,4EAA2C;AAE3C,iCAAoE;AACpE,2EAA0E;AAY1E,MAAa,kBAAkB;IAI9B,YAAY,UAA0B,EAAE;QACvC,IAAI,CAAC,OAAO,GAAG;YACd,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,sCAAsC;YACnD,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACR,EAAE,GAAG,EAAE,uBAAuB,EAAE,WAAW,EAAE,oBAAoB,EAAE;aACnE;YACD,QAAQ,EAA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0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;CAEtB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MINI_TYPES = void 0;
4
+ exports.MINI_TYPES = {
5
+ IController: Symbol.for('IController'),
6
+ };
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;CACtC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function arrayUnify<T>(array: T[]): T[];
2
+ //# sourceMappingURL=array-unify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-unify.d.ts","sourceRoot":"","sources":["../../utils/array-unify.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAGvC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.arrayUnify = arrayUnify;
4
+ function arrayUnify(array) {
5
+ const unified = [...new Set([...array])];
6
+ return unified;
7
+ }
8
+ //# sourceMappingURL=array-unify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-unify.js","sourceRoot":"","sources":["../../utils/array-unify.ts"],"names":[],"mappings":";;AAAA,gCAGC;AAHD,SAAgB,UAAU,CAAI,KAAU;IACvC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function sum(a: number, b: number): number;
2
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../utils/math.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sum = sum;
4
+ function sum(a, b) {
5
+ return a + b;
6
+ }
7
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.js","sourceRoot":"","sources":["../../utils/math.ts"],"names":[],"mappings":";;AAAA,kBAEC;AAFD,SAAgB,GAAG,CAAC,CAAS,EAAE,CAAS;IACvC,OAAO,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,30 @@
1
1
  {
2
2
  "scripts": {
3
- "test": "npm run test"
3
+ "test": "jest",
4
+ "build": "tsc",
5
+ "clean": "rm -rf dist",
6
+ "rebuild": "npm run clean && npm run build",
7
+ "prepublishOnly": "npm run rebuild",
8
+ "dev": "tsc --watch",
9
+ "publish:patch": "npm version patch && npm publish",
10
+ "publish:minor": "npm version minor && npm publish",
11
+ "publish:major": "npm version major && npm publish"
4
12
  },
5
- "main": "app.ts",
6
- "keywords": [],
13
+ "main": "dist/index.js",
14
+ "types": "dist/index.d.ts",
15
+ "keywords": [
16
+ "express",
17
+ "framework",
18
+ "mini",
19
+ "typescript",
20
+ "api",
21
+ "middleware",
22
+ "swagger"
23
+ ],
7
24
  "license": "ISC",
8
- "description": "",
25
+ "description": "Mini Express Framework - Lightweight and modular Express.js framework with TypeScript support",
9
26
  "name": "@mini2/core",
10
- "version": "1.0.1",
27
+ "version": "1.0.5",
11
28
  "author": "Mustafa Çolakoglu <mustafacolakoglu94@gmail.com> (https://github.com/mustafa-colakoglu)",
12
29
  "dependencies": {
13
30
  "class-transformer": "^0.5.1",
@@ -19,5 +36,21 @@
19
36
  "morgan": "^1.10.0",
20
37
  "reflect-metadata": "^0.2.2",
21
38
  "swagger-ui-express": "^5.0.1"
39
+ },
40
+ "devDependencies": {
41
+ "@types/cors": "^2.8.17",
42
+ "@types/express": "^4.17.21",
43
+ "@types/morgan": "^1.9.9",
44
+ "@types/node": "^20.14.9",
45
+ "@types/swagger-ui-express": "^4.1.6",
46
+ "typescript": "^5.5.3"
47
+ },
48
+ "peerDependencies": {
49
+ "mongoose": "^8.0.0"
50
+ },
51
+ "peerDependenciesMeta": {
52
+ "mongoose": {
53
+ "optional": true
54
+ }
22
55
  }
23
56
  }