@dereekb/zoho 13.4.0 → 13.4.2

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 (40) hide show
  1. package/index.cjs.js +272 -92
  2. package/index.esm.js +272 -93
  3. package/nestjs/index.cjs.js +404 -90
  4. package/nestjs/index.esm.js +404 -90
  5. package/nestjs/package.json +4 -4
  6. package/nestjs/src/lib/accounts/accounts.service.d.ts +14 -2
  7. package/nestjs/src/lib/crm/crm.api.d.ts +142 -27
  8. package/nestjs/src/lib/crm/crm.config.d.ts +2 -0
  9. package/nestjs/src/lib/recruit/recruit.api.d.ts +162 -31
  10. package/nestjs/src/lib/recruit/recruit.config.d.ts +2 -0
  11. package/nestjs/src/lib/sign/sign.api.d.ts +67 -12
  12. package/nestjs/src/lib/sign/webhook/webhook.zoho.sign.d.ts +3 -0
  13. package/nestjs/src/lib/zoho.config.d.ts +26 -2
  14. package/package.json +3 -3
  15. package/src/lib/accounts/accounts.api.d.ts +9 -5
  16. package/src/lib/accounts/accounts.config.d.ts +12 -2
  17. package/src/lib/accounts/accounts.d.ts +6 -3
  18. package/src/lib/accounts/accounts.error.api.d.ts +13 -0
  19. package/src/lib/accounts/accounts.factory.d.ts +2 -2
  20. package/src/lib/crm/crm.api.d.ts +13 -0
  21. package/src/lib/crm/crm.api.notes.d.ts +15 -0
  22. package/src/lib/crm/crm.api.tags.d.ts +17 -8
  23. package/src/lib/crm/crm.config.d.ts +9 -2
  24. package/src/lib/crm/crm.d.ts +12 -12
  25. package/src/lib/crm/crm.error.api.d.ts +14 -0
  26. package/src/lib/crm/crm.factory.d.ts +3 -3
  27. package/src/lib/crm/crm.notes.d.ts +23 -23
  28. package/src/lib/crm/crm.tags.d.ts +3 -3
  29. package/src/lib/recruit/recruit.api.candidates.d.ts +19 -0
  30. package/src/lib/recruit/recruit.api.d.ts +10 -0
  31. package/src/lib/recruit/recruit.config.d.ts +9 -2
  32. package/src/lib/recruit/recruit.d.ts +12 -12
  33. package/src/lib/recruit/recruit.error.api.d.ts +14 -0
  34. package/src/lib/recruit/recruit.factory.d.ts +3 -3
  35. package/src/lib/sign/sign.config.d.ts +12 -2
  36. package/src/lib/sign/sign.d.ts +14 -14
  37. package/src/lib/sign/sign.error.api.d.ts +13 -0
  38. package/src/lib/sign/sign.factory.d.ts +3 -3
  39. package/src/lib/zoho.error.api.d.ts +25 -8
  40. package/src/lib/zoho.limit.d.ts +8 -1
