@dereekb/zoho 13.8.0 → 13.10.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 (38) hide show
  1. package/cli/LICENSE +21 -0
  2. package/cli/index.js +8 -0
  3. package/cli/package.json +20 -0
  4. package/index.cjs.js +2537 -228
  5. package/index.esm.js +2474 -229
  6. package/nestjs/index.cjs.js +852 -191
  7. package/nestjs/index.esm.js +849 -193
  8. package/nestjs/package.json +5 -5
  9. package/nestjs/src/lib/desk/desk.api.d.ts +213 -0
  10. package/nestjs/src/lib/desk/desk.config.d.ts +27 -0
  11. package/nestjs/src/lib/desk/desk.module.d.ts +62 -0
  12. package/nestjs/src/lib/desk/index.d.ts +3 -0
  13. package/nestjs/src/lib/index.d.ts +1 -0
  14. package/package.json +12 -5
  15. package/src/lib/desk/desk.agent.d.ts +45 -0
  16. package/src/lib/desk/desk.api.activities.d.ts +43 -0
  17. package/src/lib/desk/desk.api.agents.d.ts +91 -0
  18. package/src/lib/desk/desk.api.attachments.d.ts +47 -0
  19. package/src/lib/desk/desk.api.comments.d.ts +86 -0
  20. package/src/lib/desk/desk.api.contacts.d.ts +81 -0
  21. package/src/lib/desk/desk.api.departments.d.ts +47 -0
  22. package/src/lib/desk/desk.api.followers.d.ts +57 -0
  23. package/src/lib/desk/desk.api.page.d.ts +72 -0
  24. package/src/lib/desk/desk.api.tags.d.ts +102 -0
  25. package/src/lib/desk/desk.api.threads.d.ts +60 -0
  26. package/src/lib/desk/desk.api.tickets.d.ts +227 -0
  27. package/src/lib/desk/desk.api.time.d.ts +109 -0
  28. package/src/lib/desk/desk.config.d.ts +75 -0
  29. package/src/lib/desk/desk.contact.d.ts +50 -0
  30. package/src/lib/desk/desk.d.ts +44 -0
  31. package/src/lib/desk/desk.department.d.ts +27 -0
  32. package/src/lib/desk/desk.error.api.d.ts +33 -0
  33. package/src/lib/desk/desk.factory.d.ts +47 -0
  34. package/src/lib/desk/desk.limit.d.ts +39 -0
  35. package/src/lib/desk/desk.ticket.d.ts +308 -0
  36. package/src/lib/desk/index.d.ts +21 -0
  37. package/src/lib/index.d.ts +1 -0
  38. package/src/lib/zoho.limit.d.ts +66 -10
