@bizmap/sdk 0.0.37 → 0.0.39

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 +171 -41
  2. package/dist/main.js +69 -47
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -112,7 +112,7 @@ declare const CompanyUser: z.ZodObject<{
112
112
  cshr: "cshr";
113
113
  admin: "admin";
114
114
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
115
- totalAppts: z.ZodInt;
115
+ appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
116
116
  lastActive: z.ZodInt;
117
117
  name: z.ZodRecord<z.ZodEnum<{
118
118
  first: "first";
@@ -248,7 +248,7 @@ declare const CompanyDetails: z.ZodObject<{
248
248
  }, z.core.$strip>>>;
249
249
  lastModified: z.ZodNullable<z.ZodInt>;
250
250
  }, z.core.$strip>>>;
251
- staffDetails: z.ZodPipe<z.ZodObject<{
251
+ staff: z.ZodPipe<z.ZodObject<{
252
252
  members: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
253
253
  createdAt: z.ZodReadonly<z.ZodInt>;
254
254
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -269,7 +269,7 @@ declare const CompanyDetails: z.ZodObject<{
269
269
  cshr: "cshr";
270
270
  admin: "admin";
271
271
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
272
- totalAppts: z.ZodInt;
272
+ appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
273
273
  lastActive: z.ZodInt;
274
274
  name: z.ZodRecord<z.ZodEnum<{
275
275
  first: "first";
@@ -279,9 +279,23 @@ declare const CompanyDetails: z.ZodObject<{
279
279
  email: z.ZodEmail;
280
280
  phoneNumber: z.ZodOptional<z.ZodString>;
281
281
  }, z.core.$strip>>;
282
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
283
- blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
282
+ partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
284
283
  addedAt: z.ZodInt;
284
+ }, z.core.$strip>>>;
285
+ updateQueue: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
286
+ $REMOVE: z.ZodOptional<z.ZodObject<{
287
+ addedAt: z.ZodInt;
288
+ }, z.core.$strip>>;
289
+ $CHANGE_ROLES: z.ZodOptional<z.ZodObject<{
290
+ newRoles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
291
+ doc: "doc";
292
+ physAsst: "physAsst";
293
+ rcpst: "rcpst";
294
+ cshr: "cshr";
295
+ admin: "admin";
296
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
297
+ addedAt: z.ZodInt;
298
+ }, z.core.$strip>>;
285
299
  }, z.core.$strip>>;
286
300
  lastModified: z.ZodNullable<z.ZodInt>;
287
301
  }, z.core.$strip>, z.ZodTransform<{
@@ -294,7 +308,7 @@ declare const CompanyDetails: z.ZodObject<{
294
308
  lastModified: number | null;
295
309
  };
296
310
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
297
- totalAppts: number;
311
+ appointmentCounter: Record<"ongoing" | "completed", number>;
298
312
  lastActive: number;
299
313
  name: Record<"first" | "last", string>;
300
314
  email: string;
@@ -302,9 +316,17 @@ declare const CompanyDetails: z.ZodObject<{
302
316
  photoUrl?: string | null | undefined;
303
317
  phoneNumber?: string | undefined;
304
318
  }>;
305
- partnerMap: Record<string, string[]>;
306
- blackList: Record<string, {
319
+ partnerMap: Record<string, Record<string, {
307
320
  addedAt: number;
321
+ }>>;
322
+ updateQueue: Record<string, {
323
+ $REMOVE?: {
324
+ addedAt: number;
325
+ } | undefined;
326
+ $CHANGE_ROLES?: {
327
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
328
+ addedAt: number;
329
+ } | undefined;
308
330
  }>;
309
331
  lastModified: number | null;
310
332
  }, {
@@ -317,7 +339,7 @@ declare const CompanyDetails: z.ZodObject<{
317
339
  lastModified: number | null;
318
340
  };
319
341
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
320
- totalAppts: number;
342
+ appointmentCounter: Record<"ongoing" | "completed", number>;
321
343
  lastActive: number;
322
344
  name: Record<"first" | "last", string>;
323
345
  email: string;
@@ -325,9 +347,17 @@ declare const CompanyDetails: z.ZodObject<{
325
347
  photoUrl?: string | null | undefined;
326
348
  phoneNumber?: string | undefined;
327
349
  }>;
328
- partnerMap: Record<string, string[]>;
329
- blackList: Record<string, {
350
+ partnerMap: Record<string, Record<string, {
330
351
  addedAt: number;
352
+ }>>;
353
+ updateQueue: Record<string, {
354
+ $REMOVE?: {
355
+ addedAt: number;
356
+ } | undefined;
357
+ $CHANGE_ROLES?: {
358
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
359
+ addedAt: number;
360
+ } | undefined;
331
361
  }>;
332
362
  lastModified: number | null;
333
363
  }>> | z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
@@ -351,7 +381,7 @@ declare const CompanyDetails: z.ZodObject<{
351
381
  cshr: "cshr";
352
382
  admin: "admin";
353
383
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
354
- totalAppts: z.ZodInt;
384
+ appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
355
385
  lastActive: z.ZodInt;
356
386
  name: z.ZodRecord<z.ZodEnum<{
357
387
  first: "first";
@@ -361,9 +391,23 @@ declare const CompanyDetails: z.ZodObject<{
361
391
  email: z.ZodEmail;
362
392
  phoneNumber: z.ZodOptional<z.ZodString>;
363
393
  }, z.core.$strip>>;
364
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
365
- blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
394
+ partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
366
395
  addedAt: z.ZodInt;
396
+ }, z.core.$strip>>>;
397
+ updateQueue: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
398
+ $REMOVE: z.ZodOptional<z.ZodObject<{
399
+ addedAt: z.ZodInt;
400
+ }, z.core.$strip>>;
401
+ $CHANGE_ROLES: z.ZodOptional<z.ZodObject<{
402
+ newRoles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
403
+ doc: "doc";
404
+ physAsst: "physAsst";
405
+ rcpst: "rcpst";
406
+ cshr: "cshr";
407
+ admin: "admin";
408
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
409
+ addedAt: z.ZodInt;
410
+ }, z.core.$strip>>;
367
411
  }, z.core.$strip>>;
368
412
  lastModified: z.ZodNullable<z.ZodInt>;
369
413
  }, z.core.$strip>, z.ZodTransform<{
@@ -376,7 +420,7 @@ declare const CompanyDetails: z.ZodObject<{
376
420
  lastModified: number | null;
377
421
  };
378
422
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
379
- totalAppts: number;
423
+ appointmentCounter: Record<"ongoing" | "completed", number>;
380
424
  lastActive: number;
381
425
  name: Record<"first" | "last", string>;
382
426
  email: string;
@@ -384,9 +428,17 @@ declare const CompanyDetails: z.ZodObject<{
384
428
  photoUrl?: string | null | undefined;
385
429
  phoneNumber?: string | undefined;
386
430
  }>;
387
- partnerMap: Record<string, string[]>;
388
- blackList: Record<string, {
431
+ partnerMap: Record<string, Record<string, {
389
432
  addedAt: number;
433
+ }>>;
434
+ updateQueue: Record<string, {
435
+ $REMOVE?: {
436
+ addedAt: number;
437
+ } | undefined;
438
+ $CHANGE_ROLES?: {
439
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
440
+ addedAt: number;
441
+ } | undefined;
390
442
  }>;
391
443
  lastModified: number | null;
392
444
  }, {
@@ -399,7 +451,7 @@ declare const CompanyDetails: z.ZodObject<{
399
451
  lastModified: number | null;
400
452
  };
401
453
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
402
- totalAppts: number;
454
+ appointmentCounter: Record<"ongoing" | "completed", number>;
403
455
  lastActive: number;
404
456
  name: Record<"first" | "last", string>;
405
457
  email: string;
@@ -407,9 +459,17 @@ declare const CompanyDetails: z.ZodObject<{
407
459
  photoUrl?: string | null | undefined;
408
460
  phoneNumber?: string | undefined;
409
461
  }>;
410
- partnerMap: Record<string, string[]>;
411
- blackList: Record<string, {
462
+ partnerMap: Record<string, Record<string, {
412
463
  addedAt: number;
464
+ }>>;
465
+ updateQueue: Record<string, {
466
+ $REMOVE?: {
467
+ addedAt: number;
468
+ } | undefined;
469
+ $CHANGE_ROLES?: {
470
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
471
+ addedAt: number;
472
+ } | undefined;
413
473
  }>;
414
474
  lastModified: number | null;
415
475
  }>>>>;
@@ -541,7 +601,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
541
601
  }, z.core.$strip>>>;
542
602
  lastModified: z.ZodNullable<z.ZodInt>;
543
603
  }, z.core.$strip>>>;
544
- staffDetails: z.ZodPipe<z.ZodObject<{
604
+ staff: z.ZodPipe<z.ZodObject<{
545
605
  members: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
546
606
  createdAt: z.ZodReadonly<z.ZodInt>;
547
607
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -562,7 +622,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
562
622
  cshr: "cshr";
563
623
  admin: "admin";
564
624
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
565
- totalAppts: z.ZodInt;
625
+ appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
566
626
  lastActive: z.ZodInt;
567
627
  name: z.ZodRecord<z.ZodEnum<{
568
628
  first: "first";
@@ -572,9 +632,23 @@ declare const PartialCompanyDetails: z.ZodObject<{
572
632
  email: z.ZodEmail;
573
633
  phoneNumber: z.ZodOptional<z.ZodString>;
574
634
  }, z.core.$strip>>;
575
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
576
- blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
635
+ partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
577
636
  addedAt: z.ZodInt;
637
+ }, z.core.$strip>>>;
638
+ updateQueue: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
639
+ $REMOVE: z.ZodOptional<z.ZodObject<{
640
+ addedAt: z.ZodInt;
641
+ }, z.core.$strip>>;
642
+ $CHANGE_ROLES: z.ZodOptional<z.ZodObject<{
643
+ newRoles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
644
+ doc: "doc";
645
+ physAsst: "physAsst";
646
+ rcpst: "rcpst";
647
+ cshr: "cshr";
648
+ admin: "admin";
649
+ }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
650
+ addedAt: z.ZodInt;
651
+ }, z.core.$strip>>;
578
652
  }, z.core.$strip>>;
579
653
  lastModified: z.ZodNullable<z.ZodInt>;
580
654
  }, z.core.$strip>, z.ZodTransform<{
@@ -587,7 +661,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
587
661
  lastModified: number | null;
588
662
  };
589
663
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
590
- totalAppts: number;
664
+ appointmentCounter: Record<"ongoing" | "completed", number>;
591
665
  lastActive: number;
592
666
  name: Record<"first" | "last", string>;
593
667
  email: string;
@@ -595,9 +669,17 @@ declare const PartialCompanyDetails: z.ZodObject<{
595
669
  photoUrl?: string | null | undefined;
596
670
  phoneNumber?: string | undefined;
597
671
  }>;
598
- partnerMap: Record<string, string[]>;
599
- blackList: Record<string, {
672
+ partnerMap: Record<string, Record<string, {
600
673
  addedAt: number;
674
+ }>>;
675
+ updateQueue: Record<string, {
676
+ $REMOVE?: {
677
+ addedAt: number;
678
+ } | undefined;
679
+ $CHANGE_ROLES?: {
680
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
681
+ addedAt: number;
682
+ } | undefined;
601
683
  }>;
602
684
  lastModified: number | null;
603
685
  }, {
@@ -610,7 +692,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
610
692
  lastModified: number | null;
611
693
  };
612
694
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
613
- totalAppts: number;
695
+ appointmentCounter: Record<"ongoing" | "completed", number>;
614
696
  lastActive: number;
615
697
  name: Record<"first" | "last", string>;
616
698
  email: string;
@@ -618,9 +700,17 @@ declare const PartialCompanyDetails: z.ZodObject<{
618
700
  photoUrl?: string | null | undefined;
619
701
  phoneNumber?: string | undefined;
620
702
  }>;
621
- partnerMap: Record<string, string[]>;
622
- blackList: Record<string, {
703
+ partnerMap: Record<string, Record<string, {
623
704
  addedAt: number;
705
+ }>>;
706
+ updateQueue: Record<string, {
707
+ $REMOVE?: {
708
+ addedAt: number;
709
+ } | undefined;
710
+ $CHANGE_ROLES?: {
711
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
712
+ addedAt: number;
713
+ } | undefined;
624
714
  }>;
625
715
  lastModified: number | null;
626
716
  }>> | z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
@@ -644,7 +734,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
644
734
  cshr: "cshr";
645
735
  admin: "admin";
646
736
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
647
- totalAppts: z.ZodInt;
737
+ appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
648
738
  lastActive: z.ZodInt;
649
739
  name: z.ZodRecord<z.ZodEnum<{
650
740
  first: "first";
@@ -654,9 +744,23 @@ declare const PartialCompanyDetails: z.ZodObject<{
654
744
  email: z.ZodEmail;
655
745
  phoneNumber: z.ZodOptional<z.ZodString>;
656
746
  }, z.core.$strip>>;
657
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
658
- blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
747
+ partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
659
748
  addedAt: z.ZodInt;
749
+ }, z.core.$strip>>>;
750
+ updateQueue: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
751
+ $REMOVE: z.ZodOptional<z.ZodObject<{
752
+ addedAt: z.ZodInt;
753
+ }, z.core.$strip>>;
754
+ $CHANGE_ROLES: z.ZodOptional<z.ZodObject<{
755
+ newRoles: 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")[]>>;
762
+ addedAt: z.ZodInt;
763
+ }, z.core.$strip>>;
660
764
  }, z.core.$strip>>;
661
765
  lastModified: z.ZodNullable<z.ZodInt>;
662
766
  }, z.core.$strip>, z.ZodTransform<{
@@ -669,7 +773,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
669
773
  lastModified: number | null;
670
774
  };
