@bizmap/sdk 0.0.71 → 0.0.72

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 +91 -131
  2. package/dist/main.js +83 -82
  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;
@@ -240,33 +249,22 @@ declare const CompanyDetails: z.ZodObject<{
240
249
  lastModified: z.ZodNullable<z.ZodInt>;
241
250
  version: z.ZodInt;
242
251
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
243
- _id: z.ZodUUID;
252
+ inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
244
253
  email: z.ZodEmail;
245
- phoneNumber: z.ZodOptional<z.ZodString>;
246
254
  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
255
  status: z.ZodEnum<{
264
256
  inviteSent: "inviteSent";
265
257
  active: "active";
266
258
  inactive: "inactive";
267
259
  }>;
268
- inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
269
260
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
261
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
262
+ doc: "doc";
263
+ physAsst: "physAsst";
264
+ rcpst: "rcpst";
265
+ cshr: "cshr";
266
+ founder: "founder";
267
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
270
268
  lastActive: z.ZodNullable<z.ZodInt>;
271
269
  inviteAccepted: z.ZodNullable<z.ZodInt>;
272
270
  }, z.core.$strip>>;
@@ -283,8 +281,8 @@ declare const CompanyDetails: z.ZodObject<{
283
281
  physAsst: "physAsst";
284
282
  rcpst: "rcpst";
285
283
  cshr: "cshr";
286
- admin: "admin";
287
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
284
+ founder: "founder";
285
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
288
286
  addedAt: z.ZodInt;
289
287
  }, z.core.$strip>>;
290
288
  }, z.core.$strip>>;
