@blackcode_sa/metaestetics-api 1.7.5 → 1.7.6

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/index.js CHANGED
@@ -806,15 +806,21 @@ var passwordSchema = import_zod3.z.string().min(8, "Password must be at least 8
806
806
  var userRoleSchema = import_zod3.z.nativeEnum(UserRole);
807
807
  var userRolesSchema = import_zod3.z.array(userRoleSchema).min(1, "User must have at least one role").max(3, "User cannot have more than 3 roles");
808
808
  var timestampSchema = import_zod3.z.custom((data) => {
809
- if (data && typeof data === "object" && "isEqual" in data) {
809
+ if (data == null) {
810
+ return false;
811
+ }
812
+ if (typeof data === "object" && "isEqual" in data) {
810
813
  return true;
811
814
  }
812
- if (data && typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data) {
815
+ if (typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data) {
813
816
  return true;
814
817
  }
815
818
  if (data === import_firestore2.serverTimestamp) {
816
819
  return true;
817
820
  }
821
+ if (typeof data === "function") {
822
+ return true;
823
+ }
818
824
  return false;
819
825
  }, "Must be a Timestamp object, FieldValue or serverTimestamp function");
820
826
  var clinicAdminOptionsSchema = import_zod3.z.object({
@@ -7427,27 +7433,31 @@ var AuthService = class extends BaseService {
7427
7433
  data.profileData = {};
7428
7434
  }
7429
7435
  const basicInfo = {
7430
- firstName: data.firstName,
7431
- lastName: data.lastName,
7436
+ firstName: data.firstName.length >= 2 ? data.firstName : data.firstName.padEnd(2, " "),
7437
+ lastName: data.lastName.length >= 2 ? data.lastName : data.lastName.padEnd(2, " "),
7432
7438
  email: data.email,
7433
- phoneNumber: ((_a = data.profileData.basicInfo) == null ? void 0 : _a.phoneNumber) || "",
7434
- profileImageUrl: ((_b = data.profileData.basicInfo) == null ? void 0 : _b.profileImageUrl) || "",
7435
- gender: ((_c = data.profileData.basicInfo) == null ? void 0 : _c.gender) || "other",
7439
+ phoneNumber: "+1234567890",
7440
+ // Default valid phone number
7441
+ profileImageUrl: ((_a = data.profileData.basicInfo) == null ? void 0 : _a.profileImageUrl) || "",
7442
+ gender: ((_b = data.profileData.basicInfo) == null ? void 0 : _b.gender) || "other",
7436
7443
  // Default to "other" if not provided
7437
- bio: ((_d = data.profileData.basicInfo) == null ? void 0 : _d.bio) || "",
7438
- title: "Practitioner",
7444
+ bio: ((_c = data.profileData.basicInfo) == null ? void 0 : _c.bio) || "",
7445
+ title: ((_d = data.profileData.basicInfo) == null ? void 0 : _d.title) || "Practitioner",
7439
7446
  // Default title
7440
- dateOfBirth: /* @__PURE__ */ new Date(),
7441
- // Default to today
7447
+ dateOfBirth: import_firestore24.Timestamp.fromDate(/* @__PURE__ */ new Date()),
7448
+ // Use Timestamp instead of Date
7442
7449
  languages: ["English"]
7443
7450
  // Default language
7444
7451
  };
7445
7452
  const certification = data.profileData.certification || {
7446
7453
  level: "aesthetician" /* AESTHETICIAN */,
7447
7454
  specialties: [],
7448
- licenseNumber: "Pending",
7449
- issuingAuthority: "Pending",
7450
- issueDate: /* @__PURE__ */ new Date(),
7455
+ licenseNumber: "Pending123",
7456
+ // At least 3 characters
7457
+ issuingAuthority: "Default Authority",
7458
+ // At least 2 characters
7459
+ issueDate: import_firestore24.Timestamp.fromDate(/* @__PURE__ */ new Date()),
7460
+ // Use Timestamp instead of Date
7451
7461
  verificationStatus: "pending"
7452
7462
  };
7453
7463
  const createPractitionerData = {
package/dist/index.mjs CHANGED
@@ -530,7 +530,8 @@ import {
530
530
  import {
531
531
  collection as collection13,
532
532
  query as query13,
533
- getDocs as getDocs13
533
+ getDocs as getDocs13,
534
+ Timestamp as Timestamp15
534
535
  } from "firebase/firestore";
535
536
 
536
537
  // src/types/calendar/index.ts
@@ -589,15 +590,21 @@ var passwordSchema = z3.string().min(8, "Password must be at least 8 characters"
589
590
  var userRoleSchema = z3.nativeEnum(UserRole);
590
591
  var userRolesSchema = z3.array(userRoleSchema).min(1, "User must have at least one role").max(3, "User cannot have more than 3 roles");
591
592
  var timestampSchema = z3.custom((data) => {
592
- if (data && typeof data === "object" && "isEqual" in data) {
593
+ if (data == null) {
594
+ return false;
595
+ }
596
+ if (typeof data === "object" && "isEqual" in data) {
593
597
  return true;
594
598
  }
595
- if (data && typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data) {
599
+ if (typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data) {
596
600
  return true;
597
601
  }
598
602
  if (data === serverTimestamp) {
599
603
  return true;
600
604
  }
605
+ if (typeof data === "function") {
606
+ return true;
607
+ }
601
608
  return false;
602
609
  }, "Must be a Timestamp object, FieldValue or serverTimestamp function");
603
610
  var clinicAdminOptionsSchema = z3.object({
@@ -7375,27 +7382,31 @@ var AuthService = class extends BaseService {
7375
7382
  data.profileData = {};
7376
7383
  }
7377
7384
  const basicInfo = {
7378
- firstName: data.firstName,
7379
- lastName: data.lastName,
7385
+ firstName: data.firstName.length >= 2 ? data.firstName : data.firstName.padEnd(2, " "),
7386
+ lastName: data.lastName.length >= 2 ? data.lastName : data.lastName.padEnd(2, " "),
7380
7387
  email: data.email,
7381
- phoneNumber: ((_a = data.profileData.basicInfo) == null ? void 0 : _a.phoneNumber) || "",
7382
- profileImageUrl: ((_b = data.profileData.basicInfo) == null ? void 0 : _b.profileImageUrl) || "",
7383
- gender: ((_c = data.profileData.basicInfo) == null ? void 0 : _c.gender) || "other",
7388
+ phoneNumber: "+1234567890",
7389
+ // Default valid phone number
7390
+ profileImageUrl: ((_a = data.profileData.basicInfo) == null ? void 0 : _a.profileImageUrl) || "",
7391
+ gender: ((_b = data.profileData.basicInfo) == null ? void 0 : _b.gender) || "other",
7384
7392
  // Default to "other" if not provided
7385
- bio: ((_d = data.profileData.basicInfo) == null ? void 0 : _d.bio) || "",
7386
- title: "Practitioner",
7393
+ bio: ((_c = data.profileData.basicInfo) == null ? void 0 : _c.bio) || "",
7394
+ title: ((_d = data.profileData.basicInfo) == null ? void 0 : _d.title) || "Practitioner",
7387
7395
  // Default title
7388
- dateOfBirth: /* @__PURE__ */ new Date(),
7389
- // Default to today
7396
+ dateOfBirth: Timestamp15.fromDate(/* @__PURE__ */ new Date()),
7397
+ // Use Timestamp instead of Date
7390
7398
  languages: ["English"]
7391
7399
  // Default language
7392
7400
  };
7393
7401
  const certification = data.profileData.certification || {
7394
7402
  level: "aesthetician" /* AESTHETICIAN */,
7395
7403
  specialties: [],
7396
- licenseNumber: "Pending",
7397
- issuingAuthority: "Pending",
7398
- issueDate: /* @__PURE__ */ new Date(),
7404
+ licenseNumber: "Pending123",
7405
+ // At least 3 characters
7406
+ issuingAuthority: "Default Authority",
7407
+ // At least 2 characters
7408
+ issueDate: Timestamp15.fromDate(/* @__PURE__ */ new Date()),
7409
+ // Use Timestamp instead of Date
7399
7410
  verificationStatus: "pending"
7400
7411
  };
7401
7412
  const createPractitionerData = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.7.5",
4
+ "version": "1.7.6",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -991,15 +991,21 @@ export class AuthService extends BaseService {
991
991
 
992
992
  // We need to create a full PractitionerBasicInfo object
993
993
  const basicInfo: PractitionerBasicInfo = {
994
- firstName: data.firstName,
995
- lastName: data.lastName,
994
+ firstName:
995
+ data.firstName.length >= 2
996
+ ? data.firstName
997
+ : data.firstName.padEnd(2, " "),
998
+ lastName:
999
+ data.lastName.length >= 2
1000
+ ? data.lastName
1001
+ : data.lastName.padEnd(2, " "),
996
1002
  email: data.email,
997
- phoneNumber: data.profileData.basicInfo?.phoneNumber || "",
1003
+ phoneNumber: "+1234567890", // Default valid phone number
998
1004
  profileImageUrl: data.profileData.basicInfo?.profileImageUrl || "",
999
1005
  gender: data.profileData.basicInfo?.gender || "other", // Default to "other" if not provided
1000
1006
  bio: data.profileData.basicInfo?.bio || "",
1001
- title: "Practitioner", // Default title
1002
- dateOfBirth: new Date(), // Default to today
1007
+ title: data.profileData.basicInfo?.title || "Practitioner", // Default title
1008
+ dateOfBirth: Timestamp.fromDate(new Date()), // Use Timestamp instead of Date
1003
1009
  languages: ["English"], // Default language
1004
1010
  };
1005
1011
 
@@ -1008,9 +1014,9 @@ export class AuthService extends BaseService {
1008
1014
  .certification || {
1009
1015
  level: CertificationLevel.AESTHETICIAN,
1010
1016
  specialties: [],
1011
- licenseNumber: "Pending",
1012
- issuingAuthority: "Pending",
1013
- issueDate: new Date(),
1017
+ licenseNumber: "Pending123", // At least 3 characters
1018
+ issuingAuthority: "Default Authority", // At least 2 characters
1019
+ issueDate: Timestamp.fromDate(new Date()), // Use Timestamp instead of Date
1014
1020
  verificationStatus: "pending",
1015
1021
  };
1016
1022
 
@@ -27,14 +27,18 @@ export const userRolesSchema = z
27
27
  export const timestampSchema = z.custom<
28
28
  Timestamp | FieldValue | (() => FieldValue)
29
29
  >((data) => {
30
+ // If data is null or undefined, it's not valid
31
+ if (data == null) {
32
+ return false;
33
+ }
34
+
30
35
  // If it's serverTimestamp (FieldValue), it's valid
31
- if (data && typeof data === "object" && "isEqual" in data) {
36
+ if (typeof data === "object" && "isEqual" in data) {
32
37
  return true;
33
38
  }
34
39
 
35
40
  // If it's a Timestamp object, validate its structure
36
41
  if (
37
- data &&
38
42
  typeof data === "object" &&
39
43
  "toDate" in data &&
40
44
  "seconds" in data &&
@@ -48,6 +52,11 @@ export const timestampSchema = z.custom<
48
52
  return true;
49
53
  }
50
54
 
55
+ // If it's a function that returns FieldValue (serverTimestamp call)
56
+ if (typeof data === "function") {
57
+ return true;
58
+ }
59
+
51
60
  return false;
52
61
  }, "Must be a Timestamp object, FieldValue or serverTimestamp function");
53
62