671
775
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
672
- totalAppts: number;
776
+ appointmentCounter: Record<"ongoing" | "completed", number>;
673
777
  lastActive: number;
674
778
  name: Record<"first" | "last", string>;
675
779
  email: string;
@@ -677,9 +781,17 @@ declare const PartialCompanyDetails: z.ZodObject<{
677
781
  photoUrl?: string | null | undefined;
678
782
  phoneNumber?: string | undefined;
679
783
  }>;
680
- partnerMap: Record<string, string[]>;
681
- blackList: Record<string, {
784
+ partnerMap: Record<string, Record<string, {
682
785
  addedAt: number;
786
+ }>>;
787
+ updateQueue: Record<string, {
788
+ $REMOVE?: {
789
+ addedAt: number;
790
+ } | undefined;
791
+ $CHANGE_ROLES?: {
792
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
793
+ addedAt: number;
794
+ } | undefined;
683
795
  }>;
684
796
  lastModified: number | null;
685
797
  }, {
@@ -692,7 +804,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
692
804
  lastModified: number | null;
693
805
  };
694
806
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
695
- totalAppts: number;
807
+ appointmentCounter: Record<"ongoing" | "completed", number>;
696
808
  lastActive: number;
697
809
  name: Record<"first" | "last", string>;
698
810
  email: string;
