@rachelallyson/planning-center-people-ts 2.8.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE +1 -1
  3. package/README.md +12 -14
  4. package/dist/client.d.ts +8 -8
  5. package/dist/client.js +8 -11
  6. package/dist/core/http.d.ts +1 -1
  7. package/dist/core/http.js +8 -8
  8. package/dist/core.d.ts +3 -3
  9. package/dist/core.js +4 -4
  10. package/dist/error-handling.d.ts +1 -1
  11. package/dist/error-handling.js +3 -3
  12. package/dist/error-scenarios.js +4 -4
  13. package/dist/index.d.ts +8 -8
  14. package/dist/index.js +15 -15
  15. package/dist/matching/matcher.d.ts +22 -0
  16. package/dist/matching/matcher.js +251 -20
  17. package/dist/matching/scoring.d.ts +9 -7
  18. package/dist/matching/scoring.js +49 -20
  19. package/dist/matching/strategies.d.ts +1 -0
  20. package/dist/matching/strategies.js +15 -2
  21. package/dist/modules/campus.d.ts +5 -5
  22. package/dist/modules/campus.js +2 -2
  23. package/dist/modules/contacts.d.ts +1 -1
  24. package/dist/modules/contacts.js +2 -2
  25. package/dist/modules/fields.d.ts +4 -4
  26. package/dist/modules/fields.js +2 -2
  27. package/dist/modules/forms.d.ts +7 -4
  28. package/dist/modules/forms.js +5 -2
  29. package/dist/modules/households.d.ts +2 -2
  30. package/dist/modules/households.js +2 -2
  31. package/dist/modules/lists.d.ts +2 -2
  32. package/dist/modules/lists.js +2 -2
  33. package/dist/modules/notes.d.ts +2 -2
  34. package/dist/modules/notes.js +2 -2
  35. package/dist/modules/people.d.ts +57 -5
  36. package/dist/modules/people.js +32 -2
  37. package/dist/modules/reports.d.ts +5 -5
  38. package/dist/modules/reports.js +2 -2
  39. package/dist/modules/service-time.d.ts +5 -5
  40. package/dist/modules/service-time.js +2 -2
  41. package/dist/modules/workflows.d.ts +2 -2
  42. package/dist/modules/workflows.js +2 -2
  43. package/dist/people/contacts.d.ts +1 -1
  44. package/dist/people/core.d.ts +1 -1
  45. package/dist/people/fields.d.ts +1 -1
  46. package/dist/people/fields.js +4 -4
  47. package/dist/people/households.d.ts +1 -1
  48. package/dist/people/lists.d.ts +1 -1
  49. package/dist/people/notes.d.ts +1 -1
  50. package/dist/people/organization.d.ts +1 -1
  51. package/dist/people/workflows.d.ts +1 -1
  52. package/dist/types/client.d.ts +3 -96
  53. package/dist/types/client.js +2 -0
  54. package/dist/types/index.d.ts +1 -2
  55. package/dist/types/index.js +0 -2
  56. package/package.json +15 -18
  57. package/dist/api-error.d.ts +0 -10
  58. package/dist/api-error.js +0 -32
  59. package/dist/batch.d.ts +0 -47
  60. package/dist/batch.js +0 -376
  61. package/dist/modules/base.d.ts +0 -46
  62. package/dist/modules/base.js +0 -82
  63. package/dist/monitoring.d.ts +0 -53
  64. package/dist/monitoring.js +0 -142
  65. package/dist/rate-limiter.d.ts +0 -79
  66. package/dist/rate-limiter.js +0 -137
  67. package/dist/types/batch.d.ts +0 -50
  68. package/dist/types/batch.js +0 -5
  69. package/dist/types/events.d.ts +0 -85
  70. package/dist/types/events.js +0 -5
