mp-js-api 0.0.1

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.
Files changed (48) hide show
  1. package/dist/index.d.ts +120 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +341 -0
  4. package/dist/tables/addresses.d.ts +55 -0
  5. package/dist/tables/addresses.d.ts.map +1 -0
  6. package/dist/tables/addresses.js +60 -0
  7. package/dist/tables/contact-attributes.d.ts +19 -0
  8. package/dist/tables/contact-attributes.d.ts.map +1 -0
  9. package/dist/tables/contact-attributes.js +24 -0
  10. package/dist/tables/contacts.d.ts +105 -0
  11. package/dist/tables/contacts.d.ts.map +1 -0
  12. package/dist/tables/contacts.js +114 -0
  13. package/dist/tables/event-participants.d.ts +47 -0
  14. package/dist/tables/event-participants.d.ts.map +1 -0
  15. package/dist/tables/event-participants.js +52 -0
  16. package/dist/tables/events.d.ts +117 -0
  17. package/dist/tables/events.d.ts.map +1 -0
  18. package/dist/tables/events.js +122 -0
  19. package/dist/tables/group-participants.d.ts +61 -0
  20. package/dist/tables/group-participants.d.ts.map +1 -0
  21. package/dist/tables/group-participants.js +66 -0
  22. package/dist/tables/groups.d.ts +103 -0
  23. package/dist/tables/groups.d.ts.map +1 -0
  24. package/dist/tables/groups.js +108 -0
  25. package/dist/tables/households.d.ts +55 -0
  26. package/dist/tables/households.d.ts.map +1 -0
  27. package/dist/tables/households.js +60 -0
  28. package/dist/tables/participants.d.ts +63 -0
  29. package/dist/tables/participants.d.ts.map +1 -0
  30. package/dist/tables/participants.js +68 -0
  31. package/dist/utils/strings.d.ts +2 -0
  32. package/dist/utils/strings.d.ts.map +1 -0
  33. package/dist/utils/strings.js +30 -0
  34. package/package.json +26 -0
  35. package/src/index.ts +571 -0
  36. package/src/tables/addresses.ts +111 -0
  37. package/src/tables/contact-attributes.ts +40 -0
  38. package/src/tables/contacts.ts +223 -0
  39. package/src/tables/event-participants.ts +95 -0
  40. package/src/tables/events.ts +235 -0
  41. package/src/tables/group-participants.ts +123 -0
  42. package/src/tables/groups.ts +207 -0
  43. package/src/tables/households.ts +111 -0
  44. package/src/tables/participants.ts +127 -0
  45. package/src/utils/strings.ts +29 -0
  46. package/src/utils/types.d.ts +7 -0
  47. package/test/index.spec.ts +103 -0
  48. package/tsconfig.json +25 -0