@@ -700,9 +812,17 @@ declare const PartialCompanyDetails: z.ZodObject<{
700
812
  photoUrl?: string | null | undefined;
701
813
  phoneNumber?: string | undefined;
702
814
  }>;
703
- partnerMap: Record<string, string[]>;
704
- blackList: Record<string, {
815
+ partnerMap: Record<string, Record<string, {
705
816
  addedAt: number;
817
+ }>>;
818
+ updateQueue: Record<string, {
819
+ $REMOVE?: {
820
+ addedAt: number;
821
+ } | undefined;
822
+ $CHANGE_ROLES?: {
823
+ newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
824
+ addedAt: number;
825
+ } | undefined;
706
826
  }>;
707
827
  lastModified: number | null;
708
828
  }>>>>;
@@ -741,11 +861,21 @@ declare const employeeRoles: z.ZodEnum<{
741
861
  cshr: "cshr";
742
862
  }>;
743
863
  type EmployeeRole = z.infer<typeof employeeRoles>;
864
+ declare const healthcareProviderRoles: z.ZodEnum<{
865
+ doc: "doc";
866
+ physAsst: "physAsst";
867
+ }>;
868
+ type HealthcareProviderRole = z.infer<typeof healthcareProviderRoles>;
744
869
  declare const appointmentDistAlgs: z.ZodEnum<{
745
870
  RR: "RR";
746
871
  LOR: "LOR";
747
872
  }>;
