@catlabtech/mycal-core 0.1.2 → 0.1.3

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/index.d.ts CHANGED
@@ -1,892 +1,14 @@
1
- import { z } from 'zod';
2
-
3
- interface LocalizedString {
4
- readonly ms: string;
5
- readonly en: string;
6
- readonly zh?: string;
7
- }
8
- type HolidayType = "federal" | "state" | "islamic" | "islamic_state" | "replacement" | "adhoc";
9
- type HolidayCategory = "public" | "bank" | "optional" | "half_day" | "observance";
10
- type HolidayStatus = "confirmed" | "tentative" | "announced" | "cancelled";
11
- type GazetteLevel = "P" | "N";
12
- type HolidaySource = "jpm" | "jakim" | "state-gov" | "community" | "admin";
13
- interface Holiday {
14
- readonly id: string;
15
- readonly date: string;
16
- readonly endDate?: string;
17
- readonly name: LocalizedString;
18
- readonly type: HolidayType;
19
- readonly status: HolidayStatus;
20
- readonly states: readonly string[];
21
- readonly isPublicHoliday: boolean;
22
- readonly gazetteLevel: GazetteLevel;
23
- readonly isReplacementFor?: string;
24
- readonly hijriDate?: string;
25
- readonly gazetteRef?: string;
26
- readonly source: HolidaySource;
27
- readonly category?: HolidayCategory;
28
- readonly isEstimated?: boolean;
29
- readonly confirmedAt?: string;
30
- readonly createdAt: string;
31
- readonly updatedAt: string;
32
- }
33
- type StateGroup = "A" | "B";
34
- interface WeekendConfig {
35
- readonly from: string;
36
- readonly to: string | null;
37
- readonly weekendDays: readonly number[];
38
- readonly group: StateGroup;
39
- }
40
- type StateType = "state" | "federal_territory";
41
- interface State {
42
- readonly code: string;
43
- readonly aliases: readonly string[];
44
- readonly name: LocalizedString;
45
- readonly type: StateType;
46
- readonly weekendHistory: readonly WeekendConfig[];
47
- readonly group: StateGroup;
48
- readonly isoCode?: string;
49
- }
50
- interface SchoolTermSegment {
51
- readonly startDate: string;
52
- readonly endDate: string;
53
- readonly schoolDays: number;
54
- }
55
- interface SchoolTerm {
56
- readonly id: string;
57
- readonly year: number;
58
- readonly term: 1 | 2;
59
- readonly group: StateGroup;
60
- readonly segments: readonly SchoolTermSegment[];
61
- readonly totalSchoolDays: number;
62
- readonly startDate: string;
63
- readonly endDate: string;
64
- }
65
- type SchoolHolidayType = "cuti_penggal_1" | "cuti_pertengahan" | "cuti_penggal_2" | "cuti_akhir" | "cuti_perayaan_kpm";
66
- interface SchoolHoliday {
67
- readonly id: string;
68
- readonly year: number;
69
- readonly group: StateGroup;
70
- readonly type: SchoolHolidayType;
71
- readonly name: LocalizedString;
72
- readonly startDate: string;
73
- readonly endDate: string;
74
- readonly days: number;
75
- readonly states?: readonly string[];
76
- readonly excludeStates?: readonly string[];
77
- readonly remarks?: string;
78
- }
79
- type ExamType = "spm" | "stpm" | "muet" | "pt3" | "stam" | "other";
80
- type ExamSource = "kpm" | "mpm";
81
- interface Exam {
82
- readonly id: string;
83
- readonly year: number;
84
- readonly name: string;
85
- readonly fullName: LocalizedString;
86
- readonly type: ExamType;
87
- readonly startDate: string;
88
- readonly endDate?: string;
89
- readonly status: "confirmed" | "tentative";
90
- readonly resultsDate?: string;
91
- readonly source: ExamSource;
92
- }
93
- interface CheckDateResult {
94
- readonly date: string;
95
- readonly dayOfWeek: string;
96
- readonly isHoliday: boolean;
97
- readonly isWeekend: boolean;
98
- readonly isWorkingDay: boolean;
99
- readonly isSchoolDay: boolean;
100
- readonly holidays: readonly Holiday[];
101
- readonly school: {
102
- readonly group: StateGroup;
103
- readonly term: SchoolTerm | null;
104
- readonly holiday: SchoolHoliday | null;
105
- } | null;
106
- readonly state: {
107
- readonly code: string;
108
- readonly weekendDays: readonly string[];
109
- readonly group: StateGroup;
110
- };
111
- }
112
- interface BusinessDaysResult {
113
- readonly totalDays: number;
114
- readonly businessDays: number;
115
- readonly holidays: number;
116
- readonly weekendDays: number;
117
- readonly holidayList: readonly Holiday[];
118
- }
119
- interface LongWeekend {
120
- readonly startDate: string;
121
- readonly endDate: string;
122
- readonly totalDays: number;
123
- readonly holidays: readonly Holiday[];
124
- readonly weekendDays: number;
125
- readonly bridgeDaysNeeded: number;
126
- }
127
- interface LeaveSuggestion {
128
- readonly startDate: string;
129
- readonly endDate: string;
130
- readonly totalDays: number;
131
- readonly leaveDates: readonly string[];
132
- readonly leaveCost: number;
133
- readonly efficiency: number;
134
- readonly holidays: readonly Holiday[];
135
- }
136
- interface ChangelogEntry {
137
- readonly timestamp: string;
138
- readonly event: string;
139
- readonly holidayId?: string;
140
- readonly examId?: string;
141
- readonly description: string;
142
- readonly changes?: Record<string, {
143
- from: unknown;
144
- to: unknown;
145
- }>;
146
- }
147
-
148
- declare const holidayCategorySchema: z.ZodEnum<["public", "bank", "optional", "half_day", "observance"]>;
149
- declare const holidaySchema: z.ZodObject<{
150
- id: z.ZodString;
151
- date: z.ZodString;
152
- endDate: z.ZodOptional<z.ZodString>;
153
- name: z.ZodObject<{
154
- ms: z.ZodString;
155
- en: z.ZodString;
156
- zh: z.ZodOptional<z.ZodString>;
157
- }, "strip", z.ZodTypeAny, {
158
- ms: string;
159
- en: string;
160
- zh?: string | undefined;
161
- }, {
162
- ms: string;
163
- en: string;
164
- zh?: string | undefined;
165
- }>;
166
- type: z.ZodEnum<["federal", "state", "islamic", "islamic_state", "replacement", "adhoc"]>;
167
- status: z.ZodEnum<["confirmed", "tentative", "announced", "cancelled"]>;
168
- states: z.ZodArray<z.ZodString, "many">;
169
- isPublicHoliday: z.ZodBoolean;
170
- gazetteLevel: z.ZodEnum<["P", "N"]>;
171
- isReplacementFor: z.ZodOptional<z.ZodString>;
172
- hijriDate: z.ZodOptional<z.ZodString>;
173
- gazetteRef: z.ZodOptional<z.ZodString>;
174
- source: z.ZodEnum<["jpm", "jakim", "state-gov", "community", "admin"]>;
175
- category: z.ZodOptional<z.ZodEnum<["public", "bank", "optional", "half_day", "observance"]>>;
176
- isEstimated: z.ZodOptional<z.ZodBoolean>;
177
- confirmedAt: z.ZodOptional<z.ZodString>;
178
- createdAt: z.ZodString;
179
- updatedAt: z.ZodString;
180
- }, "strip", z.ZodTypeAny, {
181
- type: "federal" | "state" | "islamic" | "islamic_state" | "replacement" | "adhoc";
182
- status: "confirmed" | "tentative" | "announced" | "cancelled";
183
- id: string;
184
- date: string;
185
- name: {
186
- ms: string;
187
- en: string;
188
- zh?: string | undefined;
189
- };
190
- states: string[];
191
- isPublicHoliday: boolean;
192
- gazetteLevel: "P" | "N";
193
- source: "jpm" | "jakim" | "state-gov" | "community" | "admin";
194
- createdAt: string;
195
- updatedAt: string;
196
- endDate?: string | undefined;
197
- isReplacementFor?: string | undefined;
198
- hijriDate?: string | undefined;
199
- gazetteRef?: string | undefined;
200
- category?: "public" | "bank" | "optional" | "half_day" | "observance" | undefined;
201
- isEstimated?: boolean | undefined;
202
- confirmedAt?: string | undefined;
203
- }, {
204
- type: "federal" | "state" | "islamic" | "islamic_state" | "replacement" | "adhoc";
205
- status: "confirmed" | "tentative" | "announced" | "cancelled";
206
- id: string;
207
- date: string;
208
- name: {
209
- ms: string;
210
- en: string;
211
- zh?: string | undefined;
212
- };
213
- states: string[];
214
- isPublicHoliday: boolean;
215
- gazetteLevel: "P" | "N";
216
- source: "jpm" | "jakim" | "state-gov" | "community" | "admin";
217
- createdAt: string;
218
- updatedAt: string;
219
- endDate?: string | undefined;
220
- isReplacementFor?: string | undefined;
221
- hijriDate?: string | undefined;
222
- gazetteRef?: string | undefined;
223
- category?: "public" | "bank" | "optional" | "half_day" | "observance" | undefined;
224
- isEstimated?: boolean | undefined;
225
- confirmedAt?: string | undefined;
226
- }>;
227
- declare const holidayFileSchema: z.ZodArray<z.ZodObject<{
228
- id: z.ZodString;
229
- date: z.ZodString;
230
- endDate: z.ZodOptional<z.ZodString>;
231
- name: z.ZodObject<{
232
- ms: z.ZodString;
233
- en: z.ZodString;
234
- zh: z.ZodOptional<z.ZodString>;
235
- }, "strip", z.ZodTypeAny, {
236
- ms: string;
237
- en: string;
238
- zh?: string | undefined;
239
- }, {
240
- ms: string;
241
- en: string;
242
- zh?: string | undefined;
243
- }>;
244
- type: z.ZodEnum<["federal", "state", "islamic", "islamic_state", "replacement", "adhoc"]>;
245
- status: z.ZodEnum<["confirmed", "tentative", "announced", "cancelled"]>;
246
- states: z.ZodArray<z.ZodString, "many">;
247
- isPublicHoliday: z.ZodBoolean;
248
- gazetteLevel: z.ZodEnum<["P", "N"]>;
249
- isReplacementFor: z.ZodOptional<z.ZodString>;
250
- hijriDate: z.ZodOptional<z.ZodString>;
251
- gazetteRef: z.ZodOptional<z.ZodString>;
252
- source: z.ZodEnum<["jpm", "jakim", "state-gov", "community", "admin"]>;
253
- category: z.ZodOptional<z.ZodEnum<["public", "bank", "optional", "half_day", "observance"]>>;
254
- isEstimated: z.ZodOptional<z.ZodBoolean>;
255
- confirmedAt: z.ZodOptional<z.ZodString>;
256
- createdAt: z.ZodString;
257
- updatedAt: z.ZodString;
258
- }, "strip", z.ZodTypeAny, {
259
- type: "federal" | "state" | "islamic" | "islamic_state" | "replacement" | "adhoc";
260
- status: "confirmed" | "tentative" | "announced" | "cancelled";
261
- id: string;
262
- date: string;
263
- name: {
264
- ms: string;
265
- en: string;
266
- zh?: string | undefined;
267
- };
268
- states: string[];
269
- isPublicHoliday: boolean;
270
- gazetteLevel: "P" | "N";
271
- source: "jpm" | "jakim" | "state-gov" | "community" | "admin";
272
- createdAt: string;
273
- updatedAt: string;
274
- endDate?: string | undefined;
275
- isReplacementFor?: string | undefined;
276
- hijriDate?: string | undefined;
277
- gazetteRef?: string | undefined;
278
- category?: "public" | "bank" | "optional" | "half_day" | "observance" | undefined;
279
- isEstimated?: boolean | undefined;
280
- confirmedAt?: string | undefined;
281
- }, {
282
- type: "federal" | "state" | "islamic" | "islamic_state" | "replacement" | "adhoc";
283
- status: "confirmed" | "tentative" | "announced" | "cancelled";
284
- id: string;
285
- date: string;
286
- name: {
287
- ms: string;
288
- en: string;
289
- zh?: string | undefined;
290
- };
291
- states: string[];
292
- isPublicHoliday: boolean;
293
- gazetteLevel: "P" | "N";
294
- source: "jpm" | "jakim" | "state-gov" | "community" | "admin";
295
- createdAt: string;
296
- updatedAt: string;
297
- endDate?: string | undefined;
298
- isReplacementFor?: string | undefined;
299
- hijriDate?: string | undefined;
300
- gazetteRef?: string | undefined;
301
- category?: "public" | "bank" | "optional" | "half_day" | "observance" | undefined;
302
- isEstimated?: boolean | undefined;
303
- confirmedAt?: string | undefined;
304
- }>, "many">;
305
- declare const stateSchema: z.ZodObject<{
306
- code: z.ZodString;
307
- aliases: z.ZodArray<z.ZodString, "many">;
308
- name: z.ZodObject<{
309
- ms: z.ZodString;
310
- en: z.ZodString;
311
- zh: z.ZodOptional<z.ZodString>;
312
- }, "strip", z.ZodTypeAny, {
313
- ms: string;
314
- en: string;
315
- zh?: string | undefined;
316
- }, {
317
- ms: string;
318
- en: string;
319
- zh?: string | undefined;
320
- }>;
321
- type: z.ZodEnum<["state", "federal_territory"]>;
322
- weekendHistory: z.ZodArray<z.ZodObject<{
323
- from: z.ZodString;
324
- to: z.ZodNullable<z.ZodString>;
325
- weekendDays: z.ZodArray<z.ZodNumber, "many">;
326
- group: z.ZodEnum<["A", "B"]>;
327
- }, "strip", z.ZodTypeAny, {
328
- from: string;
329
- to: string | null;
330
- weekendDays: number[];
331
- group: "A" | "B";
332
- }, {
333
- from: string;
334
- to: string | null;
335
- weekendDays: number[];
336
- group: "A" | "B";
337
- }>, "many">;
338
- group: z.ZodEnum<["A", "B"]>;
339
- isoCode: z.ZodOptional<z.ZodString>;
340
- }, "strip", z.ZodTypeAny, {
341
- code: string;
342
- type: "state" | "federal_territory";
343
- name: {
344
- ms: string;
345
- en: string;
346
- zh?: string | undefined;
347
- };
348
- group: "A" | "B";
349
- aliases: string[];
350
- weekendHistory: {
351
- from: string;
352
- to: string | null;
353
- weekendDays: number[];
354
- group: "A" | "B";
355
- }[];
356
- isoCode?: string | undefined;
357
- }, {
358
- code: string;
359
- type: "state" | "federal_territory";
360
- name: {
361
- ms: string;
362
- en: string;
363
- zh?: string | undefined;
364
- };
365
- group: "A" | "B";
366
- aliases: string[];
367
- weekendHistory: {
368
- from: string;
369
- to: string | null;
370
- weekendDays: number[];
371
- group: "A" | "B";
372
- }[];
373
- isoCode?: string | undefined;
374
- }>;
375
- declare const statesFileSchema: z.ZodArray<z.ZodObject<{
376
- code: z.ZodString;
377
- aliases: z.ZodArray<z.ZodString, "many">;
378
- name: z.ZodObject<{
379
- ms: z.ZodString;
380
- en: z.ZodString;
381
- zh: z.ZodOptional<z.ZodString>;
382
- }, "strip", z.ZodTypeAny, {
383
- ms: string;
384
- en: string;
385
- zh?: string | undefined;
386
- }, {
387
- ms: string;
388
- en: string;
389
- zh?: string | undefined;
390
- }>;
391
- type: z.ZodEnum<["state", "federal_territory"]>;
392
- weekendHistory: z.ZodArray<z.ZodObject<{
393
- from: z.ZodString;
394
- to: z.ZodNullable<z.ZodString>;
395
- weekendDays: z.ZodArray<z.ZodNumber, "many">;
396
- group: z.ZodEnum<["A", "B"]>;
397
- }, "strip", z.ZodTypeAny, {
398
- from: string;
399
- to: string | null;
400
- weekendDays: number[];
401
- group: "A" | "B";
402
- }, {
403
- from: string;
404
- to: string | null;
405
- weekendDays: number[];
406
- group: "A" | "B";
407
- }>, "many">;
408
- group: z.ZodEnum<["A", "B"]>;
409
- isoCode: z.ZodOptional<z.ZodString>;
410
- }, "strip", z.ZodTypeAny, {
411
- code: string;
412
- type: "state" | "federal_territory";
413
- name: {
414
- ms: string;
415
- en: string;
416
- zh?: string | undefined;
417
- };
418
- group: "A" | "B";
419
- aliases: string[];
420
- weekendHistory: {
421
- from: string;
422
- to: string | null;
423
- weekendDays: number[];
424
- group: "A" | "B";
425
- }[];
426
- isoCode?: string | undefined;
427
- }, {
428
- code: string;
429
- type: "state" | "federal_territory";
430
- name: {
431
- ms: string;
432
- en: string;
433
- zh?: string | undefined;
434
- };
435
- group: "A" | "B";
436
- aliases: string[];
437
- weekendHistory: {
438
- from: string;
439
- to: string | null;
440
- weekendDays: number[];
441
- group: "A" | "B";
442
- }[];
443
- isoCode?: string | undefined;
444
- }>, "many">;
445
- declare const schoolTermSchema: z.ZodObject<{
446
- id: z.ZodString;
447
- year: z.ZodNumber;
448
- term: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>]>;
449
- group: z.ZodEnum<["A", "B"]>;
450
- segments: z.ZodArray<z.ZodObject<{
451
- startDate: z.ZodString;
452
- endDate: z.ZodString;
453
- schoolDays: z.ZodNumber;
454
- }, "strip", z.ZodTypeAny, {
455
- endDate: string;
456
- startDate: string;
457
- schoolDays: number;
458
- }, {
459
- endDate: string;
460
- startDate: string;
461
- schoolDays: number;
462
- }>, "many">;
463
- totalSchoolDays: z.ZodNumber;
464
- startDate: z.ZodString;
465
- endDate: z.ZodString;
466
- }, "strip", z.ZodTypeAny, {
467
- id: string;
468
- endDate: string;
469
- group: "A" | "B";
470
- startDate: string;
471
- year: number;
472
- term: 1 | 2;
473
- segments: {
474
- endDate: string;
475
- startDate: string;
476
- schoolDays: number;
477
- }[];
478
- totalSchoolDays: number;
479
- }, {
480
- id: string;
481
- endDate: string;
482
- group: "A" | "B";
483
- startDate: string;
484
- year: number;
485
- term: 1 | 2;
486
- segments: {
487
- endDate: string;
488
- startDate: string;
489
- schoolDays: number;
490
- }[];
491
- totalSchoolDays: number;
492
- }>;
493
- declare const schoolHolidaySchema: z.ZodObject<{
494
- id: z.ZodString;
495
- year: z.ZodNumber;
496
- group: z.ZodEnum<["A", "B"]>;
497
- type: z.ZodEnum<["cuti_penggal_1", "cuti_pertengahan", "cuti_penggal_2", "cuti_akhir", "cuti_perayaan_kpm"]>;
498
- name: z.ZodObject<{
499
- ms: z.ZodString;
500
- en: z.ZodString;
501
- zh: z.ZodOptional<z.ZodString>;
502
- }, "strip", z.ZodTypeAny, {
503
- ms: string;
504
- en: string;
505
- zh?: string | undefined;
506
- }, {
507
- ms: string;
508
- en: string;
509
- zh?: string | undefined;
510
- }>;
511
- startDate: z.ZodString;
512
- endDate: z.ZodString;
513
- days: z.ZodNumber;
514
- states: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
515
- excludeStates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
516
- remarks: z.ZodOptional<z.ZodString>;
517
- }, "strip", z.ZodTypeAny, {
518
- type: "cuti_penggal_1" | "cuti_pertengahan" | "cuti_penggal_2" | "cuti_akhir" | "cuti_perayaan_kpm";
519
- id: string;
520
- endDate: string;
521
- name: {
522
- ms: string;
523
- en: string;
524
- zh?: string | undefined;
525
- };
526
- group: "A" | "B";
527
- startDate: string;
528
- year: number;
529
- days: number;
530
- states?: string[] | undefined;
531
- excludeStates?: string[] | undefined;
532
- remarks?: string | undefined;
533
- }, {
534
- type: "cuti_penggal_1" | "cuti_pertengahan" | "cuti_penggal_2" | "cuti_akhir" | "cuti_perayaan_kpm";
535
- id: string;
536
- endDate: string;
537
- name: {
538
- ms: string;
539
- en: string;
540
- zh?: string | undefined;
541
- };
542
- group: "A" | "B";
543
- startDate: string;
544
- year: number;
545
- days: number;
546
- states?: string[] | undefined;
547
- excludeStates?: string[] | undefined;
548
- remarks?: string | undefined;
549
- }>;
550
- declare const schoolTermsFileSchema: z.ZodArray<z.ZodObject<{
551
- id: z.ZodString;
552
- year: z.ZodNumber;
553
- term: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>]>;
554
- group: z.ZodEnum<["A", "B"]>;
555
- segments: z.ZodArray<z.ZodObject<{
556
- startDate: z.ZodString;
557
- endDate: z.ZodString;
558
- schoolDays: z.ZodNumber;
559
- }, "strip", z.ZodTypeAny, {
560
- endDate: string;
561
- startDate: string;
562
- schoolDays: number;
563
- }, {
564
- endDate: string;
565
- startDate: string;
566
- schoolDays: number;
567
- }>, "many">;
568
- totalSchoolDays: z.ZodNumber;
569
- startDate: z.ZodString;
570
- endDate: z.ZodString;
571
- }, "strip", z.ZodTypeAny, {
572
- id: string;
573
- endDate: string;
574
- group: "A" | "B";
575
- startDate: string;
576
- year: number;
577
- term: 1 | 2;
578
- segments: {
579
- endDate: string;
580
- startDate: string;
581
- schoolDays: number;
582
- }[];
583
- totalSchoolDays: number;
584
- }, {
585
- id: string;
586
- endDate: string;
587
- group: "A" | "B";
588
- startDate: string;
589
- year: number;
590
- term: 1 | 2;
591
- segments: {
592
- endDate: string;
593
- startDate: string;
594
- schoolDays: number;
595
- }[];
596
- totalSchoolDays: number;
597
- }>, "many">;
598
- declare const schoolHolidaysFileSchema: z.ZodArray<z.ZodObject<{
599
- id: z.ZodString;
600
- year: z.ZodNumber;
601
- group: z.ZodEnum<["A", "B"]>;
602
- type: z.ZodEnum<["cuti_penggal_1", "cuti_pertengahan", "cuti_penggal_2", "cuti_akhir", "cuti_perayaan_kpm"]>;
603
- name: z.ZodObject<{
604
- ms: z.ZodString;
605
- en: z.ZodString;
606
- zh: z.ZodOptional<z.ZodString>;
607
- }, "strip", z.ZodTypeAny, {
608
- ms: string;
609
- en: string;
610
- zh?: string | undefined;
611
- }, {
612
- ms: string;
613
- en: string;
614
- zh?: string | undefined;
615
- }>;
616
- startDate: z.ZodString;
617
- endDate: z.ZodString;
618
- days: z.ZodNumber;
619
- states: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
620
- excludeStates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
621
- remarks: z.ZodOptional<z.ZodString>;
622
- }, "strip", z.ZodTypeAny, {
623
- type: "cuti_penggal_1" | "cuti_pertengahan" | "cuti_penggal_2" | "cuti_akhir" | "cuti_perayaan_kpm";
624
- id: string;
625
- endDate: string;
626
- name: {
627
- ms: string;
628
- en: string;
629
- zh?: string | undefined;
630
- };
631
- group: "A" | "B";
632
- startDate: string;
633
- year: number;
634
- days: number;
635
- states?: string[] | undefined;
636
- excludeStates?: string[] | undefined;
637
- remarks?: string | undefined;
638
- }, {
639
- type: "cuti_penggal_1" | "cuti_pertengahan" | "cuti_penggal_2" | "cuti_akhir" | "cuti_perayaan_kpm";
640
- id: string;
641
- endDate: string;
642
- name: {
643
- ms: string;
644
- en: string;
645
- zh?: string | undefined;
646
- };
647
- group: "A" | "B";
648
- startDate: string;
649
- year: number;
650
- days: number;
651
- states?: string[] | undefined;
652
- excludeStates?: string[] | undefined;
653
- remarks?: string | undefined;
654
- }>, "many">;
655
- declare const examSchema: z.ZodObject<{
656
- id: z.ZodString;
657
- year: z.ZodNumber;
658
- name: z.ZodString;
659
- fullName: z.ZodObject<{
660
- ms: z.ZodString;
661
- en: z.ZodString;
662
- zh: z.ZodOptional<z.ZodString>;
663
- }, "strip", z.ZodTypeAny, {
664
- ms: string;
665
- en: string;
666
- zh?: string | undefined;
667
- }, {
668
- ms: string;
669
- en: string;
670
- zh?: string | undefined;
671
- }>;
672
- type: z.ZodEnum<["spm", "stpm", "muet", "pt3", "stam", "other"]>;
673
- startDate: z.ZodString;
674
- endDate: z.ZodOptional<z.ZodString>;
675
- status: z.ZodEnum<["confirmed", "tentative"]>;
676
- resultsDate: z.ZodOptional<z.ZodString>;
677
- source: z.ZodEnum<["kpm", "mpm"]>;
678
- }, "strip", z.ZodTypeAny, {
679
- type: "spm" | "stpm" | "muet" | "pt3" | "stam" | "other";
680
- status: "confirmed" | "tentative";
681
- id: string;
682
- name: string;
683
- source: "kpm" | "mpm";
684
- startDate: string;
685
- year: number;
686
- fullName: {
687
- ms: string;
688
- en: string;
689
- zh?: string | undefined;
690
- };
691
- endDate?: string | undefined;
692
- resultsDate?: string | undefined;
693
- }, {
694
- type: "spm" | "stpm" | "muet" | "pt3" | "stam" | "other";
695
- status: "confirmed" | "tentative";
696
- id: string;
697
- name: string;
698
- source: "kpm" | "mpm";
699
- startDate: string;
700
- year: number;
701
- fullName: {
702
- ms: string;
703
- en: string;
704
- zh?: string | undefined;
705
- };
706
- endDate?: string | undefined;
707
- resultsDate?: string | undefined;
708
- }>;
709
- declare const examsFileSchema: z.ZodArray<z.ZodObject<{
710
- id: z.ZodString;
711
- year: z.ZodNumber;
712
- name: z.ZodString;
713
- fullName: z.ZodObject<{
714
- ms: z.ZodString;
715
- en: z.ZodString;
716
- zh: z.ZodOptional<z.ZodString>;
717
- }, "strip", z.ZodTypeAny, {
718
- ms: string;
719
- en: string;
720
- zh?: string | undefined;
721
- }, {
722
- ms: string;
723
- en: string;
724
- zh?: string | undefined;
725
- }>;
726
- type: z.ZodEnum<["spm", "stpm", "muet", "pt3", "stam", "other"]>;
727
- startDate: z.ZodString;
728
- endDate: z.ZodOptional<z.ZodString>;
729
- status: z.ZodEnum<["confirmed", "tentative"]>;
730
- resultsDate: z.ZodOptional<z.ZodString>;
731
- source: z.ZodEnum<["kpm", "mpm"]>;
732
- }, "strip", z.ZodTypeAny, {
733
- type: "spm" | "stpm" | "muet" | "pt3" | "stam" | "other";
734
- status: "confirmed" | "tentative";
735
- id: string;
736
- name: string;
737
- source: "kpm" | "mpm";
738
- startDate: string;
739
- year: number;
740
- fullName: {
741
- ms: string;
742
- en: string;
743
- zh?: string | undefined;
744
- };
745
- endDate?: string | undefined;
746
- resultsDate?: string | undefined;
747
- }, {
748
- type: "spm" | "stpm" | "muet" | "pt3" | "stam" | "other";
749
- status: "confirmed" | "tentative";
750
- id: string;
751
- name: string;
752
- source: "kpm" | "mpm";
753
- startDate: string;
754
- year: number;
755
- fullName: {
756
- ms: string;
757
- en: string;
758
- zh?: string | undefined;
759
- };
760
- endDate?: string | undefined;
761
- resultsDate?: string | undefined;
762
- }>, "many">;
763
-
764
- declare function resolveStateCode(query: string, states: readonly State[]): State | null;
765
- declare function getStateByCode(code: string, states: readonly State[]): State | null;
766
- declare function getStatesByGroup(group: "A" | "B", states: readonly State[]): readonly State[];
767
-
768
- declare function getWeekendConfig(state: State, date: string): WeekendConfig;
769
- declare function isWeekend(date: string, state: State): boolean;
770
- declare function getDayOfWeekName(date: string): string;
771
- declare function getWeekendDayNames(state: State, date: string): readonly string[];
772
- declare function addDays(date: string, days: number): string;
773
- declare function nextWorkingDay(date: string, state: State, holidayDates: ReadonlySet<string>): string;
774
- declare function diffDays(start: string, end: string): number;
775
-
776
- interface HolidayFilter {
777
- readonly year?: number;
778
- readonly month?: number;
779
- readonly state?: string;
780
- readonly type?: HolidayType;
781
- readonly status?: HolidayStatus;
782
- }
783
- declare function filterHolidays(holidays: readonly Holiday[], filter: HolidayFilter): readonly Holiday[];
784
- declare function findHolidaysByDate(date: string, holidays: readonly Holiday[], stateCode?: string): readonly Holiday[];
785
- /**
786
- * Index holidays by their ISO date for O(1) date lookups, skipping cancelled
787
- * holidays and (when `stateCode` is given) holidays that do not apply to that
788
- * state. Shared by the business-day and long-weekend scanners so they don't each
789
- * re-filter the array on every day.
790
- */
791
- declare function groupHolidaysByDate(holidays: readonly Holiday[], stateCode?: string): Map<string, Holiday[]>;
792
- declare function findNextHoliday(afterDate: string, holidays: readonly Holiday[], stateCode?: string, type?: HolidayType, limit?: number): readonly Holiday[];
793
-
794
- declare function calculateReplacementHolidays(holidays: readonly Holiday[], state: State): readonly Holiday[];
795
-
796
- declare function countBusinessDays(start: string, end: string, state: State, holidays: readonly Holiday[]): BusinessDaysResult;
797
- declare function addBusinessDays(startDate: string, daysToAdd: number, state: State, holidays: readonly Holiday[]): string;
798
- declare function subtractBusinessDays(startDate: string, daysToSubtract: number, state: State, holidays: readonly Holiday[]): string;
799
- declare function isBusinessDay(date: string, state: State, holidays: readonly Holiday[]): boolean;
800
- declare function nextBusinessDay(date: string, state: State, holidays: readonly Holiday[]): string;
801
- declare function previousBusinessDay(date: string, state: State, holidays: readonly Holiday[]): string;
802
-
803
- /**
804
- * Natural long weekends for a state in a given year: runs of 3+ consecutive
805
- * non-working days (weekend days and/or public holidays) that need no leave.
806
- *
807
- * Shared by the REST `/holidays/long-weekends` route and the MCP server so the
808
- * two cannot diverge.
809
- */
810
- declare function findLongWeekends(year: number, state: State, holidays: readonly Holiday[]): LongWeekend[];
811
- /**
812
- * Leave optimizer: where can you spend up to `maxLeave` working days to chain
813
- * weekends and public holidays into the longest possible continuous break?
814
- *
815
- * Returns suggestions sorted by efficiency (days off gained per leave day spent),
816
- * then by total length. Each suggestion's `leaveDates` are the exact working days
817
- * to request off — e.g. "take 2026-09-14 & 2026-09-15 → 2026-09-12…2026-09-16".
818
- */
819
- declare function optimizeLeave(year: number, state: State, holidays: readonly Holiday[], maxLeave?: number): LeaveSuggestion[];
820
-
821
- /**
822
- * Input-validation and request-safety helpers shared by the API layer. Kept here
823
- * (pure, dependency-free) so they are unit-testable and reusable by any consumer.
824
- */
825
- /** True only for a real calendar date in strict `YYYY-MM-DD` form (rejects 2026-02-30). */
826
- declare function isValidISODate(value: string): boolean;
827
- /**
828
- * Constant-time string comparison for secrets (API keys). Returns early only on
829
- * a length mismatch; otherwise compares every byte so timing does not leak how
830
- * many leading characters matched.
831
- */
832
- declare function timingSafeEqualString(a: string, b: string): boolean;
833
- /**
834
- * SSRF guard for user-supplied callback/webhook URLs. Requires HTTPS and rejects
835
- * obviously-internal targets (localhost, *.local/.internal, and private/loopback/
836
- * link-local/reserved IP literals incl. the 169.254.169.254 cloud-metadata IP).
837
- *
838
- * Best-effort at registration time: DNS is NOT resolved here, so delivery code
839
- * MUST re-validate the resolved IP to defend against DNS rebinding.
840
- */
841
- declare function isSafePublicHttpsUrl(raw: string): boolean;
842
-
843
- declare function findSchoolTermByDate(date: string, terms: readonly SchoolTerm[], group: StateGroup): SchoolTerm | null;
844
- declare function findSchoolHolidayByDate(date: string, holidays: readonly SchoolHoliday[], group: StateGroup, stateCode?: string): SchoolHoliday | null;
845
- /**
846
- * List the school holidays that apply to a group (and optionally a specific
847
- * state, honouring `states`/`excludeStates` overrides). Shared by the REST
848
- * `/school/holidays` and iCal feed routes so the filter logic lives in one place.
849
- */
850
- declare function filterSchoolHolidays(holidays: readonly SchoolHoliday[], group: StateGroup, stateCode?: string): readonly SchoolHoliday[];
851
- declare function isSchoolDay(date: string, terms: readonly SchoolTerm[], schoolHolidays: readonly SchoolHoliday[], group: StateGroup, isPublicHoliday: boolean, isWeekendDay: boolean, stateCode?: string): boolean;
852
-
853
- declare function generateIcal(holidays: readonly Holiday[], schoolHolidays: readonly SchoolHoliday[], calendarName: string, calendarDescription?: string): string;
854
-
855
- /**
856
- * Basic Hijri date utilities.
857
- *
858
- * Note: Hijri dates for Islamic holidays are approximate until confirmed
859
- * by JAKIM rukyah (moon sighting). This module provides reference mapping
860
- * only — actual dates should come from the gazette/JAKIM confirmation.
861
- */
862
- interface HijriMonth {
863
- readonly number: number;
864
- readonly nameMs: string;
865
- readonly nameEn: string;
866
- readonly nameAr: string;
867
- }
868
- declare const HIJRI_MONTHS: readonly HijriMonth[];
869
- /**
870
- * Parse a hijri date string like "1 Syawal 1447" → { day, month, year }
871
- */
872
- declare function parseHijriDate(hijriStr: string): {
873
- day: number;
874
- month: HijriMonth;
875
- year: number;
876
- } | null;
877
- /**
878
- * Format a hijri date for display: "1 Syawal 1447"
879
- */
880
- declare function formatHijriDate(day: number, monthNumber: number, year: number): string;
881
- /**
882
- * Key Islamic holidays and their Hijri dates (fixed in the Islamic calendar).
883
- * Gregorian dates shift ~11 days earlier each year.
884
- */
885
- declare const ISLAMIC_HOLIDAY_DATES: readonly {
886
- readonly nameMs: string;
887
- readonly nameEn: string;
888
- readonly hijriMonth: number;
889
- readonly hijriDay: number;
890
- }[];
891
-
892
- export { type BusinessDaysResult, type ChangelogEntry, type CheckDateResult, type Exam, type ExamSource, type ExamType, type GazetteLevel, HIJRI_MONTHS, type HijriMonth, type Holiday, type HolidayCategory, type HolidayFilter, type HolidaySource, type HolidayStatus, type HolidayType, ISLAMIC_HOLIDAY_DATES, type LeaveSuggestion, type LocalizedString, type LongWeekend, type SchoolHoliday, type SchoolHolidayType, type SchoolTerm, type SchoolTermSegment, type State, type StateGroup, type StateType, type WeekendConfig, addBusinessDays, addDays, calculateReplacementHolidays, countBusinessDays, diffDays, examSchema, examsFileSchema, filterHolidays, filterSchoolHolidays, findHolidaysByDate, findLongWeekends, findNextHoliday, findSchoolHolidayByDate, findSchoolTermByDate, formatHijriDate, generateIcal, getDayOfWeekName, getStateByCode, getStatesByGroup, getWeekendConfig, getWeekendDayNames, groupHolidaysByDate, holidayCategorySchema, holidayFileSchema, holidaySchema, isBusinessDay, isSafePublicHttpsUrl, isSchoolDay, isValidISODate, isWeekend, nextBusinessDay, nextWorkingDay, optimizeLeave, parseHijriDate, previousBusinessDay, resolveStateCode, schoolHolidaySchema, schoolHolidaysFileSchema, schoolTermSchema, schoolTermsFileSchema, stateSchema, statesFileSchema, subtractBusinessDays, timingSafeEqualString };
1
+ export type { LocalizedString, Holiday, HolidayType, HolidayCategory, HolidayStatus, HolidaySource, GazetteLevel, State, StateGroup, StateType, WeekendConfig, SchoolTerm, SchoolTermSegment, SchoolHoliday, SchoolHolidayType, Exam, ExamType, ExamSource, CheckDateResult, BusinessDaysResult, LongWeekend, LeaveSuggestion, ChangelogEntry, } from "./types.js";
2
+ export { holidaySchema, holidayCategorySchema, holidayFileSchema, stateSchema, statesFileSchema, schoolTermSchema, schoolTermsFileSchema, schoolHolidaySchema, schoolHolidaysFileSchema, examSchema, examsFileSchema, } from "./schemas.js";
3
+ export { resolveStateCode, getStateByCode, getStatesByGroup, } from "./state-resolver.js";
4
+ export { getWeekendConfig, isWeekend, getDayOfWeekName, getWeekendDayNames, addDays, nextWorkingDay, diffDays, } from "./weekend.js";
5
+ export { filterHolidays, findHolidaysByDate, findNextHoliday, groupHolidaysByDate, } from "./filter.js";
6
+ export type { HolidayFilter } from "./filter.js";
7
+ export { calculateReplacementHolidays } from "./replacement.js";
8
+ export { countBusinessDays, addBusinessDays, subtractBusinessDays, isBusinessDay, nextBusinessDay, previousBusinessDay, } from "./business-days.js";
9
+ export { findLongWeekends, optimizeLeave } from "./long-weekend.js";
10
+ export { isValidISODate, timingSafeEqualString, isSafePublicHttpsUrl, } from "./validation.js";
11
+ export { findSchoolTermByDate, findSchoolHolidayByDate, filterSchoolHolidays, isSchoolDay, } from "./school.js";
12
+ export { generateIcal } from "./ical.js";
13
+ export { HIJRI_MONTHS, ISLAMIC_HOLIDAY_DATES, parseHijriDate, formatHijriDate, } from "./hijri.js";
14
+ export type { HijriMonth } from "./hijri.js";