@@ -294,13 +292,13 @@ type CompanyDetails = z.infer<typeof CompanyDetails>;
294
292
  declare const MutableCompanyDetails: z.ZodObject<{
295
293
  _id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
296
294
  identity: z.ZodOptional<z.ZodObject<{
297
- address: z.ZodOptional<z.ZodObject<{
295
+ alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
296
+ address: z.ZodOptional<z.ZodOptional<z.ZodObject<{
298
297
  streetAddress: z.ZodString;
299
298
  city: z.ZodOptional<z.ZodString>;
300
299
  parish: z.ZodString;
301
300
  country: z.ZodString;
302
- }, z.core.$strip>>;
303
- alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
301
+ }, z.core.$strip>>>;
304
302
  logo: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
305
303
  contact: z.ZodOptional<z.ZodObject<{
306
304
  email: z.ZodEmail;
@@ -411,8 +409,8 @@ declare const MutableCompanyDetails: z.ZodObject<{
411
409
  physAsst: "physAsst";
412
410
  rcpst: "rcpst";
413
411
  cshr: "cshr";
414
- admin: "admin";
415
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
412
+ founder: "founder";
413
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
416
414
  addedAt: z.ZodInt;
417
415
  }, z.core.$strip>>;
418
416
  }, z.core.$strip>>>;
@@ -569,12 +567,12 @@ type MutableCompanyBilling = z.infer<typeof MutableCompanyBilling>;
569
567
  declare const CompanyIdentity: z.ZodObject<{
570
568
  _id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
571
569
  alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
572
- address: z.ZodObject<{
570
+ address: z.ZodOptional<z.ZodObject<{
573
571
  streetAddress: z.ZodString;
574
572
  city: z.ZodOptional<z.ZodString>;
575
573
  parish: z.ZodString;
576
574
  country: z.ZodString;
577
- }, z.core.$strip>;
575
+ }, z.core.$strip>>;
578
576
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
579
577
  type: z.ZodReadonly<z.ZodEnum<{
580
578
  MEDICAL: "MEDICAL";
@@ -604,13 +602,13 @@ declare const CompanyIdentity: z.ZodObject<{
604
602
  }, z.core.$strip>;
605
603
  type CompanyIdentity = z.infer<typeof CompanyIdentity>;
606
604
  declare const MutableCompanyIdentity: z.ZodObject<{
607
- address: z.ZodObject<{
605
+ alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
606
+ address: z.ZodOptional<z.ZodObject<{
608
607
  streetAddress: z.ZodString;
609
608
  city: z.ZodOptional<z.ZodString>;
610
609
  parish: z.ZodString;
611
610
  country: z.ZodString;
612
- }, z.core.$strip>;
613
- alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
611
+ }, z.core.$strip>>;
614
612
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
613
  contact: z.ZodObject<{
616
614
  email: z.ZodEmail;
@@ -672,33 +670,22 @@ type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
672
670
 
673
671
  declare const CompanyStaff: z.ZodObject<{
674
672
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
675
- _id: z.ZodUUID;
673
+ inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
676
674
  email: z.ZodEmail;
677
- phoneNumber: z.ZodOptional<z.ZodString>;
678
675
  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
676
  status: z.ZodEnum<{
696
677
  inviteSent: "inviteSent";
697
678
  active: "active";
698
679
  inactive: "inactive";
699
680
  }>;
700
- inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
701
681
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
682
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
683
+ doc: "doc";
684
+ physAsst: "physAsst";
685
+ rcpst: "rcpst";
686
+ cshr: "cshr";
687
+ founder: "founder";
688
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
702
689
  lastActive: z.ZodNullable<z.ZodInt>;
703
690
  inviteAccepted: z.ZodNullable<z.ZodInt>;
704
691
  }, z.core.$strip>>;
@@ -716,8 +703,8 @@ declare const CompanyStaff: z.ZodObject<{
716
703
  physAsst: "physAsst";
717
704
  rcpst: "rcpst";
718
705
  cshr: "cshr";
719
- admin: "admin";
720
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
706
+ founder: "founder";
707
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
721
708
  addedAt: z.ZodInt;
722
709
  }, z.core.$strip>>;
723
710
  }, z.core.$strip>>;
@@ -750,15 +737,14 @@ declare const CompanyState: z.ZodObject<{
750
737
  }, z.core.$strip>;
751
738
  type CompanyState = z.infer<typeof CompanyState>;
752
739
 
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")[]>>;
740
+ declare const CompanyUserSession: z.ZodObject<{
741
+ ip: z.ZodString;
742
+ user: z.ZodObject<{
743
+ _id: z.ZodUUID;
744
+ email: z.ZodEmail;
745
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
746
+ }, z.core.$strip>;
747
+ companyId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
762
748
  isAvailable: z.ZodObject<{
763
749
  value: z.ZodBoolean;
764
750
  lastModified: z.ZodNullable<z.ZodInt>;
@@ -767,47 +753,51 @@ declare const MiniCompanyUser: z.ZodObject<{
767
753
  value: z.ZodBoolean;
768
754
  lastModified: z.ZodNullable<z.ZodInt>;
769
755
  }, z.core.$strip>;
770
- status: z.ZodEnum<{
771
- inviteSent: "inviteSent";
772
- active: "active";
773
- inactive: "inactive";
774
- }>;
775
756
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
757
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
758
+ doc: "doc";
759
+ physAsst: "physAsst";
760
+ rcpst: "rcpst";
761
+ cshr: "cshr";
762
+ founder: "founder";
763
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
764
+ expiresAfter: z.ZodDate;
765
+ }, z.core.$strip>;
766
+ declare const MiniCompanyUser: z.ZodObject<{
776
767
  lastActive: z.ZodNullable<z.ZodInt>;
777
768
  inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
778
769
  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>>;
770
+ appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
787
771
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
788
772
  doc: "doc";
789
773
  physAsst: "physAsst";
790
774
  rcpst: "rcpst";
791
775
  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>;
776
+ founder: "founder";
777
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
778
+ _id: z.ZodUUID;
779
+ }, z.core.$strip>;
780
+ type MiniCompanyUser = z.infer<typeof MiniCompanyUser>;
781
+ declare const CompanyUser: z.ZodObject<{
802
782
  status: z.ZodEnum<{
803
783
  inviteSent: "inviteSent";
804
784
  active: "active";
805
785
  inactive: "inactive";
806
786
  }>;
807
- inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
808
- appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
787
+ _id: z.ZodUUID;
788
+ email: z.ZodEmail;
789
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
809
790
  lastActive: z.ZodNullable<z.ZodInt>;
791
+ inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
810
792
  inviteAccepted: z.ZodNullable<z.ZodInt>;
793
+ appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
794
+ roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
795
+ doc: "doc";
796
+ physAsst: "physAsst";
797
+ rcpst: "rcpst";
798
+ cshr: "cshr";
799
+ founder: "founder";
800
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
811
801
  }, z.core.$strip>;
812
802
  type CompanyUser = z.infer<typeof CompanyUser>;
813
803
 
@@ -818,8 +808,8 @@ declare const CompanyInviteList: z.ZodRecord<z.ZodEmail, z.ZodObject<{
818
808
  physAsst: "physAsst";
819
809
  rcpst: "rcpst";
820
810
  cshr: "cshr";
821
- admin: "admin";
822
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
811
+ founder: "founder";
812
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
823
813
  }, z.core.$strip>>;
824
814
  type CompanyInviteList = z.infer<typeof CompanyInviteList>;
825
815
 
@@ -1607,24 +1597,13 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1607
1597
  };
1608
1598
  staffDetails: {
1609
1599
  members: Record<string, {
1610
- _id: string;
1611
1600
  email: string;
1612
1601
  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
1602
  status: "inviteSent" | "active" | "inactive";
1623
1603
  appointments: Record<"ongoing" | "completed", number>;
1604
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1624
1605
  lastActive: number | null;
1625
1606
  inviteAccepted: number | null;
1626
- phoneNumber?: string | undefined;
1627
- photoUrl?: string | null | undefined;
1628
1607
  inviteSent?: number | null | undefined;
1629
1608
  }>;
1630
1609
  _id: string;
@@ -1636,7 +1615,7 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1636
1615
  addedAt: number;
1637
1616
  } | undefined;
1638
1617
  $CHANGE_ROLES?: {
1639
- newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1618
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1640
1619
  addedAt: number;
1641
1620
  } | undefined;
1642
1621
  }>;
@@ -1796,40 +1775,21 @@ declare function findNextAvailableStaff(userUids: string[], algorithm: CompanyPr
1796
1775
  * @returns {(CompanyUser|MiniCompanyUser)[]|null} an array of the users that have conflicting roles or roles that are
1797
1776
  * incompatible with the other partners, or null if none was found. */
1798
1777
  declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyUser)[]) => ({
1778
+ status: "inviteSent" | "active" | "inactive";
1799
1779
  _id: string;
1800
1780
  email: string;
1801
1781
  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
1782
  lastActive: number | null;
1814
1783
  inviteAccepted: number | null;
1815
- phoneNumber?: string | undefined;
1816
- photoUrl?: string | null | undefined;
1784
+ appointments: Record<"ongoing" | "completed", number>;
1785
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1817
1786
  inviteSent?: number | null | undefined;
1818
1787
  } | {
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
1788
  lastActive: number | null;
1832
1789
  inviteAccepted: number | null;
1790
+ appointments: Record<"ongoing" | "completed", number>;
1791
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1792
+ _id: string;
1833
1793
  inviteSent?: number | null | undefined;
1834
1794
  })[] | null;
1835
1795
  /**
@@ -1843,4 +1803,4 @@ declare function createNotifId(options?: {
1843
1803
  to: string;
1844
1804
  }): string;
1845
1805
 
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 };
1806
+ 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";
@@ -192,7 +195,7 @@ var CompanyIdentity = z9.object({
192
195
  alias: z9.string().trim().min(3).max(63).regex(/[a-z1-9 ]/gi).transform(
193
196
  (data) => data.replace(/[^a-z1-9 ]/gi, "").replace(/\s+/g, " ")
194
197
  ),
195
- address: Address,
198
+ address: Address.optional(),
196
199
  logo: z9.string().nullish(),
197
200
  type: companyTypes.readonly(),
198
201
  contact: z9.object({
@@ -371,36 +374,8 @@ var MutableCompanyPreferences = CompanyPreferences.omit({
371
374
  import * as z15 from "zod";
372
375
 
373
376
  // src/schemas/company/components/User.ts
374
- import { UserModel as UserModel2 } from "@wavy/util";
375
377
  import * as z14 from "zod";
376
378
 
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
379
  // src/functions/helper-functions.ts
405
380
  var findConflictingPartners = (...partners) => {
406
381
  let hasSingleDoctor = false;
@@ -424,17 +399,55 @@ var findConflictingPartners = (...partners) => {
424
399
  };
425
400
  var getCompatibleRoles = (role) => {
426
401
  if (role === "physAsst") {
427
- return companyUserRoles.exclude(["admin", "doc", role]).options;
402
+ return companyUserRoles.exclude([...adminRoles.options, "doc", role]).options;
428
403
  }
429
- if (role === "admin" || role === "doc") {
404
+ if (adminRoles.safeParse(role).success || role === "doc") {
430
405
  return companyUserRoles.exclude(["physAsst", role]).options;
431
406
  }
432
407
  return companyUserRoles.exclude([role]).options;
433
408
  };
434
409
 
410
+ // src/schemas/profiles/User.ts
411
+ import { UserModel } from "@wavy/util";
412
+ import * as z13 from "zod";
413
+ var UserDetails = z13.object({
414
+ ...UserModel.shape,
415
+ _id: z13.uuidv4(),
416
+ name: z13.string().transform((data) => {
417
+ const [firstName = "", lastName = ""] = data.split(" ");
418
+ return (firstName + " " + lastName).trim();
419
+ }).superRefine((data, ctx) => {
420
+ data.split(" ").forEach((name, idx) => {
421
+ const nty = idx === 0 ? "First" : "Last";
422
+ if (idx === 0 && name.length < 2) {
423
+ ctx.addIssue(`${nty} name must have at least (2) characters.`);
424
+ }
425
+ if (name.length > 25) {
426
+ ctx.addIssue(`${nty} name can't have more than (25) characters.`);
427
+ }
428
+ });
429
+ }),
430
+ email: UserModel.shape.email,
431
+ publicKey: z13.string().nullable(),
432
+ notifications: z13.array(Notification),
433
+ version: Version,
434
+ ...TimeLog.shape
435
+ }).omit({ uid: true });
436
+
435
437
  // src/schemas/company/components/User.ts
436
- var MiniCompanyUser2 = z14.object({
437
- _id: UserDetails.shape._id,
438
+ var CompanyUserSession = z14.object({
439
+ ip: z14.string(),
440
+ user: UserDetails.pick({ _id: true, name: true, email: true }),
441
+ companyId: CompanyState.shape._id,
442
+ isAvailable: z14.object({
443
+ value: z14.boolean(),
444
+ lastModified: Timestamp.nullable()
445
+ }),
446
+ isBusy: z14.object({
447
+ value: z14.boolean(),
448
+ lastModified: Timestamp.nullable()
449
+ }),
450
+ appointments: z14.record(z14.literal(["ongoing", "completed"]), z14.int().min(0)),
438
451
  roles: z14.array(companyUserRoles).transform((roles) => {
439
452
  const newRoles = [];
440
453
  for (const role of roles) {
@@ -446,48 +459,37 @@ var MiniCompanyUser2 = z14.object({
446
459
  (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
447
460
  );
448
461
  }, "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)),
462
+ expiresAfter: z14.date()
463
+ });
464
+ var MiniCompanyUser2 = z14.object({
465
+ _id: UserDetails.shape._id,
466
+ ...CompanyUserSession.pick({
467
+ appointments: true,
468
+ roles: true
469
+ }).shape,
470
+ /** The time before the company session gets deleted */
459
471
  lastActive: Timestamp.nullable(),
460
472
  inviteSent: Timestamp.nullish(),
461
473
  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
474
  });
472
475
  var CompanyUser = z14.object({
473
- ...UserModel2.shape,
474
476
  ...MiniCompanyUser2.shape,
475
- name: UserDetails.shape.name
476
- }).omit({ uid: true });
477
+ ...CompanyUserSession.shape.user.shape,
478
+ // Determined based on:
479
+ // [1] where the data was retrieved from (if it is from the session pool then status === "active")
480
+ // [2] user's roles
481
+ // [3] inviteSent timestamp (if it )
482
+ status: companyUserStatus
483
+ });
477
484
 