748
873
  type AppointmentDistAlg = z.infer<typeof appointmentDistAlgs>;
874
+ declare const companyServiceSelectors: z.ZodEnum<{
875
+ scheduler: "scheduler";
876
+ doctor: "doctor";
877
+ }>;
878
+ type CompanyServiceSelector = z.infer<typeof companyServiceSelectors>;
749
879
 
750
880
  /**@returns an array of the users that have conflicting roles or are incompatible with the other partners, or null if none was found. */
751
881
  declare const findConflictingPartners: (...partners: CompanyUser[]) => {
@@ -757,7 +887,7 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
757
887
  lastModified: number | null;
758
888
  };
759
889
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
760
- totalAppts: number;
890
+ appointmentCounter: Record<"ongoing" | "completed", number>;
761
891
  lastActive: number;
762
892
  name: Record<"first" | "last", string>;
763
893
  email: string;
@@ -768,4 +898,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
768
898
  /**@returns the roles that are compatible with the selected role. */
769
899
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
770
900
 
771
- export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, InvoiceNo, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles };
901
+ export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, CompanyRegistrationClaims, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InvoiceNo, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
package/dist/main.js CHANGED
@@ -74,7 +74,12 @@ var companyPartnerRoles = companyUserRoles.extract([
74
74
  "physAsst"
75
75
  ]);
