@rachelallyson/planning-center-people-ts 1.1.0 → 2.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 (56) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/README.md +16 -0
  3. package/dist/batch.d.ts +47 -0
  4. package/dist/batch.js +376 -0
  5. package/dist/client-manager.d.ts +66 -0
  6. package/dist/client-manager.js +156 -0
  7. package/dist/client.d.ts +71 -0
  8. package/dist/client.js +123 -0
  9. package/dist/core/http.d.ts +48 -0
  10. package/dist/core/http.js +265 -0
  11. package/dist/core/pagination.d.ts +34 -0
  12. package/dist/core/pagination.js +164 -0
  13. package/dist/index.d.ts +13 -3
  14. package/dist/index.js +23 -5
  15. package/dist/matching/matcher.d.ts +41 -0
  16. package/dist/matching/matcher.js +161 -0
  17. package/dist/matching/scoring.d.ts +35 -0
  18. package/dist/matching/scoring.js +141 -0
  19. package/dist/matching/strategies.d.ts +35 -0
  20. package/dist/matching/strategies.js +79 -0
  21. package/dist/modules/base.d.ts +46 -0
  22. package/dist/modules/base.js +82 -0
  23. package/dist/modules/contacts.d.ts +103 -0
  24. package/dist/modules/contacts.js +130 -0
  25. package/dist/modules/fields.d.ts +157 -0
  26. package/dist/modules/fields.js +294 -0
  27. package/dist/modules/households.d.ts +42 -0
  28. package/dist/modules/households.js +74 -0
  29. package/dist/modules/lists.d.ts +62 -0
  30. package/dist/modules/lists.js +92 -0
  31. package/dist/modules/notes.d.ts +74 -0
  32. package/dist/modules/notes.js +125 -0
  33. package/dist/modules/people.d.ts +196 -0
  34. package/dist/modules/people.js +221 -0
  35. package/dist/modules/workflows.d.ts +131 -0
  36. package/dist/modules/workflows.js +221 -0
  37. package/dist/monitoring.d.ts +53 -0
  38. package/dist/monitoring.js +142 -0
  39. package/dist/testing/index.d.ts +9 -0
  40. package/dist/testing/index.js +24 -0
  41. package/dist/testing/recorder.d.ts +58 -0
  42. package/dist/testing/recorder.js +195 -0
  43. package/dist/testing/simple-builders.d.ts +33 -0
  44. package/dist/testing/simple-builders.js +124 -0
  45. package/dist/testing/simple-factories.d.ts +91 -0
  46. package/dist/testing/simple-factories.js +288 -0
  47. package/dist/testing/types.d.ts +160 -0
  48. package/dist/testing/types.js +5 -0
  49. package/dist/types/batch.d.ts +50 -0
  50. package/dist/types/batch.js +5 -0
  51. package/dist/types/client.d.ts +89 -0
  52. package/dist/types/client.js +5 -0
  53. package/dist/types/events.d.ts +85 -0
  54. package/dist/types/events.js +5 -0
  55. package/dist/types/people.d.ts +20 -1
  56. package/package.json +9 -3
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ /**
3
+ * v2.0.0 Event System and Monitoring
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RateLimitTracker = exports.PerformanceMetrics = exports.RequestIdGenerator = exports.PcoEventEmitter = void 0;
7
+ class PcoEventEmitter {
8
+ constructor() {
9
+ this.handlers = new Map();
10
+ }
11
+ on(eventType, handler) {
12
+ if (!this.handlers.has(eventType)) {
13
+ this.handlers.set(eventType, new Set());
14
+ }
15
+ this.handlers.get(eventType).add(handler);
16
+ }
17
+ off(eventType, handler) {
18
+ const eventHandlers = this.handlers.get(eventType);
19
+ if (eventHandlers) {
20
+ eventHandlers.delete(handler);
21
+ if (eventHandlers.size === 0) {
22
+ this.handlers.delete(eventType);
23
+ }
24
+ }
25
+ }
26
+ emit(event) {
27
+ const eventHandlers = this.handlers.get(event.type);
28
+ if (eventHandlers) {
29
+ for (const handler of eventHandlers) {
30
+ try {
31
+ handler(event);
32
+ }
33
+ catch (error) {
34
+ console.error(`Error in event handler for ${event.type}:`, error);
35
+ }
36
+ }
37
+ }
38
+ }
39
+ /** Remove all event handlers */
40
+ removeAllListeners(eventType) {
41
+ if (eventType) {
42
+ this.handlers.delete(eventType);
43
+ }
44
+ else {
45
+ this.handlers.clear();
46
+ }
47
+ }
48
+ /** Get the number of listeners for an event type */
49
+ listenerCount(eventType) {
50
+ return this.handlers.get(eventType)?.size || 0;
51
+ }
52
+ /** Get all registered event types */
53
+ eventTypes() {
54
+ return Array.from(this.handlers.keys());
55
+ }
56
+ }
57
+ exports.PcoEventEmitter = PcoEventEmitter;
58
+ /**
59
+ * Request ID generator for tracking requests
60
+ */
61
+ class RequestIdGenerator {
62
+ constructor() {
63
+ this.counter = 0;
64
+ }
65
+ generate() {
66
+ return `req_${Date.now()}_${++this.counter}`;
67
+ }
68
+ }
69
+ exports.RequestIdGenerator = RequestIdGenerator;
70
+ /**
71
+ * Performance metrics collector
72
+ */
73
+ class PerformanceMetrics {
74
+ constructor() {
75
+ this.metrics = new Map();
76
+ }
77
+ record(operation, duration, success = true) {
78
+ const existing = this.metrics.get(operation) || {
79
+ count: 0,
80
+ totalTime: 0,
81
+ minTime: Infinity,
82
+ maxTime: 0,
83
+ errors: 0,
84
+ };
85
+ existing.count++;
86
+ existing.totalTime += duration;
87
+ existing.minTime = Math.min(existing.minTime, duration);
88
+ existing.maxTime = Math.max(existing.maxTime, duration);
89
+ if (!success) {
90
+ existing.errors++;
91
+ }
92
+ this.metrics.set(operation, existing);
93
+ }
94
+ getMetrics() {
95
+ const result = {};
96
+ for (const [operation, metrics] of this.metrics) {
97
+ result[operation] = {
98
+ count: metrics.count,
99
+ averageTime: metrics.totalTime / metrics.count,
100
+ minTime: metrics.minTime === Infinity ? 0 : metrics.minTime,
101
+ maxTime: metrics.maxTime,
102
+ errorRate: metrics.errors / metrics.count,
103
+ };
104
+ }
105
+ return result;
106
+ }
107
+ reset() {
108
+ this.metrics.clear();
109
+ }
110
+ }
111
+ exports.PerformanceMetrics = PerformanceMetrics;
112
+ /**
113
+ * Rate limit tracker
114
+ */
115
+ class RateLimitTracker {
116
+ constructor() {
117
+ this.limits = new Map();
118
+ }
119
+ update(endpoint, limit, remaining, resetTime) {
120
+ this.limits.set(endpoint, { limit, remaining, resetTime });
121
+ }
122
+ getRemaining(endpoint) {
123
+ const limit = this.limits.get(endpoint);
124
+ return limit?.remaining || 0;
125
+ }
126
+ getResetTime(endpoint) {
127
+ const limit = this.limits.get(endpoint);
128
+ return limit?.resetTime || 0;
129
+ }
130
+ isRateLimited(endpoint) {
131
+ const limit = this.limits.get(endpoint);
132
+ return limit ? limit.remaining <= 0 : false;
133
+ }
134
+ getAllLimits() {
135
+ const result = {};
136
+ for (const [endpoint, limit] of this.limits) {
137
+ result[endpoint] = limit;
138
+ }
139
+ return result;
140
+ }
141
+ }
142
+ exports.RateLimitTracker = RateLimitTracker;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * v2.0.0 Testing Utilities
3
+ */
4
+ export { SimpleMockResponseBuilder as MockResponseBuilder } from './simple-builders';
5
+ export { SimpleMockPcoClient as MockPcoClient, createSimpleMockClient as createMockClient, createTestClient, createErrorMockClient, createSlowMockClient } from './simple-factories';
6
+ export type { SimpleMockClientConfig as MockClientConfig } from './simple-factories';
7
+ export { RequestRecorder } from './recorder';
8
+ export type { RecordingConfig } from './types';
9
+ export declare function createRecordingClient(config: any, recordingConfig: any): any;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * v2.0.0 Testing Utilities
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RequestRecorder = exports.createSlowMockClient = exports.createErrorMockClient = exports.createTestClient = exports.createMockClient = exports.MockPcoClient = exports.MockResponseBuilder = void 0;
7
+ exports.createRecordingClient = createRecordingClient;
8
+ // Export simplified versions that work without complex type issues
9
+ var simple_builders_1 = require("./simple-builders");
10
+ Object.defineProperty(exports, "MockResponseBuilder", { enumerable: true, get: function () { return simple_builders_1.SimpleMockResponseBuilder; } });
11
+ var simple_factories_1 = require("./simple-factories");
12
+ Object.defineProperty(exports, "MockPcoClient", { enumerable: true, get: function () { return simple_factories_1.SimpleMockPcoClient; } });
13
+ Object.defineProperty(exports, "createMockClient", { enumerable: true, get: function () { return simple_factories_1.createSimpleMockClient; } });
14
+ Object.defineProperty(exports, "createTestClient", { enumerable: true, get: function () { return simple_factories_1.createTestClient; } });
15
+ Object.defineProperty(exports, "createErrorMockClient", { enumerable: true, get: function () { return simple_factories_1.createErrorMockClient; } });
16
+ Object.defineProperty(exports, "createSlowMockClient", { enumerable: true, get: function () { return simple_factories_1.createSlowMockClient; } });
17
+ // Export recorder (simplified)
18
+ var recorder_1 = require("./recorder");
19
+ Object.defineProperty(exports, "RequestRecorder", { enumerable: true, get: function () { return recorder_1.RequestRecorder; } });
20
+ // Export createRecordingClient (simplified)
21
+ function createRecordingClient(config, recordingConfig) {
22
+ // Simplified implementation
23
+ return new (require('./simple-factories').SimpleMockPcoClient)(config);
24
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * v2.0.0 Request/Response Recorder
3
+ */
4
+ import type { RecordingConfig, RecordedRequest } from './types';
5
+ export declare class RequestRecorder {
6
+ private config;
7
+ private requests;
8
+ private isRecording;
9
+ constructor(config: RecordingConfig);
10
+ /**
11
+ * Start recording requests
12
+ */
13
+ startRecording(): void;
14
+ /**
15
+ * Stop recording and save to file
16
+ */
17
+ stopRecording(): void;
18
+ /**
19
+ * Record a request/response pair
20
+ */
21
+ recordRequest(endpoint: string, method: string, params: Record<string, any> | undefined, data: any, response: any): void;
22
+ /**
23
+ * Replay a recorded request
24
+ */
25
+ replayRequest(endpoint: string, method: string, params: Record<string, any> | undefined, data: any): any | null;
26
+ /**
27
+ * Check if we should record or replay
28
+ */
29
+ shouldRecord(endpoint: string, method: string): boolean;
30
+ /**
31
+ * Get all recorded requests
32
+ */
33
+ getRequests(): RecordedRequest[];
34
+ /**
35
+ * Clear recorded requests
36
+ */
37
+ clearRequests(): void;
38
+ /**
39
+ * Save the current session to file
40
+ */
41
+ private saveSession;
42
+ /**
43
+ * Load a session from file
44
+ */
45
+ private loadSession;
46
+ /**
47
+ * Ensure the record directory exists
48
+ */
49
+ private ensureRecordDirectory;
50
+ /**
51
+ * Compare two parameter objects
52
+ */
53
+ private compareParams;
54
+ /**
55
+ * Compare two data objects
56
+ */
57
+ private compareData;
58
+ }
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ /**
3
+ * v2.0.0 Request/Response Recorder
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.RequestRecorder = void 0;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ class RequestRecorder {
43
+ constructor(config) {
44
+ this.requests = [];
45
+ this.isRecording = false;
46
+ this.config = config;
47
+ this.ensureRecordDirectory();
48
+ }
49
+ /**
50
+ * Start recording requests
51
+ */
52
+ startRecording() {
53
+ this.isRecording = true;
54
+ this.requests = [];
55
+ }
56
+ /**
57
+ * Stop recording and save to file
58
+ */
59
+ stopRecording() {
60
+ this.isRecording = false;
61
+ this.saveSession();
62
+ }
63
+ /**
64
+ * Record a request/response pair
65
+ */
66
+ recordRequest(endpoint, method, params, data, response) {
67
+ if (!this.isRecording)
68
+ return;
69
+ // Apply filter if provided
70
+ if (this.config.filter && !this.config.filter(endpoint, method)) {
71
+ return;
72
+ }
73
+ const request = {
74
+ endpoint,
75
+ method,
76
+ params,
77
+ data,
78
+ response: this.config.transform ? this.config.transform(response) : response,
79
+ timestamp: new Date().toISOString(),
80
+ };
81
+ this.requests.push(request);
82
+ }
83
+ /**
84
+ * Replay a recorded request
85
+ */
86
+ replayRequest(endpoint, method, params, data) {
87
+ const session = this.loadSession();
88
+ if (!session)
89
+ return null;
90
+ const request = session.requests.find(req => req.endpoint === endpoint &&
91
+ req.method === method &&
92
+ this.compareParams(req.params, params) &&
93
+ this.compareData(req.data, data));
94
+ return request ? request.response : null;
95
+ }
96
+ /**
97
+ * Check if we should record or replay
98
+ */
99
+ shouldRecord(endpoint, method) {
100
+ if (this.config.mode === 'record')
101
+ return true;
102
+ if (this.config.mode === 'replay')
103
+ return false;
104
+ // Auto mode: record if no existing session, otherwise replay
105
+ const session = this.loadSession();
106
+ return !session;
107
+ }
108
+ /**
109
+ * Get all recorded requests
110
+ */
111
+ getRequests() {
112
+ return [...this.requests];
113
+ }
114
+ /**
115
+ * Clear recorded requests
116
+ */
117
+ clearRequests() {
118
+ this.requests = [];
119
+ }
120
+ /**
121
+ * Save the current session to file
122
+ */
123
+ saveSession() {
124
+ const session = {
125
+ requests: this.requests,
126
+ metadata: {
127
+ recordedAt: new Date().toISOString(),
128
+ version: '2.0.0',
129
+ config: {}, // Would be filled with actual config
130
+ },
131
+ };
132
+ try {
133
+ fs.writeFileSync(this.config.recordPath, JSON.stringify(session, null, 2));
134
+ }
135
+ catch (error) {
136
+ console.error('Failed to save recording session:', error);
137
+ }
138
+ }
139
+ /**
140
+ * Load a session from file
141
+ */
142
+ loadSession() {
143
+ try {
144
+ if (!fs.existsSync(this.config.recordPath)) {
145
+ return null;
146
+ }
147
+ const content = fs.readFileSync(this.config.recordPath, 'utf-8');
148
+ return JSON.parse(content);
149
+ }
150
+ catch (error) {
151
+ console.error('Failed to load recording session:', error);
152
+ return null;
153
+ }
154
+ }
155
+ /**
156
+ * Ensure the record directory exists
157
+ */
158
+ ensureRecordDirectory() {
159
+ const dir = path.dirname(this.config.recordPath);
160
+ if (!fs.existsSync(dir)) {
161
+ fs.mkdirSync(dir, { recursive: true });
162
+ }
163
+ }
164
+ /**
165
+ * Compare two parameter objects
166
+ */
167
+ compareParams(params1, params2) {
168
+ if (!params1 && !params2)
169
+ return true;
170
+ if (!params1 || !params2)
171
+ return false;
172
+ const keys1 = Object.keys(params1).sort();
173
+ const keys2 = Object.keys(params2).sort();
174
+ if (keys1.length !== keys2.length)
175
+ return false;
176
+ for (let i = 0; i < keys1.length; i++) {
177
+ if (keys1[i] !== keys2[i])
178
+ return false;
179
+ if (params1[keys1[i]] !== params2[keys2[i]])
180
+ return false;
181
+ }
182
+ return true;
183
+ }
184
+ /**
185
+ * Compare two data objects
186
+ */
187
+ compareData(data1, data2) {
188
+ if (!data1 && !data2)
189
+ return true;
190
+ if (!data1 || !data2)
191
+ return false;
192
+ return JSON.stringify(data1) === JSON.stringify(data2);
193
+ }
194
+ }
195
+ exports.RequestRecorder = RequestRecorder;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Simplified Mock Response Builders for Testing
3
+ */
4
+ export declare class SimpleMockResponseBuilder {
5
+ /**
6
+ * Build a simple mock person resource
7
+ */
8
+ static person(overrides?: any): any;
9
+ /**
10
+ * Build a simple mock email resource
11
+ */
12
+ static email(overrides?: any): any;
13
+ /**
14
+ * Build a simple mock phone number resource
15
+ */
16
+ static phoneNumber(overrides?: any): any;
17
+ /**
18
+ * Build a simple mock workflow resource
19
+ */
20
+ static workflow(overrides?: any): any;
21
+ /**
22
+ * Build a simple paginated response
23
+ */
24
+ static paginated(data: any[], meta?: any): any;
25
+ /**
26
+ * Build a simple single resource response
27
+ */
28
+ static single(data: any): any;
29
+ /**
30
+ * Build a simple error response
31
+ */
32
+ static error(status: number, message: string, details?: any): any;
33
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * Simplified Mock Response Builders for Testing
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SimpleMockResponseBuilder = void 0;
7
+ class SimpleMockResponseBuilder {
8
+ /**
9
+ * Build a simple mock person resource
10
+ */
11
+ static person(overrides = {}) {
12
+ return {
13
+ type: 'Person',
14
+ id: overrides.id || `person_${Date.now()}`,
15
+ attributes: {
16
+ id: overrides.id || `person_${Date.now()}`,
17
+ first_name: overrides.first_name || 'John',
18
+ last_name: overrides.last_name || 'Doe',
19
+ status: 'active',
20
+ ...overrides,
21
+ },
22
+ relationships: {
23
+ emails: { data: [] },
24
+ phone_numbers: { data: [] },
25
+ field_data: { data: [] },
26
+ workflow_cards: { data: [] },
27
+ household: { data: null },
28
+ },
29
+ };
30
+ }
31
+ /**
32
+ * Build a simple mock email resource
33
+ */
34
+ static email(overrides = {}) {
35
+ return {
36
+ type: 'Email',
37
+ id: overrides.id || `email_${Date.now()}`,
38
+ attributes: {
39
+ id: overrides.id || `email_${Date.now()}`,
40
+ address: overrides.address || 'john@example.com',
41
+ location: 'Home',
42
+ primary: true,
43
+ ...overrides,
44
+ },
45
+ relationships: {
46
+ person: { data: { type: 'Person', id: 'person_123' } },
47
+ },
48
+ };
49
+ }
50
+ /**
51
+ * Build a simple mock phone number resource
52
+ */
53
+ static phoneNumber(overrides = {}) {
54
+ return {
55
+ type: 'PhoneNumber',
56
+ id: overrides.id || `phone_${Date.now()}`,
57
+ attributes: {
58
+ id: overrides.id || `phone_${Date.now()}`,
59
+ number: overrides.number || '555-1234',
60
+ location: 'Mobile',
61
+ primary: true,
62
+ ...overrides,
63
+ },
64
+ relationships: {
65
+ person: { data: { type: 'Person', id: 'person_123' } },
66
+ },
67
+ };
68
+ }
69
+ /**
70
+ * Build a simple mock workflow resource
71
+ */
72
+ static workflow(overrides = {}) {
73
+ return {
74
+ type: 'Workflow',
75
+ id: overrides.id || `workflow_${Date.now()}`,
76
+ attributes: {
77
+ id: overrides.id || `workflow_${Date.now()}`,
78
+ name: overrides.name || 'New Member Workflow',
79
+ description: overrides.description || 'Workflow for new members',
80
+ ...overrides,
81
+ },
82
+ relationships: {},
83
+ };
84
+ }
85
+ /**
86
+ * Build a simple paginated response
87
+ */
88
+ static paginated(data, meta = {}) {
89
+ return {
90
+ data,
91
+ meta: {
92
+ total_count: data.length,
93
+ count: data.length,
94
+ ...meta,
95
+ },
96
+ links: {
97
+ self: '/api/v2/people?page=1',
98
+ next: null,
99
+ prev: null,
100
+ },
101
+ };
102
+ }
103
+ /**
104
+ * Build a simple single resource response
105
+ */
106
+ static single(data) {
107
+ return { data };
108
+ }
109
+ /**
110
+ * Build a simple error response
111
+ */
112
+ static error(status, message, details = {}) {
113
+ return {
114
+ errors: [
115
+ {
116
+ status: status.toString(),
117
+ title: message,
118
+ detail: details,
119
+ },
120
+ ],
121
+ };
122
+ }
123
+ }
124
+ exports.SimpleMockResponseBuilder = SimpleMockResponseBuilder;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Simplified Testing Factory Functions
3
+ */
4
+ import type { PcoClientConfig } from '../types/client';
5
+ export interface SimpleMockClientConfig {
6
+ people?: {
7
+ getAll?: () => Promise<any>;
8
+ getById?: (id: string) => Promise<any>;
9
+ create?: (data: any) => Promise<any>;
10
+ update?: (id: string, data: any) => Promise<any>;
11
+ delete?: (id: string) => Promise<void>;
12
+ findOrCreate?: (options: any) => Promise<any>;
13
+ createWithContacts?: (personData: any, contacts: any) => Promise<any>;
14
+ search?: (criteria: any) => Promise<any>;
15
+ getAllPages?: (options?: any) => Promise<any>;
16
+ addEmail?: (personId: string, data: any) => Promise<any>;
17
+ addPhoneNumber?: (personId: string, data: any) => Promise<any>;
18
+ addAddress?: (personId: string, data: any) => Promise<any>;
19
+ addSocialProfile?: (personId: string, data: any) => Promise<any>;
20
+ };
21
+ fields?: {
22
+ getAllFieldDefinitions?: () => Promise<any[]>;
23
+ getFieldDefinition?: (id: string) => Promise<any>;
24
+ getFieldDefinitionBySlug?: (slug: string) => Promise<any>;
25
+ getFieldDefinitionByName?: (name: string) => Promise<any>;
26
+ setPersonField?: (personId: string, options: any) => Promise<any>;
27
+ setPersonFieldById?: (personId: string, fieldId: string, value: string) => Promise<any>;
28
+ setPersonFieldBySlug?: (personId: string, slug: string, value: string) => Promise<any>;
29
+ setPersonFieldByName?: (personId: string, name: string, value: string) => Promise<any>;
30
+ };
31
+ workflows?: {
32
+ getAll?: (options?: any) => Promise<any>;
33
+ getById?: (id: string) => Promise<any>;
34
+ create?: (data: any) => Promise<any>;
35
+ update?: (id: string, data: any) => Promise<any>;
36
+ delete?: (id: string) => Promise<void>;
37
+ getAllPages?: (options?: any) => Promise<any>;
38
+ addPersonToWorkflow?: (personId: string, workflowId: string, options?: any) => Promise<any>;
39
+ createWorkflowCard?: (workflowId: string, personId: string) => Promise<any>;
40
+ createWorkflowCardNote?: (personId: string, workflowCardId: string, data: any) => Promise<any>;
41
+ };
42
+ batch?: {
43
+ execute?: (operations: any[]) => Promise<any>;
44
+ };
45
+ }
46
+ export declare class SimpleMockPcoClient {
47
+ people: any;
48
+ fields: any;
49
+ workflows: any;
50
+ contacts: any;
51
+ households: any;
52
+ notes: any;
53
+ lists: any;
54
+ batch: any;
55
+ private config;
56
+ private mockConfig;
57
+ constructor(config: PcoClientConfig, mockConfig?: SimpleMockClientConfig);
58
+ private createPeopleModule;
59
+ private createFieldsModule;
60
+ private createWorkflowsModule;
61
+ private createContactsModule;
62
+ private createHouseholdsModule;
63
+ private createNotesModule;
64
+ private createListsModule;
65
+ private createBatchModule;
66
+ on(eventType: string, handler: Function): void;
67
+ off(eventType: string, handler: Function): void;
68
+ emit(event: any): void;
69
+ getConfig(): PcoClientConfig;
70
+ getPerformanceMetrics(): any;
71
+ getRateLimitInfo(): any;
72
+ removeAllListeners(eventType?: string): void;
73
+ listenerCount(eventType: string): number;
74
+ eventTypes(): string[];
75
+ }
76
+ /**
77
+ * Create a simple mock client for testing
78
+ */
79
+ export declare function createSimpleMockClient(config: PcoClientConfig, mockConfig?: SimpleMockClientConfig): SimpleMockPcoClient;
80
+ /**
81
+ * Create a test client with common mock responses
82
+ */
83
+ export declare function createTestClient(overrides?: SimpleMockClientConfig): SimpleMockPcoClient;
84
+ /**
85
+ * Create a mock client that simulates errors
86
+ */
87
+ export declare function createErrorMockClient(errorType?: 'network' | 'auth' | 'validation' | 'rate_limit'): SimpleMockPcoClient;
88
+ /**
89
+ * Create a mock client with specific response delays
90
+ */
91
+ export declare function createSlowMockClient(delayMs?: number): SimpleMockPcoClient;