vr-commons 1.0.105 → 1.0.107

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.
@@ -4,26 +4,31 @@ export declare const createPlanSchema: z.ZodObject<{
4
4
  userId: z.ZodString;
5
5
  deviceIds: z.ZodArray<z.ZodString, "many">;
6
6
  pricingId: z.ZodString;
7
+ productId: z.ZodString;
7
8
  }, "strip", z.ZodTypeAny, {
8
9
  userId: string;
9
10
  deviceIds: string[];
10
11
  pricingId: string;
12
+ productId: string;
11
13
  }, {
12
14
  userId: string;
13
15
  deviceIds: string[];
14
16
  pricingId: string;
17
+ productId: string;
15
18
  }>;
16
19
  }, "strip", z.ZodTypeAny, {
17
20
  body: {
18
21
  userId: string;
19
22
  deviceIds: string[];
20
23
  pricingId: string;
24
+ productId: string;
21
25
  };
22
26
  }, {
23
27
  body: {
24
28
  userId: string;
25
29
  deviceIds: string[];
26
30
  pricingId: string;
31
+ productId: string;
27
32
  };
28
33
  }>;
29
34
  export declare const listPlansSchema: z.ZodObject<{
@@ -38,49 +43,49 @@ export declare const listPlansSchema: z.ZodObject<{
38
43
  sortBy: z.ZodOptional<z.ZodEnum<["createdAt", "updatedAt", "nextInstallmentDueAt", "paidAmount", "outstandingAmount"]>>;
39
44
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
40
45
  }, "strip", z.ZodTypeAny, {
41
- limit: number;
42
46
  page: number;
43
- search?: string | undefined;
47
+ limit: number;
48
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
44
49
  userId?: string | undefined;
45
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
46
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
47
- sortOrder?: "DESC" | "ASC" | undefined;
48
50
  deviceId?: string | undefined;
49
51
  isOverdue?: "true" | "false" | undefined;
50
- }, {
51
52
  search?: string | undefined;
52
- limit?: string | undefined;
53
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
54
+ sortOrder?: "ASC" | "DESC" | undefined;
55
+ }, {
56
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
53
57
  userId?: string | undefined;
54
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
55
58
  page?: string | undefined;
56
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
57
- sortOrder?: "DESC" | "ASC" | undefined;
59
+ limit?: string | undefined;
58
60
  deviceId?: string | undefined;
59
61
  isOverdue?: "true" | "false" | undefined;
62
+ search?: string | undefined;
63
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
64
+ sortOrder?: "ASC" | "DESC" | undefined;
60
65
  }>;
61
66
  }, "strip", z.ZodTypeAny, {
62
67
  query: {
63
- limit: number;
64
68
  page: number;
65
- search?: string | undefined;
69
+ limit: number;
70
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
66
71
  userId?: string | undefined;
67
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
68
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
69
- sortOrder?: "DESC" | "ASC" | undefined;
70
72
  deviceId?: string | undefined;
71
73
  isOverdue?: "true" | "false" | undefined;
74
+ search?: string | undefined;
75
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
76
+ sortOrder?: "ASC" | "DESC" | undefined;
72
77
  };
73
78
  }, {
74
79
  query: {
75
- search?: string | undefined;
76
- limit?: string | undefined;
80
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
77
81
  userId?: string | undefined;
78
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
79
82
  page?: string | undefined;
80
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
81
- sortOrder?: "DESC" | "ASC" | undefined;
83
+ limit?: string | undefined;
82
84
  deviceId?: string | undefined;
83
85
  isOverdue?: "true" | "false" | undefined;
86
+ search?: string | undefined;
87
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
88
+ sortOrder?: "ASC" | "DESC" | undefined;
84
89
  };
85
90
  }>;
86
91
  export declare const getPlanSchema: z.ZodObject<{
@@ -112,10 +117,10 @@ export declare const getUserPlansSchema: z.ZodObject<{
112
117
  status: z.ZodOptional<z.ZodEnum<["ACTIVE", "COMPLETED", "DEFAULTED", "CANCELLED"]>>;
113
118
  includeCompleted: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
114
119
  }, "strip", z.ZodTypeAny, {
115
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
120
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
116
121
  includeCompleted?: "true" | "false" | undefined;
117
122
  }, {
118
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
123
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
119
124
  includeCompleted?: "true" | "false" | undefined;
120
125
  }>>;
121
126
  }, "strip", z.ZodTypeAny, {
@@ -123,7 +128,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
123
128
  userId: string;
124
129
  };
125
130
  query?: {
126
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
131
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
127
132
  includeCompleted?: "true" | "false" | undefined;
128
133
  } | undefined;
129
134
  }, {
@@ -131,7 +136,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
131
136
  userId: string;
132
137
  };
133
138
  query?: {
134
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
139
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
135
140
  includeCompleted?: "true" | "false" | undefined;
136
141
  } | undefined;
137
142
  }>;
@@ -161,37 +166,51 @@ export declare const limitedUpdateSchema: z.ZodObject<{
161
166
  id: string;
162
167
  }>;
