@blackcode_sa/metaestetics-api 1.5.46 → 1.5.47

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.
@@ -737,6 +737,10 @@ interface PractitionerToken {
737
737
  expiresAt: Timestamp;
738
738
  usedBy?: string;
739
739
  usedAt?: Timestamp;
740
+ emailSent?: boolean;
741
+ emailSentAt?: Timestamp;
742
+ emailError?: string;
743
+ emailErrorAt?: Timestamp;
740
744
  }
741
745
 
742
746
  /**
@@ -737,6 +737,10 @@ interface PractitionerToken {
737
737
  expiresAt: Timestamp;
738
738
  usedBy?: string;
739
739
  usedAt?: Timestamp;
740
+ emailSent?: boolean;
741
+ emailSentAt?: Timestamp;
742
+ emailError?: string;
743
+ emailErrorAt?: Timestamp;
740
744
  }
741
745
 
742
746
  /**
@@ -40,6 +40,7 @@ __export(index_exports, {
40
40
  PatientAggregationService: () => PatientAggregationService,
41
41
  PractitionerAggregationService: () => PractitionerAggregationService,
42
42
  PractitionerInviteMailingService: () => PractitionerInviteMailingService,
43
+ PractitionerTokenStatus: () => PractitionerTokenStatus,
43
44
  ProcedureAggregationService: () => ProcedureAggregationService,
44
45
  UserRole: () => UserRole
45
46
  });
@@ -238,6 +239,13 @@ var admin2 = __toESM(require("firebase-admin"));
238
239
 
239
240
  // src/types/practitioner/index.ts
240
241
  var PRACTITIONERS_COLLECTION = "practitioners";
242
+ var PractitionerTokenStatus = /* @__PURE__ */ ((PractitionerTokenStatus2) => {
243
+ PractitionerTokenStatus2["ACTIVE"] = "active";
244
+ PractitionerTokenStatus2["USED"] = "used";
245
+ PractitionerTokenStatus2["EXPIRED"] = "expired";
246
+ PractitionerTokenStatus2["REVOKED"] = "revoked";
247
+ return PractitionerTokenStatus2;
248
+ })(PractitionerTokenStatus || {});
241
249
 
242
250
  // src/types/procedure/index.ts
243
251
  var PROCEDURES_COLLECTION = "procedures";
@@ -2009,6 +2017,17 @@ var PractitionerInviteMailingService = class extends BaseMailingService {
2009
2017
  if (!tokenData.expiresAt) {
2010
2018
  throw new Error(`Token ${tokenData.id} is missing expiration date`);
2011
2019
  }
2020
+ if (!tokenData.status) {
2021
+ throw new Error(`Token ${tokenData.id} has no status defined`);
2022
+ }
2023
+ Logger.info(
2024
+ `[PractitionerInviteMailingService] Token status validation:`,
2025
+ {
2026
+ tokenId: tokenData.id,
2027
+ status: tokenData.status,
2028
+ statusType: typeof tokenData.status
2029
+ }
2030
+ );
2012
2031
  Logger.info(
2013
2032
  `[PractitionerInviteMailingService] Fetching practitioner data: ${tokenData.practitionerId}`
2014
2033
  );
@@ -2696,6 +2715,7 @@ console.log("[Admin Module] Initialized and services exported.");
2696
2715
  PatientAggregationService,
2697
2716
  PractitionerAggregationService,
2698
2717
  PractitionerInviteMailingService,
2718
+ PractitionerTokenStatus,
2699
2719
  ProcedureAggregationService,
2700
2720
  UserRole
2701
2721
  });
@@ -198,6 +198,13 @@ import * as admin2 from "firebase-admin";
198
198
 
199
199
  // src/types/practitioner/index.ts
200
200
  var PRACTITIONERS_COLLECTION = "practitioners";
201
+ var PractitionerTokenStatus = /* @__PURE__ */ ((PractitionerTokenStatus2) => {
202
+ PractitionerTokenStatus2["ACTIVE"] = "active";
203
+ PractitionerTokenStatus2["USED"] = "used";
204
+ PractitionerTokenStatus2["EXPIRED"] = "expired";
205
+ PractitionerTokenStatus2["REVOKED"] = "revoked";
206
+ return PractitionerTokenStatus2;
207
+ })(PractitionerTokenStatus || {});
201
208
 
202
209
  // src/types/procedure/index.ts
203
210
  var PROCEDURES_COLLECTION = "procedures";
