@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.
- package/index.cjs.js +272 -92
- package/index.esm.js +272 -93
- package/nestjs/index.cjs.js +404 -90
- package/nestjs/index.esm.js +404 -90
- package/nestjs/package.json +4 -4
- package/nestjs/src/lib/accounts/accounts.service.d.ts +14 -2
- package/nestjs/src/lib/crm/crm.api.d.ts +142 -27
- package/nestjs/src/lib/crm/crm.config.d.ts +2 -0
- package/nestjs/src/lib/recruit/recruit.api.d.ts +162 -31
- package/nestjs/src/lib/recruit/recruit.config.d.ts +2 -0
- package/nestjs/src/lib/sign/sign.api.d.ts +67 -12
- package/nestjs/src/lib/sign/webhook/webhook.zoho.sign.d.ts +3 -0
- package/nestjs/src/lib/zoho.config.d.ts +26 -2
- package/package.json +3 -3
- package/src/lib/accounts/accounts.api.d.ts +9 -5
- package/src/lib/accounts/accounts.config.d.ts +12 -2
- package/src/lib/accounts/accounts.d.ts +6 -3
- package/src/lib/accounts/accounts.error.api.d.ts +13 -0
- package/src/lib/accounts/accounts.factory.d.ts +2 -2
- package/src/lib/crm/crm.api.d.ts +13 -0
- package/src/lib/crm/crm.api.notes.d.ts +15 -0
- package/src/lib/crm/crm.api.tags.d.ts +17 -8
- package/src/lib/crm/crm.config.d.ts +9 -2
- package/src/lib/crm/crm.d.ts +12 -12
- package/src/lib/crm/crm.error.api.d.ts +14 -0
- package/src/lib/crm/crm.factory.d.ts +3 -3
- package/src/lib/crm/crm.notes.d.ts +23 -23
- package/src/lib/crm/crm.tags.d.ts +3 -3
- package/src/lib/recruit/recruit.api.candidates.d.ts +19 -0
- package/src/lib/recruit/recruit.api.d.ts +10 -0
- package/src/lib/recruit/recruit.config.d.ts +9 -2
- package/src/lib/recruit/recruit.d.ts +12 -12
- package/src/lib/recruit/recruit.error.api.d.ts +14 -0
- package/src/lib/recruit/recruit.factory.d.ts +3 -3
- package/src/lib/sign/sign.config.d.ts +12 -2
- package/src/lib/sign/sign.d.ts +14 -14
- package/src/lib/sign/sign.error.api.d.ts +13 -0
- package/src/lib/sign/sign.factory.d.ts +3 -3
- package/src/lib/zoho.error.api.d.ts +25 -8
- package/src/lib/zoho.limit.d.ts +8 -1
|
@@ -933,10 +933,16 @@ export type ZohoRecruitExecuteRestApiFunctionFunction = (input: ZohoRecruitExecu
|
|
|
933
933
|
export declare function zohoRecruitExecuteRestApiFunction(context: ZohoRecruitContext): ZohoRecruitExecuteRestApiFunctionFunction;
|
|
934
934
|
/**
|
|
935
935
|
* Builds URL search params from input objects, omitting the `module` key since it is used in the URL path rather than query string.
|
|
936
|
+
*
|
|
937
|
+
* @param input - One or more objects whose key-value pairs become query parameters
|
|
938
|
+
* @returns URLSearchParams with the `module` key excluded
|
|
936
939
|
*/
|
|
937
940
|
export declare function zohoRecruitUrlSearchParamsMinusModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
|
|
938
941
|
/**
|
|
939
942
|
* Builds URL search params from input objects, omitting both `id` and `module` keys since they are used in the URL path.
|
|
943
|
+
*
|
|
944
|
+
* @param input - One or more objects whose key-value pairs become query parameters
|
|
945
|
+
* @returns URLSearchParams with `id` and `module` keys excluded
|
|
940
946
|
*/
|
|
941
947
|
export declare function zohoRecruitUrlSearchParamsMinusIdAndModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
|
|
942
948
|
/**
|
|
@@ -945,6 +951,10 @@ export declare function zohoRecruitUrlSearchParamsMinusIdAndModule(...input: May
|
|
|
945
951
|
export declare const zohoRecruitUrlSearchParams: typeof makeUrlSearchParams;
|
|
946
952
|
/**
|
|
947
953
|
* Constructs a standard {@link FetchJsonInput} for Zoho Recruit API calls with the given HTTP method and optional body.
|
|
954
|
+
*
|
|
955
|
+
* @param method - HTTP method for the request
|
|
956
|
+
* @param body - Optional JSON body to include in the request
|
|
957
|
+
* @returns Configured fetch JSON input
|
|
948
958
|
*/
|
|
949
959
|
export declare function zohoRecruitApiFetchJsonInput(method: string, body?: Maybe<FetchJsonBody>): FetchJsonInput;
|
|
950
960
|
/**
|
|
@@ -21,6 +21,9 @@ export type ZohoRecruitApiUrlKey = ZohoApiUrlKey;
|
|
|
21
21
|
export type ZohoRecruitConfigApiUrlInput = ZohoRecruitApiUrlKey | ZohoRecruitApiUrl;
|
|
22
22
|
/**
|
|
23
23
|
* Resolves an environment key or passthrough URL to the full Zoho Recruit API URL.
|
|
24
|
+
*
|
|
25
|
+
* @param input - An environment key ('sandbox' or 'production') or a full API URL
|
|
26
|
+
* @returns The resolved Zoho Recruit API URL
|
|
24
27
|
*/
|
|
25
28
|
export declare function zohoRecruitConfigApiUrl(input: ZohoRecruitConfigApiUrlInput): ZohoApiUrl;
|
|
26
29
|
/**
|
|
@@ -30,13 +33,13 @@ export type ZohoRecruitConfig = ZohoConfig;
|
|
|
30
33
|
/**
|
|
31
34
|
* Input provided to a fetch factory so it can construct an HTTP client bound to the given Recruit API URL.
|
|
32
35
|
*/
|
|
33
|
-
export interface
|
|
36
|
+
export interface ZohoRecruitFetchFactoryParams {
|
|
34
37
|
readonly apiUrl: ZohoRecruitApiUrl;
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
40
|
* Factory that produces a configured fetch client for a specific Zoho Recruit API endpoint.
|
|
38
41
|
*/
|
|
39
|
-
export type ZohoRecruitFetchFactory = FactoryWithRequiredInput<ConfiguredFetch,
|
|
42
|
+
export type ZohoRecruitFetchFactory = FactoryWithRequiredInput<ConfiguredFetch, ZohoRecruitFetchFactoryParams>;
|
|
40
43
|
/**
|
|
41
44
|
* Core context required for all Zoho Recruit API calls, bundling the HTTP client, JSON fetcher, authentication, configuration, and rate limiting.
|
|
42
45
|
*/
|
|
@@ -52,3 +55,7 @@ export interface ZohoRecruitContext extends ZohoRateLimiterRef {
|
|
|
52
55
|
export interface ZohoRecruitContextRef {
|
|
53
56
|
readonly recruitContext: ZohoRecruitContext;
|
|
54
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated use ZohoRecruitFetchFactoryParams instead.
|
|
60
|
+
*/
|
|
61
|
+
export type ZohoRecruitFetchFactoryInput = ZohoRecruitFetchFactoryParams;
|
|
@@ -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 Recruit module name.
|
|
4
4
|
*
|
|
@@ -84,15 +84,15 @@ export type ZohoRecruitDraftOrSaveState = 'draft' | 'save';
|
|
|
84
84
|
export type ZohoRecruitCommaSeparateFieldNames = CommaSeparatedString;
|
|
85
85
|
export type ZohoRecruitTrueFalseBoth = 'true' | 'false' | 'both';
|
|
86
86
|
export interface ZohoRecruitReferenceData {
|
|
87
|
-
name: string;
|
|
88
|
-
id: ZohoRecruitId;
|
|
87
|
+
readonly name: string;
|
|
88
|
+
readonly id: ZohoRecruitId;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Reference pair of a Zoho Recruit user name and id
|
|
92
92
|
*/
|
|
93
93
|
export interface ZohoRecruitUserReferenceData {
|
|
94
|
-
name: string;
|
|
95
|
-
id: ZohoRecruitUserId;
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly id: ZohoRecruitUserId;
|
|
96
96
|
}
|
|
97
97
|
export interface ZohoRecruitReferenceDataWithModule extends ZohoRecruitReferenceData, ZohoRecruitModuleNameRef {
|
|
98
98
|
}
|
|
@@ -114,11 +114,11 @@ export type ZohoRecruitValidUrl = WebsiteUrl;
|
|
|
114
114
|
* Update details returned by the server for a created/updated object.
|
|
115
115
|
*/
|
|
116
116
|
export interface ZohoRecruitChangeObjectDetails {
|
|
117
|
-
id: ZohoRecruitRecordId;
|
|
118
|
-
Modified_Time: ISO8601DateString;
|
|
119
|
-
Modified_By: ZohoRecruitCreatedByData;
|
|
120
|
-
Created_Time: ISO8601DateString;
|
|
121
|
-
Created_By: ZohoRecruitCreatedByData;
|
|
117
|
+
readonly id: ZohoRecruitRecordId;
|
|
118
|
+
readonly Modified_Time: ISO8601DateString;
|
|
119
|
+
readonly Modified_By: ZohoRecruitCreatedByData;
|
|
120
|
+
readonly Created_Time: ISO8601DateString;
|
|
121
|
+
readonly Created_By: ZohoRecruitCreatedByData;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* Base Zoho Recruit field data type.
|
|
@@ -267,7 +267,7 @@ export interface ZohoRecruitRecordAttachmentMetadata {
|
|
|
267
267
|
/**
|
|
268
268
|
* Direct URL to the attachment, when available
|
|
269
269
|
*/
|
|
270
|
-
Attachment_URL:
|
|
270
|
+
Attachment_URL: Maybe<WebsiteUrl>;
|
|
271
271
|
/**
|
|
272
272
|
* User who last modified this attachment
|
|
273
273
|
*/
|
|
@@ -291,7 +291,7 @@ export interface ZohoRecruitRecordAttachmentMetadata {
|
|
|
291
291
|
/**
|
|
292
292
|
* Link URL when the attachment is a link
|
|
293
293
|
*/
|
|
294
|
-
$link_url?:
|
|
294
|
+
$link_url?: Maybe<WebsiteUrl>;
|
|
295
295
|
/**
|
|
296
296
|
* Number of linked documents
|
|
297
297
|
*/
|
|
@@ -49,10 +49,17 @@ export declare class ZohoRecruitRecordCrudNoMatchingRecordError extends ZohoRecr
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Creates a typed CRUD error subclass based on the error code returned by the Zoho Recruit API, enabling callers to catch specific failure modes.
|
|
52
|
+
*
|
|
53
|
+
* @param error - Structured error data from the Zoho Recruit API response
|
|
54
|
+
* @returns A specific CRUD error subclass matching the error code
|
|
52
55
|
*/
|
|
53
56
|
export declare function zohoRecruitRecordCrudError(error: ZohoServerErrorDataWithDetails): ZohoRecruitRecordCrudError;
|
|
54
57
|
/**
|
|
55
58
|
* Returns an assertion function that throws {@link ZohoRecruitRecordNoContentError} when the data array result is empty or null, indicating the requested record does not exist.
|
|
59
|
+
*
|
|
60
|
+
* @param moduleName - Optional module name for the error context
|
|
61
|
+
* @param recordId - Optional record ID for the error context
|
|
62
|
+
* @returns Assertion function that validates the data array is non-empty
|
|
56
63
|
*/
|
|
57
64
|
export declare function assertZohoRecruitRecordDataArrayResultHasContent<T>(moduleName?: ZohoRecruitModuleName, recordId?: ZohoRecruitRecordId): <R extends ZohoDataArrayResultRef<T>>(x: R) => R;
|
|
58
65
|
/**
|
|
@@ -61,10 +68,17 @@ export declare function assertZohoRecruitRecordDataArrayResultHasContent<T>(modu
|
|
|
61
68
|
export declare const logZohoRecruitErrorToConsole: import("..").LogZohoServerErrorFunction;
|
|
62
69
|
/**
|
|
63
70
|
* Parses the JSON body of a failed Zoho Recruit fetch response into a structured error, returning undefined if the body cannot be parsed.
|
|
71
|
+
*
|
|
72
|
+
* @param responseError - The fetch response error to parse
|
|
73
|
+
* @returns Parsed Zoho server error, or undefined if parsing fails
|
|
64
74
|
*/
|
|
65
75
|
export declare function parseZohoRecruitError(responseError: FetchResponseError): Promise<ParsedZohoServerError>;
|
|
66
76
|
/**
|
|
67
77
|
* Converts raw Zoho Recruit error response data into a parsed error, delegating to Recruit-specific handlers for known error codes and falling back to the shared Zoho parser.
|
|
78
|
+
*
|
|
79
|
+
* @param errorResponseData - Raw error response data from the Zoho Recruit API
|
|
80
|
+
* @param responseError - The underlying fetch response error
|
|
81
|
+
* @returns Parsed Zoho server error, or undefined if the data contains no recognizable error
|
|
68
82
|
*/
|
|
69
83
|
export declare function parseZohoRecruitServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData, responseError: FetchResponseError): ParsedZohoServerError;
|
|
70
84
|
/**
|
|
@@ -15,16 +15,16 @@ export interface ZohoRecruitFactoryConfig 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?: ZohoRecruitFetchFactory;
|
|
23
|
+
readonly fetchFactory?: ZohoRecruitFetchFactory;
|
|
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 ZohoRecruit} client from a {@link ZohoRecruitConfig}.
|
|
@@ -7,12 +7,18 @@ export declare const ZOHO_SIGN_SERVICE_NAME: ZohoApiServiceName | ZohoServiceAcc
|
|
|
7
7
|
export type ZohoSignApiUrl = ZohoApiUrl;
|
|
8
8
|
export type ZohoSignApiUrlKey = ZohoApiUrlKey;
|
|
9
9
|
export type ZohoSignConfigApiUrlInput = ZohoSignApiUrlKey | ZohoSignApiUrl;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves an environment key or passthrough URL to the full Zoho Sign API URL.
|
|
12
|
+
*
|
|
13
|
+
* @param input - An environment key ('sandbox' or 'production') or a full API URL
|
|
14
|
+
* @returns The resolved Zoho Sign API URL
|
|
15
|
+
*/
|
|
10
16
|
export declare function zohoSignConfigApiUrl(input: ZohoSignConfigApiUrlInput): ZohoApiUrl;
|
|
11
17
|
export type ZohoSignConfig = ZohoConfig;
|
|
12
|
-
export interface
|
|
18
|
+
export interface ZohoSignFetchFactoryParams {
|
|
13
19
|
readonly apiUrl: ZohoSignApiUrl;
|
|
14
20
|
}
|
|
15
|
-
export type ZohoSignFetchFactory = FactoryWithRequiredInput<ConfiguredFetch,
|
|
21
|
+
export type ZohoSignFetchFactory = FactoryWithRequiredInput<ConfiguredFetch, ZohoSignFetchFactoryParams>;
|
|
16
22
|
export interface ZohoSignContext extends ZohoRateLimiterRef {
|
|
17
23
|
readonly fetch: ConfiguredFetch;
|
|
18
24
|
readonly fetchJson: FetchJsonFunction;
|
|
@@ -22,3 +28,7 @@ export interface ZohoSignContext extends ZohoRateLimiterRef {
|
|
|
22
28
|
export interface ZohoSignContextRef {
|
|
23
29
|
readonly signContext: ZohoSignContext;
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated use ZohoSignFetchFactoryParams instead.
|
|
33
|
+
*/
|
|
34
|
+
export type ZohoSignFetchFactoryInput = ZohoSignFetchFactoryParams;
|
package/src/lib/sign/sign.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EmailAddress } from '@dereekb/util';
|
|
1
|
+
import { type EmailAddress, type FileSize, type HexColorCode, type PageNumber, type Pixels, type UnixDateTimeMillisecondsNumber } from '@dereekb/util';
|
|
2
2
|
/**
|
|
3
3
|
* An identifier in Zoho Sign.
|
|
4
4
|
*/
|
|
@@ -64,8 +64,8 @@ export interface ZohoSignFieldType {
|
|
|
64
64
|
* Text styling properties for a field.
|
|
65
65
|
*/
|
|
66
66
|
export interface ZohoSignTextProperty {
|
|
67
|
-
readonly font_size?:
|
|
68
|
-
readonly font_color?:
|
|
67
|
+
readonly font_size?: Pixels;
|
|
68
|
+
readonly font_color?: HexColorCode;
|
|
69
69
|
readonly font?: string;
|
|
70
70
|
readonly is_italic?: boolean;
|
|
71
71
|
readonly is_underline?: boolean;
|
|
@@ -94,11 +94,11 @@ export interface ZohoSignField {
|
|
|
94
94
|
readonly document_id?: ZohoSignDocumentId;
|
|
95
95
|
readonly action_id?: ZohoSignActionId;
|
|
96
96
|
readonly is_mandatory?: boolean;
|
|
97
|
-
readonly x_coord?:
|
|
98
|
-
readonly y_coord?:
|
|
99
|
-
readonly abs_width?:
|
|
100
|
-
readonly abs_height?:
|
|
101
|
-
readonly page_no?:
|
|
97
|
+
readonly x_coord?: Pixels;
|
|
98
|
+
readonly y_coord?: Pixels;
|
|
99
|
+
readonly abs_width?: Pixels;
|
|
100
|
+
readonly abs_height?: Pixels;
|
|
101
|
+
readonly page_no?: PageNumber;
|
|
102
102
|
readonly default_value?: string;
|
|
103
103
|
readonly is_read_only?: boolean;
|
|
104
104
|
readonly name_format?: ZohoSignNameFormat;
|
|
@@ -138,7 +138,7 @@ export interface ZohoSignActionFields {
|
|
|
138
138
|
export interface ZohoSignDocument {
|
|
139
139
|
readonly document_id: ZohoSignDocumentId;
|
|
140
140
|
readonly document_name?: string;
|
|
141
|
-
readonly document_size?:
|
|
141
|
+
readonly document_size?: FileSize;
|
|
142
142
|
readonly total_pages?: number;
|
|
143
143
|
readonly document_order?: string;
|
|
144
144
|
}
|
|
@@ -157,11 +157,11 @@ export interface ZohoSignRequest {
|
|
|
157
157
|
readonly owner_last_name?: string;
|
|
158
158
|
readonly description?: string;
|
|
159
159
|
readonly notes?: string;
|
|
160
|
-
readonly created_time?:
|
|
161
|
-
readonly modified_time?:
|
|
162
|
-
readonly action_time?:
|
|
163
|
-
readonly sign_submitted_time?:
|
|
164
|
-
readonly expire_by?:
|
|
160
|
+
readonly created_time?: UnixDateTimeMillisecondsNumber;
|
|
161
|
+
readonly modified_time?: UnixDateTimeMillisecondsNumber;
|
|
162
|
+
readonly action_time?: UnixDateTimeMillisecondsNumber;
|
|
163
|
+
readonly sign_submitted_time?: UnixDateTimeMillisecondsNumber;
|
|
164
|
+
readonly expire_by?: UnixDateTimeMillisecondsNumber;
|
|
165
165
|
readonly expiration_days?: number;
|
|
166
166
|
readonly sign_percentage?: number;
|
|
167
167
|
readonly email_reminders?: boolean;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { type FetchResponseError } from '@dereekb/util/fetch';
|
|
2
2
|
import { type ZohoServerErrorResponseData, type ParsedZohoServerError, type ZohoServerErrorResponseDataArrayRef } from '../zoho.error.api';
|
|
3
3
|
export declare const logZohoSignErrorToConsole: import("..").LogZohoServerErrorFunction;
|
|
4
|
+
/**
|
|
5
|
+
* Parses the JSON body of a failed Zoho Sign fetch response into a structured error, returning undefined if the body cannot be parsed.
|
|
6
|
+
*
|
|
7
|
+
* @param responseError - The fetch response error to parse
|
|
8
|
+
* @returns Parsed Zoho server error, or undefined if parsing fails
|
|
9
|
+
*/
|
|
4
10
|
export declare function parseZohoSignError(responseError: FetchResponseError): Promise<ParsedZohoServerError>;
|
|
11
|
+
/**
|
|
12
|
+
* Converts raw Zoho Sign error response data into a parsed error, delegating to Sign-specific handlers for known error codes and falling back to the shared Zoho parser.
|
|
13
|
+
*
|
|
14
|
+
* @param errorResponseData - Raw error response data from the Zoho Sign API
|
|
15
|
+
* @param responseError - The underlying fetch response error
|
|
16
|
+
* @returns Parsed Zoho server error, or undefined if the data contains no recognizable error
|
|
17
|
+
*/
|
|
5
18
|
export declare function parseZohoSignServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataArrayRef, responseError: FetchResponseError): ParsedZohoServerError;
|
|
6
19
|
export declare const interceptZohoSign200StatusWithErrorResponse: import("@dereekb/util/fetch").FetchJsonInterceptJsonResponseFunction;
|
|
7
20
|
export declare const handleZohoSignErrorFetch: import("..").HandleZohoErrorFetchFactory;
|
|
@@ -15,16 +15,16 @@ export interface ZohoSignFactoryConfig 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?: ZohoSignFetchFactory;
|
|
23
|
+
readonly fetchFactory?: ZohoSignFetchFactory;
|
|
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 ZohoSign} client from a {@link ZohoSignConfig}.
|
|
@@ -76,6 +76,12 @@ export type ZohoServerSuccessData<T = unknown> = Omit<ZohoServerErrorData<T>, 'c
|
|
|
76
76
|
* Contains details and a status
|
|
77
77
|
*/
|
|
78
78
|
export type ZohoServerErrorDataWithDetails<T = unknown> = Required<ZohoServerErrorData<T>>;
|
|
79
|
+
/**
|
|
80
|
+
* Normalizes a Zoho error response entry into a consistent {@link ZohoServerErrorData} shape, handling both object and string error formats.
|
|
81
|
+
*
|
|
82
|
+
* @param error - The raw error entry, either a structured object or a plain error code string
|
|
83
|
+
* @returns Normalized error data with code and message fields
|
|
84
|
+
*/
|
|
79
85
|
export declare function zohoServerErrorData(error: ZohoServerErrorResponseDataError): ZohoServerErrorData;
|
|
80
86
|
/**
|
|
81
87
|
* Zoho Server Error
|
|
@@ -117,8 +123,9 @@ export interface LogZohoServerErrorFunctionConfig {
|
|
|
117
123
|
/**
|
|
118
124
|
* Creates a logZohoServerErrorFunction that logs the error to console.
|
|
119
125
|
*
|
|
120
|
-
* @param zohoApiNamePrefix Prefix to use when logging
|
|
121
|
-
* @
|
|
126
|
+
* @param zohoApiNamePrefix - Prefix to use when logging (e.g. 'ZohoRecruit', 'ZohoSign')
|
|
127
|
+
* @param options - Optional configuration for controlling which error types are logged
|
|
128
|
+
* @returns A function that logs Zoho server errors to the console
|
|
122
129
|
*/
|
|
123
130
|
export declare function logZohoServerErrorFunction(zohoApiNamePrefix: string, options?: LogZohoServerErrorFunctionConfig): LogZohoServerErrorFunction;
|
|
124
131
|
/**
|
|
@@ -128,18 +135,22 @@ export declare function logZohoServerErrorFunction(zohoApiNamePrefix: string, op
|
|
|
128
135
|
* @returns
|
|
129
136
|
*/
|
|
130
137
|
export type HandleZohoErrorFetchFactory = (fetch: ConfiguredFetch, logError?: LogZohoServerErrorFunction, onError?: (error: ParsedZohoServerError) => void) => ConfiguredFetch;
|
|
131
|
-
export type ParsedZohoServerError = FetchRequestFactoryError | ZohoServerError
|
|
138
|
+
export type ParsedZohoServerError = Maybe<FetchRequestFactoryError | ZohoServerError>;
|
|
132
139
|
export type ParseZohoFetchResponseErrorFunction = (responseError: FetchResponseError) => Promise<ParsedZohoServerError>;
|
|
133
140
|
/**
|
|
134
141
|
* Wraps a ConfiguredFetch to support handling errors returned by fetch.
|
|
135
142
|
*
|
|
136
|
-
* @param fetch
|
|
137
|
-
* @
|
|
143
|
+
* @param parseZohoError - Function that parses a fetch response error into a Zoho-specific error
|
|
144
|
+
* @param defaultLogError - Default error logging function used when no custom logger is provided
|
|
145
|
+
* @returns Factory that wraps a ConfiguredFetch with Zoho error handling
|
|
138
146
|
*/
|
|
139
147
|
export declare function handleZohoErrorFetchFactory(parseZohoError: ParseZohoFetchResponseErrorFunction, defaultLogError: LogZohoServerErrorFunction): HandleZohoErrorFetchFactory;
|
|
140
148
|
export type ParseZohoServerErrorResponseData = (zohoServerErrorResponseData: ZohoServerErrorResponseData, fetchResponseError: FetchResponseError) => ParsedZohoServerError;
|
|
141
149
|
/**
|
|
142
150
|
* FetchJsonInterceptJsonResponseFunction that intercepts a 200 response that actually contains a ZohoServerError and throws a ZohoServerError for the error handling to catch.
|
|
151
|
+
*
|
|
152
|
+
* @param parseZohoServerErrorResponseData - Function that parses raw error response data into a structured error
|
|
153
|
+
* @returns Interceptor function that detects and throws hidden errors in 200 responses
|
|
143
154
|
*/
|
|
144
155
|
export declare function interceptZohoErrorResponseFactory(parseZohoServerErrorResponseData: ParseZohoServerErrorResponseData): FetchJsonInterceptJsonResponseFunction;
|
|
145
156
|
/**
|
|
@@ -229,6 +240,12 @@ export interface ZohoRateLimitHeaderDetails {
|
|
|
229
240
|
*/
|
|
230
241
|
readonly resetAt: Date;
|
|
231
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Extracts rate limit details from Zoho API response headers, returning null if the headers are absent.
|
|
245
|
+
*
|
|
246
|
+
* @param headers - HTTP response headers from a Zoho API call
|
|
247
|
+
* @returns Parsed rate limit details, or null if rate limit headers are missing
|
|
248
|
+
*/
|
|
232
249
|
export declare function zohoRateLimitHeaderDetails(headers: Headers): Maybe<ZohoRateLimitHeaderDetails>;
|
|
233
250
|
export declare class ZohoTooManyRequestsError extends ZohoServerFetchResponseError {
|
|
234
251
|
get headerDetails(): Maybe<ZohoRateLimitHeaderDetails>;
|
|
@@ -236,9 +253,9 @@ export declare class ZohoTooManyRequestsError extends ZohoServerFetchResponseErr
|
|
|
236
253
|
/**
|
|
237
254
|
* Function that parses/transforms a ZohoServerErrorResponseData into a general ZohoServerError or other known error type.
|
|
238
255
|
*
|
|
239
|
-
* @param errorResponseData
|
|
240
|
-
* @param responseError
|
|
241
|
-
* @returns
|
|
256
|
+
* @param errorResponseData - Raw error response data from the Zoho API
|
|
257
|
+
* @param responseError - The underlying fetch response error
|
|
258
|
+
* @returns A typed Zoho server error, or undefined if no error is found
|
|
242
259
|
*/
|
|
243
260
|
export declare function parseZohoServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataArrayRef, responseError: FetchResponseError): ZohoServerFetchResponseError | undefined;
|
|
244
261
|
/**
|
package/src/lib/zoho.limit.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ export interface ZohoRateLimiterRef {
|
|
|
15
15
|
export type ZohoRateLimitedTooManyRequestsLogFunction = (headers: ZohoRateLimitHeaderDetails, response: Response, fetchResponseError?: FetchResponseError) => PromiseOrValue<void>;
|
|
16
16
|
/**
|
|
17
17
|
* Default handler that logs a warning to the console when the Zoho API rate limit is exceeded.
|
|
18
|
+
*
|
|
19
|
+
* @param headers - Rate limit details extracted from the Zoho API response headers
|
|
18
20
|
*/
|
|
19
|
-
export declare const
|
|
21
|
+
export declare const DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION: (headers: ZohoRateLimitHeaderDetails) => void;
|
|
20
22
|
/**
|
|
21
23
|
* Configuration for the Zoho rate-limited fetch handler, allowing customization of
|
|
22
24
|
* the rate limit, reset period, and 429 response handling.
|
|
@@ -29,6 +31,7 @@ export interface ZohoRateLimitedFetchHandlerConfig {
|
|
|
29
31
|
* The actual limit may be dynamically adjusted based on `X-RATELIMIT-LIMIT` response headers.
|
|
30
32
|
*
|
|
31
33
|
* Rate limits vary by Zoho account type:
|
|
34
|
+
*
|
|
32
35
|
* @see https://help.zoho.com/portal/en/community/topic/key-changes-in-api-limits-26-9-2018#:~:text=X%2DRATELIMIT%2DREMAINING%20%2D%20Represents,time%20of%20the%20current%20window.&text=Please%20note%20that%20these%20Rate,API%20limit%20changes%20are%20implemented.
|
|
33
36
|
*/
|
|
34
37
|
readonly maxRateLimit?: number;
|
|
@@ -67,3 +70,7 @@ export type ZohoRateLimitedFetchHandler = RateLimitedFetchHandler<ResetPeriodPro
|
|
|
67
70
|
* @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
|
|
68
71
|
*/
|
|
69
72
|
export declare function zohoRateLimitedFetchHandler(config?: Maybe<ZohoRateLimitedFetchHandlerConfig>): ZohoRateLimitedFetchHandler;
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated use DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION instead.
|
|
75
|
+
*/
|
|
76
|
+
export declare const DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION: (headers: ZohoRateLimitHeaderDetails) => void;
|