timezest 1.0.2 → 1.0.3
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/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +12 -0
- package/dist/config/config.js.map +1 -0
- package/dist/constants/endpoints.d.ts +2 -0
- package/dist/constants/endpoints.js +11 -0
- package/dist/constants/endpoints.js.map +1 -0
- package/dist/entities/schemas.d.ts +245 -0
- package/dist/entities/schemas.js +83 -0
- package/dist/entities/schemas.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/handleError.d.ts +2 -0
- package/dist/utils/handleError.js +32 -0
- package/dist/utils/handleError.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.js +62 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/makePaginatedRequest.d.ts +2 -0
- package/dist/utils/makePaginatedRequest.js +39 -0
- package/dist/utils/makePaginatedRequest.js.map +1 -0
- package/dist/utils/makeRequest.d.ts +2 -0
- package/dist/utils/makeRequest.js +58 -0
- package/dist/utils/makeRequest.js.map +1 -0
- package/package.json +2 -4
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.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG = void 0;
|
|
4
|
+
const logger_1 = require("../utils/logger");
|
|
5
|
+
exports.CONFIG = {
|
|
6
|
+
logLevel: "error",
|
|
7
|
+
logger: logger_1.defaultLogger,
|
|
8
|
+
baseUrl: "https://api.timezest.com/v1",
|
|
9
|
+
maxRetryDelayMs: 1.5 * 60 * 1000, // 1.5 minutes
|
|
10
|
+
maxRetryTimeMs: 15 * 1000, // 15 seconds
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAGnC,QAAA,MAAM,GAAsB;IACvC,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,sBAAa;IACrB,OAAO,EAAE,6BAA6B;IACtC,eAAe,EAAE,GAAG,GAAG,EAAE,GAAG,IAAI,EAAE,cAAc;IAChD,cAAc,EAAE,EAAE,GAAG,IAAI,EAAE,aAAa;CACzC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_ENDPOINTS = void 0;
|
|
4
|
+
exports.API_ENDPOINTS = {
|
|
5
|
+
RESOURCES: "/resources",
|
|
6
|
+
AGENTS: "/agents",
|
|
7
|
+
TEAMS: "/teams",
|
|
8
|
+
APPOINTMENT_TYPES: "/appointment_types",
|
|
9
|
+
SCHEDULING_REQUESTS: "/scheduling_requests",
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../src/constants/endpoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAiB;IACzC,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,QAAQ;IACf,iBAAiB,EAAE,oBAAoB;IACvC,mBAAmB,EAAE,sBAAsB;CAC5C,CAAC"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AgentSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
object: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
email: z.ZodString;
|
|
7
|
+
role: z.ZodString;
|
|
8
|
+
schedulable: z.ZodBoolean;
|
|
9
|
+
two_factor_enabled: z.ZodBoolean;
|
|
10
|
+
url_slug: z.ZodString;
|
|
11
|
+
created_at: z.ZodNumber;
|
|
12
|
+
updated_at: z.ZodNumber;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
object: string;
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
email: string;
|
|
18
|
+
role: string;
|
|
19
|
+
schedulable: boolean;
|
|
20
|
+
two_factor_enabled: boolean;
|
|
21
|
+
url_slug: string;
|
|
22
|
+
created_at: number;
|
|
23
|
+
updated_at: number;
|
|
24
|
+
}, {
|
|
25
|
+
object: string;
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
email: string;
|
|
29
|
+
role: string;
|
|
30
|
+
schedulable: boolean;
|
|
31
|
+
two_factor_enabled: boolean;
|
|
32
|
+
url_slug: string;
|
|
33
|
+
created_at: number;
|
|
34
|
+
updated_at: number;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const AppointmentTypeSchema: z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
object: z.ZodString;
|
|
39
|
+
internal_name: z.ZodString;
|
|
40
|
+
external_name: z.ZodString;
|
|
41
|
+
duration_mins: z.ZodNumber;
|
|
42
|
+
url_slug: z.ZodString;
|
|
43
|
+
created_at: z.ZodNumber;
|
|
44
|
+
updated_at: z.ZodNumber;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
object: string;
|
|
47
|
+
id: string;
|
|
48
|
+
url_slug: string;
|
|
49
|
+
created_at: number;
|
|
50
|
+
updated_at: number;
|
|
51
|
+
internal_name: string;
|
|
52
|
+
external_name: string;
|
|
53
|
+
duration_mins: number;
|
|
54
|
+
}, {
|
|
55
|
+
object: string;
|
|
56
|
+
id: string;
|
|
57
|
+
url_slug: string;
|
|
58
|
+
created_at: number;
|
|
59
|
+
updated_at: number;
|
|
60
|
+
internal_name: string;
|
|
61
|
+
external_name: string;
|
|
62
|
+
duration_mins: number;
|
|
63
|
+
}>;
|
|
64
|
+
export declare const ResourceSchema: z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
object: z.ZodString;
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
email: z.ZodString;
|
|
69
|
+
role: z.ZodString;
|
|
70
|
+
schedulable: z.ZodBoolean;
|
|
71
|
+
two_factor_enabled: z.ZodBoolean;
|
|
72
|
+
url_slug: z.ZodString;
|
|
73
|
+
created_at: z.ZodNumber;
|
|
74
|
+
updated_at: z.ZodNumber;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
object: string;
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
email: string;
|
|
80
|
+
role: string;
|
|
81
|
+
schedulable: boolean;
|
|
82
|
+
two_factor_enabled: boolean;
|
|
83
|
+
url_slug: string;
|
|
84
|
+
created_at: number;
|
|
85
|
+
updated_at: number;
|
|
86
|
+
}, {
|
|
87
|
+
object: string;
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
email: string;
|
|
91
|
+
role: string;
|
|
92
|
+
schedulable: boolean;
|
|
93
|
+
two_factor_enabled: boolean;
|
|
94
|
+
url_slug: string;
|
|
95
|
+
created_at: number;
|
|
96
|
+
updated_at: number;
|
|
97
|
+
}>;
|
|
98
|
+
export declare const SchedulingRequestSchema: z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
object: z.ZodString;
|
|
101
|
+
appointment_type_id: z.ZodString;
|
|
102
|
+
end_user_email: z.ZodString;
|
|
103
|
+
end_user_name: z.ZodString;
|
|
104
|
+
associated_entities: z.ZodArray<z.ZodObject<{
|
|
105
|
+
type: z.ZodString;
|
|
106
|
+
id: z.ZodNumber;
|
|
107
|
+
number: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
id: number;
|
|
110
|
+
type: string;
|
|
111
|
+
number?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
id: number;
|
|
114
|
+
type: string;
|
|
115
|
+
number?: string | undefined;
|
|
116
|
+
}>, "many">;
|
|
117
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
118
|
+
type: z.ZodString;
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
name: z.ZodString;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
id: string;
|
|
123
|
+
name: string;
|
|
124
|
+
type: string;
|
|
125
|
+
}, {
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
type: string;
|
|
129
|
+
}>, "many">;
|
|
130
|
+
scheduled_agents: z.ZodArray<z.ZodUnknown, "many">;
|
|
131
|
+
scheduled_at: z.ZodNumber;
|
|
132
|
+
scheduling_url: z.ZodString;
|
|
133
|
+
selected_start_time: z.ZodNumber;
|
|
134
|
+
selected_time_zone: z.ZodString;
|
|
135
|
+
status: z.ZodString;
|
|
136
|
+
created_at: z.ZodNumber;
|
|
137
|
+
updated_at: z.ZodNumber;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
object: string;
|
|
140
|
+
id: string;
|
|
141
|
+
created_at: number;
|
|
142
|
+
updated_at: number;
|
|
143
|
+
status: string;
|
|
144
|
+
appointment_type_id: string;
|
|
145
|
+
end_user_email: string;
|
|
146
|
+
end_user_name: string;
|
|
147
|
+
associated_entities: {
|
|
148
|
+
id: number;
|
|
149
|
+
type: string;
|
|
150
|
+
number?: string | undefined;
|
|
151
|
+
}[];
|
|
152
|
+
resources: {
|
|
153
|
+
id: string;
|
|
154
|
+
name: string;
|
|
155
|
+
type: string;
|
|
156
|
+
}[];
|
|
157
|
+
scheduled_agents: unknown[];
|
|
158
|
+
scheduled_at: number;
|
|
159
|
+
scheduling_url: string;
|
|
160
|
+
selected_start_time: number;
|
|
161
|
+
selected_time_zone: string;
|
|
162
|
+
}, {
|
|
163
|
+
object: string;
|
|
164
|
+
id: string;
|
|
165
|
+
created_at: number;
|
|
166
|
+
updated_at: number;
|
|
167
|
+
status: string;
|
|
168
|
+
appointment_type_id: string;
|
|
169
|
+
end_user_email: string;
|
|
170
|
+
end_user_name: string;
|
|
171
|
+
associated_entities: {
|
|
172
|
+
id: number;
|
|
173
|
+
type: string;
|
|
174
|
+
number?: string | undefined;
|
|
175
|
+
}[];
|
|
176
|
+
resources: {
|
|
177
|
+
id: string;
|
|
178
|
+
name: string;
|
|
179
|
+
type: string;
|
|
180
|
+
}[];
|
|
181
|
+
scheduled_agents: unknown[];
|
|
182
|
+
scheduled_at: number;
|
|
183
|
+
scheduling_url: string;
|
|
184
|
+
selected_start_time: number;
|
|
185
|
+
selected_time_zone: string;
|
|
186
|
+
}>;
|
|
187
|
+
export declare const SchedulingRequestPostSchema: z.ZodObject<{
|
|
188
|
+
appointment_type_id: z.ZodString;
|
|
189
|
+
trigger_mode: z.ZodString;
|
|
190
|
+
associated_entities: z.ZodArray<z.ZodObject<{
|
|
191
|
+
type: z.ZodString;
|
|
192
|
+
number: z.ZodString;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
number: string;
|
|
195
|
+
type: string;
|
|
196
|
+
}, {
|
|
197
|
+
number: string;
|
|
198
|
+
type: string;
|
|
199
|
+
}>, "many">;
|
|
200
|
+
resource_ids: z.ZodArray<z.ZodString, "many">;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
appointment_type_id: string;
|
|
203
|
+
associated_entities: {
|
|
204
|
+
number: string;
|
|
205
|
+
type: string;
|
|
206
|
+
}[];
|
|
207
|
+
trigger_mode: string;
|
|
208
|
+
resource_ids: string[];
|
|
209
|
+
}, {
|
|
210
|
+
appointment_type_id: string;
|
|
211
|
+
associated_entities: {
|
|
212
|
+
number: string;
|
|
213
|
+
type: string;
|
|
214
|
+
}[];
|
|
215
|
+
trigger_mode: string;
|
|
216
|
+
resource_ids: string[];
|
|
217
|
+
}>;
|
|
218
|
+
export declare const TeamSchema: z.ZodObject<{
|
|
219
|
+
id: z.ZodString;
|
|
220
|
+
object: z.ZodString;
|
|
221
|
+
internal_name: z.ZodString;
|
|
222
|
+
external_name: z.ZodString;
|
|
223
|
+
team_type: z.ZodString;
|
|
224
|
+
url_slug: z.ZodString;
|
|
225
|
+
created_at: z.ZodNumber;
|
|
226
|
+
updated_at: z.ZodNumber;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
object: string;
|
|
229
|
+
id: string;
|
|
230
|
+
url_slug: string;
|
|
231
|
+
created_at: number;
|
|
232
|
+
updated_at: number;
|
|
233
|
+
internal_name: string;
|
|
234
|
+
external_name: string;
|
|
235
|
+
team_type: string;
|
|
236
|
+
}, {
|
|
237
|
+
object: string;
|
|
238
|
+
id: string;
|
|
239
|
+
url_slug: string;
|
|
240
|
+
created_at: number;
|
|
241
|
+
updated_at: number;
|
|
242
|
+
internal_name: string;
|
|
243
|
+
external_name: string;
|
|
244
|
+
team_type: string;
|
|
245
|
+
}>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeamSchema = exports.SchedulingRequestPostSchema = exports.SchedulingRequestSchema = exports.ResourceSchema = exports.AppointmentTypeSchema = exports.AgentSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.AgentSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string(),
|
|
7
|
+
object: zod_1.z.string(),
|
|
8
|
+
name: zod_1.z.string(),
|
|
9
|
+
email: zod_1.z.string(),
|
|
10
|
+
role: zod_1.z.string(),
|
|
11
|
+
schedulable: zod_1.z.boolean(),
|
|
12
|
+
two_factor_enabled: zod_1.z.boolean(),
|
|
13
|
+
url_slug: zod_1.z.string(),
|
|
14
|
+
created_at: zod_1.z.number(),
|
|
15
|
+
updated_at: zod_1.z.number(),
|
|
16
|
+
});
|
|
17
|
+
exports.AppointmentTypeSchema = zod_1.z.object({
|
|
18
|
+
id: zod_1.z.string(),
|
|
19
|
+
object: zod_1.z.string(),
|
|
20
|
+
internal_name: zod_1.z.string(),
|
|
21
|
+
external_name: zod_1.z.string(),
|
|
22
|
+
duration_mins: zod_1.z.number(),
|
|
23
|
+
url_slug: zod_1.z.string(),
|
|
24
|
+
created_at: zod_1.z.number(),
|
|
25
|
+
updated_at: zod_1.z.number(),
|
|
26
|
+
});
|
|
27
|
+
exports.ResourceSchema = zod_1.z.object({
|
|
28
|
+
id: zod_1.z.string(),
|
|
29
|
+
object: zod_1.z.string(),
|
|
30
|
+
name: zod_1.z.string(),
|
|
31
|
+
email: zod_1.z.string(),
|
|
32
|
+
role: zod_1.z.string(),
|
|
33
|
+
schedulable: zod_1.z.boolean(),
|
|
34
|
+
two_factor_enabled: zod_1.z.boolean(),
|
|
35
|
+
url_slug: zod_1.z.string(),
|
|
36
|
+
created_at: zod_1.z.number(),
|
|
37
|
+
updated_at: zod_1.z.number(),
|
|
38
|
+
});
|
|
39
|
+
exports.SchedulingRequestSchema = zod_1.z.object({
|
|
40
|
+
id: zod_1.z.string(),
|
|
41
|
+
object: zod_1.z.string(),
|
|
42
|
+
appointment_type_id: zod_1.z.string(),
|
|
43
|
+
end_user_email: zod_1.z.string(),
|
|
44
|
+
end_user_name: zod_1.z.string(),
|
|
45
|
+
associated_entities: zod_1.z.array(zod_1.z.object({
|
|
46
|
+
type: zod_1.z.string(),
|
|
47
|
+
id: zod_1.z.number(),
|
|
48
|
+
number: zod_1.z.string().optional(),
|
|
49
|
+
})),
|
|
50
|
+
resources: zod_1.z.array(zod_1.z.object({
|
|
51
|
+
type: zod_1.z.string(),
|
|
52
|
+
id: zod_1.z.string(),
|
|
53
|
+
name: zod_1.z.string(),
|
|
54
|
+
})),
|
|
55
|
+
scheduled_agents: zod_1.z.array(zod_1.z.unknown()),
|
|
56
|
+
scheduled_at: zod_1.z.number(),
|
|
57
|
+
scheduling_url: zod_1.z.string(),
|
|
58
|
+
selected_start_time: zod_1.z.number(),
|
|
59
|
+
selected_time_zone: zod_1.z.string(),
|
|
60
|
+
status: zod_1.z.string(),
|
|
61
|
+
created_at: zod_1.z.number(),
|
|
62
|
+
updated_at: zod_1.z.number(),
|
|
63
|
+
});
|
|
64
|
+
exports.SchedulingRequestPostSchema = zod_1.z.object({
|
|
65
|
+
appointment_type_id: zod_1.z.string(),
|
|
66
|
+
trigger_mode: zod_1.z.string(),
|
|
67
|
+
associated_entities: zod_1.z.array(zod_1.z.object({
|
|
68
|
+
type: zod_1.z.string(),
|
|
69
|
+
number: zod_1.z.string(),
|
|
70
|
+
})),
|
|
71
|
+
resource_ids: zod_1.z.array(zod_1.z.string()),
|
|
72
|
+
});
|
|
73
|
+
exports.TeamSchema = zod_1.z.object({
|
|
74
|
+
id: zod_1.z.string(),
|
|
75
|
+
object: zod_1.z.string(),
|
|
76
|
+
internal_name: zod_1.z.string(),
|
|
77
|
+
external_name: zod_1.z.string(),
|
|
78
|
+
team_type: zod_1.z.string(),
|
|
79
|
+
url_slug: zod_1.z.string(),
|
|
80
|
+
created_at: zod_1.z.number(),
|
|
81
|
+
updated_at: zod_1.z.number(),
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/entities/schemas.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE;IACxB,kBAAkB,EAAE,OAAC,CAAC,OAAO,EAAE;IAC/B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,MAAM,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B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TimeZestAPI as TimeZestAPIInterface, TimeZestAPIOptions, TimeZestAPIConfig, log, Agent, AppointmentType, Resource, SchedulingRequest, Team } from "./index.d";
|
|
2
|
+
declare class TimeZestAPI implements TimeZestAPIInterface {
|
|
3
|
+
private config;
|
|
4
|
+
private apiKey;
|
|
5
|
+
log: log;
|
|
6
|
+
constructor(apiKey: string, options?: TimeZestAPIOptions);
|
|
7
|
+
getApiKey(): string;
|
|
8
|
+
getConfig(): TimeZestAPIConfig;
|
|
9
|
+
getResources: (filter?: string | null) => Promise<Resource[]>;
|
|
10
|
+
getAgents(filter?: string | null): Promise<Agent[]>;
|
|
11
|
+
getTeams(filter?: string | null): Promise<Team[]>;
|
|
12
|
+
getAppointmentTypes(filter?: string | null): Promise<AppointmentType[]>;
|
|
13
|
+
getSchedulingRequest(id: string): Promise<SchedulingRequest>;
|
|
14
|
+
getSchedulingRequests(filter?: string | null): Promise<SchedulingRequest[]>;
|
|
15
|
+
createSchedulingRequest(data: SchedulingRequest): Promise<SchedulingRequest>;
|
|
16
|
+
}
|
|
17
|
+
export default TimeZestAPI;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schemas_1 = require("./entities/schemas");
|
|
13
|
+
const config_1 = require("./config/config");
|
|
14
|
+
const makeRequest_1 = require("./utils/makeRequest");
|
|
15
|
+
const endpoints_1 = require("./constants/endpoints");
|
|
16
|
+
const logger_1 = require("./utils/logger");
|
|
17
|
+
const makePaginatedRequest_1 = require("./utils/makePaginatedRequest");
|
|
18
|
+
class TimeZestAPI {
|
|
19
|
+
constructor(apiKey, options) {
|
|
20
|
+
this.getResources = (...args_1) => __awaiter(this, [...args_1], void 0, function* (filter = null) {
|
|
21
|
+
const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.RESOURCES, "GET", null, filter);
|
|
22
|
+
return response.map((item) => schemas_1.ResourceSchema.parse(item));
|
|
23
|
+
});
|
|
24
|
+
this.apiKey = apiKey;
|
|
25
|
+
this.config = {
|
|
26
|
+
logLevel: (options === null || options === void 0 ? void 0 : options.logLevel) || config_1.CONFIG.logLevel,
|
|
27
|
+
logger: (options === null || options === void 0 ? void 0 : options.logger) || config_1.CONFIG.logger,
|
|
28
|
+
baseUrl: (options === null || options === void 0 ? void 0 : options.baseUrl) || config_1.CONFIG.baseUrl,
|
|
29
|
+
maxRetryDelayMs: (options === null || options === void 0 ? void 0 : options.maxRetryDelayMs) || config_1.CONFIG.maxRetryDelayMs,
|
|
30
|
+
maxRetryTimeMs: (options === null || options === void 0 ? void 0 : options.maxRetryTimeMs) || config_1.CONFIG.maxRetryTimeMs,
|
|
31
|
+
};
|
|
32
|
+
this.log = (0, logger_1.buildLogger)(this.config.logger, this.config.logLevel);
|
|
33
|
+
// Log the initialization of the API client but remove apiKey
|
|
34
|
+
this.log("info", "TimeZestAPI initialized");
|
|
35
|
+
this.log("debug", "TimeZestAPI initialized with custom config", Object.assign({}, options));
|
|
36
|
+
this.log("debug", "TimeZestAPI initialized with final config", Object.assign({}, this.config));
|
|
37
|
+
// Wrap methods with logging middleware using the instance's log method
|
|
38
|
+
this.getResources = (0, logger_1.withLogging)(this.getResources.bind(this), this, "getResources");
|
|
39
|
+
this.getAgents = (0, logger_1.withLogging)(this.getAgents.bind(this), this, "getAgents");
|
|
40
|
+
this.getTeams = (0, logger_1.withLogging)(this.getTeams.bind(this), this, "getTeams");
|
|
41
|
+
this.getAppointmentTypes = (0, logger_1.withLogging)(this.getAppointmentTypes.bind(this), this, "getAppointmentTypes");
|
|
42
|
+
this.getSchedulingRequest = (0, logger_1.withLogging)(this.getSchedulingRequest.bind(this), this, "getSchedulingRequest");
|
|
43
|
+
this.createSchedulingRequest = (0, logger_1.withLogging)(this.createSchedulingRequest.bind(this), this, "createSchedulingRequest");
|
|
44
|
+
}
|
|
45
|
+
getApiKey() {
|
|
46
|
+
return this.apiKey;
|
|
47
|
+
}
|
|
48
|
+
getConfig() {
|
|
49
|
+
return this.config;
|
|
50
|
+
}
|
|
51
|
+
getAgents() {
|
|
52
|
+
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
53
|
+
const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.AGENTS, "GET", null, filter);
|
|
54
|
+
return response.map((item) => schemas_1.AgentSchema.parse(item));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
getTeams() {
|
|
58
|
+
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
59
|
+
const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.TEAMS, "GET", null, filter);
|
|
60
|
+
return response.map((item) => schemas_1.TeamSchema.parse(item));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
getAppointmentTypes() {
|
|
64
|
+
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
65
|
+
const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.APPOINTMENT_TYPES, "GET", null, filter);
|
|
66
|
+
return response.map((item) => schemas_1.AppointmentTypeSchema.parse(item));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
getSchedulingRequest(id) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const response = yield (0, makeRequest_1.makeRequest)(this.log, this.apiKey, this.config.baseUrl, `${endpoints_1.API_ENDPOINTS.SCHEDULING_REQUESTS}/${id}`, "GET", null, this.config.maxRetryTimeMs, this.config.maxRetryDelayMs);
|
|
72
|
+
return schemas_1.SchedulingRequestSchema.parse(response);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
getSchedulingRequests() {
|
|
76
|
+
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
77
|
+
const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.SCHEDULING_REQUESTS, "GET", null, filter);
|
|
78
|
+
return response.map((item) => schemas_1.SchedulingRequestSchema.parse(item));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
createSchedulingRequest(data) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const response = yield (0, makeRequest_1.makeRequest)(this.log, this.apiKey, this.config.baseUrl, endpoints_1.API_ENDPOINTS.SCHEDULING_REQUESTS, "POST", data, this.config.maxRetryTimeMs, this.config.maxRetryDelayMs);
|
|
84
|
+
return response;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.default = TimeZestAPI;
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],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AAM,QAAQ,GAAG,MAAM,IAAA,2CAAoB,EACzC,IAAI,EACJ,yBAAa,CAAC,mBAAmB,EACjC,KAAK,EACL,IAAI,EACJ,MAAM,CACP,CAAC;YACF,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iCAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACrE,CAAC;KAAA;IAEK,uBAAuB,CAC3B,IAAuB;;YAEvB,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAW,EAChC,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,CAAC,OAAO,EACnB,yBAAa,CAAC,mBAAmB,EACjC,MAAM,EACN,IAAI,EACJ,IAAI,CAAC,MAAM,CAAC,cAAc,EAC1B,IAAI,CAAC,MAAM,CAAC,eAAe,CAC5B,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleError = void 0;
|
|
4
|
+
const handleError = (log, error) => {
|
|
5
|
+
if (error.response) {
|
|
6
|
+
const { status, data } = error.response;
|
|
7
|
+
if (status === 404) {
|
|
8
|
+
log("warn", "Resource not found, returning an empty array.", {
|
|
9
|
+
status,
|
|
10
|
+
data,
|
|
11
|
+
});
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
log("error", `API Error: ${status} - ${data.message || "Unknown error"}`, data);
|
|
15
|
+
if (data.errors) {
|
|
16
|
+
log("error", "Details:", data.errors);
|
|
17
|
+
}
|
|
18
|
+
throw new Error(data.message || `HTTP ${status}`);
|
|
19
|
+
}
|
|
20
|
+
else if (error.request) {
|
|
21
|
+
log("error", "No response received from the API.", {
|
|
22
|
+
message: error.message,
|
|
23
|
+
});
|
|
24
|
+
throw new Error("No response received from the API");
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
log("error", "Error setting up the request.", { message: error.message });
|
|
28
|
+
throw new Error("Error setting up the request");
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.handleError = handleError;
|
|
32
|
+
//# sourceMappingURL=handleError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleError.js","sourceRoot":"","sources":["../../src/utils/handleError.ts"],"names":[],"mappings":";;;AAGO,MAAM,WAAW,GAA2B,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IAChE,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;QACxC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,GAAG,CAAC,MAAM,EAAE,+CAA+C,EAAE;gBAC3D,MAAM;gBACN,IAAI;aACL,CAAC,CAAC;YACH,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,GAAG,CACD,OAAO,EACP,cAAc,MAAM,MAAM,IAAI,CAAC,OAAO,IAAI,eAAe,EAAE,EAC3D,IAAI,CACL,CAAC;QACF,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,QAAQ,MAAM,EAAE,CAAC,CAAC;IACpD,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,GAAG,CAAC,OAAO,EAAE,oCAAoC,EAAE;YACjD,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,OAAO,EAAE,+BAA+B,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC;AA5BW,QAAA,WAAW,eA4BtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Logger, LogLevel } from "./logger.d";
|
|
2
|
+
export declare const logLevelPriority: Record<LogLevel, number>;
|
|
3
|
+
export declare const defaultLogger: Logger;
|
|
4
|
+
export declare function buildLogger(logger: Logger, logLevel: LogLevel): (level: LogLevel, message: string, data?: any) => void;
|
|
5
|
+
export declare function withLogging<T>(fn: (...args: any[]) => Promise<T>, instance: {
|
|
6
|
+
log: (level: LogLevel, message: string, data?: any) => void;
|
|
7
|
+
}, functionName: string): (...args: any[]) => Promise<T>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.defaultLogger = exports.logLevelPriority = void 0;
|
|
13
|
+
exports.buildLogger = buildLogger;
|
|
14
|
+
exports.withLogging = withLogging;
|
|
15
|
+
exports.logLevelPriority = {
|
|
16
|
+
silent: -1,
|
|
17
|
+
error: 0,
|
|
18
|
+
warn: 1,
|
|
19
|
+
info: 2,
|
|
20
|
+
http: 3,
|
|
21
|
+
verbose: 4,
|
|
22
|
+
debug: 5,
|
|
23
|
+
silly: 6,
|
|
24
|
+
};
|
|
25
|
+
exports.defaultLogger = {
|
|
26
|
+
silent: (_message, _data) => { },
|
|
27
|
+
error: (message, data) => data ? console.error(message, data) : console.error(message),
|
|
28
|
+
warn: (message, data) => data ? console.warn(message, data) : console.warn(message),
|
|
29
|
+
info: (message, data) => data ? console.info(message, data) : console.info,
|
|
30
|
+
http: (message, data) => data ? console.log(message, data) : console.log(message),
|
|
31
|
+
verbose: (message, data) => data ? console.debug(message, data) : console.debug(message),
|
|
32
|
+
debug: (message, data) => data ? console.debug(message, data) : console.debug(message),
|
|
33
|
+
silly: (message, data) => data ? console.debug(message, data) : console.debug(message),
|
|
34
|
+
};
|
|
35
|
+
function buildLogger(logger, logLevel) {
|
|
36
|
+
return (level, message, data) => {
|
|
37
|
+
if (exports.logLevelPriority[level] <= exports.logLevelPriority[logLevel]) {
|
|
38
|
+
logger[level](message, data);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function withLogging(fn, instance, functionName) {
|
|
43
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
instance.log("debug", `Entering ${functionName}`);
|
|
45
|
+
args ? instance.log("silly", `Entering ${functionName}`, { args }) : null;
|
|
46
|
+
try {
|
|
47
|
+
const result = yield fn(...args);
|
|
48
|
+
instance.log("debug", `Exiting ${functionName} successfully`);
|
|
49
|
+
result
|
|
50
|
+
? instance.log("silly", `Exiting ${functionName} successfully`, {
|
|
51
|
+
result,
|
|
52
|
+
})
|
|
53
|
+
: null;
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
instance.log("error", `Error in ${functionName}`, { error });
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AAC,OAAO,EAAE,WAAW,YAAY,eAAe,CAAC,CAAC;YAC9D,MAAM;gBACJ,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,YAAY,eAAe,EAAE;oBAC5D,MAAM;iBACP,CAAC;gBACJ,CAAC,CAAC,IAAI,CAAC;YACT,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAC7D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.makePaginatedRequest = void 0;
|
|
13
|
+
const makeRequest_1 = require("./makeRequest");
|
|
14
|
+
const handleError_1 = require("./handleError");
|
|
15
|
+
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) {
|
|
16
|
+
const { log } = apiInstance;
|
|
17
|
+
const apiKey = apiInstance.getApiKey();
|
|
18
|
+
const { baseUrl, maxRetryTimeMs, maxRetryDelayMs } = apiInstance.getConfig();
|
|
19
|
+
let results = [];
|
|
20
|
+
let nextPage = 1;
|
|
21
|
+
try {
|
|
22
|
+
do {
|
|
23
|
+
log("debug", `Fetching page ${nextPage} for ${endpoint}`);
|
|
24
|
+
const response = yield (0, makeRequest_1.makeRequest)(log, apiKey, baseUrl, endpoint, method, Object.assign(Object.assign({}, data), { filter, page: nextPage }), maxRetryTimeMs, maxRetryDelayMs);
|
|
25
|
+
log("http", `Page ${nextPage} fetched successfully for ${endpoint}`);
|
|
26
|
+
results = results.concat(response.data);
|
|
27
|
+
nextPage = response.next_page;
|
|
28
|
+
} while (nextPage);
|
|
29
|
+
log("http", `Paginated request to ${endpoint} completed successfully`);
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
log("error", `Paginated request to ${endpoint} failed with error: '${error.message}'`);
|
|
34
|
+
(0, handleError_1.handleError)(log, error);
|
|
35
|
+
}
|
|
36
|
+
return results;
|
|
37
|
+
});
|
|
38
|
+
exports.makePaginatedRequest = makePaginatedRequest;
|
|
39
|
+
//# sourceMappingURL=makePaginatedRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makePaginatedRequest.js","sourceRoot":"","sources":["../../src/utils/makePaginatedRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4C;AAC5C,+CAA4C;AAGrC,MAAM,oBAAoB,GAAoC,uCAMnE,EAAE,8EALF,WAAW,EACX,QAAQ,EACR,MAAM,GAAG,KAAK,EACd,IAAI,GAAG,IAAI,EACX,MAAM,GAAG,IAAI;IAEb,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC;IAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;IACvC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;IAE7E,IAAI,OAAO,GAAU,EAAE,CAAC;IACxB,IAAI,QAAQ,GAAkB,CAAC,CAAC;IAEhC,IAAI,CAAC;QACH,GAAG,CAAC;YACF,GAAG,CAAC,OAAO,EAAE,iBAAiB,QAAQ,QAAQ,QAAQ,EAAE,CAAC,CAAC;YAC1D,MAAM,QAAQ,GACZ,MAAM,IAAA,yBAAW,EAIf,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,kCACD,IAAI,KAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KACjC,cAAc,EACd,eAAe,CAChB,CAAC;YAEJ,GAAG,CAAC,MAAM,EAAE,QAAQ,QAAQ,6BAA6B,QAAQ,EAAE,CAAC,CAAC;YACrE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACxC,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC;QAChC,CAAC,QAAQ,QAAQ,EAAE;QAEnB,GAAG,CAAC,MAAM,EAAE,wBAAwB,QAAQ,yBAAyB,CAAC,CAAC;QACvE,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,GAAG,CACD,OAAO,EACP,wBAAwB,QAAQ,wBAAwB,KAAK,CAAC,OAAO,GAAG,CACzE,CAAC;QACF,IAAA,yBAAW,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA,CAAC;AA/CW,QAAA,oBAAoB,wBA+C/B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.makeRequest = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const handleError_1 = require("./handleError");
|
|
18
|
+
const makeRequest = (log_1, apiKey_1, baseUrl_1, endpoint_1, ...args_1) => __awaiter(void 0, [log_1, apiKey_1, baseUrl_1, endpoint_1, ...args_1], void 0, function* (log, apiKey, baseUrl, endpoint, method = "GET", data = null, maxRetryTimeMs, maxRetryDelayMs) {
|
|
19
|
+
var _a;
|
|
20
|
+
let totalElapsedTime = 0;
|
|
21
|
+
let retries = 0;
|
|
22
|
+
while (totalElapsedTime < maxRetryTimeMs) {
|
|
23
|
+
try {
|
|
24
|
+
log("debug", `Attempting request to ${endpoint}. Retry count: ${retries}`);
|
|
25
|
+
const response = yield (0, axios_1.default)({
|
|
26
|
+
url: `${baseUrl}${endpoint}`,
|
|
27
|
+
method,
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${apiKey}`,
|
|
30
|
+
"Content-Type": "application/json",
|
|
31
|
+
},
|
|
32
|
+
data,
|
|
33
|
+
});
|
|
34
|
+
return response.data;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 429) {
|
|
38
|
+
const retryAfterHeader = parseInt(error.response.headers["retry-after"], 10);
|
|
39
|
+
const retryAfter = retryAfterHeader || Math.min(maxRetryDelayMs, Math.pow(2, retries));
|
|
40
|
+
if (totalElapsedTime + retryAfter * 1000 >= maxRetryTimeMs) {
|
|
41
|
+
log("error", `Max retry time exceeded for ${endpoint}`);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
log("warn", `Rate limited on ${endpoint}. Retrying after ${retryAfter} seconds...`);
|
|
45
|
+
yield new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
|
|
46
|
+
totalElapsedTime += retryAfter * 1000;
|
|
47
|
+
retries++;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
log("error", `Request to ${endpoint} failed with error: ${error.message}`);
|
|
51
|
+
(0, handleError_1.handleError)(log, error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`Max retry time of ${maxRetryTimeMs} minutes exceeded for ${endpoint}`);
|
|
56
|
+
});
|
|
57
|
+
exports.makeRequest = makeRequest;
|
|
58
|
+
//# sourceMappingURL=makeRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeRequest.js","sourceRoot":"","sources":["../../src/utils/makeRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+CAA4C;AAGrC,MAAM,WAAW,GAA2B,oDASjD,EAAE,2FARF,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,GAAG,KAAK,EACd,IAAI,GAAG,IAAI,EACX,cAAc,EACd,eAAe;;IAEf,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,OAAO,gBAAgB,GAAG,cAAc,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,GAAG,CACD,OAAO,EACP,yBAAyB,QAAQ,kBAAkB,OAAO,EAAE,CAC7D,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;gBAC3B,GAAG,EAAE,GAAG,OAAO,GAAG,QAAQ,EAAE;gBAC5B,MAAM;gBACN,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