@rachelallyson/planning-center-people-ts 1.0.0 → 1.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.
- package/CHANGELOG.md +132 -1
- package/README.md +12 -0
- package/dist/auth.d.ts +64 -0
- package/dist/auth.js +98 -0
- package/dist/core.d.ts +5 -0
- package/dist/core.js +12 -0
- package/dist/helpers.d.ts +125 -100
- package/dist/helpers.js +315 -275
- package/dist/index.d.ts +5 -3
- package/dist/index.js +19 -3
- package/dist/people/contacts.d.ts +43 -0
- package/dist/people/contacts.js +122 -0
- package/dist/people/core.d.ts +28 -0
- package/dist/people/core.js +69 -0
- package/dist/people/fields.d.ts +62 -0
- package/dist/people/fields.js +293 -0
- package/dist/people/households.d.ts +15 -0
- package/dist/people/households.js +31 -0
- package/dist/people/index.d.ts +8 -0
- package/dist/people/index.js +25 -0
- package/dist/people/lists.d.ts +30 -0
- package/dist/people/lists.js +37 -0
- package/dist/people/notes.d.ts +30 -0
- package/dist/people/notes.js +37 -0
- package/dist/people/organization.d.ts +12 -0
- package/dist/people/organization.js +15 -0
- package/dist/people/workflows.d.ts +37 -0
- package/dist/people/workflows.js +75 -0
- package/dist/types/people.d.ts +53 -78
- package/package.json +6 -1
- package/dist/people.d.ts +0 -205
- package/dist/people.js +0 -598
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export type { PcoClientConfig, PcoClientState } from './core';
|
|
3
3
|
export { createPcoClient, del, getAllPages, getList, getRateLimitInfo, getSingle, patch, post, } from './core';
|
|
4
|
+
export type { TokenResponse, TokenRefreshCallback, TokenRefreshFailureCallback } from './auth';
|
|
5
|
+
export { attemptTokenRefresh, hasRefreshTokenCapability, refreshAccessToken, updateClientTokens, } from './auth';
|
|
4
6
|
export { PcoApiError } from './api-error';
|
|
5
7
|
export type { RateLimitHeaders, RateLimitInfo } from './rate-limiter';
|
|
6
8
|
export { PcoRateLimiter } from './rate-limiter';
|
|
7
9
|
export type { ErrorContext } from './error-handling';
|
|
8
10
|
export { ErrorCategory, ErrorSeverity, handleNetworkError, handleTimeoutError, handleValidationError, PcoError, retryWithBackoff, shouldNotRetry, withErrorBoundary, } from './error-handling';
|
|
9
|
-
export { createFieldOption, createPerson, createPersonAddress, createPersonEmail, createPersonFieldData,
|
|
11
|
+
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';
|
|
10
12
|
export type { Paginated, Relationship, ResourceIdentifier, ResourceObject, } from './types';
|
|
11
|
-
export type { AddressAttributes, AddressesList, AddressResource, AddressSingle, EmailAttributes, EmailResource, EmailSingle, EmailsList, FieldDataList, FieldDataSingle, FieldDatumAttributes, FieldDatumRelationships, FieldDatumResource, FieldDefinitionAttributes, FieldDefinitionResource, FieldDefinitionSingle, FieldDefinitionsList, FieldOptionAttributes, FieldOptionResource, FieldOptionSingle, FieldOptionsList, HouseholdAttributes, HouseholdResource, HouseholdSingle, HouseholdsList, ListAttributes, ListCategoriesList, ListCategoryAttributes, ListCategoryResource, ListCategorySingle, ListResource, ListSingle, ListsList, NoteAttributes, NoteCategoriesList, NoteCategoryAttributes, NoteCategoryResource, NoteCategorySingle, NoteResource, NoteSingle, NotesList, OrganizationAttributes, OrganizationResource, OrganizationSingle, PeopleList, PersonAttributes, PersonRelationships, PersonResource, PersonSingle, PhoneNumberAttributes, PhoneNumberResource, PhoneNumberSingle, PhoneNumbersList, SocialProfileAttributes, SocialProfileResource, SocialProfileSingle, SocialProfilesList, WorkflowAttributes, WorkflowCardAttributes, WorkflowCardNoteAttributes,
|
|
13
|
+
export type { AddressAttributes, AddressesList, AddressResource, AddressSingle, EmailAttributes, EmailResource, EmailSingle, EmailsList, FieldDataList, FieldDataSingle, FieldDatumAttributes, FieldDatumRelationships, FieldDatumResource, FieldDefinitionAttributes, FieldDefinitionResource, FieldDefinitionSingle, FieldDefinitionsList, FieldOptionAttributes, FieldOptionResource, FieldOptionSingle, FieldOptionsList, HouseholdAttributes, HouseholdResource, HouseholdSingle, HouseholdsList, ListAttributes, ListCategoriesList, ListCategoryAttributes, ListCategoryResource, ListCategorySingle, ListResource, ListSingle, ListsList, NoteAttributes, NoteCategoriesList, NoteCategoryAttributes, NoteCategoryResource, NoteCategorySingle, NoteResource, NoteSingle, NotesList, OrganizationAttributes, OrganizationResource, OrganizationSingle, PeopleList, PersonAttributes, PersonRelationships, PersonResource, PersonSingle, PhoneNumberAttributes, PhoneNumberResource, PhoneNumberSingle, PhoneNumbersList, SocialProfileAttributes, SocialProfileResource, SocialProfileSingle, SocialProfilesList, WorkflowAttributes, WorkflowCardAttributes, WorkflowCardNoteAttributes, WorkflowCardNoteResource, WorkflowCardNoteSingle, WorkflowCardNotesList, WorkflowCardRelationships, WorkflowCardResource, WorkflowCardSingle, WorkflowCardsList, WorkflowResource, WorkflowSingle, WorkflowsList, } from './types';
|
|
12
14
|
export { attemptRecovery, CircuitBreaker, classifyError, createErrorReport, DEFAULT_RETRY_CONFIG, executeBulkOperation, retryWithExponentialBackoff, TIMEOUT_CONFIG, withTimeout, } from './error-scenarios';
|
|
13
|
-
export { calculateAge, createPersonWithContact, createWorkflowCardWithNote, exportAllPeopleData, formatDate, formatPersonName, getCompletePersonProfile, getListsWithCategories, getOrganizationInfo, getPeopleByHousehold, getPersonWorkflowCardsWithNotes, getPrimaryContact, isValidEmail, isValidPhone, searchPeople, validatePersonData, } from './helpers';
|
|
15
|
+
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';
|
|
14
16
|
export { AdaptiveRateLimiter, ApiCache, batchFetchPersonDetails, fetchAllPages, getCachedPeople, monitorPerformance, PerformanceMonitor, processInBatches, processLargeDataset, streamPeopleData, } from './performance';
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,9 @@ 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
|
-
exports.
|
|
18
|
-
exports.
|
|
17
|
+
exports.getPeople = exports.getOrganization = exports.getNotes = exports.getNoteCategories = exports.getNote = exports.getLists = exports.getListCategories = exports.getListById = exports.getTabs = exports.getHouseholds = exports.getHousehold = exports.getFieldOptions = exports.getFieldDefinitions = exports.deleteSocialProfile = exports.deletePersonFieldData = exports.deletePerson = exports.deleteFieldDefinition = exports.createWorkflowCardNote = exports.createWorkflowCard = exports.createPersonSocialProfile = exports.createPersonPhoneNumber = exports.createPersonFieldData = exports.createPersonEmail = exports.createPersonAddress = exports.createPerson = exports.createFieldOption = exports.createFieldDefinition = exports.withErrorBoundary = exports.shouldNotRetry = exports.retryWithBackoff = exports.PcoError = exports.handleValidationError = exports.handleTimeoutError = exports.handleNetworkError = exports.ErrorSeverity = exports.ErrorCategory = exports.PcoRateLimiter = exports.PcoApiError = exports.updateClientTokens = exports.refreshAccessToken = exports.hasRefreshTokenCapability = exports.attemptTokenRefresh = exports.post = exports.patch = exports.getSingle = exports.getRateLimitInfo = exports.getList = exports.getAllPages = exports.del = exports.createPcoClient = void 0;
|
|
18
|
+
exports.monitorPerformance = exports.getCachedPeople = exports.fetchAllPages = exports.batchFetchPersonDetails = exports.ApiCache = exports.AdaptiveRateLimiter = exports.validatePersonData = exports.searchPeople = exports.processFileValue = exports.isValidPhone = exports.isValidEmail = exports.isFileUrl = exports.isFileUpload = exports.getPrimaryContact = exports.getPersonWorkflowCardsWithNotes = exports.getPeopleByHousehold = exports.getOrganizationInfo = exports.getListsWithCategories = exports.getFilename = exports.getFileExtension = exports.getCompletePersonProfile = exports.formatPersonName = exports.formatDate = exports.extractFileUrl = exports.exportAllPeopleData = exports.createWorkflowCardWithNote = exports.createPersonWithContact = exports.calculateAge = exports.buildQueryParams = exports.withTimeout = exports.TIMEOUT_CONFIG = exports.retryWithExponentialBackoff = exports.executeBulkOperation = exports.DEFAULT_RETRY_CONFIG = exports.createErrorReport = exports.classifyError = exports.CircuitBreaker = exports.attemptRecovery = exports.updatePersonAddress = exports.updatePerson = exports.getWorkflows = exports.getWorkflowCards = exports.getWorkflowCardNotes = exports.getWorkflow = exports.getPersonSocialProfiles = exports.getPersonPhoneNumbers = exports.getPersonFieldData = exports.getPersonEmails = exports.getPersonAddresses = exports.getPerson = void 0;
|
|
19
|
+
exports.streamPeopleData = exports.processLargeDataset = exports.processInBatches = exports.PerformanceMonitor = void 0;
|
|
19
20
|
// Export all types
|
|
20
21
|
__exportStar(require("./types"), exports);
|
|
21
22
|
var core_1 = require("./core");
|
|
@@ -27,6 +28,11 @@ Object.defineProperty(exports, "getRateLimitInfo", { enumerable: true, get: func
|
|
|
27
28
|
Object.defineProperty(exports, "getSingle", { enumerable: true, get: function () { return core_1.getSingle; } });
|
|
28
29
|
Object.defineProperty(exports, "patch", { enumerable: true, get: function () { return core_1.patch; } });
|
|
29
30
|
Object.defineProperty(exports, "post", { enumerable: true, get: function () { return core_1.post; } });
|
|
31
|
+
var auth_1 = require("./auth");
|
|
32
|
+
Object.defineProperty(exports, "attemptTokenRefresh", { enumerable: true, get: function () { return auth_1.attemptTokenRefresh; } });
|
|
33
|
+
Object.defineProperty(exports, "hasRefreshTokenCapability", { enumerable: true, get: function () { return auth_1.hasRefreshTokenCapability; } });
|
|
34
|
+
Object.defineProperty(exports, "refreshAccessToken", { enumerable: true, get: function () { return auth_1.refreshAccessToken; } });
|
|
35
|
+
Object.defineProperty(exports, "updateClientTokens", { enumerable: true, get: function () { return auth_1.updateClientTokens; } });
|
|
30
36
|
// Export API error
|
|
31
37
|
var api_error_1 = require("./api-error");
|
|
32
38
|
Object.defineProperty(exports, "PcoApiError", { enumerable: true, get: function () { return api_error_1.PcoApiError; } });
|
|
@@ -44,22 +50,25 @@ Object.defineProperty(exports, "shouldNotRetry", { enumerable: true, get: functi
|
|
|
44
50
|
Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return error_handling_1.withErrorBoundary; } });
|
|
45
51
|
// Export People-specific functions
|
|
46
52
|
var people_1 = require("./people");
|
|
53
|
+
Object.defineProperty(exports, "createFieldDefinition", { enumerable: true, get: function () { return people_1.createFieldDefinition; } });
|
|
47
54
|
Object.defineProperty(exports, "createFieldOption", { enumerable: true, get: function () { return people_1.createFieldOption; } });
|
|
48
55
|
Object.defineProperty(exports, "createPerson", { enumerable: true, get: function () { return people_1.createPerson; } });
|
|
49
56
|
Object.defineProperty(exports, "createPersonAddress", { enumerable: true, get: function () { return people_1.createPersonAddress; } });
|
|
50
57
|
Object.defineProperty(exports, "createPersonEmail", { enumerable: true, get: function () { return people_1.createPersonEmail; } });
|
|
51
58
|
Object.defineProperty(exports, "createPersonFieldData", { enumerable: true, get: function () { return people_1.createPersonFieldData; } });
|
|
52
|
-
Object.defineProperty(exports, "createPersonFileFieldData", { enumerable: true, get: function () { return people_1.createPersonFileFieldData; } });
|
|
53
59
|
Object.defineProperty(exports, "createPersonPhoneNumber", { enumerable: true, get: function () { return people_1.createPersonPhoneNumber; } });
|
|
54
60
|
Object.defineProperty(exports, "createPersonSocialProfile", { enumerable: true, get: function () { return people_1.createPersonSocialProfile; } });
|
|
55
61
|
Object.defineProperty(exports, "createWorkflowCard", { enumerable: true, get: function () { return people_1.createWorkflowCard; } });
|
|
56
62
|
Object.defineProperty(exports, "createWorkflowCardNote", { enumerable: true, get: function () { return people_1.createWorkflowCardNote; } });
|
|
63
|
+
Object.defineProperty(exports, "deleteFieldDefinition", { enumerable: true, get: function () { return people_1.deleteFieldDefinition; } });
|
|
57
64
|
Object.defineProperty(exports, "deletePerson", { enumerable: true, get: function () { return people_1.deletePerson; } });
|
|
58
65
|
Object.defineProperty(exports, "deletePersonFieldData", { enumerable: true, get: function () { return people_1.deletePersonFieldData; } });
|
|
66
|
+
Object.defineProperty(exports, "deleteSocialProfile", { enumerable: true, get: function () { return people_1.deleteSocialProfile; } });
|
|
59
67
|
Object.defineProperty(exports, "getFieldDefinitions", { enumerable: true, get: function () { return people_1.getFieldDefinitions; } });
|
|
60
68
|
Object.defineProperty(exports, "getFieldOptions", { enumerable: true, get: function () { return people_1.getFieldOptions; } });
|
|
61
69
|
Object.defineProperty(exports, "getHousehold", { enumerable: true, get: function () { return people_1.getHousehold; } });
|
|
62
70
|
Object.defineProperty(exports, "getHouseholds", { enumerable: true, get: function () { return people_1.getHouseholds; } });
|
|
71
|
+
Object.defineProperty(exports, "getTabs", { enumerable: true, get: function () { return people_1.getTabs; } });
|
|
63
72
|
Object.defineProperty(exports, "getListById", { enumerable: true, get: function () { return people_1.getListById; } });
|
|
64
73
|
Object.defineProperty(exports, "getListCategories", { enumerable: true, get: function () { return people_1.getListCategories; } });
|
|
65
74
|
Object.defineProperty(exports, "getLists", { enumerable: true, get: function () { return people_1.getLists; } });
|
|
@@ -93,20 +102,27 @@ Object.defineProperty(exports, "TIMEOUT_CONFIG", { enumerable: true, get: functi
|
|
|
93
102
|
Object.defineProperty(exports, "withTimeout", { enumerable: true, get: function () { return error_scenarios_1.withTimeout; } });
|
|
94
103
|
// ===== Helper Functions =====
|
|
95
104
|
var helpers_1 = require("./helpers");
|
|
105
|
+
Object.defineProperty(exports, "buildQueryParams", { enumerable: true, get: function () { return helpers_1.buildQueryParams; } });
|
|
96
106
|
Object.defineProperty(exports, "calculateAge", { enumerable: true, get: function () { return helpers_1.calculateAge; } });
|
|
97
107
|
Object.defineProperty(exports, "createPersonWithContact", { enumerable: true, get: function () { return helpers_1.createPersonWithContact; } });
|
|
98
108
|
Object.defineProperty(exports, "createWorkflowCardWithNote", { enumerable: true, get: function () { return helpers_1.createWorkflowCardWithNote; } });
|
|
99
109
|
Object.defineProperty(exports, "exportAllPeopleData", { enumerable: true, get: function () { return helpers_1.exportAllPeopleData; } });
|
|
110
|
+
Object.defineProperty(exports, "extractFileUrl", { enumerable: true, get: function () { return helpers_1.extractFileUrl; } });
|
|
100
111
|
Object.defineProperty(exports, "formatDate", { enumerable: true, get: function () { return helpers_1.formatDate; } });
|
|
101
112
|
Object.defineProperty(exports, "formatPersonName", { enumerable: true, get: function () { return helpers_1.formatPersonName; } });
|
|
102
113
|
Object.defineProperty(exports, "getCompletePersonProfile", { enumerable: true, get: function () { return helpers_1.getCompletePersonProfile; } });
|
|
114
|
+
Object.defineProperty(exports, "getFileExtension", { enumerable: true, get: function () { return helpers_1.getFileExtension; } });
|
|
115
|
+
Object.defineProperty(exports, "getFilename", { enumerable: true, get: function () { return helpers_1.getFilename; } });
|
|
103
116
|
Object.defineProperty(exports, "getListsWithCategories", { enumerable: true, get: function () { return helpers_1.getListsWithCategories; } });
|
|
104
117
|
Object.defineProperty(exports, "getOrganizationInfo", { enumerable: true, get: function () { return helpers_1.getOrganizationInfo; } });
|
|
105
118
|
Object.defineProperty(exports, "getPeopleByHousehold", { enumerable: true, get: function () { return helpers_1.getPeopleByHousehold; } });
|
|
106
119
|
Object.defineProperty(exports, "getPersonWorkflowCardsWithNotes", { enumerable: true, get: function () { return helpers_1.getPersonWorkflowCardsWithNotes; } });
|
|
107
120
|
Object.defineProperty(exports, "getPrimaryContact", { enumerable: true, get: function () { return helpers_1.getPrimaryContact; } });
|
|
121
|
+
Object.defineProperty(exports, "isFileUpload", { enumerable: true, get: function () { return helpers_1.isFileUpload; } });
|
|
122
|
+
Object.defineProperty(exports, "isFileUrl", { enumerable: true, get: function () { return helpers_1.isFileUrl; } });
|
|
108
123
|
Object.defineProperty(exports, "isValidEmail", { enumerable: true, get: function () { return helpers_1.isValidEmail; } });
|
|
109
124
|
Object.defineProperty(exports, "isValidPhone", { enumerable: true, get: function () { return helpers_1.isValidPhone; } });
|
|
125
|
+
Object.defineProperty(exports, "processFileValue", { enumerable: true, get: function () { return helpers_1.processFileValue; } });
|
|
110
126
|
Object.defineProperty(exports, "searchPeople", { enumerable: true, get: function () { return helpers_1.searchPeople; } });
|
|
111
127
|
Object.defineProperty(exports, "validatePersonData", { enumerable: true, get: function () { return helpers_1.validatePersonData; } });
|
|
112
128
|
// ===== Performance Optimization =====
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PcoClientState } from '../core';
|
|
2
|
+
import type { ErrorContext } from '../error-handling';
|
|
3
|
+
import { AddressAttributes, AddressesList, AddressSingle, EmailAttributes, EmailSingle, EmailsList, PhoneNumberAttributes, PhoneNumberSingle, PhoneNumbersList, SocialProfileAttributes, SocialProfileSingle, SocialProfilesList } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Get all emails for a person
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPersonEmails(client: PcoClientState, personId: string, context?: Partial<ErrorContext>): Promise<EmailsList>;
|
|
8
|
+
/**
|
|
9
|
+
* Create an email for a person
|
|
10
|
+
*/
|
|
11
|
+
export declare function createPersonEmail(client: PcoClientState, personId: string, data: Partial<EmailAttributes>, context?: Partial<ErrorContext>): Promise<EmailSingle>;
|
|
12
|
+
/**
|
|
13
|
+
* Get all phone numbers for a person
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPersonPhoneNumbers(client: PcoClientState, personId: string, context?: Partial<ErrorContext>): Promise<PhoneNumbersList>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a phone number for a person
|
|
18
|
+
*/
|
|
19
|
+
export declare function createPersonPhoneNumber(client: PcoClientState, personId: string, data: Partial<PhoneNumberAttributes>, context?: Partial<ErrorContext>): Promise<PhoneNumberSingle>;
|
|
20
|
+
/**
|
|
21
|
+
* Get all addresses for a person
|
|
22
|
+
*/
|
|
23
|
+
export declare function getPersonAddresses(client: PcoClientState, personId: string, context?: Partial<ErrorContext>): Promise<AddressesList>;
|
|
24
|
+
/**
|
|
25
|
+
* Create an address for a person
|
|
26
|
+
*/
|
|
27
|
+
export declare function createPersonAddress(client: PcoClientState, personId: string, data: Partial<AddressAttributes>, context?: Partial<ErrorContext>): Promise<AddressSingle>;
|
|
28
|
+
/**
|
|
29
|
+
* Update an address for a person
|
|
30
|
+
*/
|
|
31
|
+
export declare function updatePersonAddress(client: PcoClientState, personId: string, addressId: string, data: Partial<AddressAttributes>, context?: Partial<ErrorContext>): Promise<AddressSingle>;
|
|
32
|
+
/**
|
|
33
|
+
* Get social profiles for a person
|
|
34
|
+
*/
|
|
35
|
+
export declare function getPersonSocialProfiles(client: PcoClientState, personId: string, context?: Partial<ErrorContext>): Promise<SocialProfilesList>;
|
|
36
|
+
/**
|
|
37
|
+
* Create a social profile for a person
|
|
38
|
+
*/
|
|
39
|
+
export declare function createPersonSocialProfile(client: PcoClientState, personId: string, data: Partial<SocialProfileAttributes>, context?: Partial<ErrorContext>): Promise<SocialProfileSingle>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete a social profile
|
|
42
|
+
*/
|
|
43
|
+
export declare function deleteSocialProfile(client: PcoClientState, socialProfileId: string, context?: Partial<ErrorContext>): Promise<void>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPersonEmails = getPersonEmails;
|
|
4
|
+
exports.createPersonEmail = createPersonEmail;
|
|
5
|
+
exports.getPersonPhoneNumbers = getPersonPhoneNumbers;
|
|
6
|
+
exports.createPersonPhoneNumber = createPersonPhoneNumber;
|
|
7
|
+
exports.getPersonAddresses = getPersonAddresses;
|
|
8
|
+
exports.createPersonAddress = createPersonAddress;
|
|
9
|
+
exports.updatePersonAddress = updatePersonAddress;
|
|
10
|
+
exports.getPersonSocialProfiles = getPersonSocialProfiles;
|
|
11
|
+
exports.createPersonSocialProfile = createPersonSocialProfile;
|
|
12
|
+
exports.deleteSocialProfile = deleteSocialProfile;
|
|
13
|
+
const core_1 = require("../core");
|
|
14
|
+
/**
|
|
15
|
+
* Get all emails for a person
|
|
16
|
+
*/
|
|
17
|
+
async function getPersonEmails(client, personId, context) {
|
|
18
|
+
return (0, core_1.getList)(client, `/people/${personId}/emails`, undefined, {
|
|
19
|
+
...context,
|
|
20
|
+
endpoint: `/people/${personId}/emails`,
|
|
21
|
+
method: 'GET',
|
|
22
|
+
personId,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create an email for a person
|
|
27
|
+
*/
|
|
28
|
+
async function createPersonEmail(client, personId, data, context) {
|
|
29
|
+
return (0, core_1.post)(client, `/people/${personId}/emails`, data, undefined, {
|
|
30
|
+
...context,
|
|
31
|
+
endpoint: `/people/${personId}/emails`,
|
|
32
|
+
method: 'POST',
|
|
33
|
+
personId,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all phone numbers for a person
|
|
38
|
+
*/
|
|
39
|
+
async function getPersonPhoneNumbers(client, personId, context) {
|
|
40
|
+
return (0, core_1.getList)(client, `/people/${personId}/phone_numbers`, undefined, {
|
|
41
|
+
...context,
|
|
42
|
+
endpoint: `/people/${personId}/phone_numbers`,
|
|
43
|
+
method: 'GET',
|
|
44
|
+
personId,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a phone number for a person
|
|
49
|
+
*/
|
|
50
|
+
async function createPersonPhoneNumber(client, personId, data, context) {
|
|
51
|
+
return (0, core_1.post)(client, `/people/${personId}/phone_numbers`, data, undefined, {
|
|
52
|
+
...context,
|
|
53
|
+
endpoint: `/people/${personId}/phone_numbers`,
|
|
54
|
+
method: 'POST',
|
|
55
|
+
personId,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get all addresses for a person
|
|
60
|
+
*/
|
|
61
|
+
async function getPersonAddresses(client, personId, context) {
|
|
62
|
+
return (0, core_1.getList)(client, `/people/${personId}/addresses`, undefined, {
|
|
63
|
+
...context,
|
|
64
|
+
endpoint: `/people/${personId}/addresses`,
|
|
65
|
+
method: 'GET',
|
|
66
|
+
personId,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create an address for a person
|
|
71
|
+
*/
|
|
72
|
+
async function createPersonAddress(client, personId, data, context) {
|
|
73
|
+
return (0, core_1.post)(client, `/people/${personId}/addresses`, data, undefined, {
|
|
74
|
+
...context,
|
|
75
|
+
endpoint: `/people/${personId}/addresses`,
|
|
76
|
+
method: 'POST',
|
|
77
|
+
personId,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Update an address for a person
|
|
82
|
+
*/
|
|
83
|
+
async function updatePersonAddress(client, personId, addressId, data, context) {
|
|
84
|
+
return (0, core_1.patch)(client, `/people/${personId}/addresses/${addressId}`, data, undefined, {
|
|
85
|
+
...context,
|
|
86
|
+
endpoint: `/people/${personId}/addresses/${addressId}`,
|
|
87
|
+
method: 'PATCH',
|
|
88
|
+
personId,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get social profiles for a person
|
|
93
|
+
*/
|
|
94
|
+
async function getPersonSocialProfiles(client, personId, context) {
|
|
95
|
+
return (0, core_1.getList)(client, `/people/${personId}/social_profiles`, undefined, {
|
|
96
|
+
...context,
|
|
97
|
+
endpoint: `/people/${personId}/social_profiles`,
|
|
98
|
+
method: 'GET',
|
|
99
|
+
personId,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Create a social profile for a person
|
|
104
|
+
*/
|
|
105
|
+
async function createPersonSocialProfile(client, personId, data, context) {
|
|
106
|
+
return (0, core_1.post)(client, `/people/${personId}/social_profiles`, data, undefined, {
|
|
107
|
+
...context,
|
|
108
|
+
endpoint: `/people/${personId}/social_profiles`,
|
|
109
|
+
method: 'POST',
|
|
110
|
+
personId,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Delete a social profile
|
|
115
|
+
*/
|
|
116
|
+
async function deleteSocialProfile(client, socialProfileId, context) {
|
|
117
|
+
return (0, core_1.del)(client, `/social_profiles/${socialProfileId}`, {
|
|
118
|
+
...context,
|
|
119
|
+
endpoint: `/social_profiles/${socialProfileId}`,
|
|
120
|
+
method: 'DELETE',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PcoClientState } from '../core';
|
|
2
|
+
import type { ErrorContext } from '../error-handling';
|
|
3
|
+
import { PeopleList, PersonAttributes, PersonSingle } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Get all people with optional filtering and pagination
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPeople(client: PcoClientState, params?: {
|
|
8
|
+
where?: Record<string, any>;
|
|
9
|
+
include?: string[];
|
|
10
|
+
per_page?: number;
|
|
11
|
+
page?: number;
|
|
12
|
+
}, context?: Partial<ErrorContext>): Promise<PeopleList>;
|
|
13
|
+
/**
|
|
14
|
+
* Get a single person by ID
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPerson(client: PcoClientState, id: string, include?: string[], context?: Partial<ErrorContext>): Promise<PersonSingle>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new person
|
|
19
|
+
*/
|
|
20
|
+
export declare function createPerson(client: PcoClientState, data: Partial<PersonAttributes>, context?: Partial<ErrorContext>): Promise<PersonSingle>;
|
|
21
|
+
/**
|
|
22
|
+
* Update a person
|
|
23
|
+
*/
|
|
24
|
+
export declare function updatePerson(client: PcoClientState, id: string, data: Partial<PersonAttributes>, context?: Partial<ErrorContext>): Promise<PersonSingle>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete a person
|
|
27
|
+
*/
|
|
28
|
+
export declare function deletePerson(client: PcoClientState, id: string, context?: Partial<ErrorContext>): Promise<void>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPeople = getPeople;
|
|
4
|
+
exports.getPerson = getPerson;
|
|
5
|
+
exports.createPerson = createPerson;
|
|
6
|
+
exports.updatePerson = updatePerson;
|
|
7
|
+
exports.deletePerson = deletePerson;
|
|
8
|
+
const core_1 = require("../core");
|
|
9
|
+
const helpers_1 = require("../helpers");
|
|
10
|
+
/**
|
|
11
|
+
* Get all people with optional filtering and pagination
|
|
12
|
+
*/
|
|
13
|
+
async function getPeople(client, params, context) {
|
|
14
|
+
const result = await (0, core_1.getList)(client, '/people', (0, helpers_1.buildQueryParams)(params), {
|
|
15
|
+
...context,
|
|
16
|
+
endpoint: '/people',
|
|
17
|
+
method: 'GET',
|
|
18
|
+
});
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get a single person by ID
|
|
23
|
+
*/
|
|
24
|
+
async function getPerson(client, id, include, context) {
|
|
25
|
+
const params = {};
|
|
26
|
+
if (include) {
|
|
27
|
+
params.include = include.join(',');
|
|
28
|
+
}
|
|
29
|
+
return (await (0, core_1.getSingle)(client, `/people/${id}`, params, {
|
|
30
|
+
...context,
|
|
31
|
+
endpoint: `/people/${id}`,
|
|
32
|
+
method: 'GET',
|
|
33
|
+
personId: id,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a new person
|
|
38
|
+
*/
|
|
39
|
+
async function createPerson(client, data, context) {
|
|
40
|
+
return (0, core_1.post)(client, '/people', data, undefined, {
|
|
41
|
+
...context,
|
|
42
|
+
endpoint: '/people',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Update a person
|
|
48
|
+
*/
|
|
49
|
+
async function updatePerson(client, id, data, context) {
|
|
50
|
+
return (0, core_1.patch)(client, `/people/${id}`, data, undefined, {
|
|
51
|
+
...context,
|
|
52
|
+
endpoint: `/people/${id}`,
|
|
53
|
+
method: 'PATCH',
|
|
54
|
+
personId: id,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Delete a person
|
|
59
|
+
*/
|
|
60
|
+
async function deletePerson(client, id, context) {
|
|
61
|
+
return (0, core_1.del)(client, `/people/${id}`, undefined, {
|
|
62
|
+
...context,
|
|
63
|
+
endpoint: `/people/${id}`,
|
|
64
|
+
method: 'DELETE',
|
|
65
|
+
personId: id,
|
|
66
|
+
metadata: { operation: 'delete_person' },
|
|
67
|
+
timestamp: new Date().toISOString(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { PcoClientState } from '../core';
|
|
2
|
+
import type { ErrorContext } from '../error-handling';
|
|
3
|
+
import { FieldDataList, FieldDataSingle, FieldDefinitionsList, FieldDefinitionSingle, FieldOptionAttributes, FieldOptionSingle, FieldOptionsList, TabsList } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Delete field data for a person
|
|
6
|
+
*/
|
|
7
|
+
export declare function deletePersonFieldData(client: PcoClientState, personId: string, fieldDataId: string, context?: Partial<ErrorContext>): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Get field data for a person (custom fields)
|
|
10
|
+
*/
|
|
11
|
+
export declare function getPersonFieldData(client: PcoClientState, personId: string, context?: Partial<ErrorContext>): Promise<FieldDataList>;
|
|
12
|
+
/**
|
|
13
|
+
* Get field definitions
|
|
14
|
+
*/
|
|
15
|
+
export declare function getFieldDefinitions(client: PcoClientState, params?: {
|
|
16
|
+
include?: string[];
|
|
17
|
+
per_page?: number;
|
|
18
|
+
page?: number;
|
|
19
|
+
filter?: string;
|
|
20
|
+
order?: string;
|
|
21
|
+
}, context?: Partial<ErrorContext>): Promise<FieldDefinitionsList>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a single field definition by ID
|
|
24
|
+
*/
|
|
25
|
+
export declare function getFieldDefinition(client: PcoClientState, fieldId: string, params?: {
|
|
26
|
+
include?: string[];
|
|
27
|
+
}, context?: Partial<ErrorContext>): Promise<FieldDefinitionSingle>;
|
|
28
|
+
/**
|
|
29
|
+
* Get field options for a field definition
|
|
30
|
+
*/
|
|
31
|
+
export declare function getFieldOptions(client: PcoClientState, fieldDefinitionId: string, context?: Partial<ErrorContext>): Promise<FieldOptionsList>;
|
|
32
|
+
/**
|
|
33
|
+
* Create a field option for a field definition
|
|
34
|
+
*/
|
|
35
|
+
export declare function createFieldOption(client: PcoClientState, fieldDefinitionId: string, data: Partial<FieldOptionAttributes>, context?: Partial<ErrorContext>): Promise<FieldOptionSingle>;
|
|
36
|
+
/**
|
|
37
|
+
* Get tabs
|
|
38
|
+
*/
|
|
39
|
+
export declare function getTabs(client: PcoClientState, params?: {
|
|
40
|
+
include?: string[];
|
|
41
|
+
per_page?: number;
|
|
42
|
+
page?: number;
|
|
43
|
+
}, context?: Partial<ErrorContext>): Promise<TabsList>;
|
|
44
|
+
/**
|
|
45
|
+
* Create a field definition
|
|
46
|
+
*/
|
|
47
|
+
export declare function createFieldDefinition(client: PcoClientState, tabId: string, data: {
|
|
48
|
+
name: string;
|
|
49
|
+
data_type: string;
|
|
50
|
+
sequence?: number;
|
|
51
|
+
slug?: string;
|
|
52
|
+
config?: string | Record<string, any>;
|
|
53
|
+
}, context?: Partial<ErrorContext>): Promise<FieldDefinitionSingle>;
|
|
54
|
+
/**
|
|
55
|
+
* Delete a field definition
|
|
56
|
+
*/
|
|
57
|
+
export declare function deleteFieldDefinition(client: PcoClientState, fieldDefinitionId: string, context?: Partial<ErrorContext>): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Create field data for a person with automatic file upload handling
|
|
60
|
+
* Determines field type and uses appropriate creation method
|
|
61
|
+
*/
|
|
62
|
+
export declare function createPersonFieldData(client: PcoClientState, personId: string, fieldId: string, value: string, context?: Partial<ErrorContext>): Promise<FieldDataSingle>;
|