@@ -1969,6 +1976,17 @@ var PractitionerInviteMailingService = class extends BaseMailingService {
1969
1976
  if (!tokenData.expiresAt) {
1970
1977
  throw new Error(`Token ${tokenData.id} is missing expiration date`);
1971
1978
  }
1979
+ if (!tokenData.status) {
1980
+ throw new Error(`Token ${tokenData.id} has no status defined`);
1981
+ }
1982
+ Logger.info(
1983
+ `[PractitionerInviteMailingService] Token status validation:`,
1984
+ {
1985
+ tokenId: tokenData.id,
1986
+ status: tokenData.status,
1987
+ statusType: typeof tokenData.status
1988
+ }
1989
+ );
1972
1990
  Logger.info(
1973
1991
  `[PractitionerInviteMailingService] Fetching practitioner data: ${tokenData.practitionerId}`
1974
1992
  );
@@ -2655,6 +2673,7 @@ export {
2655
2673
  PatientAggregationService,
2656
2674
  PractitionerAggregationService,
2657
2675
  PractitionerInviteMailingService,
2676
+ PractitionerTokenStatus,
2658
2677
  ProcedureAggregationService,
2659
2678
  UserRole
2660
2679
  };
package/dist/index.d.mts CHANGED
@@ -1530,6 +1530,10 @@ interface PractitionerToken {
1530
1530
  expiresAt: Timestamp;
1531
1531
  usedBy?: string;
1532
1532
  usedAt?: Timestamp;
1533
+ emailSent?: boolean;
1534
+ emailSentAt?: Timestamp;
1535
+ emailError?: string;
1536
+ emailErrorAt?: Timestamp;
1533
1537
  }
1534
1538
  /**
1535
1539
  * Tip za kreiranje tokena za zdravstvenog radnika
package/dist/index.d.ts CHANGED
@@ -1530,6 +1530,10 @@ interface PractitionerToken {
1530
1530
  expiresAt: Timestamp;
1531
1531
  usedBy?: string;
1532
1532
  usedAt?: Timestamp;
1533
+ emailSent?: boolean;
1534
+ emailSentAt?: Timestamp;
1535
+ emailError?: string;
1536
+ emailErrorAt?: Timestamp;
1533
1537
  }
1534
1538
  /**
1535
1539
  * Tip za kreiranje tokena za zdravstvenog radnika
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.46",
4
+ "version": "1.5.47",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -43,11 +43,7 @@ export type {
43
43
  // Re-export types needed by cloud functions
44
44
  export type { Clinic, ClinicLocation } from "../types/clinic";
45
45
  export type { ClinicInfo } from "../types/profile";
46
- export type {
47
- Practitioner,
48
- PractitionerToken,
49
- PractitionerTokenStatus,
50
- } from "../types/practitioner";
46
+ export type { Practitioner, PractitionerToken } from "../types/practitioner";
51
47
  export type { DoctorInfo } from "../types/clinic";
52
48
  export type { Procedure, ProcedureSummaryInfo } from "../types/procedure";
53
49
  export type { PatientProfile as Patient } from "../types/patient";
@@ -59,6 +55,7 @@ export {
59
55
  NOTIFICATIONS_COLLECTION,
60
56
  } from "../types/notifications";
61
57
  export { UserRole } from "../types";
58
+ export { PractitionerTokenStatus } from "../types/practitioner";
62
59
 
63
60
  // Export admin classes/services explicitly by name
64
61
  export {
@@ -238,6 +238,21 @@ export class PractitionerInviteMailingService extends BaseMailingService {
238
238
  throw new Error(`Token ${tokenData.id} is missing expiration date`);
239
239
  }
240
240
 
241
+ // Validate token status (handle both enum and string values)
242
+ if (!tokenData.status) {
243
+ throw new Error(`Token ${tokenData.id} has no status defined`);
244
+ }
245
+
246
+ // Log token status to help with debugging
247
+ Logger.info(
248
+ `[PractitionerInviteMailingService] Token status validation:`,
249
+ {
250
+ tokenId: tokenData.id,
251
+ status: tokenData.status,
252
+ statusType: typeof tokenData.status,
253
+ }
254
+ );
255
+
241
256
  // Get practitioner data using constant and type
242
257
  Logger.info(
243
258
  `[PractitionerInviteMailingService] Fetching practitioner data: ${tokenData.practitionerId}`
@@ -183,6 +183,11 @@ export interface PractitionerToken {
183
183
  expiresAt: Timestamp;
184
184
  usedBy?: string;
185
185
  usedAt?: Timestamp;
186
+ // Email tracking fields added by Cloud Function
187
+ emailSent?: boolean;
188
+ emailSentAt?: Timestamp;
189
+ emailError?: string;
190
+ emailErrorAt?: Timestamp;
186
191
  }
187
192
 
188
193
  /**