@bizmap/sdk 0.0.66 → 0.0.68

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
@@ -36,6 +36,10 @@ declare const companyServiceSelectors: z.ZodEnum<{
36
36
  doctor: "doctor";
37
37
  }>;
38
38
  type CompanyServiceSelector = z.infer<typeof companyServiceSelectors>;
39
+ declare const companyTypes: z.ZodEnum<{
40
+ MEDICAL: "MEDICAL";
41
+ }>;
42
+ type CompanyType = z.infer<typeof companyTypes>;
39
43
 
40
44
  declare const tiers: z.ZodEnum<{
41
45
  basic: "basic";
@@ -69,6 +73,9 @@ declare const serviceProviders: z.ZodEnum<{
69
73
  declare const CompanyDetails: z.ZodObject<{
70
74
  _id: z.ZodUUID;
71
75
  identity: z.ZodObject<{
76
+ type: z.ZodReadonly<z.ZodEnum<{
77
+ MEDICAL: "MEDICAL";
78
+ }>>;
72
79
  lastModified: z.ZodNullable<z.ZodInt>;
73
80
  address: z.ZodObject<{
74
81
  streetAddress: z.ZodString;
@@ -98,7 +105,7 @@ declare const CompanyDetails: z.ZodObject<{
98
105
  }, z.core.$strip>;
99
106
  }, z.core.$strip>;
100
107
  notifications: z.ZodArray<z.ZodObject<{
101
- _id: z.ZodUUID;
108
+ _id: z.ZodString;
102
109
  code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
103
110
  payload: z.ZodString;
104
111
  isArchived: z.ZodOptional<z.ZodBoolean>;
@@ -548,16 +555,19 @@ declare const CompanyIdentity: z.ZodObject<{
548
555
  _id: z.ZodUUID;
549
556
  displayName: z.ZodString;
550
557
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
551
- contact: z.ZodObject<{
552
- email: z.ZodEmail;
553
- phoneNumber: z.ZodOptional<z.ZodString>;
554
- }, z.core.$strip>;
558
+ type: z.ZodReadonly<z.ZodEnum<{
559
+ MEDICAL: "MEDICAL";
560
+ }>>;
555
561
  address: z.ZodObject<{
556
562
  streetAddress: z.ZodString;
557
563
  city: z.ZodOptional<z.ZodString>;
558
564
  parish: z.ZodString;
559
565
  country: z.ZodString;
560
566
  }, z.core.$strip>;
567
+ contact: z.ZodObject<{
568
+ email: z.ZodEmail;
569
+ phoneNumber: z.ZodOptional<z.ZodString>;
570
+ }, z.core.$strip>;
561
571
  tier: z.ZodObject<{
562
572
  current: z.ZodEnum<{
563
573
  basic: "basic";
@@ -596,7 +606,7 @@ declare const MutableCompanyIdentity: z.ZodObject<{
596
606
  type MutableCompanyIdentity = z.infer<typeof MutableCompanyIdentity>;
597
607
 
598
608
  declare const CompanyNotifications: z.ZodArray<z.ZodObject<{
599
- _id: z.ZodUUID;
609
+ _id: z.ZodString;
600
610
  code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
601
611
  payload: z.ZodString;
602
612
  isArchived: z.ZodOptional<z.ZodBoolean>;
@@ -851,7 +861,7 @@ declare const TierList: z.ZodRecord<z.ZodEnum<{
851
861
  }, z.core.$strip>>;
852
862
  type TierList = z.infer<typeof TierList>;
853
863
  declare const Notification: z.ZodObject<{
854
- _id: z.ZodUUID;
864
+ _id: z.ZodString;
855
865
  code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
856
866
  payload: z.ZodString;
857
867
  isArchived: z.ZodOptional<z.ZodBoolean>;
@@ -943,9 +953,10 @@ declare const UserDetails: z.ZodObject<{
943
953
  email: z.ZodEmail;
944
954
  phoneNumber: z.ZodOptional<z.ZodString>;
945
955
  name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
956
+ photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
946
957
  publicKey: z.ZodNullable<z.ZodString>;
947
958
  notifications: z.ZodArray<z.ZodObject<{
948
- _id: z.ZodUUID;
959
+ _id: z.ZodString;
949
960
  code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
950
961
  payload: z.ZodString;
951
962
  isArchived: z.ZodOptional<z.ZodBoolean>;
@@ -957,7 +968,6 @@ declare const UserDetails: z.ZodObject<{
957
968
  }, z.core.$strip>;
958
969
  createdAt: z.ZodInt;
959
970
  }, z.core.$strip>>;
960
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
961
971
  linked: z.ZodBoolean;
962
972
  }, z.core.$strip>;
963
973
  type UserDetails = z.infer<typeof UserDetails>;
@@ -1769,4 +1779,9 @@ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyU
1769
1779
  * */
1770
1780
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
1771
1781
 
1772
- export { AppointmentDetails, type AppointmentDistAlg, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, 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, Vitals, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
1782
+ declare function createNotifId(options?: {
1783
+ from: string;
1784
+ to: string;
1785
+ }): string;
1786
+
1787
+ 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, Vitals, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyTypes, companyUserRoles, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -18,6 +18,7 @@ var healthcareProviderRoles = companyUserRoles.extract([
18
18
  ]);
19
19
  var appointmentDistAlgs = z.enum(["RR", "LOR"]);
20
20
  var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
21
+ var companyTypes = z.enum(["MEDICAL"]);
21
22
 
22
23
  // src/enums/Global.ts
23
24
  import * as z2 from "zod";
@@ -181,13 +182,12 @@ var CompanyIdentity = z9.object({
181
182
  _id: CompanyState.shape._id,
182
183
  displayName: z9.string().min(3).max(25),
183
184
  logo: z9.string().max(150).nullish(),
184
- /** Hash this field */
185
- // password: z.string(),
185
+ type: companyTypes.readonly(),
186
+ address: Address,
186
187
  contact: z9.object({
187
188
  email: z9.email().max(25),
188
189
  phoneNumber: PhoneNumber.optional()
189
190
  }),
190
- address: Address,
191
191
  // Can only be changed by the server
192
192
  tier: z9.object({
193
193
  current: tiers,
@@ -212,8 +212,13 @@ var MutableCompanyIdentity = CompanyIdentity.pick({
212
212
  import * as z11 from "zod";
213
213
 
214
214
  // src/schemas/Global.ts
215
- import * as z10 from "zod";
216
215
  import { currencies as currencies2 } from "@wavy/util";
216
+ import * as z10 from "zod";
217
+
218
+ // src/constants.ts
219
+ var NOTIF_ID_DELIM = "::";
220
+
221
+ // src/schemas/Global.ts
217
222
  var TierList = z10.record(
218
223
  tiers,
219
224
  z10.object({
@@ -226,7 +231,35 @@ var TierList = z10.record(
226
231
  }
227
232
  });
228
233
  var Notification = z10.object({
229
- _id: z10.uuidv4(),
234
+ _id: z10.string().superRefine((data, ctx) => {
235
+ const isUUidV4 = z10.uuidv4().safeParse(data).success;
236
+ if (isUUidV4) return;
237
+ let [from, to, nonce] = data.split(NOTIF_ID_DELIM);
238
+ nonce = nonce?.trim() || "";
239
+ const parsedFrom = z10.uuidv4().or(z10.uuidv7()).safeParse(from);
240
+ if (!parsedFrom.success) {
241
+ ctx.addIssue({
242
+ code: "custom",
243
+ message: "Invalid UUID",
244
+ path: ["from"]
245
+ });
246
+ }
247
+ const parsedTo = z10.uuidv4().safeParse(to);
248
+ if (!parsedTo.success) {
249
+ ctx.addIssue({
250
+ code: "custom",
251
+ message: "Invalid UUID",
252
+ path: ["to"]
253
+ });
254
+ }
255
+ if (nonce.length < 4 || nonce.length > 7) {
256
+ ctx.addIssue({
257
+ code: "custom",
258
+ message: "Invalid length",
259
+ path: ["nonce"]
260
+ });
261
+ }
262
+ }),
230
263
  code: z10.literal([
231
264
  "INVITE_RESPONSE",
232
265
  "COMPANY_INVITE",
@@ -855,6 +888,23 @@ async function scheduleAppointment(request) {
855
888
  appointment: MutableAppointmentDetails.parse(appointment)
856
889
  };
857
890
  }
891
+
892
+ // src/functions/createNotifId.ts
893
+ import { random } from "@wavy/fn";
894
+ import { v4 as v42 } from "uuid";
895
+ function createNotifId(options) {
896
+ let nid = v42();
897
+ if (options) {
898
+ nid = Notification.shape._id.parse(
899
+ [
900
+ options.from,
901
+ options.to,
902
+ nid.replace(/[^a-z0-9]/i, "").slice(0, random(7, 4))
903
+ ].join(NOTIF_ID_DELIM)
904
+ );
905
+ }
906
+ return nid;
907
+ }
858
908
  export {
859
909
  AppointmentDetails,
860
910
  ClientIdentity,
@@ -895,7 +945,9 @@ export {
895
945
  appointmentDistAlgs,
896
946
  companyPartnerRoles,
897
947
  companyServiceSelectors,
948
+ companyTypes,
898
949
  companyUserRoles,
950
+ createNotifId,
899
951
  employeeRoles,
900
952
  findAvailableStaff,
901
953
  findConflictingPartners,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",