@bizmap/sdk 0.0.71 → 0.0.73

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 (3) hide show
  1. package/dist/main.d.ts +100 -137
  2. package/dist/main.js +89 -92
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -6,7 +6,7 @@ declare const companyUserRoles: z.ZodEnum<{
6
6
  physAsst: "physAsst";
7
7
  rcpst: "rcpst";
8
8
  cshr: "cshr";
9
- admin: "admin";
9
+ founder: "founder";
10
10
  }>;
11
11
  type CompanyUserRole = z.infer<typeof companyUserRoles>;
12
12
  declare const companyPartnerRoles: z.ZodEnum<{
@@ -21,6 +21,9 @@ declare const employeeRoles: z.ZodEnum<{
21
21
  cshr: "cshr";
22
22
  }>;
23
23
  type EmployeeRole = z.infer<typeof employeeRoles>;
24
+ declare const adminRoles: z.ZodEnum<{
25
+ founder: "founder";
26
+ }>;
24
27
  declare const healthcareProviderRoles: z.ZodEnum<{
25
28
  doc: "doc";
26
29
  physAsst: "physAsst";
@@ -40,6 +43,12 @@ declare const companyTypes: z.ZodEnum<{
40
43
  MEDICAL: "MEDICAL";
41
44
  }>;
42
45
  type CompanyType = z.infer<typeof companyTypes>;
46
+ declare const companyUserStatus: z.ZodEnum<{
47
+ inviteSent: "inviteSent";
48
+ active: "active";
49
+ inactive: "inactive";
50
+ }>;
51
+ type CompanyUserStatus = z.infer<typeof companyUserStatus>;
43
52
 
44
53
  declare const tiers: z.ZodEnum<{
45
54
  basic: "basic";
@@ -78,13 +87,13 @@ declare const CompanyDetails: z.ZodObject<{
78
87
  }>>;
79
88
  lastModified: z.ZodNullable<z.ZodInt>;
80
89
  version: z.ZodInt;
81
- address: z.ZodObject<{
90
+ alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
91
+ address: z.ZodOptional<z.ZodObject<{
82
92
  streetAddress: z.ZodString;
83
93
  city: z.ZodOptional<z.ZodString>;
84
94
  parish: z.ZodString;
85
95
  country: z.ZodString;
86
- }, z.core.$strip>;
87
- alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
96
+ }, z.core.$strip>>;
88
97
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
98
  contact: z.ZodObject<{
90
99
  email: z.ZodEmail;
@@ -144,10 +153,11 @@ declare const CompanyDetails: z.ZodObject<{
144
153
  current: z.ZodInt;
145
154
  lastModified: z.ZodNullable<z.ZodInt>;
146
155
  }, z.core.$strip>;
147
- storageInBytes: z.ZodRecord<z.ZodLiteral<"used" | "max">, z.ZodObject<{
156
+ usedStorageInBytes: z.ZodObject<{
148
157
  current: z.ZodNumber;
149
158
  lastModified: z.ZodNullable<z.ZodInt>;
150
- }, z.core.$strip>>;
159
+ }, z.core.$strip>;
160
+ drpInMonths: z.ZodInt;
151
161
  invoiceNoCounter: z.ZodInt;
152
162
  tktNoCounter: z.ZodInt;
153
163
  lastSavedAt: z.ZodNullable<z.ZodInt>;
@@ -240,33 +250,22 @@ declare const CompanyDetails: z.ZodObject<{
240
250
  lastModified: z.ZodNullable<z.ZodInt>;
241
251
  version: z.ZodInt;
242
252
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
243
- _id: z.ZodUUID;
253
+ inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
244
254
  email: z.ZodEmail;
245
- phoneNumber: z.ZodOptional<z.ZodString>;
246
255
  name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
247
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
248
- roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
249
- doc: "doc";
250
- physAsst: "physAsst";
251
- rcpst: "rcpst";
252
- cshr: "cshr";
253
- admin: "admin";
254
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
255
- isAvailable: z.ZodObject<{
256
- value: z.ZodBoolean;
257
- lastModified: z.ZodNullable<z.ZodInt>;
258
- }, z.core.$strip>;
259
- isBusy: z.ZodObject<{
260
- value: z.ZodBoolean;
261
- lastModified: z.ZodNullable<z.ZodInt>;
262
- }, z.core.$strip>;
263
256
  status: z.ZodEnum<{
264
257
  inviteSent: "inviteSent";
265
258
  active: "active";
266
259
  inactive: "inactive";
267
260
  }>;
268
- inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
269
261
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
262
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
263
+ doc: "doc";
264
+ physAsst: "physAsst";
265
+ rcpst: "rcpst";
266
+ cshr: "cshr";
267
+ founder: "founder";
268
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
270
269
  lastActive: z.ZodNullable<z.ZodInt>;
271
270
  inviteAccepted: z.ZodNullable<z.ZodInt>;
272
271
  }, z.core.$strip>>;
@@ -283,8 +282,8 @@ declare const CompanyDetails: z.ZodObject<{
283
282
  physAsst: "physAsst";
284
283
  rcpst: "rcpst";
285
284
  cshr: "cshr";
286
- admin: "admin";
287
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
285
+ founder: "founder";
286
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
288
287
  addedAt: z.ZodInt;
289
288
  }, z.core.$strip>>;
290
289
  }, z.core.$strip>>;
@@ -294,13 +293,13 @@ type CompanyDetails = z.infer<typeof CompanyDetails>;
294
293
  declare const MutableCompanyDetails: z.ZodObject<{
295
294
  _id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
296
295
  identity: z.ZodOptional<z.ZodObject<{
297
- address: z.ZodOptional<z.ZodObject<{
296
+ alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
297
+ address: z.ZodOptional<z.ZodOptional<z.ZodObject<{
298
298
  streetAddress: z.ZodString;
299
299
  city: z.ZodOptional<z.ZodString>;
300
300
  parish: z.ZodString;
301
301
  country: z.ZodString;
302
- }, z.core.$strip>>;
303
- alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
302
+ }, z.core.$strip>>>;
304
303
  logo: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
305
304
  contact: z.ZodOptional<z.ZodObject<{
306
305
  email: z.ZodEmail;
@@ -411,8 +410,8 @@ declare const MutableCompanyDetails: z.ZodObject<{
411
410
  physAsst: "physAsst";
412
411
  rcpst: "rcpst";
413
412
  cshr: "cshr";
414
- admin: "admin";
415
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
413
+ founder: "founder";
414
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
416
415
  addedAt: z.ZodInt;
417
416
  }, z.core.$strip>>;
418
417
  }, z.core.$strip>>>;
@@ -569,12 +568,12 @@ type MutableCompanyBilling = z.infer<typeof MutableCompanyBilling>;
569
568
  declare const CompanyIdentity: z.ZodObject<{
570
569
  _id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
571
570
  alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
572
- address: z.ZodObject<{
571
+ address: z.ZodOptional<z.ZodObject<{
573
572
  streetAddress: z.ZodString;
574
573
  city: z.ZodOptional<z.ZodString>;
575
574
  parish: z.ZodString;
576
575
  country: z.ZodString;
577
- }, z.core.$strip>;
576
+ }, z.core.$strip>>;
578
577
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
579
578
  type: z.ZodReadonly<z.ZodEnum<{
580
579
  MEDICAL: "MEDICAL";
@@ -604,13 +603,13 @@ declare const CompanyIdentity: z.ZodObject<{
604
603
  }, z.core.$strip>;
605
604
  type CompanyIdentity = z.infer<typeof CompanyIdentity>;
606
605
  declare const MutableCompanyIdentity: z.ZodObject<{
607
- address: z.ZodObject<{
606
+ alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
607
+ address: z.ZodOptional<z.ZodObject<{
608
608
  streetAddress: z.ZodString;
609
609
  city: z.ZodOptional<z.ZodString>;
610
610
  parish: z.ZodString;
611
611
  country: z.ZodString;
612
- }, z.core.$strip>;
613
- alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
612
+ }, z.core.$strip>>;
614
613
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
614
  contact: z.ZodObject<{
616
615
  email: z.ZodEmail;
@@ -672,33 +671,22 @@ type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
672
671
 
673
672
  declare const CompanyStaff: z.ZodObject<{
674
673
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
675
- _id: z.ZodUUID;
674
+ inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
676
675
  email: z.ZodEmail;
677
- phoneNumber: z.ZodOptional<z.ZodString>;
678
676
  name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
679
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
680
- roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
681
- doc: "doc";
682
- physAsst: "physAsst";
683
- rcpst: "rcpst";
684
- cshr: "cshr";
685
- admin: "admin";
686
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
687
- isAvailable: z.ZodObject<{
688
- value: z.ZodBoolean;
689
- lastModified: z.ZodNullable<z.ZodInt>;
690
- }, z.core.$strip>;
691
- isBusy: z.ZodObject<{
692
- value: z.ZodBoolean;
693
- lastModified: z.ZodNullable<z.ZodInt>;
694
- }, z.core.$strip>;
695
677
  status: z.ZodEnum<{
696
678
  inviteSent: "inviteSent";
697
679
  active: "active";
698
680
  inactive: "inactive";
699
681
  }>;
700
- inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
701
682
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
683
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
684
+ doc: "doc";
685
+ physAsst: "physAsst";
686
+ rcpst: "rcpst";
687
+ cshr: "cshr";
688
+ founder: "founder";
689
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
702
690
  lastActive: z.ZodNullable<z.ZodInt>;
703
691
  inviteAccepted: z.ZodNullable<z.ZodInt>;
704
692
  }, z.core.$strip>>;
@@ -716,8 +704,8 @@ declare const CompanyStaff: z.ZodObject<{
716
704
  physAsst: "physAsst";
717
705
  rcpst: "rcpst";
718
706
  cshr: "cshr";
719
- admin: "admin";
720
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
707
+ founder: "founder";
708
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
721
709
  addedAt: z.ZodInt;
722
710
  }, z.core.$strip>>;
723
711
  }, z.core.$strip>>;
@@ -737,10 +725,11 @@ declare const CompanyState: z.ZodObject<{
737
725
  current: z.ZodInt;
738
726
  lastModified: z.ZodNullable<z.ZodInt>;
739
727
  }, z.core.$strip>;
740
- storageInBytes: z.ZodRecord<z.ZodLiteral<"used" | "max">, z.ZodObject<{
728
+ usedStorageInBytes: z.ZodObject<{
741
729
  current: z.ZodNumber;
742
730
  lastModified: z.ZodNullable<z.ZodInt>;
743
- }, z.core.$strip>>;
731
+ }, z.core.$strip>;
732
+ drpInMonths: z.ZodInt;
744
733
  invoiceNoCounter: z.ZodInt;
745
734
  tktNoCounter: z.ZodInt;
746
735
  lastSavedAt: z.ZodNullable<z.ZodInt>;
@@ -750,15 +739,14 @@ declare const CompanyState: z.ZodObject<{
750
739
  }, z.core.$strip>;
751
740
  type CompanyState = z.infer<typeof CompanyState>;
752
741
 
753
- declare const MiniCompanyUser: z.ZodObject<{
754
- _id: z.ZodUUID;
755
- roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
756
- doc: "doc";
757
- physAsst: "physAsst";
758
- rcpst: "rcpst";
759
- cshr: "cshr";
760
- admin: "admin";
761
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
742
+ declare const CompanyUserSession: z.ZodObject<{
743
+ ip: z.ZodString;
744
+ user: z.ZodObject<{
745
+ _id: z.ZodUUID;
746
+ email: z.ZodEmail;
747
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
748
+ }, z.core.$strip>;
749
+ companyId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
762
750
  isAvailable: z.ZodObject<{
763
751
  value: z.ZodBoolean;
764
752
  lastModified: z.ZodNullable<z.ZodInt>;
@@ -767,47 +755,51 @@ declare const MiniCompanyUser: z.ZodObject<{
767
755
  value: z.ZodBoolean;
768
756
  lastModified: z.ZodNullable<z.ZodInt>;
769
757
  }, z.core.$strip>;
770
- status: z.ZodEnum<{
771
- inviteSent: "inviteSent";
772
- active: "active";
773
- inactive: "inactive";
774
- }>;
775
758
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
759
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
760
+ doc: "doc";
761
+ physAsst: "physAsst";
762
+ rcpst: "rcpst";
763
+ cshr: "cshr";
764
+ founder: "founder";
765
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
766
+ expiresAfter: z.ZodDate;
767
+ }, z.core.$strip>;
768
+ declare const MiniCompanyUser: z.ZodObject<{
776
769
  lastActive: z.ZodNullable<z.ZodInt>;
777
770
  inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
778
771
  inviteAccepted: z.ZodNullable<z.ZodInt>;
779
- }, z.core.$strip>;
780
- type MiniCompanyUser = z.infer<typeof MiniCompanyUser>;
781
- declare const CompanyUser: z.ZodObject<{
782
- _id: z.ZodUUID;
783
- email: z.ZodEmail;
784
- phoneNumber: z.ZodOptional<z.ZodString>;
785
- name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
786
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
772
+ appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
787
773
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
788
774
  doc: "doc";
789
775
  physAsst: "physAsst";
790
776
  rcpst: "rcpst";
791
777
  cshr: "cshr";
792
- admin: "admin";
793
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
794
- isAvailable: z.ZodObject<{
795
- value: z.ZodBoolean;
796
- lastModified: z.ZodNullable<z.ZodInt>;
797
- }, z.core.$strip>;
798
- isBusy: z.ZodObject<{
799
- value: z.ZodBoolean;
800
- lastModified: z.ZodNullable<z.ZodInt>;
801
- }, z.core.$strip>;
778
+ founder: "founder";
779
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
780
+ _id: z.ZodUUID;
781
+ }, z.core.$strip>;
782
+ type MiniCompanyUser = z.infer<typeof MiniCompanyUser>;
783
+ declare const CompanyUser: z.ZodObject<{
802
784
  status: z.ZodEnum<{
803
785
  inviteSent: "inviteSent";
804
786
  active: "active";
805
787
  inactive: "inactive";
806
788
  }>;
807
- inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
808
- appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
789
+ _id: z.ZodUUID;
790
+ email: z.ZodEmail;
791
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
809
792
  lastActive: z.ZodNullable<z.ZodInt>;
793
+ inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
810
794
  inviteAccepted: z.ZodNullable<z.ZodInt>;
795
+ appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
796
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
797
+ doc: "doc";
798
+ physAsst: "physAsst";
799
+ rcpst: "rcpst";
800
+ cshr: "cshr";
801
+ founder: "founder";
802
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
811
803
  }, z.core.$strip>;
812
804
  type CompanyUser = z.infer<typeof CompanyUser>;
813
805
 
@@ -818,8 +810,8 @@ declare const CompanyInviteList: z.ZodRecord<z.ZodEmail, z.ZodObject<{
818
810
  physAsst: "physAsst";
819
811
  rcpst: "rcpst";
820
812
  cshr: "cshr";
821
- admin: "admin";
822
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
813
+ founder: "founder";
814
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
823
815
  }, z.core.$strip>>;
824
816
  type CompanyInviteList = z.infer<typeof CompanyInviteList>;
825
817
 
@@ -1594,10 +1586,11 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1594
1586
  current: number;
1595
1587
  lastModified: number | null;
1596
1588
  };
1597
- storageInBytes: Record<"used" | "max", {
1589
+ usedStorageInBytes: {
1598
1590
  current: number;
1599
1591
  lastModified: number | null;
1600
- }>;
1592
+ };
1593
+ drpInMonths: number;
1601
1594
  invoiceNoCounter: number;
1602
1595
  tktNoCounter: number;
1603
1596
  lastSavedAt: number | null;
@@ -1607,24 +1600,13 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1607
1600
  };
1608
1601
  staffDetails: {
1609
1602
  members: Record<string, {
1610
- _id: string;
1611
1603
  email: string;
1612
1604
  name: string;
1613
- roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1614
- isAvailable: {
1615
- value: boolean;
1616
- lastModified: number | null;
1617
- };
1618
- isBusy: {
1619
- value: boolean;
1620
- lastModified: number | null;
1621
- };
1622
1605
  status: "inviteSent" | "active" | "inactive";
1623
1606
  appointments: Record<"ongoing" | "completed", number>;
1607
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1624
1608
  lastActive: number | null;
1625
1609
  inviteAccepted: number | null;
1626
- phoneNumber?: string | undefined;
1627
- photoUrl?: string | null | undefined;
1628
1610
  inviteSent?: number | null | undefined;
1629
1611
  }>;
1630
1612
  _id: string;
@@ -1636,7 +1618,7 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1636
1618
  addedAt: number;
1637
1619
  } | undefined;
1638
1620
  $CHANGE_ROLES?: {
1639
- newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1621
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1640
1622
  addedAt: number;
1641
1623
  } | undefined;
1642
1624
  }>;
@@ -1796,40 +1778,21 @@ declare function findNextAvailableStaff(userUids: string[], algorithm: CompanyPr
1796
1778
  * @returns {(CompanyUser|MiniCompanyUser)[]|null} an array of the users that have conflicting roles or roles that are
1797
1779
  * incompatible with the other partners, or null if none was found. */
1798
1780
  declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyUser)[]) => ({
1781
+ status: "inviteSent" | "active" | "inactive";
1799
1782
  _id: string;
1800
1783
  email: string;
1801
1784
  name: string;
1802
- roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1803
- isAvailable: {
1804
- value: boolean;
1805
- lastModified: number | null;
1806
- };
1807
- isBusy: {
1808
- value: boolean;
1809
- lastModified: number | null;
1810
- };
1811
- status: "inviteSent" | "active" | "inactive";
1812
- appointments: Record<"ongoing" | "completed", number>;
1813
1785
  lastActive: number | null;
1814
1786
  inviteAccepted: number | null;
1815
- phoneNumber?: string | undefined;
1816
- photoUrl?: string | null | undefined;
1787
+ appointments: Record<"ongoing" | "completed", number>;
1788
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1817
1789
  inviteSent?: number | null | undefined;
1818
1790
  } | {
1819
- _id: string;
1820
- roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1821
- isAvailable: {
1822
- value: boolean;
1823
- lastModified: number | null;
1824
- };
1825
- isBusy: {
1826
- value: boolean;
1827
- lastModified: number | null;
1828
- };
1829
- status: "inviteSent" | "active" | "inactive";
1830
- appointments: Record<"ongoing" | "completed", number>;
1831
1791
  lastActive: number | null;
1832
1792
  inviteAccepted: number | null;
1793
+ appointments: Record<"ongoing" | "completed", number>;
1794
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1795
+ _id: string;
1833
1796
  inviteSent?: number | null | undefined;
1834
1797
  })[] | null;
1835
1798
  /**
@@ -1843,4 +1806,4 @@ declare function createNotifId(options?: {
1843
1806
  to: string;
1844
1807
  }): string;
1845
1808
 
1846
- export { AppointmentDetails, type AppointmentDistAlg, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, type CompanyType, CompanyUser, type CompanyUserRole, CreditCurrency, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, UserDetails, Version, Vitals, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyTypes, companyUserRoles, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
1809
+ export { AppointmentDetails, type AppointmentDistAlg, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, type CompanyType, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, CreditCurrency, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, UserDetails, Version, Vitals, adminRoles, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyTypes, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -5,13 +5,15 @@ var companyUserRoles = z.enum([
5
5
  "physAsst",
6
6
  "rcpst",
7
7
  "cshr",
8
- "admin"
8
+ "founder"
9
+ // "admin",
9
10
  ]);
10
11
  var companyPartnerRoles = companyUserRoles.extract([
11
12
  "doc",
12
13
  "physAsst"
13
14
  ]);
14
- var employeeRoles = companyUserRoles.exclude(["admin"]);
15
+ var employeeRoles = companyUserRoles.exclude(["founder"]);
16
+ var adminRoles = companyUserRoles.extract(["founder"]);
15
17
  var healthcareProviderRoles = companyUserRoles.extract([
16
18
  "physAsst",
17
19
  "doc"
@@ -19,6 +21,7 @@ var healthcareProviderRoles = companyUserRoles.extract([
19
21
  var appointmentDistAlgs = z.enum(["RR", "LOR"]);
20
22
  var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
21
23
  var companyTypes = z.enum(["MEDICAL"]);
24
+ var companyUserStatus = z.enum(["inviteSent", "active", "inactive"]);
22
25
 
23
26
  // src/enums/Global.ts
24
27
  import * as z2 from "zod";
@@ -124,16 +127,12 @@ var CompanyState = z7.object({
124
127
  current: z7.int().min(1),
125
128
  lastModified: Timestamp.nullable()
126
129
  }),
127
- storageInBytes: z7.record(
128
- z7.literal(["used", "max"]),
129
- z7.object({
130
- current: z7.number(),
131
- lastModified: Timestamp.nullable()
132
- })
133
- ).refine(
134
- (data) => data.used.current <= data.max.current,
135
- "The total storage used cannot exceed the max allowed storage."
136
- ),
130
+ usedStorageInBytes: z7.object({
131
+ current: z7.number(),
132
+ lastModified: Timestamp.nullable()
133
+ }),
134
+ /** Data retention period in months */
135
+ drpInMonths: z7.int().min(1),
137
136
  /** A counter for the company's invoice no.
138
137
  * @note This should only be null when the cycle resets
139
138
  */
@@ -192,7 +191,7 @@ var CompanyIdentity = z9.object({
192
191
  alias: z9.string().trim().min(3).max(63).regex(/[a-z1-9 ]/gi).transform(
193
192
  (data) => data.replace(/[^a-z1-9 ]/gi, "").replace(/\s+/g, " ")
194
193
  ),
195
- address: Address,
194
+ address: Address.optional(),
196
195
  logo: z9.string().nullish(),
197
196
  type: companyTypes.readonly(),
198
197
  contact: z9.object({
@@ -371,36 +370,8 @@ var MutableCompanyPreferences = CompanyPreferences.omit({
371
370
  import * as z15 from "zod";
372
371
 
373
372
  // src/schemas/company/components/User.ts
374
- import { UserModel as UserModel2 } from "@wavy/util";
375
373
  import * as z14 from "zod";
376
374
 
377
- // src/schemas/profiles/User.ts
378
- import { UserModel } from "@wavy/util";
379
- import * as z13 from "zod";
380
- var UserDetails = z13.object({
381
- ...UserModel.shape,
382
- _id: z13.uuidv4(),
383
- name: z13.string().transform((data) => {
384
- const [firstName = "", lastName = ""] = data.split(" ");
385
- return (firstName + " " + lastName).trim();
386
- }).superRefine((data, ctx) => {
387
- data.split(" ").forEach((name, idx) => {
388
- const nty = idx === 0 ? "First" : "Last";
389
- if (idx === 0 && name.length < 2) {
390
- ctx.addIssue(`${nty} name must have at least (2) characters.`);
391
- }
392
- if (name.length > 25) {
393
- ctx.addIssue(`${nty} name can't have more than (25) characters.`);
394
- }
395
- });
396
- }),
397
- email: UserModel.shape.email,
398
- publicKey: z13.string().nullable(),
399
- notifications: z13.array(Notification),
400
- version: Version,
401
- ...TimeLog.shape
402
- }).omit({ uid: true });
403
-
404
375
  // src/functions/helper-functions.ts
405
376
  var findConflictingPartners = (...partners) => {
406
377
  let hasSingleDoctor = false;
@@ -424,17 +395,55 @@ var findConflictingPartners = (...partners) => {
424
395
  };
425
396
  var getCompatibleRoles = (role) => {
426
397
  if (role === "physAsst") {
427
- return companyUserRoles.exclude(["admin", "doc", role]).options;
398
+ return companyUserRoles.exclude([...adminRoles.options, "doc", role]).options;
428
399
  }
429
- if (role === "admin" || role === "doc") {
400
+ if (adminRoles.safeParse(role).success || role === "doc") {
430
401
  return companyUserRoles.exclude(["physAsst", role]).options;
431
402
  }
432
403
  return companyUserRoles.exclude([role]).options;
433
404
  };
434
405
 
406
+ // src/schemas/profiles/User.ts
407
+ import { UserModel } from "@wavy/util";
408
+ import * as z13 from "zod";
409
+ var UserDetails = z13.object({
410
+ ...UserModel.shape,
411
+ _id: z13.uuidv4(),
412
+ name: z13.string().transform((data) => {
413
+ const [firstName = "", lastName = ""] = data.split(" ");
414
+ return (firstName + " " + lastName).trim();
415
+ }).superRefine((data, ctx) => {
416
+ data.split(" ").forEach((name, idx) => {
417
+ const nty = idx === 0 ? "First" : "Last";
418
+ if (idx === 0 && name.length < 2) {
419
+ ctx.addIssue(`${nty} name must have at least (2) characters.`);
420
+ }
421
+ if (name.length > 25) {
422
+ ctx.addIssue(`${nty} name can't have more than (25) characters.`);
423
+ }
424
+ });
425
+ }),
426
+ email: UserModel.shape.email,
427
+ publicKey: z13.string().nullable(),
428
+ notifications: z13.array(Notification),
429
+ version: Version,
430
+ ...TimeLog.shape
431
+ }).omit({ uid: true });
432
+
435
433
  // src/schemas/company/components/User.ts
436
- var MiniCompanyUser2 = z14.object({
437
- _id: UserDetails.shape._id,
434
+ var CompanyUserSession = z14.object({
435
+ ip: z14.string(),
436
+ user: UserDetails.pick({ _id: true, name: true, email: true }),
437
+ companyId: CompanyState.shape._id,
438
+ isAvailable: z14.object({
439
+ value: z14.boolean(),
440
+ lastModified: Timestamp.nullable()
441
+ }),
442
+ isBusy: z14.object({
443
+ value: z14.boolean(),
444
+ lastModified: Timestamp.nullable()
445
+ }),
446
+ appointments: z14.record(z14.literal(["ongoing", "completed"]), z14.int().min(0)),
438
447
  roles: z14.array(companyUserRoles).transform((roles) => {
439
448
  const newRoles = [];
440
449
  for (const role of roles) {
@@ -446,48 +455,37 @@ var MiniCompanyUser2 = z14.object({
446
455
  (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
447
456
  );
448
457
  }, "A user is not allowed to have conflicting roles."),
449
- isAvailable: z14.object({
450
- value: z14.boolean(),
451
- lastModified: Timestamp.nullable()
452
- }),
453
- isBusy: z14.object({
454
- value: z14.boolean(),
455
- lastModified: Timestamp.nullable()
456
- }),
457
- status: z14.enum(["inviteSent", "active", "inactive"]),
458
- appointments: z14.record(z14.literal(["ongoing", "completed"]), z14.int().min(0)),
458
+ expiresAfter: z14.date()
459
+ });
460
+ var MiniCompanyUser2 = z14.object({
461
+ _id: UserDetails.shape._id,
462
+ ...CompanyUserSession.pick({
463
+ appointments: true,
464
+ roles: true
465
+ }).shape,
466
+ /** The time before the company session gets deleted */
459
467
  lastActive: Timestamp.nullable(),
460
468
  inviteSent: Timestamp.nullish(),
461
469
  inviteAccepted: Timestamp.nullable()
462
- }).superRefine((data, ctx) => {
463
- if (!data.isAvailable && data.status !== "active") {
464
- ctx.addIssue('Unavailable users MUST also have the "active" status.');
465
- }
466
- if (!data.isAvailable && !data.roles.some((role) => role === "doc" || role === "physAsst")) {
467
- ctx.addIssue(
468
- 'Only users with the "doc" or "physAsst" role can be marked as unavailable.'
469
- );
470
- }
471
470
  });
472
471
  var CompanyUser = z14.object({
473
- ...UserModel2.shape,
474
472
  ...MiniCompanyUser2.shape,
475
- name: UserDetails.shape.name
476
- }).omit({ uid: true });
473
+ ...CompanyUserSession.shape.user.shape,
474
+ // Determined based on:
475
+ // [1] where the data was retrieved from (if it is from the session pool then status === "active")
476
+ // [2] user's roles
477
+ // [3] inviteSent timestamp (if it )
478
+ status: companyUserStatus
479
+ });
477
480
 
478
481
  // src/schemas/company/components/Staff.ts
479
- var refineMembers = (data, ctx) => {
480
- for (const [uid, user] of Object.entries(data)) {
481
- if (uid !== user._id) {
482
- ctx.addIssue(
483
- `User found with a uid that doesn't match their respective key. (${uid} !== ${user._id}).`
484
- );
485
- }
486
- }
487
- };
488
482
  var MiniRawCompanyStaff = z15.object({
489
483
  _id: CompanyState.shape._id,
490
- members: z15.record(MiniCompanyUser2.shape._id, MiniCompanyUser2).superRefine(refineMembers),
484
+ members: z15.record(
485
+ MiniCompanyUser2.shape._id,
486
+ MiniCompanyUser2.omit({ _id: true })
487
+ ),
488
+ // .superRefine(refineMembers),
491
489
  /**
492
490
  * @relationship one -> many
493
491
  *@description A map of doctor `uids` to their assistants `uids` */
@@ -510,7 +508,7 @@ var MiniRawCompanyStaff = z15.object({
510
508
  });
511
509
  var RawCompanyStaff = z15.object({
512
510
  ...MiniRawCompanyStaff.shape,
513
- members: z15.record(CompanyUser.shape._id, CompanyUser).superRefine(refineMembers)
511
+ members: z15.record(CompanyUser.shape._id, CompanyUser.omit({ _id: true }))
514
512
  });
515
513
  var transformStaff = (object16) => {
516
514
  return object16.transform((d) => {
@@ -542,27 +540,22 @@ var transformStaff = (object16) => {
542
540
  }
543
541
  return copy;
544
542
  }).superRefine((details, ctx) => {
545
- for (const user of Object.values(details.members)) {
546
- if (user.roles.includes("doc") && user._id in details.partnerMap) {
547
- for (const asstUid of Object.keys(details.partnerMap[user._id])) {
543
+ for (const [_id, user] of Object.entries(details.members)) {
544
+ if (user.roles.includes("doc") && _id in details.partnerMap) {
545
+ for (const asstUid of Object.keys(details.partnerMap[_id])) {
548
546
  if (!details.members[asstUid].roles.includes("physAsst")) {
549
547
  ctx.addIssue(
550
- `A partner group member must have the "physAsst" role (${user._id}) -> (${asstUid}).`
548
+ `A partner group member must have the "physAsst" role (${_id}) -> (${asstUid}).`
551
549
  );
552
550
  }
553
551
  }
554
- } else if (user._id in details.partnerMap) {
552
+ } else if (_id in details.partnerMap) {
555
553
  ctx.addIssue(
556
- `A partner group leader must have the "doc" role. (${user._id})`
554
+ `A partner group leader must have the "doc" role. (${_id})`
557
555
  );
558
556
  } else if (user.roles.includes("doc")) {
559
557
  ctx.addIssue(
560
- `All users that have the "doc" role must be the leader of a partner group. (${user._id})`
561
- );
562
- }
563
- if (!user.isBusy && user._id in details.updateQueue) {
564
- ctx.addIssue(
565
- `Having users that aren't busy in the update queue is prohibited.`
558
+ `All users that have the "doc" role must be the leader of a partner group. (${_id})`
566
559
  );
567
560
  }
568
561
  }
@@ -752,7 +745,7 @@ function findAvailableStaff(role, staff) {
752
745
  return Object.keys(role === "doc" ? staff.partnerMap : staff.members).filter(
753
746
  (uid) => {
754
747
  const user = staff.members[uid];
755
- return !(uid in staff.updateQueue) && user.roles.includes(role) && user.status === "active" && user.isAvailable;
748
+ return !(uid in staff.updateQueue) && user.roles.includes(role) && user.status === "active";
756
749
  }
757
750
  );
758
751
  }
@@ -785,6 +778,7 @@ function findNextAvailableStaff(userUids, algorithm, staff) {
785
778
  }
786
779
 
787
780
  // src/functions/scheduleAppointment.ts
781
+ import { adminRoles as adminRoles2 } from "src/main";
788
782
  async function scheduleAppointment(request) {
789
783
  request.form = ScheduleAppointmentForm.parse(request.form);
790
784
  request.sender = UserDetails.parse(request.sender);
@@ -860,7 +854,7 @@ async function scheduleAppointment(request) {
860
854
  if (totalPaid < totalOwed) throw new Error("Insufficient payments made.");
861
855
  }
862
856
  if (stateCopy.credits.current < request.cost) {
863
- if (companyUser.roles.includes("admin")) {
857
+ if (companyUser.roles.some((role) => adminRoles2.safeParse(role).success)) {
864
858
  throw new Error("Account balance has insufficient funds.");
865
859
  } else {
866
860
  throw new Error(
@@ -942,6 +936,7 @@ export {
942
936
  CompanyStaff,
943
937
  CompanyState,
944
938
  CompanyUser,
939
+ CompanyUserSession,
945
940
  CreditCurrency,
946
941
  InviteResponse,
947
942
  InvoiceNo,
@@ -968,11 +963,13 @@ export {
968
963
  UserDetails,
969
964
  Version,
970
965
  Vitals,
966
+ adminRoles,
971
967
  appointmentDistAlgs,
972
968
  companyPartnerRoles,
973
969
  companyServiceSelectors,
974
970
  companyTypes,
975
971
  companyUserRoles,
972
+ companyUserStatus,
976
973
  createNotifId,
977
974
  employeeRoles,
978
975
  findAvailableStaff,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",