@rachelallyson/planning-center-people-ts 2.14.1 → 3.1.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +82 -7
  2. package/README.md +42 -4
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/auth.js +14 -6
  5. package/dist/client.d.ts +33 -8
  6. package/dist/client.js +47 -22
  7. package/dist/core.d.ts +4 -2
  8. package/dist/core.js +3 -2
  9. package/dist/error-handling.d.ts +4 -4
  10. package/dist/error-handling.js +13 -2
  11. package/dist/error-scenarios.d.ts +11 -7
  12. package/dist/error-scenarios.js +26 -10
  13. package/dist/helpers.d.ts +124 -48
  14. package/dist/helpers.js +237 -93
  15. package/dist/index.d.ts +10 -8
  16. package/dist/index.js +31 -72
  17. package/dist/matching/matcher.d.ts +8 -4
  18. package/dist/matching/matcher.js +51 -58
  19. package/dist/matching/scoring.d.ts +9 -6
  20. package/dist/matching/scoring.js +18 -14
  21. package/dist/modules/campus.d.ts +31 -36
  22. package/dist/modules/campus.js +36 -49
  23. package/dist/modules/contacts.d.ts +33 -29
  24. package/dist/modules/contacts.js +36 -12
  25. package/dist/modules/fields.d.ts +39 -55
  26. package/dist/modules/fields.js +65 -105
  27. package/dist/modules/forms.d.ts +35 -24
  28. package/dist/modules/forms.js +41 -23
  29. package/dist/modules/households.d.ts +17 -19
  30. package/dist/modules/households.js +25 -34
  31. package/dist/modules/lists.d.ts +38 -28
  32. package/dist/modules/lists.js +62 -42
  33. package/dist/modules/notes.d.ts +32 -30
  34. package/dist/modules/notes.js +40 -52
  35. package/dist/modules/people.d.ts +83 -71
  36. package/dist/modules/people.js +323 -172
  37. package/dist/modules/reports.d.ts +18 -32
  38. package/dist/modules/reports.js +28 -40
  39. package/dist/modules/service-time.d.ts +19 -24
  40. package/dist/modules/service-time.js +28 -28
  41. package/dist/modules/workflows.d.ts +42 -47
  42. package/dist/modules/workflows.js +52 -53
  43. package/dist/performance.d.ts +14 -10
  44. package/dist/performance.js +61 -25
  45. package/dist/testing/recorder.js +11 -2
  46. package/dist/testing/simple-builders.d.ts +6 -4
  47. package/dist/testing/simple-builders.js +36 -49
  48. package/dist/testing/types.d.ts +4 -0
  49. package/dist/types/api-options.d.ts +380 -0
  50. package/dist/types/api-options.js +6 -0
  51. package/dist/types/client.d.ts +4 -2
  52. package/dist/types/client.js +1 -1
  53. package/dist/types/index.d.ts +1 -1
  54. package/dist/types/people.d.ts +61 -9
  55. package/package.json +7 -7
  56. package/dist/core/http.d.ts +0 -56
  57. package/dist/core/http.js +0 -360
  58. package/dist/core/pagination.d.ts +0 -34
  59. package/dist/core/pagination.js +0 -178
  60. package/dist/people/contacts.d.ts +0 -43
  61. package/dist/people/contacts.js +0 -122
  62. package/dist/people/core.d.ts +0 -28
  63. package/dist/people/core.js +0 -69
  64. package/dist/people/fields.d.ts +0 -68
  65. package/dist/people/fields.js +0 -305
  66. package/dist/people/households.d.ts +0 -15
  67. package/dist/people/households.js +0 -31
  68. package/dist/people/index.d.ts +0 -8
  69. package/dist/people/index.js +0 -25
  70. package/dist/people/lists.d.ts +0 -34
  71. package/dist/people/lists.js +0 -48
  72. package/dist/people/notes.d.ts +0 -30
  73. package/dist/people/notes.js +0 -37
  74. package/dist/people/organization.d.ts +0 -12
  75. package/dist/people/organization.js +0 -15
  76. package/dist/people/workflows.d.ts +0 -37
  77. package/dist/people/workflows.js +0 -75
