@nyig/models 0.2.10 → 0.2.12

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.
Files changed (5) hide show
  1. package/index.d.mts +1070 -421
  2. package/index.d.ts +1070 -421
  3. package/index.js +154 -144
  4. package/index.mjs +153 -144
  5. package/package.json +2 -1
package/index.mjs CHANGED
@@ -1,70 +1,56 @@
1
- // src/interface/booking/bUserInfo.ts
2
- import { z } from "zod";
3
- var zBUserInfo = z.object({
4
- firstName: z.string(),
5
- lastName: z.string(),
6
- rank: z.string(),
7
- email: z.string(),
8
- phone: z.string().optional(),
9
- address: z.string().optional(),
10
- notes: z.string().optional()
11
- });
12
-
13
- // src/interface/booking/privateBooking.ts
14
- import { z as z4 } from "zod";
15
-
16
- // src/mongoose.ts
17
- import { z as z2 } from "zod";
18
- function extendZodObjectForMongoose(original) {
19
- return original.extend({
20
- _id: z2.string(),
21
- createdAt: z2.coerce.date().optional(),
22
- updatedAt: z2.coerce.date().optional()
23
- });
24
- }
25
-
26
1
  // src/interface/booking/bPaymentInfo.ts
27
- import { z as z3 } from "zod";
28
- var zBPaymentInfo = z3.object({
2
+ import { z } from "zod";
3
+ var zBPaymentInfo = z.object({
29
4
  /**
30
5
  * @units CENTS - Proposed payment amount in cents of the booking
31
6
  */
32
- paymentAmount: z3.number().int().min(1),
7
+ paymentAmount: z.number().int().min(1),
33
8
  /**
34
9
  * True if the payment has been received. Populated by webhook.
35
10
  */
36
- paymentReceived: z3.boolean().optional(),
11
+ paymentReceived: z.boolean().optional(),
37
12
  /**
38
13
  * When Date is reached, document is deleted by MongoDB sweeper.
39
14
  * Creation typically marks one to two weeks.
40
15
  * After payment, webhook should extend this date to essentially infinite.
41
16
  */
42
- expireAt: z3.coerce.date().optional()
17
+ expireAt: z.coerce.date().optional()
43
18
  });
44
19
 
45
- // src/interface/booking/privateBooking.ts
46
- var zPrivateBooking = z4.object({
47
- userId: z4.string().optional(),
48
- courseId: z4.string(),
49
- teacherId: z4.string(),
50
- classDate: z4.string().optional()
51
- }).merge(zBUserInfo).merge(zBPaymentInfo);
52
- var zMPrivateBooking = extendZodObjectForMongoose(zPrivateBooking);
20
+ // src/interface/booking/bUserInfo.ts
21
+ import { z as z2 } from "zod";
22
+ var zBUserInfo = z2.object({
23
+ firstName: z2.string(),
24
+ lastName: z2.string(),
25
+ rank: z2.string(),
26
+ email: z2.string(),
27
+ phone: z2.string().optional(),
28
+ address: z2.string().optional(),
29
+ notes: z2.string().optional()
30
+ });
53
31
 
54
- // src/interface/booking/groupBooking.ts
55
- import { z as z5 } from "zod";
56
- var zGroupBooking = z5.object({
57
- userId: z5.string().optional(),
58
- gtId: z5.string().optional(),
59
- isTrial: z5.boolean().optional(),
60
- isOnline: z5.boolean(),
61
- classDate: z5.string().optional(),
62
- shipping: z5.boolean().optional()
63
- }).merge(zBUserInfo).merge(zBPaymentInfo);
64
- var zMGroupBooking = extendZodObjectForMongoose(zGroupBooking);
32
+ // src/interface/booking/bookingType.ts
33
+ var BookingType = /* @__PURE__ */ ((BookingType2) => {
34
+ BookingType2["GROUP"] = "group";
35
+ BookingType2["PRIVATE"] = "private";
36
+ BookingType2["TOURNAMENT"] = "tournament";
37
+ BookingType2["CAMP"] = "camp";
38
+ return BookingType2;
39
+ })(BookingType || {});
65
40
 
66
41
  // src/interface/booking/campBooking.ts
67
- import { z as z15 } from "zod";
42
+ import { z as z13 } from "zod";
43
+
44
+ // src/interface/mongoose/mongoose.ts
45
+ import { z as z3 } from "zod";
46
+ import { Types } from "mongoose";
47
+ function extendZodObjectForMongoose(original) {
48
+ return original.extend({
49
+ _id: z3.instanceof(Types.ObjectId),
50
+ createdAt: z3.coerce.date().optional(),
51
+ updatedAt: z3.coerce.date().optional()
52
+ });
53
+ }
68
54
 
69
55
  // src/interface/tracking/attendState.ts
70
56
  var AttendState = /* @__PURE__ */ ((AttendState2) => {
@@ -75,14 +61,14 @@ var AttendState = /* @__PURE__ */ ((AttendState2) => {
75
61
  })(AttendState || {});
76
62
 
77
63
  // src/interface/tracking/attendance.ts
78
- import { z as z7 } from "zod";
64
+ import { z as z5 } from "zod";
79
65
 
80
66
  // src/interface/payment/tuition.ts
81
- import { z as z6 } from "zod";
82
- var zTuition = z6.object({
83
- primary: z6.number().int().min(1),
84
- textbook: z6.boolean().optional(),
85
- shipping: z6.boolean().optional()
67
+ import { z as z4 } from "zod";
68
+ var zTuition = z4.object({
69
+ primary: z4.number().int().min(1),
70
+ textbook: z4.boolean().optional(),
71
+ shipping: z4.boolean().optional()
86
72
  });
87
73
 
88
74
  // src/interface/tracking/campOption.ts
@@ -94,47 +80,47 @@ var CampOption = /* @__PURE__ */ ((CampOption2) => {
94
80
  })(CampOption || {});
95
81
 
96
82
  // src/interface/tracking/attendance.ts
97
- var zAttendance = z7.object({
98
- student: z7.string(),
99
- states: z7.array(z7.nativeEnum(AttendState)),
83
+ var zAttendance = z5.object({
84
+ student: z5.string(),
85
+ states: z5.array(z5.nativeEnum(AttendState)),
100
86
  tuition: zTuition,
101
- paid: z7.boolean().optional(),
102
- campOption: z7.nativeEnum(CampOption)
87
+ paid: z5.boolean().optional(),
88
+ campOption: z5.nativeEnum(CampOption)
103
89
  });
104
90
  var zMAttendance = extendZodObjectForMongoose(zAttendance);
105
91
 
106
92
  // src/interface/tracking/campTracker.ts
107
- import { z as z8 } from "zod";
108
- var zCampTracker = z8.object({
93
+ import { z as z6 } from "zod";
94
+ var zCampTracker = z6.object({
109
95
  /**
110
96
  * Mongoose object ID
111
97
  */
112
- course: z8.string(),
98
+ course: z6.string(),
113
99
  /**
114
100
  * Mongoose object ID
115
101
  */
116
- teacher: z8.string(),
102
+ teacher: z6.string(),
117
103
  /**
118
104
  * Mongoose object ID
119
105
  */
120
- semester: z8.string(),
106
+ semester: z6.string(),
121
107
  /**
122
108
  * occurrences are tracked by week for camps
123
109
  */
124
- occurrences: z8.array(z8.string()),
110
+ occurrences: z6.array(z6.string()),
125
111
  /**
126
112
  * attendances are tracked by week for camps
127
113
  */
128
- attendances: z8.array(z8.string()),
129
- notes: z8.string().optional()
114
+ attendances: z6.array(z6.string()),
115
+ notes: z6.string().optional()
130
116
  });
131
117
  var zMCampTracker = extendZodObjectForMongoose(zCampTracker);
132
118
 
133
119
  // src/interface/tracking/classTracker.ts
134
- import { z as z11 } from "zod";
120
+ import { z as z9 } from "zod";
135
121
 
136
122
  // src/interface/payment/invoice.ts
137
- import { z as z9 } from "zod";
123
+ import { z as z7 } from "zod";
138
124
 
139
125
  // src/interface/payment/paymentMethod.ts
140
126
  var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
@@ -146,94 +132,94 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
146
132
  })(PaymentMethod || {});
147
133
 
148
134
  // src/interface/payment/invoice.ts
149
- var zDiscount = z9.object({
150
- desc: z9.string(),
151
- amount: z9.number()
135
+ var zDiscount = z7.object({
136
+ desc: z7.string(),
137
+ amount: z7.number()
152
138
  });
153
- var zInvoiceItem = z9.object({
139
+ var zInvoiceItem = z7.object({
154
140
  /**
155
141
  * Mongoose object ID
156
142
  */
157
- course: z9.string(),
158
- price: z9.number(),
159
- units: z9.number()
143
+ course: z7.string(),
144
+ price: z7.number(),
145
+ units: z7.number()
160
146
  });
161
- var zInvoicePackage = z9.object({
147
+ var zInvoicePackage = z7.object({
162
148
  /**
163
149
  * Mongoose object ID
164
150
  */
165
- student: z9.string(),
166
- items: z9.array(zInvoiceItem)
151
+ student: z7.string(),
152
+ items: z7.array(zInvoiceItem)
167
153
  });
168
- var zInvoice = z9.object({
169
- billTo: z9.string(),
170
- packages: z9.array(zInvoicePackage),
171
- discounts: z9.array(zDiscount),
172
- textbook: z9.number().int().min(1).optional(),
173
- shipping: z9.number().int().min(1).optional(),
174
- paid: z9.nativeEnum(PaymentMethod).optional(),
175
- notes: z9.string().optional(),
154
+ var zInvoice = z7.object({
155
+ billTo: z7.string(),
156
+ packages: z7.array(zInvoicePackage),
157
+ discounts: z7.array(zDiscount),
158
+ textbook: z7.number().int().min(1).optional(),
159
+ shipping: z7.number().int().min(1).optional(),
160
+ paid: z7.nativeEnum(PaymentMethod).optional(),
161
+ notes: z7.string().optional(),
176
162
  /**
177
163
  * Mongoose object ID
178
164
  */
179
- createdBy: z9.string(),
165
+ createdBy: z7.string(),
180
166
  /**
181
167
  * Mongoose object ID
182
168
  */
183
- lastEditBy: z9.string().optional()
169
+ lastEditBy: z7.string().optional()
184
170
  });
185
171
  var zMInvoice = extendZodObjectForMongoose(zInvoice);
186
172
 
187
173
  // src/interface/payment/teacherPayment.ts
188
- import { z as z10 } from "zod";
189
- var zTeacherPaymentRow = z10.object({
190
- course: z10.string(),
191
- length: z10.number(),
192
- count: z10.number(),
193
- wage: z10.number()
174
+ import { z as z8 } from "zod";
175
+ var zTeacherPaymentRow = z8.object({
176
+ course: z8.string(),
177
+ length: z8.number(),
178
+ count: z8.number(),
179
+ wage: z8.number()
194
180
  });
195
- var zTeacherPayment = z10.object({
196
- teacher: z10.string(),
197
- rows: z10.array(zTeacherPaymentRow),
198
- paid: z10.boolean().optional()
181
+ var zTeacherPayment = z8.object({
182
+ teacher: z8.string(),
183
+ rows: z8.array(zTeacherPaymentRow),
184
+ paid: z8.boolean().optional()
199
185
  });
200
186
  var zMTeacherPayment = extendZodObjectForMongoose(zTeacherPayment);
201
187
 
202
188
  // src/interface/tracking/classTracker.ts
203
- var zClassTracker = z11.object({
189
+ var zClassTracker = z9.object({
204
190
  /**
205
191
  * Mongoose object ID
206
192
  */
207
- course: z11.string(),
193
+ course: z9.string(),
208
194
  /**
209
195
  * Mongoose object ID
210
196
  */
211
- teacher: z11.string(),
197
+ teacher: z9.string(),
212
198
  /**
213
199
  * Mongoose object ID
214
200
  */
215
- semester: z11.string(),
216
- classTimes: z11.array(z11.coerce.date()),
217
- completedList: z11.array(z11.boolean()),
201
+ semester: z9.string(),
202
+ classTimes: z9.array(z9.coerce.date()),
203
+ completedList: z9.array(z9.boolean()),
218
204
  /**
219
205
  * Virtual mongoose field when all values in completedList is true
220
206
  */
221
- completed: z11.boolean().optional(),
207
+ completed: z9.boolean().optional(),
222
208
  tuition: zTuition.optional(),
223
- paid: z11.boolean().optional(),
224
- notes: z11.string().optional()
209
+ paid: z9.boolean().optional(),
210
+ notes: z9.string().optional()
225
211
  });
226
212
  var zMClassTracker = extendZodObjectForMongoose(zClassTracker);
227
213
 
228
214
  // src/interface/tracking/groupTracker.ts
229
- import { z as z14 } from "zod";
215
+ import { z as z12 } from "zod";
230
216
 
231
217
  // src/interface/tracking/scheduleData.ts
232
- import { z as z12 } from "zod";
233
- var zScheduleData = z12.object({
234
- startTime: z12.string(),
218
+ import { z as z10 } from "zod";
219
+ var zScheduleData = z10.object({
220
+ startTime: z10.string(),
235
221
  // String in 24 hour "HH:mm" format
236
- dayOfWeek: z12.number().int().min(0).max(6)
222
+ dayOfWeek: z10.number().int().min(0).max(6)
237
223
  // integeters in 0 - 6
238
224
  });
239
225
 
@@ -262,88 +248,110 @@ var NYIGSchool = /* @__PURE__ */ ((NYIGSchool2) => {
262
248
  })(NYIGSchool || {});
263
249
 
264
250
  // src/interface/course/course.ts
265
- import { z as z13 } from "zod";
266
- var zCourse = z13.object({
267
- name: z13.string(),
268
- category: z13.nativeEnum(CourseCategory),
251
+ import { z as z11 } from "zod";
252
+ var zCourse = z11.object({
253
+ name: z11.string(),
254
+ category: z11.nativeEnum(CourseCategory),
269
255
  /**
270
256
  * @unit SECONDS - Duration of the course in seconds
271
257
  */
272
- duration: z13.number(),
258
+ duration: z11.number(),
273
259
  /**
274
260
  * @unit CENTS - Price of the course in cents
275
261
  */
276
- price: z13.number(),
277
- description: z13.string().optional(),
262
+ price: z11.number(),
263
+ description: z11.string().optional(),
278
264
  /**
279
265
  * NYIG School locations
280
266
  */
281
- nyigSchool: z13.nativeEnum(NYIGSchool),
267
+ nyigSchool: z11.nativeEnum(NYIGSchool),
282
268
  /**
283
269
  * Recommended level before taking this course
284
270
  */
285
- recLevel: z13.string(),
271
+ recLevel: z11.string(),
286
272
  /**
287
273
  * Camp tuition for half-day option
288
274
  */
289
- halfCampTuition: z13.number(),
275
+ halfCampTuition: z11.number(),
290
276
  /**
291
277
  * Camp tuition for full-day option
292
278
  */
293
- fullCampTuition: z13.number()
279
+ fullCampTuition: z11.number()
294
280
  });
295
281
  var zMCourse = extendZodObjectForMongoose(zCourse);
296
282
 
297
283
  // src/interface/tracking/groupTracker.ts
298
- var zGroupTracker = z14.object({
284
+ var zGroupTracker = z12.object({
299
285
  /**
300
286
  * Mongoose object ID
301
287
  */
302
- course: z14.string(),
288
+ course: z12.string(),
303
289
  /**
304
290
  * Mongoose object ID
305
291
  */
306
- teacher: z14.string(),
292
+ teacher: z12.string(),
307
293
  /**
308
294
  * Mongoose object ID
309
295
  */
310
- semester: z14.string(),
296
+ semester: z12.string(),
311
297
  scheduleData: zScheduleData,
312
298
  /**
313
299
  * occurrences are tracked by week for Groups
314
300
  */
315
- occurrences: z14.array(z14.coerce.date()),
301
+ occurrences: z12.array(z12.coerce.date()),
316
302
  /**
317
303
  * attendances are tracked by week for Groups
318
304
  */
319
- attendances: z14.array(z14.string()),
305
+ attendances: z12.array(z12.string()),
320
306
  /**
321
307
  * ID of the course instance, e.g., 101
322
308
  */
323
- courseId: z14.string().optional(),
309
+ courseId: z12.string().optional(),
324
310
  /**
325
311
  * Age group of the class instance, e.g. "adult", "youth"
326
312
  */
327
- ageGroup: z14.nativeEnum(AgeGroup).optional(),
313
+ ageGroup: z12.nativeEnum(AgeGroup).optional(),
328
314
  /**
329
315
  * If true, the course is hidden from public view
330
316
  */
331
- isNonPublic: z14.boolean().optional(),
332
- notes: z14.string().optional()
317
+ isNonPublic: z12.boolean().optional(),
318
+ notes: z12.string().optional()
333
319
  });
334
320
  var zMGroupTracker = extendZodObjectForMongoose(zGroupTracker);
335
321
 
336
322
  // src/interface/booking/campBooking.ts
337
- var zCampBooking = z15.object({
338
- userId: z15.string().optional(),
339
- ctId: z15.string().optional(),
340
- isOnline: z15.boolean(),
341
- classDates: z15.string(),
342
- campOption: z15.nativeEnum(CampOption),
343
- shipping: z15.boolean().optional()
323
+ var zCampBooking = z13.object({
324
+ userId: z13.string().optional(),
325
+ ctId: z13.string().optional(),
326
+ isOnline: z13.boolean(),
327
+ classDates: z13.string(),
328
+ campOption: z13.nativeEnum(CampOption),
329
+ shipping: z13.boolean().optional()
344
330
  }).merge(zBUserInfo).merge(zBPaymentInfo);
345
331
  var zMCampBooking = extendZodObjectForMongoose(zCampBooking);
346
332
 
333
+ // src/interface/booking/groupBooking.ts
334
+ import { z as z14 } from "zod";
335
+ var zGroupBooking = z14.object({
336
+ userId: z14.string().optional(),
337
+ gtId: z14.string().optional(),
338
+ isTrial: z14.boolean().optional(),
339
+ isOnline: z14.boolean(),
340
+ classDate: z14.string().optional(),
341
+ shipping: z14.boolean().optional()
342
+ }).merge(zBUserInfo).merge(zBPaymentInfo);
343
+ var zMGroupBooking = extendZodObjectForMongoose(zGroupBooking);
344
+
345
+ // src/interface/booking/privateBooking.ts
346
+ import { z as z15 } from "zod";
347
+ var zPrivateBooking = z15.object({
348
+ userId: z15.string().optional(),
349
+ courseId: z15.string(),
350
+ teacherId: z15.string(),
351
+ classDate: z15.string().optional()
352
+ }).merge(zBUserInfo).merge(zBPaymentInfo);
353
+ var zMPrivateBooking = extendZodObjectForMongoose(zPrivateBooking);
354
+
347
355
  // src/interface/public/aurora.ts
348
356
  import { z as z16 } from "zod";
349
357
  var zTeacherDisplay = z16.object({
@@ -555,7 +563,7 @@ var zTTicket = z24.object({
555
563
  /**
556
564
  * @optional If date is provided and in the past, ticket cannot be purchased
557
565
  */
558
- lastBuytableDate: z24.coerce.date().optional()
566
+ lastBuyableDate: z24.coerce.date().optional()
559
567
  });
560
568
  var zMTTicket = extendZodObjectForMongoose(zTTicket);
561
569
 
@@ -668,6 +676,7 @@ var zMTeacher = extendZodObjectForMongoose(zTeacher);
668
676
  export {
669
677
  AgeGroup,
670
678
  AttendState,
679
+ BookingType,
671
680
  CampOption,
672
681
  CourseCategory,
673
682
  GoRank,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@nyig/models",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "license": "MIT",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
7
7
  "types": "index.d.ts",
8
8
  "peerDependencies": {
9
+ "mongoose": ">=8.0.0",
9
10
  "zod": ">=3.22.4"
10
11
  },
11
12
  "devDependencies": {