@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
package/CHANGELOG.md CHANGED
@@ -5,6 +5,58 @@ 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.0] - 2025-01-14
9
+
10
+ ### 🎯 **Matching Logic Improvements**
11
+
12
+ This release significantly improves the accuracy of person matching by verifying email/phone matches and preventing incorrect name-only matches.
13
+
14
+ ### 🐛 **Critical Bug Fixes**
15
+
16
+ - **🔍 Email/Phone Verification**: Fixed matching logic that was allowing name-only matches even when email/phone were provided but didn't match
17
+ - Previously, searching with email/phone would match people with different contact info if names matched
18
+ - Now requires actual email/phone verification before considering name matches
19
+ - **✅ Verified Contact Matching**: `scoreEmailMatch()` and `scorePhoneMatch()` now actually fetch and verify contact information instead of assuming matches
20
+ - **🚫 Name-Only Matching Restrictions**: Name-only matching now only occurs when:
21
+ - Multiple people share the same email/phone (name helps distinguish), OR
22
+ - No email/phone was provided in the search
23
+ - **🎯 Exact Match Strategy**: Made "exact" matching strategy stricter, requiring verified email/phone matches unless multiple people share the same contact info
24
+
25
+ ### ✨ **New Features**
26
+
27
+ - **📝 Auto-Update Contact Info**: New `addMissingContactInfo` option in `PersonMatchOptions`
28
+ - When enabled, automatically adds missing email/phone to a person's profile when a match is found
29
+ - Missing contacts are added as non-primary to preserve existing primary contacts
30
+ - Helps keep person profiles up-to-date when new contact information is discovered
31
+
32
+ ### 🔧 **Technical Improvements**
33
+
34
+ - **🔍 Async Verification**: Email and phone matching now uses async methods to fetch and verify actual contact information
35
+ - **📊 Improved Scoring**: MatchScorer now requires PeopleModule dependency to verify matches
36
+ - **🎯 Better Match Prioritization**: Verified email/phone matches are prioritized over name-only matches
37
+ - **📖 Enhanced Documentation**: Comprehensive JSDoc comments and README examples for all new features
38
+
39
+ ### 📚 **Documentation**
40
+
41
+ - **📖 JSDoc Updates**: Added detailed documentation for `PersonMatchOptions` interface and `findOrCreate()` method
42
+ - **📝 README Examples**: Added example showing `addMissingContactInfo` usage
43
+ - **🔍 Method Documentation**: Updated all matching methods with comprehensive parameter descriptions
44
+
45
+ ### 🎯 **Impact**
46
+
47
+ This release fixes the issue where:
48
+
49
+ - ❌ Searching with `rachel@onark.app` + `+11233853584` would incorrectly match someone with `rachel@hangar31.dev` + `+16103017206` based on name alone
50
+ - ❌ Email/phone matches were assumed without verification
51
+ - ❌ Name-only matching occurred even when email/phone were provided
52
+
53
+ Now matching:
54
+
55
+ - ✅ Verifies email/phone actually match before considering a match
56
+ - ✅ Only uses name matching when appropriate (multiple people share contact info or no contact info provided)
57
+ - ✅ Can automatically update profiles with missing contact information
58
+ - ✅ Provides stricter exact matching for high-confidence scenarios
59
+
8
60
  ## [2.8.0] - 2025-01-11
9
61
 
10
62
  ### 🎯 **CRITICAL FINDORCREATE BUG FIX**
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Rachel Higley
3
+ Copyright (c) 2024 Rachel Allyson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A modern, type-safe TypeScript library for interacting with the Planning Center Online People API. Built with a class-based architecture, comprehensive error handling, and advanced features like person matching and batch operations.
4
4
 
5
- > **📖 For the latest documentation and examples, see [docs/README.md](docs/README.md)**
5
+ > **📖 For the latest documentation and examples, see the [Monorepo Documentation Site](../../docs/content/index.mdx)**
6
6
 
7
7
  ## Features
8
8
 
@@ -519,19 +519,17 @@ See [TYPE_VALIDATION_SUMMARY.md](./TYPE_VALIDATION_SUMMARY.md) for detailed docu
519
519
 
