@rachelallyson/planning-center-people-ts 2.6.0 โ 2.6.2
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 +89 -0
- package/dist/matching/matcher.js +30 -10
- package/dist/modules/people.d.ts +1 -1
- package/dist/people/fields.d.ts +2 -2
- package/dist/types/people.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,101 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.6.2] - 2025-01-10
|
|
9
|
+
|
|
10
|
+
### ๐ฏ **TYPE DEFINITION ENHANCEMENT**
|
|
11
|
+
|
|
12
|
+
This patch release adds enhanced type definitions for better TypeScript support and developer experience.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **๐ FieldDataType Type**: Added comprehensive type definition for field data types
|
|
17
|
+
- **Types**: `'boolean' | 'checkboxes' | 'date' | 'file' | 'number' | 'select' | 'string' | 'text'`
|
|
18
|
+
- **Usage**: Provides type safety for field definition operations
|
|
19
|
+
- **Benefits**: Better IntelliSense and compile-time validation
|
|
20
|
+
|
|
21
|
+
### Enhanced Type Safety
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// Now you get full type safety for field data types
|
|
25
|
+
const fieldDefinition: FieldDefinitionAttributes = {
|
|
26
|
+
data_type: 'select', // โ
TypeScript knows this is valid
|
|
27
|
+
// ... other properties
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Invalid types will be caught at compile time
|
|
31
|
+
const invalidField = {
|
|
32
|
+
data_type: 'invalid', // โ TypeScript error
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Migration
|
|
37
|
+
|
|
38
|
+
No breaking changes - this is a type enhancement release:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// Existing code continues to work
|
|
42
|
+
const fields = await client.people.getFieldDefinitions();
|
|
43
|
+
|
|
44
|
+
// New type safety benefits
|
|
45
|
+
fields.data.forEach(field => {
|
|
46
|
+
if (field.attributes.data_type === 'select') {
|
|
47
|
+
// TypeScript knows this is a select field
|
|
48
|
+
console.log('Select field:', field.attributes.name);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## [2.6.1] - 2025-01-10
|
|
54
|
+
|
|
55
|
+
### ๐ **CRITICAL BUG FIXES**
|
|
56
|
+
|
|
57
|
+
This patch release fixes critical bugs in the `findOrCreate` method that would cause runtime errors and API failures.
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
- **๐ Critical Bug in findOrCreate**: Fixed broken contact creation in `findOrCreate` method
|
|
62
|
+
- **Issue**: `createWithContacts` method didn't exist, causing runtime errors
|
|
63
|
+
- **Issue**: Email/phone passed to person creation caused 422 API errors
|
|
64
|
+
- **Fix**: Now properly creates person first, then adds contacts separately
|
|
65
|
+
- **Enhancement**: Added campus assignment support with `campusId` option
|
|
66
|
+
- **Enhancement**: Added proper error handling for contact creation failures
|
|
67
|
+
|
|
68
|
+
### Changed
|
|
69
|
+
|
|
70
|
+
- **๐งน Cleaned up PersonMatchOptions interface**: Removed unused `campus` field, kept only functional `campusId` field
|
|
71
|
+
- **๐ Better error handling**: Contact creation failures now log warnings instead of crashing
|
|
72
|
+
|
|
73
|
+
### Migration
|
|
74
|
+
|
|
75
|
+
No breaking changes - this is a bug fix release:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// This now works correctly (was broken in 2.6.0)
|
|
79
|
+
const person = await client.people.findOrCreate({
|
|
80
|
+
firstName: 'John',
|
|
81
|
+
lastName: 'Doe',
|
|
82
|
+
email: 'john@example.com',
|
|
83
|
+
phone: '555-1234',
|
|
84
|
+
campusId: 'campus-123' // NEW: Campus assignment support
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
8
88
|
## [2.6.0] - 2025-01-10
|
|
9
89
|
|
|
10
90
|
### ๐ฏ **PERFORMANCE & DEPENDENCY OPTIMIZATION**
|
|
11
91
|
|
|
12
92
|
This release focuses on performance improvements and dependency optimization, making the library lighter, faster, and more efficient.
|
|
13
93
|
|
|
94
|
+
### Fixed
|
|
95
|
+
|
|
96
|
+
- **๐ Critical Bug in findOrCreate**: Fixed broken contact creation in `findOrCreate` method
|
|
97
|
+
- **Issue**: `createWithContacts` method didn't exist, causing runtime errors
|
|
98
|
+
- **Issue**: Email/phone passed to person creation caused 422 API errors
|
|
99
|
+
- **Fix**: Now properly creates person first, then adds contacts separately
|
|
100
|
+
- **Enhancement**: Added campus assignment support with `campusId` option
|
|
101
|
+
- **Enhancement**: Added proper error handling for contact creation failures
|
|
102
|
+
|
|
14
103
|
### Removed
|
|
15
104
|
|
|
16
105
|
- **๐ฆ Axios Dependency**: Completely removed axios dependency by replacing it with native fetch API
|
package/dist/matching/matcher.js
CHANGED
|
@@ -132,26 +132,46 @@ class PersonMatcher {
|
|
|
132
132
|
* Create a new person
|
|
133
133
|
*/
|
|
134
134
|
async createPerson(options) {
|
|
135
|
+
// Create basic person data (only name fields)
|
|
135
136
|
const personData = {};
|
|
136
137
|
if (options.firstName)
|
|
137
138
|
personData.first_name = options.firstName;
|
|
138
139
|
if (options.lastName)
|
|
139
140
|
personData.last_name = options.lastName;
|
|
140
|
-
|
|
141
|
-
personData.email = options.email;
|
|
142
|
-
if (options.phone)
|
|
143
|
-
personData.phone = options.phone;
|
|
141
|
+
// Create the person first
|
|
144
142
|
const person = await this.peopleModule.create(personData);
|
|
145
|
-
// Add contact
|
|
146
|
-
const contacts = {};
|
|
143
|
+
// Add email contact if provided
|
|
147
144
|
if (options.email) {
|
|
148
|
-
|
|
145
|
+
try {
|
|
146
|
+
await this.peopleModule.addEmail(person.id, {
|
|
147
|
+
address: options.email,
|
|
148
|
+
primary: true
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
console.warn('Failed to create email contact:', error);
|
|
153
|
+
}
|
|
149
154
|
}
|
|
155
|
+
// Add phone contact if provided
|
|
150
156
|
if (options.phone) {
|
|
151
|
-
|
|
157
|
+
try {
|
|
158
|
+
await this.peopleModule.addPhoneNumber(person.id, {
|
|
159
|
+
number: options.phone,
|
|
160
|
+
primary: true
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
console.warn('Failed to create phone contact:', error);
|
|
165
|
+
}
|
|
152
166
|
}
|
|
153
|
-
|
|
154
|
-
|
|
167
|
+
// Set campus if provided
|
|
168
|
+
if (options.campusId) {
|
|
169
|
+
try {
|
|
170
|
+
await this.peopleModule.setPrimaryCampus(person.id, options.campusId);
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
console.warn('Failed to set campus:', error);
|
|
174
|
+
}
|
|
155
175
|
}
|
|
156
176
|
return person;
|
|
157
177
|
}
|
package/dist/modules/people.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface PersonMatchOptions {
|
|
|
48
48
|
email?: string;
|
|
49
49
|
phone?: string;
|
|
50
50
|
matchStrategy?: 'exact' | 'fuzzy' | 'aggressive';
|
|
51
|
-
|
|
51
|
+
campusId?: string;
|
|
52
52
|
createIfNotFound?: boolean;
|
|
53
53
|
agePreference?: 'adults' | 'children' | 'any';
|
|
54
54
|
minAge?: number;
|
package/dist/people/fields.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PcoClientState } from '../core';
|
|
2
2
|
import type { ErrorContext } from '../error-handling';
|
|
3
|
-
import { FieldDataList, FieldDataSingle, FieldDefinitionsList, FieldDefinitionSingle, FieldOptionAttributes, FieldOptionSingle, FieldOptionsList, TabsList } from '../types';
|
|
3
|
+
import { FieldDataList, FieldDataSingle, FieldDataType, FieldDefinitionsList, FieldDefinitionSingle, FieldOptionAttributes, FieldOptionSingle, FieldOptionsList, TabsList } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Delete field data for a person
|
|
6
6
|
*/
|
|
@@ -46,7 +46,7 @@ export declare function getTabs(client: PcoClientState, params?: {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare function createFieldDefinition(client: PcoClientState, tabId: string, data: {
|
|
48
48
|
name: string;
|
|
49
|
-
data_type:
|
|
49
|
+
data_type: FieldDataType;
|
|
50
50
|
sequence?: number;
|
|
51
51
|
slug?: string;
|
|
52
52
|
config?: string | Record<string, any>;
|
package/dist/types/people.d.ts
CHANGED
|
@@ -128,9 +128,10 @@ export interface SocialProfileResource extends ResourceObject<'SocialProfile', S
|
|
|
128
128
|
}
|
|
129
129
|
export type SocialProfilesList = Paginated<SocialProfileResource>;
|
|
130
130
|
export type SocialProfileSingle = Response<SocialProfileResource>;
|
|
131
|
+
export type FieldDataType = 'boolean' | 'checkboxes' | 'date' | 'file' | 'number' | 'select' | 'string' | 'text';
|
|
131
132
|
export interface FieldDefinitionAttributes extends Attributes {
|
|
132
133
|
config: string | Record<string, any> | null;
|
|
133
|
-
data_type:
|
|
134
|
+
data_type: FieldDataType;
|
|
134
135
|
deleted_at: string | null | false;
|
|
135
136
|
name: string;
|
|
136
137
|
sequence: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rachelallyson/planning-center-people-ts",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "A strictly typed TypeScript client for Planning Center Online People API with smart matching, batch operations, and enhanced developer experience",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|