@bizmap/sdk 0.0.93 → 0.0.94

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 +27 -40
  2. package/dist/main.js +152 -156
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -70,12 +70,6 @@ declare const genders: z.ZodEnum<{
70
70
  female: "female";
71
71
  }>;
72
72
  type Gender = z.infer<typeof genders>;
73
- declare const nidClasses: z.ZodEnum<{
74
- passportNo: "passportNo";
75
- trn: "trn";
76
- nin: "nin";
77
- }>;
78
- type NidClass = z.infer<typeof nidClasses>;
79
73
  declare const acceptedCurrencies: z.ZodEnum<{
80
74
  JMD: "JMD";
81
75
  }>;
@@ -968,6 +962,7 @@ declare const Reason: z.ZodObject<{
968
962
  lastModified: z.ZodInt;
969
963
  }, z.core.$strip>;
970
964
  declare const Version: z.ZodInt;
965
+ declare const AlphaNumeric: z.ZodString;
971
966
 
972
967
  declare const PriceAdjustment: z.ZodObject<{
973
968
  createdAt: z.ZodReadonly<z.ZodInt>;
@@ -1050,17 +1045,14 @@ declare const ClientIdentity: z.ZodObject<{
1050
1045
  isGlobal: z.ZodBoolean;
1051
1046
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1052
1047
  nid: z.ZodOptional<z.ZodObject<{
1053
- class: z.ZodEnum<{
1054
- passportNo: "passportNo";
1055
- trn: "trn";
1056
- nin: "nin";
1057
- }>;
1058
- value: z.ZodString;
1048
+ trn: z.ZodOptional<z.ZodString>;
1049
+ nin: z.ZodOptional<z.ZodString>;
1050
+ passportNo: z.ZodOptional<z.ZodString>;
1059
1051
  }, z.core.$strip>>;
1060
1052
  attributes: z.ZodObject<{
1061
- mothersMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1062
- fathersMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1063
- mothersMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1053
+ motherMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1054
+ fatherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1055
+ motherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1064
1056
  oldestSiblingMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1065
1057
  firstSchoolName: z.ZodOptional<z.ZodString>;
1066
1058
  }, z.core.$strip>;
@@ -1383,17 +1375,14 @@ declare const AppointmentDetails: z.ZodObject<{
1383
1375
  isGlobal: z.ZodBoolean;
1384
1376
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1385
1377
  nid: z.ZodOptional<z.ZodObject<{
1386
- class: z.ZodEnum<{
1387
- passportNo: "passportNo";
1388
- trn: "trn";
1389
- nin: "nin";
1390
- }>;
1391
- value: z.ZodString;
1378
+ trn: z.ZodOptional<z.ZodString>;
1379
+ nin: z.ZodOptional<z.ZodString>;
1380
+ passportNo: z.ZodOptional<z.ZodString>;
1392
1381
  }, z.core.$strip>>;
1393
1382
  attributes: z.ZodObject<{
1394
- mothersMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1395
- fathersMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1396
- mothersMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1383
+ motherMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1384
+ fatherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1385
+ motherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1397
1386
  oldestSiblingMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1398
1387
  firstSchoolName: z.ZodOptional<z.ZodString>;
1399
1388
  }, z.core.$strip>;
@@ -1564,17 +1553,14 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1564
1553
  isGlobal: z.ZodBoolean;
1565
1554
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1566
1555
  nid: z.ZodOptional<z.ZodObject<{
1567
- class: z.ZodEnum<{
1568
- passportNo: "passportNo";
1569
- trn: "trn";
1570
- nin: "nin";
1571
- }>;
1572
- value: z.ZodString;
1556
+ trn: z.ZodOptional<z.ZodString>;
1557
+ nin: z.ZodOptional<z.ZodString>;
1558
+ passportNo: z.ZodOptional<z.ZodString>;
1573
1559
  }, z.core.$strip>>;
1574
1560
  attributes: z.ZodObject<{
1575
- mothersMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1576
- fathersMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1577
- mothersMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1561
+ motherMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1562
+ fatherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1563
+ motherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1578
1564
  oldestSiblingMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1579
1565
  firstSchoolName: z.ZodOptional<z.ZodString>;
1580
1566
  }, z.core.$strip>;
@@ -1786,9 +1772,9 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1786
1772
  isGlobal: boolean;
1787
1773
  origin: string;
1788
1774
  attributes: {
1789
- mothersMaidenName?: string | undefined;
1790
- fathersMiddleName?: string | undefined;
1791
- mothersMiddleName?: string | undefined;
1775
+ motherMaidenName?: string | undefined;
1776
+ fatherMiddleName?: string | undefined;
1777
+ motherMiddleName?: string | undefined;
1792
1778
  oldestSiblingMiddleName?: string | undefined;
1793
1779
  firstSchoolName?: string | undefined;
1794
1780
  };
@@ -1797,8 +1783,9 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1797
1783
  photoUrl?: string | null | undefined;
1798
1784
  email?: string | undefined;
1799
1785
  nid?: {
1800
- class: "passportNo" | "trn" | "nin";
1801
- value: string;
1786
+ trn?: string | undefined;
1787
+ nin?: string | undefined;
1788
+ passportNo?: string | undefined;
1802
1789
  } | undefined;
1803
1790
  address?: {
1804
1791
  streetAddress: string;
@@ -1918,7 +1905,7 @@ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyU
1918
1905
  * */
1919
1906
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
1920
1907
  declare const normalizeCompanyId: (id: string) => string;
1921
- declare const normalizeNidClass: (value: NidClass) => string;
1908
+ declare const normalizeNidKey: (value: keyof NonNullable<ClientIdentity["nid"]>) => string;
1922
1909
  declare const parseClientName: ({ firstName, middleName, lastName, }: Pick<ClientIdentity, "firstName" | "middleName" | "lastName">) => string;
1923
1910
 
1924
1911
  declare function createNotifId(options?: {
@@ -1926,4 +1913,4 @@ declare function createNotifId(options?: {
1926
1913
  to: string;
1927
1914
  }): string;
1928
1915
 
1929
- export { type AcceptedCurrency, AppointmentDetails, type AppointmentDistAlg, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, type Industry, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, type NidClass, Notification, PaymentDetails, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, acceptedCurrencies, adminRoles, appointmentDistAlgs, calcAppointmentFee, companyPartnerRoles, companyServiceSelectors, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, healthcareProviderRoles, industries, nidClasses, normalizeCompanyId, normalizeNidClass, parseClientName, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
1916
+ export { type AcceptedCurrency, AlphaNumeric, AppointmentDetails, type AppointmentDistAlg, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, type Industry, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, PaymentDetails, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, acceptedCurrencies, adminRoles, appointmentDistAlgs, calcAppointmentFee, companyPartnerRoles, companyServiceSelectors, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, healthcareProviderRoles, industries, normalizeCompanyId, normalizeNidKey, parseClientName, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -33,7 +33,6 @@ import * as z2 from "zod";
33
33
  var tiers = z2.enum(["basic", "pro", "premium", "gold"]);
34
34
  var paymentMethods = z2.enum(["cash", "card", "insurance"]);
35
35
  var genders = z2.enum(["male", "female"]);
36
- var nidClasses = z2.enum(["passportNo", "trn", "nin"]);
37
36
  var acceptedCurrencies = currencies.extract(["JMD"]);
38
37
 
39
38
  // src/enums/Medical.ts
@@ -56,7 +55,7 @@ var serviceProviders = z4.enum([
56
55
  ]);
57
56
 
58
57
  // src/schemas/company/CompanyDetails.ts
59
- import * as z16 from "zod";
58
+ import * as z17 from "zod";
60
59
 
61
60
  // src/schemas/company/components/Billing.ts
62
61
  import * as z8 from "zod";
@@ -99,6 +98,13 @@ var Reason = z5.object({
99
98
  lastModified: Timestamp
100
99
  });
101
100
  var Version = z5.int().min(1);
101
+ var AlphaNumeric = z5.string().trim().superRefine((data, ctx) => {
102
+ const invalidCharIdx = data.search(/[^a-z0-9]/i);
103
+ if (invalidCharIdx > -1) {
104
+ const char = `"'`.includes(data[invalidCharIdx]) ? `(${data[invalidCharIdx]})` : `"${data[invalidCharIdx]}"`;
105
+ ctx.addIssue(`${char} is not an alpha-numeric character.`);
106
+ }
107
+ });
102
108
 
103
109
  // src/schemas/utils/billing.ts
104
110
  var PriceAdjustment = z6.object({
@@ -413,13 +419,104 @@ var MutableCompanyPreferences = CompanyPreferences.omit({
413
419
  });
414
420
 
415
421
  // src/schemas/company/components/Staff.ts
416
- import * as z15 from "zod";
422
+ import * as z16 from "zod";
417
423
 
418
424
  // src/schemas/company/components/User.ts
419
- import * as z14 from "zod";
425
+ import * as z15 from "zod";
420
426
 
421
427
  // src/functions/helper-functions.ts
422
428
  import { camelCaseToLetter, upperFirst as upperFirst2 } from "@wavy/fn";
429
+
430
+ // src/schemas/profiles/Client.ts
431
+ import * as z14 from "zod";
432
+
433
+ // src/schemas/profiles/User.ts
434
+ import { UserModel } from "@wavy/util";
435
+ import * as z13 from "zod";
436
+ var UserDetails = z13.object({
437
+ ...UserModel.shape,
438
+ _id: z13.uuidv4(),
439
+ name: z13.string().transform((data) => {
440
+ const [firstName = "", lastName = ""] = data.split(" ");
441
+ return (firstName + " " + lastName).trim();
442
+ }).superRefine((data, ctx) => {
443
+ data.split(" ").forEach((name, idx) => {
444
+ const nty = idx === 0 ? "First" : "Last";
445
+ if (idx === 0 && name.length < 2) {
446
+ ctx.addIssue(`${nty} name must have at least (2) characters.`);
447
+ }
448
+ if (name.length > MAX_NAME_LENGTH) {
449
+ ctx.addIssue(`${nty} name can't have more than (${MAX_NAME_LENGTH}) characters.`);
450
+ }
451
+ });
452
+ }),
453
+ email: UserModel.shape.email,
454
+ publicKey: z13.string().nullable(),
455
+ notifications: z13.array(Notification),
456
+ version: Version,
457
+ companyUids: z13.array(CompanyState.shape._id).min(1).optional(),
458
+ resumeToken: z13.uuidv4().optional(),
459
+ ...TimeLog.shape
460
+ }).omit({ uid: true });
461
+
462
+ // src/schemas/profiles/Client.ts
463
+ import { Address as Address2 } from "@wavy/util";
464
+ var Name = z14.string().trim().min(2).max(MAX_NAME_LENGTH).transform((d) => d.replace(/-+/g, "-").replace(/'+/g, "'")).superRefine((data, ctx) => {
465
+ const invalidCharIdx = data.search(/[^a-z'-]/i);
466
+ if (invalidCharIdx >= 0) {
467
+ const char = data[invalidCharIdx].includes('"') ? `(${data[invalidCharIdx]})` : `"${data[invalidCharIdx]}"`;
468
+ ctx.addIssue(`${char} is not an allowed character.`);
469
+ }
470
+ });
471
+ var ClientIdentity = UserDetails.pick({
472
+ _id: true,
473
+ createdAt: true,
474
+ lastModified: true,
475
+ phoneNumber: true,
476
+ version: true,
477
+ photoUrl: true
478
+ }).safeExtend(
479
+ z14.object({
480
+ firstName: Name,
481
+ middleName: Name,
482
+ lastName: Name,
483
+ email: UserDetails.shape.email.optional(),
484
+ dob: Timestamp,
485
+ sex: genders,
486
+ isGlobal: z14.boolean(),
487
+ origin: CompanyIdentity.shape._id,
488
+ // aka. National id
489
+ nid: z14.object({
490
+ trn: Trn,
491
+ nin: AlphaNumeric.toLowerCase().min(5).max(20),
492
+ passportNo: AlphaNumeric.toLowerCase().min(5).max(15)
493
+ }).partial().optional(),
494
+ // Don't hash the attributes, they can be used to help accurately identify a client by whoever is searching for
495
+ // the client
496
+ attributes: z14.object({
497
+ motherMaidenName: Name,
498
+ fatherMiddleName: Name,
499
+ motherMiddleName: Name,
500
+ oldestSiblingMiddleName: Name,
501
+ firstSchoolName: z14.string().trim().min(3).max(60)
502
+ // nickname: z.string().trim().min(1).max(40),
503
+ }).partial().refine(
504
+ (data) => Object.keys(data).length > 0,
505
+ "At least (1) attribute must be defined."
506
+ ),
507
+ address: Address2.optional(),
508
+ linkedTo: UserDetails.shape._id.optional()
509
+ }).shape
510
+ );
511
+ var ClientForm = ClientIdentity.pick({
512
+ firstName: true,
513
+ middleName: true,
514
+ lastName: true,
515
+ dob: true,
516
+ sex: true
517
+ }).required();
518
+
519
+ // src/functions/helper-functions.ts
423
520
  var findConflictingPartners = (...partners) => {
424
521
  let hasSingleDoctor = false;
425
522
  const conflicts = [];
@@ -452,8 +549,8 @@ var getCompatibleRoles = (role) => {
452
549
  var normalizeCompanyId = (id) => {
453
550
  return id.split("-").map((value) => upperFirst2(value.toLowerCase())).join(" ");
454
551
  };
455
- var normalizeNidClass = (value) => {
456
- value = nidClasses.parse(value);
552
+ var normalizeNidKey = (value) => {
553
+ value = ClientIdentity.shape.nid.unwrap().keyof().parse(value);
457
554
  if (value === "nin") return "National Id No.";
458
555
  if (value === "trn") return "Tax Registration No.";
459
556
  return camelCaseToLetter(value.replace("No", "No."));
@@ -464,51 +561,22 @@ var parseClientName = ({
464
561
  lastName
465
562
  }) => [firstName, middleName[0] + ".", lastName].join(" ");
466
563
 
467
- // src/schemas/profiles/User.ts
468
- import { UserModel } from "@wavy/util";
469
- import * as z13 from "zod";
470
- var UserDetails = z13.object({
471
- ...UserModel.shape,
472
- _id: z13.uuidv4(),
473
- name: z13.string().transform((data) => {
474
- const [firstName = "", lastName = ""] = data.split(" ");
475
- return (firstName + " " + lastName).trim();
476
- }).superRefine((data, ctx) => {
477
- data.split(" ").forEach((name, idx) => {
478
- const nty = idx === 0 ? "First" : "Last";
479
- if (idx === 0 && name.length < 2) {
480
- ctx.addIssue(`${nty} name must have at least (2) characters.`);
481
- }
482
- if (name.length > MAX_NAME_LENGTH) {
483
- ctx.addIssue(`${nty} name can't have more than (${MAX_NAME_LENGTH}) characters.`);
484
- }
485
- });
486
- }),
487
- email: UserModel.shape.email,
488
- publicKey: z13.string().nullable(),
489
- notifications: z13.array(Notification),
490
- version: Version,
491
- companyUids: z13.array(CompanyState.shape._id).min(1).optional(),
492
- resumeToken: z13.uuidv4().optional(),
493
- ...TimeLog.shape
494
- }).omit({ uid: true });
495
-
496
564
  // src/schemas/company/components/User.ts
497
- var CompanyUserSession = z14.object({
498
- _id: z14.uuidv4(),
565
+ var CompanyUserSession = z15.object({
566
+ _id: z15.uuidv4(),
499
567
  user: UserDetails.pick({ _id: true, name: true, email: true }),
500
568
  companyId: CompanyState.shape._id,
501
- deviceId: z14.string().trim().min(15),
502
- isAvailable: z14.object({
503
- value: z14.boolean(),
569
+ deviceId: z15.string().trim().min(15),
570
+ isAvailable: z15.object({
571
+ value: z15.boolean(),
504
572
  lastModified: Timestamp.nullable()
505
573
  }),
506
- isBusy: z14.object({
507
- value: z14.boolean(),
574
+ isBusy: z15.object({
575
+ value: z15.boolean(),
508
576
  lastModified: Timestamp.nullable()
509
577
  }),
510
- appointments: z14.record(z14.literal(["ongoing", "completed"]), z14.int().min(0)),
511
- roles: z14.array(companyUserRoles).transform((roles) => {
578
+ appointments: z15.record(z15.literal(["ongoing", "completed"]), z15.int().min(0)),
579
+ roles: z15.array(companyUserRoles).transform((roles) => {
512
580
  const newRoles = [];
513
581
  for (const role of roles) {
514
582
  if (!!role && !newRoles.includes(role)) newRoles.push(role);
@@ -519,11 +587,11 @@ var CompanyUserSession = z14.object({
519
587
  (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
520
588
  );
521
589
  }, "A user is not allowed to have conflicting roles."),
522
- ttl: z14.number(),
590
+ ttl: z15.number(),
523
591
  lastModified: Timestamp.nullable(),
524
- expiresAfter: z14.date()
592
+ expiresAfter: z15.date()
525
593
  });
526
- var MiniCompanyUser2 = z14.object({
594
+ var MiniCompanyUser2 = z15.object({
527
595
  _id: UserDetails.shape._id,
528
596
  ...CompanyUserSession.pick({
529
597
  roles: true,
@@ -537,7 +605,7 @@ var MiniCompanyUser2 = z14.object({
537
605
  inviteSent: Timestamp.nullish(),
538
606
  inviteAccepted: Timestamp.nullable()
539
607
  });
540
- var CompanyUser = z14.object({
608
+ var CompanyUser = z15.object({
541
609
  ...MiniCompanyUser2.shape,
542
610
  ...CompanyUserSession.shape.user.shape,
543
611
  // Determined based on:
@@ -548,9 +616,9 @@ var CompanyUser = z14.object({
548
616
  });
549
617
 
550
618
  // src/schemas/company/components/Staff.ts
551
- var MiniRawCompanyStaff = z15.object({
619
+ var MiniRawCompanyStaff = z16.object({
552
620
  _id: CompanyState.shape._id,
553
- members: z15.record(
621
+ members: z16.record(
554
622
  MiniCompanyUser2.shape._id,
555
623
  MiniCompanyUser2.omit({ _id: true })
556
624
  ),
@@ -558,15 +626,15 @@ var MiniRawCompanyStaff = z15.object({
558
626
  /**
559
627
  * @relationship one -> many
560
628
  *@description A map of doctor `uids` to their assistants `uids` */
561
- partnerMap: z15.record(
629
+ partnerMap: z16.record(
562
630
  CompanyUser.shape._id,
563
- z15.record(CompanyUser.shape._id, z15.object({ addedAt: Timestamp }))
631
+ z16.record(CompanyUser.shape._id, z16.object({ addedAt: Timestamp }))
564
632
  ),
565
- updateQueue: z15.record(
633
+ updateQueue: z16.record(
566
634
  CompanyUser.shape._id,
567
- z15.object({
568
- $REMOVE: z15.object({ addedAt: Timestamp }),
569
- $CHANGE_ROLES: z15.object({
635
+ z16.object({
636
+ $REMOVE: z16.object({ addedAt: Timestamp }),
637
+ $CHANGE_ROLES: z16.object({
570
638
  newRoles: CompanyUser.shape.roles,
571
639
  addedAt: Timestamp
572
640
  })
@@ -575,9 +643,9 @@ var MiniRawCompanyStaff = z15.object({
575
643
  version: Version,
576
644
  lastModified: Timestamp.nullable()
577
645
  });
578
- var RawCompanyStaff = z15.object({
646
+ var RawCompanyStaff = z16.object({
579
647
  ...MiniRawCompanyStaff.shape,
580
- members: z15.record(CompanyUser.shape._id, CompanyUser.omit({ _id: true }))
648
+ members: z16.record(CompanyUser.shape._id, CompanyUser.omit({ _id: true }))
581
649
  });
582
650
  var transformStaff = (object17) => {
583
651
  return object17.transform((d) => {
@@ -638,7 +706,7 @@ var MutableCompanyStaff = RawCompanyStaff.pick({
638
706
  });
639
707
 
640
708
  // src/schemas/company/CompanyDetails.ts
641
- var CompanyDetails = z16.object({
709
+ var CompanyDetails = z17.object({
642
710
  _id: CompanyState.shape._id,
643
711
  identity: CompanyIdentity.omit({ _id: true }),
644
712
  notifications: CompanyNotifications,
@@ -648,7 +716,7 @@ var CompanyDetails = z16.object({
648
716
  billing: CompanyBilling.omit({ _id: true }),
649
717
  staff: RawCompanyStaff.omit({ _id: true })
650
718
  });
651
- var MutableCompanyDetails = z16.object({
719
+ var MutableCompanyDetails = z17.object({
652
720
  _id: CompanyDetails.shape._id,
653
721
  identity: MutableCompanyIdentity.partial().optional(),
654
722
  preferences: MutableCompanyPreferences.partial().optional(),
@@ -657,18 +725,18 @@ var MutableCompanyDetails = z16.object({
657
725
  });
658
726
 
659
727
  // src/schemas/company/utils/InviteList.ts
660
- import * as z17 from "zod";
661
- var CompanyInviteList = z17.record(
728
+ import * as z18 from "zod";
729
+ var CompanyInviteList = z18.record(
662
730
  CompanyUser.shape.email,
663
- z17.object({ createdAt: Timestamp, roles: CompanyUser.shape.roles })
731
+ z18.object({ createdAt: Timestamp, roles: CompanyUser.shape.roles })
664
732
  ).refine(
665
733
  (data) => Object.keys(data).length > 0,
666
734
  "Insufficient amount of members invited."
667
735
  );
668
736
 
669
737
  // src/schemas/company/utils/CreateCompanyForm.ts
670
- import * as z18 from "zod";
671
- var CreateCompanyForm = z18.object({
738
+ import * as z19 from "zod";
739
+ var CreateCompanyForm = z19.object({
672
740
  domain: CompanyIdentity.shape._id,
673
741
  alias: CompanyIdentity.shape.alias.optional(),
674
742
  picture: CompanyIdentity.shape.logo,
@@ -683,112 +751,40 @@ var CreateCompanyForm = z18.object({
683
751
  });
684
752
 
685
753
  // src/schemas/appointment/components/Medical.ts
686
- import * as z19 from "zod";
687
- var Vitals = z19.record(
754
+ import * as z20 from "zod";
755
+ var Vitals = z20.record(
688
756
  vitalKeys,
689
- z19.object({
690
- value: z19.string().trim().regex(/^\d{0,3}((\/|\.)\d{1,3})?/),
757
+ z20.object({
758
+ value: z20.string().trim().regex(/^\d{0,3}((\/|\.)\d{1,3})?/),
691
759
  lastModified: Timestamp.nullable()
692
760
  })
693
761
  );
694
- var Medicine = z19.object({
695
- brand: z19.string().trim(),
762
+ var Medicine = z20.object({
763
+ brand: z20.string().trim(),
696
764
  expiresAt: Timestamp.nullish(),
697
- quantity: z19.string().trim().regex(/^\d+(\.\d{1,3})? ?[a-zA-Z]{1,20}/, {
765
+ quantity: z20.string().trim().regex(/^\d+(\.\d{1,3})? ?[a-zA-Z]{1,20}/, {
698
766
  error: "Failed to match the pattern <number>+(.<number>{1,3})? ?[a-zA-Z]{1,20}"
699
767
  }),
700
- refills: z19.string().trim().regex(/^[0-8]/, { error: "Must be between 0 and 8" }),
701
- directions: z19.string().trim().max(100, { error: "Must be 100 characters or less" }),
768
+ refills: z20.string().trim().regex(/^[0-8]/, { error: "Must be between 0 and 8" }),
769
+ directions: z20.string().trim().max(100, { error: "Must be 100 characters or less" }),
702
770
  ...TimeLog.shape
703
771
  });
704
- var MedicalDetails = z19.object({
772
+ var MedicalDetails = z20.object({
705
773
  vitals: Vitals,
706
- prescriptions: z19.array(z19.array(Medicine)).nullish(),
707
- doctorNote: z19.object({
708
- value: z19.string(),
774
+ prescriptions: z20.array(z20.array(Medicine)).nullish(),
775
+ doctorNote: z20.object({
776
+ value: z20.string(),
709
777
  lastModified: Timestamp.nullable()
710
778
  }),
711
- physAsstNotes: z19.array(
712
- z19.object({
713
- title: z19.string(),
714
- content: z19.string(),
779
+ physAsstNotes: z20.array(
780
+ z20.object({
781
+ title: z20.string(),
782
+ content: z20.string(),
715
783
  ...TimeLog.shape
716
784
  })
717
785
  ).optional()
718
786
  });
719
787
 
720
- // src/schemas/profiles/Client.ts
721
- import * as z20 from "zod";
722
- import { Address as Address2 } from "@wavy/util";
723
- var Name = z20.string().trim().min(2).max(MAX_NAME_LENGTH).transform((d) => d.replace(/-+/g, "-").replace(/'+/g, "'")).superRefine((data, ctx) => {
724
- const invalidCharIdx = data.search(/[^a-z'-]/i);
725
- if (invalidCharIdx >= 0) {
726
- const char = data[invalidCharIdx].includes('"') ? `(${data[invalidCharIdx]})` : `"${data[invalidCharIdx]}"`;
727
- ctx.addIssue(`${char} is not an allowed character.`);
728
- }
729
- });
730
- var ClientIdentity = UserDetails.pick({
731
- _id: true,
732
- createdAt: true,
733
- lastModified: true,
734
- phoneNumber: true,
735
- version: true,
736
- photoUrl: true
737
- }).safeExtend(
738
- z20.object({
739
- firstName: Name,
740
- middleName: Name,
741
- lastName: Name,
742
- email: UserDetails.shape.email.optional(),
743
- dob: Timestamp,
744
- sex: genders,
745
- isGlobal: z20.boolean(),
746
- origin: CompanyIdentity.shape._id,
747
- // National id
748
- nid: z20.object({
749
- class: nidClasses,
750
- // Hash this value
751
- value: z20.string().min(5).max(20)
752
- }).superRefine((data, ctx) => {
753
- const invalidCharIdx = data.value.search(/[^a-z0-9]/i);
754
- if (data.class === "trn") {
755
- const parsedData = Trn.safeParse(data.value);
756
- if (!parsedData.success) {
757
- ctx.addIssue(
758
- parsedData.error?.issues?.[0]?.message || parsedData.error.message
759
- );
760
- }
761
- } else if (invalidCharIdx >= 0) {
762
- const char = data.value[invalidCharIdx] === '"' ? `(${data.value[invalidCharIdx]})` : `"${data.value[invalidCharIdx]}"`;
763
- ctx.addIssue(`${char} is not an allowed character.`);
764
- }
765
- }).optional(),
766
- // Don't hash the attributes, they can be used to help accurately identify a client by whoever is searching for
767
- // the client
768
- attributes: z20.object({
769
- mothersMaidenName: Name,
770
- fathersMiddleName: Name,
771
- mothersMiddleName: Name,
772
- oldestSiblingMiddleName: Name,
773
- firstSchoolName: z20.string().trim().min(3).max(60)
774
- // nickname: z.string().trim().min(1).max(40),
775
- }).partial().refine(
776
- (data) => Object.keys(data).length > 0,
777
- "At least (1) attribute must be defined."
778
- ),
779
- address: Address2.optional(),
780
- linkedTo: UserDetails.shape._id.optional()
781
- }).shape
782
- );
783
- var ClientForm = ClientIdentity.pick({
784
- firstName: true,
785
- middleName: true,
786
- lastName: true,
787
- dob: true,
788
- sex: true
789
- // attributes: true,
790
- }).required();
791
-
792
788
  // src/schemas/appointment/Appointment.ts
793
789
  import * as z21 from "zod";
794
790
  import { sumOf as sumOf2 } from "@wavy/fn";
@@ -1102,6 +1098,7 @@ function createNotifId(options) {
1102
1098
  return nid;
1103
1099
  }
1104
1100
  export {
1101
+ AlphaNumeric,
1105
1102
  AppointmentDetails,
1106
1103
  ClientForm,
1107
1104
  ClientIdentity,
@@ -1161,9 +1158,8 @@ export {
1161
1158
  getCompatibleRoles,
1162
1159
  healthcareProviderRoles,
1163
1160
  industries,
1164
- nidClasses,
1165
1161
  normalizeCompanyId,
1166
- normalizeNidClass,
1162
+ normalizeNidKey,
1167
1163
  parseClientName,
1168
1164
  paymentMethods,
1169
1165
  scheduleAppointment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",