@@ -0,0 +1,308 @@
1
+ import { type Maybe } from '@dereekb/util';
2
+ import { type ZohoDateTimeString } from '../zoho.type';
3
+ import { type ZohoDeskTicketId, type ZohoDeskContactId, type ZohoDeskProductId, type ZohoDeskDepartmentId, type ZohoDeskAgentId, type ZohoDeskTeamId, type ZohoDeskAccountId, type ZohoDeskContractId } from './desk';
4
+ /**
5
+ * High-level ticket status category in Zoho Desk.
6
+ */
7
+ export type ZohoDeskTicketStatusType = 'Open' | 'Closed' | 'On Hold';
8
+ /**
9
+ * Ticket priority level in Zoho Desk.
10
+ *
11
+ * Known values include Low, Medium, High, and Urgent. Custom priorities may also be defined.
12
+ */
13
+ export type ZohoDeskTicketPriority = 'Low' | 'Medium' | 'High' | 'Urgent' | string;
14
+ /**
15
+ * Communication channel through which a Zoho Desk ticket was created.
16
+ *
17
+ * Known values include Phone, Email, Social, Web, Chat, and Forums. Custom channels may also be present.
18
+ */
19
+ export type ZohoDeskTicketChannel = 'Phone' | 'Email' | 'Social' | 'Web' | 'Chat' | 'Forums' | string;
20
+ /**
21
+ * Fields by which Zoho Desk ticket lists can be sorted.
22
+ */
23
+ export type ZohoDeskTicketSortBy = 'ticketNumber' | 'modifiedTime' | 'customerResponseTime' | 'recentThread' | 'responseDueDate' | 'dueDate' | 'createdTime';
24
+ /**
25
+ * Related entities that can be expanded inline when fetching Zoho Desk tickets via the `include` query parameter.
26
+ */
27
+ export type ZohoDeskTicketInclude = 'isRead' | 'departments' | 'team' | 'assignee' | 'contacts' | 'products';
28
+ /**
29
+ * Describes the originating source application or service for a Zoho Desk ticket.
30
+ */
31
+ export interface ZohoDeskTicketSource {
32
+ readonly appName?: Maybe<string>;
33
+ readonly extId?: Maybe<string>;
34
+ readonly type?: Maybe<string>;
35
+ readonly permalink?: Maybe<string>;
36
+ readonly appPhotoURL?: Maybe<string>;
37
+ }
38
+ /**
39
+ * A support ticket in Zoho Desk.
40
+ *
41
+ * Contains the full set of fields returned by the Zoho Desk Tickets API.
42
+ */
43
+ export interface ZohoDeskTicket {
44
+ readonly id: ZohoDeskTicketId;
45
+ readonly ticketNumber: string;
46
+ readonly subject: string;
47
+ readonly description?: Maybe<string>;
48
+ readonly status: string;
49
+ readonly statusType: ZohoDeskTicketStatusType;
50
+ readonly priority?: Maybe<ZohoDeskTicketPriority>;
51
+ readonly classification?: Maybe<string>;
52
+ readonly category?: Maybe<string>;
53
+ readonly subCategory?: Maybe<string>;
54
+ readonly channel?: Maybe<ZohoDeskTicketChannel>;
55
+ readonly channelCode?: Maybe<string>;
56
+ readonly email?: Maybe<string>;
57
+ readonly phone?: Maybe<string>;
58
+ readonly webUrl?: Maybe<string>;
59
+ readonly sentiment?: Maybe<string>;
60
+ readonly resolution?: Maybe<string>;
61
+ readonly departmentId?: Maybe<ZohoDeskDepartmentId>;
62
+ readonly contactId?: Maybe<ZohoDeskContactId>;
63
+ readonly productId?: Maybe<ZohoDeskProductId>;
64
+ readonly accountId?: Maybe<ZohoDeskAccountId>;
65
+ readonly assigneeId?: Maybe<ZohoDeskAgentId>;
66
+ readonly teamId?: Maybe<ZohoDeskTeamId>;
67
+ readonly contractId?: Maybe<ZohoDeskContractId>;
68
+ readonly dueDate?: Maybe<ZohoDateTimeString>;
69
+ readonly responseDueDate?: Maybe<ZohoDateTimeString>;
70
+ readonly createdTime?: Maybe<ZohoDateTimeString>;
71
+ readonly modifiedTime?: Maybe<ZohoDateTimeString>;
72
+ readonly closedTime?: Maybe<ZohoDateTimeString>;
73
+ readonly onholdTime?: Maybe<ZohoDateTimeString>;
74
+ readonly customerResponseTime?: Maybe<ZohoDateTimeString>;
75
+ readonly threadCount?: Maybe<number>;
76
+ readonly commentCount?: Maybe<number>;
77
+ readonly taskCount?: Maybe<number>;
78
+ readonly sharedCount?: Maybe<number>;
79
+ readonly approvalCount?: Maybe<number>;
80
+ readonly followerCount?: Maybe<number>;
81
+ readonly tagCount?: Maybe<number>;
82
+ readonly attachmentCount?: Maybe<number>;
83
+ readonly timeEntryCount?: Maybe<number>;
84
+ readonly isTrashed?: Maybe<boolean>;
85
+ readonly isResponseOverdue?: Maybe<boolean>;
86
+ readonly isSpam?: Maybe<boolean>;
87
+ readonly isRead?: Maybe<boolean>;
88
+ readonly isDeleted?: Maybe<boolean>;
89
+ readonly isFollowing?: Maybe<boolean>;
90
+ readonly source?: Maybe<ZohoDeskTicketSource>;
91
+ readonly secondaryContacts?: Maybe<string[]>;
92
+ readonly createdBy?: Maybe<string>;
93
+ readonly modifiedBy?: Maybe<string>;
94
+ readonly product?: Maybe<Record<string, unknown>>;
95
+ readonly contact?: Maybe<Record<string, unknown>>;
96
+ readonly team?: Maybe<Record<string, unknown>>;
97
+ readonly assignee?: Maybe<Record<string, unknown>>;
98
+ readonly department?: Maybe<Record<string, unknown>>;
99
+ readonly cf?: Maybe<Record<string, unknown>>;
100
+ }
101
+ /**
102
+ * Performance and SLA metrics for a single Zoho Desk ticket, returned by the ticket metrics endpoint.
103
+ */
104
+ export interface ZohoDeskTicketMetrics {
105
+ readonly reopenCount?: Maybe<number>;
106
+ readonly firstResponseTime?: Maybe<string>;
107
+ readonly averageResponseTime?: Maybe<string>;
108
+ readonly resolutionTime?: Maybe<string>;
109
+ readonly happinessRating?: Maybe<string>;
110
+ readonly assigneeChanges?: Maybe<number>;
111
+ readonly threadCount?: Maybe<number>;
112
+ readonly responseCount?: Maybe<number>;
113
+ }
114
+ /**
115
+ * Ticket count data for a single agent, returned by the agents ticket count endpoint.
116
+ */
117
+ export interface ZohoDeskAgentTicketCount {
118
+ readonly agentId: ZohoDeskAgentId;
119
+ readonly count: number;
120
+ }
121
+ /**
122
+ * A tag associated with a Zoho Desk ticket.
123
+ */
124
+ export interface ZohoDeskTicketTag {
125
+ readonly id: string;
126
+ readonly name: string;
127
+ readonly createdTime?: Maybe<ZohoDateTimeString>;
128
+ readonly ticketCount?: Maybe<number>;
129
+ }
130
+ /**
131
+ * A follower of a Zoho Desk ticket (typically an agent).
132
+ */
133
+ export interface ZohoDeskTicketFollower {
134
+ readonly id: string;
135
+ readonly name?: Maybe<string>;
136
+ readonly email?: Maybe<string>;
137
+ readonly photoURL?: Maybe<string>;
138
+ }
139
+ /**
140
+ * Fields by which Zoho Desk ticket attachment lists can be sorted.
141
+ */
142
+ export type ZohoDeskAttachmentSortBy = 'createdTime';
143
+ /**
144
+ * Related entities that can be expanded when fetching ticket attachments.
145
+ */
146
+ export type ZohoDeskAttachmentInclude = 'creator';
147
+ /**
148
+ * A file attachment on a Zoho Desk ticket.
149
+ */
150
+ export interface ZohoDeskTicketAttachment {
151
+ readonly id: string;
152
+ readonly name: string;
153
+ readonly size?: Maybe<string>;
154
+ readonly href?: Maybe<string>;
155
+ readonly isPublic?: Maybe<boolean>;
156
+ readonly creatorId?: Maybe<string>;
157
+ readonly createdTime?: Maybe<ZohoDateTimeString>;
158
+ readonly creator?: Maybe<Record<string, unknown>>;
159
+ }
160
+ /**
161
+ * Content type of a Zoho Desk ticket comment.
162
+ */
163
+ export type ZohoDeskCommentContentType = 'plainText' | 'html';
164
+ /**
165
+ * Fields by which Zoho Desk ticket comment lists can be sorted.
166
+ */
167
+ export type ZohoDeskCommentSortBy = 'commentedTime';
168
+ /**
169
+ * Related entities that can be expanded when fetching ticket comments.
170
+ */
171
+ export type ZohoDeskCommentInclude = 'mentions';
172
+ /**
173
+ * A comment on a Zoho Desk ticket.
174
+ */
175
+ export interface ZohoDeskTicketComment {
176
+ readonly id: string;
177
+ readonly content: string;
178
+ readonly encodedContent?: Maybe<string>;
179
+ readonly contentType?: Maybe<ZohoDeskCommentContentType>;
180
+ readonly commenterId?: Maybe<string>;
181
+ readonly commentedTime?: Maybe<ZohoDateTimeString>;
182
+ readonly modifiedTime?: Maybe<ZohoDateTimeString>;
183
+ readonly isPublic?: Maybe<boolean>;
184
+ readonly attachmentIds?: Maybe<string[]>;
185
+ readonly commenter?: Maybe<Record<string, unknown>>;
186
+ readonly mentions?: Maybe<Record<string, unknown>[]>;
187
+ }
188
+ /**
189
+ * A time entry recorded against a Zoho Desk ticket.
190
+ */
191
+ export interface ZohoDeskTicketTimeEntry {
192
+ readonly id: string;
193
+ readonly ownerId?: Maybe<string>;
194
+ readonly billingType?: Maybe<string>;
195
+ readonly description?: Maybe<string>;
196
+ readonly executedTime?: Maybe<ZohoDateTimeString>;
197
+ readonly createdTime?: Maybe<ZohoDateTimeString>;
198
+ readonly hh?: Maybe<string>;
199
+ readonly mm?: Maybe<string>;
200
+ readonly requestedBy?: Maybe<string>;
201
+ readonly agentCostPerHour?: Maybe<string>;
202
+ readonly additionalCost?: Maybe<string>;
203
+ readonly totalCost?: Maybe<string>;
204
+ }
205
+ /**
206
+ * Timer state for a Zoho Desk ticket.
207
+ */
208
+ export interface ZohoDeskTicketTimer {
209
+ readonly isBillable?: Maybe<boolean>;
210
+ readonly timerAction?: Maybe<string>;
211
+ readonly startedTime?: Maybe<ZohoDateTimeString>;
212
+ }
213
+ /**
214
+ * Communication channel for a thread.
215
+ */
216
+ export type ZohoDeskThreadChannel = 'EMAIL' | 'PHONE' | 'WEB' | 'CUSTOMERPORTAL' | 'FORUMS' | 'FACEBOOK' | 'TWITTER' | 'TWITTER_DM' | 'ONLINE_CHAT' | 'OFFLINE_CHAT' | 'FEEDBACK' | 'FEEDBACK_WIDGET' | string;
217
+ /**
218
+ * Direction of a thread message relative to the support team.
219
+ */
220
+ export type ZohoDeskThreadDirection = 'in' | 'out';
221
+ /**
222
+ * Visibility of a thread to end users.
223
+ */
224
+ export type ZohoDeskThreadVisibility = 'public' | 'private';
225
+ /**
226
+ * Delivery status of a thread.
227
+ */
228
+ export type ZohoDeskThreadStatus = 'SUCCESS' | 'FAILED' | 'DRAFT' | 'PENDING';
229
+ /**
230
+ * Related entities that can be expanded when fetching threads.
231
+ */
232
+ export type ZohoDeskThreadInclude = 'plainText';
233
+ /**
234
+ * A conversation thread on a Zoho Desk ticket (email, reply, note, etc.).
235
+ */
236
+ export interface ZohoDeskTicketThread {
237
+ readonly id: string;
238
+ readonly content?: Maybe<string>;
239
+ readonly contentType?: Maybe<string>;
240
+ readonly direction?: Maybe<ZohoDeskThreadDirection>;
241
+ readonly channel?: Maybe<ZohoDeskThreadChannel>;
242
+ readonly visibility?: Maybe<ZohoDeskThreadVisibility>;
243
+ readonly status?: Maybe<ZohoDeskThreadStatus>;
244
+ readonly summary?: Maybe<string>;
245
+ readonly to?: Maybe<string>;
246
+ readonly cc?: Maybe<string>;
247
+ readonly bcc?: Maybe<string>;
248
+ readonly fromEmailAddress?: Maybe<string>;
249
+ readonly responderId?: Maybe<string>;
250
+ readonly replyTo?: Maybe<string>;
251
+ readonly fullContentURL?: Maybe<string>;
252
+ readonly isDescriptionThread?: Maybe<boolean>;
253
+ readonly isContentTruncated?: Maybe<boolean>;
254
+ readonly canReply?: Maybe<boolean>;
255
+ readonly isForward?: Maybe<boolean>;
256
+ readonly hasAttach?: Maybe<boolean>;
257
+ readonly attachmentCount?: Maybe<number>;
258
+ readonly createdTime?: Maybe<ZohoDateTimeString>;
259
+ readonly author?: Maybe<Record<string, unknown>>;
260
+ readonly source?: Maybe<Record<string, unknown>>;
261
+ readonly channelRelatedInfo?: Maybe<Record<string, unknown>>;
262
+ readonly plainText?: Maybe<string>;
263
+ readonly attachments?: Maybe<Record<string, unknown>[]>;
264
+ }
265
+ /**
266
+ * Type of activity associated with a ticket.
267
+ */
268
+ export type ZohoDeskActivityType = 'Tasks' | 'Events' | 'Calls';
269
+ /**
270
+ * Status of a ticket activity.
271
+ */
272
+ export type ZohoDeskActivityStatus = 'Scheduled' | 'Completed' | 'Missed' | 'In Progress' | 'Canceled';
273
+ /**
274
+ * Direction of a ticket activity.
275
+ */
276
+ export type ZohoDeskActivityDirection = 'inbound' | 'outbound';
277
+ /**
278
+ * Related entities that can be expanded when fetching activities.
279
+ */
280
+ export type ZohoDeskActivityInclude = 'ticket' | 'contact' | 'assignee' | 'team';
281
+ /**
282
+ * An activity (task, event, or call) associated with a Zoho Desk ticket.
283
+ */
284
+ export interface ZohoDeskTicketActivity {
285
+ readonly id: string;
286
+ readonly activityType?: Maybe<ZohoDeskActivityType>;
287
+ readonly status?: Maybe<ZohoDeskActivityStatus>;
288
+ readonly direction?: Maybe<ZohoDeskActivityDirection>;
289
+ readonly subject?: Maybe<string>;
290
+ readonly description?: Maybe<string>;
291
+ readonly category?: Maybe<string>;
292
+ readonly priority?: Maybe<string>;
293
+ readonly ticketId?: Maybe<ZohoDeskTicketId>;
294
+ readonly contactId?: Maybe<ZohoDeskContactId>;
295
+ readonly departmentId?: Maybe<ZohoDeskDepartmentId>;
296
+ readonly creatorId?: Maybe<string>;
297
+ readonly ownerId?: Maybe<string>;
298
+ readonly dueDate?: Maybe<ZohoDateTimeString>;
299
+ readonly startTime?: Maybe<ZohoDateTimeString>;
300
+ readonly createdTime?: Maybe<ZohoDateTimeString>;
301
+ readonly completedTime?: Maybe<ZohoDateTimeString>;
302
+ readonly isCommented?: Maybe<boolean>;
303
+ readonly webUrl?: Maybe<string>;
304
+ readonly ticket?: Maybe<Record<string, unknown>>;
305
+ readonly contact?: Maybe<Record<string, unknown>>;
306
+ readonly assignee?: Maybe<Record<string, unknown>>;
307
+ readonly team?: Maybe<Record<string, unknown>>;
308
+ }
@@ -0,0 +1,21 @@
1
+ export * from './desk';
2
+ export * from './desk.ticket';
3
+ export * from './desk.department';
4
+ export * from './desk.contact';
5
+ export * from './desk.agent';
6
+ export * from './desk.config';
7
+ export * from './desk.factory';
8
+ export * from './desk.error.api';
9
+ export * from './desk.limit';
10
+ export * from './desk.api.page';
11
+ export * from './desk.api.tickets';
12
+ export * from './desk.api.departments';
13
+ export * from './desk.api.contacts';
14
+ export * from './desk.api.tags';
15
+ export * from './desk.api.followers';
16
+ export * from './desk.api.attachments';
17
+ export * from './desk.api.comments';
18
+ export * from './desk.api.time';
19
+ export * from './desk.api.threads';
20
+ export * from './desk.api.activities';
21
+ export * from './desk.api.agents';
@@ -1,6 +1,7 @@
1
1
  export * from './recruit';
