cyc-type-def 1.0.3 → 2.1.0

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/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # Usage
2
+
3
+ Run these commands to use the package:
4
+
5
+ ```bash
6
+ npm run build
7
+ npm publish --access public
8
+ ```
9
+ ---
10
+ # TypeScript Package Setup Guide
11
+
12
+ This guide outlines how to set up a simple TypeScript package with build and test scripts.
13
+
14
+ ## 1. Initialize Your Package
15
+
16
+ ```bash
17
+ npm init -y
18
+ ```
19
+
20
+ ## 2. Install TypeScript and Essential Dependencies
21
+
22
+ ```bash
23
+ npm install typescript @types/node tsup --save-dev
24
+ ```
25
+
26
+ ## 3. Set Up TypeScript Configuration
27
+
28
+ ```bash
29
+ npx tsc --init
30
+ ```
31
+
32
+ ## 4. Create Package Structure
33
+
34
+ ```
35
+ my-ts-package/
36
+ ├── src/
37
+ │ ├── index.ts # Main exports
38
+ │ ├── utils.ts # Utility functions
39
+ │ └── types.ts # Type definitions
40
+ ├── test/ # Tests
41
+ ├── dist/ # Compiled output
42
+ ├── package.json
43
+ └── tsconfig.json
44
+ ```
45
+
46
+ ## 5. Example Package Code
47
+
48
+ ### `src/index.ts`
49
+
50
+ ```ts
51
+ export * from './utils';
52
+ export * from './types';
53
+ ```
54
+
55
+ ### `src/utils.ts`
56
+
57
+ ```ts
58
+ export function greet(name: string): string {
59
+ return `Hello, ${name}!`;
60
+ }
61
+
62
+ export function sum(a: number, b: number): number {
63
+ return a + b;
64
+ }
65
+ ```
66
+
67
+ ### `src/types.ts`
68
+
69
+ ```ts
70
+ export interface User {
71
+ id: string;
72
+ name: string;
73
+ email: string;
74
+ }
75
+ ```
76
+
77
+ ## 6. `package.json` Scripts
78
+
79
+ ```json
80
+ "scripts": {
81
+ "build": "tsup src/index.ts --format cjs,esm --dts",
82
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
83
+ "test": "jest",
84
+ "prepublishOnly": "npm run build"
85
+ }
86
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,573 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ AppUser: () => AppUser,
24
+ AssignedCG: () => AssignedCG,
25
+ AttSheep: () => AttSheep,
26
+ Attendance: () => Attendance,
27
+ BackupAttendance: () => BackupAttendance,
28
+ CG: () => CG,
29
+ Click: () => Click,
30
+ ClickAction: () => ClickAction,
31
+ Cluster: () => Cluster,
32
+ Column: () => Column,
33
+ DisplayAttendance: () => DisplayAttendance,
34
+ FollowUpStatus: () => FollowUpStatus,
35
+ LIST_STATUS: () => LIST_STATUS,
36
+ METHOD: () => METHOD,
37
+ PERMISSION: () => PERMISSION,
38
+ ReportSheep: () => ReportSheep,
39
+ Session: () => Session,
40
+ SessionAttendance: () => SessionAttendance,
41
+ Sheep: () => Sheep,
42
+ SmallTeam: () => SmallTeam,
43
+ Title: () => Title,
44
+ TitleAttendance: () => TitleAttendance
45
+ });
46
+ module.exports = __toCommonJS(index_exports);
47
+
48
+ // src/constants/method.constant.ts
49
+ var METHOD = {
50
+ SKY: "S",
51
+ GROUND: "G",
52
+ TOTAL: "T"
53
+ };
54
+
55
+ // src/constants/status.constant.ts
56
+ var LIST_STATUS = ["OM", "NB", "AC", "NF", "RNF"];
57
+
58
+ // src/classes/attendance/SessionAttendance.ts
59
+ var SessionAttendance = class {
60
+ constructor(session) {
61
+ this.arrSheep = [];
62
+ if (session) {
63
+ this.code = session.code;
64
+ this.type = session.type;
65
+ this.desc = session.desc;
66
+ this.seq = session.seq;
67
+ this.needAbsReason = session.needAbsReason;
68
+ }
69
+ }
70
+ sortedArrAttSheep() {
71
+ let arrStatusCopy = LIST_STATUS;
72
+ return this.arrSheep.sort((a, b) => {
73
+ if (a.attended && b.attended || !a.attended && !b.attended) {
74
+ let indexA = arrStatusCopy.indexOf(a.status);
75
+ let indexB = arrStatusCopy.indexOf(b.status);
76
+ if (indexA < 0) {
77
+ return 1;
78
+ } else if (indexB < 0) {
79
+ return -1;
80
+ } else {
81
+ if (indexA < indexB) {
82
+ return -1;
83
+ } else if (indexA > indexB) {
84
+ return 1;
85
+ } else {
86
+ return a.name.localeCompare(b.name);
87
+ }
88
+ }
89
+ } else if (a.attended) {
90
+ return -1;
91
+ } else if (b.attended) {
92
+ return 1;
93
+ } else {
94
+ return -1;
95
+ }
96
+ });
97
+ }
98
+ get arrFilteredSheep() {
99
+ return this.input ? this.arrSheep.filter(
100
+ (sheep) => sheep.name.toLowerCase().includes(this.input.toLowerCase())
101
+ ) : this.arrSheep.slice();
102
+ }
103
+ getCnt(status, attType) {
104
+ if (!this.arrSheep) return 0;
105
+ else {
106
+ let cnt = 0;
107
+ for (let s of this.arrSheep) {
108
+ if (attType == METHOD.GROUND || attType == METHOD.SKY) {
109
+ if (attType == s.method && s.status == status && s.attended) cnt++;
110
+ } else if (attType == METHOD.TOTAL) {
111
+ if (s.status == status && s.attended) cnt++;
112
+ }
113
+ }
114
+ return cnt;
115
+ }
116
+ }
117
+ getAbsCnt() {
118
+ if (!this.arrSheep) return 0;
119
+ else {
120
+ let cnt = 0;
121
+ for (let s of this.arrSheep) {
122
+ if (s.status == "OM" && !s.attended) cnt++;
123
+ }
124
+ return cnt;
125
+ }
126
+ }
127
+ getDesc(status, attType) {
128
+ if (!this.arrSheep) return "";
129
+ else {
130
+ let desc = "";
131
+ for (let s of this.arrSheep) {
132
+ if (attType == METHOD.GROUND || attType == METHOD.SKY) {
133
+ if (attType == s.method && s.status == status && s.attended)
134
+ desc += s.name + ", ";
135
+ } else if (attType == METHOD.TOTAL) {
136
+ if (s.status == status && s.attended) desc += s.name + ", ";
137
+ }
138
+ }
139
+ desc = desc.slice(0, desc.length - 2);
140
+ return desc;
141
+ }
142
+ }
143
+ getAbsDesc() {
144
+ if (!this.arrSheep) return "";
145
+ else {
146
+ let desc = "";
147
+ for (let s of this.arrSheep) {
148
+ if (s.status == "OM" && !s.attended)
149
+ desc += s.name + " - " + s.absReason + ", ";
150
+ }
151
+ desc = desc.slice(0, desc.length - 2);
152
+ return desc;
153
+ }
154
+ }
155
+ calc() {
156
+ this.ground = new DisplayAttendance();
157
+ this.sky = new DisplayAttendance();
158
+ this.total = new DisplayAttendance();
159
+ this.calcFigure();
160
+ this.calcDesc();
161
+ }
162
+ /** generate count of OM, NB, AC, NF, RNF */
163
+ calcFigure() {
164
+ for (let status of LIST_STATUS) {
165
+ this.ground["cnt" + status] = this.getCnt(status, METHOD.GROUND);
166
+ this.ground.calcTotal();
167
+ }
168
+ for (let status of LIST_STATUS) {
169
+ this.sky["cnt" + status] = this.getCnt(status, METHOD.SKY);
170
+ this.sky.calcTotal();
171
+ }
172
+ for (let status of LIST_STATUS) {
173
+ this.total["cnt" + status] = this.getCnt(status, METHOD.TOTAL);
174
+ this.total.calcTotal();
175
+ }
176
+ this.cntAbs = this.getAbsCnt();
177
+ }
178
+ /** generate description of OM, NB, AC, NF, RNF */
179
+ calcDesc() {
180
+ for (let status of LIST_STATUS) {
181
+ this.ground["des" + status] = this.getDesc(status, METHOD.GROUND);
182
+ }
183
+ for (let status of LIST_STATUS) {
184
+ this.sky["des" + status] = this.getDesc(status, METHOD.SKY);
185
+ }
186
+ for (let status of LIST_STATUS) {
187
+ this.total["des" + status] = this.getDesc(status, METHOD.TOTAL);
188
+ }
189
+ this.desAbs = this.getAbsDesc();
190
+ }
191
+ /**
192
+ * reset all display attendance figure to zero
193
+ */
194
+ resetDisplayAttendance() {
195
+ this.ground = new DisplayAttendance();
196
+ this.sky = new DisplayAttendance();
197
+ this.total = new DisplayAttendance();
198
+ for (let status of LIST_STATUS) {
199
+ this.ground["cnt" + status] = 0;
200
+ this.sky["cnt" + status] = 0;
201
+ this.total["cnt" + status] = 0;
202
+ }
203
+ this.ground.total = 0;
204
+ this.sky.total = 0;
205
+ this.total.total = 0;
206
+ this.cntAbs = 0;
207
+ }
208
+ /**
209
+ * Sums CG's sessionAttendance into total sessionAttendance.
210
+ * @param sessionAttendance
211
+ */
212
+ sum(sessionAttendance) {
213
+ for (let status of LIST_STATUS) {
214
+ this.ground["cnt" + status] += sessionAttendance.ground["cnt" + status];
215
+ this.sky["cnt" + status] += sessionAttendance.sky["cnt" + status];
216
+ this.total["cnt" + status] += sessionAttendance.total["cnt" + status];
217
+ }
218
+ this.ground.total += sessionAttendance.ground.total;
219
+ this.sky.total += sessionAttendance.sky.total;
220
+ this.total.total += sessionAttendance.total.total;
221
+ this.cntAbs += sessionAttendance.cntAbs;
222
+ }
223
+ };
224
+ var AttSheep = class {
225
+ /**
226
+ * initialize AttSheep object from Sheep object
227
+ * @param sheep
228
+ */
229
+ constructor(sheep) {
230
+ this.idSheep = sheep.id;
231
+ this.name = sheep.name;
232
+ this.status = sheep.status;
233
+ this.attended = false;
234
+ this.absReason = "";
235
+ this.method = METHOD.GROUND;
236
+ }
237
+ copyAtt(attSheep) {
238
+ this.attended = attSheep.attended;
239
+ this.absReason = attSheep.absReason;
240
+ this.method = attSheep.method;
241
+ }
242
+ };
243
+ var DisplayAttendance = class {
244
+ calcTotal() {
245
+ this.total = this.cntOM + this.cntNB + this.cntAC + this.cntNF + this.cntRNF;
246
+ }
247
+ };
248
+
249
+ // src/classes/attendance/Attendance.ts
250
+ var Attendance = class {
251
+ constructor(attendance) {
252
+ if (attendance) {
253
+ Object.assign(this, attendance);
254
+ }
255
+ }
256
+ getSessionAttendance(session) {
257
+ }
258
+ setSessionAttendance(arrSession) {
259
+ if (this.arrSessionAttendance) {
260
+ let oriArr = this.deepCopySessionAttendance(this.arrSessionAttendance);
261
+ this.arrSessionAttendance = [];
262
+ for (let s of arrSession) {
263
+ this.arrSessionAttendance.push(new SessionAttendance(s));
264
+ }
265
+ for (let oriSession of oriArr) {
266
+ for (let newSession of this.arrSessionAttendance) {
267
+ if (oriSession.code == newSession.code) {
268
+ if (oriSession.arrSheep) {
269
+ newSession.arrSheep = [...oriSession.arrSheep];
270
+ }
271
+ }
272
+ }
273
+ }
274
+ } else {
275
+ this.arrSessionAttendance = [];
276
+ for (let s of arrSession) {
277
+ this.arrSessionAttendance.push(new SessionAttendance(s));
278
+ }
279
+ }
280
+ }
281
+ deepCopySessionAttendance(arrSessionAttendance) {
282
+ let arrRtn = [];
283
+ for (let s of arrSessionAttendance) {
284
+ let sessionAtt = new SessionAttendance();
285
+ sessionAtt.code = s.code;
286
+ sessionAtt.desc = s.desc;
287
+ sessionAtt.type = s.type;
288
+ sessionAtt.seq = s.seq;
289
+ sessionAtt.needAbsReason = s.needAbsReason;
290
+ sessionAtt.arrSheep = [];
291
+ for (let sheep of s.arrSheep) {
292
+ sessionAtt.arrSheep.push(sheep);
293
+ }
294
+ arrRtn.push(sessionAtt);
295
+ }
296
+ return arrRtn;
297
+ }
298
+ clearArrAttSheep(idCG, arrSheepForRef) {
299
+ if (this.arrSessionAttendance) {
300
+ for (let sessionAtt of this.arrSessionAttendance) {
301
+ sessionAtt.arrSheep = sessionAtt.arrSheep.filter((s) => {
302
+ return arrSheepForRef[s.idSheep] ? arrSheepForRef[s.idSheep].cg == idCG : false;
303
+ });
304
+ }
305
+ }
306
+ }
307
+ setArrAttSheep(arrSheep) {
308
+ for (let sessionAtt of this.arrSessionAttendance) {
309
+ for (let sheep of arrSheep) {
310
+ let found = false;
311
+ for (let attSheep of sessionAtt.arrSheep) {
312
+ if (attSheep.idSheep == sheep.id) {
313
+ found = true;
314
+ }
315
+ }
316
+ if (!found) sessionAtt.arrSheep.push(new AttSheep(sheep));
317
+ }
318
+ sessionAtt.arrSheep = sessionAtt.sortedArrAttSheep();
319
+ }
320
+ }
321
+ addSheep(sheep) {
322
+ for (let sessionAtt of this.arrSessionAttendance) {
323
+ sessionAtt.arrSheep.push(new AttSheep(sheep));
324
+ sessionAtt.arrSheep = sessionAtt.sortedArrAttSheep();
325
+ }
326
+ }
327
+ setCG(cg) {
328
+ this.idCg = cg.id;
329
+ this.idSt = cg.st;
330
+ this.idCluster = cg.cluster;
331
+ }
332
+ /**
333
+ * remove sheep where attended=false from arrSheep to submit attendance,
334
+ * won't remove OM
335
+ */
336
+ removeNotAttendForSubmission() {
337
+ for (let sessionAtt of this.arrSessionAttendance) {
338
+ sessionAtt.arrSheep = sessionAtt.arrSheep.filter(
339
+ (sheep) => sheep.attended || sheep.status == "OM"
340
+ );
341
+ }
342
+ }
343
+ /** calculate session attendance's figure & description */
344
+ calc() {
345
+ for (let sessionAtt of this.arrSessionAttendance) {
346
+ sessionAtt.calc();
347
+ }
348
+ }
349
+ /** Reset all display attendance figure to zero. */
350
+ resetDisplayAttendance() {
351
+ for (let session of this.arrSessionAttendance) {
352
+ session.resetDisplayAttendance();
353
+ }
354
+ }
355
+ getSessionAttendanceByCode(code) {
356
+ for (let session of this.arrSessionAttendance) {
357
+ if (session.code == code) {
358
+ return session;
359
+ }
360
+ }
361
+ return new SessionAttendance();
362
+ }
363
+ /**
364
+ * copy attendance to the writing panel
365
+ * @param attendance
366
+ */
367
+ copy(attendance) {
368
+ for (let sessionAtt of this.arrSessionAttendance) {
369
+ for (let prevSessionAtt of attendance.arrSessionAttendance) {
370
+ if (sessionAtt.code == prevSessionAtt.code) {
371
+ for (let attSheep of sessionAtt.arrSheep) {
372
+ let found = false;
373
+ for (let prevAttSheep of prevSessionAtt.arrSheep) {
374
+ if (attSheep.idSheep == prevAttSheep.idSheep) {
375
+ attSheep.copyAtt(prevAttSheep);
376
+ found = true;
377
+ }
378
+ }
379
+ if (!found) attSheep.attended = false;
380
+ }
381
+ }
382
+ }
383
+ }
384
+ }
385
+ };
386
+
387
+ // src/classes/attendance/BackupAttendance.ts
388
+ var BackupAttendance = class {
389
+ };
390
+
391
+ // src/classes/attendance/Session.ts
392
+ var Session = class {
393
+ constructor() {
394
+ }
395
+ };
396
+
397
+ // src/classes/attendance/Title.ts
398
+ var Title = class {
399
+ getKey() {
400
+ return "dddd";
401
+ }
402
+ };
403
+
404
+ // src/classes/pastoral-team/Sheep.ts
405
+ var Sheep = class {
406
+ constructor(id, name, status, cg, st, cluster, deleted, show, attCnt) {
407
+ this.id = id;
408
+ this.name = name;
409
+ this.status = status;
410
+ this.cg = cg;
411
+ this.st = st;
412
+ this.cluster = cluster;
413
+ this.deleted = deleted;
414
+ this.show = show;
415
+ this.attCnt = attCnt;
416
+ }
417
+ };
418
+
419
+ // src/classes/attendance-report/ReportSheep.ts
420
+ var ReportSheep = class extends Sheep {
421
+ constructor(sheep) {
422
+ super(
423
+ sheep.id,
424
+ sheep.name,
425
+ sheep.status,
426
+ sheep.cg,
427
+ sheep.st,
428
+ sheep.cluster,
429
+ sheep.deleted,
430
+ sheep.show,
431
+ sheep.attCnt
432
+ );
433
+ this.attMap = {};
434
+ }
435
+ };
436
+
437
+ // src/classes/attendance-report/TitleAttendance.ts
438
+ var TitleAttendance = class {
439
+ constructor(cgAtt, serviceAtt, title) {
440
+ this.cgAtt = cgAtt;
441
+ this.serviceAtt = serviceAtt;
442
+ this.title = title;
443
+ }
444
+ };
445
+
446
+ // src/classes/flw-up/FollowUpStatus.ts
447
+ var FollowUpStatus = class {
448
+ constructor() {
449
+ this.id = "";
450
+ this.method = "";
451
+ this.cluster = "";
452
+ this.st = "";
453
+ this.cg = "";
454
+ this.sheep = "";
455
+ this.in_list = true;
456
+ this.status = "";
457
+ this.timeStamp = "";
458
+ this.date = "";
459
+ this.discipler = "";
460
+ }
461
+ };
462
+
463
+ // src/classes/pastoral-team/CG.ts
464
+ var CG = class {
465
+ constructor(id, name, st, cluster, deleted) {
466
+ this.id = id;
467
+ this.name = name;
468
+ this.st = st;
469
+ this.cluster = cluster;
470
+ this.deleted = deleted;
471
+ }
472
+ };
473
+
474
+ // src/classes/pastoral-team/Cluster.ts
475
+ var Cluster = class {
476
+ constructor(id, name, deleted) {
477
+ this.id = id;
478
+ this.name = name;
479
+ this.deleted = deleted;
480
+ }
481
+ };
482
+
483
+ // src/classes/pastoral-team/SmallTeam.ts
484
+ var SmallTeam = class {
485
+ constructor(id, name, cluster, deleted) {
486
+ this.id = id;
487
+ this.name = name;
488
+ this.cluster = cluster;
489
+ this.deleted = deleted;
490
+ }
491
+ };
492
+
493
+ // src/classes/user-management/AssignedCG.ts
494
+ var AssignedCG = class {
495
+ constructor(cg) {
496
+ this.cg = cg;
497
+ }
498
+ };
499
+
500
+ // src/classes/AppUser.ts
501
+ var AppUser = class {
502
+ constructor(id, name, phoneNum, permission) {
503
+ this.id = id;
504
+ this.name = name;
505
+ this.phoneNum = phoneNum;
506
+ this.permission = permission;
507
+ }
508
+ };
509
+
510
+ // src/classes/Click.ts
511
+ var Click = class {
512
+ };
513
+
514
+ // src/classes/Column.ts
515
+ var Column = class {
516
+ constructor(name) {
517
+ this.visible = false;
518
+ this.name = name;
519
+ }
520
+ };
521
+
522
+ // src/constants/click.constant.ts
523
+ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
524
+ ClickAction2[ClickAction2["P_WeeklyAttendance"] = 0] = "P_WeeklyAttendance";
525
+ ClickAction2[ClickAction2["P_AttendanceReport"] = 1] = "P_AttendanceReport";
526
+ ClickAction2[ClickAction2["P_CGNameList"] = 2] = "P_CGNameList";
527
+ ClickAction2[ClickAction2["F_CopyAttendance"] = 3] = "F_CopyAttendance";
528
+ ClickAction2[ClickAction2["F_CheckAttendanceHistory"] = 4] = "F_CheckAttendanceHistory";
529
+ ClickAction2[ClickAction2["F_AttendanceReminder"] = 5] = "F_AttendanceReminder";
530
+ ClickAction2[ClickAction2["F_ExportWeekAttendance"] = 6] = "F_ExportWeekAttendance";
531
+ ClickAction2[ClickAction2["F_ClickEditSheep"] = 7] = "F_ClickEditSheep";
532
+ ClickAction2[ClickAction2["F_EditSheep"] = 8] = "F_EditSheep";
533
+ ClickAction2[ClickAction2["F_VerticalViewAttendance"] = 9] = "F_VerticalViewAttendance";
534
+ return ClickAction2;
535
+ })(ClickAction || {});
536
+
537
+ // src/constants/permission.constant.ts
538
+ var PERMISSION = {
539
+ SUPER_USER: "Super user",
540
+ TL: "TL",
541
+ SCGL: "SCGL",
542
+ CGL: "CGL",
543
+ FL: "FL",
544
+ WM: "WM",
545
+ NOT_VERIFIED: "Not verified",
546
+ PASTORAL_ADMIN: "Pastoral Admin",
547
+ ST_ADMIN: "Small Team Admin"
548
+ };
549
+ // Annotate the CommonJS export names for ESM import in node:
550
+ 0 && (module.exports = {
551
+ AppUser,
552
+ AssignedCG,
553
+ AttSheep,
554
+ Attendance,
555
+ BackupAttendance,
556
+ CG,
557
+ Click,
558
+ ClickAction,
559
+ Cluster,
560
+ Column,
561
+ DisplayAttendance,
562
+ FollowUpStatus,
563
+ LIST_STATUS,
564
+ METHOD,
565
+ PERMISSION,
566
+ ReportSheep,
567
+ Session,
568
+ SessionAttendance,
569
+ Sheep,
570
+ SmallTeam,
571
+ Title,
572
+ TitleAttendance
573
+ });
@@ -0,0 +1,392 @@
1
+ interface Base {
2
+ id: string;
3
+ deleted: boolean;
4
+ createdAt?: number;
5
+ createdBy?: string;
6
+ updatedAt?: number;
7
+ updatedBy?: string;
8
+ remark?: string;
9
+ }
10
+
11
+ declare class CG implements Base {
12
+ id: string;
13
+ deleted: boolean;
14
+ name: string;
15
+ /** small team id */
16
+ st: string;
17
+ /** cluster id */
18
+ cluster: string;
19
+ cglCnt?: number;
20
+ sglCnt?: number;
21
+ cglName?: string;
22
+ constructor(id: string, name: string, st: string, cluster: string, deleted: boolean);
23
+ }
24
+
25
+ interface MsjStudClass {
26
+ idClass?: string;
27
+ attended: boolean;
28
+ classNo: number;
29
+ replaced?: boolean;
30
+ absReason?: string;
31
+ markBy?: string;
32
+ markAt?: number;
33
+ provedAbsent?: boolean;
34
+ isWatchedRecording?: boolean;
35
+ markByName?: string;
36
+ }
37
+
38
+ interface MsjStudBatch extends Base {
39
+ idSheep: string;
40
+ idBatch: string;
41
+ completed?: boolean;
42
+ proceed?: boolean;
43
+ attendance?: MsjStudClass[];
44
+ status?: string;
45
+ }
46
+
47
+ declare class Sheep implements Base {
48
+ name: string;
49
+ st: string;
50
+ cluster: string;
51
+ cg: string;
52
+ status: string;
53
+ discipler?: string;
54
+ age?: number;
55
+ show: boolean;
56
+ birthday?: number;
57
+ isBaptised?: boolean;
58
+ dtBaptism?: number;
59
+ attCnt: number;
60
+ hideAtt?: boolean;
61
+ id: string;
62
+ deleted: boolean;
63
+ createdAt?: number;
64
+ createdBy?: string;
65
+ updatedAt?: number;
66
+ updatedBy?: string;
67
+ remark?: string;
68
+ arrFlwUpCnt?: number[];
69
+ msj?: Map<String, MsjStudBatch>;
70
+ msjRecords?: Map<String, MsjStudBatch[]>;
71
+ constructor(id: string, name: string, status: string, cg: string, st: string, cluster: string, deleted: boolean, show: boolean, attCnt: number);
72
+ }
73
+
74
+ interface Session extends Base {
75
+ code: string;
76
+ desc: string;
77
+ seq: number;
78
+ type: string;
79
+ needAbsReason: boolean;
80
+ }
81
+ /** Session object indicating session of title */
82
+ declare class Session implements Session {
83
+ constructor();
84
+ }
85
+
86
+ interface SessionAttendance extends Session {
87
+ /** array of attendance sheep (AttSheep) */
88
+ arrSheep: AttSheep[];
89
+ input: string;
90
+ sky: DisplayAttendance;
91
+ ground: DisplayAttendance;
92
+ total: DisplayAttendance;
93
+ cntAbs: number;
94
+ desAbs: string;
95
+ }
96
+ /**
97
+ * attendance of a session
98
+ *
99
+ * @extends
100
+ * Session
101
+ */
102
+ declare class SessionAttendance implements SessionAttendance {
103
+ constructor();
104
+ constructor(session: Session);
105
+ sortedArrAttSheep(): AttSheep[];
106
+ get arrFilteredSheep(): AttSheep[];
107
+ getCnt(status: string, attType: string): number;
108
+ getAbsCnt(): number;
109
+ getDesc(status: string, attType: string): string;
110
+ getAbsDesc(): string;
111
+ calc(): void;
112
+ /** generate count of OM, NB, AC, NF, RNF */
113
+ calcFigure(): void;
114
+ /** generate description of OM, NB, AC, NF, RNF */
115
+ calcDesc(): void;
116
+ /**
117
+ * reset all display attendance figure to zero
118
+ */
119
+ resetDisplayAttendance(): void;
120
+ /**
121
+ * Sums CG's sessionAttendance into total sessionAttendance.
122
+ * @param sessionAttendance
123
+ */
124
+ sum(sessionAttendance: SessionAttendance): void;
125
+ }
126
+ interface AttSheep {
127
+ idSheep: string;
128
+ name: string;
129
+ status: string;
130
+ attended: boolean;
131
+ absReason: string;
132
+ method: string;
133
+ }
134
+ /** represents a single member in a SessionAttendance. */
135
+ declare class AttSheep implements AttSheep {
136
+ /**
137
+ * initialize AttSheep object from Sheep object
138
+ * @param sheep
139
+ */
140
+ constructor(sheep: Sheep);
141
+ copyAtt(attSheep: AttSheep): void;
142
+ }
143
+ /**
144
+ * Contains a SessionAttendance data, to display.
145
+ * Ground/Sky/Total
146
+ */
147
+ declare class DisplayAttendance {
148
+ [key: string]: any;
149
+ cntOM: number;
150
+ cntNB: number;
151
+ cntAC: number;
152
+ cntNF: number;
153
+ cntRNF: number;
154
+ desOM: string;
155
+ desNB: string;
156
+ desAC: string;
157
+ desNF: string;
158
+ desRNF: string;
159
+ total: number;
160
+ calcTotal(): void;
161
+ }
162
+
163
+ interface Title extends Base {
164
+ startDt: number;
165
+ endDt: number;
166
+ code: string;
167
+ arrSession: Session[];
168
+ }
169
+ /** represents a week */
170
+ declare class Title implements Title {
171
+ getKey(): string;
172
+ }
173
+
174
+ interface Attendance extends Title {
175
+ idTitle: string;
176
+ idCg: string;
177
+ idSt: string;
178
+ idCluster: string;
179
+ timestamp: number;
180
+ arrSessionAttendance: SessionAttendance[];
181
+ }
182
+ /**
183
+ * attendance of week
184
+ *
185
+ * @extends Title
186
+ */
187
+ declare class Attendance implements Attendance {
188
+ constructor();
189
+ constructor(attendance: Attendance);
190
+ getSessionAttendance(session: Session): void;
191
+ setSessionAttendance(arrSession: Session[]): void;
192
+ deepCopySessionAttendance(arrSessionAttendance: SessionAttendance[]): SessionAttendance[];
193
+ clearArrAttSheep(idCG: string, arrSheepForRef: {
194
+ [key: string]: Sheep;
195
+ }): void;
196
+ setArrAttSheep(arrSheep: Sheep[]): void;
197
+ addSheep(sheep: Sheep): void;
198
+ setCG(cg: CG): void;
199
+ /**
200
+ * remove sheep where attended=false from arrSheep to submit attendance,
201
+ * won't remove OM
202
+ */
203
+ removeNotAttendForSubmission(): void;
204
+ /** calculate session attendance's figure & description */
205
+ calc(): void;
206
+ /** Reset all display attendance figure to zero. */
207
+ resetDisplayAttendance(): void;
208
+ getSessionAttendanceByCode(code: string): SessionAttendance;
209
+ /**
210
+ * copy attendance to the writing panel
211
+ * @param attendance
212
+ */
213
+ copy(attendance: Attendance): void;
214
+ }
215
+
216
+ interface BackupAttendance {
217
+ attendance: Attendance;
218
+ timestamp: number;
219
+ }
220
+ declare class BackupAttendance implements BackupAttendance {
221
+ }
222
+
223
+ declare class TitleAttendance {
224
+ cgAtt: AttSheep;
225
+ serviceAtt: AttSheep;
226
+ title: Title;
227
+ constructor(cgAtt: AttSheep, serviceAtt: AttSheep, title: Title);
228
+ }
229
+
230
+ declare class ReportSheep extends Sheep {
231
+ attMap: {
232
+ [key: string]: TitleAttendance;
233
+ };
234
+ constructor(sheep: Sheep);
235
+ }
236
+
237
+ interface MsjClassType extends Base {
238
+ title: string;
239
+ seq?: number;
240
+ defaultMinAtt?: number;
241
+ }
242
+
243
+ interface MsjClassBatch extends Base {
244
+ idMsjClassType: string;
245
+ yearTimestamp: number;
246
+ monthTimestamp: number;
247
+ msjClassType?: MsjClassType;
248
+ numOfClass: number;
249
+ dt?: Date;
250
+ minAtt?: number;
251
+ }
252
+
253
+ interface MsjClassTime extends Base {
254
+ idMsjClassBatch: string;
255
+ time: number;
256
+ msjClassBatch?: MsjClassBatch;
257
+ classNo: number;
258
+ backtracked?: boolean;
259
+ }
260
+
261
+ declare class FollowUpStatus {
262
+ id: string;
263
+ method: string;
264
+ st: string;
265
+ cluster: string;
266
+ cg: string;
267
+ sheep: string;
268
+ in_list: boolean;
269
+ status: string;
270
+ timeStamp: string;
271
+ date: string;
272
+ discipler: string;
273
+ user?: string;
274
+ constructor();
275
+ }
276
+
277
+ declare class Cluster implements Base {
278
+ id: string;
279
+ deleted: boolean;
280
+ name: string;
281
+ createdAt?: number;
282
+ createdBy: string | undefined;
283
+ updatedAt?: number;
284
+ updatedBy: string | undefined;
285
+ remark?: string;
286
+ constructor(id: string, name: string, deleted: boolean);
287
+ }
288
+
289
+ declare class SmallTeam implements Base {
290
+ id: string;
291
+ name: string;
292
+ /** cluster id */
293
+ cluster: string;
294
+ deleted: boolean;
295
+ constructor(id: string, name: string, cluster: string, deleted: boolean);
296
+ }
297
+
298
+ declare class AssignedCG {
299
+ cg: string;
300
+ constructor(cg: string);
301
+ }
302
+
303
+ /** Navigation List Item */
304
+ interface AppPage {
305
+ /** Title shown in navigation list */
306
+ title: string;
307
+ /** redirect target */
308
+ url: string;
309
+ /** Ionic icon name */
310
+ icon: string;
311
+ /** control whether show in navigation list or not */
312
+ canAccess: boolean;
313
+ category: string;
314
+ /** Angular Material icon name */
315
+ matIcon: string;
316
+ /** user need sign in to view */
317
+ isSecure: boolean;
318
+ /** Permissions need to view. Blank indicates everyone can view. */
319
+ permissions: string[];
320
+ }
321
+
322
+ interface PastoralTeam {
323
+ cg?: string;
324
+ cluster?: string;
325
+ st?: string;
326
+ }
327
+ declare class AppUser {
328
+ id: string;
329
+ name: string;
330
+ /** Login id: phone number/email */
331
+ phoneNum: string;
332
+ permission: string;
333
+ pastoral_team?: PastoralTeam;
334
+ permissions?: string[];
335
+ assigned_cg?: AssignedCG[];
336
+ constructor(id: string, name: string, phoneNum: string, permission: string);
337
+ }
338
+
339
+ interface BaseDialog {
340
+ close(): void;
341
+ }
342
+
343
+ declare enum ClickAction {
344
+ P_WeeklyAttendance = 0,
345
+ P_AttendanceReport = 1,
346
+ P_CGNameList = 2,
347
+ F_CopyAttendance = 3,
348
+ F_CheckAttendanceHistory = 4,
349
+ F_AttendanceReminder = 5,
350
+ F_ExportWeekAttendance = 6,
351
+ F_ClickEditSheep = 7,
352
+ F_EditSheep = 8,
353
+ F_VerticalViewAttendance = 9
354
+ }
355
+
356
+ declare class Click {
357
+ action: ClickAction;
358
+ timeStamp: number;
359
+ userId?: string;
360
+ }
361
+
362
+ declare class Column {
363
+ visible: boolean;
364
+ name: string;
365
+ constructor(name: string);
366
+ }
367
+
368
+ interface Device extends Base {
369
+ version?: number;
370
+ }
371
+
372
+ declare const METHOD: {
373
+ SKY: string;
374
+ GROUND: string;
375
+ TOTAL: string;
376
+ };
377
+
378
+ declare const PERMISSION: {
379
+ SUPER_USER: string;
380
+ TL: string;
381
+ SCGL: string;
382
+ CGL: string;
383
+ FL: string;
384
+ WM: string;
385
+ NOT_VERIFIED: string;
386
+ PASTORAL_ADMIN: string;
387
+ ST_ADMIN: string;
388
+ };
389
+
390
+ declare const LIST_STATUS: string[];
391
+
392
+ export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance };
package/dist/index.d.ts CHANGED
@@ -295,6 +295,11 @@ declare class SmallTeam implements Base {
295
295
  constructor(id: string, name: string, cluster: string, deleted: boolean);
296
296
  }
297
297
 
298
+ declare class AssignedCG {
299
+ cg: string;
300
+ constructor(cg: string);
301
+ }
302
+
298
303
  /** Navigation List Item */
299
304
  interface AppPage {
300
305
  /** Title shown in navigation list */
@@ -327,6 +332,7 @@ declare class AppUser {
327
332
  permission: string;
328
333
  pastoral_team?: PastoralTeam;
329
334
  permissions?: string[];
335
+ assigned_cg?: AssignedCG[];
330
336
  constructor(id: string, name: string, phoneNum: string, permission: string);
331
337
  }
332
338
 
@@ -383,4 +389,4 @@ declare const PERMISSION: {
383
389
 
384
390
  declare const LIST_STATUS: string[];
385
391
 
386
- export { type AppPage, AppUser, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance };
392
+ export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance };
package/dist/index.js CHANGED
@@ -1,49 +1,3 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- AppUser: () => AppUser,
24
- AttSheep: () => AttSheep,
25
- Attendance: () => Attendance,
26
- BackupAttendance: () => BackupAttendance,
27
- CG: () => CG,
28
- Click: () => Click,
29
- ClickAction: () => ClickAction,
30
- Cluster: () => Cluster,
31
- Column: () => Column,
32
- DisplayAttendance: () => DisplayAttendance,
33
- FollowUpStatus: () => FollowUpStatus,
34
- LIST_STATUS: () => LIST_STATUS,
35
- METHOD: () => METHOD,
36
- PERMISSION: () => PERMISSION,
37
- ReportSheep: () => ReportSheep,
38
- Session: () => Session,
39
- SessionAttendance: () => SessionAttendance,
40
- Sheep: () => Sheep,
41
- SmallTeam: () => SmallTeam,
42
- Title: () => Title,
43
- TitleAttendance: () => TitleAttendance
44
- });
45
- module.exports = __toCommonJS(index_exports);
46
-
47
1
  // src/constants/method.constant.ts
48
2
  var METHOD = {
49
3
  SKY: "S",
@@ -489,6 +443,13 @@ var SmallTeam = class {
489
443
  }
490
444
  };
491
445
 
446
+ // src/classes/user-management/AssignedCG.ts
447
+ var AssignedCG = class {
448
+ constructor(cg) {
449
+ this.cg = cg;
450
+ }
451
+ };
452
+
492
453
  // src/classes/AppUser.ts
493
454
  var AppUser = class {
494
455
  constructor(id, name, phoneNum, permission) {
@@ -538,9 +499,9 @@ var PERMISSION = {
538
499
  PASTORAL_ADMIN: "Pastoral Admin",
539
500
  ST_ADMIN: "Small Team Admin"
540
501
  };
541
- // Annotate the CommonJS export names for ESM import in node:
542
- 0 && (module.exports = {
502
+ export {
543
503
  AppUser,
504
+ AssignedCG,
544
505
  AttSheep,
545
506
  Attendance,
546
507
  BackupAttendance,
@@ -561,4 +522,4 @@ var PERMISSION = {
561
522
  SmallTeam,
562
523
  Title,
563
524
  TitleAttendance
564
- });
525
+ };
package/package.json CHANGED
@@ -1,28 +1,29 @@
1
- {
2
- "name": "cyc-type-def",
3
- "version": "1.0.3",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "files": [
7
- "dist"
8
- ],
9
- "scripts": {
10
- "build": "tsup src/index.ts --format cjs,esm --dts",
11
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
12
- "test": "jest",
13
- "prepublishOnly": "npm run build"
14
- },
15
- "keywords": [],
16
- "author": "",
17
- "license": "ISC",
18
- "description": "",
19
- "devDependencies": {
20
- "@types/jest": "^30.0.0",
21
- "@types/node": "^24.0.13",
22
- "jest": "^29.7.0",
23
- "ts-jest": "^29.4.0",
24
- "ts-node": "^10.9.2",
25
- "tsup": "^8.5.0",
26
- "typescript": "^5.8.3"
27
- }
28
- }
1
+ {
2
+ "name": "cyc-type-def",
3
+ "version": "2.1.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsup src/index.ts --format cjs,esm --dts",
12
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
13
+ "test": "jest",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "keywords": [],
17
+ "author": "",
18
+ "license": "ISC",
19
+ "description": "",
20
+ "devDependencies": {
21
+ "@types/jest": "^30.0.0",
22
+ "@types/node": "^24.0.13",
23
+ "jest": "^29.7.0",
24
+ "ts-jest": "^29.4.0",
25
+ "ts-node": "^10.9.2",
26
+ "tsup": "^8.5.0",
27
+ "typescript": "^5.8.3"
28
+ }
29
+ }