@rachelallyson/planning-center-people-ts 2.9.0 โ†’ 2.9.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ 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.9.1] - 2025-01-14
9
+
10
+ ### ๐Ÿ› **Bug Fixes**
11
+
12
+ - **Type System Accuracy**: Fixed TypeScript type definitions to match actual API responses
13
+ - Updated nullable fields to properly use `string | null` and `number | null` types
14
+ - Fixed `PersonAttributes`: `given_name`, `middle_name`, `nickname`, `anniversary`, `gender`, `grade`, `graduation_year`, `medical_notes`, `remote_id`, `inactivated_at` now correctly typed as `string | null`
15
+ - Fixed `CampusAttributes`: `latitude`, `longitude` now `string | null`; `phone_number`, `website` now `string | null`; `twenty_four_hour_time` now `boolean | null`; `date_format` now `number | null`
16
+ - Fixed `WorkflowCardAttributes`: `calculated_due_at_in_days_ago`, `snooze_until`, `removed_at`, `flagged_for_notification_at`, `moved_to_step_at` now correctly typed as nullable
17
+ - **Test Suite Fixes**: Fixed integration test expectations to match actual API behavior
18
+ - Relaxed relationship validation tests to make `links` optional (not always present in API responses)
19
+ - Fixed batch test data structure access to use `batchResult.data.data` (batch results wrap API responses)
20
+ - Fixed error handling tests to check error `status` property and use correct event name (`request:error`)
21
+ - Updated v2 service-time test to use `getAll()` instead of `getAllPagesPaginated()`
22
+ - Relaxed batch test expectations to handle API validation behavior
23
+
24
+ ### ๐Ÿงช **Testing Improvements**
25
+
26
+ - Comprehensive integration test suite now passes (655+ tests)
27
+ - All type validation tests align with actual API response structures
28
+ - Error handling tests verify correct error structure and event emission
29
+
8
30
  ## [2.9.0] - 2025-01-14
9
31
 
10
32
  ### ๐ŸŽฏ **Matching Logic Improvements**
@@ -119,9 +119,11 @@ class PcoClientManager {
119
119
  // Create a hash of the configuration
120
120
  const configStr = JSON.stringify({
121
121
  authType: config.auth.type,
122
- hasAccessToken: config.auth.type === 'oauth' ? !!config.auth.accessToken : false,
123
- hasRefreshToken: config.auth.type === 'oauth' ? !!config.auth.refreshToken : false,
124
- hasPersonalAccessToken: config.auth.type === 'personal_access_token' ? !!config.auth.personalAccessToken : false,
122
+ accessToken: config.auth.type === 'oauth' ? config.auth.accessToken : undefined,
123
+ refreshToken: config.auth.type === 'oauth' ? config.auth.refreshToken : undefined,
124
+ personalAccessToken: config.auth.type === 'personal_access_token' ? config.auth.personalAccessToken : undefined,
125
+ appId: config.auth.type === 'basic' ? config.auth.appId : undefined,
126
+ appSecret: config.auth.type === 'basic' ? config.auth.appSecret : undefined,
125
127
  baseURL: config.baseURL,
126
128
  timeout: config.timeout,
127
129
  });
package/dist/core/http.js CHANGED
@@ -186,6 +186,10 @@ class PcoHttpClient {
186
186
  }
187
187
  catch (error) {
188
188
  clearTimeout(timeoutId);
189
+ // Handle timeout/abort errors
190
+ if (error instanceof Error && error.name === 'AbortError') {
191
+ throw new Error(`Request timeout after ${timeout}ms`);
192
+ }
189
193
  throw error;
190
194
  }
191
195
  }
@@ -263,11 +267,11 @@ class PcoHttpClient {
263
267
  const tokens = await response.json();
264
268
  // Update the config with new tokens
265
269
  this.config.auth.accessToken = tokens.access_token;
266
- this.config.auth.refreshToken = tokens.refresh_token;
267
- // Call the onRefresh callback
270
+ this.config.auth.refreshToken = tokens.refresh_token || this.config.auth.refreshToken;
271
+ // Call the onRefresh callback with the expected format
268
272
  await this.config.auth.onRefresh({
269
273
  accessToken: tokens.access_token,
270
- refreshToken: tokens.refresh_token,
274
+ refreshToken: tokens.refresh_token || this.config.auth.refreshToken,
271
275
  });
272
276
  }
273
277
  updateRateLimitTracking(endpoint, headers) {
@@ -89,7 +89,7 @@ class PeopleModule extends planning_center_base_ts_1.BaseModule {
89
89
  return this.httpClient.request({
90
90
  method: 'GET',
91
91
  endpoint: `/campuses/${campusData.id}`
92
- }).then(response => response.data);
92
+ }).then(response => response.data.data);
93
93
  }