478
485
  // 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
486
  var MiniRawCompanyStaff = z15.object({
489
487
  _id: CompanyState.shape._id,
490
- members: z15.record(MiniCompanyUser2.shape._id, MiniCompanyUser2).superRefine(refineMembers),
488
+ members: z15.record(
489
+ MiniCompanyUser2.shape._id,
490
+ MiniCompanyUser2.omit({ _id: true })
491
+ ),
492
+ // .superRefine(refineMembers),
491
493
  /**
492
494
  * @relationship one -> many
493
495
  *@description A map of doctor `uids` to their assistants `uids` */
@@ -510,7 +512,7 @@ var MiniRawCompanyStaff = z15.object({
510
512
  });
511
513
  var RawCompanyStaff = z15.object({
512
514
  ...MiniRawCompanyStaff.shape,
513
- members: z15.record(CompanyUser.shape._id, CompanyUser).superRefine(refineMembers)
515
+ members: z15.record(CompanyUser.shape._id, CompanyUser.omit({ _id: true }))
514
516
  });
515
517
  var transformStaff = (object16) => {
516
518
  return object16.transform((d) => {
@@ -542,27 +544,22 @@ var transformStaff = (object16) => {
542
544
  }
543
545
  return copy;
544
546
  }).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])) {
547
+ for (const [_id, user] of Object.entries(details.members)) {
548
+ if (user.roles.includes("doc") && _id in details.partnerMap) {
549
+ for (const asstUid of Object.keys(details.partnerMap[_id])) {
548
550
  if (!details.members[asstUid].roles.includes("physAsst")) {
549
551
  ctx.addIssue(
550
- `A partner group member must have the "physAsst" role (${user._id}) -> (${asstUid}).`
552
+ `A partner group member must have the "physAsst" role (${_id}) -> (${asstUid}).`
551
553
  );
552
554
  }
553
555
  }
554
- } else if (user._id in details.partnerMap) {
556
+ } else if (_id in details.partnerMap) {
555
557
  ctx.addIssue(
556
- `A partner group leader must have the "doc" role. (${user._id})`
558
+ `A partner group leader must have the "doc" role. (${_id})`
557
559
  );
558
560
  } else if (user.roles.includes("doc")) {
559
561
  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.`
562
+ `All users that have the "doc" role must be the leader of a partner group. (${_id})`
566
563
  );
567
564
  }
568
565
  }
@@ -752,7 +749,7 @@ function findAvailableStaff(role, staff) {
752
749
  return Object.keys(role === "doc" ? staff.partnerMap : staff.members).filter(
753
750
  (uid) => {
754
751
  const user = staff.members[uid];
755
- return !(uid in staff.updateQueue) && user.roles.includes(role) && user.status === "active" && user.isAvailable;
752
+ return !(uid in staff.updateQueue) && user.roles.includes(role) && user.status === "active";
756
753
  }
757
754
  );
758
755
  }
@@ -785,6 +782,7 @@ function findNextAvailableStaff(userUids, algorithm, staff) {
785
782
  }
786
783
 
787
784
  // src/functions/scheduleAppointment.ts
785
+ import { adminRoles as adminRoles2 } from "src/main";
788
786
  async function scheduleAppointment(request) {
789
787
  request.form = ScheduleAppointmentForm.parse(request.form);
790
788
  request.sender = UserDetails.parse(request.sender);
@@ -860,7 +858,7 @@ async function scheduleAppointment(request) {
860
858
  if (totalPaid < totalOwed) throw new Error("Insufficient payments made.");
861
859
  }
862
860
  if (stateCopy.credits.current < request.cost) {
863
- if (companyUser.roles.includes("admin")) {
861
+ if (companyUser.roles.some((role) => adminRoles2.safeParse(role).success)) {
864
862
  throw new Error("Account balance has insufficient funds.");
865
863
  } else {
866
864
  throw new Error(
@@ -942,6 +940,7 @@ export {
942
940
  CompanyStaff,
943
941
  CompanyState,
944
942
  CompanyUser,
943
+ CompanyUserSession,
945
944
  CreditCurrency,
946
945
  InviteResponse,
947
946
  InvoiceNo,
@@ -968,11 +967,13 @@ export {
968
967
  UserDetails,
969
968
  Version,
970
969
  Vitals,
970
+ adminRoles,
971
971
  appointmentDistAlgs,
972
972
  companyPartnerRoles,
973
973
  companyServiceSelectors,
974
974
  companyTypes,
975
975
  companyUserRoles,
976
+ companyUserStatus,
976
977
  createNotifId,
977
978
  employeeRoles,
978
979
  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.72",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",