timezest 1.1.2 → 1.1.4
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/LICENSE +8 -8
- package/README.md +31 -9
- package/{config → dist/config}/config.d.ts +3 -0
- package/{config → dist/config}/config.js +5 -2
- package/dist/config/config.js.map +1 -0
- package/dist/index.d.ts +99 -0
- package/{index.js → dist/index.js} +27 -24
- package/dist/index.js.map +1 -0
- package/{utils → dist/utils}/makePaginatedRequest.d.ts +3 -2
- package/{utils → dist/utils}/makePaginatedRequest.js +3 -2
- package/dist/utils/makePaginatedRequest.js.map +1 -0
- package/{utils → dist/utils}/makeRequest.js +30 -7
- package/dist/utils/makeRequest.js.map +1 -0
- package/dist/utils/tqlFilter.d.ts +260 -0
- package/dist/utils/tqlFilter.js +439 -0
- package/dist/utils/tqlFilter.js.map +1 -0
- package/package.json +1 -1
- package/config/config.js.map +0 -1
- package/index.d.ts +0 -97
- package/index.js.map +0 -1
- package/utils/makePaginatedRequest.js.map +0 -1
- package/utils/makeRequest.js.map +0 -1
- /package/{constants → dist/constants}/endpoints.d.ts +0 -0
- /package/{constants → dist/constants}/endpoints.js +0 -0
- /package/{constants → dist/constants}/endpoints.js.map +0 -0
- /package/{entities → dist/entities}/entities.d.ts +0 -0
- /package/{entities → dist/entities}/entities.js +0 -0
- /package/{entities → dist/entities}/entities.js.map +0 -0
- /package/{entities → dist/entities}/schemas.d.ts +0 -0
- /package/{entities → dist/entities}/schemas.js +0 -0
- /package/{entities → dist/entities}/schemas.js.map +0 -0
- /package/{utils → dist/utils}/handleError.d.ts +0 -0
- /package/{utils → dist/utils}/handleError.js +0 -0
- /package/{utils → dist/utils}/handleError.js.map +0 -0
- /package/{utils → dist/utils}/logger.d.ts +0 -0
- /package/{utils → dist/utils}/logger.js +0 -0
- /package/{utils → dist/utils}/logger.js.map +0 -0
- /package/{utils → dist/utils}/makeRequest.d.ts +0 -0
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 PNC IT
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 PNC IT
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
9
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -133,29 +133,51 @@ async function fetchAllResources() {
|
|
|
133
133
|
fetchAllResources();
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
## Retry Logic
|
|
136
|
+
## Rate Limiting and Retry Logic
|
|
137
137
|
|
|
138
|
-
The `TimeZestAPI` class includes
|
|
138
|
+
The `TimeZestAPI` class includes intelligent retry logic optimized for TimeZest's API limits. TimeZest enforces a **maximum of 180 requests in any 60-second sliding window**.
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
### Retry Strategy
|
|
141
|
+
|
|
142
|
+
When a request fails due to rate limiting (429 Too Many Requests), the library automatically retries with an optimized strategy:
|
|
143
|
+
|
|
144
|
+
- **Aggressive Exponential Backoff**: Starts at 1 second and doubles with each retry (1s, 2s, 4s, 8s, 16s, 32s, 64s...)
|
|
145
|
+
- **Jitter**: Adds ±25% random variation to retry delays to prevent a thundering herd problem when multiple clients hit rate limits simultaneously
|
|
146
|
+
- **Retry-After Header**: Always respects the `Retry-After` header from 429 responses when provided by the API
|
|
147
|
+
- **Patient by Default**: Will retry for up to 5 minutes by default, allowing time for rate limit windows to clear
|
|
148
|
+
- **Configurable**: Full control over retry behavior via configuration options
|
|
149
|
+
|
|
150
|
+
### Configuration Options
|
|
151
|
+
|
|
152
|
+
You can configure the retry behavior using the following options when initializing the class:
|
|
153
|
+
|
|
154
|
+
- **`maxRetryTimeMs`**: The maximum amount of time (in milliseconds) to spend retrying a request. Defaults to 5 minutes (300,000ms).
|
|
155
|
+
- **`maxRetryDelayMs`**: The maximum delay (in milliseconds) between individual retry attempts. Defaults to 60 seconds (60,000ms).
|
|
142
156
|
|
|
143
157
|
### Example Configuration
|
|
144
158
|
|
|
145
159
|
```typescript
|
|
146
160
|
const options = {
|
|
147
|
-
maxRetryTimeMs:
|
|
148
|
-
maxRetryDelayMs:
|
|
161
|
+
maxRetryTimeMs: 10 * 60 * 1000, // Retry for up to 10 minutes
|
|
162
|
+
maxRetryDelayMs: 60 * 1000, // Max 60 seconds between retries
|
|
163
|
+
logLevel: "debug", // See detailed retry information in logs
|
|
149
164
|
};
|
|
150
165
|
|
|
151
166
|
const timeZest = new TimeZestAPI("your-api-key", options);
|
|
152
167
|
```
|
|
153
168
|
|
|
154
|
-
###
|
|
169
|
+
### Retry Behavior Example
|
|
155
170
|
|
|
156
|
-
|
|
171
|
+
If you hit a rate limit without a `Retry-After` header, the retry delays will be:
|
|
172
|
+
- 1st retry: ~1 second (0.75-1.25s with jitter)
|
|
173
|
+
- 2nd retry: ~2 seconds (1.5-2.5s with jitter)
|
|
174
|
+
- 3rd retry: ~4 seconds (3-5s with jitter)
|
|
175
|
+
- 4th retry: ~8 seconds (6-10s with jitter)
|
|
176
|
+
- 5th retry: ~16 seconds (12-20s with jitter)
|
|
177
|
+
- 6th retry: ~32 seconds (24-40s with jitter)
|
|
178
|
+
- 7th+ retry: ~60 seconds (45-60s with jitter, capped at maxRetryDelayMs)
|
|
157
179
|
|
|
158
|
-
|
|
180
|
+
The jitter ensures that if multiple clients hit the rate limit at the same time, they won't all retry simultaneously.
|
|
159
181
|
|
|
160
182
|
## Logging
|
|
161
183
|
|
|
@@ -30,5 +30,8 @@ export interface TimeZestAPIConfig {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Default configuration for the TimeZest API client.
|
|
33
|
+
*
|
|
34
|
+
* Rate limit: 180 requests per 60 seconds (sliding window)
|
|
35
|
+
* Retry strategy: Aggressive exponential backoff with jitter
|
|
33
36
|
*/
|
|
34
37
|
export declare const CONFIG: TimeZestAPIConfig;
|
|
@@ -4,13 +4,16 @@ exports.CONFIG = void 0;
|
|
|
4
4
|
const logger_1 = require("../utils/logger");
|
|
5
5
|
/**
|
|
6
6
|
* Default configuration for the TimeZest API client.
|
|
7
|
+
*
|
|
8
|
+
* Rate limit: 180 requests per 60 seconds (sliding window)
|
|
9
|
+
* Retry strategy: Aggressive exponential backoff with jitter
|
|
7
10
|
*/
|
|
8
11
|
exports.CONFIG = {
|
|
9
12
|
logLevel: "error",
|
|
10
13
|
logger: logger_1.defaultLogger,
|
|
11
14
|
baseUrl: "https://api.timezest.com/v1",
|
|
12
|
-
maxRetryDelayMs:
|
|
13
|
-
maxRetryTimeMs:
|
|
15
|
+
maxRetryDelayMs: 60 * 1000, // 60 seconds (aligned with rate limit window)
|
|
16
|
+
maxRetryTimeMs: 5 * 60 * 1000, // 5 minutes (be patient with retries)
|
|
14
17
|
outputValidation: true,
|
|
15
18
|
};
|
|
16
19
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":";;;AAAA,4CAAkE;AAqClE;;;;;GAKG;AACU,QAAA,MAAM,GAAsB;IACvC,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,sBAAa;IACrB,OAAO,EAAE,6BAA6B;IACtC,eAAe,EAAE,EAAE,GAAG,IAAI,EAAE,8CAA8C;IAC1E,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,sCAAsC;IACrE,gBAAgB,EAAE,IAAI;CACvB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { log, LogLevel, Logger } from "./utils/logger";
|
|
2
|
+
import { TimeZestAPIConfig } from "./config/config";
|
|
3
|
+
import { Agent, Resource, AppointmentType, SchedulingRequest, Team, SchedulingRequestPost } from "./entities/entities";
|
|
4
|
+
import { TQLFilter } from "./utils/tqlFilter";
|
|
5
|
+
export { Agent, Resource, AppointmentType, SchedulingRequest, SchedulingRequestPost, Team } from "./entities/entities";
|
|
6
|
+
export { ResourceSchema, AgentSchema, AppointmentTypeSchema, SchedulingRequestSchema, TeamSchema } from "./entities/schemas";
|
|
7
|
+
export { TQL, TQLFilter } from "./utils/tqlFilter";
|
|
8
|
+
/**
|
|
9
|
+
* Options for configuring the TimeZest API.
|
|
10
|
+
*/
|
|
11
|
+
export interface TimeZestAPIOptions {
|
|
12
|
+
/** The log level for the API (e.g., 'info', 'debug'). */
|
|
13
|
+
logLevel?: LogLevel;
|
|
14
|
+
/** A custom logger implementation. */
|
|
15
|
+
logger?: Logger;
|
|
16
|
+
/** The base URL for the API. */
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
/** The maximum delay between retries, in milliseconds. */
|
|
19
|
+
maxRetryDelayMs?: number;
|
|
20
|
+
/** The maximum total retry time, in milliseconds. */
|
|
21
|
+
maxRetryTimeMs?: number;
|
|
22
|
+
/** Whether to use Zod validation for API responses. */
|
|
23
|
+
outputValidation?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents the TimeZest API client.
|
|
27
|
+
* Provides methods to interact with the TimeZest API.
|
|
28
|
+
*/
|
|
29
|
+
export declare class TimeZestAPI {
|
|
30
|
+
private config;
|
|
31
|
+
private apiKey;
|
|
32
|
+
log: log;
|
|
33
|
+
/**
|
|
34
|
+
* Creates an instance of the TimeZestAPI client.
|
|
35
|
+
* @param apiKey - The API key for authenticating with the TimeZest API.
|
|
36
|
+
* @param options - Optional configuration options for the API client.
|
|
37
|
+
*/
|
|
38
|
+
constructor(apiKey: string, options?: TimeZestAPIOptions);
|
|
39
|
+
/**
|
|
40
|
+
* Returns the API key used by this client instance.
|
|
41
|
+
* @returns {string} The API key for authenticating with the TimeZest API.
|
|
42
|
+
*/
|
|
43
|
+
getApiKey(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the configuration object for this API client instance.
|
|
46
|
+
* @returns {TimeZestAPIConfig} The configuration for the API client.
|
|
47
|
+
*/
|
|
48
|
+
getConfig(): TimeZestAPIConfig;
|
|
49
|
+
/**
|
|
50
|
+
* Fetches resources from the TimeZest API.
|
|
51
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
52
|
+
* @returns {Promise<Resource[]>} A promise that resolves to an array of resources.
|
|
53
|
+
*/
|
|
54
|
+
getResources: (filter?: TQLFilter | string | null) => Promise<Resource[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Fetches agents from the TimeZest API.
|
|
57
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
58
|
+
* @returns {Promise<Agent[]>} A promise that resolves to an array of agents.
|
|
59
|
+
*/
|
|
60
|
+
getAgents(filter?: TQLFilter | string | null): Promise<Agent[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Fetches teams from the TimeZest API.
|
|
63
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
64
|
+
* @returns {Promise<Team[]>} A promise that resolves to an array of teams.
|
|
65
|
+
*/
|
|
66
|
+
getTeams(filter?: TQLFilter | string | null): Promise<Team[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Fetches appointment types from the TimeZest API.
|
|
69
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
70
|
+
* @returns {Promise<AppointmentType[]>} A promise that resolves to an array of appointment types.
|
|
71
|
+
*/
|
|
72
|
+
getAppointmentTypes(filter?: TQLFilter | string | null): Promise<AppointmentType[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Fetches a scheduling request by its ID.
|
|
75
|
+
* @param {string} id - The ID of the scheduling request to fetch.
|
|
76
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the scheduling request.
|
|
77
|
+
*/
|
|
78
|
+
getSchedulingRequest(id: string): Promise<SchedulingRequest>;
|
|
79
|
+
/**
|
|
80
|
+
* Fetches scheduling requests from the TimeZest API.
|
|
81
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
82
|
+
* @returns {Promise<SchedulingRequest[]>} A promise that resolves to an array of scheduling requests.
|
|
83
|
+
*/
|
|
84
|
+
getSchedulingRequests(filter?: TQLFilter | string | null): Promise<SchedulingRequest[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a new scheduling request in the TimeZest API.
|
|
87
|
+
* @param {SchedulingRequestPost} data - The data for the new scheduling request.
|
|
88
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the created scheduling request.
|
|
89
|
+
*/
|
|
90
|
+
createSchedulingRequest(data: SchedulingRequestPost): Promise<SchedulingRequest>;
|
|
91
|
+
/**
|
|
92
|
+
* Validates API responses using Zod schemas if outputValidation is enabled in the config.
|
|
93
|
+
* @param {T[]} response - The API response data to validate.
|
|
94
|
+
* @param {ZodSchema} schema - The Zod schema to validate against.
|
|
95
|
+
* @returns {T[]} The validated or raw response data.
|
|
96
|
+
*/
|
|
97
|
+
private validateResponse;
|
|
98
|
+
}
|
|
99
|
+
export default TimeZestAPI;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TimeZestAPI = exports.TeamSchema = exports.SchedulingRequestSchema = exports.AppointmentTypeSchema = exports.AgentSchema = exports.ResourceSchema = void 0;
|
|
12
|
+
exports.TimeZestAPI = exports.TQLFilter = exports.TQL = exports.TeamSchema = exports.SchedulingRequestSchema = exports.AppointmentTypeSchema = exports.AgentSchema = exports.ResourceSchema = void 0;
|
|
13
13
|
const schemas_1 = require("./entities/schemas");
|
|
14
14
|
const config_1 = require("./config/config");
|
|
15
15
|
const makeRequest_1 = require("./utils/makeRequest");
|
|
@@ -22,6 +22,9 @@ Object.defineProperty(exports, "AgentSchema", { enumerable: true, get: function
|
|
|
22
22
|
Object.defineProperty(exports, "AppointmentTypeSchema", { enumerable: true, get: function () { return schemas_2.AppointmentTypeSchema; } });
|
|
23
23
|
Object.defineProperty(exports, "SchedulingRequestSchema", { enumerable: true, get: function () { return schemas_2.SchedulingRequestSchema; } });
|
|
24
24
|
Object.defineProperty(exports, "TeamSchema", { enumerable: true, get: function () { return schemas_2.TeamSchema; } });
|
|
25
|
+
var tqlFilter_1 = require("./utils/tqlFilter");
|
|
26
|
+
Object.defineProperty(exports, "TQL", { enumerable: true, get: function () { return tqlFilter_1.TQL; } });
|
|
27
|
+
Object.defineProperty(exports, "TQLFilter", { enumerable: true, get: function () { return tqlFilter_1.TQLFilter; } });
|
|
25
28
|
/**
|
|
26
29
|
* Represents the TimeZest API client.
|
|
27
30
|
* Provides methods to interact with the TimeZest API.
|
|
@@ -35,8 +38,8 @@ class TimeZestAPI {
|
|
|
35
38
|
constructor(apiKey, options) {
|
|
36
39
|
/**
|
|
37
40
|
* Fetches resources from the TimeZest API.
|
|
38
|
-
* @param filter - Optional filter string to narrow down results.
|
|
39
|
-
* @returns A promise that resolves to an array of resources.
|
|
41
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
42
|
+
* @returns {Promise<Resource[]>} A promise that resolves to an array of resources.
|
|
40
43
|
*/
|
|
41
44
|
this.getResources = (...args_1) => __awaiter(this, [...args_1], void 0, function* (filter = null) {
|
|
42
45
|
const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.RESOURCES, "GET", null, filter);
|
|
@@ -65,23 +68,23 @@ class TimeZestAPI {
|
|
|
65
68
|
this.createSchedulingRequest = (0, logger_1.withLogging)(this.createSchedulingRequest.bind(this), this, "createSchedulingRequest");
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
|
-
*
|
|
69
|
-
* @returns The API key.
|
|
71
|
+
* Returns the API key used by this client instance.
|
|
72
|
+
* @returns {string} The API key for authenticating with the TimeZest API.
|
|
70
73
|
*/
|
|
71
74
|
getApiKey() {
|
|
72
75
|
return this.apiKey;
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @returns The API client
|
|
78
|
+
* Returns the configuration object for this API client instance.
|
|
79
|
+
* @returns {TimeZestAPIConfig} The configuration for the API client.
|
|
77
80
|
*/
|
|
78
81
|
getConfig() {
|
|
79
82
|
return this.config;
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
82
85
|
* Fetches agents from the TimeZest API.
|
|
83
|
-
* @param filter - Optional filter string to narrow down results.
|
|
84
|
-
* @returns A promise that resolves to an array of agents.
|
|
86
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
87
|
+
* @returns {Promise<Agent[]>} A promise that resolves to an array of agents.
|
|
85
88
|
*/
|
|
86
89
|
getAgents() {
|
|
87
90
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -91,8 +94,8 @@ class TimeZestAPI {
|
|
|
91
94
|
}
|
|
92
95
|
/**
|
|
93
96
|
* Fetches teams from the TimeZest API.
|
|
94
|
-
* @param filter - Optional filter string to narrow down results.
|
|
95
|
-
* @returns A promise that resolves to an array of teams.
|
|
97
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
98
|
+
* @returns {Promise<Team[]>} A promise that resolves to an array of teams.
|
|
96
99
|
*/
|
|
97
100
|
getTeams() {
|
|
98
101
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -102,8 +105,8 @@ class TimeZestAPI {
|
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
104
107
|
* Fetches appointment types from the TimeZest API.
|
|
105
|
-
* @param filter - Optional filter string to narrow down results.
|
|
106
|
-
* @returns A promise that resolves to an array of appointment types.
|
|
108
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
109
|
+
* @returns {Promise<AppointmentType[]>} A promise that resolves to an array of appointment types.
|
|
107
110
|
*/
|
|
108
111
|
getAppointmentTypes() {
|
|
109
112
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -113,8 +116,8 @@ class TimeZestAPI {
|
|
|
113
116
|
}
|
|
114
117
|
/**
|
|
115
118
|
* Fetches a scheduling request by its ID.
|
|
116
|
-
* @param id - The ID of the scheduling request.
|
|
117
|
-
* @returns A promise that resolves to the scheduling request.
|
|
119
|
+
* @param {string} id - The ID of the scheduling request to fetch.
|
|
120
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the scheduling request.
|
|
118
121
|
*/
|
|
119
122
|
getSchedulingRequest(id) {
|
|
120
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -124,8 +127,8 @@ class TimeZestAPI {
|
|
|
124
127
|
}
|
|
125
128
|
/**
|
|
126
129
|
* Fetches scheduling requests from the TimeZest API.
|
|
127
|
-
* @param filter - Optional filter string to narrow down results.
|
|
128
|
-
* @returns A promise that resolves to an array of scheduling requests.
|
|
130
|
+
* @param {TQLFilter | string | null} [filter=null] - Optional filter (TQLFilter instance or string) to narrow down results.
|
|
131
|
+
* @returns {Promise<SchedulingRequest[]>} A promise that resolves to an array of scheduling requests.
|
|
129
132
|
*/
|
|
130
133
|
getSchedulingRequests() {
|
|
131
134
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -134,9 +137,9 @@ class TimeZestAPI {
|
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
137
|
-
* Creates a new scheduling request.
|
|
138
|
-
* @param data - The data for the scheduling request.
|
|
139
|
-
* @returns A promise that resolves to the created scheduling request.
|
|
140
|
+
* Creates a new scheduling request in the TimeZest API.
|
|
141
|
+
* @param {SchedulingRequestPost} data - The data for the new scheduling request.
|
|
142
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the created scheduling request.
|
|
140
143
|
*/
|
|
141
144
|
createSchedulingRequest(data) {
|
|
142
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -145,10 +148,10 @@ class TimeZestAPI {
|
|
|
145
148
|
});
|
|
146
149
|
}
|
|
147
150
|
/**
|
|
148
|
-
* Validates API responses using Zod schemas if outputValidation is enabled.
|
|
149
|
-
* @param response - The API response data to validate.
|
|
150
|
-
* @param schema - The Zod schema to validate against.
|
|
151
|
-
* @returns The validated or raw response data.
|
|
151
|
+
* Validates API responses using Zod schemas if outputValidation is enabled in the config.
|
|
152
|
+
* @param {T[]} response - The API response data to validate.
|
|
153
|
+
* @param {ZodSchema} schema - The Zod schema to validate against.
|
|
154
|
+
* @returns {T[]} The validated or raw response data.
|
|
152
155
|
*/
|
|
153
156
|
validateResponse(response, schema) {
|
|
154
157
|
if (this.config.outputValidation) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,gDAM4B;AAC5B,4CAAyC;AACzC,qDAAkD;AAClD,qDAAsD;AACtD,2CAA0D;AAC1D,uEAAoE;AAKpE,8CAA6H;AAApH,yGAAA,cAAc,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,gHAAA,qBAAqB,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AAAE,qGAAA,UAAU,OAAA;AAChG,+CAAmD;AAA1C,gGAAA,GAAG,OAAA;AAAE,sGAAA,SAAS,OAAA;AAyBvB;;;GAGG;AACH,MAAa,WAAW;IAKtB;;;;OAIG;IACH,YAAY,MAAc,EAAE,OAA4B;QA6DxD;;;;WAIG;QACH,iBAAY,GAAG,YAAsE,EAAE,iDAAjE,SAAoC,IAAI;YAC5D,MAAM,QAAQ,GAAG,MAAM,IAAA,2CAAoB,EACzC,IAAI,EACJ,yBAAa,CAAC,SAAS,EACvB,KAAK,EACL,IAAI,EACJ,MAAM,CACP,CAAC;YACF,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,wBAAc,CAAC,CAAC;QACzD,CAAC,CAAA,CAAC;QA1EA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,eAAM,CAAC,QAAQ;YAC9C,MAAM,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,KAAI,eAAM,CAAC,MAAM;YACxC,OAAO,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,eAAM,CAAC,OAAO;YAC3C,eAAe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AAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA/MD,kCA+MC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { apiEndpoint } from "../constants/endpoints";
|
|
2
2
|
import { TimeZestAPI } from "../index";
|
|
3
|
+
import { TQLFilter } from "./tqlFilter";
|
|
3
4
|
/**
|
|
4
5
|
* Makes a paginated API request.
|
|
5
6
|
* @template T - The type of the response data.
|
|
@@ -7,7 +8,7 @@ import { TimeZestAPI } from "../index";
|
|
|
7
8
|
* @param endpoint - The API endpoint to call.
|
|
8
9
|
* @param method - The HTTP method (GET or POST).
|
|
9
10
|
* @param data - The request payload.
|
|
10
|
-
* @param filter - An optional filter string.
|
|
11
|
+
* @param filter - An optional filter string or TQLFilter instance.
|
|
11
12
|
* @returns A promise that resolves to an array of response data.
|
|
12
13
|
*/
|
|
13
|
-
export declare const makePaginatedRequest: <T>(apiInstance: TimeZestAPI, endpoint: apiEndpoint, method?: "GET" | "POST", data?: any, filter?: string | null) => Promise<T[]>;
|
|
14
|
+
export declare const makePaginatedRequest: <T>(apiInstance: TimeZestAPI, endpoint: apiEndpoint, method?: "GET" | "POST", data?: any, filter?: TQLFilter | string | null) => Promise<T[]>;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.makePaginatedRequest = void 0;
|
|
13
13
|
const makeRequest_1 = require("./makeRequest");
|
|
14
14
|
const handleError_1 = require("./handleError");
|
|
15
|
+
const tqlFilter_1 = require("./tqlFilter");
|
|
15
16
|
/**
|
|
16
17
|
* Makes a paginated API request.
|
|
17
18
|
* @template T - The type of the response data.
|
|
@@ -19,7 +20,7 @@ const handleError_1 = require("./handleError");
|
|
|
19
20
|
* @param endpoint - The API endpoint to call.
|
|
20
21
|
* @param method - The HTTP method (GET or POST).
|
|
21
22
|
* @param data - The request payload.
|
|
22
|
-
* @param filter - An optional filter string.
|
|
23
|
+
* @param filter - An optional filter string or TQLFilter instance.
|
|
23
24
|
* @returns A promise that resolves to an array of response data.
|
|
24
25
|
*/
|
|
25
26
|
const makePaginatedRequest = (apiInstance_1, endpoint_1, ...args_1) => __awaiter(void 0, [apiInstance_1, endpoint_1, ...args_1], void 0, function* (apiInstance, endpoint, method = "GET", data = null, filter = null) {
|
|
@@ -31,7 +32,7 @@ const makePaginatedRequest = (apiInstance_1, endpoint_1, ...args_1) => __awaiter
|
|
|
31
32
|
try {
|
|
32
33
|
do {
|
|
33
34
|
log("debug", `Fetching page ${nextPage} for ${endpoint}`);
|
|
34
|
-
const response = yield (0, makeRequest_1.makeRequest)(log, apiKey, baseUrl, endpoint, method, Object.assign(Object.assign({}, data), { filter, page: nextPage }), maxRetryTimeMs, maxRetryDelayMs);
|
|
35
|
+
const response = yield (0, makeRequest_1.makeRequest)(log, apiKey, baseUrl, endpoint, method, Object.assign(Object.assign({}, data), { filter: (0, tqlFilter_1.normalizeFilter)(filter), page: nextPage }), maxRetryTimeMs, maxRetryDelayMs);
|
|
35
36
|
log("http", `Page ${nextPage} fetched successfully for ${endpoint}`);
|
|
36
37
|
results = results.concat(response.data);
|
|
37
38
|
nextPage = response.next_page;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makePaginatedRequest.js","sourceRoot":"","sources":["../../src/utils/makePaginatedRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4C;AAC5C,+CAA4C;AAG5C,2CAAyD;AAEzD;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,uCAMpB,EAAE,8EALhB,WAAwB,EACxB,QAAqB,EACrB,SAAyB,KAAK,EAC9B,OAAY,IAAI,EAChB,SAAoC,IAAI;IAExC,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC;IAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;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.response) === null || _a === void 0 ? void 0 : _a.status) === 429) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
// Parse Retry-After header (can be in seconds or HTTP date format)
|
|
53
|
+
let retryAfterMs;
|
|
54
|
+
const retryAfterHeader = error.response.headers["retry-after"];
|
|
55
|
+
if (retryAfterHeader) {
|
|
56
|
+
const retryAfterSeconds = parseInt(retryAfterHeader, 10);
|
|
57
|
+
if (!isNaN(retryAfterSeconds)) {
|
|
58
|
+
retryAfterMs = retryAfterSeconds * 1000;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// HTTP date format - calculate difference
|
|
62
|
+
const retryDate = new Date(retryAfterHeader);
|
|
63
|
+
retryAfterMs = Math.max(0, retryDate.getTime() - Date.now());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// No Retry-After header - use aggressive exponential backoff
|
|
68
|
+
// Start at 1 second, grow rapidly: 1s, 2s, 4s, 8s, 16s, 32s, 64s
|
|
69
|
+
const baseDelayMs = Math.pow(2, retries) * 1000;
|
|
70
|
+
// Add jitter (random ±25%) to prevent thundering herd
|
|
71
|
+
// If multiple clients hit 429 at the same time, they'll retry at different times
|
|
72
|
+
const jitterFactor = 0.75 + Math.random() * 0.5; // Random between 0.75 and 1.25
|
|
73
|
+
retryAfterMs = baseDelayMs * jitterFactor;
|
|
74
|
+
}
|
|
75
|
+
// Cap at maxRetryDelayMs
|
|
76
|
+
retryAfterMs = Math.min(maxRetryDelayMs, retryAfterMs);
|
|
77
|
+
if (totalElapsedTime + retryAfterMs >= maxRetryTimeMs) {
|
|
55
78
|
log("error", `Max retry time exceeded for ${endpoint}`);
|
|
56
79
|
break;
|
|
57
80
|
}
|
|
58
|
-
log("warn", `Rate limited on ${endpoint}. Retrying after ${
|
|
59
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
60
|
-
totalElapsedTime +=
|
|
81
|
+
log("warn", `Rate limited (429) on ${endpoint}. Retrying after ${(retryAfterMs / 1000).toFixed(2)} seconds... (attempt ${retries + 1})`);
|
|
82
|
+
yield new Promise((resolve) => setTimeout(resolve, retryAfterMs));
|
|
83
|
+
totalElapsedTime += retryAfterMs;
|
|
61
84
|
retries++;
|
|
62
85
|
}
|
|
63
86
|
else {
|
|
@@ -66,7 +89,7 @@ function makeRequest(log, apiKey, baseUrl, endpoint, method, data, maxRetryTimeM
|
|
|
66
89
|
}
|
|
67
90
|
}
|
|
68
91
|
}
|
|
69
|
-
throw new Error(`Max retry time of ${maxRetryTimeMs}
|
|
92
|
+
throw new Error(`Max retry time of ${maxRetryTimeMs / 1000} seconds exceeded for ${endpoint}`);
|
|
70
93
|
});
|
|
71
94
|
}
|
|
72
95
|
//# sourceMappingURL=makeRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeRequest.js","sourceRoot":"","sources":["../../src/utils/makeRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAkBA,kCAqFC;AAvGD,kDAA0B;AAC1B,+CAA4C;AAI5C;;;;;;;;;;;;GAYG;AACH,SAAsB,WAAW,CAC/B,GAA2D,EAC3D,MAAc,EACd,OAAe,EACf,QAAqB,EACrB,MAAsB,EACtB,IAAS,EACT,cAAsB,EACtB,eAAuB;;;QAEvB,IAAI,gBAAgB,GAAG,CAAC,CAAC;QACzB,IAAI,OAAO,GAAG,CAAC,CAAC;QAEhB,OAAO,gBAAgB,GAAG,cAAc,EAAE,CAAC;YACzC,IAAI,CAAC;gBACH,GAAG,CACD,OAAO,EACP,yBAAyB,QAAQ,kBAAkB,OAAO,EAAE,CAC7D,CAAC;gBAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;oBAC3B,GAAG,EAAE,GAAG,OAAO,GAAG,QAAQ,EAAE;oBAC5B,MAAM;oBACN,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,MAAM,EAAE;wBACjC,cAAc,EAAE,kBAAkB;qBACnC;oBACD,IAAI;iBAC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