@@ -4,8 +4,8 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ListsModule = void 0;
7
- const base_1 = require("./base");
8
- class ListsModule extends base_1.BaseModule {
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
  */
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * v2.0.0 Notes Module
3
3
  */
4
- import { BaseModule } from './base';
5
- import type { PaginationOptions, PaginationResult } from '../core/pagination';
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>;
@@ -4,8 +4,8 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NotesModule = void 0;
7
- const base_1 = require("./base");
8
- class NotesModule extends base_1.BaseModule {
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
  */
@@ -1,11 +1,8 @@
1
1
  /**
2
2
  * v2.0.0 People Module
3
3
  */
4
- import { BaseModule } from './base';
5
- import type { PcoHttpClient } from '../core/http';
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
  /**
@@ -4,9 +4,9 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PeopleModule = void 0;
7
- const base_1 = require("./base");
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 base_1.BaseModule {
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);
@@ -1,8 +1,8 @@
1
- import { BaseModule } from './base';
2
- import type { PcoHttpClient } from '../core/http';
3
- import type { PaginationHelper } from '../core/pagination';
4
- import type { PcoEventEmitter } from '../monitoring';
5
- import type { PaginationOptions, PaginationResult } from '../core/pagination';
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
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReportsModule = void 0;
4
- const base_1 = require("./base");
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 base_1.BaseModule {
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 './base';
2
- import type { PcoHttpClient } from '../core/http';
3
- import type { PaginationHelper } from '../core/pagination';
4
- import type { PcoEventEmitter } from '../monitoring';
5
- import type { PaginationOptions, PaginationResult } from '../core/pagination';
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 base_1 = require("./base");
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 base_1.BaseModule {
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 './base';
5
- import type { PaginationOptions, PaginationResult } from '../core/pagination';
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 base_1 = require("./base");
8
- class WorkflowsModule extends base_1.BaseModule {
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 '../error-handling';
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
@@ -1,5 +1,5 @@
1
1
  import { PcoClientState } from '../core';
2
- import type { ErrorContext } from '../error-handling';
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
@@ -1,5 +1,5 @@
1
1
  import { PcoClientState } from '../core';
2
- import type { ErrorContext } from '../error-handling';
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
@@ -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 error_handling_1 = require("../error-handling");
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, error_handling_1.withErrorBoundary)(async () => {
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: error_handling_1.ErrorCategory.EXTERNAL_API,
144
- severity: error_handling_1.ErrorSeverity.HIGH,
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
  /**
@@ -1,5 +1,5 @@
1
1
  import { PcoClientState } from '../core';
2
- import type { ErrorContext } from '../error-handling';
2
+ import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
3
3
  import { HouseholdSingle, HouseholdsList } from '../types';
4
4
  /**
5
5
  * Get all households
@@ -1,5 +1,5 @@
1
1
  import { PcoClientState } from '../core';
2
- import type { ErrorContext } from '../error-handling';
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
@@ -1,5 +1,5 @@
1
1
  import { PcoClientState } from '../core';
2
- import type { ErrorContext } from '../error-handling';
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 '../error-handling';
2
+ import type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
3
3
  import { OrganizationSingle } from '../types';
4
4
  /**
5
5
  * Get organization information
@@ -1,5 +1,5 @@
1
1
  import { PcoClientState } from '../core';
2
- import type { ErrorContext } from '../error-handling';
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
@@ -1,99 +1,6 @@
1
1
  /**
2
2
  * v2.0.0 Client Configuration Types
3
+ *
4
+ * Re-exports from base package for convenience
3
5
  */
4
- /** Authentication configuration for Personal Access Token */
5
- export interface PersonalAccessTokenAuth {
6
- type: 'personal_access_token';
7
- personalAccessToken: string;
8
- }
9
- /** Authentication configuration for OAuth 2.0 with required refresh handling */
10
- export interface OAuthAuth {
11
- type: 'oauth';
12
- accessToken: string;
13
- refreshToken: string;
14
- onRefresh: (tokens: {
15
- accessToken: string;
16
- refreshToken: string;
17
- }) => void | Promise<void>;
18
- onRefreshFailure: (error: Error) => void | Promise<void>;
19
- /** Client ID for token refresh (optional, can use environment variable PCO_APP_ID) */
20
- clientId?: string;
21
- /** Client Secret for token refresh (optional, can use environment variable PCO_APP_SECRET) */
22
- clientSecret?: string;
23
- }
24
- /** Authentication configuration for Basic Auth with app credentials */
25
- export interface BasicAuth {
26
- type: 'basic';
27
- appId: string;
28
- appSecret: string;
29
- }
30
- /** Union type for authentication configurations */
31
- export type PcoAuthConfig = PersonalAccessTokenAuth | OAuthAuth | BasicAuth;
32
- export interface PcoClientConfig {
33
- /** Authentication configuration */
34
- auth: PcoAuthConfig;
35
- /** Caching configuration */
36
- caching?: {
37
- fieldDefinitions?: boolean;
38
- ttl?: number;
39
- maxSize?: number;
40
- };
41
- /** Retry configuration */
42
- retry?: {
43
- enabled?: boolean;
44
- maxRetries?: number;
45
- baseDelay?: number;
46
- maxDelay?: number;
47
- backoff?: 'linear' | 'exponential';
48
- };
49
- /** Event handlers */
50
- events?: {
51
- onError?: (event: ErrorEvent) => void | Promise<void>;
52
- onAuthFailure?: (event: AuthFailureEvent) => void | Promise<void>;
53
- onRequestStart?: (event: RequestStartEvent) => void | Promise<void>;
54
- onRequestComplete?: (event: RequestCompleteEvent) => void | Promise<void>;
55
- onRateLimit?: (event: RateLimitEvent) => void | Promise<void>;
56
- };
57
- /** Base URL override */
58
- baseURL?: string;
59
- /** Request timeout in milliseconds */
60
- timeout?: number;
61
- /** Custom headers */
62
- headers?: Record<string, string>;
63
- }
64
- export interface ErrorEvent {
65
- error: Error;
66
- operation: string;
67
- timestamp: string;
68
- context?: Record<string, any>;
69
- }
70
- export interface AuthFailureEvent {
71
- error: Error;
72
- timestamp: string;
73
- authType: 'oauth' | 'basic';
74
- }
75
- export interface RequestStartEvent {
76
- endpoint: string;
77
- method: string;
78
- timestamp: string;
79
- requestId: string;
80
- }
81
- export interface RequestCompleteEvent {
82
- endpoint: string;
83
- method: string;
84
- status: number;
85
- duration: number;
86
- timestamp: string;
87
- requestId: string;
88
- }
89
- export interface RateLimitEvent {
90
- limit: number;
91
- remaining: number;
92
- resetTime: string;
93
- timestamp: string;
94
- }
95
- export interface CacheEvent {
96
- key: string;
97
- operation: 'hit' | 'miss' | 'set' | 'invalidate';
98
- timestamp: string;
99
- }
6
+ export type { PcoClientConfig, PcoAuthConfig, PersonalAccessTokenAuth, OAuthAuth, BasicAuth, ErrorEvent, AuthFailureEvent, RequestStartEvent, RequestCompleteEvent, RateLimitEvent, CacheEvent, } from '@rachelallyson/planning-center-base-ts';
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * v2.0.0 Client Configuration Types
4
+ *
5
+ * Re-exports from base package for convenience
4
6
  */
5
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,3 @@
1
- export * from './json-api';
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 { Paginated, Relationship, ResourceIdentifier, ResourceObject, } from './json-api';
4
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';
@@ -14,7 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- // Export all JSON:API types
18
- __exportStar(require("./json-api"), exports);
19
17
  // Export all People-specific types
20
18
  __exportStar(require("./people"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rachelallyson/planning-center-people-ts",
3
- "version": "2.8.0",
4
- "description": "A strictly typed TypeScript client for Planning Center Online People API with smart matching, batch operations, and enhanced developer experience",
3
+ "version": "2.9.0",
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",
7
7
  "scripts": {
@@ -13,11 +13,9 @@
13
13
  "test:watch": "jest --watch --testPathIgnorePatterns=integration.test.ts",
14
14
  "test:coverage": "jest --coverage --testPathIgnorePatterns=integration.test.ts",
15
15
  "test:ci": "jest --ci --coverage --watchAll=false --testPathIgnorePatterns=integration.test.ts",
16
- "test:integration": "dotenv -e .env.test -- jest --testPathPatterns=integration.test.ts --setupFilesAfterEnv='<rootDir>/tests/integration-setup.ts' --testTimeout=30000",
17
- "test:integration:people-all": "dotenv -e .env.test -- jest --testPathPatterns=integration/people-.*.integration.test.ts --setupFilesAfterEnv='<rootDir>/tests/integration-setup.ts' --testTimeout=30000",
18
- "test:integration:v2:all": "dotenv -e .env.test -- jest --testPathPatterns=integration/v2/.*.integration.test.ts --setupFilesAfterEnv='<rootDir>/tests/integration-setup.ts' --testTimeout=30000",
19
- "test:edge-cases": "jest --testPathPatterns=edge-cases.test.ts --testTimeout=30000",
20
- "test:all": "npm run test && npm run test:edge-cases",
16
+ "test:integration": "dotenv -e .env.test -- jest --testPathPatterns=integration/.*.integration.test.ts --setupFilesAfterEnv='<rootDir>/tests/integration-setup.ts' --testTimeout=60000",
17
+ "docs": "typedoc",
18
+ "docs:watch": "typedoc --watch",
21
19
  "prepublishOnly": "npm run build"
22
20
  },
23
21
  "keywords": [
@@ -29,26 +27,25 @@
29
27
  "json-api",
30
28
  "people",
31
29
  "church",
32
- "crm",
33
30
  "client",
34
31
  "sdk",
35
32
  "rate-limiting",
36
33
  "error-handling",
37
- "performance",
38
- "caching",
39
34
  "batch-operations",
40
- "smart-matching",
41
35
  "fluent-api",
42
- "event-system",
43
- "client-manager"
36
+ "event-system"
44
37
  ],
45
- "author": "Rachel Higley",
38
+ "author": "Rachel Allyson",
46
39
  "license": "MIT",
47
40
  "devDependencies": {
48
41
  "@types/jest": "^30.0.0",
42
+ "@types/node": "^20.0.0",
49
43
  "dotenv": "^16.6.1",
50
44
  "jest": "^30.2.0",
51
45
  "ts-jest": "^29.4.4",
46
+ "tslib": "^2.8.1",
47
+ "typedoc": "^0.28.14",
48
+ "typedoc-plugin-markdown": "^4.9.0",
52
49
  "typescript": "^5.9.3"
53
50
  },
54
51
  "files": [
@@ -59,12 +56,12 @@
59
56
  ],
60
57
  "repository": {
61
58
  "type": "git",
62
- "url": "https://github.com/rachelallyson/planning-center-people-ts.git"
59
+ "url": "https://github.com/rachelallyson/planning-center-monorepo.git"
63
60
  },
64
61
  "bugs": {
65
- "url": "https://github.com/rachelallyson/planning-center-people-ts/issues"
62
+ "url": "https://github.com/rachelallyson/planning-center-monorepo/issues"
66
63
  },
67
- "homepage": "https://github.com/rachelallyson/planning-center-people-ts#readme",
64
+ "homepage": "https://github.com/rachelallyson/planning-center-monorepo#readme",
68
65
  "engines": {
69
66
  "node": ">=16.0.0"
70
67
  },
@@ -72,6 +69,6 @@
72
69
  "access": "public"
73
70
  },
74
71
  "dependencies": {
75
- "form-data": "^4.0.4"
72
+ "@rachelallyson/planning-center-base-ts": "^1.0.0"
76
73
  }
77
74
  }
@@ -1,10 +0,0 @@
1
- import type { RateLimitHeaders } from './rate-limiter';
2
- import type { ErrorObject as JsonApiError } from './types';
3
- export declare class PcoApiError extends Error {
4
- readonly status: number;
5
- readonly statusText: string;
6
- readonly errors: JsonApiError[];
7
- readonly rateLimitHeaders?: RateLimitHeaders;
8
- constructor(message: string, status: number, statusText: string, errors: JsonApiError[], rateLimitHeaders?: RateLimitHeaders);
9
- static fromFetchError(response: Response, data?: unknown): PcoApiError;
10
- }
package/dist/api-error.js DELETED
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PcoApiError = void 0;
4
- // ===== PCO API Error =====
5
- class PcoApiError extends Error {
6
- constructor(message, status, statusText, errors, rateLimitHeaders) {
7
- super(message);
8
- this.name = 'PcoApiError';
9
- this.status = status;
10
- this.statusText = statusText;
11
- this.errors = errors;
12
- this.rateLimitHeaders = rateLimitHeaders;
13
- }
14
- static fromFetchError(response, data) {
15
- const status = response.status;
16
- const statusText = response.statusText;
17
- const apiErrors = Array.isArray(data?.errors)
18
- ? data.errors || []
19
- : [];
20
- const rateLimitHeaders = {
21
- 'Retry-After': response.headers.get('retry-after') ?? undefined,
22
- 'X-PCO-API-Request-Rate-Count': response.headers.get('x-pco-api-request-rate-count') ?? undefined,
23
- 'X-PCO-API-Request-Rate-Limit': response.headers.get('x-pco-api-request-rate-limit') ?? undefined,
24
- 'X-PCO-API-Request-Rate-Period': response.headers.get('x-pco-api-request-rate-period') ?? undefined,
25
- };
26
- const message = apiErrors.length > 0
27
- ? apiErrors.map(e => e.detail ?? e.title ?? 'Unknown error').join('; ')
28
- : statusText;
29
- return new PcoApiError(message, status, statusText, apiErrors, rateLimitHeaders);
30
- }
31
- }
32
- exports.PcoApiError = PcoApiError;