vr-commons 1.0.152 → 1.0.154

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.
@@ -211,66 +211,69 @@ export declare const unlockDevicesSchema: z.ZodObject<{
211
211
  };
212
212
  }>;
213
213
  export declare const disableDevicesSchema: z.ZodObject<{
214
- body: z.ZodEffects<z.ZodObject<{
215
- reason: z.ZodString;
216
- pairIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
217
- serialNumbers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
214
+ body: z.ZodObject<{
215
+ pairIds: z.ZodArray<z.ZodString, "many">;
216
+ reason: z.ZodOptional<z.ZodString>;
218
217
  }, "strip", z.ZodTypeAny, {
219
- reason: string;
220
- pairIds?: string[] | undefined;
221
- serialNumbers?: string[] | undefined;
218
+ pairIds: string[];
219
+ reason?: string | undefined;
222
220
  }, {
223
- reason: string;
224
- pairIds?: string[] | undefined;
225
- serialNumbers?: string[] | undefined;
226
- }>, {
227
- reason: string;
228
- pairIds?: string[] | undefined;
229
- serialNumbers?: string[] | undefined;
221
+ pairIds: string[];
222
+ reason?: string | undefined;
223
+ }>;
224
+ }, "strip", z.ZodTypeAny, {
225
+ body: {
226
+ pairIds: string[];
227
+ reason?: string | undefined;
228
+ };
229
+ }, {
230
+ body: {
231
+ pairIds: string[];
232
+ reason?: string | undefined;
233
+ };
234
+ }>;
235
+ export declare const enableDevicesSchema: z.ZodObject<{
236
+ body: z.ZodObject<{
237
+ pairIds: z.ZodArray<z.ZodString, "many">;
238
+ reason: z.ZodOptional<z.ZodString>;
239
+ }, "strip", z.ZodTypeAny, {
240
+ pairIds: string[];
241
+ reason?: string | undefined;
230
242
  }, {
231
- reason: string;
232
- pairIds?: string[] | undefined;
233
- serialNumbers?: string[] | undefined;
243
+ pairIds: string[];
244
+ reason?: string | undefined;
234
245
  }>;
235
246
  }, "strip", z.ZodTypeAny, {
236
247
  body: {
237
- reason: string;
238
- pairIds?: string[] | undefined;
239
- serialNumbers?: string[] | undefined;
248
+ pairIds: string[];
249
+ reason?: string | undefined;
240
250
  };
241
251
  }, {
242
252
  body: {
243
- reason: string;
244
- pairIds?: string[] | undefined;
245
- serialNumbers?: string[] | undefined;
253
+ pairIds: string[];
254
+ reason?: string | undefined;
246
255
  };
247
256
  }>;
248
257
  export declare const makeDevicesPermanentSchema: z.ZodObject<{
249
- body: z.ZodEffects<z.ZodObject<{
250
- pairIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
251
- serialNumbers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
258
+ body: z.ZodObject<{
259
+ pairIds: z.ZodArray<z.ZodString, "many">;
260
+ reason: z.ZodOptional<z.ZodString>;
252
261
  }, "strip", z.ZodTypeAny, {
253
- pairIds?: string[] | undefined;
254
- serialNumbers?: string[] | undefined;
255
- }, {
256
- pairIds?: string[] | undefined;
257
- serialNumbers?: string[] | undefined;
258
- }>, {
259
- pairIds?: string[] | undefined;
260
- serialNumbers?: string[] | undefined;
262
+ pairIds: string[];
263
+ reason?: string | undefined;
261
264
  }, {
262
- pairIds?: string[] | undefined;
263
- serialNumbers?: string[] | undefined;
265
+ pairIds: string[];
266
+ reason?: string | undefined;
264
267
  }>;
265
268
  }, "strip", z.ZodTypeAny, {
266
269
  body: {
267
- pairIds?: string[] | undefined;
268
- serialNumbers?: string[] | undefined;
270
+ pairIds: string[];
271
+ reason?: string | undefined;
269
272
  };
270
273
  }, {
271
274
  body: {
272
- pairIds?: string[] | undefined;
273
- serialNumbers?: string[] | undefined;
275
+ pairIds: string[];
276
+ reason?: string | undefined;
274
277
  };
275
278
  }>;
276
279
  export declare const checkAvailabilitySchema: z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkAvailabilitySchema = exports.makeDevicesPermanentSchema = exports.disableDevicesSchema = exports.unlockDevicesSchema = exports.lockDevicesSchema = exports.permanentDeleteDevicesByPairsSchema = exports.deleteDevicesByPairsSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.createDevicePairsSchema = exports.deduplicatePairIds = exports.PAIR_ID_REGEX = void 0;
3
+ 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");
@@ -110,31 +110,31 @@ exports.unlockDevicesSchema = zod_1.z.object({
110
110
  path: ["pairIds"],
111
111
  }),
112
112
  });