76
76
  var employeeRoles = companyUserRoles.exclude(["admin"]);
77
+ var healthcareProviderRoles = companyUserRoles.extract([
78
+ "physAsst",
79
+ "doc"
80
+ ]);
77
81
  var appointmentDistAlgs = z3.enum(["RR", "LOR"]);
82
+ var companyServiceSelectors = z3.enum(["scheduler", "doctor"]);
78
83
 
79
84
  // src/schemas/Company.ts
80
85
  var RegisterCompanyForm = z4.object({
@@ -107,13 +112,15 @@ var CompanyUser = z4.object({
107
112
  }
108
113
  return newRoles.sort();
109
114
  }).refine((roles) => {
110
- const compatibleRoles = getCompatibleRoles(roles[0]);
111
115
  return roles.every(
112
- (role, i) => i === 0 || compatibleRoles.includes(role)
116
+ (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
113
117
  );
114
118
  }, "A user is not allowed to have conflicting roles."),
115
119
  /** This should reset at the end of every cycle. */
116
- totalAppts: z4.int().min(0),
120
+ appointmentCounter: z4.record(
121
+ z4.literal(["ongoing", "completed"]),
122
+ z4.int().min(0)
123
+ ),
117
124
  lastActive: Timestamp,
118
125
  ...TimeLog.shape
119
126
  }).superRefine((data, ctx) => {
@@ -126,7 +133,7 @@ var CompanyUser = z4.object({
126
133
  );
127
134
  }
128
135
  });
