vr-commons 1.0.153 → 1.0.155

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,33 +2,28 @@ import { z } from "zod";
2
2
  export declare const createPlanSchema: z.ZodObject<{
3
3
  body: z.ZodObject<{
4
4
  userId: z.ZodString;
5
- deviceIds: z.ZodArray<z.ZodString, "many">;
6
5
  pricingId: z.ZodString;
7
6
  productId: z.ZodString;
8
7
  }, "strip", z.ZodTypeAny, {
9
- productId: string;
10
8
  userId: string;
11
- deviceIds: string[];
12
9
  pricingId: string;
13
- }, {
14
10
  productId: string;
11
+ }, {
15
12
  userId: string;
16
- deviceIds: string[];
17
13
  pricingId: string;
14
+ productId: string;
18
15
  }>;
19
16
  }, "strip", z.ZodTypeAny, {
20
17
  body: {
21
- productId: string;
22
18
  userId: string;
23
- deviceIds: string[];
24
19
  pricingId: string;
20
+ productId: string;
25
21
  };
26
22
  }, {
27
23
  body: {
28
- productId: string;
29
24
  userId: string;
30
- deviceIds: string[];
31
25
  pricingId: string;
26
+ productId: string;
32
27
  };
33
28
  }>;
34
29
  export declare const listPlansSchema: z.ZodObject<{
@@ -45,47 +40,47 @@ export declare const listPlansSchema: z.ZodObject<{
45
40
  }, "strip", z.ZodTypeAny, {
46
41
  page: number;
47
42
  limit: number;
48
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
49
- search?: string | undefined;
50
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
51
- sortOrder?: "ASC" | "DESC" | undefined;
43
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
52
44
  userId?: string | undefined;
53
- isOverdue?: "true" | "false" | undefined;
54
45
  deviceId?: string | undefined;
46
+ isOverdue?: "true" | "false" | undefined;
47
+ search?: string | undefined;
48
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
49
+ sortOrder?: "ASC" | "DESC" | undefined;
55
50
  }, {
56
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
51
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
52
+ userId?: string | undefined;
57
53
  page?: string | undefined;
58
54
  limit?: string | undefined;
55
+ deviceId?: string | undefined;
56
+ isOverdue?: "true" | "false" | undefined;
59
57
  search?: string | undefined;
60
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
58
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
61
59
  sortOrder?: "ASC" | "DESC" | undefined;
62
- userId?: string | undefined;
63
- isOverdue?: "true" | "false" | undefined;
64
- deviceId?: string | undefined;
65
60
  }>;
66
61
  }, "strip", z.ZodTypeAny, {
67
62
  query: {
68
63
  page: number;
69
64
  limit: number;
70
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
71
- search?: string | undefined;
72
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
73
- sortOrder?: "ASC" | "DESC" | undefined;
65
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
74
66
  userId?: string | undefined;
75
- isOverdue?: "true" | "false" | undefined;
76
67
  deviceId?: string | undefined;
68
+ isOverdue?: "true" | "false" | undefined;
69
+ search?: string | undefined;
70
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
71
+ sortOrder?: "ASC" | "DESC" | undefined;
77
72
  };
78
73
  }, {
79
74
  query: {
80
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
75
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
76
+ userId?: string | undefined;
81
77
  page?: string | undefined;
82
78
  limit?: string | undefined;
79
+ deviceId?: string | undefined;
80
+ isOverdue?: "true" | "false" | undefined;
83
81
  search?: string | undefined;
84
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
82
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
85
83
  sortOrder?: "ASC" | "DESC" | undefined;
86
- userId?: string | undefined;
87
- isOverdue?: "true" | "false" | undefined;
88
- deviceId?: string | undefined;
89
84
  };
90
85
  }>;
91
86
  export declare const getPlanSchema: z.ZodObject<{
@@ -117,10 +112,10 @@ export declare const getUserPlansSchema: z.ZodObject<{
117
112
  status: z.ZodOptional<z.ZodEnum<["PENDING", "ACTIVE", "COMPLETED", "DEFAULTED", "CANCELLED"]>>;
118
113
  includeCompleted: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
119
114
  }, "strip", z.ZodTypeAny, {
120
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
115
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
121
116
  includeCompleted?: "true" | "false" | undefined;
122
117
  }, {
123
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
118
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
124
119
  includeCompleted?: "true" | "false" | undefined;
125
120
  }>>;
126
121
  }, "strip", z.ZodTypeAny, {
@@ -128,7 +123,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
128
123
  userId: string;
129
124
  };