2
2
  export * from './crm';
3
3
  export * from './sign';
4
+ export * from './desk';
4
5
  export * from './accounts';
5
6
  export * from './zoho.error.api';
6
7
  export * from './zoho.api.page';
@@ -12,13 +12,13 @@ export interface ZohoRateLimiterRef {
12
12
  *
13
13
  * Typically used for logging or alerting. Any errors thrown by this function are silently ignored.
14
14
  */
15
- export type ZohoRateLimitedTooManyRequestsLogFunction = (headers: ZohoRateLimitHeaderDetails, response: Response, fetchResponseError?: FetchResponseError) => PromiseOrValue<void>;
15
+ export type ZohoRateLimitedTooManyRequestsLogFunction = (headers: ZohoRateLimitHeaderDetails | ZohoRateLimitResponseDetails, 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
18
  *
19
- * @param headers - Rate limit details extracted from the Zoho API response headers
19
+ * @param details - Rate limit details extracted from the Zoho API response headers
20
20
  */
21
- export declare const DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION: (headers: ZohoRateLimitHeaderDetails) => void;
21
+ export declare const DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION: (details: ZohoRateLimitHeaderDetails | ZohoRateLimitResponseDetails) => void;
22
22
  /**
23
23
  * Configuration for the Zoho rate-limited fetch handler, allowing customization of
24
24
  * the rate limit, reset period, and 429 response handling.
@@ -28,7 +28,7 @@ export interface ZohoRateLimitedFetchHandlerConfig {
28
28
  * Custom maximum number of requests allowed per reset period.
29
29
  *
30
30
  * Defaults to {@link DEFAULT_ZOHO_API_RATE_LIMIT} (100 requests).
31
- * The actual limit may be dynamically adjusted based on `X-RATELIMIT-LIMIT` response headers.
31
+ * The actual limit may be dynamically adjusted based on rate limit response headers.
32
32
  *
33
33
  * Rate limits vary by Zoho account type:
34
34
  *
@@ -51,7 +51,7 @@ export interface ZohoRateLimitedFetchHandlerConfig {
51
51
  /**
52
52
  * Optional callback invoked when a 429 Too Many Requests response is received.
53
53
  *
54
- * Defaults to {@link DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION}.
54
+ * Defaults to {@link DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION}.
55
55
  * Pass `false` to disable the callback entirely.
56
56
  */
57
57
  readonly onTooManyRequests?: ZohoRateLimitedTooManyRequestsLogFunction | false;
@@ -62,22 +62,78 @@ export interface ZohoRateLimitedFetchHandlerConfig {
62
62
  */
63
63
  export type ZohoRateLimitedFetchHandler = RateLimitedFetchHandler<ResetPeriodPromiseRateLimiter>;
64
64
  /**
65
- * Creates a {@link ZohoRateLimitedFetchHandler} that throttles outgoing requests based on
66
- * Zoho's rate limit headers (`X-RATELIMIT-LIMIT`, `X-RATELIMIT-REMAINING`, `X-RATELIMIT-RESET`).
65
+ * Service-agnostic rate limit details parsed from response headers.
67
66
  *
67
+ * Each Zoho service (CRM, Recruit, Desk, etc.) provides its own reader function
68
+ * that maps service-specific headers to this common shape.
69
+ */
70
+ export interface ZohoRateLimitResponseDetails {
71
+ /**
72
+ * Number of remaining allowed requests in the current period.
73
+ */
74
+ readonly remaining: number;
75
+ /**
76
+ * Total request limit for the current period. Optional because some services
77
+ * (e.g., Zoho Desk) do not provide this in response headers.
78
+ */
79
+ readonly limit?: Maybe<number>;
80
+ /**
81
+ * The time at which the rate limit window resets. Optional because the computation
82
+ * differs per service (e.g., CRM provides a Unix timestamp, Desk provides a Retry-After in seconds).
83
+ */
84
+ readonly resetAt?: Maybe<Date>;
85
+ }
86
+ /**
87
+ * Reads rate limit details from HTTP response headers.
88
+ * Returns null when the expected headers are absent (e.g., error responses).
89
+ */
90
+ export type ZohoReadRateLimitDetailsFunction = (headers: Headers) => Maybe<ZohoRateLimitResponseDetails>;
91
+ /**
92
+ * Configuration for {@link makeZohoRateLimitedFetchHandler}, extending the base handler config
93
+ * with a service-specific header reader function.
94
+ */
95
+ export interface MakeZohoRateLimitedFetchHandlerConfig extends ZohoRateLimitedFetchHandlerConfig {
96
+ /**
97
+ * Parses service-specific rate limit headers into the common {@link ZohoRateLimitResponseDetails} shape.
98
+ */
99
+ readonly readRateLimitDetails: ZohoReadRateLimitDetailsFunction;
100
+ }
101
+ /**
102
+ * Creates a {@link ZohoRateLimitedFetchHandler} using a configurable header reader function.
103
+ *
104
+ * This is the core rate limiter factory that all service-specific wrappers delegate to.
68
105
  * The handler uses an exponential backoff strategy with the following behavior:
69
106
  * - Rate limiting begins after 10% of the allowed requests have been made (`startLimitAt`)
70
107
  * - Wait times increase exponentially (rate 1.08) as more requests are made, capped at 10 seconds
71
- * - On each response, the limiter updates its remaining count and reset time from headers
72
- * - When the API returns a different limit than configured, the limiter dynamically adjusts
108
+ * - On each response, the limiter updates its remaining count and reset time via the provided reader
109
+ * - When the API reports a different limit than configured, the limiter dynamically adjusts
73
110
  * - On 429 responses, the request is automatically retried after the rate limiter delay
74
111
  * - The limiter is disabled when responses lack rate limit headers (e.g., error responses)
75
112
  *
113
+ * @param config - Configuration including the service-specific header reader, rate limit, reset period, and 429 handling
114
+ * @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
115
+ */
116
+ export declare function makeZohoRateLimitedFetchHandler(config: MakeZohoRateLimitedFetchHandlerConfig): ZohoRateLimitedFetchHandler;
117
+ /**
118
+ * Creates a {@link ZohoRateLimitedFetchHandler} that throttles outgoing requests based on
119
+ * Zoho's CRM/Recruit/Sign rate limit headers (`X-RATELIMIT-LIMIT`, `X-RATELIMIT-REMAINING`, `X-RATELIMIT-RESET`).
120
+ *
121
+ * This is a convenience wrapper around {@link makeZohoRateLimitedFetchHandler} pre-configured
122
+ * with the standard Zoho rate limit header reader.
123
+ *
76
124
  * @param config - Optional configuration for rate limit, reset period, and 429 handling
77
125
  * @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
78
126
  */
79
127
  export declare function zohoRateLimitedFetchHandler(config?: Maybe<ZohoRateLimitedFetchHandlerConfig>): ZohoRateLimitedFetchHandler;
128
+ /**
129
+ * Reads rate limit details from standard Zoho API response headers (`X-RATELIMIT-*`).
130
+ * Used by CRM, Recruit, and Sign services.
131
+ *
132
+ * @param headers - HTTP response headers
133
+ * @returns Parsed rate limit details, or null if headers are absent
134
+ */
135
+ export declare function zohoStandardRateLimitDetailsReader(headers: Headers): Maybe<ZohoRateLimitResponseDetails>;
80
136
  /**
81
137
  * @deprecated use DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION instead.
82
138
  */
83
- export declare const DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION: (headers: ZohoRateLimitHeaderDetails) => void;
139
+ export declare const DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION: (details: ZohoRateLimitHeaderDetails | ZohoRateLimitResponseDetails) => void;