129
- var CompanyIdentity = z4.object({
136
+ var IdentityDetails = z4.object({
130
137
  displayName: z4.string().min(3).max(20),
131
138
  logo: z4.string().max(2500).nullish(),
132
139
  contact: z4.object({
@@ -142,7 +149,7 @@ var CompanyIdentity = z4.object({
142
149
  }),
143
150
  lastModified: Timestamp.nullable()
144
151
  });
145
- var CompanyState = z4.object({
152
+ var StateDetails = z4.object({
146
153
  // This can only be changed by the server/app admin
147
154
  availableBalance: z4.number(),
148
155
  /**
@@ -158,7 +165,7 @@ var CompanyState = z4.object({
158
165
  tktNoCounter: z4.int().min(1),
159
166
  lastModified: Timestamp.nullable()
160
167
  });
161
- var CompanyPreferences = z4.object({
168
+ var PreferenceDetails = z4.object({
162
169
  /** The amount of user provisions made for this company */
163
170
  userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
164
171
  (p) => !(p > 1 && p < 10),
@@ -171,12 +178,12 @@ var CompanyPreferences = z4.object({
171
178
  apptDistAlg: appointmentDistAlgs.default("RR"),
172
179
  lastModified: Timestamp.nullable()
173
180
  });
174
- var CompanyBillingModel = z4.object({
181
+ var BillingDetails = z4.object({
175
182
  preferences: z4.object({
176
183
  /** Forces service selectors to use the list of service(s) that you've created. */
177
184
  useCreatedServices: z4.boolean(),
178
185
  /** The user that's allowed to record the client's services. */
179
- serviceSelector: z4.enum(["scheduler", "doctor"]),
186
+ serviceSelector: companyServiceSelectors,
180
187
  /** A record of the payments made must be attached before creating the
181
188
  * appointment
182
189
  * @note
@@ -233,63 +240,76 @@ var StaffDetails = z4.object({
233
240
  *@description A map of doctor `uids` to their assistants `uids` */
234
241
  partnerMap: z4.record(
235
242
  CompanyUser.shape.uid,
236
- z4.array(CompanyUser.shape.uid).transform((pUids) => {
237
- const partners = [];
238
- for (const uid of pUids) {
239
- if (!uid || typeof uid !== "string") continue;
240
- if (!partners.some((p) => p.toLowerCase() === uid.toLowerCase())) {
241
- partners.push(uid);
242
- }
243
- }
244
- return partners.sort();
245
- })
243
+ z4.record(CompanyUser.shape.uid, z4.object({ addedAt: Timestamp }))
246
244
  ),
247
- blackList: z4.record(
245
+ updateQueue: z4.record(
248
246
  CompanyUser.shape.uid,
249
- z4.object({ addedAt: Timestamp })
247
+ z4.object({
248
+ $REMOVE: z4.object({ addedAt: Timestamp }),
249
+ $CHANGE_ROLES: z4.object({
250
+ newRoles: CompanyUser.shape.roles,
251
+ addedAt: Timestamp
252
+ })
253
+ }).partial()
250
254
  ),
251
255
  lastModified: Timestamp.nullable()
252
256
  }).transform((d) => {
253
257
  const copy = structuredClone(d);
254
- for (const uid of Object.keys(copy.blackList)) {
255
- if (uid in copy.members) continue;
256
- delete copy.blackList[uid];
258
+ for (const uid of Object.keys(copy.updateQueue)) {
259
+ if (uid in copy.members) {
260
+ const user = copy.updateQueue[uid];
261
+ if ("$REMOVE" in user) {
262
+ copy.updateQueue[uid] = { $REMOVE: user.$REMOVE };
263
+ } else if (user.$CHANGE_ROLES && user.$CHANGE_ROLES.newRoles.length === copy.members[uid].roles.length && user.$CHANGE_ROLES.newRoles.every(
264
+ (role) => copy.members[uid].roles.includes(role)
265
+ )) {
266
+ delete copy.updateQueue[uid].$CHANGE_ROLES;
267
+ }
268
+ if (Object.keys(user).length < 1) delete copy.updateQueue[uid];
269
+ } else {
270
+ delete copy.updateQueue[uid];
271
+ }
272
+ }
273
+ for (const [docUid, assts] of Object.entries(copy.partnerMap)) {
274
+ if (docUid in d.members) {
275
+ for (const asstUid of Object.keys(assts)) {
276
+ if (asstUid in d.members) continue;
277
+ delete copy.partnerMap[docUid][asstUid];
278
+ }
279
+ } else {
280
+ delete copy.partnerMap[docUid];
281
+ }
257
282
  }
258
283
  return copy;
259
284
  }).superRefine((details, ctx) => {
260
- for (const [docUid, physAssts] of Object.entries(details.partnerMap)) {
261
- const queriedDoc = details.members[docUid];
262
- if (!queriedDoc) {
285
+ for (const user of Object.values(details.members)) {
286
+ if (user.roles.includes("doc") && user.uid in details.partnerMap) {
287
+ for (const asstUid of Object.keys(details.partnerMap[user.uid])) {
288
+ if (!details.members[asstUid].roles.includes("physAsst")) {
289
+ ctx.addIssue(
290
+ `A partner group member must have the "physAsst" role (${user.uid}) -> (${asstUid}).`
291
+ );
292
+ }
293
+ }
294
+ } else if (user.uid in details.partnerMap) {
263
295
  ctx.addIssue(
264
- `Only existing members of a company are allowed to be leaders of a partner group (${docUid}).`
296
+ `A partner group leader must have the "doc" role. (${user.uid})`
265
297
  );
266
- } else if (!queriedDoc?.roles?.includes?.("doc")) {
298
+ } else if (user.roles.includes("doc")) {
267
299
  ctx.addIssue(
268
- `A partner group leader must have the "doc" role (${docUid}).`
300
+ `All users that have the "doc" role must be the leader of a partner group. (${user.uid})`
269
301
  );
270
302
  }
271
- for (const asstUid of physAssts) {
272
- const queriedAsst = details.members[asstUid];
273
- if (!queriedAsst) {
274
- ctx.addIssue(
275
- `Only existing members of a company are allowed to be apart of a partner group (${asstUid}).`
276
- );
277
- } else if (!queriedAsst?.roles?.includes?.("physAsst")) {
278
- ctx.addIssue(
279
- `A partner group member must have the "physAsst" role (${asstUid}).`
280
- );
281
- }
282
- }
283
303
  }
284
304
  });
285
305
  var createCompanyDetails = (options) => {
286
306
  return z4.object({
287
307
  uid: UuidV7,
288
- identity: CompanyIdentity,
289
- state: options.partial ? CompanyState.nullish() : CompanyState,
290
- preferences: options.partial ? CompanyPreferences.nullish() : CompanyPreferences,
291
- billing: options.partial ? CompanyBillingModel.nullish() : CompanyBillingModel,
292
- staffDetails: options.partial ? StaffDetails.nullish() : StaffDetails,
308
+ identity: IdentityDetails,
309
+ state: options.partial ? StateDetails.nullish() : StateDetails,
310
+ preferences: options.partial ? PreferenceDetails.nullish() : PreferenceDetails,
311
+ billing: options.partial ? BillingDetails.nullish() : BillingDetails,
312
+ staff: options.partial ? StaffDetails.nullish() : StaffDetails,
293
313
  createdAt: options.partial ? Timestamp.nullish() : Timestamp
294
314
  });
295
315
  };
@@ -343,8 +363,10 @@ export {
343
363
  UuidV7,
344
364
  appointmentDistAlgs,
345
365
  companyPartnerRoles,
366
+ companyServiceSelectors,
346
367
  companyUserRoles,
347
368
  employeeRoles,
348
369
  findConflictingPartners,
349
- getCompatibleRoles
370
+ getCompatibleRoles,
371
+ healthcareProviderRoles
350
372
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",