vr-commons 1.0.182 → 1.0.184

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.
@@ -2,3 +2,4 @@ export { checkAdminAuthentication } from "./admin/admin.auth.middleware";
2
2
  export { checkUserAuthentication } from "./users/users.auth.middleware";
3
3
  export { checkIsUserBanned, checkIsUserSuspended, checkUserAccountStatus, } from "./shared/shared.account.middleware";
4
4
  export { errorHandler } from "./shared/shared.errorHandler.middleware";
5
+ export { loadAppRuntimeConfig } from "./shared/shared.appSpecs.middleware";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.errorHandler = exports.checkUserAccountStatus = exports.checkIsUserSuspended = exports.checkIsUserBanned = exports.checkUserAuthentication = exports.checkAdminAuthentication = void 0;
3
+ exports.loadAppRuntimeConfig = exports.errorHandler = exports.checkUserAccountStatus = exports.checkIsUserSuspended = exports.checkIsUserBanned = exports.checkUserAuthentication = exports.checkAdminAuthentication = void 0;
4
4
  var admin_auth_middleware_1 = require("./admin/admin.auth.middleware");
5
5
  Object.defineProperty(exports, "checkAdminAuthentication", { enumerable: true, get: function () { return admin_auth_middleware_1.checkAdminAuthentication; } });
6
6
  var users_auth_middleware_1 = require("./users/users.auth.middleware");
@@ -11,3 +11,5 @@ Object.defineProperty(exports, "checkIsUserSuspended", { enumerable: true, get:
11
11
  Object.defineProperty(exports, "checkUserAccountStatus", { enumerable: true, get: function () { return shared_account_middleware_1.checkUserAccountStatus; } });
12
12
  var shared_errorHandler_middleware_1 = require("./shared/shared.errorHandler.middleware");
13
13
  Object.defineProperty(exports, "errorHandler", { enumerable: true, get: function () { return shared_errorHandler_middleware_1.errorHandler; } });
14
+ var shared_appSpecs_middleware_1 = require("./shared/shared.appSpecs.middleware");
15
+ Object.defineProperty(exports, "loadAppRuntimeConfig", { enumerable: true, get: function () { return shared_appSpecs_middleware_1.loadAppRuntimeConfig; } });
@@ -0,0 +1,11 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ declare global {
3
+ namespace Express {
4
+ interface Request {
5
+ appRuntimeConfig?: Record<string, unknown>;
6
+ paidAccessActivated?: boolean;
7
+ }
8
+ }
9
+ }
10
+ /** Load app runtime settings once for a request and expose them on req. */
11
+ export declare function loadAppRuntimeConfig(appName?: string): (_req: Request, _res: Response, next: NextFunction) => Promise<void>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadAppRuntimeConfig = loadAppRuntimeConfig;
4
+ const vr_models_1 = require("vr-models");
5
+ /** Load app runtime settings once for a request and expose them on req. */
6
+ function loadAppRuntimeConfig(appName = "VIBERIDE-MOBILE-APP") {
7
+ return async (_req, _res, next) => {
8
+ try {
9
+ const appSpecs = await vr_models_1.AppSpecs.getByAppName(appName);
10
+ const runtimeConfig = appSpecs?.runtimeConfig;
11
+ _req.appRuntimeConfig = runtimeConfig;
12
+ const legacyPassengerAccess = runtimeConfig?.passengerAccess;
13
+ _req.paidAccessActivated = typeof runtimeConfig?.paidAccessActivated === "boolean"
14
+ ? runtimeConfig.paidAccessActivated
15
+ : legacyPassengerAccess?.mode !== "FREE";
16
+ next();
17
+ }
18
+ catch (error) {
19
+ next(error);
20
+ }
21
+ };
22
+ }
@@ -73,7 +73,7 @@ export declare const getDevicesSchema: z.ZodObject<{
73
73
  page?: number | undefined;
74
74
  sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
75
75
  sortOrder?: "DESC" | "ASC" | undefined;
76
- dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
76
+ dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
77
77
  isPermanentlyUnlocked?: "true" | "false" | undefined;
78
78
  isAssigned?: "true" | "false" | undefined;
79
79
  }, {
@@ -84,7 +84,7 @@ export declare const getDevicesSchema: z.ZodObject<{
84
84
  page?: string | undefined;
85
85
  sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
86
86
  sortOrder?: "DESC" | "ASC" | undefined;
87
- dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
87
+ dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
88
88
  isPermanentlyUnlocked?: "true" | "false" | undefined;
89
89
  isAssigned?: "true" | "false" | undefined;
90
90
  }>;
@@ -97,7 +97,7 @@ export declare const getDevicesSchema: z.ZodObject<{
97
97
  page?: number | undefined;
98
98
  sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
99
99
  sortOrder?: "DESC" | "ASC" | undefined;
100
- dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
100
+ dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
101
101
  isPermanentlyUnlocked?: "true" | "false" | undefined;
102
102
  isAssigned?: "true" | "false" | undefined;
103
103
  };
@@ -110,7 +110,7 @@ export declare const getDevicesSchema: z.ZodObject<{
110
110
  page?: string | undefined;
111
111
  sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
112
112
  sortOrder?: "DESC" | "ASC" | undefined;
113
- dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
113
+ dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
114
114
  isPermanentlyUnlocked?: "true" | "false" | undefined;
115
115
  isAssigned?: "true" | "false" | undefined;
116
116
  };
@@ -28,7 +28,7 @@ export declare const listEventLogsSchema: z.ZodObject<{
28
28
  lastName?: string | undefined;
29
29
  fromDate?: string | undefined;
30
30
  toDate?: string | undefined;
31
- actorType?: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN" | undefined;
31
+ actorType?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
32
32
  actorId?: string | undefined;
33
33
  action?: string | undefined;
34
34
  entity?: string | undefined;
@@ -44,7 +44,7 @@ export declare const listEventLogsSchema: z.ZodObject<{
44
44
  fromDate?: string | undefined;
45
45
  toDate?: string | undefined;
46
46
  sortOrder?: "DESC" | "ASC" | undefined;
47
- actorType?: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN" | undefined;
47
+ actorType?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
48
48
  actorId?: string | undefined;
49
49
  action?: string | undefined;
50
50
  entity?: string | undefined;
@@ -61,7 +61,7 @@ export declare const listEventLogsSchema: z.ZodObject<{
61
61
  fromDate?: string | undefined;
62
62
  toDate?: string | undefined;
63
63
  sortOrder?: "DESC" | "ASC" | undefined;
64
- actorType?: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN" | undefined;
64
+ actorType?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
65
65
  actorId?: string | undefined;
66
66
  action?: string | undefined;
67
67
  entity?: string | undefined;
@@ -82,7 +82,7 @@ export declare const listEventLogsSchema: z.ZodObject<{
82
82
  fromDate?: string | undefined;
83
83
  toDate?: string | undefined;
84
84
  sortOrder?: "DESC" | "ASC" | undefined;
85
- actorType?: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN" | undefined;
85
+ actorType?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
86
86
  actorId?: string | undefined;
87
87
  action?: string | undefined;
88
88
  entity?: string | undefined;