130
125
  query?: {
131
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
126
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
132
127
  includeCompleted?: "true" | "false" | undefined;
133
128
  } | undefined;
134
129
  }, {
@@ -136,7 +131,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
136
131
  userId: string;
137
132
  };
138
133
  query?: {
139
- status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
134
+ status?: "PENDING" | "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
140
135
  includeCompleted?: "true" | "false" | undefined;
141
136
  } | undefined;
142
137
  }>;
@@ -168,48 +163,41 @@ export declare const limitedUpdateSchema: z.ZodObject<{
168
163
  body: z.ZodEffects<z.ZodObject<{
169
164
  pricingId: z.ZodOptional<z.ZodString>;
170
165
  productId: z.ZodOptional<z.ZodString>;
171
- deviceIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
172
166
  userId: z.ZodOptional<z.ZodString>;
173
167
  }, "strip", z.ZodTypeAny, {
174
- productId?: string | undefined;
175
168
  userId?: string | undefined;
176
- deviceIds?: string[] | undefined;
177
169
  pricingId?: string | undefined;
178
- }, {
179
170
  productId?: string | undefined;
171
+ }, {
180
172
  userId?: string | undefined;
181
- deviceIds?: string[] | undefined;
182
173
  pricingId?: string | undefined;
183
- }>, {
184
174
  productId?: string | undefined;
175
+ }>, {
185
176
  userId?: string | undefined;
186
- deviceIds?: string[] | undefined;
187
177
  pricingId?: string | undefined;
188
- }, {
189
178
  productId?: string | undefined;
179
+ }, {
190
180
  userId?: string | undefined;
191
- deviceIds?: string[] | undefined;
192
181
  pricingId?: string | undefined;
182
+ productId?: string | undefined;
193
183
  }>;
194
184
  }, "strip", z.ZodTypeAny, {
195
185
  params: {
196
186
  id: string;
197
187
  };
198
188
  body: {
199
- productId?: string | undefined;
200
189
  userId?: string | undefined;
201
- deviceIds?: string[] | undefined;
202
190
  pricingId?: string | undefined;
191
+ productId?: string | undefined;
203
192
  };
204
193
  }, {
205
194
  params: {
206
195
  id: string;
207
196
  };
208
197
  body: {
209
- productId?: string | undefined;
210
198
  userId?: string | undefined;
211
- deviceIds?: string[] | undefined;
212
199
  pricingId?: string | undefined;
200
+ productId?: string | undefined;
213
201
  };
214
202
  }>;
