@vulog/aima-client 1.2.32 → 1.2.34

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/index.cjs CHANGED
@@ -133,7 +133,7 @@ const getClient = (options) => {
133
133
  "Cache-Control": "no-cache",
134
134
  "Content-Type": "application/json",
135
135
  "X-Api-Key": options.apiKey,
136
- "User-Agent": options.userAgent ?? `aima-node/1.2.32 ${options.fleetId}`
136
+ "User-Agent": options.userAgent ?? `aima-node/1.2.34 ${options.fleetId}`
137
137
  },
138
138
  withCredentials: false
139
139
  });
@@ -249,6 +249,7 @@ const getClient = (options) => {
249
249
  }, (error) => {
250
250
  const { config, response: { status } = { status: 500 } } = error;
251
251
  const originalRequest = config;
252
+ if (!originalRequest) return Promise.reject(formatError(error));
252
253
  if (originalRequest.attemptCount === void 0) originalRequest.attemptCount = 0;
253
254
  if (originalRequest.attemptCount === 5) return Promise.reject(formatError(error));
254
255
  if (status === 401) {
package/dist/index.mjs CHANGED
@@ -109,7 +109,7 @@ const getClient = (options) => {
109
109
  "Cache-Control": "no-cache",
110
110
  "Content-Type": "application/json",
111
111
  "X-Api-Key": options.apiKey,
112
- "User-Agent": options.userAgent ?? `aima-node/1.2.32 ${options.fleetId}`
112
+ "User-Agent": options.userAgent ?? `aima-node/1.2.34 ${options.fleetId}`
113
113
  },
114
114
  withCredentials: false
115
115
  });
@@ -225,6 +225,7 @@ const getClient = (options) => {
225
225
  }, (error) => {
226
226
  const { config, response: { status } = { status: 500 } } = error;
227
227
  const originalRequest = config;
228
+ if (!originalRequest) return Promise.reject(formatError(error));
228
229
  if (originalRequest.attemptCount === void 0) originalRequest.attemptCount = 0;
229
230
  if (originalRequest.attemptCount === 5) return Promise.reject(formatError(error));
230
231
  if (status === 401) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vulog/aima-client",
3
3
  "type": "module",
4
- "version": "1.2.32",
4
+ "version": "1.2.34",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.cts",
package/src/getClient.ts CHANGED
@@ -221,6 +221,10 @@ const getClient = (options: ClientOptions): Client => {
221
221
  const { config, response: { status } = { status: 500 } } = error;
222
222
  const originalRequest = config;
223
223
 
224
+ if (!originalRequest) {
225
+ return Promise.reject(formatError(error));
226
+ }
227
+
224
228
  if (originalRequest.attemptCount === undefined) {
225
229
  originalRequest.attemptCount = 0;
226
230
  }