@@ -13,15 +13,39 @@ export interface ZohoConfigServiceReaderConfig {
13
13
  export type ZohoConfigServiceReaderFunction = (configKey: string) => string;
14
14
  /**
15
15
  * Creates a new ZohoConfigServiceReaderFunction that reads from the input ConfigService.
16
+ *
16
17
  * @param input
18
+ * @returns a function that reads config values for the given Zoho service
17
19
  */
18
20
  export declare function zohoConfigServiceReaderFunction(input: ZohoConfigServiceReaderConfig): ZohoConfigServiceReaderFunction;
19
21
  export declare function zohoConfigServiceReaderFunction(serviceAccessTokenKey: ZohoServiceAccessTokenKey, configService: ConfigService): ZohoConfigServiceReaderFunction;
22
+ export interface ReadZohoConfigFromConfigServiceConfig {
23
+ readonly configService: ConfigService;
24
+ readonly servicePrefix?: string;
25
+ readonly assertValid?: boolean;
26
+ }
20
27
  /**
21
28
  * Reads the ZohoConfig config from the ConfigService.
22
29
  *
23
- * @param configService
24
- * @param prefix
30
+ * @param config - Configuration for reading from the config service
31
+ * @param configService - NestJS ConfigService to read environment variables from
32
+ * @param servicePrefix - optional prefix to scope config keys per service
33
+ * @param assertValid - whether to throw if required config values are missing
34
+ * @returns ZohoConfig read from environment variables
35
+ */
36
+ export declare function readZohoConfigFromConfigService(config: ReadZohoConfigFromConfigServiceConfig): ZohoConfig;
37
+ /**
38
+ * @deprecated Use the config object overload instead.
39
+ *
40
+ * @param configService - NestJS ConfigService to read environment variables from
41
+ * @param servicePrefix - optional prefix to scope config keys per service
42
+ * @param assertValid - whether to throw if required config values are missing
43
+ * @returns ZohoConfig read from environment variables
25
44
  */
26
45
  export declare function readZohoConfigFromConfigService(configService: ConfigService, servicePrefix?: string, assertValid?: boolean): ZohoConfig;
46
+ /**
47
+ * Asserts that the provided ZohoConfig has a valid API URL configured.
48
+ *
49
+ * @param config - the Zoho config to validate
50
+ */
27
51
  export declare function assertValidZohoConfig(config: ZohoConfig): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/zoho",
3
- "version": "13.4.0",
3
+ "version": "13.4.2",
4
4
  "exports": {
5
5
  "./nestjs": {
6
6
  "module": "./nestjs/index.esm.js",
@@ -17,8 +17,8 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@dereekb/nestjs": "13.4.0",
21
- "@dereekb/util": "13.4.0",
20
+ "@dereekb/nestjs": "13.4.2",
21
+ "@dereekb/util": "13.4.2",
22
22
  "@nestjs/common": "^11.1.16",
23
23
  "@nestjs/config": "^4.0.3",
24
24
  "express": "^5.0.0",
@@ -26,23 +26,23 @@ export interface ZohoAccountsAccessTokenResponse {
26
26
  /**
27
27
  * Short-lived OAuth access token for authenticating API calls.
28
28
  */
29
- access_token: ZohoAccessTokenString;
29
+ readonly access_token: ZohoAccessTokenString;
30
30
  /**
31
31
  * Comma-separated list of OAuth scopes granted to this token.
32
32
  */
33
- scope: ZohoAccessTokenScopesString;
33
+ readonly scope: ZohoAccessTokenScopesString;
34
34
  /**
35
35
  * The API domain to use for subsequent API calls (e.g. `'https://www.zohoapis.com'`).
36
36
  */
37
- api_domain: ZohoAccessTokenApiDomain;
37
+ readonly api_domain: ZohoAccessTokenApiDomain;
38
38
  /**
39
39
  * Token type, always `'Bearer'`.
40
40
  */
41
- token_type: 'Bearer';
41
+ readonly token_type: 'Bearer';
42
42
  /**
43
43
  * Number of seconds until the access token expires.
44
44
  */
45
- expires_in: Seconds;
45
+ readonly expires_in: Seconds;
46
46
  }
47
47
  /**
48
48
  * Error response from the Zoho OAuth token endpoint when the refresh fails.
@@ -169,5 +169,9 @@ export type ZohoAccountsRefreshTokenFromAuthorizationCodeFunction = (input: Zoho
169
169
  export declare function zohoAccountsRefreshTokenFromAuthorizationCode(context: ZohoAccountsContext): ZohoAccountsRefreshTokenFromAuthorizationCodeFunction;
170
170
  /**
171
171
  * Constructs a standard {@link FetchJsonInput} for Zoho Accounts API calls with the given HTTP method and optional body.
172
+ *
173
+ * @param method - HTTP method to use for the request
174
+ * @param body - Optional request body to include
175
+ * @returns Configured fetch input for the Zoho Accounts API call
172
176
  */
173
177
  export declare function zohoAccountsApiFetchJsonInput(method: string, body?: FetchJsonBody): FetchJsonInput;
@@ -16,6 +16,12 @@ export declare const ZOHO_ACCOUNTS_US_API_URL = "https://accounts.zoho.com";
16
16
  export type ZohoAccountsApiUrl = ZohoApiUrl;
17
17
  export type ZohoAccountsApiUrlKey = 'us';
18
18
  export type ZohoAccountsConfigApiUrlInput = ZohoAccountsApiUrlKey | ZohoAccountsApiUrl;
19
+ /**
20
+ * Resolves a Zoho Accounts API URL input to the full base URL. The 'us' key maps to the US datacenter; custom URLs pass through unchanged.
21
+ *
22
+ * @param input - A well-known datacenter key or a custom Zoho Accounts API URL
23
+ * @returns The resolved full Zoho Accounts API base URL
24
+ */
19
25
  export declare function zohoAccountsConfigApiUrl(input: ZohoAccountsConfigApiUrlInput): ZohoApiUrl;
20
26
  /**
21
27
  * Configuration for ZohoAccounts.
@@ -30,10 +36,10 @@ export interface ZohoAccountsConfig extends ZohoConfig, ZohoAuthClientIdAndSecre
30
36
  */
31
37
  readonly accessTokenCache?: Maybe<ZohoAccessTokenCache>;
32
38
  }
33
- export interface ZohoAccountsFetchFactoryInput {
39
+ export interface ZohoAccountsFetchFactoryParams {
34
40
  readonly apiUrl: ZohoApiUrl;
35
41
  }
36
- export type ZohoAccountsFetchFactory = FactoryWithRequiredInput<ConfiguredFetch, ZohoAccountsFetchFactoryInput>;
42
+ export type ZohoAccountsFetchFactory = FactoryWithRequiredInput<ConfiguredFetch, ZohoAccountsFetchFactoryParams>;
37
43
  export interface ZohoAccountsContext {
38
44
  readonly fetch: ConfiguredFetch;
39
45
  readonly fetchJson: FetchJsonFunction;
@@ -43,3 +49,7 @@ export interface ZohoAccountsContext {
43
49
  export interface ZohoAccountsContextRef {
44
50
  readonly accountsContext: ZohoAccountsContext;
45
51
  }
52
+ /**
53
+ * @deprecated use ZohoAccountsFetchFactoryParams instead.
54
+ */
55
+ export type ZohoAccountsFetchFactoryInput = ZohoAccountsFetchFactoryParams;
@@ -1,4 +1,4 @@
1
- import { type Maybe } from '@dereekb/util';
1
+ import { type Maybe, type Seconds } from '@dereekb/util';
2
2
  import { type ZohoApiServiceName } from '../zoho.config';
3
3
  /**
4
4
  * Arbitrary key used to identify a specific service's access token. Typically coincides with the ZohoApiServiceName.
@@ -30,9 +30,9 @@ export interface ZohoAccessToken {
30
30
  readonly scope: ZohoAccessTokenScopesString;
31
31
  readonly apiDomain: ZohoAccessTokenApiDomain;
32
32
  /**
33
- * Length of time the token is valid for.
33
+ * Length of time the token is valid for, in seconds.
34
34
  */
35
- readonly expiresIn: number;
35
+ readonly expiresIn: Seconds;
36
36
  /**
37
37
  * Date the token expires at.
38
38
  */
@@ -80,5 +80,8 @@ export type ZohoAccessTokenRefresher = ZohoAccessTokenFactory;
80
80
  export type ZohoAccessTokenStringFactory = () => Promise<ZohoAccessTokenString>;
81
81
  /**
82
82
  * Generates a new ZohoAccessTokenStringFactory.
83
+ *
84
+ * @param zohoAccessTokenFactory - Factory that produces ZohoAccessToken instances
85
+ * @returns A factory function that resolves to the access token string
83
86
  */
84
87
  export declare function zohoAccessTokenStringFactory(zohoAccessTokenFactory: ZohoAccessTokenFactory): ZohoAccessTokenStringFactory;
@@ -22,7 +22,20 @@ export declare class ZohoAccountsAuthFailureError extends FetchRequestFactoryErr
22
22
  constructor(reason?: string | undefined);
23
23
  }
24
24
  export declare const logZohoAccountsErrorToConsole: import("..").LogZohoServerErrorFunction;
25
+ /**
26
+ * Parses a fetch response error into a typed Zoho Accounts server error by extracting and interpreting the JSON error body.
27
+ *
28
+ * @param responseError - The fetch response error to parse
29
+ * @returns The parsed Zoho server error, or undefined if the response could not be parsed
30
+ */
25
31
  export declare function parseZohoAccountsError(responseError: FetchResponseError): Promise<ParsedZohoServerError>;
32
+ /**
33
+ * Parses a Zoho Accounts error response body into a typed error. Handles account-specific error codes before falling back to the generic Zoho error parser.
34
+ *
35
+ * @param errorResponseData - The raw error response data from the Zoho Accounts API
36
+ * @param responseError - The original fetch response error for context
37
+ * @returns The parsed Zoho server error, or undefined if the error could not be classified
38
+ */
26
39
  export declare function parseZohoAccountsServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData, responseError: FetchResponseError): ParsedZohoServerError;
27
40
  export declare const interceptZohoAccounts200StatusWithErrorResponse: import("@dereekb/util/fetch").FetchJsonInterceptJsonResponseFunction;
28
41
  export declare const handleZohoAccountsErrorFetch: import("..").HandleZohoErrorFetchFactory;
@@ -16,11 +16,11 @@ export interface ZohoAccountsFactoryConfig {
16
16
  * Custom fetch factory for creating the underlying HTTP client.
17
17
  * Defaults to a standard fetch service with JSON content headers and a 20-second timeout.
18
18
  */
19
- fetchFactory?: ZohoAccountsFetchFactory;
19
+ readonly fetchFactory?: ZohoAccountsFetchFactory;
20
20
  /**
21
21
  * Custom error logging function invoked when Zoho API errors are encountered.
22
22
  */
23
- logZohoServerErrorFunction?: LogZohoServerErrorFunction;
23
+ readonly logZohoServerErrorFunction?: LogZohoServerErrorFunction;
24
24
  }
25
25
  /**
26
26
  * Factory function that creates a {@link ZohoAccounts} client from a {@link ZohoAccountsConfig}.
@@ -860,10 +860,16 @@ export type ZohoCrmExecuteRestApiFunctionFunction = (input: ZohoCrmExecuteRestAp
860
860
  export declare function zohoCrmExecuteRestApiFunction(context: ZohoCrmContext): ZohoCrmExecuteRestApiFunctionFunction;
861
861
  /**
862
862
  * Builds URL search params from the input objects, omitting the `module` key since it is used in the URL path rather than as a query parameter.
863
+ *
864
+ * @param input - One or more objects to convert into URL search parameters
865
+ * @returns URL search params string with the `module` key excluded
863
866
  */
864
867
  export declare function zohoCrmUrlSearchParamsMinusModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
865
868
  /**
866
869
  * Builds URL search params from the input objects, omitting both `id` and `module` keys since they are used in the URL path.
870
+ *
871
+ * @param input - One or more objects to convert into URL search parameters
872
+ * @returns URL search params string with `id` and `module` keys excluded
867
873
  */
868
874
  export declare function zohoCrmUrlSearchParamsMinusIdAndModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
869
875
  /**
@@ -872,12 +878,19 @@ export declare function zohoCrmUrlSearchParamsMinusIdAndModule(...input: Maybe<o
872
878
  export declare const zohoCrmUrlSearchParams: typeof makeUrlSearchParams;
873
879
  /**
874
880
  * Constructs the standard FetchJsonInput used by CRM API calls, pairing the HTTP method with an optional body.
881
+ *
882
+ * @param method - HTTP method to use for the request
883
+ * @param body - Optional request body to include
884
+ * @returns Configured fetch input for the Zoho CRM API call
875
885
  */
876
886
  export declare function zohoCrmApiFetchJsonInput(method: string, body?: Maybe<FetchJsonBody>): FetchJsonInput;
877
887
  /**
878
888
  * Catches ZohoServerFetchResponseDataArrayError and returns the error data array as the response data, as each data element will have the error details.
879
889
  *
880
890
  * Use to catch errors from functions that return ZohoCrmChangeObjectLikeResponse and pass the result to zohoCrmChangeObjectLikeResponseSuccessAndErrorPairs.
891
+ *
892
+ * @param e - The error to catch and potentially convert
893
+ * @returns The error data array wrapped as a change object response
881
894
  */
882
895
  export declare function zohoCrmCatchZohoCrmChangeObjectLikeResponseError<R extends ZohoCrmChangeObjectLikeResponse<any>>(e: unknown): R;
883
896
  export type ZohoCrmChangeObjectLikeResponse<T extends ZohoCrmChangeObjectLikeResponseEntry = ZohoCrmChangeObjectLikeResponseEntry> = ZohoDataArrayResultRef<T>;
@@ -28,6 +28,9 @@ export type ZohoCrmCreateNotesFunction = (input: ZohoCrmCreateNotesRequest) => P
28
28
  * Creates notes directly in the CRM Notes module. Each note must include the parent record reference and module name.
29
29
  *
30
30
  * For creating notes associated with a specific record, prefer {@link zohoCrmCreateNotesForRecord} which handles parent binding automatically.
31
+ *
32
+ * @param context - Authenticated Zoho CRM context for making API calls
33
+ * @returns Function that creates notes in the CRM Notes module
31
34
  */
32
35
  export declare function zohoCrmCreateNotes(context: ZohoCrmContext): (input: ZohoCrmCreateNotesRequest) => Promise<ZohoCrmMultiRecordResult<NewZohoCrmNoteData, ZohoCrmChangeObjectResponseSuccessEntry<import("./crm").ZohoCrmChangeObjectDetails>, ZohoCrmChangeObjectResponseErrorEntry>>;
33
36
  /**
@@ -47,6 +50,9 @@ export type ZohoCrmDeleteNotesResponse = ZohoCrmChangeObjectResponse;
47
50
  export type ZohoCrmDeleteNotesFunction = (input: ZohoCrmDeleteNotesRequest) => Promise<ZohoCrmDeleteNotesResult>;
48
51
  /**
49
52
  * Deletes one or more notes from the CRM Notes module by their IDs.
53
+ *
54
+ * @param context - Authenticated Zoho CRM context for making API calls
55
+ * @returns Function that deletes notes by their IDs
50
56
  */
51
57
  export declare function zohoCrmDeleteNotes(context: ZohoCrmContext): (input: ZohoCrmDeleteNotesRequest) => Promise<ZohoCrmMultiRecordResult<string, ZohoCrmChangeObjectResponseSuccessEntry<import("./crm").ZohoCrmChangeObjectDetails>, ZohoCrmChangeObjectResponseErrorEntry>>;
52
58
  /**
@@ -60,11 +66,17 @@ export type ZohoCrmGetNotesForRecordResponse = ZohoPageResult<ZohoCrmRecordNote>
60
66
  export type ZohoCrmGetNotesForRecordFunction = (input: ZohoCrmGetNotesForRecordRequest) => Promise<ZohoCrmGetNotesForRecordResponse>;
61
67
  /**
62
68
  * Retrieves paginated notes associated with a specific CRM record using the related records API.
69
+ *
70
+ * @param context - Authenticated Zoho CRM context for making API calls
71
+ * @returns Function that retrieves notes for a specific record
63
72
  */
64
73
  export declare function zohoCrmGetNotesForRecord(context: ZohoCrmContext): ZohoCrmGetNotesForRecordFunction;
65
74
  export type ZohoCrmGetNotesForRecordPageFactory = FetchPageFactory<ZohoCrmGetNotesForRecordRequest, ZohoCrmGetNotesForRecordResponse>;
66
75
  /**
67
76
  * Creates a page factory for iterating through all notes for a record across multiple pages.
77
+ *
78
+ * @param context - Authenticated Zoho CRM context for making API calls
79
+ * @returns Page factory for paginating through notes for a record
68
80
  */
69
81
  export declare function zohoCrmGetNotesForRecordPageFactory(context: ZohoCrmContext): ZohoCrmGetNotesForRecordPageFactory;
70
82
  /**
@@ -79,5 +91,8 @@ export type ZohoCrmCreateNotesForRecordFunction = (input: ZohoCrmCreateNotesForR
79
91
  * Creates notes for a specific record, automatically binding the parent module and record ID to each note entry.
80
92
  *
81
93
  * https://www.zoho.com/crm/developer/docs/api/v8/create-notes.html
94
+ *
95
+ * @param context - Authenticated Zoho CRM context for making API calls
96
+ * @returns Function that creates notes bound to a specific record
82
97
  */
83
98
  export declare function zohoCrmCreateNotesForRecord(context: ZohoCrmContext): ZohoCrmCreateNotesForRecordFunction;
@@ -31,6 +31,9 @@ export type ZohoCrmCreateTagsResult = ZohoCrmMultiRecordResult<ZohoCrmCreateTagD
31
31
  export type ZohoCrmCreateTagsFunction = (input: ZohoCrmCreateTagsRequest) => Promise<ZohoCrmCreateTagsResult>;
32
32
  /**
33
33
  * Creates one or more tags for a CRM module. Duplicate tag errors are separated from other errors in the result to simplify idempotent workflows.
34
+ *
35
+ * @param context - Authenticated Zoho CRM context for making API calls
36
+ * @returns Function that creates tags for a module
34
37
  */
35
38
  export declare function zohoCrmCreateTagsForModule(context: ZohoCrmContext): (input: ZohoCrmCreateTagsRequest) => Promise<{
36
39
  errorItems: ZohoCrmMultiRecordResultEntry<ZohoCrmCreateTagData, ZohoCrmChangeObjectResponseErrorEntry>[];
@@ -67,8 +70,8 @@ export type ZohoCrmDeleteTagFunction = (input: ZohoCrmDeleteTagRequest) => Promi
67
70
  *
68
71
  * https://www.zoho.com/crm/developer/docs/api/v8/delete-tag.html
69
72
  *
70
- * @param context
71
- * @returns
73
+ * @param context - Authenticated Zoho CRM context for making API calls
74
+ * @returns Function that deletes a tag by ID
72
75
  */
73
76
  export declare function zohoCrmDeleteTag(context: ZohoCrmContext): ZohoCrmDeleteTagFunction;
74
77
  /**
@@ -93,13 +96,16 @@ export type ZohoCrmGetTagsFunction = (input: ZohoCrmGetTagsRequest) => Promise<Z
93
96
  *
94
97
  * https://www.zoho.com/crm/developer-guide/apiv2/get-tag-list.html
95
98
  *
96
- * @param context
97
- * @returns
99
+ * @param context - Authenticated Zoho CRM context for making API calls
100
+ * @returns Function that retrieves tags for a module
98
101
  */
99
102
  export declare function zohoCrmGetTagsForModule(context: ZohoCrmContext): ZohoCrmGetTagsFunction;
100
103
  export type ZohoCrmGetTagsForModulePageFactory = (input: ZohoCrmGetTagsRequest, options?: Maybe<FetchPageFactoryOptions<ZohoCrmGetTagsRequest, ZohoCrmGetTagsResult>>) => FetchPage<ZohoCrmGetTagsRequest, ZohoCrmGetTagsResult>;
101
104
  /**
102
105
  * Creates a page factory for iterating through all tags in a module across multiple pages.
106
+ *
107
+ * @param context - Authenticated Zoho CRM context for making API calls
108
+ * @returns Page factory for paginating through tags in a module
103
109
  */
104
110
  export declare function zohoCrmGetTagsForModulePageFactory(context: ZohoCrmContext): ZohoCrmGetTagsForModulePageFactory;
105
111
  /**
@@ -165,12 +171,15 @@ export type ZohoCrmAddTagsToRecordsFunction = (input: ZohoCrmAddTagsToRecordsReq
165
171
  *
166
172
  * https://www.zoho.com/crm/developer-guide/apiv2/add-tags.html
167
173
  *
168
- * @param context
169
- * @returns
174
+ * @param context - Authenticated Zoho CRM context for making API calls
175
+ * @returns Function that adds tags to records
170
176
  */
171
177
  export declare function zohoCrmAddTagsToRecords(context: ZohoCrmContext): ZohoCrmAddTagsToRecordsFunction;
172
178
  /**
173
179
  * Builds the request body for the add/remove tags endpoints, merging `tag_names` into `tags` and enforcing the max ID limit.
180
+ *
181
+ * @param input - The add/remove tags request containing tag names, tag objects, and record IDs
182
+ * @returns The formatted request body with merged tags and record IDs
174
183
  */
175
184
  export declare function zohoCrmAddTagsToRecordsRequestBody(input: ZohoCrmAddTagsToRecordsRequest): {
176
185
  tags: (ZohoCrmTagData & {
@@ -217,7 +226,7 @@ export type ZohoCrmRemoveTagsFromRecordsFunction = (input: ZohoCrmRemoveTagsFrom
217
226
  *
218
227
  * https://www.zoho.com/crm/developer-guide/apiv2/remove-tags.html
219
228
  *
220
- * @param context
221
- * @returns
229
+ * @param context - Authenticated Zoho CRM context for making API calls
230
+ * @returns Function that removes tags from records
222
231
  */
223
232
  export declare function zohoCrmRemoveTagsFromRecords(context: ZohoCrmContext): ZohoCrmRemoveTagsFromRecordsFunction;
@@ -21,6 +21,9 @@ export type ZohoCrmApiUrlKey = ZohoApiUrlKey;
21
21
  export type ZohoCrmConfigApiUrlInput = ZohoCrmApiUrlKey | ZohoCrmApiUrl;
22
22
  /**
23
23
  * Resolves a CRM API URL input to its full base URL. Well-known keys ('sandbox', 'production') map to their respective Zoho CRM endpoints; custom URLs pass through unchanged.
24
+ *
25
+ * @param input - A well-known environment key or a custom CRM API URL
26
+ * @returns The resolved full Zoho CRM API base URL
24
27
  */
25
28
  export declare function zohoCrmConfigApiUrl(input: ZohoCrmConfigApiUrlInput): ZohoApiUrl;
26
29
  /**
@@ -30,13 +33,13 @@ export type ZohoCrmConfig = ZohoConfig;
30
33
  /**
31
34
  * Input provided to a CRM fetch factory to construct an authenticated fetch instance for a specific API base URL.
32
35
  */
33
- export interface ZohoCrmFetchFactoryInput {
36
+ export interface ZohoCrmFetchFactoryParams {
34
37
  readonly apiUrl: ZohoCrmApiUrl;
35
38
  }
36
39
  /**
37
40
  * Factory that produces a pre-configured fetch instance bound to a specific Zoho CRM API URL, used to customize HTTP transport (e.g., timeouts, headers).
38
41
  */
39
- export type ZohoCrmFetchFactory = FactoryWithRequiredInput<ConfiguredFetch, ZohoCrmFetchFactoryInput>;
42
+ export type ZohoCrmFetchFactory = FactoryWithRequiredInput<ConfiguredFetch, ZohoCrmFetchFactoryParams>;
40
43
  /**
41
44
  * Core context for making authenticated Zoho CRM API calls. Bundles the configured fetch, JSON parsing, access token management, rate limiting, and service configuration needed by all CRM operations.
42
45
  */
@@ -52,3 +55,7 @@ export interface ZohoCrmContext extends ZohoRateLimiterRef {
52
55
  export interface ZohoCrmContextRef {
53
56
  readonly crmContext: ZohoCrmContext;
54
57
  }
58
+ /**
59
+ * @deprecated use ZohoCrmFetchFactoryParams instead.
60
+ */
61
+ export type ZohoCrmFetchFactoryInput = ZohoCrmFetchFactoryParams;
@@ -1,4 +1,4 @@
1
- import { type CommaSeparatedString, type EmailAddress, type ISO8601DateString, type UniqueModelWithId, type WebsiteUrl } from '@dereekb/util';
1
+ import { type CommaSeparatedString, type EmailAddress, type ISO8601DateString, type Maybe, type UniqueModelWithId, type WebsiteUrl } from '@dereekb/util';
2
2
  /**
3
3
  * Zoho CRM module name.
4
4
  *
@@ -108,15 +108,15 @@ export type ZohoCrmCommaSeparateFieldNames = CommaSeparatedString;
108
108
  export type ZohoCrmDraftOrSaveState = 'draft' | 'save';
109
109
  export type ZohoCrmTrueFalseBoth = 'true' | 'false' | 'both';
110
110
  export interface ZohoCrmReferenceData {
111
- name: string;
112
- id: ZohoCrmId;
111
+ readonly name: string;
112
+ readonly id: ZohoCrmId;
113
113
  }
114
114
  /**
115
115
  * Reference pair of a Zoho Crm user name and id
116
116
  */
117
117
  export interface ZohoCrmUserReferenceData {
118
- name: string;
119
- id: ZohoCrmUserId;
118
+ readonly name: string;
119
+ readonly id: ZohoCrmUserId;
120
120
  }
121
121
  export interface ZohoCrmReferenceDataWithModule extends ZohoCrmReferenceData, ZohoCrmModuleNameRef {
122
122
  }
@@ -138,11 +138,11 @@ export type ZohoCrmValidUrl = WebsiteUrl;
138
138
  * Update details returned by the server for a created/updated object.
139
139
  */
140
140
  export interface ZohoCrmChangeObjectDetails {
141
- id: ZohoCrmRecordId;
142
- Modified_Time: ISO8601DateString;
143
- Modified_By: ZohoCrmCreatedByData;
144
- Created_Time: ISO8601DateString;
145
- Created_By: ZohoCrmCreatedByData;
141
+ readonly id: ZohoCrmRecordId;
142
+ readonly Modified_Time: ISO8601DateString;
143
+ readonly Modified_By: ZohoCrmCreatedByData;
144
+ readonly Created_Time: ISO8601DateString;
145
+ readonly Created_By: ZohoCrmCreatedByData;
146
146
  }
147
147
  /**
148
148
  * Base Zoho Crm field data type.
@@ -287,7 +287,7 @@ export interface ZohoCrmRecordAttachmentMetadata {
287
287
  /**
288
288
  * Direct URL to the attachment, when available
289
289
  */
290
- Attachment_URL: string | null;
290
+ Attachment_URL: Maybe<WebsiteUrl>;
291
291
  /**
292
292
  * User who last modified this attachment
293
293
  */
@@ -311,7 +311,7 @@ export interface ZohoCrmRecordAttachmentMetadata {
311
311
  /**
312
312
  * Link URL when the attachment is a link
313
313
  */
314
- $link_url?: string | null;
314
+ $link_url?: Maybe<WebsiteUrl>;
315
315
  /**
316
316
  * Number of linked documents
317
317
  */
@@ -66,10 +66,17 @@ export declare class ZohoCrmRecordCrudNoMatchingRecordError extends ZohoCrmRecor
66
66
  }
67
67
  /**
68
68
  * Maps a Zoho CRM server error to the appropriate typed {@link ZohoCrmRecordCrudError} subclass based on the error code and affected field.
69
+ *
70
+ * @param error - The server error data containing the error code and field details
71
+ * @returns The appropriate typed CRM CRUD error instance
69
72
  */
70
73
  export declare function zohoCrmRecordCrudError(error: ZohoServerErrorDataWithDetails): ZohoCrmRecordCrudError;
71
74
  /**
72
75
  * Returns an assertion function that throws {@link ZohoCrmRecordNoContentError} when a data array result is empty or null, typically indicating a missing record.
76
+ *
77
+ * @param moduleName - Optional CRM module name for the error context
78
+ * @param recordId - Optional record ID for the error context
79
+ * @returns Assertion function that throws if the data array is empty
73
80
  */
74
81
  export declare function assertZohoCrmRecordDataArrayResultHasContent<T>(moduleName?: ZohoCrmModuleName, recordId?: ZohoCrmRecordId): <R extends ZohoDataArrayResultRef<T>>(x: R) => R;
75
82
  /**
@@ -78,10 +85,17 @@ export declare function assertZohoCrmRecordDataArrayResultHasContent<T>(moduleNa
78
85
  export declare const logZohoCrmErrorToConsole: import("..").LogZohoServerErrorFunction;
79
86
  /**
80
87
  * Parses a fetch response error into a typed Zoho CRM server error by extracting and interpreting the JSON error body.
88
+ *
89
+ * @param responseError - The fetch response error to parse
90
+ * @returns The parsed Zoho server error, or undefined if the response could not be parsed
81
91
  */
82
92
  export declare function parseZohoCrmError(responseError: FetchResponseError): Promise<ParsedZohoServerError>;
83
93
  /**
84
94
  * Parses a Zoho CRM error response body into a typed error. Delegates to CRM-specific error code handling before falling back to the generic Zoho error parser.
95
+ *
96
+ * @param errorResponseData - The raw error response data from the Zoho CRM API
97
+ * @param responseError - The original fetch response error for context
98
+ * @returns The parsed Zoho server error, or undefined if the error could not be classified
85
99
  */
86
100
  export declare function parseZohoCrmServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataArrayRef, responseError: FetchResponseError): ParsedZohoServerError;
87
101
  /**
@@ -15,16 +15,16 @@ export interface ZohoCrmFactoryConfig extends ZohoAccountsContextRef {
15
15
  /**
16
16
  * Custom rate limiter configuration to control request concurrency and throttling.
17
17
  */
18
- rateLimiterConfig?: Maybe<ZohoRateLimitedFetchHandlerConfig>;
18
+ readonly rateLimiterConfig?: Maybe<ZohoRateLimitedFetchHandlerConfig>;
19
19
  /**
20
20
  * Custom fetch factory for creating the underlying HTTP client.
21
21
  * Defaults to a standard fetch service with OAuth Bearer token headers and a 20-second timeout.
22
22
  */
23
- fetchFactory?: ZohoCrmFetchFactory;
23
+ readonly fetchFactory?: ZohoCrmFetchFactory;
24
24
  /**
25
25
  * Custom error logging function invoked when Zoho API errors are encountered.
26
26
  */
27
- logZohoServerErrorFunction?: LogZohoServerErrorFunction;
27
+ readonly logZohoServerErrorFunction?: LogZohoServerErrorFunction;
28
28
  }
29
29
  /**
30
30
  * Factory function that creates a {@link ZohoCrm} client from a {@link ZohoCrmConfig}.
@@ -8,7 +8,7 @@ export type ZohoCrmNoteId = string;
8
8
  * Metadata describing whether the note action was triggered by the system.
9
9
  */
10
10
  export interface ZohoCrmNoteAction {
11
- $is_system_action: boolean;
11
+ readonly $is_system_action: boolean;
12
12
  }
13
13
  /**
14
14
  * Known source name indicating the note was created by a normal user.
@@ -22,8 +22,8 @@ export type ZohoCrmNoteSourceType = number;
22
22
  * Describes the origin of a note, including who or what created it.
23
23
  */
24
24
  export interface ZohoCrmNoteSource {
25
- name: ZohoCrmNoteSourceName;
26
- type: ZohoCrmNoteSourceType;
25
+ readonly name: ZohoCrmNoteSourceName;
26
+ readonly type: ZohoCrmNoteSourceType;
27
27
  }
28
28
  /**
29
29
  * Reference data identifying the owner of a note.
@@ -33,26 +33,26 @@ export type ZohoCrmNoteOwnerData = ZohoCrmReferenceData;
33
33
  * Full data shape for a CRM note as returned by the API, including metadata fields like permissions, source, and timestamps.
34
34
  */
35
35
  export interface ZohoCrmNoteData {
36
- Note_Title: string;
37
- Note_Content: string;
38
- Parent_Id: ZohoCrmParentReferenceData;
39
- Created_Time: ISO8601DateString;
40
- Modified_Time: ISO8601DateString;
41
- $attachments: null;
42
- $is_edit_allowed: boolean;
43
- $editable: boolean;
44
- $type_id: ZohoCrmTypeId;
45
- $is_delete_allowed: boolean;
46
- $note_action: ZohoCrmNoteAction;
47
- $source: ZohoCrmNoteSource;
48
- $se_module: ZohoCrmModuleName;
49
- $is_shared_to_client: boolean;
50
- Note_Owner: ZohoCrmNoteOwnerData;
51
- Created_By: ZohoCrmCreatedByData;
52
- Modified_By: ZohoCrmModifiedByData;
53
- $size: ZohoCrmNoteFileSize | null;
54
- $voice_note: boolean;
55
- $status: ZohoCrmNoteStatus;
36
+ readonly Note_Title: string;
37
+ readonly Note_Content: string;
38
+ readonly Parent_Id: ZohoCrmParentReferenceData;
39
+ readonly Created_Time: ISO8601DateString;
40
+ readonly Modified_Time: ISO8601DateString;
41
+ readonly $attachments: null;
42
+ readonly $is_edit_allowed: boolean;
43
+ readonly $editable: boolean;
44
+ readonly $type_id: ZohoCrmTypeId;
45
+ readonly $is_delete_allowed: boolean;
46
+ readonly $note_action: ZohoCrmNoteAction;
47
+ readonly $source: ZohoCrmNoteSource;
48
+ readonly $se_module: ZohoCrmModuleName;
49
+ readonly $is_shared_to_client: boolean;
50
+ readonly Note_Owner: ZohoCrmNoteOwnerData;
51
+ readonly Created_By: ZohoCrmCreatedByData;
52
+ readonly Modified_By: ZohoCrmModifiedByData;
53
+ readonly $size: ZohoCrmNoteFileSize | null;
54
+ readonly $voice_note: boolean;
55
+ readonly $status: ZohoCrmNoteStatus;
56
56
  }
57
57
  /**
58
58
  * Data required to create a new note, including the parent record reference and target module.
@@ -22,14 +22,14 @@ export type ZohoCrmTagColorCode = HexColorCode;
22
22
  * The color and name of a Tag in Zoho Crm.
23
23
  */
24
24
  export interface ZohoCrmTagData {
25
- color_code?: Maybe<ZohoCrmTagColorCode>;
26
- name: ZohoCrmTagName;
25
+ readonly color_code?: Maybe<ZohoCrmTagColorCode>;
26
+ readonly name: ZohoCrmTagName;
27
27
  }
28
28
  /**
29
29
  * Includes the id of the Tag along with other tag data.
30
30
  */
31
31
  export interface ZohoCrmTag extends ZohoCrmTagData {
32
- id: ZohoCrmTagId;
32
+ readonly id: ZohoCrmTagId;
33
33
  }
34
34
  /**
35
35
  * ZohoCrmTag that also has ZohoCrmChangeObjectDetails
@@ -59,6 +59,9 @@ export type ZohoRecruitAssociateCandidateRecordsWithJobOpeningsFunction = (input
59
59
  *
60
60
  * The result separates "already associated" errors from other errors, allowing callers to treat duplicate associations as non-fatal.
61
61
  *
62
+ * @param context - Zoho Recruit API context providing fetch and authentication
63
+ * @returns Factory function that associates candidates with job openings
64
+ *
62
65
  * https://www.zoho.com/recruit/developer-guide/apiv2/associate-candidate.html
63
66
  */
64
67
  export declare function zohoRecruitAssociateCandidateRecordsWithJobOpenings(context: ZohoRecruitContext): ZohoRecruitAssociateCandidateRecordsWithJobOpeningsFunction;
@@ -80,6 +83,9 @@ export type ZohoRecruitSearchAssociatedRecordsResponse<T = ZohoRecruitRecord> =
80
83
  export type ZohoRecruitSearchAssociatedRecordsFunction<R extends ZohoRecruitSearchAssociatedRecordsResponse> = (input: ZohoRecruitSearchAssociatedRecordsInput) => Promise<R>;
81
84
  /**
82
85
  * Searches for records associated with a given candidate or job opening. Returns an empty page result when no records are found.
86
+ *
87
+ * @param context - Zoho Recruit API context providing fetch and authentication
88
+ * @returns Factory function that searches for associated records
83
89
  */
84
90
  export declare function zohoRecruitSearchAssociatedRecords<R extends ZohoRecruitSearchAssociatedRecordsResponse>(context: ZohoRecruitContext): ZohoRecruitSearchAssociatedRecordsFunction<R>;
85
91
  /**
@@ -89,10 +95,16 @@ export type ZohoRecruitSearchCandidateAssociatedJobOpeningRecordsInput = Omit<Zo
89
95
  export type ZohoRecruitSearchCandidateAssociatedJobOpeningRecordsFunction<T extends ZohoRecruitRecord> = (input: ZohoRecruitSearchCandidateAssociatedJobOpeningRecordsInput) => Promise<ZohoRecruitSearchAssociatedRecordsResponse<T>>;
90
96
  /**
91
97
  * Searches for job openings associated with a specific candidate.
98
+ *
99
+ * @param context - Zoho Recruit API context providing fetch and authentication
100
+ * @returns Factory function that searches for job openings associated with a candidate
92
101
  */
93
102
  export declare function zohoRecruitSearchCandidateAssociatedJobOpeningRecords<T extends ZohoRecruitRecord>(context: ZohoRecruitContext): ZohoRecruitSearchCandidateAssociatedJobOpeningRecordsFunction<T>;
94
103
  /**
95
104
  * Creates a page factory for paginating over job openings associated with a candidate.
105
+ *
106
+ * @param context - Zoho Recruit API context providing fetch and authentication
107
+ * @returns Page factory for iterating through associated job openings
96
108
  */
97
109
  export declare function zohoRecruitSearchCandidateAssociatedJobOpeningRecordsPageFactory<T extends ZohoRecruitRecord>(context: ZohoRecruitContext): import("@dereekb/util/fetch").FetchPageFactory<ZohoRecruitSearchCandidateAssociatedJobOpeningRecordsInput, ZohoRecruitSearchAssociatedRecordsResponse<T>>;
98
110
  /**
@@ -102,9 +114,16 @@ export type ZohoRecruitSearchJobOpeningAssociatedCandidateRecordsInput = Omit<Zo
102
114
  export type ZohoRecruitSearchJobOpeningAssociatedCandidateRecordsFunction<T extends ZohoRecruitRecord> = (input: ZohoRecruitSearchJobOpeningAssociatedCandidateRecordsInput) => Promise<ZohoRecruitSearchAssociatedRecordsResponse<T>>;
103
115
  /**
104
116
  * Searches for candidates associated with a specific job opening.
117
+ *
118
+ * @param context - Zoho Recruit API context providing fetch and authentication
119
+ * @param jobOpeningModuleName - Module name for job openings, defaults to the standard module
120
+ * @returns Factory function that searches for candidates associated with a job opening
105
121
  */
106
122
  export declare function zohoRecruitSearchJobOpeningAssociatedCandidateRecords<T extends ZohoRecruitRecord>(context: ZohoRecruitContext, jobOpeningModuleName?: string): ZohoRecruitSearchJobOpeningAssociatedCandidateRecordsFunction<T>;
107
123
  /**
108
124
  * Creates a page factory for paginating over candidates associated with a job opening.
125
+ *
126
+ * @param context - Zoho Recruit API context providing fetch and authentication
127
+ * @returns Page factory for iterating through associated candidates
109
128
  */
110
129
  export declare function zohoRecruitSearchJobOpeningAssociatedCandidateRecordsPageFactory<T extends ZohoRecruitRecord>(context: ZohoRecruitContext): import("@dereekb/util/fetch").FetchPageFactory<ZohoRecruitSearchJobOpeningAssociatedCandidateRecordsInput, ZohoRecruitSearchAssociatedRecordsResponse<T>>;