vr-commons 1.0.160 → 1.0.162
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/dist/utils/admin.device.utils.js +70 -106
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -7
- package/dist/utils/systemLog.utils.d.ts +2 -44
- package/dist/utils/systemLog.utils.js +11 -119
- package/dist/validations/admin.devices.validations.d.ts +160 -33
- package/dist/validations/admin.devices.validations.js +37 -7
- package/dist/validations/index.d.ts +1 -1
- package/dist/validations/index.js +3 -3
- package/package.json +2 -2
|
@@ -7,6 +7,10 @@ const sequelize_1 = require("sequelize");
|
|
|
7
7
|
const eventLog_utils_1 = require("./eventLog.utils");
|
|
8
8
|
const admin_devices_validations_1 = require("../validations/admin.devices.validations");
|
|
9
9
|
const systemLog_utils_1 = require("./systemLog.utils");
|
|
10
|
+
const isValidUUID = (str) => {
|
|
11
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
12
|
+
return uuidRegex.test(str);
|
|
13
|
+
};
|
|
10
14
|
/**
|
|
11
15
|
* Extract dedication from serial number
|
|
12
16
|
*/
|
|
@@ -620,40 +624,25 @@ exports.stockUtil = {
|
|
|
620
624
|
let batchNumber = 0;
|
|
621
625
|
let hasMore = true;
|
|
622
626
|
let offset = 0;
|
|
623
|
-
// Build WHERE clause for the query
|
|
624
627
|
const whereClause = buildWhereClause(condition);
|
|
625
|
-
// Build UPDATE SET clause
|
|
626
628
|
const setClause = buildSetClause(update);
|
|
627
629
|
console.log(`🔄 Resetting device pairs at ${new Date().toISOString()}`);
|
|
628
630
|
console.log(`📋 WHERE: ${whereClause}`);
|
|
629
631
|
console.log(`📝 SET: ${setClause}`);
|
|
630
|
-
// Log start
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
await (0, systemLog_utils_1.logInfo)(`Reset device pairs triggered by ${actorRole}`, {
|
|
640
|
-
category: "DEVICE",
|
|
641
|
-
userId: actorId || undefined,
|
|
642
|
-
userRole: actorRole,
|
|
643
|
-
source: "device-reset.manual",
|
|
644
|
-
details: { triggeredBy, batchSize, maxRetries, condition, update },
|
|
645
|
-
});
|
|
646
|
-
}
|
|
632
|
+
// Log start - SystemLog only
|
|
633
|
+
await (0, systemLog_utils_1.logInfo)(`Reset device pairs job started`, {
|
|
634
|
+
category: isSystem ? "CRONJOB" : "DEVICE",
|
|
635
|
+
source: isSystem ? "device-reset.cronjob" : "device-reset.manual",
|
|
636
|
+
details: { triggeredBy, batchSize, maxRetries, condition, update },
|
|
637
|
+
});
|
|
647
638
|
const sequelizeInstance = vr_models_1.Device.sequelize;
|
|
648
639
|
if (!sequelizeInstance) {
|
|
649
640
|
throw new Error("Sequelize instance not available");
|
|
650
641
|
}
|
|
651
|
-
// Process in batches
|
|
652
642
|
while (hasMore) {
|
|
653
643
|
batchNumber++;
|
|
654
644
|
offset = (batchNumber - 1) * batchSize;
|
|
655
|
-
|
|
656
|
-
const [pairIdsResult] = await sequelizeInstance.query(`
|
|
645
|
+
const pairIdsResult = await sequelizeInstance.query(`
|
|
657
646
|
SELECT "pairId"
|
|
658
647
|
FROM "devices"
|
|
659
648
|
WHERE "deletedAt" IS NULL
|
|
@@ -661,17 +650,21 @@ exports.stockUtil = {
|
|
|
661
650
|
GROUP BY "pairId"
|
|
662
651
|
HAVING COUNT(*) = 2
|
|
663
652
|
ORDER BY "pairId" ASC
|
|
664
|
-
LIMIT
|
|
665
|
-
OFFSET
|
|
653
|
+
LIMIT $1
|
|
654
|
+
OFFSET $2
|
|
666
655
|
`, {
|
|
667
|
-
|
|
668
|
-
limit: batchSize,
|
|
669
|
-
offset: offset,
|
|
670
|
-
},
|
|
656
|
+
bind: [batchSize, offset],
|
|
671
657
|
type: "SELECT",
|
|
672
658
|
transaction: transaction,
|
|
673
659
|
});
|
|
674
|
-
|
|
660
|
+
let pairIds = [];
|
|
661
|
+
if (Array.isArray(pairIdsResult)) {
|
|
662
|
+
pairIds = pairIdsResult.map((p) => p.pairId);
|
|
663
|
+
}
|
|
664
|
+
else if (pairIdsResult && typeof pairIdsResult === "object") {
|
|
665
|
+
const rows = pairIdsResult.rows || [];
|
|
666
|
+
pairIds = rows.map((p) => p.pairId);
|
|
667
|
+
}
|
|
675
668
|
if (pairIds.length === 0) {
|
|
676
669
|
hasMore = false;
|
|
677
670
|
break;
|
|
@@ -694,7 +687,6 @@ exports.stockUtil = {
|
|
|
694
687
|
if (devices.length !== 2) {
|
|
695
688
|
throw new Error(`Incomplete pair ${pairId}: expected 2 devices, found ${devices.length}`);
|
|
696
689
|
}
|
|
697
|
-
// Check if update would be a no-op
|
|
698
690
|
const shouldUpdate = devices.some((d) => {
|
|
699
691
|
const updateObj = buildUpdateObject(update);
|
|
700
692
|
return Object.keys(updateObj).some((key) => d[key] !== updateObj[key]);
|
|
@@ -747,78 +739,61 @@ exports.stockUtil = {
|
|
|
747
739
|
: ""}`,
|
|
748
740
|
};
|
|
749
741
|
console.log(`✅ Reset device pairs completed:`, result);
|
|
750
|
-
// Log
|
|
751
|
-
await (0,
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
condition: condition,
|
|
761
|
-
update: update,
|
|
762
|
-
summary: {
|
|
763
|
-
totalPairsProcessed: result.pairsProcessed,
|
|
764
|
-
totalDevicesUpdated: result.updatedCount,
|
|
765
|
-
totalPairsUpdated: updatedPairIds.length,
|
|
766
|
-
failedPairs: result.failedCount,
|
|
767
|
-
failedPairIds: result.failedPairIds,
|
|
768
|
-
errors: result.errors,
|
|
769
|
-
deviceIds: allDeviceIds.slice(0, 100),
|
|
770
|
-
},
|
|
771
|
-
batchDetails: {
|
|
772
|
-
totalBatches: batchNumber,
|
|
773
|
-
batchSize: batchSize,
|
|
774
|
-
maxRetries: maxRetries,
|
|
775
|
-
},
|
|
776
|
-
timestamp: new Date().toISOString(),
|
|
742
|
+
// Log completion - SystemLog only
|
|
743
|
+
await (0, systemLog_utils_1.logInfo)(`Reset device pairs job completed`, {
|
|
744
|
+
category: isSystem ? "CRONJOB" : "DEVICE",
|
|
745
|
+
source: isSystem ? "device-reset.cronjob" : "device-reset.manual",
|
|
746
|
+
details: {
|
|
747
|
+
updatedDevices: result.updatedCount,
|
|
748
|
+
updatedPairs: updatedPairIds.length,
|
|
749
|
+
failedPairs: result.failedCount,
|
|
750
|
+
totalPairs: result.pairsProcessed,
|
|
751
|
+
hasErrors: result.errors.length > 0,
|
|
777
752
|
},
|
|
778
|
-
deviceSession: null,
|
|
779
|
-
transaction: transaction,
|
|
780
753
|
});
|
|
781
|
-
// Log to system logs
|
|
782
|
-
if (isSystem) {
|
|
783
|
-
await (0, systemLog_utils_1.logInfo)(`Reset device pairs job completed`, {
|
|
784
|
-
category: "CRONJOB",
|
|
785
|
-
source: "device-reset.cronjob",
|
|
786
|
-
details: {
|
|
787
|
-
updatedDevices: result.updatedCount,
|
|
788
|
-
updatedPairs: updatedPairIds.length,
|
|
789
|
-
failedPairs: result.failedCount,
|
|
790
|
-
totalPairs: result.pairsProcessed,
|
|
791
|
-
hasErrors: result.errors.length > 0,
|
|
792
|
-
},
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
else {
|
|
796
|
-
await (0, systemLog_utils_1.logInfo)(`Reset device pairs completed by ${actorRole}`, {
|
|
797
|
-
category: "DEVICE",
|
|
798
|
-
userId: actorId || undefined,
|
|
799
|
-
userRole: actorRole,
|
|
800
|
-
source: "device-reset.manual",
|
|
801
|
-
details: {
|
|
802
|
-
updatedDevices: result.updatedCount,
|
|
803
|
-
updatedPairs: updatedPairIds.length,
|
|
804
|
-
failedPairs: result.failedCount,
|
|
805
|
-
totalPairs: result.pairsProcessed,
|
|
806
|
-
hasErrors: result.errors.length > 0,
|
|
807
|
-
},
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
754
|
if (result.errors.length > 0) {
|
|
811
755
|
await (0, systemLog_utils_1.logError)(`Reset device pairs had ${result.errors.length} failures`, {
|
|
812
756
|
category: isSystem ? "CRONJOB" : "DEVICE",
|
|
813
757
|
source: isSystem ? "device-reset.cronjob" : "device-reset.manual",
|
|
814
|
-
userId: isSystem ? null : actorId || undefined,
|
|
815
|
-
userRole: isSystem ? null : actorRole,
|
|
816
758
|
details: {
|
|
817
759
|
failedPairs: result.failedPairIds,
|
|
818
760
|
errors: result.errors,
|
|
819
761
|
},
|
|
820
762
|
});
|
|
821
763
|
}
|
|
764
|
+
// Log EventLog ONLY for user-triggered actions
|
|
765
|
+
if (!isSystem && actorId && isValidUUID(actorId)) {
|
|
766
|
+
await (0, eventLog_utils_1.logEvent)({
|
|
767
|
+
actorId: actorId,
|
|
768
|
+
actorType: actorRole,
|
|
769
|
+
action: "DEVICES_UPDATED",
|
|
770
|
+
entity: "Device",
|
|
771
|
+
entityId: null,
|
|
772
|
+
metadata: {
|
|
773
|
+
action: "RESET_DEVICES_STATUS",
|
|
774
|
+
triggeredBy: triggeredBy,
|
|
775
|
+
condition: condition,
|
|
776
|
+
update: update,
|
|
777
|
+
summary: {
|
|
778
|
+
totalPairsProcessed: result.pairsProcessed,
|
|
779
|
+
totalDevicesUpdated: result.updatedCount,
|
|
780
|
+
totalPairsUpdated: updatedPairIds.length,
|
|
781
|
+
failedPairs: result.failedCount,
|
|
782
|
+
failedPairIds: result.failedPairIds,
|
|
783
|
+
errors: result.errors,
|
|
784
|
+
deviceIds: allDeviceIds.slice(0, 100),
|
|
785
|
+
},
|
|
786
|
+
batchDetails: {
|
|
787
|
+
totalBatches: batchNumber,
|
|
788
|
+
batchSize: batchSize,
|
|
789
|
+
maxRetries: maxRetries,
|
|
790
|
+
},
|
|
791
|
+
timestamp: new Date().toISOString(),
|
|
792
|
+
},
|
|
793
|
+
deviceSession: null,
|
|
794
|
+
transaction: transaction,
|
|
795
|
+
});
|
|
796
|
+
}
|
|
822
797
|
return result;
|
|
823
798
|
}
|
|
824
799
|
catch (err) {
|
|
@@ -834,22 +809,11 @@ exports.stockUtil = {
|
|
|
834
809
|
pairsProcessed: 0,
|
|
835
810
|
message: `Reset device pairs job failed: ${errorMessage}`,
|
|
836
811
|
};
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
else {
|
|
845
|
-
await (0, systemLog_utils_1.logError)(`Reset device pairs failed`, {
|
|
846
|
-
category: "DEVICE",
|
|
847
|
-
userId: actorId || undefined,
|
|
848
|
-
userRole: actorRole,
|
|
849
|
-
source: "device-reset.manual",
|
|
850
|
-
details: { error: errorMessage },
|
|
851
|
-
});
|
|
852
|
-
}
|
|
812
|
+
await (0, systemLog_utils_1.logError)(`Reset device pairs job failed`, {
|
|
813
|
+
category: isSystem ? "CRONJOB" : "DEVICE",
|
|
814
|
+
source: isSystem ? "device-reset.cronjob" : "device-reset.manual",
|
|
815
|
+
details: { error: errorMessage },
|
|
816
|
+
});
|
|
853
817
|
return result;
|
|
854
818
|
}
|
|
855
819
|
},
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -15,4 +15,4 @@ export { DPP_OperationsUtil } from "./admin.devicePayment.utils";
|
|
|
15
15
|
export { PendingRegistration, VerificationMethod, ConfirmResponse, UploadResult, StockChangeResult, } from "./types";
|
|
16
16
|
export { formatDeviceSession, formatEventLog, formatEventLogs, buildEventLogWhereClause, buildSearchConditions, buildUserSearchConditions, } from "./eventlogs.admin.utils";
|
|
17
17
|
export { extractDedicatedUserFromSerial } from "./deviceUtils";
|
|
18
|
-
export {
|
|
18
|
+
export { logDebug, logError, logInfo, logSystem, logWarning, } from "./systemLog.utils";
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateContactValue = exports.detectContactType = exports.sendVerificationCode = exports.sendSMS = exports.sendEmail = exports.getVerificationMethod = exports.getOTPExpiry = exports.generateOTP = exports.createDeviceSession = exports.suspensionUtil = exports.banUtil = exports.hasHigherAuthority = exports.getModeratableRoles = exports.canModerateUser = exports.canModerate = exports.softDeleteUser = exports.hashPassword = exports.validatePassword = exports.validateUniqueFields = exports.generateJacketId = exports.getSortOrder = exports.generateEventSearchConditions = exports.generateUserSearchConditions = exports.findSecurityClearanceByRole = exports.getUsersByRole = exports.getUserById = exports.isAccountAccessible = exports.canModifyAccount = exports.hasAllPermissions = exports.hasAnyPermission = exports.hasPermission = exports.hasRole = exports.formatUserListResponse = exports.formatUserProfile = exports.sendErrorResponse = exports.sendSuccessResponse = exports.logEvent = exports.formatTimeRemaining = exports.getTokenTimeRemaining = exports.generateToken = exports.shouldRefreshToken = exports.verifyToken = exports.generateRiderToken = exports.generatePassengerToken = exports.generateAdminToken = exports.checkSuspensionStatus = exports.checkIsUserBannedOrSuspended = exports.checkBanStatus = exports.hasActiveDependencies = exports.checkAccountDependencies = void 0;
|
|
4
|
-
exports.logWarning = exports.logSystem = exports.
|
|
4
|
+
exports.logWarning = exports.logSystem = exports.logInfo = exports.logError = exports.logDebug = exports.extractDedicatedUserFromSerial = exports.buildUserSearchConditions = exports.buildSearchConditions = exports.buildEventLogWhereClause = exports.formatEventLogs = exports.formatEventLog = exports.formatDeviceSession = exports.DPP_OperationsUtil = exports.cloudinaryUtil = exports.stockUtil = exports.hierarchicalView = exports.validateHierarchy = exports.isSuperiorOrEqual = exports.isSuperior = exports.isSubordinateOrEqual = exports.isSubordinate = exports.isRankEqual = exports.getUserLevel = void 0;
|
|
5
5
|
var account_utils_1 = require("./account.utils");
|
|
6
6
|
Object.defineProperty(exports, "checkAccountDependencies", { enumerable: true, get: function () { return account_utils_1.checkAccountDependencies; } });
|
|
7
7
|
Object.defineProperty(exports, "hasActiveDependencies", { enumerable: true, get: function () { return account_utils_1.hasActiveDependencies; } });
|
|
@@ -94,14 +94,8 @@ Object.defineProperty(exports, "buildUserSearchConditions", { enumerable: true,
|
|
|
94
94
|
var deviceUtils_1 = require("./deviceUtils");
|
|
95
95
|
Object.defineProperty(exports, "extractDedicatedUserFromSerial", { enumerable: true, get: function () { return deviceUtils_1.extractDedicatedUserFromSerial; } });
|
|
96
96
|
var systemLog_utils_1 = require("./systemLog.utils");
|
|
97
|
-
Object.defineProperty(exports, "logApi", { enumerable: true, get: function () { return systemLog_utils_1.logApi; } });
|
|
98
|
-
Object.defineProperty(exports, "logAuth", { enumerable: true, get: function () { return systemLog_utils_1.logAuth; } });
|
|
99
|
-
Object.defineProperty(exports, "logCronjob", { enumerable: true, get: function () { return systemLog_utils_1.logCronjob; } });
|
|
100
97
|
Object.defineProperty(exports, "logDebug", { enumerable: true, get: function () { return systemLog_utils_1.logDebug; } });
|
|
101
|
-
Object.defineProperty(exports, "logDevice", { enumerable: true, get: function () { return systemLog_utils_1.logDevice; } });
|
|
102
98
|
Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return systemLog_utils_1.logError; } });
|
|
103
99
|
Object.defineProperty(exports, "logInfo", { enumerable: true, get: function () { return systemLog_utils_1.logInfo; } });
|
|
104
|
-
Object.defineProperty(exports, "logPayment", { enumerable: true, get: function () { return systemLog_utils_1.logPayment; } });
|
|
105
|
-
Object.defineProperty(exports, "logSecurity", { enumerable: true, get: function () { return systemLog_utils_1.logSecurity; } });
|
|
106
100
|
Object.defineProperty(exports, "logSystem", { enumerable: true, get: function () { return systemLog_utils_1.logSystem; } });
|
|
107
101
|
Object.defineProperty(exports, "logWarning", { enumerable: true, get: function () { return systemLog_utils_1.logWarning; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogLevel, LogCategory
|
|
1
|
+
import { LogLevel, LogCategory } from "vr-models";
|
|
2
2
|
import { Transaction } from "sequelize";
|
|
3
3
|
export interface SystemLogInput {
|
|
4
4
|
level?: LogLevel;
|
|
@@ -6,55 +6,13 @@ export interface SystemLogInput {
|
|
|
6
6
|
message: string;
|
|
7
7
|
details?: Record<string, any> | null;
|
|
8
8
|
source?: string | null;
|
|
9
|
-
userId?: string | null;
|
|
10
|
-
userRole?: UserRole | null;
|
|
11
9
|
ipAddress?: string | null;
|
|
12
10
|
userAgent?: string | null;
|
|
13
11
|
timestamp?: Date;
|
|
14
12
|
transaction?: Transaction;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
* Create a system log entry
|
|
18
|
-
* Uses the static methods from SystemLog model
|
|
19
|
-
*/
|
|
20
|
-
export declare const logSystem: ({ level, category, message, details, source, userId, userRole, ipAddress, userAgent, timestamp, transaction, }: SystemLogInput) => Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Log an error
|
|
23
|
-
*/
|
|
14
|
+
export declare const logSystem: ({ level, category, message, details, source, ipAddress, userAgent, timestamp, transaction, }: SystemLogInput) => Promise<void>;
|
|
24
15
|
export declare const logError: (message: string, options?: Omit<SystemLogInput, "level" | "message">) => Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Log a warning
|
|
27
|
-
*/
|
|
28
16
|
export declare const logWarning: (message: string, options?: Omit<SystemLogInput, "level" | "message">) => Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Log an info message
|
|
31
|
-
*/
|
|
32
17
|
export declare const logInfo: (message: string, options?: Omit<SystemLogInput, "level" | "message">) => Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Log debug info
|
|
35
|
-
*/
|
|
36
18
|
export declare const logDebug: (message: string, options?: Omit<SystemLogInput, "level" | "message">) => Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Log a cronjob event
|
|
39
|
-
*/
|
|
40
|
-
export declare const logCronjob: (message: string, options?: Omit<SystemLogInput, "level" | "category" | "message">) => Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Log a payment event
|
|
43
|
-
*/
|
|
44
|
-
export declare const logPayment: (message: string, options?: Omit<SystemLogInput, "level" | "category" | "message">) => Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Log a device event
|
|
47
|
-
*/
|
|
48
|
-
export declare const logDevice: (message: string, options?: Omit<SystemLogInput, "level" | "category" | "message">) => Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Log an auth event
|
|
51
|
-
*/
|
|
52
|
-
export declare const logAuth: (message: string, options?: Omit<SystemLogInput, "level" | "category" | "message">) => Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Log a security event
|
|
55
|
-
*/
|
|
56
|
-
export declare const logSecurity: (message: string, options?: Omit<SystemLogInput, "level" | "category" | "message">) => Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Log an API request
|
|
59
|
-
*/
|
|
60
|
-
export declare const logApi: (message: string, options?: Omit<SystemLogInput, "level" | "category" | "message">) => Promise<void>;
|
|
@@ -1,148 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.logDebug = exports.logInfo = exports.logWarning = exports.logError = exports.logSystem = void 0;
|
|
4
4
|
// src/utils/systemLog.utils.ts
|
|
5
5
|
const vr_models_1 = require("vr-models");
|
|
6
|
-
|
|
7
|
-
* Create a system log entry
|
|
8
|
-
* Uses the static methods from SystemLog model
|
|
9
|
-
*/
|
|
10
|
-
const logSystem = async ({ level = "INFO", category = "SYSTEM", message, details = null, source = null, userId = null, userRole = null, ipAddress = null, userAgent = null, timestamp, transaction, }) => {
|
|
6
|
+
const logSystem = async ({ level = "INFO", category = "SYSTEM", message, details = null, source = null, ipAddress = null, userAgent = null, timestamp, transaction, }) => {
|
|
11
7
|
try {
|
|
12
8
|
const logData = {
|
|
13
9
|
level,
|
|
14
10
|
category,
|
|
15
11
|
message,
|
|
16
|
-
details,
|
|
17
|
-
source,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
userAgent,
|
|
22
|
-
timestamp,
|
|
12
|
+
details: details || null,
|
|
13
|
+
source: source || null,
|
|
14
|
+
ipAddress: ipAddress || null,
|
|
15
|
+
userAgent: userAgent || null,
|
|
16
|
+
timestamp: timestamp || new Date(),
|
|
23
17
|
};
|
|
24
|
-
// Create log entry with optional transaction
|
|
25
18
|
await vr_models_1.SystemLog.create(logData, { transaction });
|
|
26
19
|
}
|
|
27
20
|
catch (err) {
|
|
28
21
|
console.error("❌ Failed to create system log:", err);
|
|
29
|
-
// Don't throw - system logging should not break the main operation
|
|
30
22
|
}
|
|
31
23
|
};
|
|
32
24
|
exports.logSystem = logSystem;
|
|
33
|
-
/**
|
|
34
|
-
* Log an error
|
|
35
|
-
*/
|
|
36
25
|
const logError = async (message, options = {}) => {
|
|
37
|
-
await (0, exports.logSystem)({
|
|
38
|
-
level: "ERROR",
|
|
39
|
-
message,
|
|
40
|
-
...options,
|
|
41
|
-
});
|
|
26
|
+
await (0, exports.logSystem)({ level: "ERROR", message, ...options });
|
|
42
27
|
};
|
|
43
28
|
exports.logError = logError;
|
|
44
|
-
/**
|
|
45
|
-
* Log a warning
|
|
46
|
-
*/
|
|
47
29
|
const logWarning = async (message, options = {}) => {
|
|
48
|
-
await (0, exports.logSystem)({
|
|
49
|
-
level: "WARNING",
|
|
50
|
-
message,
|
|
51
|
-
...options,
|
|
52
|
-
});
|
|
30
|
+
await (0, exports.logSystem)({ level: "WARNING", message, ...options });
|
|
53
31
|
};
|
|
54
32
|
exports.logWarning = logWarning;
|
|
55
|
-
/**
|
|
56
|
-
* Log an info message
|
|
57
|
-
*/
|
|
58
33
|
const logInfo = async (message, options = {}) => {
|
|
59
|
-
await (0, exports.logSystem)({
|
|
60
|
-
level: "INFO",
|
|
61
|
-
message,
|
|
62
|
-
...options,
|
|
63
|
-
});
|
|
34
|
+
await (0, exports.logSystem)({ level: "INFO", message, ...options });
|
|
64
35
|
};
|
|
65
36
|
exports.logInfo = logInfo;
|
|
66
|
-
/**
|
|
67
|
-
* Log debug info
|
|
68
|
-
*/
|
|
69
37
|
const logDebug = async (message, options = {}) => {
|
|
70
|
-
await (0, exports.logSystem)({
|
|
71
|
-
level: "DEBUG",
|
|
72
|
-
message,
|
|
73
|
-
...options,
|
|
74
|
-
});
|
|
38
|
+
await (0, exports.logSystem)({ level: "DEBUG", message, ...options });
|
|
75
39
|
};
|
|
76
40
|
exports.logDebug = logDebug;
|
|
77
|
-
/**
|
|
78
|
-
* Log a cronjob event
|
|
79
|
-
*/
|
|
80
|
-
const logCronjob = async (message, options = {}) => {
|
|
81
|
-
await (0, exports.logSystem)({
|
|
82
|
-
level: "INFO",
|
|
83
|
-
category: "CRONJOB",
|
|
84
|
-
message,
|
|
85
|
-
...options,
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
exports.logCronjob = logCronjob;
|
|
89
|
-
/**
|
|
90
|
-
* Log a payment event
|
|
91
|
-
*/
|
|
92
|
-
const logPayment = async (message, options = {}) => {
|
|
93
|
-
await (0, exports.logSystem)({
|
|
94
|
-
level: "INFO",
|
|
95
|
-
category: "PAYMENT",
|
|
96
|
-
message,
|
|
97
|
-
...options,
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
exports.logPayment = logPayment;
|
|
101
|
-
/**
|
|
102
|
-
* Log a device event
|
|
103
|
-
*/
|
|
104
|
-
const logDevice = async (message, options = {}) => {
|
|
105
|
-
await (0, exports.logSystem)({
|
|
106
|
-
level: "INFO",
|
|
107
|
-
category: "DEVICE",
|
|
108
|
-
message,
|
|
109
|
-
...options,
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
exports.logDevice = logDevice;
|
|
113
|
-
/**
|
|
114
|
-
* Log an auth event
|
|
115
|
-
*/
|
|
116
|
-
const logAuth = async (message, options = {}) => {
|
|
117
|
-
await (0, exports.logSystem)({
|
|
118
|
-
level: "INFO",
|
|
119
|
-
category: "AUTH",
|
|
120
|
-
message,
|
|
121
|
-
...options,
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
exports.logAuth = logAuth;
|
|
125
|
-
/**
|
|
126
|
-
* Log a security event
|
|
127
|
-
*/
|
|
128
|
-
const logSecurity = async (message, options = {}) => {
|
|
129
|
-
await (0, exports.logSystem)({
|
|
130
|
-
level: "INFO",
|
|
131
|
-
category: "SECURITY",
|
|
132
|
-
message,
|
|
133
|
-
...options,
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
exports.logSecurity = logSecurity;
|
|
137
|
-
/**
|
|
138
|
-
* Log an API request
|
|
139
|
-
*/
|
|
140
|
-
const logApi = async (message, options = {}) => {
|
|
141
|
-
await (0, exports.logSystem)({
|
|
142
|
-
level: "INFO",
|
|
143
|
-
category: "API",
|
|
144
|
-
message,
|
|
145
|
-
...options,
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
exports.logApi = logApi;
|
|
@@ -59,53 +59,53 @@ export declare const getDevicesSchema: z.ZodObject<{
|
|
|
59
59
|
sortBy: z.ZodOptional<z.ZodEnum<["serialNumber", "status", "createdAt", "updatedAt"]>>;
|
|
60
60
|
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
|
|
62
|
+
search?: string | undefined;
|
|
63
|
+
limit?: number | undefined;
|
|
63
64
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
64
65
|
page?: number | undefined;
|
|
65
|
-
|
|
66
|
+
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
67
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
68
|
+
productId?: string | undefined;
|
|
66
69
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
67
70
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
68
71
|
isAssigned?: "true" | "false" | undefined;
|
|
69
|
-
search?: string | undefined;
|
|
70
|
-
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
71
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
72
72
|
}, {
|
|
73
|
-
|
|
73
|
+
search?: string | undefined;
|
|
74
|
+
limit?: string | undefined;
|
|
74
75
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
75
76
|
page?: string | undefined;
|
|
76
|
-
|
|
77
|
+
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
78
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
79
|
+
productId?: string | undefined;
|
|
77
80
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
78
81
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
79
82
|
isAssigned?: "true" | "false" | undefined;
|
|
80
|
-
search?: string | undefined;
|
|
81
|
-
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
82
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
83
83
|
}>;
|
|
84
84
|
}, "strip", z.ZodTypeAny, {
|
|
85
85
|
query: {
|
|
86
|
-
|
|
86
|
+
search?: string | undefined;
|
|
87
|
+
limit?: number | undefined;
|
|
87
88
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
88
89
|
page?: number | undefined;
|
|
89
|
-
|
|
90
|
+
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
91
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
92
|
+
productId?: string | undefined;
|
|
90
93
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
91
94
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
92
95
|
isAssigned?: "true" | "false" | undefined;
|
|
93
|
-
search?: string | undefined;
|
|
94
|
-
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
95
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
96
96
|
};
|
|
97
97
|
}, {
|
|
98
98
|
query: {
|
|
99
|
-
|
|
99
|
+
search?: string | undefined;
|
|
100
|
+
limit?: string | undefined;
|
|
100
101
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
101
102
|
page?: string | undefined;
|
|
102
|
-
|
|
103
|
+
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
104
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
105
|
+
productId?: string | undefined;
|
|
103
106
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
104
107
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
105
108
|
isAssigned?: "true" | "false" | undefined;
|
|
106
|
-
search?: string | undefined;
|
|
107
|
-
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
108
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
109
109
|
};
|
|
110
110
|
}>;
|
|
111
111
|
export declare const deleteDevicesByPairsSchema: z.ZodObject<{
|
|
@@ -153,32 +153,32 @@ export declare const lockDevicesSchema: z.ZodObject<{
|
|
|
153
153
|
pairIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
154
154
|
serialNumbers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
155
155
|
}, "strip", z.ZodTypeAny, {
|
|
156
|
-
pairIds?: string[] | undefined;
|
|
157
156
|
reason?: string | undefined;
|
|
157
|
+
pairIds?: string[] | undefined;
|
|
158
158
|
serialNumbers?: string[] | undefined;
|
|
159
159
|
}, {
|
|
160
|
-
pairIds?: string[] | undefined;
|
|
161
160
|
reason?: string | undefined;
|
|
161
|
+
pairIds?: string[] | undefined;
|
|
162
162
|
serialNumbers?: string[] | undefined;
|
|
163
163
|
}>, {
|
|
164
|
-
pairIds?: string[] | undefined;
|
|
165
164
|
reason?: string | undefined;
|
|
165
|
+
pairIds?: string[] | undefined;
|
|
166
166
|
serialNumbers?: string[] | undefined;
|
|
167
167
|
}, {
|
|
168
|
-
pairIds?: string[] | undefined;
|
|
169
168
|
reason?: string | undefined;
|
|
169
|
+
pairIds?: string[] | undefined;
|
|
170
170
|
serialNumbers?: string[] | undefined;
|
|
171
171
|
}>;
|
|
172
172
|
}, "strip", z.ZodTypeAny, {
|
|
173
173
|
body: {
|
|
174
|
-
pairIds?: string[] | undefined;
|
|
175
174
|
reason?: string | undefined;
|
|
175
|
+
pairIds?: string[] | undefined;
|
|
176
176
|
serialNumbers?: string[] | undefined;
|
|
177
177
|
};
|
|
178
178
|
}, {
|
|
179
179
|
body: {
|
|
180
|
-
pairIds?: string[] | undefined;
|
|
181
180
|
reason?: string | undefined;
|
|
181
|
+
pairIds?: string[] | undefined;
|
|
182
182
|
serialNumbers?: string[] | undefined;
|
|
183
183
|
};
|
|
184
184
|
}>;
|
|
@@ -293,7 +293,7 @@ export declare const checkAvailabilitySchema: z.ZodObject<{
|
|
|
293
293
|
productId: string;
|
|
294
294
|
};
|
|
295
295
|
}>;
|
|
296
|
-
export declare const
|
|
296
|
+
export declare const triggerDeviceResetSchema: z.ZodObject<{
|
|
297
297
|
body: z.ZodOptional<z.ZodObject<{
|
|
298
298
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
299
299
|
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
@@ -315,20 +315,147 @@ export declare const triggerDeviceLockSchema: z.ZodObject<{
|
|
|
315
315
|
maxRetries?: number | undefined;
|
|
316
316
|
} | undefined;
|
|
317
317
|
}>;
|
|
318
|
-
export declare const
|
|
318
|
+
export declare const customDeviceResetSchema: z.ZodObject<{
|
|
319
319
|
body: z.ZodObject<{
|
|
320
|
-
|
|
320
|
+
condition: z.ZodOptional<z.ZodObject<{
|
|
321
|
+
status: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
322
|
+
excludeStatus: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
323
|
+
isPermanentlyUnlocked: z.ZodOptional<z.ZodBoolean>;
|
|
324
|
+
pairId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
325
|
+
excludePairIds: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
326
|
+
productId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
327
|
+
dedicatedUser: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
328
|
+
createdBefore: z.ZodOptional<z.ZodString>;
|
|
329
|
+
createdAfter: z.ZodOptional<z.ZodString>;
|
|
330
|
+
}, "strip", z.ZodTypeAny, {
|
|
331
|
+
status?: string | string[] | undefined;
|
|
332
|
+
productId?: string | string[] | undefined;
|
|
333
|
+
dedicatedUser?: string | string[] | undefined;
|
|
334
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
335
|
+
excludeStatus?: string | string[] | undefined;
|
|
336
|
+
pairId?: string | string[] | undefined;
|
|
337
|
+
excludePairIds?: string | string[] | undefined;
|
|
338
|
+
createdBefore?: string | undefined;
|
|
339
|
+
createdAfter?: string | undefined;
|
|
340
|
+
}, {
|
|
341
|
+
status?: string | string[] | undefined;
|
|
342
|
+
productId?: string | string[] | undefined;
|
|
343
|
+
dedicatedUser?: string | string[] | undefined;
|
|
344
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
345
|
+
excludeStatus?: string | string[] | undefined;
|
|
346
|
+
pairId?: string | string[] | undefined;
|
|
347
|
+
excludePairIds?: string | string[] | undefined;
|
|
348
|
+
createdBefore?: string | undefined;
|
|
349
|
+
createdAfter?: string | undefined;
|
|
350
|
+
}>>;
|
|
351
|
+
update: z.ZodOptional<z.ZodObject<{
|
|
352
|
+
status: z.ZodOptional<z.ZodString>;
|
|
353
|
+
isPermanentlyUnlocked: z.ZodOptional<z.ZodBoolean>;
|
|
354
|
+
dedicatedUser: z.ZodOptional<z.ZodString>;
|
|
355
|
+
devicePaymentPlanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
356
|
+
activatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
status?: string | undefined;
|
|
359
|
+
devicePaymentPlanId?: string | null | undefined;
|
|
360
|
+
dedicatedUser?: string | undefined;
|
|
361
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
362
|
+
activatedAt?: string | null | undefined;
|
|
363
|
+
}, {
|
|
364
|
+
status?: string | undefined;
|
|
365
|
+
devicePaymentPlanId?: string | null | undefined;
|
|
366
|
+
dedicatedUser?: string | undefined;
|
|
367
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
368
|
+
activatedAt?: string | null | undefined;
|
|
369
|
+
}>>;
|
|
370
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
371
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
321
372
|
}, "strip", z.ZodTypeAny, {
|
|
322
|
-
|
|
373
|
+
update?: {
|
|
374
|
+
status?: string | undefined;
|
|
375
|
+
devicePaymentPlanId?: string | null | undefined;
|
|
376
|
+
dedicatedUser?: string | undefined;
|
|
377
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
378
|
+
activatedAt?: string | null | undefined;
|
|
379
|
+
} | undefined;
|
|
380
|
+
batchSize?: number | undefined;
|
|
381
|
+
maxRetries?: number | undefined;
|
|
382
|
+
condition?: {
|
|
383
|
+
status?: string | string[] | undefined;
|
|
384
|
+
productId?: string | string[] | undefined;
|
|
385
|
+
dedicatedUser?: string | string[] | undefined;
|
|
386
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
387
|
+
excludeStatus?: string | string[] | undefined;
|
|
388
|
+
pairId?: string | string[] | undefined;
|
|
389
|
+
excludePairIds?: string | string[] | undefined;
|
|
390
|
+
createdBefore?: string | undefined;
|
|
391
|
+
createdAfter?: string | undefined;
|
|
392
|
+
} | undefined;
|
|
323
393
|
}, {
|
|
324
|
-
|
|
394
|
+
update?: {
|
|
395
|
+
status?: string | undefined;
|
|
396
|
+
devicePaymentPlanId?: string | null | undefined;
|
|
397
|
+
dedicatedUser?: string | undefined;
|
|
398
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
399
|
+
activatedAt?: string | null | undefined;
|
|
400
|
+
} | undefined;
|
|
401
|
+
batchSize?: number | undefined;
|
|
402
|
+
maxRetries?: number | undefined;
|
|
403
|
+
condition?: {
|
|
404
|
+
status?: string | string[] | undefined;
|
|
405
|
+
productId?: string | string[] | undefined;
|
|
406
|
+
dedicatedUser?: string | string[] | undefined;
|
|
407
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
408
|
+
excludeStatus?: string | string[] | undefined;
|
|
409
|
+
pairId?: string | string[] | undefined;
|
|
410
|
+
excludePairIds?: string | string[] | undefined;
|
|
411
|
+
createdBefore?: string | undefined;
|
|
412
|
+
createdAfter?: string | undefined;
|
|
413
|
+
} | undefined;
|
|
325
414
|
}>;
|
|
326
415
|
}, "strip", z.ZodTypeAny, {
|
|
327
416
|
body: {
|
|
328
|
-
|
|
417
|
+
update?: {
|
|
418
|
+
status?: string | undefined;
|
|
419
|
+
devicePaymentPlanId?: string | null | undefined;
|
|
420
|
+
dedicatedUser?: string | undefined;
|
|
421
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
422
|
+
activatedAt?: string | null | undefined;
|
|
423
|
+
} | undefined;
|
|
424
|
+
batchSize?: number | undefined;
|
|
425
|
+
maxRetries?: number | undefined;
|
|
426
|
+
condition?: {
|
|
427
|
+
status?: string | string[] | undefined;
|
|
428
|
+
productId?: string | string[] | undefined;
|
|
429
|
+
dedicatedUser?: string | string[] | undefined;
|
|
430
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
431
|
+
excludeStatus?: string | string[] | undefined;
|
|
432
|
+
pairId?: string | string[] | undefined;
|
|
433
|
+
excludePairIds?: string | string[] | undefined;
|
|
434
|
+
createdBefore?: string | undefined;
|
|
435
|
+
createdAfter?: string | undefined;
|
|
436
|
+
} | undefined;
|
|
329
437
|
};
|
|
330
438
|
}, {
|
|
331
439
|
body: {
|
|
332
|
-
|
|
440
|
+
update?: {
|
|
441
|
+
status?: string | undefined;
|
|
442
|
+
devicePaymentPlanId?: string | null | undefined;
|
|
443
|
+
dedicatedUser?: string | undefined;
|
|
444
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
445
|
+
activatedAt?: string | null | undefined;
|
|
446
|
+
} | undefined;
|
|
447
|
+
batchSize?: number | undefined;
|
|
448
|
+
maxRetries?: number | undefined;
|
|
449
|
+
condition?: {
|
|
450
|
+
status?: string | string[] | undefined;
|
|
451
|
+
productId?: string | string[] | undefined;
|
|
452
|
+
dedicatedUser?: string | string[] | undefined;
|
|
453
|
+
isPermanentlyUnlocked?: boolean | undefined;
|
|
454
|
+
excludeStatus?: string | string[] | undefined;
|
|
455
|
+
pairId?: string | string[] | undefined;
|
|
456
|
+
excludePairIds?: string | string[] | undefined;
|
|
457
|
+
createdBefore?: string | undefined;
|
|
458
|
+
createdAfter?: string | undefined;
|
|
459
|
+
} | undefined;
|
|
333
460
|
};
|
|
334
461
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.customDeviceResetSchema = exports.triggerDeviceResetSchema = exports.checkAvailabilitySchema = exports.makeDevicesPermanentSchema = exports.enableDevicesSchema = exports.disableDevicesSchema = exports.unlockDevicesSchema = exports.lockDevicesSchema = exports.permanentDeleteDevicesByPairsSchema = exports.deleteDevicesByPairsSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.createDevicePairsSchema = exports.deduplicatePairIds = exports.PAIR_ID_REGEX = void 0;
|
|
4
4
|
// src/validations/device.validations.ts
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const vr_models_1 = require("vr-models");
|
|
@@ -144,7 +144,7 @@ exports.checkAvailabilitySchema = zod_1.z.object({
|
|
|
144
144
|
}),
|
|
145
145
|
});
|
|
146
146
|
// ======================== CRON JOB RELATED VALIDATIONS ===========================
|
|
147
|
-
exports.
|
|
147
|
+
exports.triggerDeviceResetSchema = zod_1.z.object({
|
|
148
148
|
body: zod_1.z
|
|
149
149
|
.object({
|
|
150
150
|
batchSize: zod_1.z
|
|
@@ -162,11 +162,41 @@ exports.triggerDeviceLockSchema = zod_1.z.object({
|
|
|
162
162
|
})
|
|
163
163
|
.optional(),
|
|
164
164
|
});
|
|
165
|
-
exports.
|
|
165
|
+
exports.customDeviceResetSchema = zod_1.z.object({
|
|
166
166
|
body: zod_1.z.object({
|
|
167
|
-
|
|
168
|
-
.
|
|
169
|
-
.
|
|
170
|
-
.
|
|
167
|
+
condition: zod_1.z
|
|
168
|
+
.object({
|
|
169
|
+
status: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
170
|
+
excludeStatus: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
171
|
+
isPermanentlyUnlocked: zod_1.z.boolean().optional(),
|
|
172
|
+
pairId: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
173
|
+
excludePairIds: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
174
|
+
productId: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
175
|
+
dedicatedUser: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
176
|
+
createdBefore: zod_1.z.string().datetime().optional(),
|
|
177
|
+
createdAfter: zod_1.z.string().datetime().optional(),
|
|
178
|
+
})
|
|
179
|
+
.optional(),
|
|
180
|
+
update: zod_1.z
|
|
181
|
+
.object({
|
|
182
|
+
status: zod_1.z.string().optional(),
|
|
183
|
+
isPermanentlyUnlocked: zod_1.z.boolean().optional(),
|
|
184
|
+
dedicatedUser: zod_1.z.string().optional(),
|
|
185
|
+
devicePaymentPlanId: zod_1.z.string().nullable().optional(),
|
|
186
|
+
activatedAt: zod_1.z.string().datetime().nullable().optional(),
|
|
187
|
+
})
|
|
188
|
+
.optional(),
|
|
189
|
+
batchSize: zod_1.z
|
|
190
|
+
.number()
|
|
191
|
+
.int()
|
|
192
|
+
.min(1, "Batch size must be at least 1")
|
|
193
|
+
.max(500, "Batch size cannot exceed 500")
|
|
194
|
+
.optional(),
|
|
195
|
+
maxRetries: zod_1.z
|
|
196
|
+
.number()
|
|
197
|
+
.int()
|
|
198
|
+
.min(1, "Max retries must be at least 1")
|
|
199
|
+
.max(5, "Max retries cannot exceed 5")
|
|
200
|
+
.optional(),
|
|
171
201
|
}),
|
|
172
202
|
});
|
|
@@ -10,6 +10,6 @@ export { updateProfileSchema, requestPhoneChangeSchema, verifyPhoneChangeSchema,
|
|
|
10
10
|
export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema, } from "./users.admin.validations";
|
|
11
11
|
export { createProductSchema, updateProductSchema, getProductSchema, getProductsSchema, deactivateProductSchema, activateProductSchema, deleteProductSchema, updateStockSchema, } from "./product.validations";
|
|
12
12
|
export { createPricingSchema, updatePricingSchema, getPricingSchema, getPricingsSchema, deletePricingSchema, } from "./pricings.validations";
|
|
13
|
-
export { checkAvailabilitySchema, createDevicePairsSchema, lockDevicesSchema, unlockDevicesSchema, deleteDevicesByPairsSchema, makeDevicesPermanentSchema, permanentDeleteDevicesByPairsSchema, disableDevicesSchema, enableDevicesSchema, getDeviceSchema, getDevicesSchema,
|
|
13
|
+
export { checkAvailabilitySchema, createDevicePairsSchema, lockDevicesSchema, unlockDevicesSchema, deleteDevicesByPairsSchema, makeDevicesPermanentSchema, permanentDeleteDevicesByPairsSchema, disableDevicesSchema, enableDevicesSchema, getDeviceSchema, getDevicesSchema, triggerDeviceResetSchema, customDeviceResetSchema, } from "./admin.devices.validations";
|
|
14
14
|
export { createPlanSchema, limitedUpdateSchema, getDevicePlanSchema, getPlanSchema, getUserPlansSchema, listPlansSchema, recordPaymentSchema, deletePlanSchema, } from "./admin.devicePayment.validations";
|
|
15
15
|
export { listEventLogsSchema, getEventLogSchema, } from "./eventlogs.admin.validations";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.exportBansSchema = exports.createSuspensionSchema = exports.createBanSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.getUserBansSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.deactivateAccountSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.googleLoginSchema = exports.completePassengerProfileSchema = exports.checkRiderAccountSchema = exports.setRiderPasswordSchema = exports.riderPasswordRegex = exports.passwordRegex = exports.emailRegex = exports.phoneRegex = exports.requestOtpSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
4
4
|
exports.getDeviceSchema = exports.enableDevicesSchema = exports.disableDevicesSchema = exports.permanentDeleteDevicesByPairsSchema = exports.makeDevicesPermanentSchema = exports.deleteDevicesByPairsSchema = exports.unlockDevicesSchema = exports.lockDevicesSchema = exports.createDevicePairsSchema = exports.checkAvailabilitySchema = exports.deletePricingSchema = exports.getPricingsSchema = exports.getPricingSchema = exports.updatePricingSchema = exports.createPricingSchema = exports.updateStockSchema = exports.deleteProductSchema = exports.activateProductSchema = exports.deactivateProductSchema = exports.getProductsSchema = exports.getProductSchema = exports.updateProductSchema = exports.createProductSchema = exports.resetPasswordSchema = exports.upgradeToRiderSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.updateAdminSchema = exports.registerRiderSchema = exports.riderPasswordSchema = exports.changePasswordSchema = exports.strongPasswordRegex = exports.deleteAccountSchema = exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = exports.getInstallmentsSchema = exports.getInstallmentByIdSchema = exports.payInstallmentSchema = exports.serialRegex = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = void 0;
|
|
5
|
-
exports.getEventLogSchema = exports.listEventLogsSchema = exports.deletePlanSchema = exports.recordPaymentSchema = exports.listPlansSchema = exports.getUserPlansSchema = exports.getPlanSchema = exports.getDevicePlanSchema = exports.limitedUpdateSchema = exports.createPlanSchema = exports.
|
|
5
|
+
exports.getEventLogSchema = exports.listEventLogsSchema = exports.deletePlanSchema = exports.recordPaymentSchema = exports.listPlansSchema = exports.getUserPlansSchema = exports.getPlanSchema = exports.getDevicePlanSchema = exports.limitedUpdateSchema = exports.createPlanSchema = exports.customDeviceResetSchema = exports.triggerDeviceResetSchema = exports.getDevicesSchema = void 0;
|
|
6
6
|
var validate_validations_1 = require("./validate.validations");
|
|
7
7
|
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
|
|
8
8
|
var auth_validations_1 = require("./auth.validations");
|
|
@@ -125,8 +125,8 @@ Object.defineProperty(exports, "disableDevicesSchema", { enumerable: true, get:
|
|
|
125
125
|
Object.defineProperty(exports, "enableDevicesSchema", { enumerable: true, get: function () { return admin_devices_validations_1.enableDevicesSchema; } });
|
|
126
126
|
Object.defineProperty(exports, "getDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.getDeviceSchema; } });
|
|
127
127
|
Object.defineProperty(exports, "getDevicesSchema", { enumerable: true, get: function () { return admin_devices_validations_1.getDevicesSchema; } });
|
|
128
|
-
Object.defineProperty(exports, "
|
|
129
|
-
Object.defineProperty(exports, "
|
|
128
|
+
Object.defineProperty(exports, "triggerDeviceResetSchema", { enumerable: true, get: function () { return admin_devices_validations_1.triggerDeviceResetSchema; } });
|
|
129
|
+
Object.defineProperty(exports, "customDeviceResetSchema", { enumerable: true, get: function () { return admin_devices_validations_1.customDeviceResetSchema; } });
|
|
130
130
|
var admin_devicePayment_validations_1 = require("./admin.devicePayment.validations");
|
|
131
131
|
Object.defineProperty(exports, "createPlanSchema", { enumerable: true, get: function () { return admin_devicePayment_validations_1.createPlanSchema; } });
|
|
132
132
|
Object.defineProperty(exports, "limitedUpdateSchema", { enumerable: true, get: function () { return admin_devicePayment_validations_1.limitedUpdateSchema; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vr-commons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.162",
|
|
4
4
|
"description": "Shared functions package",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"rimraf": "^5.0.5",
|
|
104
104
|
"streamifier": "^0.1.1",
|
|
105
105
|
"typescript": "^5.3.3",
|
|
106
|
-
"vr-models": "^1.0.
|
|
106
|
+
"vr-models": "^1.0.84",
|
|
107
107
|
"zod": "^3.25.20"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|