mp-js-api 0.0.32 → 0.0.34
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/.claude/settings.local.json +3 -1
- package/dev/MP_Tables_And_Columns_Info.csv +2472 -0
- package/dev/Table-Lookup-Convention.html +136 -0
- package/dist/index.d.ts +52 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -0
- package/dist/tables/contact-relationships.d.ts +21 -0
- package/dist/tables/contact-relationships.d.ts.map +1 -0
- package/dist/tables/contact-relationships.js +2 -0
- package/dist/tables/form-fields.d.ts +29 -0
- package/dist/tables/form-fields.d.ts.map +1 -0
- package/dist/tables/form-fields.js +2 -0
- package/dist/tables/participation-details.d.ts +15 -0
- package/dist/tables/participation-details.d.ts.map +1 -0
- package/dist/tables/participation-details.js +2 -0
- package/docs/npm-publishing-guide.md +125 -0
- package/package.json +2 -1
- package/src/index.ts +150 -0
- package/src/tables/contact-relationships.ts +22 -0
- package/src/tables/form-fields.ts +30 -0
- package/src/tables/participation-details.ts +15 -0
package/src/index.ts
CHANGED
|
@@ -13,9 +13,12 @@ import { Household, HouseholdRecord } from './tables/households';
|
|
|
13
13
|
import { Participant, ParticipantRecord } from './tables/participants';
|
|
14
14
|
import { EventParticipant, EventParticipantRecord } from './tables/event-participants';
|
|
15
15
|
import { GroupParticipant, GroupParticipantRecord } from './tables/group-participants';
|
|
16
|
+
import { ParticipationDetails, ParticipationDetailsRecord } from './tables/participation-details';
|
|
16
17
|
import { ContactAttribute, ContactAttributeRecord, ContactWithAttribute } from './tables/contact-attributes';
|
|
17
18
|
import { FormResponse, FormResponseRecord } from './tables/form-responses';
|
|
18
19
|
import { FormResponseAnswer, FormResponseAnswerRecord } from './tables/from-response-answers';
|
|
20
|
+
import { FormField, FormFieldRecord } from './tables/form-fields';
|
|
21
|
+
import { ContactRelationship, ContactRelationshipRecord } from './tables/contact-relationships';
|
|
19
22
|
import { ContactEmailAddress, ContactEmailAddressRecord, ContactWithEmailAddress, ContactWithEmailAddresses } from './tables/contact-email-addresses';
|
|
20
23
|
import { AttachedFile } from './tables/files';
|
|
21
24
|
|
|
@@ -47,6 +50,10 @@ export type CreateGroupParticipantPayload = WithRequired<
|
|
|
47
50
|
Partial<GroupParticipant>,
|
|
48
51
|
'groupID' | 'participantID' | 'groupRoleID' | 'startDate'
|
|
49
52
|
>;
|
|
53
|
+
export type CreateParticipationDetailsPayload = WithRequired<
|
|
54
|
+
Partial<ParticipationDetails>,
|
|
55
|
+
'eventParticipantID' | 'participationItemID'
|
|
56
|
+
>;
|
|
50
57
|
export type CreateContactAttributePayload = WithRequired<
|
|
51
58
|
Partial<ContactAttribute>,
|
|
52
59
|
'attributeID' | 'contactID' | 'startDate'
|
|
@@ -59,10 +66,18 @@ export type CreateFormResponseAnswerPayload = WithRequired<
|
|
|
59
66
|
Omit<Partial<FormResponseAnswer>, 'formResponseAnswerID'>,
|
|
60
67
|
'formFieldID' | 'formResponseID'
|
|
61
68
|
>;
|
|
69
|
+
export type CreateFormFieldPayload = WithRequired<
|
|
70
|
+
Omit<Partial<FormField>, 'formFieldID'>,
|
|
71
|
+
'formID' | 'fieldLabel' | 'fieldOrder' | 'fieldTypeID' | 'required'
|
|
72
|
+
>;
|
|
62
73
|
export type CreateContactEmailAddressPayload = WithRequired<
|
|
63
74
|
Omit<Partial<ContactEmailAddress>, 'emailAddressID'>,
|
|
64
75
|
'emailAddress' | 'contactID'
|
|
65
76
|
>;
|
|
77
|
+
export type CreateContactRelationshipPayload = WithRequired<
|
|
78
|
+
Omit<Partial<ContactRelationship>, 'contactRelationshipID'>,
|
|
79
|
+
'contactID' | 'relationshipID' | 'relatedContactID'
|
|
80
|
+
>;
|
|
66
81
|
export type CreateFilePayload = WithRequired<
|
|
67
82
|
Omit<Partial<AttachedFile>, 'FileId'>,
|
|
68
83
|
'Description' | 'IsDefaultImage'
|
|
@@ -149,10 +164,22 @@ export type MPInstance = {
|
|
|
149
164
|
id: number,
|
|
150
165
|
mpQuery?: MPGetQuery
|
|
151
166
|
): Promise<GroupParticipant | undefined | { error: ErrorDetails; }>;
|
|
167
|
+
getParticipationDetail(
|
|
168
|
+
id: number,
|
|
169
|
+
mpQuery?: MPGetQuery
|
|
170
|
+
): Promise<ParticipationDetails | undefined | { error: ErrorDetails; }>;
|
|
152
171
|
getFormResponse(
|
|
153
172
|
id: number,
|
|
154
173
|
mpQuery?: MPGetQuery
|
|
155
174
|
): Promise<FormResponse | undefined | { error: ErrorDetails; }>;
|
|
175
|
+
getFormField(
|
|
176
|
+
id: number,
|
|
177
|
+
mpQuery?: MPGetQuery
|
|
178
|
+
): Promise<FormField | undefined | { error: ErrorDetails; }>;
|
|
179
|
+
getContactRelationship(
|
|
180
|
+
id: number,
|
|
181
|
+
mpQuery?: MPGetQuery
|
|
182
|
+
): Promise<ContactRelationship | undefined | { error: ErrorDetails; }>;
|
|
156
183
|
|
|
157
184
|
getContacts(
|
|
158
185
|
mpQuery: AtLeastOne<MPGetQuery>
|
|
@@ -193,6 +220,15 @@ export type MPInstance = {
|
|
|
193
220
|
getFormResponseAnswers(
|
|
194
221
|
mpQuery: AtLeastOne<MPGetQuery>
|
|
195
222
|
): Promise<FormResponseAnswer[] | { error: ErrorDetails; }>;
|
|
223
|
+
getParticipationDetails(
|
|
224
|
+
mpQuery: AtLeastOne<MPGetQuery>
|
|
225
|
+
): Promise<ParticipationDetails[] | { error: ErrorDetails; }>;
|
|
226
|
+
getFormFields(
|
|
227
|
+
mpQuery: AtLeastOne<MPGetQuery>
|
|
228
|
+
): Promise<FormField[] | { error: ErrorDetails; }>;
|
|
229
|
+
getContactRelationships(
|
|
230
|
+
mpQuery: AtLeastOne<MPGetQuery>
|
|
231
|
+
): Promise<ContactRelationship[] | { error: ErrorDetails; }>;
|
|
196
232
|
|
|
197
233
|
createContact(
|
|
198
234
|
data: CreateContactPayload,
|
|
@@ -234,6 +270,30 @@ export type MPInstance = {
|
|
|
234
270
|
data: CreateContactEmailAddressPayload[],
|
|
235
271
|
mpQuery?: MPCreateQuery
|
|
236
272
|
): Promise<ContactEmailAddress[] | { error: ErrorDetails; }>;
|
|
273
|
+
createParticipationDetail(
|
|
274
|
+
data: CreateParticipationDetailsPayload,
|
|
275
|
+
mpQuery?: MPCreateQuery
|
|
276
|
+
): Promise<ParticipationDetails | { error: ErrorDetails; }>;
|
|
277
|
+
createParticipationDetails(
|
|
278
|
+
data: CreateParticipationDetailsPayload[],
|
|
279
|
+
mpQuery?: MPCreateQuery
|
|
280
|
+
): Promise<ParticipationDetails[] | { error: ErrorDetails; }>;
|
|
281
|
+
createFormField(
|
|
282
|
+
data: CreateFormFieldPayload,
|
|
283
|
+
mpQuery?: MPCreateQuery
|
|
284
|
+
): Promise<FormField | { error: ErrorDetails; }>;
|
|
285
|
+
createFormFields(
|
|
286
|
+
data: CreateFormFieldPayload[],
|
|
287
|
+
mpQuery?: MPCreateQuery
|
|
288
|
+
): Promise<FormField[] | { error: ErrorDetails; }>;
|
|
289
|
+
createContactRelationship(
|
|
290
|
+
data: CreateContactRelationshipPayload,
|
|
291
|
+
mpQuery?: MPCreateQuery
|
|
292
|
+
): Promise<ContactRelationship | { error: ErrorDetails; }>;
|
|
293
|
+
createContactRelationships(
|
|
294
|
+
data: CreateContactRelationshipPayload[],
|
|
295
|
+
mpQuery?: MPCreateQuery
|
|
296
|
+
): Promise<ContactRelationship[] | { error: ErrorDetails; }>;
|
|
237
297
|
|
|
238
298
|
updateContacts(
|
|
239
299
|
contacts: WithRequired<Partial<Contact>, 'contactID'>[],
|
|
@@ -255,6 +315,18 @@ export type MPInstance = {
|
|
|
255
315
|
participants: WithRequired<Partial<FormResponseAnswer>, 'formResponseAnswerID'>[],
|
|
256
316
|
mpQuery?: MPUpdateQuery
|
|
257
317
|
): Promise<FormResponseAnswer[] | { error: ErrorDetails; }>;
|
|
318
|
+
updateParticipationDetails(
|
|
319
|
+
details: WithRequired<Partial<ParticipationDetails>, 'participationDetailID'>[],
|
|
320
|
+
mpQuery?: MPUpdateQuery
|
|
321
|
+
): Promise<ParticipationDetails[] | { error: ErrorDetails; }>;
|
|
322
|
+
updateFormFields(
|
|
323
|
+
fields: WithRequired<Partial<FormField>, 'formFieldID'>[],
|
|
324
|
+
mpQuery?: MPUpdateQuery
|
|
325
|
+
): Promise<FormField[] | { error: ErrorDetails; }>;
|
|
326
|
+
updateContactRelationships(
|
|
327
|
+
relationships: WithRequired<Partial<ContactRelationship>, 'contactRelationshipID'>[],
|
|
328
|
+
mpQuery?: MPUpdateQuery
|
|
329
|
+
): Promise<ContactRelationship[] | { error: ErrorDetails; }>;
|
|
258
330
|
|
|
259
331
|
getFiles(table: string, recordId: number, mpQuery?: MPGetQuery)
|
|
260
332
|
: Promise<AttachedFile[] | { error: ErrorDetails; }>;
|
|
@@ -370,11 +442,26 @@ export const createMPInstance = ({ auth }: { auth: { username: string; password:
|
|
|
370
442
|
{ path: `/tables/group_participants`, id, mpQuery }
|
|
371
443
|
);
|
|
372
444
|
},
|
|
445
|
+
async getParticipationDetail(id, mpQuery = {}) {
|
|
446
|
+
return getOne<ParticipationDetails>(
|
|
447
|
+
{ path: `/tables/participation_details`, id, mpQuery }
|
|
448
|
+
);
|
|
449
|
+
},
|
|
373
450
|
async getFormResponse(id, mpQuery = {}) {
|
|
374
451
|
return getOne<FormResponse>(
|
|
375
452
|
{ path: `/tables/form_responses`, id, mpQuery }
|
|
376
453
|
);
|
|
377
454
|
},
|
|
455
|
+
async getFormField(id, mpQuery = {}) {
|
|
456
|
+
return getOne<FormField>(
|
|
457
|
+
{ path: `/tables/form_fields`, id, mpQuery }
|
|
458
|
+
);
|
|
459
|
+
},
|
|
460
|
+
async getContactRelationship(id, mpQuery = {}) {
|
|
461
|
+
return getOne<ContactRelationship>(
|
|
462
|
+
{ path: `/tables/contact_relationships`, id, mpQuery }
|
|
463
|
+
);
|
|
464
|
+
},
|
|
378
465
|
async getContacts(mpQuery) {
|
|
379
466
|
return getMany<Contact>(
|
|
380
467
|
{ path: `/tables/contacts`, mpQuery }
|
|
@@ -449,6 +536,21 @@ export const createMPInstance = ({ auth }: { auth: { username: string; password:
|
|
|
449
536
|
{ path: `/tables/form_response_answers`, mpQuery }
|
|
450
537
|
);
|
|
451
538
|
},
|
|
539
|
+
async getParticipationDetails(mpQuery) {
|
|
540
|
+
return getMany<ParticipationDetails>(
|
|
541
|
+
{ path: `/tables/participation_details`, mpQuery }
|
|
542
|
+
);
|
|
543
|
+
},
|
|
544
|
+
async getFormFields(mpQuery) {
|
|
545
|
+
return getMany<FormField>(
|
|
546
|
+
{ path: `/tables/form_fields`, mpQuery }
|
|
547
|
+
);
|
|
548
|
+
},
|
|
549
|
+
async getContactRelationships(mpQuery) {
|
|
550
|
+
return getMany<ContactRelationship>(
|
|
551
|
+
{ path: `/tables/contact_relationships`, mpQuery }
|
|
552
|
+
);
|
|
553
|
+
},
|
|
452
554
|
|
|
453
555
|
async createContact(data, mpQuery = {}) {
|
|
454
556
|
return createOne<Contact>(
|
|
@@ -500,6 +602,36 @@ export const createMPInstance = ({ auth }: { auth: { username: string; password:
|
|
|
500
602
|
{ path: `/tables/contact_email_addresses`, mpQuery, data }
|
|
501
603
|
);
|
|
502
604
|
},
|
|
605
|
+
async createParticipationDetail(data, mpQuery) {
|
|
606
|
+
return createOne<ParticipationDetails>(
|
|
607
|
+
{ path: `/tables/participation_details`, mpQuery, data }
|
|
608
|
+
);
|
|
609
|
+
},
|
|
610
|
+
async createParticipationDetails(data, mpQuery) {
|
|
611
|
+
return createMany<ParticipationDetails>(
|
|
612
|
+
{ path: `/tables/participation_details`, mpQuery, data }
|
|
613
|
+
);
|
|
614
|
+
},
|
|
615
|
+
async createFormField(data, mpQuery) {
|
|
616
|
+
return createOne<FormField>(
|
|
617
|
+
{ path: `/tables/form_fields`, mpQuery, data }
|
|
618
|
+
);
|
|
619
|
+
},
|
|
620
|
+
async createFormFields(data, mpQuery) {
|
|
621
|
+
return createMany<FormField>(
|
|
622
|
+
{ path: `/tables/form_fields`, mpQuery, data }
|
|
623
|
+
);
|
|
624
|
+
},
|
|
625
|
+
async createContactRelationship(data, mpQuery) {
|
|
626
|
+
return createOne<ContactRelationship>(
|
|
627
|
+
{ path: `/tables/contact_relationships`, mpQuery, data }
|
|
628
|
+
);
|
|
629
|
+
},
|
|
630
|
+
async createContactRelationships(data, mpQuery) {
|
|
631
|
+
return createMany<ContactRelationship>(
|
|
632
|
+
{ path: `/tables/contact_relationships`, mpQuery, data }
|
|
633
|
+
);
|
|
634
|
+
},
|
|
503
635
|
async updateContacts(data, mpQuery) {
|
|
504
636
|
return updateMany<Contact>(
|
|
505
637
|
{ path: `/tables/contacts`, mpQuery, data }
|
|
@@ -525,6 +657,21 @@ export const createMPInstance = ({ auth }: { auth: { username: string; password:
|
|
|
525
657
|
{ path: `/tables/form_response_answers`, mpQuery, data }
|
|
526
658
|
);
|
|
527
659
|
},
|
|
660
|
+
async updateParticipationDetails(data, mpQuery) {
|
|
661
|
+
return updateMany<ParticipationDetails>(
|
|
662
|
+
{ path: `/tables/participation_details`, mpQuery, data }
|
|
663
|
+
);
|
|
664
|
+
},
|
|
665
|
+
async updateFormFields(data, mpQuery) {
|
|
666
|
+
return updateMany<FormField>(
|
|
667
|
+
{ path: `/tables/form_fields`, mpQuery, data }
|
|
668
|
+
);
|
|
669
|
+
},
|
|
670
|
+
async updateContactRelationships(data, mpQuery) {
|
|
671
|
+
return updateMany<ContactRelationship>(
|
|
672
|
+
{ path: `/tables/contact_relationships`, mpQuery, data }
|
|
673
|
+
);
|
|
674
|
+
},
|
|
528
675
|
|
|
529
676
|
async getFiles(table, recordId) {
|
|
530
677
|
return getMany<AttachedFile>(
|
|
@@ -561,15 +708,18 @@ export {
|
|
|
561
708
|
Group,
|
|
562
709
|
EventParticipant,
|
|
563
710
|
GroupParticipant,
|
|
711
|
+
ParticipationDetails,
|
|
564
712
|
Household,
|
|
565
713
|
Address,
|
|
566
714
|
FormResponse,
|
|
567
715
|
FormResponseAnswer,
|
|
716
|
+
FormField,
|
|
568
717
|
ContactAttribute,
|
|
569
718
|
ContactWithAttribute,
|
|
570
719
|
ContactEmailAddress,
|
|
571
720
|
ContactWithEmailAddress,
|
|
572
721
|
ContactWithEmailAddresses,
|
|
722
|
+
ContactRelationship,
|
|
573
723
|
|
|
574
724
|
// Communications endpoint types
|
|
575
725
|
Communication,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ContactRelationshipRecord {
|
|
2
|
+
Contact_Relationship_ID: number;
|
|
3
|
+
Contact_ID: number;
|
|
4
|
+
Relationship_ID: number;
|
|
5
|
+
Related_Contact_ID: number;
|
|
6
|
+
Start_Date: string | null;
|
|
7
|
+
End_Date: string | null;
|
|
8
|
+
Notes: string | null;
|
|
9
|
+
_Triggered_By: number | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export interface ContactRelationship {
|
|
14
|
+
contactRelationshipID: number;
|
|
15
|
+
contactID: number;
|
|
16
|
+
relationshipID: number;
|
|
17
|
+
relatedContactID: number;
|
|
18
|
+
startDate: string | null;
|
|
19
|
+
endDate: string | null;
|
|
20
|
+
notes: string | null;
|
|
21
|
+
readonly _triggeredBy: number | null;
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface FormFieldRecord {
|
|
2
|
+
Form_Field_ID: number;
|
|
3
|
+
Form_ID: number;
|
|
4
|
+
Field_Label: string;
|
|
5
|
+
Field_Order: number;
|
|
6
|
+
Field_Type_ID: number;
|
|
7
|
+
Field_Values: string | null;
|
|
8
|
+
Required: boolean;
|
|
9
|
+
Placement_Required: boolean;
|
|
10
|
+
Alternate_Label: string | null;
|
|
11
|
+
Is_Hidden: boolean;
|
|
12
|
+
Depends_On: number | null;
|
|
13
|
+
Depends_On_Value: string | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export interface FormField {
|
|
18
|
+
formFieldID: number;
|
|
19
|
+
formID: number;
|
|
20
|
+
fieldLabel: string;
|
|
21
|
+
fieldOrder: number;
|
|
22
|
+
fieldTypeID: number;
|
|
23
|
+
fieldValues: string | null;
|
|
24
|
+
required: boolean;
|
|
25
|
+
placementRequired: boolean;
|
|
26
|
+
alternateLabel: string | null;
|
|
27
|
+
isHidden: boolean;
|
|
28
|
+
dependsOn: number | null;
|
|
29
|
+
dependsOnValue: string | null;
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ParticipationDetailsRecord {
|
|
2
|
+
Participation_Detail_ID: number;
|
|
3
|
+
Event_Participant_ID: number;
|
|
4
|
+
Participation_Item_ID: number;
|
|
5
|
+
Numeric_Value: number | null;
|
|
6
|
+
Notes: string | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ParticipationDetails {
|
|
10
|
+
participationDetailID: number;
|
|
11
|
+
eventParticipantID: number;
|
|
12
|
+
participationItemID: number;
|
|
13
|
+
numericValue: number | null;
|
|
14
|
+
notes: string | null;
|
|
15
|
+
}
|