520
520
  ## 📚 Comprehensive Documentation
521
521
 
522
- This library includes extensive documentation covering all aspects of usage:
523
-
524
- - **[📖 Complete Documentation](./docs/README.md)** - Comprehensive guide covering all features
525
- - **[🚀 Getting Started](./docs/OVERVIEW.md)** - What this library does and why you should use it
526
- - **[⚙️ Installation Guide](./docs/INSTALLATION.md)** - Complete setup instructions for all environments
527
- - **[🔐 Authentication Guide](./docs/AUTHENTICATION.md)** - All authentication methods and token management
528
- - **[📋 API Reference](./docs/API_REFERENCE.md)** - Complete reference for all 40+ functions
529
- - **[💡 Examples & Patterns](./docs/EXAMPLES.md)** - Real-world examples and common patterns
530
- - **[🛠️ Error Handling](./docs/ERROR_HANDLING.md)** - Advanced error management and recovery
531
- - **[ Performance Guide](./docs/PERFORMANCE.md)** - Optimization techniques and bulk operations
532
- - **[🔧 Troubleshooting](./docs/TROUBLESHOOTING.md)** - Common issues and solutions
533
- - **[🔄 Migration Guide](./docs/MIGRATION.md)** - Switching from other libraries
534
- - **[⭐ Best Practices](./docs/BEST_PRACTICES.md)** - Production-ready patterns and security
522
+ Complete documentation is available in the monorepo documentation site:
523
+
524
+ - **[📖 Documentation Index](../../docs/content/index.mdx)** - Complete documentation entry point
525
+ - **[🚀 Quick Start Guide](../../docs/content/guides/quickstart.mdx)** - Get started in 5 minutes
526
+ - **[📋 API Reference](../../docs/content/api/)** - Complete TypeScript API documentation
527
+ - **[⚙️ Configuration Reference](../../docs/content/reference/config.mdx)** - All configuration options
528
+ - **[💡 Examples & Recipes](../../docs/content/recipes/examples.mdx)** - Copy-paste code snippets
529
+ - **[🛠️ Error Handling Guide](../../docs/content/guides/error-handling.mdx)** - Comprehensive error handling
530
+ - **[📄 Pagination Guide](../../docs/content/guides/pagination.mdx)** - Handling paginated responses
531
+ - **[🔧 Troubleshooting](../../docs/content/troubleshooting.mdx)** - Common issues and solutions
532
+ - **[🏗️ Core Concepts](../../docs/content/concepts.mdx)** - Architecture and mental models
535
533
 
536
534
  ## License
537
535
 
package/dist/client.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * v2.0.0 Main PcoClient Class
3
3
  */
4
4
  import type { PcoClientConfig } from './types/client';
5
- import type { EventEmitter } from './types/events';
5
+ import type { EventEmitter, PcoEvent, EventHandler, EventType } from '@rachelallyson/planning-center-base-ts';
6
+ import { BatchExecutor } from '@rachelallyson/planning-center-base-ts';
6
7
  import { PeopleModule } from './modules/people';
7
8
  import { FieldsModule } from './modules/fields';
8
9
  import { WorkflowsModule } from './modules/workflows';
@@ -14,7 +15,6 @@ import { CampusModule } from './modules/campus';
14
15
  import { ServiceTimeModule } from './modules/service-time';
15
16
  import { FormsModule } from './modules/forms';
16
17
  import { ReportsModule } from './modules/reports';
