@blackcode_sa/metaestetics-api 1.14.7 → 1.14.9

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
@@ -12906,12 +12906,13 @@ var UserService = class extends BaseService {
12906
12906
  * Kreira novog korisnika na osnovu Firebase korisnika
12907
12907
  */
12908
12908
  async createUser(firebaseUser, roles = ["patient" /* PATIENT */], options) {
12909
- var _a, _b, _c, _d, _e, _f, _g, _h;
12909
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12910
12910
  console.log("[USER_SERVICE] ====== CREATE USER DEBUG ======");
12911
+ console.log("[USER_SERVICE] Auth instance ID:", ((_a = this.auth) == null ? void 0 : _a.__debugId) || "no-id");
12911
12912
  console.log("[USER_SERVICE] Current auth state:", {
12912
- currentUser: ((_b = (_a = this.auth) == null ? void 0 : _a.currentUser) == null ? void 0 : _b.uid) || "NULL",
12913
- currentUserEmail: ((_d = (_c = this.auth) == null ? void 0 : _c.currentUser) == null ? void 0 : _d.email) || "NULL",
12914
- currentUserProvider: ((_f = (_e = this.auth) == null ? void 0 : _e.currentUser) == null ? void 0 : _f.providerId) || "NULL"
12913
+ currentUser: ((_c = (_b = this.auth) == null ? void 0 : _b.currentUser) == null ? void 0 : _c.uid) || "NULL",
12914
+ currentUserEmail: ((_e = (_d = this.auth) == null ? void 0 : _d.currentUser) == null ? void 0 : _e.email) || "NULL",
12915
+ currentUserProvider: ((_g = (_f = this.auth) == null ? void 0 : _f.currentUser) == null ? void 0 : _g.providerId) || "NULL"
12915
12916
  });
12916
12917
  console.log("[USER_SERVICE] Firebase user passed to createUser:", {
12917
12918
  uid: (firebaseUser == null ? void 0 : firebaseUser.uid) || "NULL",
@@ -12919,7 +12920,7 @@ var UserService = class extends BaseService {
12919
12920
  providerId: (firebaseUser == null ? void 0 : firebaseUser.providerId) || "NULL",
12920
12921
  isAnonymous: firebaseUser == null ? void 0 : firebaseUser.isAnonymous
12921
12922
  });
12922
- console.log("[USER_SERVICE] Auth instances match:", ((_h = (_g = this.auth) == null ? void 0 : _g.currentUser) == null ? void 0 : _h.uid) === (firebaseUser == null ? void 0 : firebaseUser.uid));
12923
+ console.log("[USER_SERVICE] Auth instances match:", ((_i = (_h = this.auth) == null ? void 0 : _h.currentUser) == null ? void 0 : _i.uid) === (firebaseUser == null ? void 0 : firebaseUser.uid));
12923
12924
  console.log("[USER_SERVICE] Document path:", `${USERS_COLLECTION}/${firebaseUser == null ? void 0 : firebaseUser.uid}`);
12924
12925
  console.log("[USER_SERVICE] Roles:", roles);
12925
12926
  console.log("[USER_SERVICE] ================================");
@@ -16001,10 +16002,7 @@ var AuthService = class extends BaseService {
16001
16002
  }
16002
16003
  console.log("[AUTH] Using Firebase user:", firebaseUser.uid);
16003
16004
  await this.waitForAuthState(firebaseUser.uid);
16004
- console.log("[AUTH] Forcing token refresh...");
16005
- await firebaseUser.getIdToken(true);
16006
- console.log("[AUTH] Token refreshed successfully");
16007
- console.log("[AUTH] Verifying auth.currentUser:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
16005
+ console.log("[AUTH] Auth state after waitForAuthState:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
16008
16006
  const practitionerService = new PractitionerService(this.db, this.auth, this.app);
16009
16007
  let user = null;
16010
16008
  try {
package/dist/index.mjs CHANGED
@@ -12929,12 +12929,13 @@ var UserService = class extends BaseService {
12929
12929
  * Kreira novog korisnika na osnovu Firebase korisnika
12930
12930
  */
12931
12931
  async createUser(firebaseUser, roles = ["patient" /* PATIENT */], options) {
12932
- var _a, _b, _c, _d, _e, _f, _g, _h;
12932
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12933
12933
  console.log("[USER_SERVICE] ====== CREATE USER DEBUG ======");
12934
+ console.log("[USER_SERVICE] Auth instance ID:", ((_a = this.auth) == null ? void 0 : _a.__debugId) || "no-id");
12934
12935
  console.log("[USER_SERVICE] Current auth state:", {
12935
- currentUser: ((_b = (_a = this.auth) == null ? void 0 : _a.currentUser) == null ? void 0 : _b.uid) || "NULL",
12936
- currentUserEmail: ((_d = (_c = this.auth) == null ? void 0 : _c.currentUser) == null ? void 0 : _d.email) || "NULL",
12937
- currentUserProvider: ((_f = (_e = this.auth) == null ? void 0 : _e.currentUser) == null ? void 0 : _f.providerId) || "NULL"
12936
+ currentUser: ((_c = (_b = this.auth) == null ? void 0 : _b.currentUser) == null ? void 0 : _c.uid) || "NULL",
12937
+ currentUserEmail: ((_e = (_d = this.auth) == null ? void 0 : _d.currentUser) == null ? void 0 : _e.email) || "NULL",
12938
+ currentUserProvider: ((_g = (_f = this.auth) == null ? void 0 : _f.currentUser) == null ? void 0 : _g.providerId) || "NULL"
12938
12939
  });
12939
12940
  console.log("[USER_SERVICE] Firebase user passed to createUser:", {
12940
12941
  uid: (firebaseUser == null ? void 0 : firebaseUser.uid) || "NULL",
@@ -12942,7 +12943,7 @@ var UserService = class extends BaseService {
12942
12943
  providerId: (firebaseUser == null ? void 0 : firebaseUser.providerId) || "NULL",
12943
12944
  isAnonymous: firebaseUser == null ? void 0 : firebaseUser.isAnonymous
12944
12945
  });
12945
- console.log("[USER_SERVICE] Auth instances match:", ((_h = (_g = this.auth) == null ? void 0 : _g.currentUser) == null ? void 0 : _h.uid) === (firebaseUser == null ? void 0 : firebaseUser.uid));
12946
+ console.log("[USER_SERVICE] Auth instances match:", ((_i = (_h = this.auth) == null ? void 0 : _h.currentUser) == null ? void 0 : _i.uid) === (firebaseUser == null ? void 0 : firebaseUser.uid));
12946
12947
  console.log("[USER_SERVICE] Document path:", `${USERS_COLLECTION}/${firebaseUser == null ? void 0 : firebaseUser.uid}`);
12947
12948
  console.log("[USER_SERVICE] Roles:", roles);
12948
12949
  console.log("[USER_SERVICE] ================================");
@@ -16088,10 +16089,7 @@ var AuthService = class extends BaseService {
16088
16089
  }
16089
16090
  console.log("[AUTH] Using Firebase user:", firebaseUser.uid);
16090
16091
  await this.waitForAuthState(firebaseUser.uid);
16091
- console.log("[AUTH] Forcing token refresh...");
16092
- await firebaseUser.getIdToken(true);
16093
- console.log("[AUTH] Token refreshed successfully");
16094
- console.log("[AUTH] Verifying auth.currentUser:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
16092
+ console.log("[AUTH] Auth state after waitForAuthState:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
16095
16093
  const practitionerService = new PractitionerService(this.db, this.auth, this.app);
16096
16094
  let user = null;
16097
16095
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.14.7",
4
+ "version": "1.14.9",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -889,13 +889,13 @@ export class AuthService extends BaseService {
889
889
  // This causes Firestore to not see the authenticated user, resulting in permission denied
890
890
  await this.waitForAuthState(firebaseUser.uid);
891
891
 
892
- // Force token refresh to ensure Firestore has fresh auth context
893
- console.log('[AUTH] Forcing token refresh...');
894
- await firebaseUser.getIdToken(true);
895
- console.log('[AUTH] Token refreshed successfully');
892
+ // Verify auth state BEFORE any other operations
893
+ console.log('[AUTH] Auth state after waitForAuthState:', this.auth.currentUser?.uid || 'NULL');
896
894
 
897
- // Verify auth state is correct
898
- console.log('[AUTH] Verifying auth.currentUser:', this.auth.currentUser?.uid || 'NULL');
895
+ // DON'T force token refresh - it might be clearing auth state in React Native!
896
+ // console.log('[AUTH] Forcing token refresh...');
897
+ // await firebaseUser.getIdToken(true);
898
+ // console.log('[AUTH] Token refreshed successfully');
899
899
 
900
900
  const practitionerService = new PractitionerService(this.db, this.auth, this.app);
901
901
 
@@ -91,6 +91,8 @@ export class UserService extends BaseService {
91
91
  ): Promise<User> {
92
92
  // DEBUG LOGGING - Check auth state before creating user document
93
93
  console.log('[USER_SERVICE] ====== CREATE USER DEBUG ======');
94
+ // @ts-ignore - Debug: Check auth instance ID
95
+ console.log('[USER_SERVICE] Auth instance ID:', (this.auth as any)?.__debugId || 'no-id');
94
96
  console.log('[USER_SERVICE] Current auth state:', {
95
97
  currentUser: this.auth?.currentUser?.uid || 'NULL',
96
98
  currentUserEmail: this.auth?.currentUser?.email || 'NULL',