@dereekb/zoho 12.6.21 → 12.7.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 (52) hide show
  1. package/index.cjs.js +1786 -419
  2. package/index.esm.js +1678 -417
  3. package/nestjs/CHANGELOG.md +9 -0
  4. package/nestjs/package.json +1 -1
  5. package/nestjs/src/lib/accounts/accounts.api.js +3 -2
  6. package/nestjs/src/lib/accounts/accounts.api.js.map +1 -1
  7. package/nestjs/src/lib/accounts/accounts.config.d.ts +32 -0
  8. package/nestjs/src/lib/accounts/accounts.config.js +29 -4
  9. package/nestjs/src/lib/accounts/accounts.config.js.map +1 -1
  10. package/nestjs/src/lib/crm/crm.api.d.ts +42 -0
  11. package/nestjs/src/lib/crm/crm.api.js +115 -0
  12. package/nestjs/src/lib/crm/crm.api.js.map +1 -0
  13. package/nestjs/src/lib/crm/crm.config.d.ts +10 -0
  14. package/nestjs/src/lib/crm/crm.config.js +16 -0
  15. package/nestjs/src/lib/crm/crm.config.js.map +1 -0
  16. package/nestjs/src/lib/crm/crm.module.d.ts +24 -0
  17. package/nestjs/src/lib/crm/crm.module.js +61 -0
  18. package/nestjs/src/lib/crm/crm.module.js.map +1 -0
  19. package/nestjs/src/lib/crm/index.d.ts +3 -0
  20. package/nestjs/src/lib/crm/index.js +7 -0
  21. package/nestjs/src/lib/crm/index.js.map +1 -0
  22. package/nestjs/src/lib/recruit/recruit.api.d.ts +4 -4
  23. package/nestjs/src/lib/recruit/recruit.api.js +31 -31
  24. package/nestjs/src/lib/recruit/recruit.api.js.map +1 -1
  25. package/nestjs/src/lib/recruit/recruit.module.js +1 -1
  26. package/nestjs/src/lib/recruit/recruit.module.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/lib/accounts/accounts.api.d.ts +1 -1
  29. package/src/lib/crm/crm.api.d.ts +430 -0
  30. package/src/lib/crm/crm.api.notes.d.ts +40 -0
  31. package/src/lib/crm/crm.api.tags.d.ts +136 -0
  32. package/src/lib/crm/crm.config.d.ts +24 -0
  33. package/src/lib/crm/crm.criteria.d.ts +19 -0
  34. package/src/lib/crm/crm.d.ts +325 -0
  35. package/src/lib/crm/crm.error.api.d.ts +52 -0
  36. package/src/lib/crm/crm.factory.d.ts +22 -0
  37. package/src/lib/crm/crm.notes.d.ts +48 -0
  38. package/src/lib/crm/crm.tags.d.ts +40 -0
  39. package/src/lib/crm/index.d.ts +10 -0
  40. package/src/lib/index.d.ts +1 -0
  41. package/src/lib/recruit/index.d.ts +0 -1
  42. package/src/lib/recruit/recruit.api.candidates.d.ts +30 -6
  43. package/src/lib/recruit/recruit.api.d.ts +102 -22
  44. package/src/lib/recruit/recruit.api.notes.d.ts +30 -6
  45. package/src/lib/recruit/recruit.api.tags.d.ts +30 -6
  46. package/src/lib/recruit/recruit.criteria.d.ts +8 -44
  47. package/src/lib/recruit/recruit.d.ts +7 -3
  48. package/src/lib/recruit/recruit.error.api.d.ts +5 -1
  49. package/src/lib/shared/criteria.d.ts +55 -0
  50. package/src/lib/shared/criteria.util.d.ts +10 -0
  51. package/src/lib/zoho.error.api.d.ts +62 -4
  52. package/src/lib/recruit/recruit.criteria.util.d.ts +0 -10