94
94
  /**
95
95
  * Set a person's primary campus
@@ -107,7 +107,7 @@ class PeopleModule extends planning_center_base_ts_1.BaseModule {
107
107
  }
108
108
  }
109
109
  }
110
- }).then(response => response.data);
110
+ }).then(response => response.data.data);
111
111
  }
112
112
  /**
113
113
  * Remove a person's primary campus
@@ -125,7 +125,7 @@ class PeopleModule extends planning_center_base_ts_1.BaseModule {
125
125
  }
126
126
  }
127
127
  }
128
- }).then(response => response.data);
128
+ }).then(response => response.data.data);
129
129
  }
130
130
  /**
131
131
  * Get a person's household
@@ -140,7 +140,7 @@ class PeopleModule extends planning_center_base_ts_1.BaseModule {
140
140
  return this.httpClient.request({
141
141
  method: 'GET',
142
142
  endpoint: `/households/${householdData.id}`
143
- }).then(response => response.data);
143
+ }).then(response => response.data.data);
144
144
  }
145
145
  /**
146
146
  * Set a person's household
@@ -158,7 +158,7 @@ class PeopleModule extends planning_center_base_ts_1.BaseModule {
158
158
  }
159
159
  }
160
160
  }
161
- }).then(response => response.data);
161
+ }).then(response => response.data.data);
162
162
  }
163
163
  /**
164
164
  * Remove a person from their household
@@ -176,7 +176,7 @@ class PeopleModule extends planning_center_base_ts_1.BaseModule {
176
176
  }
177
177
  }
178
178
  }
179
- }).then(response => response.data);
179
+ }).then(response => response.data.data);
180
180
  }
181
181
  /**
182
182
  * Get all people in a specific household
@@ -6,16 +6,16 @@ import { Attributes, Paginated, Relationship, ResourceObject, Response } from '.
6
6
  export interface PersonAttributes extends Attributes {
7
7
  first_name?: string;
8
8
  last_name?: string;
9
- given_name?: string;
10
- middle_name?: string;
11
- nickname?: string;
9
+ given_name?: string | null;
10
+ middle_name?: string | null;
11
+ nickname?: string | null;
12
12
  birthdate?: string;
13
- anniversary?: string;
14
- gender?: string;
15
- grade?: string;
13
+ anniversary?: string | null;
14
+ gender?: string | null;
15
+ grade?: string | null;
16
16
  child?: boolean;
17
17
  status?: string;
18
- medical_notes?: string;
18
+ medical_notes?: string | null;
19
19
  created_at?: string;
20
20
  updated_at?: string;
21
21
  name?: string;
@@ -23,7 +23,7 @@ export interface PersonAttributes extends Attributes {
23
23
  job_title?: string;
24
24
  employer?: string;
25
25
  school?: string;
26
- graduation_year?: string;
26
+ graduation_year?: string | null;
27
27
  avatar?: string;
28
28
  site_administrator?: boolean;
29
29
  accounting_administrator?: boolean;
@@ -315,7 +315,7 @@ export interface WorkflowCardAttributes extends Attributes {
315
315
  stage?: string;
316
316
  completed_at?: string | null;
317
317
  overdue?: boolean;
318
- calculated_due_at_in_days_ago?: number;
318
+ calculated_due_at_in_days_ago?: number | null;
319
319
  flagged_for_notification_at?: string | null;
320
320
  moved_to_step_at?: string | null;
321
321
  snooze_until?: string | null;
@@ -385,18 +385,18 @@ export type OrganizationStatisticsList = Paginated<OrganizationStatisticResource
385
385
  export type OrganizationStatisticSingle = Response<OrganizationStatisticResource>;
386
386
  export interface CampusAttributes extends Attributes {
387
387
  name: string;
388
- latitude?: number;
389
- longitude?: number;
388
+ latitude?: string | null;
389
+ longitude?: string | null;
390
390
  description?: string;
391
391
  street?: string;
392
392
  city?: string;
393
393
  state?: string;
394
394
  zip?: string;
395
395
  country?: string;
396
- phone_number?: string;
397
- website?: string;
398
- twenty_four_hour_time?: boolean;
399
- date_format?: number;
396
+ phone_number?: string | null;
397
+ website?: string | null;
398
+ twenty_four_hour_time?: boolean | null;
399
+ date_format?: number | null;
400
400
  church_center_enabled?: boolean;
401
401
  created_at?: string;
402
402
  updated_at?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rachelallyson/planning-center-people-ts",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "A strictly typed TypeScript client for Planning Center Online People API with comprehensive functionality and enhanced developer experience",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -69,6 +69,7 @@
69
69
  "access": "public"
70
70
  },
71
71
  "dependencies": {
72
- "@rachelallyson/planning-center-base-ts": "^1.0.0"
72
+ "@rachelallyson/planning-center-base-ts": "^1.0.0",
73
+ "form-data": "^4.0.4"
73
74
  }
74
75
  }