163
168
  body: z.ZodEffects<z.ZodObject<{
164
- pricingId: z.ZodOptional<z.ZodString>;
165
- userId: z.ZodOptional<z.ZodString>;
169
+ pricingId: z.ZodString;
170
+ productId: z.ZodString;
171
+ deviceIds: z.ZodArray<z.ZodString, "many">;
172
+ userId: z.ZodString;
166
173
  }, "strip", z.ZodTypeAny, {
167
- userId?: string | undefined;
168
- pricingId?: string | undefined;
174
+ userId: string;
175
+ deviceIds: string[];
176
+ pricingId: string;
177
+ productId: string;
169
178
  }, {
170
- userId?: string | undefined;
171
- pricingId?: string | undefined;
179
+ userId: string;
180
+ deviceIds: string[];
181
+ pricingId: string;
182
+ productId: string;
172
183
  }>, {
173
- userId?: string | undefined;
174
- pricingId?: string | undefined;
184
+ userId: string;
185
+ deviceIds: string[];
186
+ pricingId: string;
187
+ productId: string;
175
188
  }, {
176
- userId?: string | undefined;
177
- pricingId?: string | undefined;
189
+ userId: string;
190
+ deviceIds: string[];
191
+ pricingId: string;
192
+ productId: string;
178
193
  }>;
179
194
  }, "strip", z.ZodTypeAny, {
180
- body: {
181
- userId?: string | undefined;
182
- pricingId?: string | undefined;
183
- };
184
195
  params: {
185
196
  id: string;
186
197
  };
187
- }, {
188
198
  body: {
189
- userId?: string | undefined;
190
- pricingId?: string | undefined;
199
+ userId: string;
200
+ deviceIds: string[];
201
+ pricingId: string;
202
+ productId: string;
191
203
  };
204
+ }, {
192
205
  params: {
193
206
  id: string;
194
207
  };
208
+ body: {
209
+ userId: string;
210
+ deviceIds: string[];
211
+ pricingId: string;
212
+ productId: string;
213
+ };
195
214
  }>;
196
215
  export declare const recordPaymentSchema: z.ZodObject<{
197
216
  params: z.ZodObject<{
@@ -209,33 +228,33 @@ export declare const recordPaymentSchema: z.ZodObject<{
209
228
  }, "strip", z.ZodTypeAny, {
210
229
  amount: number;
211
230
  provider: "mtn_momo" | "airtel_money";
212
- metadata?: Record<string, any> | undefined;
213
231
  providerReference?: string | undefined;
232
+ metadata?: Record<string, any> | undefined;
214
233
  }, {
215
234
  amount: number;
216
235
  provider: "mtn_momo" | "airtel_money";
217
- metadata?: Record<string, any> | undefined;
218
236
  providerReference?: string | undefined;
237
+ metadata?: Record<string, any> | undefined;
219
238
  }>;
220
239
  }, "strip", z.ZodTypeAny, {
240
+ params: {
241
+ id: string;
242
+ };
221
243
  body: {
222
244
  amount: number;
223
245
  provider: "mtn_momo" | "airtel_money";
224
- metadata?: Record<string, any> | undefined;
225
246
  providerReference?: string | undefined;
247
+ metadata?: Record<string, any> | undefined;
226
248
  };
249
+ }, {
227
250
  params: {
228
251
  id: string;
229
252
  };
230
- }, {
231
253
  body: {
232
254
  amount: number;
233
255
  provider: "mtn_momo" | "airtel_money";
234
- metadata?: Record<string, any> | undefined;
235
256
  providerReference?: string | undefined;
236
- };
237
- params: {
238
- id: string;
257
+ metadata?: Record<string, any> | undefined;
239
258
  };
240
259
  }>;
241
260
  export declare const deletePlanSchema: z.ZodObject<{
@@ -12,6 +12,7 @@ exports.createPlanSchema = zod_1.z.object({
12
12
  .min(1, "At least one device required")
13
13
  .max(10, "Maximum 10 devices per plan"),
14
14
  pricingId: zod_1.z.string().uuid("Invalid pricing ID"),
15
+ productId: zod_1.z.string().uuid("Invalid product ID"),
15
16
  }),
16
17
  });
17
18
  // ==================== READ ====================
@@ -66,9 +67,14 @@ exports.limitedUpdateSchema = zod_1.z.object({
66
67
  body: zod_1.z
67
68
  .object({
68
69
  // Can update pricing before any payments
69
- pricingId: zod_1.z.string().uuid("Invalid pricing ID").optional(),
70
+ pricingId: zod_1.z.string().uuid("Invalid pricing ID"),
71
+ productId: zod_1.z.string().uuid("Invalid product ID"),
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"),
70
76
  // Can reassign to different user before any payments
71
- userId: zod_1.z.string().uuid("Invalid user ID").optional(),
77
+ userId: zod_1.z.string().uuid("Invalid user ID"),
72
78
  })
73
79
  .refine((data) => Object.keys(data).length > 0, {
74
80
  message: "At least one field to update is required",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-commons",
3
- "version": "1.0.105",
3
+ "version": "1.0.107",
4
4
  "description": "Shared functions package",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",