microsoft-graph 2.9.0 → 2.9.1
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/dist/cjs/graphApi.js +1 -2
- package/dist/cjs/services/httpStatus.d.ts +6 -0
- package/dist/cjs/services/httpStatus.d.ts.map +1 -1
- package/dist/cjs/services/httpStatus.js +9 -0
- package/dist/esm/graphApi.js +2 -3
- package/dist/esm/services/httpStatus.d.ts +6 -0
- package/dist/esm/services/httpStatus.d.ts.map +1 -1
- package/dist/esm/services/httpStatus.js +8 -0
- package/package.json +1 -1
package/dist/cjs/graphApi.js
CHANGED
|
@@ -136,7 +136,6 @@ async function innerFetch(args) {
|
|
|
136
136
|
httpsAgent: options.httpAgent,
|
|
137
137
|
});
|
|
138
138
|
while (attempts < maxRetries) {
|
|
139
|
-
// Retry at most 3 times
|
|
140
139
|
try {
|
|
141
140
|
response = await instance({
|
|
142
141
|
url,
|
|
@@ -147,7 +146,7 @@ async function innerFetch(args) {
|
|
|
147
146
|
catch (error) {
|
|
148
147
|
if (axios_1.default.isAxiosError(error) && error.response) {
|
|
149
148
|
response = error.response;
|
|
150
|
-
if (!((0, httpStatus_ts_1.isHttpTooManyRequests)(response.status) || (0, httpStatus_ts_1.isServiceUnavailable)(response.status))) {
|
|
149
|
+
if (!((0, httpStatus_ts_1.isHttpTooManyRequests)(response.status) || (0, httpStatus_ts_1.isServiceUnavailable)(response.status) || (0, httpStatus_ts_1.isGatewayTimeout)(response.status))) {
|
|
151
150
|
throw error; // Don't retry for other error codes
|
|
152
151
|
}
|
|
153
152
|
const requestedRetryAfterSeconds = Number.parseInt(response.headers["retry-after"] ?? "0", 10);
|
|
@@ -16,4 +16,10 @@ export declare function isHttpTooManyRequests(status: number): boolean;
|
|
|
16
16
|
* @returns True if the status code is 503, otherwise false.
|
|
17
17
|
*/
|
|
18
18
|
export declare function isServiceUnavailable(status: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the HTTP status code indicates a gateway has timed out.
|
|
21
|
+
* @param status - The HTTP status code.
|
|
22
|
+
* @returns True if the status code is 504, otherwise false.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isGatewayTimeout(status: number): boolean;
|
|
19
25
|
//# sourceMappingURL=httpStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
1
|
+
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isHttpOk = isHttpOk;
|
|
4
4
|
exports.isHttpTooManyRequests = isHttpTooManyRequests;
|
|
5
5
|
exports.isServiceUnavailable = isServiceUnavailable;
|
|
6
|
+
exports.isGatewayTimeout = isGatewayTimeout;
|
|
6
7
|
/**
|
|
7
8
|
* Checks if the HTTP status code indicates a successful response.
|
|
8
9
|
* @param status - The HTTP status code.
|
|
@@ -27,3 +28,11 @@ function isHttpTooManyRequests(status) {
|
|
|
27
28
|
function isServiceUnavailable(status) {
|
|
28
29
|
return status === 503;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the HTTP status code indicates a gateway has timed out.
|
|
33
|
+
* @param status - The HTTP status code.
|
|
34
|
+
* @returns True if the status code is 504, otherwise false.
|
|
35
|
+
*/
|
|
36
|
+
function isGatewayTimeout(status) {
|
|
37
|
+
return status === 504;
|
|
38
|
+
}
|
package/dist/esm/graphApi.js
CHANGED
|
@@ -7,7 +7,7 @@ import RequestFailedError from "./errors/RequestFailedError.js";
|
|
|
7
7
|
import { getCurrentAccessToken } from "./services/accessToken.js";
|
|
8
8
|
import { getContext } from "./services/context.js";
|
|
9
9
|
import { tryGetHttpAgent } from "./services/httpAgent.js";
|
|
10
|
-
import { isHttpOk, isHttpTooManyRequests, isServiceUnavailable } from "./services/httpStatus.js";
|
|
10
|
+
import { isGatewayTimeout, isHttpOk, isHttpTooManyRequests, isServiceUnavailable } from "./services/httpStatus.js";
|
|
11
11
|
import { operationIdToIndex, operationIndexToId } from "./services/operationId.js";
|
|
12
12
|
import { sleep } from "./services/sleep.js";
|
|
13
13
|
export const authenticationScope = "https://graph.microsoft.com/.default";
|
|
@@ -127,7 +127,6 @@ async function innerFetch(args) {
|
|
|
127
127
|
httpsAgent: options.httpAgent,
|
|
128
128
|
});
|
|
129
129
|
while (attempts < maxRetries) {
|
|
130
|
-
// Retry at most 3 times
|
|
131
130
|
try {
|
|
132
131
|
response = await instance({
|
|
133
132
|
url,
|
|
@@ -138,7 +137,7 @@ async function innerFetch(args) {
|
|
|
138
137
|
catch (error) {
|
|
139
138
|
if (axios.isAxiosError(error) && error.response) {
|
|
140
139
|
response = error.response;
|
|
141
|
-
if (!(isHttpTooManyRequests(response.status) || isServiceUnavailable(response.status))) {
|
|
140
|
+
if (!(isHttpTooManyRequests(response.status) || isServiceUnavailable(response.status) || isGatewayTimeout(response.status))) {
|
|
142
141
|
throw error; // Don't retry for other error codes
|
|
143
142
|
}
|
|
144
143
|
const requestedRetryAfterSeconds = Number.parseInt(response.headers["retry-after"] ?? "0", 10);
|
|
@@ -16,4 +16,10 @@ export declare function isHttpTooManyRequests(status: number): boolean;
|
|
|
16
16
|
* @returns True if the status code is 503, otherwise false.
|
|
17
17
|
*/
|
|
18
18
|
export declare function isServiceUnavailable(status: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the HTTP status code indicates a gateway has timed out.
|
|
21
|
+
* @param status - The HTTP status code.
|
|
22
|
+
* @returns True if the status code is 504, otherwise false.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isGatewayTimeout(status: number): boolean;
|
|
19
25
|
//# sourceMappingURL=httpStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
1
|
+
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
|
@@ -22,3 +22,11 @@ export function isHttpTooManyRequests(status) {
|
|
|
22
22
|
export function isServiceUnavailable(status) {
|
|
23
23
|
return status === 503;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the HTTP status code indicates a gateway has timed out.
|
|
27
|
+
* @param status - The HTTP status code.
|
|
28
|
+
* @returns True if the status code is 504, otherwise false.
|
|
29
|
+
*/
|
|
30
|
+
export function isGatewayTimeout(status) {
|
|
31
|
+
return status === 504;
|
|
32
|
+
}
|