215
203
  export declare const recordPaymentSchema: z.ZodObject<{
@@ -231,19 +219,19 @@ export declare const recordPaymentSchema: z.ZodObject<{
231
219
  }, "strip", z.ZodTypeAny, {
232
220
  amount: number;
233
221
  provider: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY";
234
- metadata?: Record<string, any> | undefined;
235
222
  providerReference?: string | undefined;
236
223
  customerPhone?: string | undefined;
237
224
  customerName?: string | undefined;
238
225
  notes?: string | undefined;
226
+ metadata?: Record<string, any> | undefined;
239
227
  }, {
240
228
  amount: number;
241
- metadata?: Record<string, any> | undefined;
242
229
  provider?: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | undefined;
243
230
  providerReference?: string | undefined;
244
231
  customerPhone?: string | undefined;
245
232
  customerName?: string | undefined;
246
233
  notes?: string | undefined;
234
+ metadata?: Record<string, any> | undefined;
247
235
  }>;
248
236
  }, "strip", z.ZodTypeAny, {
249
237
  params: {
@@ -252,11 +240,11 @@ export declare const recordPaymentSchema: z.ZodObject<{
252
240
  body: {
253
241
  amount: number;
254
242
  provider: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY";
255
- metadata?: Record<string, any> | undefined;
256
243
  providerReference?: string | undefined;
257
244
  customerPhone?: string | undefined;
258
245
  customerName?: string | undefined;
259
246
  notes?: string | undefined;
247
+ metadata?: Record<string, any> | undefined;
260
248
  };
261
249
  }, {
262
250
  params: {
@@ -264,12 +252,12 @@ export declare const recordPaymentSchema: z.ZodObject<{
264
252
  };
265
253
  body: {
266
254
  amount: number;
267
- metadata?: Record<string, any> | undefined;
268
255
  provider?: "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | undefined;
269
256
  providerReference?: string | undefined;
270
257
  customerPhone?: string | undefined;
271
258
  customerName?: string | undefined;
272
259
  notes?: string | undefined;
260
+ metadata?: Record<string, any> | undefined;
273
261
  };
274
262
  }>;
275
263
  export declare const deletePlanSchema: z.ZodObject<{
@@ -7,10 +7,6 @@ const vr_models_1 = require("vr-models");
7
7
  exports.createPlanSchema = zod_1.z.object({
8
8
  body: zod_1.z.object({
9
9
  userId: zod_1.z.string().uuid("Invalid user ID"),
10
- deviceIds: zod_1.z
11
- .array(zod_1.z.string().uuid("Invalid device ID"))
12
- .min(1, "At least one device required")
13
- .max(10, "Maximum 10 devices per plan"),
14
10
  pricingId: zod_1.z.string().uuid("Invalid pricing ID"),
15
11
  productId: zod_1.z.string().uuid("Invalid product ID"),
16
12
  }),
@@ -69,11 +65,6 @@ exports.limitedUpdateSchema = zod_1.z.object({
69
65
  // All fields are optional - can update any combination
70
66
  pricingId: zod_1.z.string().uuid("Invalid pricing ID").optional(),
71
67
  productId: zod_1.z.string().uuid("Invalid product ID").optional(),
72
- deviceIds: zod_1.z
73
- .array(zod_1.z.string().uuid("Invalid device ID"))
74
- .min(1, "At least one device required")
75
- .max(10, "Maximum 10 devices per plan")
76
- .optional(),
77
68
  userId: zod_1.z.string().uuid("Invalid user ID").optional(),
78
69
  })
79
70
  .refine((data) => Object.keys(data).length > 0, {
@@ -255,31 +255,25 @@ export declare const enableDevicesSchema: z.ZodObject<{
255
255
  };
256
256
  }>;
257
257
  export declare const makeDevicesPermanentSchema: z.ZodObject<{
258
- body: z.ZodEffects<z.ZodObject<{
259
- pairIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
260
- 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>;
261
261
  }, "strip", z.ZodTypeAny, {
262
- pairIds?: string[] | undefined;
263
- serialNumbers?: string[] | undefined;
264
- }, {
265
- pairIds?: string[] | undefined;
266
- serialNumbers?: string[] | undefined;
267
- }>, {
268
- pairIds?: string[] | undefined;
269
- serialNumbers?: string[] | undefined;
262
+ pairIds: string[];
263
+ reason?: string | undefined;
270
264
  }, {
271
- pairIds?: string[] | undefined;
272
- serialNumbers?: string[] | undefined;
265
+ pairIds: string[];
266
+ reason?: string | undefined;
273
267
  }>;
274
268
  }, "strip", z.ZodTypeAny, {
275
269
  body: {
276
- pairIds?: string[] | undefined;
277
- serialNumbers?: string[] | undefined;
270
+ pairIds: string[];
271
+ reason?: string | undefined;
278
272
  };
279
273
  }, {
280
274
  body: {
281
- pairIds?: string[] | undefined;
282
- serialNumbers?: string[] | undefined;
275
+ pairIds: string[];
276
+ reason?: string | undefined;
283
277
  };
284
278
  }>;
285
279
  export declare const checkAvailabilitySchema: z.ZodObject<{
@@ -130,13 +130,11 @@ exports.enableDevicesSchema = zod_1.z.object({
130
130
  });
131
131
  // Make permanent schema
132
132
  exports.makeDevicesPermanentSchema = zod_1.z.object({
133
- body: zod_1.z.object(flexibleIdentifiersSchema).refine((data) => {
134
- const hasPairIds = data.pairIds && data.pairIds.length > 0;
135
- const hasSerialNumbers = data.serialNumbers && data.serialNumbers.length > 0;
136
- return ((hasPairIds || hasSerialNumbers) && !(hasPairIds && hasSerialNumbers));
137
- }, {
138
- message: "Either pairIds or serialNumbers must be provided, but not both",
139
- 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(),
140
138
  }),
141
139
  });
142
140
  // Check availability schema (for assignment flow)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-commons",
3
- "version": "1.0.153",
3
+ "version": "1.0.155",
4
4
  "description": "Shared functions package",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",