113
- // Disable devices schema
113
+ // ✅ Disable devices by pair IDs only
114
114
  exports.disableDevicesSchema = zod_1.z.object({
115
- body: zod_1.z
116
- .object({
117
- ...flexibleIdentifiersSchema,
118
- reason: zod_1.z.string().min(1, "Reason is required"),
119
- })
120
- .refine((data) => {
121
- const hasPairIds = data.pairIds && data.pairIds.length > 0;
122
- const hasSerialNumbers = data.serialNumbers && data.serialNumbers.length > 0;
123
- return ((hasPairIds || hasSerialNumbers) && !(hasPairIds && hasSerialNumbers));
124
- }, {
125
- message: "Either pairIds or serialNumbers must be provided, but not both",
126
- path: ["pairIds"],
115
+ body: zod_1.z.object({
116
+ pairIds: zod_1.z
117
+ .array(zod_1.z.string().regex(exports.PAIR_ID_REGEX, PAIR_ID_ERROR))
118
+ .min(1, "At least one pair ID required"),
119
+ reason: zod_1.z.string().optional(),
120
+ }),
121
+ });
122
+ // ✅ Enable devices by pair IDs only
123
+ exports.enableDevicesSchema = zod_1.z.object({
124
+ body: zod_1.z.object({
125
+ pairIds: zod_1.z
126
+ .array(zod_1.z.string().regex(exports.PAIR_ID_REGEX, PAIR_ID_ERROR))
127
+ .min(1, "At least one pair ID required"),
128
+ reason: zod_1.z.string().optional(),
127
129
  }),
128
130
  });
129
131
  // Make permanent schema
130
132
  exports.makeDevicesPermanentSchema = zod_1.z.object({
131
- body: zod_1.z.object(flexibleIdentifiersSchema).refine((data) => {
132
- const hasPairIds = data.pairIds && data.pairIds.length > 0;
133
- const hasSerialNumbers = data.serialNumbers && data.serialNumbers.length > 0;
134
- return ((hasPairIds || hasSerialNumbers) && !(hasPairIds && hasSerialNumbers));
135
- }, {
136
- message: "Either pairIds or serialNumbers must be provided, but not both",
137
- path: ["pairIds"],
133
+ body: zod_1.z.object({
134
+ pairIds: zod_1.z
135
+ .array(zod_1.z.string().regex(exports.PAIR_ID_REGEX, PAIR_ID_ERROR))
136
+ .min(1, "At least one pair ID required"),
137
+ reason: zod_1.z.string().optional(),
138
138
  }),
139
139
  });
140
140
  // Check availability schema (for assignment flow)
@@ -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, getDeviceSchema, getDevicesSchema, } from "./admin.devices.validations";
13
+ export { checkAvailabilitySchema, createDevicePairsSchema, lockDevicesSchema, unlockDevicesSchema, deleteDevicesByPairsSchema, makeDevicesPermanentSchema, permanentDeleteDevicesByPairsSchema, disableDevicesSchema, enableDevicesSchema, getDeviceSchema, getDevicesSchema, } 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";
@@ -1,8 +1,8 @@
1
1
  "use strict";
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
- exports.getDevicesSchema = exports.getDeviceSchema = 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 = void 0;
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.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");
@@ -122,6 +122,7 @@ Object.defineProperty(exports, "deleteDevicesByPairsSchema", { enumerable: true,
122
122
  Object.defineProperty(exports, "makeDevicesPermanentSchema", { enumerable: true, get: function () { return admin_devices_validations_1.makeDevicesPermanentSchema; } });
123
123
  Object.defineProperty(exports, "permanentDeleteDevicesByPairsSchema", { enumerable: true, get: function () { return admin_devices_validations_1.permanentDeleteDevicesByPairsSchema; } });
124
124
  Object.defineProperty(exports, "disableDevicesSchema", { enumerable: true, get: function () { return admin_devices_validations_1.disableDevicesSchema; } });
125
+ Object.defineProperty(exports, "enableDevicesSchema", { enumerable: true, get: function () { return admin_devices_validations_1.enableDevicesSchema; } });
125
126
  Object.defineProperty(exports, "getDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.getDeviceSchema; } });
126
127
  Object.defineProperty(exports, "getDevicesSchema", { enumerable: true, get: function () { return admin_devices_validations_1.getDevicesSchema; } });
127
128
  var admin_devicePayment_validations_1 = require("./admin.devicePayment.validations");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-commons",
3
- "version": "1.0.152",
3
+ "version": "1.0.154",
4
4
  "description": "Shared functions package",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",