@blackcode_sa/metaestetics-api 1.5.2 → 1.5.3

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.d.mts CHANGED
@@ -3658,9 +3658,9 @@ interface User {
3658
3658
  email: string | null;
3659
3659
  roles: UserRole[];
3660
3660
  isAnonymous: boolean;
3661
- createdAt: Timestamp;
3662
- updatedAt: Timestamp;
3663
- lastLoginAt: Timestamp;
3661
+ createdAt: Timestamp | FieldValue;
3662
+ updatedAt: Timestamp | FieldValue;
3663
+ lastLoginAt: Timestamp | FieldValue;
3664
3664
  patientProfile?: string;
3665
3665
  practitionerProfile?: string;
3666
3666
  adminProfile?: string;
@@ -5012,7 +5012,7 @@ declare const emailSchema: z.ZodString;
5012
5012
  declare const passwordSchema: z.ZodString;
5013
5013
  declare const userRoleSchema: z.ZodNativeEnum<typeof UserRole>;
5014
5014
  declare const userRolesSchema: z.ZodArray<z.ZodNativeEnum<typeof UserRole>, "many">;
5015
- declare const timestampSchema: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5015
+ declare const timestampSchema: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5016
5016
  /**
5017
5017
  * Validaciona šema za clinic admin opcije pri kreiranju
5018
5018
  */
@@ -5080,31 +5080,31 @@ declare const userSchema: z.ZodObject<{
5080
5080
  email: z.ZodNullable<z.ZodString>;
5081
5081
  roles: z.ZodArray<z.ZodNativeEnum<typeof UserRole>, "many">;
5082
5082
  isAnonymous: z.ZodBoolean;
5083
- createdAt: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5084
- updatedAt: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5085
- lastLoginAt: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5083
+ createdAt: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5084
+ updatedAt: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5085
+ lastLoginAt: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5086
5086
  patientProfile: z.ZodOptional<z.ZodString>;
5087
5087
  practitionerProfile: z.ZodOptional<z.ZodString>;
5088
5088
  adminProfile: z.ZodOptional<z.ZodString>;
5089
5089
  }, "strip", z.ZodTypeAny, {
5090
- updatedAt: Timestamp;
5090
+ updatedAt: Timestamp | FieldValue;
5091
5091
  email: string | null;
5092
- createdAt: Timestamp;
5092
+ createdAt: Timestamp | FieldValue;
5093
5093
  uid: string;
5094
5094
  roles: UserRole[];
5095
5095
  isAnonymous: boolean;
5096
- lastLoginAt: Timestamp;
5096
+ lastLoginAt: Timestamp | FieldValue;
5097
5097
  patientProfile?: string | undefined;
5098
5098
  practitionerProfile?: string | undefined;
5099
5099
  adminProfile?: string | undefined;
5100
5100
  }, {
5101
- updatedAt: Timestamp;
5101
+ updatedAt: Timestamp | FieldValue;
5102
5102
  email: string | null;
5103
- createdAt: Timestamp;
5103
+ createdAt: Timestamp | FieldValue;
5104
5104
  uid: string;
5105
5105
  roles: UserRole[];
5106
5106
  isAnonymous: boolean;
5107
- lastLoginAt: Timestamp;
5107
+ lastLoginAt: Timestamp | FieldValue;
5108
5108
  patientProfile?: string | undefined;
5109
5109
  practitionerProfile?: string | undefined;
5110
5110
  adminProfile?: string | undefined;
package/dist/index.d.ts CHANGED
@@ -3658,9 +3658,9 @@ interface User {
3658
3658
  email: string | null;
3659
3659
  roles: UserRole[];
3660
3660
  isAnonymous: boolean;
3661
- createdAt: Timestamp;
3662
- updatedAt: Timestamp;
3663
- lastLoginAt: Timestamp;
3661
+ createdAt: Timestamp | FieldValue;
3662
+ updatedAt: Timestamp | FieldValue;
3663
+ lastLoginAt: Timestamp | FieldValue;
3664
3664
  patientProfile?: string;
3665
3665
  practitionerProfile?: string;
3666
3666
  adminProfile?: string;
@@ -5012,7 +5012,7 @@ declare const emailSchema: z.ZodString;
5012
5012
  declare const passwordSchema: z.ZodString;
5013
5013
  declare const userRoleSchema: z.ZodNativeEnum<typeof UserRole>;
5014
5014
  declare const userRolesSchema: z.ZodArray<z.ZodNativeEnum<typeof UserRole>, "many">;
5015
- declare const timestampSchema: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5015
+ declare const timestampSchema: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5016
5016
  /**
5017
5017
  * Validaciona šema za clinic admin opcije pri kreiranju
5018
5018
  */
@@ -5080,31 +5080,31 @@ declare const userSchema: z.ZodObject<{
5080
5080
  email: z.ZodNullable<z.ZodString>;
5081
5081
  roles: z.ZodArray<z.ZodNativeEnum<typeof UserRole>, "many">;
5082
5082
  isAnonymous: z.ZodBoolean;
5083
- createdAt: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5084
- updatedAt: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5085
- lastLoginAt: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
5083
+ createdAt: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5084
+ updatedAt: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5085
+ lastLoginAt: z.ZodType<Timestamp | FieldValue, z.ZodTypeDef, Timestamp | FieldValue>;
5086
5086
  patientProfile: z.ZodOptional<z.ZodString>;
5087
5087
  practitionerProfile: z.ZodOptional<z.ZodString>;
5088
5088
  adminProfile: z.ZodOptional<z.ZodString>;
5089
5089
  }, "strip", z.ZodTypeAny, {
5090
- updatedAt: Timestamp;
5090
+ updatedAt: Timestamp | FieldValue;
5091
5091
  email: string | null;
5092
- createdAt: Timestamp;
5092
+ createdAt: Timestamp | FieldValue;
5093
5093
  uid: string;
5094
5094
  roles: UserRole[];
5095
5095
  isAnonymous: boolean;
5096
- lastLoginAt: Timestamp;
5096
+ lastLoginAt: Timestamp | FieldValue;
5097
5097
  patientProfile?: string | undefined;
5098
5098
  practitionerProfile?: string | undefined;
5099
5099
  adminProfile?: string | undefined;
5100
5100
  }, {
5101
- updatedAt: Timestamp;
5101
+ updatedAt: Timestamp | FieldValue;
5102
5102
  email: string | null;
5103
- createdAt: Timestamp;
5103
+ createdAt: Timestamp | FieldValue;
5104
5104
  uid: string;
5105
5105
  roles: UserRole[];
5106
5106
  isAnonymous: boolean;
5107
- lastLoginAt: Timestamp;
5107
+ lastLoginAt: Timestamp | FieldValue;
5108
5108
  patientProfile?: string | undefined;
5109
5109
  practitionerProfile?: string | undefined;
5110
5110
  adminProfile?: string | undefined;
package/dist/index.js CHANGED
@@ -460,8 +460,11 @@ var passwordSchema = import_zod2.z.string().min(8, "Password must be at least 8
460
460
  var userRoleSchema = import_zod2.z.nativeEnum(UserRole);
461
461
  var userRolesSchema = import_zod2.z.array(userRoleSchema).min(1, "User must have at least one role").max(3, "User cannot have more than 3 roles");
462
462
  var timestampSchema = import_zod2.z.custom((data) => {
463
+ if (data && typeof data === "object" && "isEqual" in data) {
464
+ return true;
465
+ }
463
466
  return data && typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data;
464
- }, "Must be a Timestamp object");
467
+ }, "Must be a Timestamp object or serverTimestamp");
465
468
  var clinicAdminOptionsSchema = import_zod2.z.object({
466
469
  isGroupOwner: import_zod2.z.boolean(),
467
470
  groupToken: import_zod2.z.string().optional(),
package/dist/index.mjs CHANGED
@@ -288,8 +288,11 @@ var passwordSchema = z2.string().min(8, "Password must be at least 8 characters"
288
288
  var userRoleSchema = z2.nativeEnum(UserRole);
289
289
  var userRolesSchema = z2.array(userRoleSchema).min(1, "User must have at least one role").max(3, "User cannot have more than 3 roles");
290
290
  var timestampSchema = z2.custom((data) => {
291
+ if (data && typeof data === "object" && "isEqual" in data) {
292
+ return true;
293
+ }
291
294
  return data && typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data;
292
- }, "Must be a Timestamp object");
295
+ }, "Must be a Timestamp object or serverTimestamp");
293
296
  var clinicAdminOptionsSchema = z2.object({
294
297
  isGroupOwner: z2.boolean(),
295
298
  groupToken: z2.string().optional(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.5.2",
4
+ "version": "1.5.3",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -14,9 +14,9 @@ export interface User {
14
14
  email: string | null;
15
15
  roles: UserRole[];
16
16
  isAnonymous: boolean;
17
- createdAt: Timestamp;
18
- updatedAt: Timestamp;
19
- lastLoginAt: Timestamp;
17
+ createdAt: Timestamp | FieldValue;
18
+ updatedAt: Timestamp | FieldValue;
19
+ lastLoginAt: Timestamp | FieldValue;
20
20
  patientProfile?: string;
21
21
  practitionerProfile?: string;
22
22
  adminProfile?: string;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { UserRole } from "../types";
3
- import { Timestamp } from "firebase/firestore";
3
+ import { Timestamp, FieldValue } from "firebase/firestore";
4
4
 
5
5
  export const emailSchema = z
6
6
  .string()
@@ -24,7 +24,13 @@ export const userRolesSchema = z
24
24
  .min(1, "User must have at least one role")
25
25
  .max(3, "User cannot have more than 3 roles");
26
26
 
27
- export const timestampSchema = z.custom<Timestamp>((data) => {
27
+ export const timestampSchema = z.custom<Timestamp | FieldValue>((data) => {
28
+ // If it's a serverTimestamp (FieldValue), it's valid
29
+ if (data && typeof data === "object" && "isEqual" in data) {
30
+ return true;
31
+ }
32
+
33
+ // If it's a Timestamp object, validate its structure
28
34
  return (
29
35
  data &&
30
36
  typeof data === "object" &&
@@ -32,7 +38,7 @@ export const timestampSchema = z.custom<Timestamp>((data) => {
32
38
  "seconds" in data &&
33
39
  "nanoseconds" in data
34
40
  );
35
- }, "Must be a Timestamp object");
41
+ }, "Must be a Timestamp object or serverTimestamp");
36
42
 
37
43
  /**
38
44
  * Validaciona šema za clinic admin opcije pri kreiranju