@@ -141,6 +141,10 @@ export interface RecordingConfig {
141
141
  filter?: (endpoint: string, method: string) => boolean;
142
142
  /** Transform recorded responses */
143
143
  transform?: (response: any) => any;
144
+ /** Optional getConfig for debug logging (e.g. when recording client has debug) */
145
+ getConfig?: () => {
146
+ debug?: boolean | import('@rachelallyson/planning-center-base-ts').PcoDebugOptions;
147
+ };
144
148
  }
145
149
  export interface RecordedRequest {
146
150
  endpoint: string;
@@ -0,0 +1,380 @@
1
+ /**
2
+ * Strictly typed API options for Planning Center People API endpoints
3
+ * Based on official API documentation: https://developer.planning.center/docs
4
+ */
5
+ /**
6
+ * Valid include values for Person endpoint
7
+ */
8
+ export type PersonInclude = 'addresses' | 'emails' | 'field_data' | 'households' | 'inactive_reason' | 'marital_status' | 'name_prefix' | 'name_suffix' | 'organization' | 'person_apps' | 'phone_numbers' | 'platform_notifications' | 'primary_campus' | 'school' | 'social_profiles';
9
+ /**
10
+ * Valid order fields for Person endpoint (prefix with '-' for descending)
11
+ */
12
+ export type PersonOrderField = 'accounting_administrator' | 'anniversary' | 'birthdate' | 'child' | 'created_at' | 'first_name' | 'gender' | 'given_name' | 'grade' | 'graduation_year' | 'inactivated_at' | 'last_name' | 'membership' | 'middle_name' | 'nickname' | 'people_permissions' | 'remote_id' | 'site_administrator' | 'status' | 'updated_at';
13
+ /**
14
+ * Strictly typed where clause for Person endpoint
15
+ */
16
+ export interface PersonWhereClause {
17
+ accounting_administrator?: boolean;
18
+ anniversary?: string;
19
+ birthdate?: string;
20
+ child?: boolean;
21
+ created_at?: string;
22
+ first_name?: string;
23
+ gender?: string;
24
+ given_name?: string;
25
+ grade?: number;
26
+ graduation_year?: number;
27
+ id?: string;
28
+ inactivated_at?: string | null;
29
+ last_name?: string;
30
+ medical_notes?: string;
31
+ membership?: string;
32
+ mfa_configured?: boolean;
33
+ middle_name?: string;
34
+ nickname?: string;
35
+ people_permissions?: string;
36
+ primary_campus_id?: number;
37
+ remote_id?: number;
38
+ search_name?: string;
39
+ search_name_or_email?: string;
40
+ search_name_or_email_or_phone_number?: string;
41
+ search_phone_number?: string;
42
+ search_phone_number_e164?: string;
43
+ site_administrator?: boolean;
44
+ status?: string;
45
+ updated_at?: string;
46
+ }
47
+ /**
48
+ * Strictly typed options for Person getAll() - no pagination options
49
+ */
50
+ export interface PersonListOptions {
51
+ /** Filter by specific fields */
52
+ where?: PersonWhereClause;
53
+ /** Include related resources */
54
+ include?: PersonInclude[];
55
+ /** Order by field (prefix with '-' for descending) */
56
+ order?: PersonOrderField | `-${PersonOrderField}`;
57
+ }
58
+ /**
59
+ * Strictly typed options for Person getPage() - includes pagination
60
+ */
61
+ export interface PersonPageOptions extends PersonListOptions {
62
+ /** Items per page (1-100, default: 25) */
63
+ perPage?: number;
64
+ /** Page number */
65
+ page?: number;
66
+ }
67
+ /**
68
+ * Valid include values for FieldDefinition endpoint
69
+ */
70
+ export type FieldDefinitionInclude = 'tab' | 'field_options';
71
+ /**
72
+ * Valid order fields for FieldDefinition endpoint
73
+ */
74
+ export type FieldDefinitionOrderField = 'config' | 'data_type' | 'deleted_at' | 'name' | 'sequence' | 'slug' | 'tab_id';
75
+ /**
76
+ * Strictly typed where clause for FieldDefinition endpoint
77
+ */
78
+ export interface FieldDefinitionWhereClause {
79
+ config?: string;
80
+ data_type?: string;
81
+ deleted_at?: string;
82
+ name?: string;
83
+ sequence?: number;
84
+ slug?: string;
85
+ tab_id?: string;
86
+ }
87
+ /**
88
+ * Strictly typed options for FieldDefinition list endpoints
89
+ */
90
+ export interface FieldDefinitionListOptions {
91
+ /** Include related resources */
92
+ include?: FieldDefinitionInclude[];
93
+ /** Filter by specific fields */
94
+ where?: FieldDefinitionWhereClause;
95
+ /** Order by field (prefix with '-' for descending) */
96
+ order?: FieldDefinitionOrderField | `-${FieldDefinitionOrderField}`;
97
+ /** Include deleted field definitions */
98
+ includeDeleted?: boolean;
99
+ }
100
+ export type FieldDataOrderField = 'file' | 'file_content_type' | 'file_name' | 'file_size' | 'value';
101
+ export interface FieldDataWhereClause {
102
+ field_definition_id?: number;
103
+ file?: string;
104
+ file_content_type?: string;
105
+ file_name?: string;
106
+ file_size?: number;
107
+ value?: string;
108
+ }
109
+ export interface FieldDataOptions {
110
+ /** Include related resources */
111
+ include?: ('field_definition' | 'field_option' | 'tab')[];
112
+ /** Filter by specific fields */
113
+ where?: FieldDataWhereClause;
114
+ /** Order by field (prefix with '-' for descending) */
115
+ order?: FieldDataOrderField | `-${FieldDataOrderField}`;
116
+ }
117
+ /**
118
+ * Valid include values for Workflow endpoint
119
+ */
120
+ export type WorkflowInclude = 'category' | 'shares' | 'steps';
121
+ /**
122
+ * Valid order fields for Workflow endpoint
123
+ */
124
+ export type WorkflowOrderField = 'archived_at' | 'campus_id' | 'created_at' | 'deleted_at' | 'name' | 'updated_at' | 'workflow_category_id';
125
+ /**
126
+ * Strictly typed where clause for Workflow endpoint
127
+ */
128
+ export interface WorkflowWhereClause {
129
+ archived_at?: string;
130
+ campus_id?: string;
131
+ created_at?: string;
132
+ deleted_at?: string;
133
+ id?: string;
134
+ name?: string;
135
+ updated_at?: string;
136
+ workflow_category_id?: string;
137
+ }
138
+ /**
139
+ * Strictly typed options for Workflow getAll() - no pagination options
140
+ */
141
+ export interface WorkflowListOptions {
142
+ /** Filter by specific fields */
143
+ where?: WorkflowWhereClause;
144
+ /** Include related resources */
145
+ include?: WorkflowInclude[];
146
+ /** Order by field (prefix with '-' for descending) */
147
+ order?: WorkflowOrderField | `-${WorkflowOrderField}`;
148
+ }
149
+ /**
150
+ * Strictly typed options for Workflow getPage() - includes pagination
151
+ */
152
+ export interface WorkflowPageOptions extends WorkflowListOptions {
153
+ /** Items per page (1-100, default: 25) */
154
+ perPage?: number;
155
+ /** Page number */
156
+ page?: number;
157
+ }
158
+ /**
159
+ * Valid include values for Note endpoint
160
+ */
161
+ export type NoteInclude = 'note_category' | 'created_by' | 'person' | 'organization';
162
+ /**
163
+ * Valid order fields for Note endpoint
164
+ */
165
+ export type NoteOrderField = 'created_at' | 'display_date' | 'id' | 'note' | 'note_category_id' | 'updated_at';
166
+ /**
167
+ * Strictly typed where clause for Note endpoint
168
+ */
169
+ export interface NoteWhereClause {
170
+ note?: string;
171
+ note_category_id?: string;
172
+ }
173
+ /**
174
+ * Strictly typed options for Note getAll() - no pagination options
175
+ */
176
+ export interface NoteListOptions {
177
+ /** Filter by specific fields */
178
+ where?: NoteWhereClause;
179
+ /** Include related resources */
180
+ include?: NoteInclude[];
181
+ /** Order by field (prefix with '-' for descending) */
182
+ order?: NoteOrderField | `-${NoteOrderField}`;
183
+ }
184
+ /**
185
+ * Strictly typed options for Note getPage() - includes pagination
186
+ */
187
+ export interface NotePageOptions extends NoteListOptions {
188
+ /** Items per page (1-100, default: 25) */
189
+ perPage?: number;
190
+ /** Page number */
191
+ page?: number;
192
+ }
193
+ /**
194
+ * Valid include values for List endpoint
195
+ */
196
+ export type ListInclude = 'campus' | 'category' | 'created_by' | 'mailchimp_sync_status' | 'people' | 'rules' | 'shares' | 'updated_by';
197
+ /**
198
+ * Valid order fields for List endpoint
199
+ */
200
+ export type ListOrderField = 'batch_completed_at' | 'campus_id' | 'created_at' | 'list_categories.name' | 'list_category_id' | 'name' | 'name_or_description' | 'updated_at';
201
+ /**
202
+ * Strictly typed where clause for List endpoint
203
+ */
204
+ export interface ListWhereClause {
205
+ batch_completed_at?: string;
206
+ created_at?: string;
207
+ id?: string;
208
+ list_category_id?: string;
209
+ name?: string;
210
+ updated_at?: string;
211
+ }
212
+ /**
213
+ * Strictly typed options for List getAll() - no pagination options
214
+ */
215
+ export interface ListListOptions {
216
+ /** Filter by specific fields */
217
+ where?: ListWhereClause;
218
+ /** Include related resources */
219
+ include?: ListInclude[];
220
+ /** Order by field (prefix with '-' for descending) */
221
+ order?: ListOrderField | `-${ListOrderField}`;
222
+ }
223
+ /**
224
+ * Strictly typed options for List getPage() - includes pagination
225
+ */
226
+ export interface ListPageOptions extends ListListOptions {
227
+ /** Items per page (1-100, default: 25) */
228
+ perPage?: number;
229
+ /** Page number */
230
+ page?: number;
231
+ }
232
+ /**
233
+ * Valid include values for Household endpoint
234
+ */
235
+ export type HouseholdInclude = 'people' | 'primary_contact';
236
+ /**
237
+ * Valid order fields for Household endpoint
238
+ */
239
+ export type HouseholdOrderField = 'created_at' | 'member_count' | 'name' | 'primary_contact_name' | 'updated_at';
240
+ /**
241
+ * Strictly typed where clause for Household endpoint
242
+ */
243
+ export interface HouseholdWhereClause {
244
+ created_at?: string;
245
+ member_count?: number;
246
+ name?: string;
247
+ updated_at?: string;
248
+ }
249
+ /**
250
+ * Strictly typed options for Household getAll() - no pagination options
251
+ */
252
+ export interface HouseholdListOptions {
253
+ /** Filter by specific fields */
254
+ where?: HouseholdWhereClause;
255
+ /** Include related resources */
256
+ include?: HouseholdInclude[];
257
+ /** Order by field (prefix with '-' for descending) */
258
+ order?: HouseholdOrderField | `-${HouseholdOrderField}`;
259
+ }
260
+ /**
261
+ * Strictly typed options for Household getPage() - includes pagination
262
+ */
263
+ export interface HouseholdPageOptions extends HouseholdListOptions {
264
+ /** Items per page (1-100, default: 25) */
265
+ perPage?: number;
266
+ /** Page number */
267
+ page?: number;
268
+ }
269
+ /**
270
+ * Valid include values for Campus endpoint
271
+ */
272
+ export type CampusInclude = 'organization' | 'lists' | 'service_times';
273
+ /**
274
+ * Valid order fields for Campus endpoint
275
+ */
276
+ export type CampusOrderField = 'created_at' | 'name' | 'updated_at';
277
+ /**
278
+ * Strictly typed where clause for Campus endpoint
279
+ */
280
+ export interface CampusWhereClause {
281
+ created_at?: string;
282
+ id?: string;
283
+ updated_at?: string;
284
+ }
285
+ /**
286
+ * Strictly typed options for Campus getAll() - no pagination options
287
+ */
288
+ export interface CampusListOptions {
289
+ /** Filter by specific fields */
290
+ where?: CampusWhereClause;
291
+ /** Include related resources */
292
+ include?: CampusInclude[];
293
+ /** Order by field (prefix with '-' for descending) */
294
+ order?: CampusOrderField | `-${CampusOrderField}`;
295
+ }
296
+ /**
297
+ * Strictly typed options for Campus getPage() - includes pagination
298
+ */
299
+ export interface CampusPageOptions extends CampusListOptions {
300
+ /** Items per page (1-100, default: 25) */
301
+ perPage?: number;
302
+ /** Page number */
303
+ page?: number;
304
+ }
305
+ /**
306
+ * Strictly typed where clause for Form endpoint
307
+ */
308
+ export interface FormWhereClause {
309
+ active?: boolean;
310
+ id?: string;
311
+ }
312
+ /**
313
+ * Strictly typed options for Form getAll() - no pagination options
314
+ */
315
+ export interface FormListOptions {
316
+ /** Filter by specific fields */
317
+ where?: FormWhereClause;
318
+ /** Include related resources */
319
+ include?: string[];
320
+ /** Order by field (prefix with '-' for descending) */
321
+ order?: string;
322
+ }
323
+ /**
324
+ * Strictly typed options for Form getPage() - includes pagination
325
+ */
326
+ export interface FormPageOptions extends FormListOptions {
327
+ /** Items per page (1-100, default: 25) */
328
+ perPage?: number;
329
+ /** Page number */
330
+ page?: number;
331
+ }
332
+ /**
333
+ * Strictly typed where clause for Report endpoint
334
+ */
335
+ export interface ReportWhereClause {
336
+ body?: string;
337
+ created_at?: string;
338
+ name?: string;
339
+ updated_at?: string;
340
+ }
341
+ /**
342
+ * Strictly typed options for Report getAll() - no pagination options
343
+ */
344
+ export interface ReportListOptions {
345
+ /** Filter by specific fields */
346
+ where?: ReportWhereClause;
347
+ /** Include related resources */
348
+ include?: string[];
349
+ /** Order by field (prefix with '-' for descending) */
350
+ order?: string;
351
+ }
352
+ /**
353
+ * Strictly typed options for Report getPage() - includes pagination
354
+ */
355
+ export interface ReportPageOptions extends ReportListOptions {
356
+ /** Items per page (1-100, default: 25) */
357
+ perPage?: number;
358
+ /** Page number */
359
+ page?: number;
360
+ }
361
+ /**
362
+ * Strictly typed options for ServiceTime getAll() - no pagination options
363
+ */
364
+ export interface ServiceTimeListOptions {
365
+ /** Filter by specific fields - Note: ServiceTime endpoint does not support where[] filtering */
366
+ where?: never;
367
+ /** Include related resources */
368
+ include?: string[];
369
+ /** Order by field (prefix with '-' for descending) */
370
+ order?: string;
371
+ }
372
+ /**
373
+ * Strictly typed options for ServiceTime getPage() - includes pagination
374
+ */
375
+ export interface ServiceTimePageOptions extends ServiceTimeListOptions {
376
+ /** Items per page (1-100, default: 25) */
377
+ perPage?: number;
378
+ /** Page number */
379
+ page?: number;
380
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Strictly typed API options for Planning Center People API endpoints
4
+ * Based on official API documentation: https://developer.planning.center/docs
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * v2.0.0 Client Configuration Types
3
3
  *
4
- * Re-exports from base package for convenience
4
+ * Re-exports from base package for consistency. Debug options live in base so all PCO packages share the same behavior.
5
5
  */
6
- export type { PcoClientConfig, PcoAuthConfig, PersonalAccessTokenAuth, OAuthAuth, BasicAuth, ErrorEvent, AuthFailureEvent, RequestStartEvent, RequestCompleteEvent, RateLimitEvent, CacheEvent, } from '@rachelallyson/planning-center-base-ts';
6
+ export type { PcoClientConfig, PcoAuthConfig, PcoDebugOptions, PersonalAccessTokenAuth, OAuthAuth, BasicAuth, ErrorEvent, AuthFailureEvent, RequestStartEvent, RequestCompleteEvent, RateLimitEvent, CacheEvent, } from '@rachelallyson/planning-center-base-ts';
7
+ /** Alias for PcoClientConfig (base now includes debug). Use for clarity in People package. */
8
+ export type PeopleClientConfig = import('@rachelallyson/planning-center-base-ts').PcoClientConfig;
@@ -2,6 +2,6 @@
2
2
  /**
3
3
  * v2.0.0 Client Configuration Types
4
4
  *
5
- * Re-exports from base package for convenience
5
+ * Re-exports from base package for consistency. Debug options live in base so all PCO packages share the same behavior.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,3 @@
1
1
  export type { JsonValue, Meta, LinkObject, Link, Links, PaginationLinks, TopLevelLinks, TopLevelJsonApi, ResourceIdentifier, Relationship, ToOne, ToMany, Attributes, ResourceObject, JsonApiBase, ErrorObject, ErrorDocument, DataDocumentSingle, DataDocumentMany, JsonApiDocument, Paginated, Response, } from '@rachelallyson/planning-center-base-ts';
2
2
  export * from './people';
3
- export type { AddressAttributes, AddressesList, AddressResource, AddressSingle, EmailAttributes, EmailResource, EmailSingle, EmailsList, FieldDefinitionAttributes, FieldDefinitionResource, FieldDefinitionSingle, FieldDefinitionsList, FieldOptionAttributes, FieldOptionResource, FieldOptionSingle, FieldOptionsList, HouseholdAttributes, HouseholdResource, HouseholdSingle, HouseholdsList, PeopleList, PersonAttributes, PersonRelationships, PersonResource, PersonSingle, PhoneNumberAttributes, PhoneNumberResource, PhoneNumberSingle, PhoneNumbersList, SocialProfileAttributes, SocialProfileResource, SocialProfileSingle, SocialProfilesList, } from './people';
3
+ export type { AddressAttributes, AddressesList, AddressResource, AddressSingle, EmailAttributes, EmailResource, EmailSingle, EmailsList, FieldDefinitionAttributes, FieldDefinitionResource, FieldDefinitionSingle, FieldDefinitionsList, FieldOptionAttributes, FieldOptionResource, FieldOptionSingle, FieldOptionsList, HouseholdAttributes, HouseholdResource, HouseholdSingle, HouseholdsList, PeopleList, PersonAttributes, PersonRelationships, PersonRelationshipMap, FlattenedPersonResource, PersonResource, PersonSingle, PhoneNumberAttributes, PhoneNumberResource, PhoneNumberSingle, PhoneNumbersList, SocialProfileAttributes, SocialProfileResource, SocialProfileSingle, SocialProfilesList, } from './people';
@@ -3,6 +3,7 @@
3
3
  * Based on JSON:API 1.0 specification
4
4
  */
5
5
  import { Attributes, Paginated, Relationship, ResourceObject, Response } from './json-api';
6
+ import type { FlattenedResource } from '@rachelallyson/planning-center-base-ts';
6
7
  export interface PersonAttributes extends Attributes {
7
8
  first_name?: string;
8
9
  last_name?: string;
@@ -50,11 +51,32 @@ export interface PersonRelationships {
50
51
  }
51
52
  export interface PersonResource extends ResourceObject<'Person', PersonAttributes, PersonRelationships> {
52
53
  }
54
+ /**
55
+ * Mapping of Person relationship keys to their resource types
56
+ * Used for proper typing of flattened relationships
57
+ */
58
+ export type PersonRelationshipMap = {
59
+ emails: EmailResource[];
60
+ phone_numbers: PhoneNumberResource[];
61
+ addresses: AddressResource[];
62
+ household: HouseholdResource;
63
+ primary_campus: CampusResource;
64
+ gender: ResourceObject<string, any, any>;
65
+ workflow_cards: WorkflowCardResource[];
66
+ notes: NoteResource[];
67
+ field_data: FieldDatumResource[];
68
+ social_profiles: SocialProfileResource[];
69
+ };
70
+ /**
71
+ * Flattened Person resource type with properly typed relationships
72
+ * Relationships are typed as their actual resource types, not Relationship wrappers
73
+ */
74
+ export type FlattenedPersonResource = FlattenedResource<PersonResource['type'], PersonAttributes, PersonRelationships, PersonRelationshipMap>;
53
75
  export type PeopleList = Paginated<PersonResource, PeopleIncluded>;
54
76
  export type PersonSingle = Response<PersonResource>;
55
77
  export interface EmailAttributes extends Attributes {
56
- address?: string;
57
- location?: string;
78
+ address: string;
79
+ location: 'Home' | 'Work' | 'Other';
58
80
  primary?: boolean;
59
81
  created_at?: string;
60
82
  updated_at?: string;
@@ -68,8 +90,8 @@ export interface EmailResource extends ResourceObject<'Email', EmailAttributes,
68
90
  export type EmailsList = Paginated<EmailResource>;
69
91
  export type EmailSingle = Response<EmailResource>;
70
92
  export interface PhoneNumberAttributes extends Attributes {
71
- number?: string;
72
- location?: string;
93
+ number: string;
94
+ location: 'Home' | 'Work' | 'Other';
73
95
  primary?: boolean;
74
96
  created_at?: string;
75
97
  updated_at?: string;
@@ -169,12 +191,13 @@ export interface FieldOptionResource extends ResourceObject<'FieldOption', Field
169
191
  }
170
192
  export type FieldOptionsList = Paginated<FieldOptionResource>;
171
193
  export type FieldOptionSingle = Response<FieldOptionResource>;
194
+ export interface FieldDatumFileMetadata {
195
+ url?: string | null;
196
+ [key: string]: string | number | boolean | null | undefined;
197
+ }
172
198
  export interface FieldDatumAttributes extends Attributes {
173
199
  value?: string | null;
174
- file?: {
175
- url?: string | null;
176
- [key: string]: any;
177
- } | null;
200
+ file?: FieldDatumFileMetadata | null;
178
201
  file_content_type?: string | null;
179
202
  file_name?: string | null;
180
203
  file_size?: string | number | null;
@@ -186,6 +209,20 @@ export interface FieldDatumRelationships {
186
209
  }
187
210
  export interface FieldDatumResource extends ResourceObject<'FieldDatum', FieldDatumAttributes, FieldDatumRelationships> {
188
211
  }
212
+ /**
213
+ * Mapping of FieldDatum relationship keys to their resource types
214
+ * Used for proper typing of flattened relationships
215
+ */
216
+ export type FieldDatumRelationshipMap = {
217
+ field_definition: FieldDefinitionResource;
218
+ field_option: FieldOptionResource;
219
+ customizable: PersonResource;
220
+ };
221
+ /**
222
+ * Flattened FieldDatum resource type with properly typed relationships
223
+ * Relationships are typed as their actual resource types, not Relationship wrappers
224
+ */
225
+ export type FlattenedFieldDatumResource = FlattenedResource<FieldDatumResource['type'], FieldDatumAttributes, FieldDatumRelationships, FieldDatumRelationshipMap>;
189
226
  export type FieldDataList = Paginated<FieldDatumResource>;
190
227
  export type FieldDataSingle = Response<FieldDatumResource>;
191
228
  export interface ListAttributes extends Attributes {
@@ -236,8 +273,23 @@ export interface ListStarResource extends ResourceObject<'ListStar', ListStarAtt
236
273
  }
237
274
  export type ListStarsList = Paginated<ListStarResource>;
238
275
  export type ListStarSingle = Response<ListStarResource>;
276
+ export interface ListRuleAttributes extends Attributes {
277
+ group?: string;
278
+ operator?: string;
279
+ value?: string;
280
+ created_at?: string;
281
+ updated_at?: string;
282
+ }
283
+ export interface ListRuleRelationships {
284
+ list?: Relationship;
285
+ }
286
+ export interface ListRuleResource extends ResourceObject<'Rule', ListRuleAttributes, ListRuleRelationships> {
287
+ }
288
+ export type ListRulesList = Paginated<ListRuleResource>;
289
+ export type ListRuleSingle = Response<ListRuleResource>;
239
290
  export interface NoteAttributes extends Attributes {
240
- content?: string;
291
+ note?: string;
292
+ note_category_id?: string;
241
293
  created_at?: string;
242
294
  updated_at?: string;
243
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rachelallyson/planning-center-people-ts",
3
- "version": "2.14.1",
3
+ "version": "3.1.0",
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",
@@ -39,12 +39,12 @@
39
39
  "license": "MIT",
40
40
  "devDependencies": {
41
41
  "@types/jest": "^30.0.0",
42
- "@types/node": "^20.0.0",
43
- "dotenv": "^16.6.1",
42
+ "@types/node": "^25.0.10",
43
+ "dotenv": "^17.2.3",
44
44
  "jest": "^30.2.0",
45
- "ts-jest": "^29.4.4",
45
+ "ts-jest": "^29.4.6",
46
46
  "tslib": "^2.8.1",
47
- "typedoc": "^0.28.14",
47
+ "typedoc": "^0.28.16",
48
48
  "typedoc-plugin-markdown": "^4.9.0",
49
49
  "typescript": "^5.9.3"
50
50
  },
@@ -69,7 +69,7 @@
69
69
  "access": "public"
70
70
  },
71
71
  "dependencies": {
72
- "@rachelallyson/planning-center-base-ts": "^1.0.0",
73
- "form-data": "^4.0.4"
72
+ "@rachelallyson/planning-center-base-ts": "^1.1.0",
73
+ "form-data": "^4.0.5"
74
74
  }
75
75
  }
@@ -1,56 +0,0 @@
1
- /**
2
- * v2.0.0 HTTP Client
3
- */
4
- import type { PcoClientConfig } from '../types/client';
5
- import { PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
6
- export interface HttpRequestOptions {
7
- method: string;
8
- endpoint: string;
9
- data?: any;
10
- params?: Record<string, any>;
11
- headers?: Record<string, string>;
12
- timeout?: number;
13
- }
14
- export interface HttpResponse<T = any> {
15
- data: T;
16
- status: number;
17
- headers: Record<string, string>;
18
- requestId: string;
19
- duration: number;
20
- }
21
- export declare class PcoHttpClient {
22
- private config;
23
- private eventEmitter;
24
- private requestIdGenerator;
25
- private performanceMetrics;
26
- private rateLimitTracker;
27
- private rateLimiter;
28
- constructor(config: PcoClientConfig, eventEmitter: PcoEventEmitter);
29
- request<T = any>(options: HttpRequestOptions): Promise<HttpResponse<T>>;
30
- private makeRequest;
31
- private addAuthentication;
32
- private getResourceTypeFromEndpoint;
33
- private extractHeaders;
34
- private attemptTokenRefresh;
35
- private updateRateLimitTracking;
36
- getPerformanceMetrics(): Record<string, {
37
- count: number;
38
- averageTime: number;
39
- minTime: number;
40
- maxTime: number;
41
- errorRate: number;
42
- }>;
43
- getRateLimitInfo(): Record<string, {
44
- limit: number;
45
- remaining: number;
46
- resetTime: number;
47
- }>;
48
- /**
49
- * Get authentication header for external services (like file uploads)
50
- */
51
- getAuthHeader(): string;
52
- /**
53
- * Make HTTPS request using Node.js HTTPS module (fallback when fetch is unavailable)
54
- */
55
- private makeHttpsRequest;
56
- }