@@ -0,0 +1,136 @@
1
+ import { type ZohoCrmContext } from './crm.config';
2
+ import { type ArrayOrValue, type Maybe } from '@dereekb/util';
3
+ import { type ZohoCrmModuleNameRef, type ZohoCrmRecordId } from './crm';
4
+ import { type ZohoCrmChangeObjectLikeResponse, type ZohoCrmChangeObjectLikeResponseSuccessEntryMeta, type ZohoCrmChangeObjectResponse, type ZohoCrmChangeObjectResponseErrorEntry, type ZohoCrmChangeObjectResponseSuccessEntry, type ZohoCrmGetRecordsPageFilter, type ZohoCrmMultiRecordResult, type ZohoCrmMultiRecordResultEntry } from './crm.api';
5
+ import { type ZohoCrmTagId, type ZohoCrmTagData, type ZohoCrmTagName, type ZohoCrmTagWithObjectDetails } from './crm.tags';
6
+ import { type FetchPage, type FetchPageFactoryOptions } from '@dereekb/util/fetch';
7
+ import { type ZohoPageResult } from '../zoho.api.page';
8
+ export type ZohoCrmCreateTagData = Pick<ZohoCrmTagData, 'name'> & Partial<Pick<ZohoCrmTagData, 'color_code'>>;
9
+ export interface ZohoCrmCreateTagsRequest extends ZohoCrmModuleNameRef {
10
+ readonly tags: ArrayOrValue<ZohoCrmCreateTagData>;
11
+ }
12
+ export interface ZohoCrmCreateTagsResponse {
13
+ readonly tags: ZohoCrmChangeObjectResponse['data'];
14
+ }
15
+ export type ZohoCrmCreateTagsResult = ZohoCrmMultiRecordResult<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseSuccessEntry, ZohoCrmChangeObjectResponseErrorEntry> & {
16
+ readonly duplicateErrorItems: ZohoCrmMultiRecordResultEntry<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseErrorEntry>[];
17
+ readonly allErrorItems: ZohoCrmMultiRecordResultEntry<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseErrorEntry>[];
18
+ };
19
+ export type ZohoCrmCreateTagsFunction = (input: ZohoCrmCreateTagsRequest) => Promise<ZohoCrmCreateTagsResult>;
20
+ export declare function zohoCrmCreateTagsForModule(context: ZohoCrmContext): (input: ZohoCrmCreateTagsRequest) => Promise<{
21
+ errorItems: ZohoCrmMultiRecordResultEntry<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseErrorEntry>[];
22
+ duplicateErrorItems: ZohoCrmMultiRecordResultEntry<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseErrorEntry>[];
23
+ allErrorItems: ZohoCrmMultiRecordResultEntry<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseErrorEntry>[];
24
+ successItems: ZohoCrmMultiRecordResultEntry<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseSuccessEntry<import("./crm").ZohoCrmChangeObjectDetails>>[];
25
+ }>;
26
+ export interface ZohoCrmGetTagsRequest extends ZohoCrmModuleNameRef, ZohoCrmGetRecordsPageFilter {
27
+ readonly my_tags?: string;
28
+ }
29
+ export interface ZohoCrmGetTagsResponse extends Omit<ZohoPageResult<ZohoCrmTagWithObjectDetails>, 'data'> {
30
+ readonly tags: ZohoCrmTagWithObjectDetails[];
31
+ }
32
+ export type ZohoCrmGetTagsResult = ZohoPageResult<ZohoCrmTagWithObjectDetails>;
33
+ export type ZohoCrmGetTagsFunction = (input: ZohoCrmGetTagsRequest) => Promise<ZohoCrmGetTagsResult>;
34
+ /**
35
+ * Returns the list of tags within a module.
36
+ *
37
+ * https://www.zoho.com/crm/developer-guide/apiv2/get-tag-list.html
38
+ *
39
+ * @param context
40
+ * @returns
41
+ */
42
+ export declare function zohoCrmGetTagsForModule(context: ZohoCrmContext): ZohoCrmGetTagsFunction;
43
+ export type ZohoCrmGetTagsForModulePageFactory = (input: ZohoCrmGetTagsRequest, options?: Maybe<FetchPageFactoryOptions<ZohoCrmGetTagsRequest, ZohoCrmGetTagsResult>>) => FetchPage<ZohoCrmGetTagsRequest, ZohoCrmGetTagsResult>;
44
+ export declare function zohoCrmGetTagsForModulePageFactory(context: ZohoCrmContext): ZohoCrmGetTagsForModulePageFactory;
45
+ /**
46
+ * Limit enforced by Zoho Crm
47
+ */
48
+ export declare const ZOHO_CRM_ADD_TAGS_TO_RECORDS_MAX_IDS_ALLOWED = 100;
49
+ export interface ZohoCrmAddTagsToRecordsRequest extends ZohoCrmModuleNameRef {
50
+ /**
51
+ * Tag names to add to the records.
52
+ */
53
+ readonly tag_names?: Maybe<ArrayOrValue<ZohoCrmTagName>>;
54
+ /**
55
+ * Specific tags to add to the records.
56
+ */
57
+ readonly tags?: Maybe<ArrayOrValue<ZohoCrmTagData & {
58
+ id?: Maybe<ZohoCrmTagId>;
59
+ }>>;
60
+ /**
61
+ * Specify if the existing tags are to be overwritten.
62
+ */
63
+ readonly over_write?: Maybe<boolean>;
64
+ /**
65
+ * Ids corresponding to the records in the module to add the tags to.
66
+ *
67
+ * Max of 100 ids.
68
+ */
69
+ readonly ids: ArrayOrValue<ZohoCrmRecordId>;
70
+ }
71
+ export interface ZohoCrmAddTagsToRecordsResultDetails {
72
+ /**
73
+ * Record id that was updated
74
+ */
75
+ readonly id: ZohoCrmRecordId;
76
+ /**
77
+ * Tag names that were added to the record
78
+ */
79
+ readonly tags: ZohoCrmTagName[];
80
+ }
81
+ export interface ZohoCrmAddTagsToRecordsSuccessEntry extends ZohoCrmChangeObjectLikeResponseSuccessEntryMeta {
82
+ readonly details: ZohoCrmAddTagsToRecordsResultDetails;
83
+ }
84
+ export type ZohoCrmAddTagsToRecordsResponse = ZohoCrmChangeObjectLikeResponse<ZohoCrmAddTagsToRecordsSuccessEntry>;
85
+ /**
86
+ * Contains all the details of the error.
87
+ */
88
+ export type ZohoCrmAddTagsToRecordsErrorEntryDetails = ZohoCrmAddTagsToRecordsResultDetails;
89
+ export type ZohoCrmAddTagsToRecordsErrorEntry = ZohoCrmChangeObjectResponseErrorEntry & {
90
+ readonly details: ZohoCrmAddTagsToRecordsErrorEntryDetails;
91
+ };
92
+ export type ZohoCrmAddTagsToRecordsResult = ZohoCrmMultiRecordResult<ZohoCrmAddTagsToRecordsRequest, ZohoCrmAddTagsToRecordsSuccessEntry, ZohoCrmAddTagsToRecordsErrorEntry>;
93
+ export type ZohoCrmAddTagsToRecordsFunction = (input: ZohoCrmAddTagsToRecordsRequest) => Promise<ZohoCrmAddTagsToRecordsResult>;
94
+ /**
95
+ * Adds one or more tags to one or more records.
96
+ *
97
+ * https://www.zoho.com/crm/developer-guide/apiv2/add-tags.html
98
+ *
99
+ * @param context
100
+ * @returns
101
+ */
102
+ export declare function zohoCrmAddTagsToRecords(context: ZohoCrmContext): ZohoCrmAddTagsToRecordsFunction;
103
+ export declare function zohoCrmAddTagsToRecordsRequestBody(input: ZohoCrmAddTagsToRecordsRequest): {
104
+ tags: (ZohoCrmTagData & {
105
+ id?: Maybe<ZohoCrmTagId>;
106
+ })[];
107
+ ids: string[];
108
+ };
109
+ /**
110
+ * Limit enforced by Zoho Crm
111
+ */
112
+ export declare const ZOHO_CRM_REMOVE_TAGS_FROM_RECORDS_MAX_IDS_ALLOWED = 100;
113
+ export type ZohoCrmRemoveTagsFromRecordsRequest = ZohoCrmAddTagsToRecordsRequest;
114
+ export type ZohoCrmRemoveTagsFromRecordsResultDetails = ZohoCrmAddTagsToRecordsResultDetails;
115
+ export interface ZohoCrmRemoveTagsFromRecordsSuccessEntry extends ZohoCrmChangeObjectLikeResponseSuccessEntryMeta {
116
+ readonly details: ZohoCrmRemoveTagsFromRecordsResultDetails;
117
+ }
118
+ export type ZohoCrmRemoveTagsFromRecordsResponse = ZohoCrmChangeObjectLikeResponse<ZohoCrmRemoveTagsFromRecordsSuccessEntry>;
119
+ /**
120
+ * Contains all the details of the error.
121
+ */
122
+ export type ZohoCrmRemoveTagsFromRecordsErrorEntryDetails = ZohoCrmRemoveTagsFromRecordsResultDetails;
123
+ export type ZohoCrmRemoveTagsFromRecordsErrorEntry = ZohoCrmChangeObjectResponseErrorEntry & {
124
+ readonly details: ZohoCrmRemoveTagsFromRecordsErrorEntryDetails;
125
+ };
126
+ export type ZohoCrmRemoveTagsFromRecordsResult = ZohoCrmMultiRecordResult<ZohoCrmRemoveTagsFromRecordsRequest, ZohoCrmRemoveTagsFromRecordsSuccessEntry, ZohoCrmRemoveTagsFromRecordsErrorEntry>;
127
+ export type ZohoCrmRemoveTagsFromRecordsFunction = (input: ZohoCrmRemoveTagsFromRecordsRequest) => Promise<ZohoCrmRemoveTagsFromRecordsResult>;
128
+ /**
129
+ * Removes one or more tags from one or more records.
130
+ *
131
+ * https://www.zoho.com/crm/developer-guide/apiv2/remove-tags.html
132
+ *
133
+ * @param context
134
+ * @returns
135
+ */
136
+ export declare function zohoCrmRemoveTagsFromRecords(context: ZohoCrmContext): ZohoCrmRemoveTagsFromRecordsFunction;
@@ -0,0 +1,24 @@
1
+ import { type FactoryWithRequiredInput } from '@dereekb/util';
2
+ import { type ConfiguredFetch, type FetchJsonFunction } from '@dereekb/util/fetch';
3
+ import { type ZohoApiUrl, type ZohoApiUrlKey, type ZohoConfig, type ZohoApiServiceName } from '../zoho.config';
4
+ import { type ZohoAccessTokenStringFactory, type ZohoServiceAccessTokenKey } from '../accounts';
5
+ import { type ZohoRateLimiterRef } from '../zoho.limit';
6
+ export declare const ZOHO_CRM_SERVICE_NAME: ZohoApiServiceName | ZohoServiceAccessTokenKey;
7
+ export type ZohoCrmApiUrl = ZohoApiUrl;
8
+ export type ZohoCrmApiUrlKey = ZohoApiUrlKey;
9
+ export type ZohoCrmConfigApiUrlInput = ZohoCrmApiUrlKey | ZohoCrmApiUrl;
10
+ export declare function zohoCrmConfigApiUrl(input: ZohoCrmConfigApiUrlInput): ZohoApiUrl;
11
+ export type ZohoCrmConfig = ZohoConfig;
12
+ export interface ZohoCrmFetchFactoryInput {
13
+ readonly apiUrl: ZohoCrmApiUrl;
14
+ }
15
+ export type ZohoCrmFetchFactory = FactoryWithRequiredInput<ConfiguredFetch, ZohoCrmFetchFactoryInput>;
16
+ export interface ZohoCrmContext extends ZohoRateLimiterRef {
17
+ readonly fetch: ConfiguredFetch;
18
+ readonly fetchJson: FetchJsonFunction;
19
+ readonly accessTokenStringFactory: ZohoAccessTokenStringFactory;
20
+ readonly config: ZohoCrmConfig;
21
+ }
22
+ export interface ZohoCrmContextRef {
23
+ readonly crmContext: ZohoCrmContext;
24
+ }
@@ -0,0 +1,19 @@
1
+ import { type ZohoSearchRecordsCriteriaString, type ZohoSearchRecordsCriteriaTree, type ZohoSearchRecordsCriteriaFilterType, type ZohoSearchRecordsCriteriaEntry, zohoSearchRecordsCriteriaString, zohoSearchRecordsCriteriaStringForTree, zohoSearchRecordsCriteriaEntryToCriteriaString } from '../shared/criteria';
2
+ /**
3
+ * Can search up to 10 criteria at a time.
4
+ *
5
+ * https://www.zoho.com/crm/developer/docs/api/v8/search-records.html
6
+ *
7
+ * "You can search for a maximum of 10 criteria (with the same or different column) with equals and starts_with conditions."
8
+ */
9
+ export declare const MAX_ZOHO_CRM_SEARCH_MODULE_RECORDS_CRITERIA = 10;
10
+ export type ZohoCrmSearchRecordsCriteriaString = ZohoSearchRecordsCriteriaString;
11
+ export declare const zohoCrmSearchRecordsCriteriaString: typeof zohoSearchRecordsCriteriaString;
12
+ export declare const zohoCrmSearchRecordsCriteriaStringForTree: typeof zohoSearchRecordsCriteriaStringForTree;
13
+ export type ZohoCrmSearchRecordsCriteriaTree<T = any> = ZohoSearchRecordsCriteriaTree<T>;
14
+ export type ZohoCrmSearchRecordsCriteriaTreeElement<T = any> = ZohoCrmSearchRecordsCriteriaEntryArray<T> | ZohoCrmSearchRecordsCriteriaTree<T> | ZohoCrmSearchRecordsCriteriaString;
15
+ export type ZohoCrmSearchRecordsCriteriaFilterType = ZohoSearchRecordsCriteriaFilterType;
16
+ export type ZohoCrmSearchRecordsCriteriaEntryArray<T = any> = ZohoCrmSearchRecordsCriteriaEntry<T>[];
17
+ export type ZohoCrmSearchRecordsCriteriaEntry<T = any> = ZohoSearchRecordsCriteriaEntry<T>;
18
+ export declare const escapeZohoCrmFieldValueForCriteriaString: import("dist/packages/util/src").EscapeStringCharactersFunction;
19
+ export declare const zohoCrmSearchRecordsCriteriaEntryToCriteriaString: typeof zohoSearchRecordsCriteriaEntryToCriteriaString;
@@ -0,0 +1,325 @@
1
+ import { type CommaSeparatedString, type EmailAddress, type ISO8601DateString, type UniqueModelWithId, type WebsiteUrl } from '@dereekb/util';
2
+ /**
3
+ * Zoho CRM module name.
4
+ *
5
+ * Example "Leads"
6
+ */
7
+ export type ZohoCrmModuleName = string;
8
+ /**
9
+ * Leads module name
10
+ */
11
+ export declare const ZOHO_CRM_LEADS_MODULE = "Leads";
12
+ /**
13
+ * Contacts module name
14
+ */
15
+ export declare const ZOHO_CRM_CONTACTS_MODULE = "Contacts";
16
+ /**
17
+ * Tasks module name
18
+ */
19
+ export declare const ZOHO_CRM_TASKS_MODULE = "Tasks";
20
+ /**
21
+ * Notes module name
22
+ */
23
+ export declare const ZOHO_CRM_NOTES_MODULE = "Notes";
24
+ /**
25
+ * Emails module name
26
+ */
27
+ export declare const ZOHO_CRM_EMAILS_MODULE = "Emails";
28
+ /**
29
+ * Attachments module name
30
+ */
31
+ export declare const ZOHO_CRM_ATTACHMENTS_MODULE = "Attachments";
32
+ /**
33
+ * Contains a reference to a module.
34
+ */
35
+ export interface ZohoCrmModuleNameRef {
36
+ readonly module: ZohoCrmModuleName;
37
+ }
38
+ /**
39
+ * The API name of a function that is accessible via the Crm REST API
40
+ */
41
+ export type ZohoCrmRestFunctionApiName = string;
42
+ /**
43
+ * An identifier in Zoho Crm.
44
+ */
45
+ export type ZohoCrmId = string;
46
+ /**
47
+ * Identifier of a Lead record in Zoho CRM.
48
+ */
49
+ export type ZohoCrmLeadId = string;
50
+ /**
51
+ * Identifier of an Account record in Zoho CRM.
52
+ */
53
+ export type ZohoCrmAccountId = string;
54
+ /**
55
+ * Identifier of a Contact record in Zoho CRM.
56
+ */
57
+ export type ZohoCrmContactId = string;
58
+ /**
59
+ * Identifier of a Deal record in Zoho CRM.
60
+ */
61
+ export type ZohoCrmDealId = string;
62
+ /**
63
+ * Identifier of a Campaign record in Zoho CRM.
64
+ */
65
+ export type ZohoCrmCampaignId = string;
66
+ /**
67
+ * Identifier of a Task record in Zoho CRM.
68
+ */
69
+ export type ZohoCrmTaskId = string;
70
+ /**
71
+ * Identifier of a Case record in Zoho CRM.
72
+ */
73
+ export type ZohoCrmCaseId = string;
74
+ /**
75
+ * Zoho Crm record id
76
+ *
77
+ * Example "576214000000569001"
78
+ */
79
+ export type ZohoCrmRecordId = string;
80
+ /**
81
+ * Zoho Crm type id
82
+ *
83
+ * Example "576214000000820595"
84
+ */
85
+ export type ZohoCrmTypeId = string;
86
+ /**
87
+ * Zoho Crm user identifier.
88
+ *
89
+ * Users can be found in the Users and Controls section in settings.
90
+ */
91
+ export type ZohoCrmUserId = string;
92
+ /**
93
+ * Zoho Crm custom view id
94
+ */
95
+ export type ZohoCrmCustomViewId = string;
96
+ /**
97
+ * Zoho Crm territory id
98
+ */
99
+ export type ZohoCrmTerritoryId = string;
100
+ /**
101
+ * The name of a field on a record.
102
+ */
103
+ export type ZohoCrmFieldName = string;
104
+ /**
105
+ * Comma separated list of field names
106
+ */
107
+ export type ZohoCrmCommaSeparateFieldNames = CommaSeparatedString;
108
+ export type ZohoCrmDraftOrSaveState = 'draft' | 'save';
109
+ export type ZohoCrmTrueFalseBoth = 'true' | 'false' | 'both';
110
+ export interface ZohoCrmReferenceData {
111
+ name: string;
112
+ id: ZohoCrmId;
113
+ }
114
+ /**
115
+ * Reference pair of a Zoho Crm user name and id
116
+ */
117
+ export interface ZohoCrmUserReferenceData {
118
+ name: string;
119
+ id: ZohoCrmUserId;
120
+ }
121
+ export interface ZohoCrmReferenceDataWithModule extends ZohoCrmReferenceData, ZohoCrmModuleNameRef {
122
+ }
123
+ export type ZohoCrmCreatedByData = ZohoCrmUserReferenceData;
124
+ export type ZohoCrmRecordOwner = ZohoCrmUserReferenceData;
125
+ export interface ZohoCrmModifiedByData extends ZohoCrmReferenceData {
126
+ zuid: ZohoCrmId;
127
+ }
128
+ export type ZohoCrmParentReferenceData = ZohoCrmReferenceDataWithModule;
129
+ /**
130
+ * Zoho Crm only allows URLs that can be resolved via the internet (I.E. uses a normal tdl)
131
+ *
132
+ * The following are considered invalid:
133
+ * - localhost:8080
134
+ * - ht://dereekb.com
135
+ */
136
+ export type ZohoCrmValidUrl = WebsiteUrl;
137
+ /**
138
+ * Update details returned by the server for a created/updated object.
139
+ */
140
+ export interface ZohoCrmChangeObjectDetails {
141
+ id: ZohoCrmRecordId;
142
+ Modified_Time: ISO8601DateString;
143
+ Modified_By: ZohoCrmCreatedByData;
144
+ Created_Time: ISO8601DateString;
145
+ Created_By: ZohoCrmCreatedByData;
146
+ }
147
+ /**
148
+ * Base Zoho Crm field data type.
149
+ */
150
+ export interface ZohoCrmRecordFieldsData {
151
+ }
152
+ export interface ZohoCrmRecordDraftStateData {
153
+ /**
154
+ * Used to update a draft record or to convert a draft to a normal record.
155
+ *
156
+ * When creating, passing "draft" will create the record as a draft.
157
+ */
158
+ $state?: ZohoCrmDraftOrSaveState;
159
+ }
160
+ export type NewZohoCrmRecordData<T = ZohoCrmRecordFieldsData> = T & ZohoCrmRecordDraftStateData;
161
+ /**
162
+ * A ZohoCrm record containing the corresponding record's id.
163
+ */
164
+ export type UpdateZohoCrmRecordData = UniqueModelWithId & ZohoCrmRecordFieldsData & ZohoCrmRecordDraftStateData;
165
+ /**
166
+ * A ZohoCrm record containing record details.
167
+ */
168
+ export type ZohoCrmRecord = UniqueModelWithId & ZohoCrmRecordFieldsData;
169
+ /**
170
+ * Returns true if it is a valid ZohoCrmValidUrl.
171
+ */
172
+ export declare const isZohoCrmValidUrl: (input: WebsiteUrl) => input is ZohoCrmValidUrl;
173
+ /**
174
+ * The status of a record.
175
+ */
176
+ export type ZohoCrmRecordStatus = string;
177
+ /**
178
+ * Metadata for a record's email.
179
+ */
180
+ export interface ZohoCrmRecordEmailMetadata {
181
+ /**
182
+ * Whether or not an attachment is present.
183
+ */
184
+ attachment: boolean;
185
+ /**
186
+ * The subject of the email.
187
+ */
188
+ subject: string;
189
+ /**
190
+ * The email address the email was sent to.
191
+ */
192
+ to: EmailAddress;
193
+ /**
194
+ * The email address the email was sent from.
195
+ */
196
+ from: EmailAddress;
197
+ /**
198
+ * The date the email was sent.
199
+ */
200
+ sent_on: ISO8601DateString;
201
+ /**
202
+ * The status of the email.
203
+ */
204
+ status: ZohoCrmRecordEmailMetadataStatus[];
205
+ }
206
+ export type ZohoCrmRecordEmailMetadataStatusType = 'sent' | string;
207
+ export interface ZohoCrmRecordEmailMetadataStatus {
208
+ type: ZohoCrmRecordEmailMetadataStatusType;
209
+ }
210
+ export declare const ZOHO_CRM_RECORD_ATTACHMENT_METADATA_ATTACH_TYPE_RESUME = "Resume";
211
+ export interface ZohoCrmRecordAttachmentMetadataAttachType extends ZohoCrmReferenceData {
212
+ name: typeof ZOHO_CRM_RECORD_ATTACHMENT_METADATA_ATTACH_TYPE_RESUME | string;
213
+ }
214
+ /**
215
+ * Record id for an attachment.
216
+ */
217
+ export type ZohoCrmAttachmentRecordId = ZohoCrmRecordId;
218
+ /**
219
+ * The size of the attachment in bytes, stored as a string.
220
+ */
221
+ export type ZohoCrmRecordAttachmentMetadataSize = string;
222
+ /**
223
+ * Attachment category id
224
+ */
225
+ export type ZohoCrmAttachmentCategoryId = string;
226
+ /**
227
+ * Known attachment category names
228
+ */
229
+ export type KnownZohoCrmAttachmentCategoryName = 'Resume' | 'Offer' | 'Contracts' | 'Criminal records' | 'Mandatory reporter' | 'Teaching certification' | 'Health records' | 'Others' | 'Cover Letter' | 'Formatted Resume';
230
+ /**
231
+ * Attachment category name
232
+ *
233
+ * I.E. "Resume"
234
+ */
235
+ export type ZohoCrmAttachmentCategoryName = KnownZohoCrmAttachmentCategoryName | string;
236
+ /**
237
+ * The type of attachment.
238
+ *
239
+ * "Attachment" - Download the attachment to retrieve the value.
240
+ * "Link URL" - Use the Attachment_URL property to retrieve the value.
241
+ */
242
+ export type ZohoCrmAttachmentType = 'Attachment' | 'Link URL';
243
+ /**
244
+ * Metadata for a record's attachment.
245
+ */
246
+ export interface ZohoCrmRecordAttachmentMetadata {
247
+ /**
248
+ * The type of attachment
249
+ */
250
+ $attach_type: ZohoCrmRecordAttachmentMetadataAttachType;
251
+ /**
252
+ * Last time the attachment was modified
253
+ */
254
+ Modified_Time: ISO8601DateString;
255
+ /**
256
+ * The category of the attachment
257
+ */
258
+ Category: ZohoCrmRecordAttachmentMetadataAttachType;
259
+ /**
260
+ * The name of the attachment
261
+ */
262
+ File_Name: string;
263
+ /**
264
+ * The size of the attachment in bytes, stored as a string.
265
+ */
266
+ Size: ZohoCrmRecordAttachmentMetadataSize;
267
+ /**
268
+ * The time the attachment was created
269
+ */
270
+ Created_Time: ISO8601DateString;
271
+ /**
272
+ * The parent record id for this attachment
273
+ */
274
+ Parent_Id: ZohoCrmRecordId;
275
+ /**
276
+ * Owner of the attachment
277
+ */
278
+ Attachment_Owner: ZohoCrmUserReferenceData;
279
+ /**
280
+ * Internal file identifier for the attachment
281
+ */
282
+ $file_id: string;
283
+ /**
284
+ * Type of attachment, and how to retrieve the value.
285
+ */
286
+ $type: ZohoCrmAttachmentType;
287
+ /**
288
+ * Direct URL to the attachment, when available
289
+ */
290
+ Attachment_URL: string | null;
291
+ /**
292
+ * User who last modified this attachment
293
+ */
294
+ Modified_By: ZohoCrmUserReferenceData;
295
+ /**
296
+ * Attachment record id
297
+ */
298
+ id: ZohoCrmAttachmentRecordId;
299
+ /**
300
+ * User who created this attachment
301
+ */
302
+ Created_By: ZohoCrmUserReferenceData;
303
+ /**
304
+ * Whether the attachment is editable
305
+ */
306
+ $editable: boolean;
307
+ /**
308
+ * Module this attachment belongs to (e.g., Leads)
309
+ */
310
+ $se_module: ZohoCrmModuleName;
311
+ /**
312
+ * Link URL when the attachment is a link
313
+ */
314
+ $link_url?: string | null;
315
+ /**
316
+ * Number of linked documents
317
+ */
318
+ $link_docs: number;
319
+ }
320
+ /**
321
+ * Update details returned by the server for an updated record.
322
+ *
323
+ * @deprecated use ZohoCrmChangeObjectDetails instead.
324
+ */
325
+ export type ZohoCrmRecordUpdateDetails = ZohoCrmChangeObjectDetails;
@@ -0,0 +1,52 @@
1
+ import { type FetchResponseError } from '@dereekb/util/fetch';
2
+ import { BaseError } from 'make-error';
3
+ import { type ZohoServerErrorDataWithDetails, type ZohoServerErrorResponseData, ZohoServerError, type ParsedZohoServerError, type ZohoServerErrorResponseDataArrayRef } from '../zoho.error.api';
4
+ import { type ZohoCrmModuleName, type ZohoCrmRecordId } from './crm';
5
+ import { type ZohoDataArrayResultRef } from '../zoho.api.page';
6
+ /**
7
+ * Error code for when two records are already associated with each other.
8
+ *
9
+ * Example being a candidate and a job opening are already associated.
10
+ */
11
+ export declare const ZOHO_CRM_ALREADY_ASSOCIATED_ERROR_CODE = "ALREADY_ASSOCIATED";
12
+ /**
13
+ * Thrown when a record with the given id has no content. Typically also means it does not exist.
14
+ */
15
+ export declare class ZohoCrmRecordNoContentError extends BaseError {
16
+ readonly moduleName?: ZohoCrmModuleName | undefined;
17
+ readonly recordId?: ZohoCrmRecordId | undefined;
18
+ constructor(moduleName?: ZohoCrmModuleName | undefined, recordId?: ZohoCrmRecordId | undefined);
19
+ }
20
+ export declare class ZohoCrmRecordCrudError extends ZohoServerError<ZohoServerErrorDataWithDetails> {
21
+ }
22
+ export declare class ZohoCrmRecordCrudMandatoryFieldNotFoundError extends ZohoCrmRecordCrudError {
23
+ }
24
+ export declare class ZohoCrmRecordCrudDuplicateDataError extends ZohoCrmRecordCrudError {
25
+ }
26
+ export type ZohoCrmRecordCrudInvalidDataErrorDetails = Record<string, string>;
27
+ export interface ZohoCrmRecordCrudInvalidFieldDetails {
28
+ /**
29
+ * The api name for this field
30
+ *
31
+ * Example: 'id'
32
+ */
33
+ readonly api_name: string;
34
+ /**
35
+ * The json path for this field from the root data.
36
+ *
37
+ * Example: `$.data[0].id`
38
+ */
39
+ readonly json_path: string;
40
+ }
41
+ export declare class ZohoCrmRecordCrudInvalidDataError extends ZohoCrmRecordCrudError {
42
+ get invalidFieldDetails(): ZohoCrmRecordCrudInvalidFieldDetails;
43
+ }
44
+ export declare class ZohoCrmRecordCrudNoMatchingRecordError extends ZohoCrmRecordCrudInvalidDataError {
45
+ }
46
+ export declare function zohoCrmRecordCrudError(error: ZohoServerErrorDataWithDetails): ZohoCrmRecordCrudError;
47
+ export declare function assertZohoCrmRecordDataArrayResultHasContent<T>(moduleName?: ZohoCrmModuleName, recordId?: ZohoCrmRecordId): <R extends ZohoDataArrayResultRef<T>>(x: R) => R;
48
+ export declare const logZohoCrmErrorToConsole: import("../zoho.error.api").LogZohoServerErrorFunction;
49
+ export declare function parseZohoCrmError(responseError: FetchResponseError): Promise<ParsedZohoServerError>;
50
+ export declare function parseZohoCrmServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataArrayRef, responseError: FetchResponseError): ParsedZohoServerError;
51
+ export declare const interceptZohoCrm200StatusWithErrorResponse: import("@dereekb/util/fetch").FetchJsonInterceptJsonResponseFunction;
52
+ export declare const handleZohoCrmErrorFetch: import("../zoho.error.api").HandleZohoErrorFetchFactory;
@@ -0,0 +1,22 @@
1
+ import { type ZohoCrmConfig, type ZohoCrmContextRef, type ZohoCrmFetchFactory } from './crm.config';
2
+ import { type LogZohoServerErrorFunction } from '../zoho.error.api';
3
+ import { type ZohoAccountsContextRef } from '../accounts/accounts.config';
4
+ import { type ZohoRateLimitedFetchHandlerConfig } from '../zoho.limit';
5
+ import { type Maybe } from '@dereekb/util';
6
+ export type ZohoCrm = ZohoCrmContextRef;
7
+ export interface ZohoCrmFactoryConfig extends ZohoAccountsContextRef {
8
+ /**
9
+ * Custom ZohoRateLimitedFetchHandlerConfig
10
+ */
11
+ rateLimiterConfig?: Maybe<ZohoRateLimitedFetchHandlerConfig>;
12
+ /**
13
+ * Creates a new fetch instance to use when making calls.
14
+ */
15
+ fetchFactory?: ZohoCrmFetchFactory;
16
+ /**
17
+ * Custom log error function.
18
+ */
19
+ logZohoServerErrorFunction?: LogZohoServerErrorFunction;
20
+ }
21
+ export type ZohoCrmFactory = (config: ZohoCrmConfig) => ZohoCrm;
22
+ export declare function zohoCrmFactory(factoryConfig: ZohoCrmFactoryConfig): ZohoCrmFactory;
@@ -0,0 +1,48 @@
1
+ import { type ISO8601DateString, type UniqueModelWithId } from '@dereekb/util';
2
+ import { type ZohoCrmReferenceData, type ZohoCrmParentReferenceData, type ZohoCrmTypeId, type ZohoCrmModuleName, type ZohoCrmCreatedByData, type ZohoCrmModifiedByData, type ZohoCrmId } from './crm';
3
+ export type ZohoCrmNoteId = string;
4
+ export interface ZohoCrmNoteAction {
5
+ $is_system_action: boolean;
6
+ }
7
+ export type ZohoCrmNoteSourceName = 'NORMAL_USER';
8
+ export type ZohoCrmNoteSourceType = number;
9
+ export interface ZohoCrmNoteSource {
10
+ name: ZohoCrmNoteSourceName;
11
+ type: ZohoCrmNoteSourceType;
12
+ }
13
+ export type ZohoCrmNoteOwnerData = ZohoCrmReferenceData;
14
+ export interface ZohoCrmNoteData {
15
+ Note_Title: string;
16
+ Note_Content: string;
17
+ Parent_Id: ZohoCrmParentReferenceData;
18
+ Created_Time: ISO8601DateString;
19
+ Modified_Time: ISO8601DateString;
20
+ $attachments: null;
21
+ $is_edit_allowed: boolean;
22
+ $editable: boolean;
23
+ $type_id: ZohoCrmTypeId;
24
+ $is_delete_allowed: boolean;
25
+ $note_action: ZohoCrmNoteAction;
26
+ $source: ZohoCrmNoteSource;
27
+ $se_module: ZohoCrmModuleName;
28
+ $is_shared_to_client: boolean;
29
+ Note_Owner: ZohoCrmNoteOwnerData;
30
+ Created_By: ZohoCrmCreatedByData;
31
+ Modified_By: ZohoCrmModifiedByData;
32
+ $size: ZohoCrmNoteFileSize | null;
33
+ $voice_note: boolean;
34
+ $status: ZohoCrmNoteStatus;
35
+ }
36
+ export interface NewZohoCrmNoteData extends Pick<ZohoCrmNoteData, 'Note_Title' | 'Note_Content'> {
37
+ Parent_Id: Pick<ZohoCrmParentReferenceData, 'id'> | ZohoCrmId;
38
+ se_module: ZohoCrmModuleName;
39
+ }
40
+ export type ZohoCrmNoteStatus = string;
41
+ export type ZohoCrmNoteFileSize = number;
42
+ export interface ZohoCrmNote extends ZohoCrmNoteData, UniqueModelWithId {
43
+ }
44
+ export type ZohoCrmRecordNote = ZohoCrmNote;
45
+ /**
46
+ * @deprecated use NewZohoCrmNewNoteData instead.
47
+ */
48
+ export type NewZohoCrmNewNoteData = NewZohoCrmNoteData;
@@ -0,0 +1,40 @@
1
+ import { type Maybe, type HexColorCode } from '@dereekb/util';
2
+ import { type ZohoCrmChangeObjectDetails } from './crm';
3
+ export type ZohoCrmTagId = string;
4
+ /**
5
+ * Name of a tag.
6
+ *
7
+ * Max length of 25 characters.
8
+ */
9
+ export type ZohoCrmTagName = string;
10
+ /**
11
+ * Maximum length of ZohoCrmTagName
12
+ */
13
+ export declare const ZOHO_CRM_TAG_NAME_MAX_LENGTH = 25;
14
+ /**
15
+ * Hex color code of a tag
16
+ */
17
+ export type ZohoCrmTagColorCode = HexColorCode;
18
+ /**
19
+ * The color and name of a Tag in Zoho Crm.
20
+ */
21
+ export interface ZohoCrmTagData {
22
+ color_code?: Maybe<ZohoCrmTagColorCode>;
23
+ name: ZohoCrmTagName;
24
+ }
25
+ /**
26
+ * Includes the id of the Tag along with other tag data.
27
+ */
28
+ export interface ZohoCrmTag extends ZohoCrmTagData {
29
+ id: ZohoCrmTagId;
30
+ }
31
+ /**
32
+ * ZohoCrmTag that also has ZohoCrmChangeObjectDetails
33
+ */
34
+ export type ZohoCrmTagWithObjectDetails = ZohoCrmTag & ZohoCrmChangeObjectDetails;
35
+ /**
36
+ * A record that may contain a Tag value.
37
+ */
38
+ export interface ZohoCrmTagArrayRef {
39
+ Tag?: Maybe<ZohoCrmTag[]>;
40
+ }
@@ -0,0 +1,10 @@
1
+ export * from './crm.api';
2
+ export * from './crm.api.notes';
3
+ export * from './crm.api.tags';
4
+ export * from './crm.config';
5
+ export * from './crm.criteria';
6
+ export * from './crm.error.api';
7
+ export * from './crm.factory';
8
+ export * from './crm';
9
+ export * from './crm.tags';
10
+ export * from './crm.notes';