@@ -0,0 +1,123 @@
1
+ export interface GroupParticipantRecord {
2
+ Group_Participant_ID: number;
3
+ Group_ID: number;
4
+ Participant_ID: number;
5
+ Group_Role_ID: number;
6
+ Start_Date: string;
7
+ End_Date: string | null;
8
+ Employee_Role: boolean;
9
+ Hours_Per_Week: null | number;
10
+ Notes: null | string;
11
+ Need_Book: boolean;
12
+ Email_Opt_Out: boolean;
13
+ Share_With_Group: boolean;
14
+ Auto_Promote: boolean;
15
+ _First_Attendance: null | string;
16
+ _Second_Attendance: null | string;
17
+ _Third_Attendance: null | string;
18
+ _Last_Attendance: null | string;
19
+ Show_Email: boolean;
20
+ Show_Phone: boolean;
21
+ Show_Last_Name: boolean;
22
+ Show_Photo: boolean;
23
+ _Show_Birthday: boolean;
24
+ _Show_Email: boolean;
25
+ _Show_Home_Phone: boolean;
26
+ _Show_Mobile_Phone: boolean;
27
+ _Show_Address: boolean;
28
+ _Show_Photo: boolean;
29
+ }
30
+
31
+ export interface GroupParticipant {
32
+ groupParticipantID: number;
33
+ groupID: number;
34
+ participantID: number;
35
+ groupRoleID: number;
36
+ startDate: string;
37
+ endDate: string | null;
38
+ employeeRole: boolean;
39
+ hoursPerWeek: null | number;
40
+ notes: null | string;
41
+ needBook: boolean;
42
+ emailOptOut: boolean;
43
+ shareWithGroup: boolean;
44
+ autoPromote: boolean;
45
+ firstAttendance: null | string;
46
+ secondAttendance: null | string;
47
+ thirdAttendance: null | string;
48
+ lastAttendance: null | string;
49
+ showEmail: boolean;
50
+ showPhone: boolean;
51
+ showLastName: boolean;
52
+ showPhoto: boolean;
53
+ _showBirthday: boolean;
54
+ _showEmail: boolean;
55
+ _showHomePhone: boolean;
56
+ _showMobilePhone: boolean;
57
+ _showAddress: boolean;
58
+ _showPhoto: boolean;
59
+ }
60
+
61
+ export function mapGroupParticipantRecord(originalObject: GroupParticipantRecord): GroupParticipant {
62
+ return {
63
+ groupParticipantID: originalObject.Group_Participant_ID,
64
+ groupID: originalObject.Group_ID,
65
+ participantID: originalObject.Participant_ID,
66
+ groupRoleID: originalObject.Group_Role_ID,
67
+ startDate: originalObject.Start_Date,
68
+ endDate: originalObject.End_Date,
69
+ employeeRole: originalObject.Employee_Role,
70
+ hoursPerWeek: originalObject.Hours_Per_Week,
71
+ notes: originalObject.Notes,
72
+ needBook: originalObject.Need_Book,
73
+ emailOptOut: originalObject.Email_Opt_Out,
74
+ shareWithGroup: originalObject.Share_With_Group,
75
+ autoPromote: originalObject.Auto_Promote,
76
+ firstAttendance: originalObject._First_Attendance,
77
+ secondAttendance: originalObject._Second_Attendance,
78
+ thirdAttendance: originalObject._Third_Attendance,
79
+ lastAttendance: originalObject._Last_Attendance,
80
+ showEmail: originalObject.Show_Email,
81
+ showPhone: originalObject.Show_Phone,
82
+ showLastName: originalObject.Show_Last_Name,
83
+ showPhoto: originalObject.Show_Photo,
84
+ _showBirthday: originalObject._Show_Birthday,
85
+ _showEmail: originalObject._Show_Email,
86
+ _showHomePhone: originalObject._Show_Home_Phone,
87
+ _showMobilePhone: originalObject._Show_Mobile_Phone,
88
+ _showAddress: originalObject._Show_Address,
89
+ _showPhoto: originalObject._Show_Photo,
90
+ };
91
+ }
92
+
93
+ export function mapGroupParticipantToGroupParticipantRecord(groupParticipant: GroupParticipant): GroupParticipantRecord {
94
+ return {
95
+ Group_Participant_ID: groupParticipant.groupParticipantID,
96
+ Group_ID: groupParticipant.groupID,
97
+ Participant_ID: groupParticipant.participantID,
98
+ Group_Role_ID: groupParticipant.groupRoleID,
99
+ Start_Date: groupParticipant.startDate,
100
+ End_Date: groupParticipant.endDate,
101
+ Employee_Role: groupParticipant.employeeRole,
102
+ Hours_Per_Week: groupParticipant.hoursPerWeek,
103
+ Notes: groupParticipant.notes,
104
+ Need_Book: groupParticipant.needBook,
105
+ Email_Opt_Out: groupParticipant.emailOptOut,
106
+ Share_With_Group: groupParticipant.shareWithGroup,
107
+ Auto_Promote: groupParticipant.autoPromote,
108
+ _First_Attendance: groupParticipant.firstAttendance,
109
+ _Second_Attendance: groupParticipant.secondAttendance,
110
+ _Third_Attendance: groupParticipant.thirdAttendance,
111
+ _Last_Attendance: groupParticipant.lastAttendance,
112
+ Show_Email: groupParticipant.showEmail,
113
+ Show_Phone: groupParticipant.showPhone,
114
+ Show_Last_Name: groupParticipant.showLastName,
115
+ Show_Photo: groupParticipant.showPhoto,
116
+ _Show_Birthday: groupParticipant._showBirthday,
117
+ _Show_Email: groupParticipant._showEmail,
118
+ _Show_Home_Phone: groupParticipant._showHomePhone,
119
+ _Show_Mobile_Phone: groupParticipant._showMobilePhone,
120
+ _Show_Address: groupParticipant._showAddress,
121
+ _Show_Photo: groupParticipant._showPhoto,
122
+ };
123
+ }
@@ -0,0 +1,207 @@
1
+ export interface GroupRecord {
2
+ Group_ID: number;
3
+ Group_Name: string;
4
+ Group_Type_ID: number;
5
+ Ministry_ID: number;
6
+ Congregation_ID: number;
7
+ Primary_Contact: number;
8
+ Description: null | string;
9
+ Start_Date: string;
10
+ End_Date: string;
11
+ Target_Size: null | number;
12
+ Parent_Group: null | number;
13
+ Priority_ID: null | number;
14
+ Small_Group_Information: null | string;
15
+ Offsite_Meeting_Address: null | string;
16
+ Group_Is_Full: boolean;
17
+ Available_Online: boolean;
18
+ Meets_Online: boolean;
19
+ Life_Stage_ID: null | number;
20
+ Group_Focus_ID: number;
21
+ Meeting_Time: null | string;
22
+ Meeting_Day_ID: null | number;
23
+ Meeting_Frequency_ID: null | number;
24
+ Meeting_Duration_ID: null | number;
25
+ Required_Book: null | string;
26
+ Descended_From: null | number;
27
+ Reason_Ended: null | string;
28
+ _Last_Attendance_Posted: null | string;
29
+ _Last_Group_Member_Changed: string;
30
+ Check_in_Information: null | string;
31
+ Secure_Check_in: boolean;
32
+ Suppress_Nametag: boolean;
33
+ Suppress_Care_Note: boolean;
34
+ On_Classroom_Manager: boolean;
35
+ Promotion_Information: null | string;
36
+ Promote_to_Group: null | string;
37
+ Age_in_Months_to_Promote: null | number;
38
+ Promote_Weekly: boolean;
39
+ Promotion_Date: null | string;
40
+ Promote_Participants_Only: boolean;
41
+ Notifications: null | string;
42
+ Send_Attendance_Notification: boolean;
43
+ Send_Service_Notification: boolean;
44
+ Enable_Discussion: boolean;
45
+ SMS_Number: null | string;
46
+ Default_Meeting_Room: null | string;
47
+ Create_Next_Meeting: boolean;
48
+ Next_Scheduled_Meeting: null | string;
49
+ Available_On_App: null | string;
50
+ }
51
+
52
+ export interface Group {
53
+ groupID: number;
54
+ groupName: string;
55
+ groupTypeID: number;
56
+ ministryID: number;
57
+ congregationID: number;
58
+ primaryContact: number;
59
+ description: null | string;
60
+ startDate: string;
61
+ endDate: string;
62
+ targetSize: null | number;
63
+ parentGroup: null | number;
64
+ priorityID: null | number;
65
+ smallGroupInformation: null | string;
66
+ offsiteMeetingAddress: null | string;
67
+ groupIsFull: boolean;
68
+ availableOnline: boolean;
69
+ meetsOnline: boolean;
70
+ lifeStageID: null | number;
71
+ groupFocusID: number;
72
+ meetingTime: null | string;
73
+ meetingDayID: null | number;
74
+ meetingFrequencyID: null | number;
75
+ meetingDurationID: null | number;
76
+ requiredBook: null | string;
77
+ descendedFrom: null | number;
78
+ reasonEnded: null | string;
79
+ lastAttendancePosted: null | string;
80
+ lastGroupMemberChanged: string;
81
+ checkInInformation: null | string;
82
+ secureCheckIn: boolean;
83
+ suppressNametag: boolean;
84
+ suppressCareNote: boolean;
85
+ onClassroomManager: boolean;
86
+ promotionInformation: null | string;
87
+ promoteToGroup: null | string;
88
+ ageInMonthsToPromote: null | number;
89
+ promoteWeekly: boolean;
90
+ promotionDate: null | string;
91
+ promoteParticipantsOnly: boolean;
92
+ notifications: null | string;
93
+ sendAttendanceNotification: boolean;
94
+ sendServiceNotification: boolean;
95
+ enableDiscussion: boolean;
96
+ smsNumber: null | string;
97
+ defaultMeetingRoom: null | string;
98
+ createNextMeeting: boolean;
99
+ nextScheduledMeeting: null | string;
100
+ availableOnApp: null | string;
101
+ }
102
+
103
+ export function mapGroupRecord(record: GroupRecord): Group {
104
+ return {
105
+ groupID: record.Group_ID,
106
+ groupName: record.Group_Name,
107
+ groupTypeID: record.Group_Type_ID,
108
+ ministryID: record.Ministry_ID,
109
+ congregationID: record.Congregation_ID,
110
+ primaryContact: record.Primary_Contact,
111
+ description: record.Description,
112
+ startDate: record.Start_Date,
113
+ endDate: record.End_Date,
114
+ targetSize: record.Target_Size,
115
+ parentGroup: record.Parent_Group,
116
+ priorityID: record.Priority_ID,
117
+ smallGroupInformation: record.Small_Group_Information,
118
+ offsiteMeetingAddress: record.Offsite_Meeting_Address,
119
+ groupIsFull: record.Group_Is_Full,
120
+ availableOnline: record.Available_Online,
121
+ meetsOnline: record.Meets_Online,
122
+ lifeStageID: record.Life_Stage_ID,
123
+ groupFocusID: record.Group_Focus_ID,
124
+ meetingTime: record.Meeting_Time,
125
+ meetingDayID: record.Meeting_Day_ID,
126
+ meetingFrequencyID: record.Meeting_Frequency_ID,
127
+ meetingDurationID: record.Meeting_Duration_ID,
128
+ requiredBook: record.Required_Book,
129
+ descendedFrom: record.Descended_From,
130
+ reasonEnded: record.Reason_Ended,
131
+ lastAttendancePosted: record._Last_Attendance_Posted,
132
+ lastGroupMemberChanged: record._Last_Group_Member_Changed,
133
+ checkInInformation: record.Check_in_Information,
134
+ secureCheckIn: record.Secure_Check_in,
135
+ suppressNametag: record.Suppress_Nametag,
136
+ suppressCareNote: record.Suppress_Care_Note,
137
+ onClassroomManager: record.On_Classroom_Manager,
138
+ promotionInformation: record.Promotion_Information,
139
+ promoteToGroup: record.Promote_to_Group,
140
+ ageInMonthsToPromote: record.Age_in_Months_to_Promote,
141
+ promoteWeekly: record.Promote_Weekly,
142
+ promotionDate: record.Promotion_Date,
143
+ promoteParticipantsOnly: record.Promote_Participants_Only,
144
+ notifications: record.Notifications,
145
+ sendAttendanceNotification: record.Send_Attendance_Notification,
146
+ sendServiceNotification: record.Send_Service_Notification,
147
+ enableDiscussion: record.Enable_Discussion,
148
+ smsNumber: record.SMS_Number,
149
+ defaultMeetingRoom: record.Default_Meeting_Room,
150
+ createNextMeeting: record.Create_Next_Meeting,
151
+ nextScheduledMeeting: record.Next_Scheduled_Meeting,
152
+ availableOnApp: record.Available_On_App,
153
+ };
154
+ }
155
+
156
+ export function mapGroupToGroupRecord(group: Group): GroupRecord {
157
+ return {
158
+ Group_ID: group.groupID,
159
+ Group_Name: group.groupName,
160
+ Group_Type_ID: group.groupTypeID,
161
+ Ministry_ID: group.ministryID,
162
+ Congregation_ID: group.congregationID,
163
+ Primary_Contact: group.primaryContact,
164
+ Description: group.description,
165
+ Start_Date: group.startDate,
166
+ End_Date: group.endDate,
167
+ Target_Size: group.targetSize,
168
+ Parent_Group: group.parentGroup,
169
+ Priority_ID: group.priorityID,
170
+ Small_Group_Information: group.smallGroupInformation,
171
+ Offsite_Meeting_Address: group.offsiteMeetingAddress,
172
+ Group_Is_Full: group.groupIsFull,
173
+ Available_Online: group.availableOnline,
174
+ Meets_Online: group.meetsOnline,
175
+ Life_Stage_ID: group.lifeStageID,
176
+ Group_Focus_ID: group.groupFocusID,
177
+ Meeting_Time: group.meetingTime,
178
+ Meeting_Day_ID: group.meetingDayID,
179
+ Meeting_Frequency_ID: group.meetingFrequencyID,
180
+ Meeting_Duration_ID: group.meetingDurationID,
181
+ Required_Book: group.requiredBook,
182
+ Descended_From: group.descendedFrom,
183
+ Reason_Ended: group.reasonEnded,
184
+ _Last_Attendance_Posted: group.lastAttendancePosted,
185
+ _Last_Group_Member_Changed: group.lastGroupMemberChanged,
186
+ Check_in_Information: group.checkInInformation,
187
+ Secure_Check_in: group.secureCheckIn,
188
+ Suppress_Nametag: group.suppressNametag,
189
+ Suppress_Care_Note: group.suppressCareNote,
190
+ On_Classroom_Manager: group.onClassroomManager,
191
+ Promotion_Information: group.promotionInformation,
192
+ Promote_to_Group: group.promoteToGroup,
193
+ Age_in_Months_to_Promote: group.ageInMonthsToPromote,
194
+ Promote_Weekly: group.promoteWeekly,
195
+ Promotion_Date: group.promotionDate,
196
+ Promote_Participants_Only: group.promoteParticipantsOnly,
197
+ Notifications: group.notifications,
198
+ Send_Attendance_Notification: group.sendAttendanceNotification,
199
+ Send_Service_Notification: group.sendServiceNotification,
200
+ Enable_Discussion: group.enableDiscussion,
201
+ SMS_Number: group.smsNumber,
202
+ Default_Meeting_Room: group.defaultMeetingRoom,
203
+ Create_Next_Meeting: group.createNextMeeting,
204
+ Next_Scheduled_Meeting: group.nextScheduledMeeting,
205
+ Available_On_App: group.availableOnApp,
206
+ };
207
+ }
@@ -0,0 +1,111 @@
1
+ export interface HouseholdRecord {
2
+ Household_ID: number;
3
+ Household_Name: string;
4
+ Address_ID: number;
5
+ Home_Phone: null | string;
6
+ Congregation_ID: number;
7
+ Care_Person: null | string;
8
+ Household_Source_ID: number;
9
+ Family_Call_Number: number;
10
+ Household_Preferences: null | string;
11
+ Home_Phone_Unlisted: boolean;
12
+ Home_Address_Unlisted: boolean;
13
+ Bulk_Mail_Opt_Out: boolean;
14
+ _First_Donation: null | string;
15
+ _Last_Donation: null | string;
16
+ _Last_Activity: string;
17
+ Seasonal_Alternate_Address_Settings: null | string;
18
+ Alternate_Mailing_Address: null | string;
19
+ Season_Start: null | string;
20
+ Season_End: null | string;
21
+ Repeats_Annually: boolean;
22
+ End_Seasonal_Alternate_Address_Settings: null | string;
23
+ Congregation_Drive_Time: null | string;
24
+ Driving_Distance: null | string;
25
+ Driving_Time: null | string;
26
+ }
27
+
28
+ export interface Household {
29
+ householdID: number;
30
+ householdName: string;
31
+ addressID: number;
32
+ homePhone: null | string;
33
+ congregationID: number;
34
+ carePerson: null | string;
35
+ householdSourceID: number;
36
+ familyCallNumber: number;
37
+ householdPreferences: null | string;
38
+ homePhoneUnlisted: boolean;
39
+ homeAddressUnlisted: boolean;
40
+ bulkMailOptOut: boolean;
41
+ firstDonation: null | string;
42
+ lastDonation: null | string;
43
+ lastActivity: string;
44
+ seasonalAlternateAddressSettings: null | string;
45
+ alternateMailingAddress: null | string;
46
+ seasonStart: null | string;
47
+ seasonEnd: null | string;
48
+ repeatsAnnually: boolean;
49
+ endSeasonalAlternateAddressSettings: null | string;
50
+ congregationDriveTime: null | string;
51
+ drivingDistance: null | string;
52
+ drivingTime: null | string;
53
+ }
54
+
55
+ export function mapHouseholdRecord(householdRecord: HouseholdRecord): Household {
56
+ return {
57
+ householdID: householdRecord.Household_ID,
58
+ householdName: householdRecord.Household_Name,
59
+ addressID: householdRecord.Address_ID,
60
+ homePhone: householdRecord.Home_Phone,
61
+ congregationID: householdRecord.Congregation_ID,
62
+ carePerson: householdRecord.Care_Person,
63
+ householdSourceID: householdRecord.Household_Source_ID,
64
+ familyCallNumber: householdRecord.Family_Call_Number,
65
+ householdPreferences: householdRecord.Household_Preferences,
66
+ homePhoneUnlisted: householdRecord.Home_Phone_Unlisted,
67
+ homeAddressUnlisted: householdRecord.Home_Address_Unlisted,
68
+ bulkMailOptOut: householdRecord.Bulk_Mail_Opt_Out,
69
+ firstDonation: householdRecord._First_Donation,
70
+ lastDonation: householdRecord._Last_Donation,
71
+ lastActivity: householdRecord._Last_Activity,
72
+ seasonalAlternateAddressSettings: householdRecord.Seasonal_Alternate_Address_Settings,
73
+ alternateMailingAddress: householdRecord.Alternate_Mailing_Address,
74
+ seasonStart: householdRecord.Season_Start,
75
+ seasonEnd: householdRecord.Season_End,
76
+ repeatsAnnually: householdRecord.Repeats_Annually,
77
+ endSeasonalAlternateAddressSettings: householdRecord.End_Seasonal_Alternate_Address_Settings,
78
+ congregationDriveTime: householdRecord.Congregation_Drive_Time,
79
+ drivingDistance: householdRecord.Driving_Distance,
80
+ drivingTime: householdRecord.Driving_Time,
81
+ };
82
+ }
83
+
84
+ export function mapHouseholdToHouseholdRecord(household: Household): HouseholdRecord {
85
+ return {
86
+ Household_ID: household.householdID,
87
+ Household_Name: household.householdName,
88
+ Address_ID: household.addressID,
89
+ Home_Phone: household.homePhone,
90
+ Congregation_ID: household.congregationID,
91
+ Care_Person: household.carePerson,
92
+ Household_Source_ID: household.householdSourceID,
93
+ Family_Call_Number: household.familyCallNumber,
94
+ Household_Preferences: household.householdPreferences,
95
+ Home_Phone_Unlisted: household.homePhoneUnlisted,
96
+ Home_Address_Unlisted: household.homeAddressUnlisted,
97
+ Bulk_Mail_Opt_Out: household.bulkMailOptOut,
98
+ _First_Donation: household.firstDonation,
99
+ _Last_Donation: household.lastDonation,
100
+ _Last_Activity: household.lastActivity,
101
+ Seasonal_Alternate_Address_Settings: household.seasonalAlternateAddressSettings,
102
+ Alternate_Mailing_Address: household.alternateMailingAddress,
103
+ Season_Start: household.seasonStart,
104
+ Season_End: household.seasonEnd,
105
+ Repeats_Annually: household.repeatsAnnually,
106
+ End_Seasonal_Alternate_Address_Settings: household.endSeasonalAlternateAddressSettings,
107
+ Congregation_Drive_Time: household.congregationDriveTime,
108
+ Driving_Distance: household.drivingDistance,
109
+ Driving_Time: household.drivingTime,
110
+ };
111
+ }
@@ -0,0 +1,127 @@
1
+ export interface ParticipantRecord {
2
+ Participant_ID: number;
3
+ Red_Flag_Notes: null | string;
4
+ Contact_ID: number;
5
+ Participant_Type_ID: number;
6
+ Member_Status_ID: null | number;
7
+ Participant_Engagement_ID: number;
8
+ Participant_Start_Date: string;
9
+ Participant_End_Date: null | string;
10
+ Notes: string;
11
+ _First_Attendance_Ever: null | string;
12
+ _Second_Attendance_Ever: null | string;
13
+ _Third_Attendance_Ever: null | string;
14
+ _Last_Attendance_Ever: null | string;
15
+ SubStatus_Name: null | string;
16
+ Status_Date: null | string;
17
+ Former_Denomination: null | string;
18
+ Former_Church: null | string;
19
+ _Background_Check_Information: null | string;
20
+ _Background_Check_Type: null | string;
21
+ _Background_Check_Status: null | string;
22
+ _Background_Check_Date: null | string;
23
+ Sacrament_Information: null | string;
24
+ Church_of_Record: null | string;
25
+ Baptism_Parish_Name: null | string;
26
+ Baptism_Parish_Address: null | string;
27
+ Birth_Certificate_Address: null | string;
28
+ Birth_Certificate_City: null | string;
29
+ Birth_Certificate_State: null | string;
30
+ }
31
+
32
+ export interface Participant {
33
+ participantID: number;
34
+ redFlagNotes: null | string;
35
+ contactID: number;
36
+ participantTypeID: number;
37
+ memberStatusID: null | number;
38
+ participantEngagementID: number;
39
+ participantStartDate: string;
40
+ participantEndDate: null | string;
41
+ notes: string;
42
+ firstAttendanceEver: null | string;
43
+ secondAttendanceEver: null | string;
44
+ thirdAttendanceEver: null | string;
45
+ lastAttendanceEver: null | string;
46
+ subStatusName: null | string;
47
+ statusDate: null | string;
48
+ formerDenomination: null | string;
49
+ formerChurch: null | string;
50
+ backgroundCheckInformation: null | string;
51
+ backgroundCheckType: null | string;
52
+ backgroundCheckStatus: null | string;
53
+ backgroundCheckDate: null | string;
54
+ sacramentInformation: null | string;
55
+ churchOfRecord: null | string;
56
+ baptismParishName: null | string;
57
+ baptismParishAddress: null | string;
58
+ birthCertificateAddress: null | string;
59
+ birthCertificateCity: null | string;
60
+ birthCertificateState: null | string;
61
+ }
62
+
63
+ export function mapParticipantRecord(record: ParticipantRecord): Participant {
64
+ return {
65
+ participantID: record.Participant_ID,
66
+ redFlagNotes: record.Red_Flag_Notes,
67
+ contactID: record.Contact_ID,
68
+ participantTypeID: record.Participant_Type_ID,
69
+ memberStatusID: record.Member_Status_ID,
70
+ participantEngagementID: record.Participant_Engagement_ID,
71
+ participantStartDate: record.Participant_Start_Date,
72
+ participantEndDate: record.Participant_End_Date,
73
+ notes: record.Notes,
74
+ firstAttendanceEver: record._First_Attendance_Ever,
75
+ secondAttendanceEver: record._Second_Attendance_Ever,
76
+ thirdAttendanceEver: record._Third_Attendance_Ever,
77
+ lastAttendanceEver: record._Last_Attendance_Ever,
78
+ subStatusName: record.SubStatus_Name,
79
+ statusDate: record.Status_Date,
80
+ formerDenomination: record.Former_Denomination,
81
+ formerChurch: record.Former_Church,
82
+ backgroundCheckInformation: record._Background_Check_Information,
83
+ backgroundCheckType: record._Background_Check_Type,
84
+ backgroundCheckStatus: record._Background_Check_Status,
85
+ backgroundCheckDate: record._Background_Check_Date,
86
+ sacramentInformation: record.Sacrament_Information,
87
+ churchOfRecord: record.Church_of_Record,
88
+ baptismParishName: record.Baptism_Parish_Name,
89
+ baptismParishAddress: record.Baptism_Parish_Address,
90
+ birthCertificateAddress: record.Birth_Certificate_Address,
91
+ birthCertificateCity: record.Birth_Certificate_City,
92
+ birthCertificateState: record.Birth_Certificate_State,
93
+ };
94
+ }
95
+
96
+ export function mapParticipantToParticipantRecord(participant: Participant): ParticipantRecord {
97
+ return {
98
+ Participant_ID: participant.participantID,
99
+ Red_Flag_Notes: participant.redFlagNotes,
100
+ Contact_ID: participant.contactID,
101
+ Participant_Type_ID: participant.participantTypeID,
102
+ Member_Status_ID: participant.memberStatusID,
103
+ Participant_Engagement_ID: participant.participantEngagementID,
104
+ Participant_Start_Date: participant.participantStartDate,
105
+ Participant_End_Date: participant.participantEndDate,
106
+ Notes: participant.notes,
107
+ _First_Attendance_Ever: participant.firstAttendanceEver,
108
+ _Second_Attendance_Ever: participant.secondAttendanceEver,
109
+ _Third_Attendance_Ever: participant.thirdAttendanceEver,
110
+ _Last_Attendance_Ever: participant.lastAttendanceEver,
111
+ SubStatus_Name: participant.subStatusName,
112
+ Status_Date: participant.statusDate,
113
+ Former_Denomination: participant.formerDenomination,
114
+ Former_Church: participant.formerChurch,
115
+ _Background_Check_Information: participant.backgroundCheckInformation,
116
+ _Background_Check_Type: participant.backgroundCheckType,
117
+ _Background_Check_Status: participant.backgroundCheckStatus,
118
+ _Background_Check_Date: participant.backgroundCheckDate,
119
+ Sacrament_Information: participant.sacramentInformation,
120
+ Church_of_Record: participant.churchOfRecord,
121
+ Baptism_Parish_Name: participant.baptismParishName,
122
+ Baptism_Parish_Address: participant.baptismParishAddress,
123
+ Birth_Certificate_Address: participant.birthCertificateAddress,
124
+ Birth_Certificate_City: participant.birthCertificateCity,
125
+ Birth_Certificate_State: participant.birthCertificateState,
126
+ };
127
+ }
@@ -0,0 +1,29 @@
1
+
2
+ String.prototype.escapeSql = function () {
3
+ return this.replace(/%|(?<=\w)'(?=\w)/g, function (char) {
4
+ switch (char) {
5
+ case "\0":
6
+ return "\\0";
7
+ case "\x08":
8
+ return "\\b";
9
+ case "\x09":
10
+ return "\\t";
11
+ case "\x1a":
12
+ return "\\z";
13
+ case "\n":
14
+ return "\\n";
15
+ case "\r":
16
+ return "\\r";
17
+ case "%":
18
+ return "%25"
19
+ case "'":
20
+ return "''"
21
+ case "\"":
22
+ case "\\":
23
+ return "\\" + char; // prepends a backslash to backslash, percent,
24
+ // and double/single quotes
25
+ default:
26
+ return char;
27
+ }
28
+ });
29
+ }
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface String {
3
+ escapeSql(): string;
4
+ }
5
+ }
6
+
7
+ export {};