@bizmap/sdk 0.0.87 → 0.0.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -991,6 +991,7 @@ declare const MedicalDetails: z.ZodObject<{
991
991
  type MedicalDetails = z.infer<typeof MedicalDetails>;
992
992
 
993
993
  declare const InvoiceNo: z.ZodString;
994
+ declare const Trn: z.ZodString;
994
995
  declare const StandardTime: z.ZodString;
995
996
  declare const Timestamp: z.ZodInt;
996
997
  declare const InviteResponse: z.ZodEnum<{
@@ -2011,4 +2012,4 @@ declare function createNotifId(options?: {
2011
2012
  to: string;
2012
2013
  }): string;
2013
2014
 
2014
- export { AppointmentDetails, type AppointmentDistAlg, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, type CompanyType, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, type NidClass, 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, genders, getCompatibleRoles, healthcareProviderRoles, nidClasses, normalizeCompanyId, normalizeNidClass, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
2015
+ export { AppointmentDetails, type AppointmentDistAlg, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, type CompanyType, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, type NidClass, Notification, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, adminRoles, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyTypes, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, healthcareProviderRoles, nidClasses, normalizeCompanyId, normalizeNidClass, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -61,13 +61,20 @@ import * as z6 from "zod";
61
61
 
62
62
  // src/schemas/utils/core.ts
63
63
  import * as z5 from "zod";
64
- var InvoiceNo = z5.string().regex(
65
- /^[0-9]{4}-(01|(0[2-9])|(1[0-2]))-(30|31|([1-2][0-9])|0[1-9])-[0-9]{7}/,
66
- 'An invoice no. must match the pattern "yyyy-mm-dd-9999999".'
64
+ var InvoiceNo = z5.string().trim().refine(
65
+ (d) => d && d.replace(
66
+ /^[0-9]{4}-(01|(0[2-9])|(1[0-2]))-(30|31|([1-2][0-9])|0[1-9])-[0-9]{7}/,
67
+ ""
68
+ ).length === 0,
69
+ 'Invalid invoice no.: must match the pattern "yyyy-mm-dd-0000000"'
67
70
  );
68
- var StandardTime = z5.string().regex(
69
- /^(01|(0[2-9])|(1[0-2])):(([1-5][0-9])|0[0-9]) (am|pm)/i,
70
- "A standard time must match the pattern hh:mm A."
71
+ var Trn = z5.string().trim().refine(
72
+ (data) => data && data.replace(/^[0-9]{3}-[0-9]{3}-[0-9]{3}/, "").length === 0,
73
+ 'Invalid trn: must match the pattern "000-000-000"'
74
+ );
75
+ var StandardTime = z5.string().trim().refine(
76
+ (d) => d && d.replace(/^(01|(0[2-9])|(1[0-2])):(([1-5][0-9])|0[0-9]) (am|pm)/i, "").length === 0,
77
+ 'Invalid standard time: must match the pattern "hh:mm A"'
71
78
  );
72
79
  var Timestamp = z5.int().refine(
73
80
  (t) => t.toString().length === 13,
@@ -429,6 +436,7 @@ var normalizeCompanyId = (id) => {
429
436
  var normalizeNidClass = (value) => {
430
437
  value = nidClasses.parse(value);
431
438
  if (value === "nin") return "National Id No.";
439
+ if (value === "trn") return "Tax Registration No.";
432
440
  return camelCaseToLetter(value.replace("No", "No."));
433
441
  };
434
442
 
@@ -712,10 +720,18 @@ var ClientIdentity = UserDetails.pick({
712
720
  sex: genders,
713
721
  isGlobal: z20.boolean(),
714
722
  origin: CompanyIdentity.shape._id,
723
+ // National id
715
724
  nid: z20.object({
716
725
  class: nidClasses,
717
726
  // Hash this value
718
- value: z20.string()
727
+ value: z20.string().max(20)
728
+ }).superRefine((data, ctx) => {
729
+ if (data.class === "trn") {
730
+ const parsedData = Trn.safeParse(data.value);
731
+ if (!parsedData.success) {
732
+ ctx.addIssue(parsedData.error.message);
733
+ }
734
+ }
719
735
  }).optional(),
720
736
  // Don't hash the attributes, they can be used to help accurately identify a client by whoever is searching for
721
737
  // the client
@@ -1058,6 +1074,7 @@ export {
1058
1074
  TierList,
1059
1075
  TimeLog,
1060
1076
  Timestamp,
1077
+ Trn,
1061
1078
  UserDetails,
1062
1079
  Version,
1063
1080
  Vitals,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",