17
- import { BatchExecutor } from './batch';
18
18
  export declare class PcoClient implements EventEmitter {
19
19
  people: PeopleModule;
20
20
  fields: FieldsModule;
@@ -33,9 +33,9 @@ export declare class PcoClient implements EventEmitter {
33
33
  private eventEmitter;
34
34
  private config;
35
35
  constructor(config: PcoClientConfig);
36
- on<T extends import('./types/events').PcoEvent>(eventType: T['type'], handler: import('./types/events').EventHandler<T>): void;
37
- off<T extends import('./types/events').PcoEvent>(eventType: T['type'], handler: import('./types/events').EventHandler<T>): void;
38
- emit<T extends import('./types/events').PcoEvent>(event: T): void;
36
+ on<T extends PcoEvent>(eventType: T['type'], handler: EventHandler<T>): void;
37
+ off<T extends PcoEvent>(eventType: T['type'], handler: EventHandler<T>): void;
38
+ emit<T extends PcoEvent>(event: T): void;
39
39
  /**
40
40
  * Get the current configuration
41
41
  */
@@ -65,15 +65,15 @@ export declare class PcoClient implements EventEmitter {
65
65
  /**
66
66
  * Clear all event listeners
67
67
  */
68
- removeAllListeners(eventType?: import('./types/events').EventType): void;
68
+ removeAllListeners(eventType?: EventType): void;
69
69
  /**
70
70
  * Get the number of listeners for an event type
71
71
  */
72
- listenerCount(eventType: import('./types/events').EventType): number;
72
+ listenerCount(eventType: EventType): number;
73
73
  /**
74
74
  * Get all registered event types
75
75
  */
76
- eventTypes(): import('./types/events').EventType[];
76
+ eventTypes(): EventType[];
77
77
  private setupEventHandlers;
78
78
  private updateModules;
79
79
  }
package/dist/client.js CHANGED
@@ -4,9 +4,7 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PcoClient = void 0;
7
- const monitoring_1 = require("./monitoring");
8
- const http_1 = require("./core/http");
9
- const pagination_1 = require("./core/pagination");
7
+ const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
10
8
  const people_1 = require("./modules/people");
11
9
  const fields_1 = require("./modules/fields");
12
10
  const workflows_1 = require("./modules/workflows");
@@ -18,13 +16,12 @@ const campus_1 = require("./modules/campus");
18
16
  const service_time_1 = require("./modules/service-time");
19
17
  const forms_1 = require("./modules/forms");
20
18
  const reports_1 = require("./modules/reports");
21
- const batch_1 = require("./batch");
22
19
  class PcoClient {
23
20
  constructor(config) {
24
21
  this.config = config;
25
- this.eventEmitter = new monitoring_1.PcoEventEmitter();
26
- this.httpClient = new http_1.PcoHttpClient(config, this.eventEmitter);
27
- this.paginationHelper = new pagination_1.PaginationHelper(this.httpClient);
22
+ this.eventEmitter = new planning_center_base_ts_1.PcoEventEmitter();
23
+ this.httpClient = new planning_center_base_ts_1.PcoHttpClient(config, this.eventEmitter);
24
+ this.paginationHelper = new planning_center_base_ts_1.PaginationHelper(this.httpClient);
28
25
  // Initialize modules
29
26
  this.people = new people_1.PeopleModule(this.httpClient, this.paginationHelper, this.eventEmitter);
30
27
  this.fields = new fields_1.FieldsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
@@ -37,7 +34,7 @@ class PcoClient {
37
34
  this.serviceTime = new service_time_1.ServiceTimeModule(this.httpClient, this.paginationHelper, this.eventEmitter);
38
35
  this.forms = new forms_1.FormsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
39
36
  this.reports = new reports_1.ReportsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
40
- this.batch = new batch_1.BatchExecutor(this, this.eventEmitter);
37
+ this.batch = new planning_center_base_ts_1.BatchExecutor(this, this.eventEmitter);
41
38
  // Set up event handlers from config
42
39
  this.setupEventHandlers();
43
40
  }
@@ -63,8 +60,8 @@ class PcoClient {
63
60
  updateConfig(updates) {
64
61
  this.config = { ...this.config, ...updates };
65
62
  // Recreate HTTP client with new config
66
- this.httpClient = new http_1.PcoHttpClient(this.config, this.eventEmitter);
67
- this.paginationHelper = new pagination_1.PaginationHelper(this.httpClient);
63
+ this.httpClient = new planning_center_base_ts_1.PcoHttpClient(this.config, this.eventEmitter);
64
+ this.paginationHelper = new planning_center_base_ts_1.PaginationHelper(this.httpClient);
68
65
  // Update modules with new HTTP client
69
66
  this.updateModules();
70
67
  }
@@ -125,7 +122,7 @@ class PcoClient {
125
122
  this.households = new households_1.HouseholdsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
126
123
  this.notes = new notes_1.NotesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
127
124
  this.lists = new lists_1.ListsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
128
- this.batch = new batch_1.BatchExecutor(this, this.eventEmitter);
125
+ this.batch = new planning_center_base_ts_1.BatchExecutor(this, this.eventEmitter);
129
126
  }
130
127
  }
131
128
  exports.PcoClient = PcoClient;
@@ -2,7 +2,7 @@
2
2
  * v2.0.0 HTTP Client
3
3
  */
4
4
  import type { PcoClientConfig } from '../types/client';
5
- import { PcoEventEmitter } from '../monitoring';
5
+ import { PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
6
6
  export interface HttpRequestOptions {
7
7
  method: string;
8
8
  endpoint: string;
package/dist/core/http.js CHANGED
@@ -4,18 +4,18 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PcoHttpClient = void 0;
7
- const monitoring_1 = require("../monitoring");
8
- const rate_limiter_1 = require("../rate-limiter");
9
- const api_error_1 = require("../api-error");
7
+ const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
8
+ const planning_center_base_ts_2 = require("@rachelallyson/planning-center-base-ts");
9
+ const planning_center_base_ts_3 = require("@rachelallyson/planning-center-base-ts");
10
10
  class PcoHttpClient {
11
11
  constructor(config, eventEmitter) {
12
12
  this.config = config;
13
13
  this.eventEmitter = eventEmitter;
14
- this.requestIdGenerator = new monitoring_1.RequestIdGenerator();
15
- this.performanceMetrics = new monitoring_1.PerformanceMetrics();
16
- this.rateLimitTracker = new monitoring_1.RateLimitTracker();
14
+ this.requestIdGenerator = new planning_center_base_ts_1.RequestIdGenerator();
15
+ this.performanceMetrics = new planning_center_base_ts_1.PerformanceMetrics();
16
+ this.rateLimitTracker = new planning_center_base_ts_1.RateLimitTracker();
17
17
  // Initialize rate limiter
18
- this.rateLimiter = new rate_limiter_1.PcoRateLimiter(100, 20000); // 100 requests per 20 seconds
18
+ this.rateLimiter = new planning_center_base_ts_2.PcoRateLimiter(100, 20000); // 100 requests per 20 seconds
19
19
  }
20
20
  async request(options) {
21
21
  const requestId = this.requestIdGenerator.generate();
@@ -163,7 +163,7 @@ class PcoHttpClient {
163
163
  catch {
164
164
  errorData = {};
165
165
  }
166
- throw api_error_1.PcoApiError.fromFetchError(response, errorData);
166
+ throw planning_center_base_ts_3.PcoApiError.fromFetchError(response, errorData);
167
167
  }
168
168
  // Parse response
169
169
  if (options.method === 'DELETE') {
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type ErrorContext, PcoError } from './error-handling';
2
- import { PcoRateLimiter } from './rate-limiter';
2
+ import { PcoRateLimiter } from '@rachelallyson/planning-center-base-ts';
3
3
  import { Paginated, ResourceObject, Response as JsonApiResponse } from './types';
4
4
  import { type TokenRefreshCallback, type TokenRefreshFailureCallback } from './auth';
5
5
  export interface PcoClientConfig {
@@ -36,7 +36,7 @@ export interface PcoClientConfig {
36
36
  onRetry?: (error: PcoError, attempt: number) => void;
37
37
  };
38
38
  }
39
- export { PcoApiError } from './api-error';
39
+ export { PcoApiError } from '@rachelallyson/planning-center-base-ts';
40
40
  export interface PcoClientState {
41
41
  config: PcoClientConfig;
42
42
  rateLimiter: PcoRateLimiter;
@@ -72,4 +72,4 @@ export declare function getAllPages<T extends ResourceObject<string, any, any>>(
72
72
  /**
73
73
  * Get rate limit information
74
74
  */
75
- export declare function getRateLimitInfo(client: PcoClientState): import("./rate-limiter").RateLimitInfo;
75
+ export declare function getRateLimitInfo(client: PcoClientState): import("@rachelallyson/planning-center-base-ts").RateLimitInfo;
package/dist/core.js CHANGED
@@ -10,11 +10,11 @@ exports.del = del;
10
10
  exports.getAllPages = getAllPages;
11
11
  exports.getRateLimitInfo = getRateLimitInfo;
12
12
  const error_handling_1 = require("./error-handling");
13
- const rate_limiter_1 = require("./rate-limiter");
13
+ const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
14
14
  const auth_1 = require("./auth");
15
15
  // Re-export PcoApiError for convenience
16
- var api_error_1 = require("./api-error");
17
- Object.defineProperty(exports, "PcoApiError", { enumerable: true, get: function () { return api_error_1.PcoApiError; } });
16
+ var planning_center_base_ts_2 = require("@rachelallyson/planning-center-base-ts");
17
+ Object.defineProperty(exports, "PcoApiError", { enumerable: true, get: function () { return planning_center_base_ts_2.PcoApiError; } });
18
18
  // ===== Core PCO Client Functions =====
19
19
  /**
20
20
  * Create a PCO client state
@@ -25,7 +25,7 @@ function createPcoClient(config) {
25
25
  maxRequests: 100,
26
26
  perMilliseconds: 20000, // 20 seconds
27
27
  };
28
- const rateLimiter = new rate_limiter_1.PcoRateLimiter(rateLimitConfig.maxRequests, rateLimitConfig.perMilliseconds);
28
+ const rateLimiter = new planning_center_base_ts_1.PcoRateLimiter(rateLimitConfig.maxRequests, rateLimitConfig.perMilliseconds);
29
29
  return {
30
30
  config,
31
31
  rateLimiter,
@@ -1,4 +1,4 @@
1
- import { PcoApiError } from './api-error';
1
+ import { PcoApiError } from '@rachelallyson/planning-center-base-ts';
2
2
  import type { ErrorObject as JsonApiError } from './types';
3
3
  export declare enum ErrorCategory {
4
4
  EXTERNAL_API = "external_api",
@@ -7,7 +7,7 @@ exports.withErrorBoundary = withErrorBoundary;
7
7
  exports.handleValidationError = handleValidationError;
8
8
  exports.handleTimeoutError = handleTimeoutError;
9
9
  exports.handleNetworkError = handleNetworkError;
10
- const api_error_1 = require("./api-error");
10
+ const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
11
11
  // Error categories for better monitoring
12
12
  var ErrorCategory;
13
13
  (function (ErrorCategory) {
@@ -29,7 +29,7 @@ var ErrorSeverity;
29
29
  ErrorSeverity["CRITICAL"] = "critical";
30
30
  })(ErrorSeverity || (exports.ErrorSeverity = ErrorSeverity = {}));
31
31
  // Enhanced PCO API Error with additional context
32
- class PcoError extends api_error_1.PcoApiError {
32
+ class PcoError extends planning_center_base_ts_1.PcoApiError {
33
33
  constructor(message, status, statusText, errors, rateLimitHeaders, context = {}) {
34
34
  super(message, status, statusText, errors, rateLimitHeaders);
35
35
  this.name = 'PcoError';
@@ -170,7 +170,7 @@ function shouldNotRetry(error) {
170
170
  if (error instanceof PcoError) {
171
171
  return !error.shouldRetry();
172
172
  }
173
- if (error instanceof api_error_1.PcoApiError) {
173
+ if (error instanceof planning_center_base_ts_1.PcoApiError) {
174
174
  // Don't retry authentication, authorization, or validation errors
175
175
  return (error.status === 401 ||
176
176
  error.status === 403 ||
@@ -13,7 +13,7 @@ exports.withTimeout = withTimeout;
13
13
  exports.classifyError = classifyError;
14
14
  exports.attemptRecovery = attemptRecovery;
15
15
  exports.createErrorReport = createErrorReport;
16
- const api_error_1 = require("./api-error");
16
+ const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
17
17
  exports.DEFAULT_RETRY_CONFIG = {
18
18
  backoffFactor: 2,
19
19
  baseDelay: 1000,
@@ -52,7 +52,7 @@ async function retryWithExponentialBackoff(operation, config = {}) {
52
52
  * Check if an error is retryable
53
53
  */
54
54
  function isRetryableError(error, retryableStatuses) {
55
- if (error instanceof api_error_1.PcoApiError) {
55
+ if (error instanceof planning_center_base_ts_1.PcoApiError) {
56
56
  return retryableStatuses.includes(error.status);
57
57
  }
58
58
  // Network errors are generally retryable
@@ -195,7 +195,7 @@ exports.TIMEOUT_CONFIG = {
195
195
  * Classify errors for appropriate handling
196
196
  */
197
197
  function classifyError(error) {
198
- if (error instanceof api_error_1.PcoApiError) {
198
+ if (error instanceof planning_center_base_ts_1.PcoApiError) {
199
199
  return classifyPcoError(error);
200
200
  }
201
201
  if (error.name === 'TypeError' && error.message.includes('fetch')) {
@@ -300,7 +300,7 @@ async function attemptRecovery(operation, error, context) {
300
300
  }
301
301
  // Rate limit recovery
302
302
  if (classification.category === 'rate_limit' &&
303
- error instanceof api_error_1.PcoApiError) {
303
+ error instanceof planning_center_base_ts_1.PcoApiError) {
304
304
  const retryAfter = error.rateLimitHeaders?.['Retry-After'];
305
305
  if (retryAfter) {
306
306
  const delay = parseInt(retryAfter) * 1000;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { PcoClient } from './client';
2
2
  export { PcoClientManager } from './client-manager';
3
3
  export type { PcoClientConfig, PcoAuthConfig, PersonalAccessTokenAuth, OAuthAuth } from './types/client';
4
- export type { PcoEvent, EventHandler, EventType } from './types/events';
5
- export type { BatchOperation, BatchResult, BatchOptions, BatchSummary } from './types/batch';
6
- export type { Paginated, Relationship, ResourceIdentifier, ResourceObject, } from './types';
4
+ export type { PcoEvent, EventHandler, EventType } from '@rachelallyson/planning-center-base-ts';
5
+ export type { BatchOperation, BatchResult, BatchOptions, BatchSummary } from '@rachelallyson/planning-center-base-ts';
6
+ export type { Paginated, Relationship, ResourceIdentifier, ResourceObject, } from '@rachelallyson/planning-center-base-ts';
7
7
  export type { PersonResource, PersonAttributes, PersonSingle, PeopleList, EmailResource, EmailAttributes, PhoneNumberResource, PhoneNumberAttributes, AddressResource, AddressAttributes, SocialProfileResource, SocialProfileAttributes, } from './types';
8
8
  export type { FieldDefinitionResource, FieldDefinitionAttributes, FieldDatumResource, FieldDatumAttributes, FieldOptionResource, FieldOptionAttributes, TabResource, TabAttributes, } from './types';
9
9
  export type { WorkflowResource, WorkflowAttributes, WorkflowCardResource, WorkflowCardAttributes, WorkflowCardNoteResource, WorkflowCardNoteAttributes, } from './types';
@@ -13,11 +13,11 @@ export type { PcoClientConfig as PcoClientConfigV1, PcoClientState } from './cor
13
13
  export { createPcoClient, del, getAllPages, getList, getRateLimitInfo, getSingle, patch, post, } from './core';
14
14
  export type { TokenResponse, TokenRefreshCallback, TokenRefreshFailureCallback } from './auth';
15
15
  export { attemptTokenRefresh, hasRefreshTokenCapability, refreshAccessToken, updateClientTokens, } from './auth';
16
- export { PcoApiError } from './api-error';
17
- export type { RateLimitHeaders, RateLimitInfo } from './rate-limiter';
18
- export { PcoRateLimiter } from './rate-limiter';
19
- export type { ErrorContext } from './error-handling';
20
- export { ErrorCategory, ErrorSeverity, handleNetworkError, handleTimeoutError, handleValidationError, PcoError, retryWithBackoff, shouldNotRetry, withErrorBoundary, } from './error-handling';
16
+ export { PcoApiError } from '@rachelallyson/planning-center-base-ts';
17
+ export type { RateLimitHeaders, RateLimitInfo } from '@rachelallyson/planning-center-base-ts';
18
+ export { PcoRateLimiter } from '@rachelallyson/planning-center-base-ts';
19
+ export type { ErrorContext } from '@rachelallyson/planning-center-base-ts';
20
+ export { ErrorCategory, ErrorSeverity, handleNetworkError, handleTimeoutError, handleValidationError, PcoError, retryWithBackoff, shouldNotRetry, withErrorBoundary, } from '@rachelallyson/planning-center-base-ts';
21
21
  export { createFieldDefinition, createFieldOption, createPerson, createPersonAddress, createPersonEmail, createPersonFieldData, createPersonPhoneNumber, createPersonSocialProfile, createWorkflowCard, createWorkflowCardNote, deleteFieldDefinition, deletePerson, deletePersonFieldData, deleteSocialProfile, getFieldDefinitions, getFieldOptions, getHousehold, getHouseholds, getTabs, getListById, getListCategories, getLists, getNote, getNoteCategories, getNotes, getOrganization, getPeople, getPerson, getPersonAddresses, getPersonEmails, getPersonFieldData, getPersonPhoneNumbers, getPersonSocialProfiles, getWorkflow, getWorkflowCardNotes, getWorkflowCards, getWorkflows, updatePerson, updatePersonAddress, } from './people';
22
22
  export { attemptRecovery, CircuitBreaker, classifyError, createErrorReport, DEFAULT_RETRY_CONFIG, executeBulkOperation, retryWithExponentialBackoff, TIMEOUT_CONFIG, withTimeout, } from './error-scenarios';
23
23
  export { buildQueryParams, calculateAge, createPersonWithContact, createWorkflowCardWithNote, exportAllPeopleData, extractFileUrl, formatDate, formatPersonName, getCompletePersonProfile, getFileExtension, getFilename, getListsWithCategories, getOrganizationInfo, getPeopleByHousehold, getPersonWorkflowCardsWithNotes, getPrimaryContact, isFileUpload, isFileUrl, isValidEmail, isValidPhone, processFileValue, searchPeople, validatePersonData, } from './helpers';
package/dist/index.js CHANGED
@@ -41,21 +41,21 @@ Object.defineProperty(exports, "attemptTokenRefresh", { enumerable: true, get: f
41
41
  Object.defineProperty(exports, "hasRefreshTokenCapability", { enumerable: true, get: function () { return auth_1.hasRefreshTokenCapability; } });
42
42
  Object.defineProperty(exports, "refreshAccessToken", { enumerable: true, get: function () { return auth_1.refreshAccessToken; } });
43
43
  Object.defineProperty(exports, "updateClientTokens", { enumerable: true, get: function () { return auth_1.updateClientTokens; } });
44
- // Export API error
45
- var api_error_1 = require("./api-error");
46
- Object.defineProperty(exports, "PcoApiError", { enumerable: true, get: function () { return api_error_1.PcoApiError; } });
47
- var rate_limiter_1 = require("./rate-limiter");
48
- Object.defineProperty(exports, "PcoRateLimiter", { enumerable: true, get: function () { return rate_limiter_1.PcoRateLimiter; } });
49
- var error_handling_1 = require("./error-handling");
50
- Object.defineProperty(exports, "ErrorCategory", { enumerable: true, get: function () { return error_handling_1.ErrorCategory; } });
51
- Object.defineProperty(exports, "ErrorSeverity", { enumerable: true, get: function () { return error_handling_1.ErrorSeverity; } });
52
- Object.defineProperty(exports, "handleNetworkError", { enumerable: true, get: function () { return error_handling_1.handleNetworkError; } });
53
- Object.defineProperty(exports, "handleTimeoutError", { enumerable: true, get: function () { return error_handling_1.handleTimeoutError; } });
54
- Object.defineProperty(exports, "handleValidationError", { enumerable: true, get: function () { return error_handling_1.handleValidationError; } });
55
- Object.defineProperty(exports, "PcoError", { enumerable: true, get: function () { return error_handling_1.PcoError; } });
56
- Object.defineProperty(exports, "retryWithBackoff", { enumerable: true, get: function () { return error_handling_1.retryWithBackoff; } });
57
- Object.defineProperty(exports, "shouldNotRetry", { enumerable: true, get: function () { return error_handling_1.shouldNotRetry; } });
58
- Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return error_handling_1.withErrorBoundary; } });
44
+ // Export API error (re-exported from base)
45
+ var planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
46
+ Object.defineProperty(exports, "PcoApiError", { enumerable: true, get: function () { return planning_center_base_ts_1.PcoApiError; } });
47
+ var planning_center_base_ts_2 = require("@rachelallyson/planning-center-base-ts");
48
+ Object.defineProperty(exports, "PcoRateLimiter", { enumerable: true, get: function () { return planning_center_base_ts_2.PcoRateLimiter; } });
49
+ var planning_center_base_ts_3 = require("@rachelallyson/planning-center-base-ts");
50
+ Object.defineProperty(exports, "ErrorCategory", { enumerable: true, get: function () { return planning_center_base_ts_3.ErrorCategory; } });
51
+ Object.defineProperty(exports, "ErrorSeverity", { enumerable: true, get: function () { return planning_center_base_ts_3.ErrorSeverity; } });
52
+ Object.defineProperty(exports, "handleNetworkError", { enumerable: true, get: function () { return planning_center_base_ts_3.handleNetworkError; } });
53
+ Object.defineProperty(exports, "handleTimeoutError", { enumerable: true, get: function () { return planning_center_base_ts_3.handleTimeoutError; } });
54
+ Object.defineProperty(exports, "handleValidationError", { enumerable: true, get: function () { return planning_center_base_ts_3.handleValidationError; } });
55
+ Object.defineProperty(exports, "PcoError", { enumerable: true, get: function () { return planning_center_base_ts_3.PcoError; } });
56
+ Object.defineProperty(exports, "retryWithBackoff", { enumerable: true, get: function () { return planning_center_base_ts_3.retryWithBackoff; } });
57
+ Object.defineProperty(exports, "shouldNotRetry", { enumerable: true, get: function () { return planning_center_base_ts_3.shouldNotRetry; } });
58
+ Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return planning_center_base_ts_3.withErrorBoundary; } });
59
59
  // Export People-specific functions (deprecated)
60
60
  var people_1 = require("./people");
61
61
  Object.defineProperty(exports, "createFieldDefinition", { enumerable: true, get: function () { return people_1.createFieldDefinition; } });
@@ -8,6 +8,7 @@ export interface MatchResult {
8
8
  person: PersonResource;
9
9
  score: number;
10
10
  reason: string;
11
+ isVerifiedContactMatch?: boolean;
11
12
  }
12
13
  export declare class PersonMatcher {
13
14
  private peopleModule;
@@ -16,6 +17,14 @@ export declare class PersonMatcher {
16
17
  constructor(peopleModule: PeopleModule);
17
18
  /**
18
19
  * Find or create a person with smart matching
20
+ *
21
+ * Uses intelligent matching logic that:
22
+ * - Verifies email/phone matches by checking actual contact information
23
+ * - Only uses name matching when appropriate (multiple people share contact info, or no contact info provided)
24
+ * - Can automatically add missing contact information when a match is found (if addMissingContactInfo is true)
25
+ *
26
+ * @param options - Matching options
27
+ * @param options.addMissingContactInfo - If true, automatically adds missing email/phone to matched person's profile
19
28
  */
20
29
  findOrCreate(options: PersonMatchOptions): Promise<PersonResource>;
21
30
  /**
@@ -24,8 +33,21 @@ export declare class PersonMatcher {
24
33
  findMatch(options: PersonMatchOptions): Promise<MatchResult | null>;
25
34
  /**
26
35
  * Get potential matching candidates
36
+ * @deprecated Use findMatch which has improved logic for separating verified matches from name-only matches
27
37
  */
28
38
  private getCandidates;
39
+ /**
40
+ * Verify if a person's email actually matches the search email
41
+ */
42
+ private verifyEmailMatch;
43
+ /**
44
+ * Verify if a person's phone actually matches the search phone
45
+ */
46
+ private verifyPhoneMatch;
47
+ /**
48
+ * Add missing contact information to a person's profile
49
+ */
50
+ private addMissingContactInfo;
29
51
  /**
30
52
  * Filter candidates by age preferences
31
53
  */