@uniformdev/context
Advanced tools
+23
-2
@@ -44,2 +44,3 @@ "use strict"; | ||
| ApiClientError: () => ApiClientError, | ||
| BearerTokenNotValidOrExpiredError: () => BearerTokenNotValidOrExpiredError, | ||
| CachedAggregateClient: () => CachedAggregateClient, | ||
@@ -60,2 +61,3 @@ CachedContextClient: () => CachedContextClient, | ||
| TestClient: () => TestClient, | ||
| UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE: () => UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE, | ||
| UncachedAggregateClient: () => UncachedAggregateClient, | ||
@@ -83,2 +85,3 @@ UncachedContextClient: () => UncachedContextClient, | ||
| var defaultLimitPolicy = (0, import_p_limit.default)(6); | ||
| var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired"; | ||
| var ApiClientError = class _ApiClientError extends Error { | ||
@@ -99,2 +102,8 @@ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) { | ||
| }; | ||
| var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError { | ||
| constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) { | ||
| super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId); | ||
| Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype); | ||
| } | ||
| }; | ||
@@ -135,3 +144,3 @@ // src/api/ApiClient.ts | ||
| return this.options.limitPolicy(async () => { | ||
| var _a; | ||
| var _a, _b; | ||
| const coreHeaders = this.options.apiKey ? { | ||
@@ -172,5 +181,15 @@ "x-api-key": this.options.apiKey | ||
| } | ||
| if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) { | ||
| throw new BearerTokenNotValidOrExpiredError( | ||
| message, | ||
| (_a = options == null ? void 0 : options.method) != null ? _a : "GET", | ||
| fetchUri.toString(), | ||
| apiResponse.status, | ||
| apiResponse.statusText, | ||
| _ApiClient.getRequestId(apiResponse) | ||
| ); | ||
| } | ||
| throw new ApiClientError( | ||
| message, | ||
| (_a = options == null ? void 0 : options.method) != null ? _a : "GET", | ||
| (_b = options == null ? void 0 : options.method) != null ? _b : "GET", | ||
| fetchUri.toString(), | ||
@@ -646,2 +665,3 @@ apiResponse.status, | ||
| ApiClientError, | ||
| BearerTokenNotValidOrExpiredError, | ||
| CachedAggregateClient, | ||
@@ -662,2 +682,3 @@ CachedContextClient, | ||
| TestClient, | ||
| UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE, | ||
| UncachedAggregateClient, | ||
@@ -664,0 +685,0 @@ UncachedContextClient, |
+21
-2
@@ -15,2 +15,3 @@ var __defProp = Object.defineProperty; | ||
| var defaultLimitPolicy = pLimit(6); | ||
| var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired"; | ||
| var ApiClientError = class _ApiClientError extends Error { | ||
@@ -31,2 +32,8 @@ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) { | ||
| }; | ||
| var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError { | ||
| constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) { | ||
| super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId); | ||
| Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype); | ||
| } | ||
| }; | ||
@@ -67,3 +74,3 @@ // src/api/ApiClient.ts | ||
| return this.options.limitPolicy(async () => { | ||
| var _a; | ||
| var _a, _b; | ||
| const coreHeaders = this.options.apiKey ? { | ||
@@ -104,5 +111,15 @@ "x-api-key": this.options.apiKey | ||
| } | ||
| if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) { | ||
| throw new BearerTokenNotValidOrExpiredError( | ||
| message, | ||
| (_a = options == null ? void 0 : options.method) != null ? _a : "GET", | ||
| fetchUri.toString(), | ||
| apiResponse.status, | ||
| apiResponse.statusText, | ||
| _ApiClient.getRequestId(apiResponse) | ||
| ); | ||
| } | ||
| throw new ApiClientError( | ||
| message, | ||
| (_a = options == null ? void 0 : options.method) != null ? _a : "GET", | ||
| (_b = options == null ? void 0 : options.method) != null ? _b : "GET", | ||
| fetchUri.toString(), | ||
@@ -577,2 +594,3 @@ apiResponse.status, | ||
| ApiClientError, | ||
| BearerTokenNotValidOrExpiredError, | ||
| CachedAggregateClient, | ||
@@ -593,2 +611,3 @@ CachedContextClient, | ||
| TestClient, | ||
| UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE, | ||
| UncachedAggregateClient, | ||
@@ -595,0 +614,0 @@ UncachedContextClient, |
+2
-2
| { | ||
| "name": "@uniformdev/context", | ||
| "version": "20.72.3-alpha.14+1e232e59cd", | ||
| "version": "20.72.3-alpha.23+cbe06f1e8a", | ||
| "description": "Uniform Context core package", | ||
@@ -73,3 +73,3 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
| }, | ||
| "gitHead": "1e232e59cd3ded97b85b063986cc95e954b8c937" | ||
| "gitHead": "cbe06f1e8a5bb93b0e3cae6b1c8774f21c10506e" | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
667003
0.54%13602
0.39%