@bizmap/sdk 0.0.65 → 0.0.67

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
@@ -98,14 +98,16 @@ declare const CompanyDetails: z.ZodObject<{
98
98
  }, z.core.$strip>;
99
99
  }, z.core.$strip>;
100
100
  notifications: z.ZodArray<z.ZodObject<{
101
- code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE" | "ALERT">;
101
+ _id: z.ZodString;
102
+ code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
102
103
  payload: z.ZodString;
103
- seen: z.ZodBoolean;
104
+ isArchived: z.ZodOptional<z.ZodBoolean>;
105
+ rcpt: z.ZodNullable<z.ZodUnion<[z.ZodUUID, z.ZodUUID]>>;
104
106
  src: z.ZodObject<{
107
+ _id: z.ZodUnion<[z.ZodUUID, z.ZodUUID]>;
105
108
  name: z.ZodString;
106
109
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
110
  }, z.core.$strip>;
108
- expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
109
111
  createdAt: z.ZodInt;
110
112
  }, z.core.$strip>>;
111
113
  receipts: z.ZodArray<z.ZodObject<{
@@ -594,14 +596,16 @@ declare const MutableCompanyIdentity: z.ZodObject<{
594
596
  type MutableCompanyIdentity = z.infer<typeof MutableCompanyIdentity>;
595
597
 
596
598
  declare const CompanyNotifications: z.ZodArray<z.ZodObject<{
597
- code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE" | "ALERT">;
599
+ _id: z.ZodString;
600
+ code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
598
601
  payload: z.ZodString;
599
- seen: z.ZodBoolean;
602
+ isArchived: z.ZodOptional<z.ZodBoolean>;
603
+ rcpt: z.ZodNullable<z.ZodUnion<[z.ZodUUID, z.ZodUUID]>>;
600
604
  src: z.ZodObject<{
605
+ _id: z.ZodUnion<[z.ZodUUID, z.ZodUUID]>;
601
606
  name: z.ZodString;
602
607
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
603
608
  }, z.core.$strip>;
604
- expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
605
609
  createdAt: z.ZodInt;
606
610
  }, z.core.$strip>>;
607
611
  type CompanyNotifications = z.infer<typeof CompanyNotifications>;
@@ -847,14 +851,16 @@ declare const TierList: z.ZodRecord<z.ZodEnum<{
847
851
  }, z.core.$strip>>;
848
852
  type TierList = z.infer<typeof TierList>;
849
853
  declare const Notification: z.ZodObject<{
850
- code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE" | "ALERT">;
854
+ _id: z.ZodString;
855
+ code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
851
856
  payload: z.ZodString;
852
- seen: z.ZodBoolean;
857
+ isArchived: z.ZodOptional<z.ZodBoolean>;
858
+ rcpt: z.ZodNullable<z.ZodUnion<[z.ZodUUID, z.ZodUUID]>>;
853
859
  src: z.ZodObject<{
860
+ _id: z.ZodUnion<[z.ZodUUID, z.ZodUUID]>;
854
861
  name: z.ZodString;
855
862
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
856
863
  }, z.core.$strip>;
857
- expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
858
864
  createdAt: z.ZodInt;
859
865
  }, z.core.$strip>;
860
866
  type Notification = z.infer<typeof Notification>;
@@ -940,14 +946,16 @@ declare const UserDetails: z.ZodObject<{
940
946
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
941
947
  publicKey: z.ZodNullable<z.ZodString>;
942
948
  notifications: z.ZodArray<z.ZodObject<{
943
- code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE" | "ALERT">;
949
+ _id: z.ZodString;
950
+ code: z.ZodLiteral<"INVITE_RESPONSE" | "COMPANY_INVITE" | "DEV_MESSAGE" | "ALERT">;
944
951
  payload: z.ZodString;
945
- seen: z.ZodBoolean;
952
+ isArchived: z.ZodOptional<z.ZodBoolean>;
953
+ rcpt: z.ZodNullable<z.ZodUnion<[z.ZodUUID, z.ZodUUID]>>;
946
954
  src: z.ZodObject<{
955
+ _id: z.ZodUnion<[z.ZodUUID, z.ZodUUID]>;
947
956
  name: z.ZodString;
948
957
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
949
958
  }, z.core.$strip>;
950
- expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
951
959
  createdAt: z.ZodInt;
952
960
  }, z.core.$strip>>;
953
961
  linked: z.ZodBoolean;
@@ -1761,4 +1769,9 @@ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyU
1761
1769
  * */
1762
1770
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
1763
1771
 
1764
- 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 };
1772
+ declare function createNotifId(options?: {
1773
+ from: string;
1774
+ to: string;
1775
+ }): string;
1776
+
1777
+ 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, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -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,19 +231,49 @@ var TierList = z10.record(
226
231
  }
227
232
  });
228
233
  var Notification = z10.object({
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
+ }),
229
263
  code: z10.literal([
230
- "COMPANY_INVITE",
231
264
  "INVITE_RESPONSE",
265
+ "COMPANY_INVITE",
232
266
  "DEV_MESSAGE",
233
267
  "ALERT"
234
268
  ]),
235
269
  payload: z10.string(),
236
- seen: z10.boolean(),
270
+ isArchived: z10.boolean().optional(),
271
+ rcpt: z10.uuidv4().or(z10.uuidv7()).nullable(),
237
272
  src: z10.object({
273
+ _id: z10.uuidv4().or(z10.uuidv7()),
238
274
  name: z10.string(),
239
275
  photoUrl: z10.string().nullish()
240
276
  }),
241
- expiresAt: Timestamp.nullish(),
242
277
  createdAt: Timestamp
243
278
  }).superRefine((data, ctx) => {
244
279
  const expectMessage = () => {
@@ -853,6 +888,23 @@ async function scheduleAppointment(request) {
853
888
  appointment: MutableAppointmentDetails.parse(appointment)
854
889
  };
855
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
+ }
856
908
  export {
857
909
  AppointmentDetails,
858
910
  ClientIdentity,
@@ -894,6 +946,7 @@ export {
894
946
  companyPartnerRoles,
895
947
  companyServiceSelectors,
896
948
  companyUserRoles,
949
+ createNotifId,
897
950
  employeeRoles,
898
951
  findAvailableStaff,
899
952
  findConflictingPartners,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",
@@ -16,14 +16,14 @@
16
16
  "author": "",
17
17
  "license": "MIT",
18
18
  "peerDependencies": {
19
- "@wavy/fn": "^0.0.40",
19
+ "@wavy/fn": "^0.0.41",
20
20
  "@wavy/util": ">=0.0.12",
21
21
  "zod": "^4.2.1"
22
22
  },
23
23
  "description": "",
24
24
  "devDependencies": {
25
- "@wavy/fn": "^0.0.40",
26
- "@wavy/util": "^0.0.13",
25
+ "@wavy/fn": "^0.0.41",
26
+ "@wavy/util": "^0.0.18",
27
27
  "tsup": "^8.5.0",
28
28
  "typescript": "^5.9.2",
29
29
  "zod": "^4.2.1"