@technomoron/api-server-base 1.0.25 → 1.0.27

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.
@@ -6,6 +6,12 @@
6
6
  */
7
7
  import { Application, Request, Response } from 'express';
8
8
  import jwt, { JwtPayload, SignOptions, VerifyOptions } from 'jsonwebtoken';
9
+ export interface RequestWithStuff extends Request {
10
+ file?: Express.Multer.File;
11
+ files?: Express.Multer.File[] | {
12
+ [fieldname: string]: Express.Multer.File[];
13
+ };
14
+ }
9
15
  interface JwtSignResult {
10
16
  success: boolean;
11
17
  token?: string;
@@ -29,7 +35,7 @@ export interface ApiTokenData extends JwtPayload {
29
35
  }
30
36
  export interface ApiRequest {
31
37
  server: any;
32
- req: Request;
38
+ req: RequestWithStuff;
33
39
  res: Response;
34
40
  tokenData?: ApiTokenData | null;
35
41
  token?: string;
@@ -57,6 +63,7 @@ export declare class ApiModule<T> {
57
63
  constructor(opts?: {
58
64
  namespace?: string;
59
65
  });
66
+ checkConfig(): boolean;
60
67
  defineRoutes(): ApiRoute[];
61
68
  }
62
69
  export interface ApiErrorParams {
@@ -20,6 +20,9 @@ class ApiModule {
20
20
  this.mountpath = '';
21
21
  this.namespace = opts.namespace ?? this.constructor.defaultNamespace ?? '';
22
22
  }
23
+ checkConfig() {
24
+ return true;
25
+ }
23
26
  defineRoutes() {
24
27
  return [];
25
28
  }
@@ -337,6 +340,7 @@ class ApiServer {
337
340
  api(module) {
338
341
  const router = express_1.default.Router();
339
342
  module.server = this;
343
+ module.checkConfig();
340
344
  const base = this.config.apiBasePath ?? '/api';
341
345
  const ns = module.namespace;
342
346
  const mountPath = `${base}${ns}`;
@@ -6,6 +6,12 @@
6
6
  */
7
7
  import { Application, Request, Response } from 'express';
8
8
  import jwt, { JwtPayload, SignOptions, VerifyOptions } from 'jsonwebtoken';
9
+ export interface RequestWithStuff extends Request {
10
+ file?: Express.Multer.File;
11
+ files?: Express.Multer.File[] | {
12
+ [fieldname: string]: Express.Multer.File[];
13
+ };
14
+ }
9
15
  interface JwtSignResult {
10
16
  success: boolean;
11
17
  token?: string;
@@ -29,7 +35,7 @@ export interface ApiTokenData extends JwtPayload {
29
35
  }
30
36
  export interface ApiRequest {
31
37
  server: any;
32
- req: Request;
38
+ req: RequestWithStuff;
33
39
  res: Response;
34
40
  tokenData?: ApiTokenData | null;
35
41
  token?: string;
@@ -57,6 +63,7 @@ export declare class ApiModule<T> {
57
63
  constructor(opts?: {
58
64
  namespace?: string;
59
65
  });
66
+ checkConfig(): boolean;
60
67
  defineRoutes(): ApiRoute[];
61
68
  }
62
69
  export interface ApiErrorParams {
@@ -14,6 +14,9 @@ export class ApiModule {
14
14
  this.mountpath = '';
15
15
  this.namespace = opts.namespace ?? this.constructor.defaultNamespace ?? '';
16
16
  }
17
+ checkConfig() {
18
+ return true;
19
+ }
17
20
  defineRoutes() {
18
21
  return [];
19
22
  }
@@ -329,6 +332,7 @@ export class ApiServer {
329
332
  api(module) {
330
333
  const router = express.Router();
331
334
  module.server = this;
335
+ module.checkConfig();
332
336
  const base = this.config.apiBasePath ?? '/api';
333
337
  const ns = module.namespace;
334
338
  const mountPath = `${base}${ns}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@technomoron/api-server-base",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "Api Server Skeleton / Base Class",
5
5
  "main": "dist/cjs/api-server-base.js",
6
6
  "module": "dist/esm/api-server-base.js",
@@ -34,20 +34,20 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/cookie-parser": "^1.4.8",
37
- "@types/cors": "^2.8.17",
38
- "@types/express": "^5.0.1",
37
+ "@types/cors": "^2.8.18",
38
+ "@types/express": "^5.0.2",
39
39
  "@types/express-serve-static-core": "^5.0.6",
40
40
  "@types/jsonwebtoken": "^9.0.9",
41
41
  "@types/multer": "^1.4.12",
42
- "@typescript-eslint/eslint-plugin": "^8.30.1",
43
- "@typescript-eslint/parser": "^8.30.1",
42
+ "@typescript-eslint/eslint-plugin": "^8.33.0",
43
+ "@typescript-eslint/parser": "^8.33.0",
44
44
  "@vue/eslint-config-prettier": "10.2.0",
45
45
  "@vue/eslint-config-typescript": "14.5.0",
46
- "eslint": "^9.25.1",
46
+ "eslint": "^9.28.0",
47
47
  "eslint-plugin-import": "^2.31.0",
48
- "eslint-plugin-vue": "^10.0.0",
48
+ "eslint-plugin-vue": "^10.1.0",
49
49
  "prettier": "^3.5.3",
50
- "typescript": "^5.6.3"
50
+ "typescript": "^5.8.3"
51
51
  },
52
52
  "files": [
53
53
  "dist/",