@rachelallyson/planning-center-people-ts 2.7.0 → 2.9.0
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/CHANGELOG.md +174 -0
- package/LICENSE +1 -1
- package/README.md +12 -14
- package/dist/client.d.ts +8 -8
- package/dist/client.js +8 -11
- package/dist/core/http.d.ts +1 -1
- package/dist/core/http.js +18 -11
- package/dist/core/pagination.js +16 -2
- package/dist/core.d.ts +3 -3
- package/dist/core.js +4 -4
- package/dist/error-handling.d.ts +1 -1
- package/dist/error-handling.js +3 -3
- package/dist/error-scenarios.js +4 -4
- package/dist/helpers.js +5 -4
- package/dist/index.d.ts +8 -8
- package/dist/index.js +15 -15
- package/dist/matching/matcher.d.ts +22 -0
- package/dist/matching/matcher.js +260 -27
- package/dist/matching/scoring.d.ts +9 -7
- package/dist/matching/scoring.js +54 -23
- package/dist/matching/strategies.d.ts +1 -0
- package/dist/matching/strategies.js +17 -4
- package/dist/modules/campus.d.ts +5 -5
- package/dist/modules/campus.js +2 -2
- package/dist/modules/contacts.d.ts +1 -1
- package/dist/modules/contacts.js +2 -2
- package/dist/modules/fields.d.ts +4 -4
- package/dist/modules/fields.js +2 -2
- package/dist/modules/forms.d.ts +7 -4
- package/dist/modules/forms.js +5 -2
- package/dist/modules/households.d.ts +2 -2
- package/dist/modules/households.js +2 -2
- package/dist/modules/lists.d.ts +2 -2
- package/dist/modules/lists.js +2 -2
- package/dist/modules/notes.d.ts +2 -2
- package/dist/modules/notes.js +2 -2
- package/dist/modules/people.d.ts +57 -5
- package/dist/modules/people.js +44 -9
- package/dist/modules/reports.d.ts +5 -5
- package/dist/modules/reports.js +2 -2
- package/dist/modules/service-time.d.ts +5 -5
- package/dist/modules/service-time.js +2 -2
- package/dist/modules/workflows.d.ts +2 -2
- package/dist/modules/workflows.js +2 -2
- package/dist/people/contacts.d.ts +1 -1
- package/dist/people/core.d.ts +1 -1
- package/dist/people/fields.d.ts +1 -1
- package/dist/people/fields.js +4 -4
- package/dist/people/households.d.ts +1 -1
- package/dist/people/lists.d.ts +1 -1
- package/dist/people/notes.d.ts +1 -1
- package/dist/people/organization.d.ts +1 -1
- package/dist/people/workflows.d.ts +1 -1
- package/dist/types/client.d.ts +3 -96
- package/dist/types/client.js +2 -0
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.js +0 -2
- package/package.json +16 -19
- package/dist/api-error.d.ts +0 -10
- package/dist/api-error.js +0 -32
- package/dist/batch.d.ts +0 -47
- package/dist/batch.js +0 -376
- package/dist/modules/base.d.ts +0 -46
- package/dist/modules/base.js +0 -82
- package/dist/monitoring.d.ts +0 -53
- package/dist/monitoring.js +0 -142
- package/dist/rate-limiter.d.ts +0 -79
- package/dist/rate-limiter.js +0 -137
- package/dist/types/batch.d.ts +0 -50
- package/dist/types/batch.js +0 -5
- package/dist/types/events.d.ts +0 -85
- package/dist/types/events.js +0 -5
|
@@ -25,18 +25,31 @@ class MatchStrategies {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Exact matching strategy - only return matches with very high confidence
|
|
28
|
+
* Requires verified email/phone matches unless multiple people share the same contact info
|
|
28
29
|
*/
|
|
29
30
|
selectExactMatch(candidates) {
|
|
30
|
-
//
|
|
31
|
-
|
|
31
|
+
// For exact match, require verified email/phone match
|
|
32
|
+
// Only allow name-only matches if multiple people share same email/phone (to distinguish)
|
|
33
|
+
const verifiedMatches = candidates.filter(c => c.isVerifiedContactMatch);
|
|
34
|
+
const verifiedCount = verifiedMatches.length;
|
|
35
|
+
const exactMatches = candidates.filter(c => {
|
|
36
|
+
// Must have score >= 0.8
|
|
37
|
+
if (c.score < 0.8)
|
|
38
|
+
return false;
|
|
39
|
+
// Must be a verified contact match (email/phone), OR
|
|
40
|
+
// Must be a name-only match with multiple verified matches (to distinguish)
|
|
41
|
+
const isNameMatch = c.reason.includes('name match');
|
|
42
|
+
return c.isVerifiedContactMatch ||
|
|
43
|
+
(isNameMatch && verifiedCount > 1);
|
|
44
|
+
});
|
|
32
45
|
return exactMatches.length > 0 ? exactMatches[0] : null;
|
|
33
46
|
}
|
|
34
47
|
/**
|
|
35
48
|
* Fuzzy matching strategy - return best match above threshold
|
|
36
49
|
*/
|
|
37
50
|
selectFuzzyMatch(candidates) {
|
|
38
|
-
// Return best match with score >= 0.7
|
|
39
|
-
const fuzzyMatches = candidates.filter(c => c.score >= 0.
|
|
51
|
+
// Return best match with score >= 0.5 (lowered from 0.7)
|
|
52
|
+
const fuzzyMatches = candidates.filter(c => c.score >= 0.5);
|
|
40
53
|
return fuzzyMatches.length > 0 ? fuzzyMatches[0] : null;
|
|
41
54
|
}
|
|
42
55
|
/**
|
package/dist/modules/campus.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseModule } from '
|
|
2
|
-
import type { PcoHttpClient } from '
|
|
3
|
-
import type { PaginationHelper } from '
|
|
4
|
-
import type { PcoEventEmitter } from '
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '
|
|
1
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
2
|
+
import type { PcoHttpClient } from '@rachelallyson/planning-center-base-ts';
|
|
3
|
+
import type { PaginationHelper } from '@rachelallyson/planning-center-base-ts';
|
|
4
|
+
import type { PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { CampusResource, CampusAttributes, CampusesList } from '../types';
|
|
7
7
|
/**
|
|
8
8
|
* Campus module for managing campus-related operations
|
package/dist/modules/campus.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CampusModule = void 0;
|
|
4
|
-
const
|
|
4
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
5
5
|
/**
|
|
6
6
|
* Campus module for managing campus-related operations
|
|
7
7
|
*/
|
|
8
|
-
class CampusModule extends
|
|
8
|
+
class CampusModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v2.0.0 Contacts Module
|
|
3
3
|
*/
|
|
4
|
-
import { BaseModule } from '
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
5
|
import type { EmailResource, EmailAttributes, PhoneNumberResource, PhoneNumberAttributes, AddressResource, AddressAttributes, SocialProfileResource, SocialProfileAttributes } from '../types';
|
|
6
6
|
export declare class ContactsModule extends BaseModule {
|
|
7
7
|
/**
|
package/dist/modules/contacts.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ContactsModule = void 0;
|
|
7
|
-
const
|
|
8
|
-
class ContactsModule extends
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class ContactsModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
/**
|
|
10
10
|
* Get all emails
|
|
11
11
|
*/
|
package/dist/modules/fields.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v2.0.0 Fields Module
|
|
3
3
|
*/
|
|
4
|
-
import { BaseModule } from '
|
|
5
|
-
import type { PcoHttpClient } from '
|
|
6
|
-
import type { PaginationHelper } from '
|
|
7
|
-
import type { PcoEventEmitter } from '
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PcoHttpClient } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
import type { PaginationHelper } from '@rachelallyson/planning-center-base-ts';
|
|
7
|
+
import type { PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
8
8
|
import type { FieldDefinitionResource, FieldDefinitionAttributes, FieldDatumResource, FieldOptionResource, FieldOptionAttributes, TabResource, TabAttributes } from '../types';
|
|
9
9
|
export interface FieldDefinitionCache {
|
|
10
10
|
byId: Map<string, FieldDefinitionResource>;
|
package/dist/modules/fields.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.FieldsModule = void 0;
|
|
7
|
-
const
|
|
8
|
-
class FieldsModule extends
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class FieldsModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
this.fieldDefinitionCache = null;
|
package/dist/modules/forms.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
1
|
+
/**
|
|
2
|
+
* v2.0.0 Forms Module
|
|
3
|
+
*/
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PcoHttpClient } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
import type { PaginationHelper } from '@rachelallyson/planning-center-base-ts';
|
|
7
|
+
import type { PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
5
8
|
import type { FormResource, FormsList, FormCategoryResource, FormFieldResource, FormFieldOptionResource, FormSubmissionResource, FormSubmissionValueResource } from '../types';
|
|
6
9
|
/**
|
|
7
10
|
* Forms module for managing form-related operations
|
package/dist/modules/forms.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* v2.0.0 Forms Module
|
|
4
|
+
*/
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.FormsModule = void 0;
|
|
4
|
-
const
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
5
8
|
/**
|
|
6
9
|
* Forms module for managing form-related operations
|
|
7
10
|
* Most operations are read-only based on API documentation
|
|
8
11
|
*/
|
|
9
|
-
class FormsModule extends
|
|
12
|
+
class FormsModule extends planning_center_base_ts_1.BaseModule {
|
|
10
13
|
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
11
14
|
super(httpClient, paginationHelper, eventEmitter);
|
|
12
15
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v2.0.0 Households Module
|
|
3
3
|
*/
|
|
4
|
-
import { BaseModule } from '
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { HouseholdResource, HouseholdAttributes } from '../types';
|
|
7
7
|
export interface HouseholdListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HouseholdsModule = void 0;
|
|
7
|
-
const
|
|
8
|
-
class HouseholdsModule extends
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class HouseholdsModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
/**
|
|
10
10
|
* Get all households
|
|
11
11
|
*/
|
package/dist/modules/lists.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v2.0.0 Lists Module
|
|
3
3
|
*/
|
|
4
|
-
import { BaseModule } from '
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { ListResource, ListCategoryResource, ListCategoryAttributes, PersonResource } from '../types';
|
|
7
7
|
export interface ListsListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
package/dist/modules/lists.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ListsModule = void 0;
|
|
7
|
-
const
|
|
8
|
-
class ListsModule extends
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class ListsModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
/**
|
|
10
10
|
* Get all lists
|
|
11
11
|
*/
|
package/dist/modules/notes.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v2.0.0 Notes Module
|
|
3
3
|
*/
|
|
4
|
-
import { BaseModule } from '
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { NoteResource, NoteAttributes, NoteCategoryResource, NoteCategoryAttributes } from '../types';
|
|
7
7
|
export interface NotesListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
package/dist/modules/notes.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.NotesModule = void 0;
|
|
7
|
-
const
|
|
8
|
-
class NotesModule extends
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class NotesModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
/**
|
|
10
10
|
* Get all notes
|
|
11
11
|
*/
|
package/dist/modules/people.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v2.0.0 People Module
|
|
3
3
|
*/
|
|
4
|
-
import { BaseModule } from '
|
|
5
|
-
import type { PcoHttpClient } from '
|
|
6
|
-
import type { PaginationHelper } from '../core/pagination';
|
|
7
|
-
import type { PcoEventEmitter } from '../monitoring';
|
|
8
|
-
import type { PaginationOptions, PaginationResult } from '../core/pagination';
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
9
6
|
import type { PersonResource, EmailResource, EmailAttributes, PhoneNumberResource, PhoneNumberAttributes, AddressResource, AddressAttributes, SocialProfileResource, SocialProfileAttributes, CampusResource, HouseholdResource } from '../types';
|
|
10
7
|
export interface PeopleListOptions {
|
|
11
8
|
where?: Record<string, any>;
|
|
@@ -42,17 +39,42 @@ export interface PersonCreateOptions {
|
|
|
42
39
|
inactivatedAt?: string;
|
|
43
40
|
resourcePermissionFlags?: Record<string, boolean>;
|
|
44
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Options for finding or creating a person with smart matching
|
|
44
|
+
*/
|
|
45
45
|
export interface PersonMatchOptions {
|
|
46
|
+
/** Person's first name */
|
|
46
47
|
firstName?: string;
|
|
48
|
+
/** Person's last name */
|
|
47
49
|
lastName?: string;
|
|
50
|
+
/** Person's email address */
|
|
48
51
|
email?: string;
|
|
52
|
+
/** Person's phone number */
|
|
49
53
|
phone?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Matching strategy to use:
|
|
56
|
+
* - 'exact': Only return matches with verified email/phone matches (high confidence)
|
|
57
|
+
* - 'fuzzy': Return best match above threshold (default)
|
|
58
|
+
* - 'aggressive': Return best match with lower threshold
|
|
59
|
+
*/
|
|
50
60
|
matchStrategy?: 'exact' | 'fuzzy' | 'aggressive';
|
|
61
|
+
/** Campus ID to associate with the person */
|
|
51
62
|
campusId?: string;
|
|
63
|
+
/** If true, create a new person if no match is found (default: true) */
|
|
52
64
|
createIfNotFound?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* If true, automatically add missing email/phone contact information to a person's profile
|
|
67
|
+
* when a match is found. Missing contacts are added as non-primary to avoid overriding
|
|
68
|
+
* existing primary contacts. (default: false)
|
|
69
|
+
*/
|
|
70
|
+
addMissingContactInfo?: boolean;
|
|
71
|
+
/** Age preference filter: 'adults' (18+), 'children' (<18), or 'any' */
|
|
53
72
|
agePreference?: 'adults' | 'children' | 'any';
|
|
73
|
+
/** Minimum age filter */
|
|
54
74
|
minAge?: number;
|
|
75
|
+
/** Maximum age filter */
|
|
55
76
|
maxAge?: number;
|
|
77
|
+
/** Birth year filter (exact match) */
|
|
56
78
|
birthYear?: number;
|
|
57
79
|
}
|
|
58
80
|
export declare class PeopleModule extends BaseModule {
|
|
@@ -176,6 +198,36 @@ export declare class PeopleModule extends BaseModule {
|
|
|
176
198
|
}>;
|
|
177
199
|
/**
|
|
178
200
|
* Find or create a person with smart matching
|
|
201
|
+
*
|
|
202
|
+
* This method uses intelligent matching logic to find existing people or create new ones.
|
|
203
|
+
* It verifies email/phone matches and only uses name matching when appropriate.
|
|
204
|
+
*
|
|
205
|
+
* @param options - Matching options including name, contact info, and matching preferences
|
|
206
|
+
* @param options.addMissingContactInfo - If true, automatically adds missing email/phone
|
|
207
|
+
* to a person's profile when a match is found. The contacts are added as non-primary
|
|
208
|
+
* to preserve existing primary contacts.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* // Basic find or create
|
|
213
|
+
* const person = await client.people.findOrCreate({
|
|
214
|
+
* firstName: 'John',
|
|
215
|
+
* lastName: 'Doe',
|
|
216
|
+
* email: 'john@example.com',
|
|
217
|
+
* phone: '+1234567890'
|
|
218
|
+
* });
|
|
219
|
+
*
|
|
220
|
+
* // Find and add missing contact info if match found
|
|
221
|
+
* const person = await client.people.findOrCreate({
|
|
222
|
+
* firstName: 'Jane',
|
|
223
|
+
* lastName: 'Smith',
|
|
224
|
+
* email: 'jane@example.com',
|
|
225
|
+
* phone: '+1987654321',
|
|
226
|
+
* addMissingContactInfo: true // Will add phone if person only has email
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @returns The found or newly created person
|
|
179
231
|
*/
|
|
180
232
|
findOrCreate(options: PersonMatchOptions): Promise<PersonResource>;
|
|
181
233
|
/**
|
package/dist/modules/people.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PeopleModule = void 0;
|
|
7
|
-
const
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
8
|
const matcher_1 = require("../matching/matcher");
|
|
9
|
-
class PeopleModule extends
|
|
9
|
+
class PeopleModule extends planning_center_base_ts_1.BaseModule {
|
|
10
10
|
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
11
11
|
super(httpClient, paginationHelper, eventEmitter);
|
|
12
12
|
this.personMatcher = new matcher_1.PersonMatcher(this);
|
|
@@ -280,6 +280,36 @@ class PeopleModule extends base_1.BaseModule {
|
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
282
282
|
* Find or create a person with smart matching
|
|
283
|
+
*
|
|
284
|
+
* This method uses intelligent matching logic to find existing people or create new ones.
|
|
285
|
+
* It verifies email/phone matches and only uses name matching when appropriate.
|
|
286
|
+
*
|
|
287
|
+
* @param options - Matching options including name, contact info, and matching preferences
|
|
288
|
+
* @param options.addMissingContactInfo - If true, automatically adds missing email/phone
|
|
289
|
+
* to a person's profile when a match is found. The contacts are added as non-primary
|
|
290
|
+
* to preserve existing primary contacts.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* // Basic find or create
|
|
295
|
+
* const person = await client.people.findOrCreate({
|
|
296
|
+
* firstName: 'John',
|
|
297
|
+
* lastName: 'Doe',
|
|
298
|
+
* email: 'john@example.com',
|
|
299
|
+
* phone: '+1234567890'
|
|
300
|
+
* });
|
|
301
|
+
*
|
|
302
|
+
* // Find and add missing contact info if match found
|
|
303
|
+
* const person = await client.people.findOrCreate({
|
|
304
|
+
* firstName: 'Jane',
|
|
305
|
+
* lastName: 'Smith',
|
|
306
|
+
* email: 'jane@example.com',
|
|
307
|
+
* phone: '+1987654321',
|
|
308
|
+
* addMissingContactInfo: true // Will add phone if person only has email
|
|
309
|
+
* });
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @returns The found or newly created person
|
|
283
313
|
*/
|
|
284
314
|
async findOrCreate(options) {
|
|
285
315
|
return this.personMatcher.findOrCreate(options);
|
|
@@ -289,14 +319,19 @@ class PeopleModule extends base_1.BaseModule {
|
|
|
289
319
|
*/
|
|
290
320
|
async search(criteria) {
|
|
291
321
|
const where = {};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
322
|
+
// Use flexible search when we have multiple criteria or want broader matching
|
|
323
|
+
if (criteria.email || criteria.phone) {
|
|
324
|
+
// Use the powerful flexible search parameter
|
|
325
|
+
if (criteria.email) {
|
|
326
|
+
where.search_name_or_email_or_phone_number = criteria.email;
|
|
327
|
+
}
|
|
328
|
+
else if (criteria.phone) {
|
|
329
|
+
where.search_name_or_email_or_phone_number = criteria.phone;
|
|
330
|
+
}
|
|
297
331
|
}
|
|
298
|
-
if (criteria.
|
|
299
|
-
|
|
332
|
+
else if (criteria.name) {
|
|
333
|
+
// Use specific name search when only name is provided
|
|
334
|
+
where.search_name = criteria.name;
|
|
300
335
|
}
|
|
301
336
|
if (criteria.status) {
|
|
302
337
|
where.status = criteria.status;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseModule } from '
|
|
2
|
-
import type { PcoHttpClient } from '
|
|
3
|
-
import type { PaginationHelper } from '
|
|
4
|
-
import type { PcoEventEmitter } from '
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '
|
|
1
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
2
|
+
import type { PcoHttpClient } from '@rachelallyson/planning-center-base-ts';
|
|
3
|
+
import type { PaginationHelper } from '@rachelallyson/planning-center-base-ts';
|
|
4
|
+
import type { PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { ReportResource, ReportAttributes, ReportsList, PersonResource } from '../types';
|
|
7
7
|
/**
|
|
8
8
|
* Reports module for managing report-related operations
|
package/dist/modules/reports.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReportsModule = void 0;
|
|
4
|
-
const
|
|
4
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
5
5
|
/**
|
|
6
6
|
* Reports module for managing report-related operations
|
|
7
7
|
*/
|
|
8
|
-
class ReportsModule extends
|
|
8
|
+
class ReportsModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseModule } from '
|
|
2
|
-
import type { PcoHttpClient } from '
|
|
3
|
-
import type { PaginationHelper } from '
|
|
4
|
-
import type { PcoEventEmitter } from '
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '
|
|
1
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
2
|
+
import type { PcoHttpClient } from '@rachelallyson/planning-center-base-ts';
|
|
3
|
+
import type { PaginationHelper } from '@rachelallyson/planning-center-base-ts';
|
|
4
|
+
import type { PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { ServiceTimeResource, ServiceTimeAttributes, ServiceTimesList } from '../types';
|
|
7
7
|
/**
|
|
8
8
|
* ServiceTime module for managing service time-related operations
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ServiceTimeModule = void 0;
|
|
4
|
-
const
|
|
4
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
5
5
|
/**
|
|
6
6
|
* ServiceTime module for managing service time-related operations
|
|
7
7
|
* ServiceTimes are campus-scoped resources
|
|
8
8
|
*/
|
|
9
|
-
class ServiceTimeModule extends
|
|
9
|
+
class ServiceTimeModule extends planning_center_base_ts_1.BaseModule {
|
|
10
10
|
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
11
11
|
super(httpClient, paginationHelper, eventEmitter);
|
|
12
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v2.0.0 Workflows Module
|
|
3
3
|
*/
|
|
4
|
-
import { BaseModule } from '
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '
|
|
4
|
+
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { WorkflowResource, WorkflowAttributes, WorkflowCardResource, WorkflowCardAssignableAttributes, WorkflowCardSnoozeAttributes, WorkflowCardEmailAttributes, WorkflowCardNoteResource, WorkflowCardNoteAttributes } from '../types';
|
|
7
7
|
export interface WorkflowListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.WorkflowsModule = void 0;
|
|
7
|
-
const
|
|
8
|
-
class WorkflowsModule extends
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
|
+
class WorkflowsModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
/**
|
|
10
10
|
* Get all workflows
|
|
11
11
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PcoClientState } from '../core';
|
|
2
|
-
import type { ErrorContext } from '
|
|
2
|
+
import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
|
|
3
3
|
import { AddressAttributes, AddressesList, AddressSingle, EmailAttributes, EmailSingle, EmailsList, PhoneNumberAttributes, PhoneNumberSingle, PhoneNumbersList, SocialProfileAttributes, SocialProfileSingle, SocialProfilesList } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Get all emails for a person
|
package/dist/people/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PcoClientState } from '../core';
|
|
2
|
-
import type { ErrorContext } from '
|
|
2
|
+
import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
|
|
3
3
|
import { PeopleList, PersonAttributes, PersonSingle } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Get all people with optional filtering and pagination
|
package/dist/people/fields.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PcoClientState } from '../core';
|
|
2
|
-
import type { ErrorContext } from '
|
|
2
|
+
import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
|
|
3
3
|
import { FieldDataList, FieldDataSingle, FieldDataType, FieldDefinitionsList, FieldDefinitionSingle, FieldOptionAttributes, FieldOptionSingle, FieldOptionsList, TabsList } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Delete field data for a person
|
package/dist/people/fields.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.createFieldDefinition = createFieldDefinition;
|
|
|
11
11
|
exports.deleteFieldDefinition = deleteFieldDefinition;
|
|
12
12
|
exports.createPersonFieldData = createPersonFieldData;
|
|
13
13
|
const core_1 = require("../core");
|
|
14
|
-
const
|
|
14
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
15
15
|
const helpers_1 = require("../helpers");
|
|
16
16
|
/**
|
|
17
17
|
* Create field data for a person (internal)
|
|
@@ -53,7 +53,7 @@ async function getPersonFieldData(client, personId, context) {
|
|
|
53
53
|
* Upload a file to PCO and create field data (internal)
|
|
54
54
|
*/
|
|
55
55
|
async function createPersonFileFieldDataInternal(client, personId, fieldDefinitionId, fileUrl, context) {
|
|
56
|
-
return (0,
|
|
56
|
+
return (0, planning_center_base_ts_1.withErrorBoundary)(async () => {
|
|
57
57
|
// No external dependencies needed - using native fetch API
|
|
58
58
|
// Extract filename from URL
|
|
59
59
|
const urlParts = fileUrl.split('/');
|
|
@@ -140,8 +140,8 @@ async function createPersonFileFieldDataInternal(client, personId, fieldDefiniti
|
|
|
140
140
|
});
|
|
141
141
|
}, {
|
|
142
142
|
...context,
|
|
143
|
-
category:
|
|
144
|
-
severity:
|
|
143
|
+
category: planning_center_base_ts_1.ErrorCategory.EXTERNAL_API,
|
|
144
|
+
severity: planning_center_base_ts_1.ErrorSeverity.HIGH,
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
/**
|
package/dist/people/lists.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PcoClientState } from '../core';
|
|
2
|
-
import type { ErrorContext } from '
|
|
2
|
+
import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
|
|
3
3
|
import { ListCategoriesList, ListSingle, ListsList } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Get all lists
|
package/dist/people/notes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PcoClientState } from '../core';
|
|
2
|
-
import type { ErrorContext } from '
|
|
2
|
+
import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
|
|
3
3
|
import { NoteCategoriesList, NoteSingle, NotesList } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Get all notes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PcoClientState } from '../core';
|
|
2
|
-
import type { ErrorContext } from '
|
|
2
|
+
import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
|
|
3
3
|
import { WorkflowCardNoteAttributes, WorkflowCardNoteSingle, WorkflowCardNotesList, WorkflowCardSingle, WorkflowCardsList, WorkflowSingle, WorkflowsList } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* List notes for a workflow card
|