@blackcode_sa/metaestetics-api 1.6.11 → 1.6.13
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/admin/index.d.mts +101 -1
- package/dist/admin/index.d.ts +101 -1
- package/dist/admin/index.js +2868 -1812
- package/dist/admin/index.mjs +2866 -1812
- package/package.json +1 -1
- package/src/admin/index.ts +5 -0
package/dist/admin/index.d.mts
CHANGED
|
@@ -1800,6 +1800,106 @@ declare class PatientAggregationService {
|
|
|
1800
1800
|
cancelUpcomingCalendarEventsForPatient(patientId: string): Promise<void>;
|
|
1801
1801
|
}
|
|
1802
1802
|
|
|
1803
|
+
/**
|
|
1804
|
+
* @class AppointmentAggregationService
|
|
1805
|
+
* @description Handles aggregation tasks and side effects related to appointment lifecycle events.
|
|
1806
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
1807
|
+
* triggered by changes in the appointments collection.
|
|
1808
|
+
*/
|
|
1809
|
+
declare class AppointmentAggregationService {
|
|
1810
|
+
private db;
|
|
1811
|
+
private appointmentMailingService;
|
|
1812
|
+
private notificationsAdmin;
|
|
1813
|
+
private calendarAdminService;
|
|
1814
|
+
private patientRequirementsAdminService;
|
|
1815
|
+
/**
|
|
1816
|
+
* Constructor for AppointmentAggregationService.
|
|
1817
|
+
* @param mailgunClient - An initialized Mailgun client instance.
|
|
1818
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
1819
|
+
*/
|
|
1820
|
+
constructor(mailgunClient: any, // Type as 'any' for now, to be provided by the calling Cloud Function
|
|
1821
|
+
firestore?: admin.firestore.Firestore);
|
|
1822
|
+
/**
|
|
1823
|
+
* Handles side effects when an appointment is first created.
|
|
1824
|
+
* This function would typically be called by an Firestore onCreate trigger.
|
|
1825
|
+
* @param {Appointment} appointment - The newly created Appointment object.
|
|
1826
|
+
* @returns {Promise<void>}
|
|
1827
|
+
*/
|
|
1828
|
+
handleAppointmentCreate(appointment: Appointment): Promise<void>;
|
|
1829
|
+
/**
|
|
1830
|
+
* Handles side effects when an appointment is updated.
|
|
1831
|
+
* This function would typically be called by an Firestore onUpdate trigger.
|
|
1832
|
+
* @param {Appointment} before - The Appointment object before the update.
|
|
1833
|
+
* @param {Appointment} after - The Appointment object after the update.
|
|
1834
|
+
* @returns {Promise<void>}
|
|
1835
|
+
*/
|
|
1836
|
+
handleAppointmentUpdate(before: Appointment, after: Appointment): Promise<void>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Handles side effects when an appointment is deleted.
|
|
1839
|
+
* @param deletedAppointment - The Appointment object that was deleted.
|
|
1840
|
+
* @returns {Promise<void>}
|
|
1841
|
+
*/
|
|
1842
|
+
handleAppointmentDelete(deletedAppointment: Appointment): Promise<void>;
|
|
1843
|
+
/**
|
|
1844
|
+
* Creates PRE_APPOINTMENT PatientRequirementInstance documents for a given appointment.
|
|
1845
|
+
* Uses the `appointment.preProcedureRequirements` array, which should contain relevant Requirement templates.
|
|
1846
|
+
* For each active PRE requirement template, it constructs a new PatientRequirementInstance document
|
|
1847
|
+
* with derived instructions and batch writes them to Firestore under the patient's `patient_requirements` subcollection.
|
|
1848
|
+
*
|
|
1849
|
+
* @param {Appointment} appointment - The appointment for which to create pre-requirement instances.
|
|
1850
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1851
|
+
*/
|
|
1852
|
+
private createPreAppointmentRequirementInstances;
|
|
1853
|
+
/**
|
|
1854
|
+
* Creates POST_APPOINTMENT PatientRequirementInstance documents for a given appointment.
|
|
1855
|
+
* Uses the `appointment.postProcedureRequirements` array.
|
|
1856
|
+
* For each active POST requirement template, it constructs a new PatientRequirementInstance document
|
|
1857
|
+
* with derived instructions and batch writes them to Firestore under the patient's `patient_requirements` subcollection.
|
|
1858
|
+
*
|
|
1859
|
+
* @param {Appointment} appointment - The appointment for which to create post-requirement instances.
|
|
1860
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1861
|
+
*/
|
|
1862
|
+
private createPostAppointmentRequirementInstances;
|
|
1863
|
+
/**
|
|
1864
|
+
* Updates the overallStatus of all PatientRequirementInstance documents associated with a given appointment.
|
|
1865
|
+
* This is typically used when an appointment is cancelled or rescheduled, making existing requirements void.
|
|
1866
|
+
*
|
|
1867
|
+
* @param {Appointment} appointment - The appointment whose requirement instances need updating.
|
|
1868
|
+
* @param {PatientRequirementOverallStatus} newOverallStatus - The new status to set (e.g., CANCELLED_APPOINTMENT).
|
|
1869
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1870
|
+
*/
|
|
1871
|
+
private updateRelatedPatientRequirementInstances;
|
|
1872
|
+
/**
|
|
1873
|
+
* Manages denormalized links between a patient and the clinic/practitioner associated with an appointment.
|
|
1874
|
+
* Adds patientId to arrays on clinic and practitioner documents on appointment creation.
|
|
1875
|
+
* Removes patientId on appointment cancellation (basic removal, can be enhanced).
|
|
1876
|
+
*
|
|
1877
|
+
* @param {Appointment} appointment - The appointment object.
|
|
1878
|
+
* @param {"create" | "cancel"} action - 'create' to add links, 'cancel' to remove them.
|
|
1879
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1880
|
+
*/
|
|
1881
|
+
private managePatientClinicPractitionerLinks;
|
|
1882
|
+
private fetchPatientProfile;
|
|
1883
|
+
/**
|
|
1884
|
+
* Fetches the sensitive information for a given patient ID.
|
|
1885
|
+
* @param patientId The ID of the patient to fetch sensitive information for.
|
|
1886
|
+
* @returns {Promise<PatientSensitiveInfo | null>} The patient sensitive information or null if not found or an error occurs.
|
|
1887
|
+
*/
|
|
1888
|
+
private fetchPatientSensitiveInfo;
|
|
1889
|
+
/**
|
|
1890
|
+
* Fetches the profile for a given practitioner ID.
|
|
1891
|
+
* @param practitionerId The ID of the practitioner to fetch.
|
|
1892
|
+
* @returns {Promise<Practitioner | null>} The practitioner profile or null if not found or an error occurs.
|
|
1893
|
+
*/
|
|
1894
|
+
private fetchPractitionerProfile;
|
|
1895
|
+
/**
|
|
1896
|
+
* Fetches the information for a given clinic ID.
|
|
1897
|
+
* @param clinicId The ID of the clinic to fetch.
|
|
1898
|
+
* @returns {Promise<Clinic | null>} The clinic information or null if not found or an error occurs.
|
|
1899
|
+
*/
|
|
1900
|
+
private fetchClinicInfo;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1803
1903
|
/**
|
|
1804
1904
|
* Minimal interface for the new mailgun.js client's messages API
|
|
1805
1905
|
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
@@ -2166,4 +2266,4 @@ interface TimeInterval {
|
|
|
2166
2266
|
end: Timestamp;
|
|
2167
2267
|
}
|
|
2168
2268
|
|
|
2169
|
-
export { type AppointmentReminderNotification, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, type BookingAvailabilityRequest, type BookingAvailabilityResponse, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type TimeInterval, UserRole };
|
|
2269
|
+
export { type Appointment, AppointmentAggregationService, type AppointmentReminderNotification, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, type BookingAvailabilityRequest, type BookingAvailabilityResponse, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type TimeInterval, UserRole };
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1800,6 +1800,106 @@ declare class PatientAggregationService {
|
|
|
1800
1800
|
cancelUpcomingCalendarEventsForPatient(patientId: string): Promise<void>;
|
|
1801
1801
|
}
|
|
1802
1802
|
|
|
1803
|
+
/**
|
|
1804
|
+
* @class AppointmentAggregationService
|
|
1805
|
+
* @description Handles aggregation tasks and side effects related to appointment lifecycle events.
|
|
1806
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
1807
|
+
* triggered by changes in the appointments collection.
|
|
1808
|
+
*/
|
|
1809
|
+
declare class AppointmentAggregationService {
|
|
1810
|
+
private db;
|
|
1811
|
+
private appointmentMailingService;
|
|
1812
|
+
private notificationsAdmin;
|
|
1813
|
+
private calendarAdminService;
|
|
1814
|
+
private patientRequirementsAdminService;
|
|
1815
|
+
/**
|
|
1816
|
+
* Constructor for AppointmentAggregationService.
|
|
1817
|
+
* @param mailgunClient - An initialized Mailgun client instance.
|
|
1818
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
1819
|
+
*/
|
|
1820
|
+
constructor(mailgunClient: any, // Type as 'any' for now, to be provided by the calling Cloud Function
|
|
1821
|
+
firestore?: admin.firestore.Firestore);
|
|
1822
|
+
/**
|
|
1823
|
+
* Handles side effects when an appointment is first created.
|
|
1824
|
+
* This function would typically be called by an Firestore onCreate trigger.
|
|
1825
|
+
* @param {Appointment} appointment - The newly created Appointment object.
|
|
1826
|
+
* @returns {Promise<void>}
|
|
1827
|
+
*/
|
|
1828
|
+
handleAppointmentCreate(appointment: Appointment): Promise<void>;
|
|
1829
|
+
/**
|
|
1830
|
+
* Handles side effects when an appointment is updated.
|
|
1831
|
+
* This function would typically be called by an Firestore onUpdate trigger.
|
|
1832
|
+
* @param {Appointment} before - The Appointment object before the update.
|
|
1833
|
+
* @param {Appointment} after - The Appointment object after the update.
|
|
1834
|
+
* @returns {Promise<void>}
|
|
1835
|
+
*/
|
|
1836
|
+
handleAppointmentUpdate(before: Appointment, after: Appointment): Promise<void>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Handles side effects when an appointment is deleted.
|
|
1839
|
+
* @param deletedAppointment - The Appointment object that was deleted.
|
|
1840
|
+
* @returns {Promise<void>}
|
|
1841
|
+
*/
|
|
1842
|
+
handleAppointmentDelete(deletedAppointment: Appointment): Promise<void>;
|
|
1843
|
+
/**
|
|
1844
|
+
* Creates PRE_APPOINTMENT PatientRequirementInstance documents for a given appointment.
|
|
1845
|
+
* Uses the `appointment.preProcedureRequirements` array, which should contain relevant Requirement templates.
|
|
1846
|
+
* For each active PRE requirement template, it constructs a new PatientRequirementInstance document
|
|
1847
|
+
* with derived instructions and batch writes them to Firestore under the patient's `patient_requirements` subcollection.
|
|
1848
|
+
*
|
|
1849
|
+
* @param {Appointment} appointment - The appointment for which to create pre-requirement instances.
|
|
1850
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1851
|
+
*/
|
|
1852
|
+
private createPreAppointmentRequirementInstances;
|
|
1853
|
+
/**
|
|
1854
|
+
* Creates POST_APPOINTMENT PatientRequirementInstance documents for a given appointment.
|
|
1855
|
+
* Uses the `appointment.postProcedureRequirements` array.
|
|
1856
|
+
* For each active POST requirement template, it constructs a new PatientRequirementInstance document
|
|
1857
|
+
* with derived instructions and batch writes them to Firestore under the patient's `patient_requirements` subcollection.
|
|
1858
|
+
*
|
|
1859
|
+
* @param {Appointment} appointment - The appointment for which to create post-requirement instances.
|
|
1860
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1861
|
+
*/
|
|
1862
|
+
private createPostAppointmentRequirementInstances;
|
|
1863
|
+
/**
|
|
1864
|
+
* Updates the overallStatus of all PatientRequirementInstance documents associated with a given appointment.
|
|
1865
|
+
* This is typically used when an appointment is cancelled or rescheduled, making existing requirements void.
|
|
1866
|
+
*
|
|
1867
|
+
* @param {Appointment} appointment - The appointment whose requirement instances need updating.
|
|
1868
|
+
* @param {PatientRequirementOverallStatus} newOverallStatus - The new status to set (e.g., CANCELLED_APPOINTMENT).
|
|
1869
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1870
|
+
*/
|
|
1871
|
+
private updateRelatedPatientRequirementInstances;
|
|
1872
|
+
/**
|
|
1873
|
+
* Manages denormalized links between a patient and the clinic/practitioner associated with an appointment.
|
|
1874
|
+
* Adds patientId to arrays on clinic and practitioner documents on appointment creation.
|
|
1875
|
+
* Removes patientId on appointment cancellation (basic removal, can be enhanced).
|
|
1876
|
+
*
|
|
1877
|
+
* @param {Appointment} appointment - The appointment object.
|
|
1878
|
+
* @param {"create" | "cancel"} action - 'create' to add links, 'cancel' to remove them.
|
|
1879
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
1880
|
+
*/
|
|
1881
|
+
private managePatientClinicPractitionerLinks;
|
|
1882
|
+
private fetchPatientProfile;
|
|
1883
|
+
/**
|
|
1884
|
+
* Fetches the sensitive information for a given patient ID.
|
|
1885
|
+
* @param patientId The ID of the patient to fetch sensitive information for.
|
|
1886
|
+
* @returns {Promise<PatientSensitiveInfo | null>} The patient sensitive information or null if not found or an error occurs.
|
|
1887
|
+
*/
|
|
1888
|
+
private fetchPatientSensitiveInfo;
|
|
1889
|
+
/**
|
|
1890
|
+
* Fetches the profile for a given practitioner ID.
|
|
1891
|
+
* @param practitionerId The ID of the practitioner to fetch.
|
|
1892
|
+
* @returns {Promise<Practitioner | null>} The practitioner profile or null if not found or an error occurs.
|
|
1893
|
+
*/
|
|
1894
|
+
private fetchPractitionerProfile;
|
|
1895
|
+
/**
|
|
1896
|
+
* Fetches the information for a given clinic ID.
|
|
1897
|
+
* @param clinicId The ID of the clinic to fetch.
|
|
1898
|
+
* @returns {Promise<Clinic | null>} The clinic information or null if not found or an error occurs.
|
|
1899
|
+
*/
|
|
1900
|
+
private fetchClinicInfo;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1803
1903
|
/**
|
|
1804
1904
|
* Minimal interface for the new mailgun.js client's messages API
|
|
1805
1905
|
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
@@ -2166,4 +2266,4 @@ interface TimeInterval {
|
|
|
2166
2266
|
end: Timestamp;
|
|
2167
2267
|
}
|
|
2168
2268
|
|
|
2169
|
-
export { type AppointmentReminderNotification, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, type BookingAvailabilityRequest, type BookingAvailabilityResponse, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type TimeInterval, UserRole };
|
|
2269
|
+
export { type Appointment, AppointmentAggregationService, type AppointmentReminderNotification, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, type BookingAvailabilityRequest, type BookingAvailabilityResponse, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type TimeInterval, UserRole };
|