@sebspark/openapi-client 2.1.9 → 2.1.10

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.js CHANGED
@@ -100,13 +100,18 @@ var TypedClient = (baseURL, globalOptions, logger) => {
100
100
  const url = `${request.baseURL}${request.url}`;
101
101
  logger?.debug(`Intercepting request to ${url}`);
102
102
  if (globalOptions?.authorizationTokenGenerator && url) {
103
- const authorizationTokenHeaders = await globalOptions.authorizationTokenGenerator(url);
104
- if (authorizationTokenHeaders) {
105
- for (const key of Object.keys(authorizationTokenHeaders)) {
106
- const value = authorizationTokenHeaders[key];
107
- logger?.debug(`Setting header ${key} to ${value}`);
108
- request.headers[key] = value;
103
+ try {
104
+ const authorizationTokenHeaders = await globalOptions.authorizationTokenGenerator(url);
105
+ if (authorizationTokenHeaders) {
106
+ for (const key of Object.keys(authorizationTokenHeaders)) {
107
+ const value = authorizationTokenHeaders[key];
108
+ logger?.debug(`Setting header ${key} to ${value}`);
109
+ request.headers[key] = value;
110
+ }
109
111
  }
112
+ } catch (error) {
113
+ logger?.error(`Error generating token for URL: ${url}`);
114
+ throw error;
110
115
  }
111
116
  }
112
117
  logger?.debug("Intercepted request:");
@@ -128,7 +133,12 @@ var TypedClient = (baseURL, globalOptions, logger) => {
128
133
  const url = `${axiosError.config?.baseURL}${axiosError.config?.url}`;
129
134
  if (globalOptions?.authorizationTokenRefresh && url) {
130
135
  logger?.debug(`Refreshing token for URL ${url}`);
131
- await globalOptions?.authorizationTokenRefresh(url);
136
+ try {
137
+ await globalOptions?.authorizationTokenRefresh(url);
138
+ } catch (error) {
139
+ logger?.error(`Error refreshing token for URL: ${url}`);
140
+ throw error;
141
+ }
132
142
  }
133
143
  };
134
144
  (0, import_axios_auth_refresh.default)(axiosInstance, refreshAuthLogic);
package/dist/index.mjs CHANGED
@@ -65,13 +65,18 @@ var TypedClient = (baseURL, globalOptions, logger) => {
65
65
  const url = `${request.baseURL}${request.url}`;
66
66
  logger?.debug(`Intercepting request to ${url}`);
67
67
  if (globalOptions?.authorizationTokenGenerator && url) {
68
- const authorizationTokenHeaders = await globalOptions.authorizationTokenGenerator(url);
69
- if (authorizationTokenHeaders) {
70
- for (const key of Object.keys(authorizationTokenHeaders)) {
71
- const value = authorizationTokenHeaders[key];
72
- logger?.debug(`Setting header ${key} to ${value}`);
73
- request.headers[key] = value;
68
+ try {
69
+ const authorizationTokenHeaders = await globalOptions.authorizationTokenGenerator(url);
70
+ if (authorizationTokenHeaders) {
71
+ for (const key of Object.keys(authorizationTokenHeaders)) {
72
+ const value = authorizationTokenHeaders[key];
73
+ logger?.debug(`Setting header ${key} to ${value}`);
74
+ request.headers[key] = value;
75
+ }
74
76
  }
77
+ } catch (error) {
78
+ logger?.error(`Error generating token for URL: ${url}`);
79
+ throw error;
75
80
  }
76
81
  }
77
82
  logger?.debug("Intercepted request:");
@@ -93,7 +98,12 @@ var TypedClient = (baseURL, globalOptions, logger) => {
93
98
  const url = `${axiosError.config?.baseURL}${axiosError.config?.url}`;
94
99
  if (globalOptions?.authorizationTokenRefresh && url) {
95
100
  logger?.debug(`Refreshing token for URL ${url}`);
96
- await globalOptions?.authorizationTokenRefresh(url);
101
+ try {
102
+ await globalOptions?.authorizationTokenRefresh(url);
103
+ } catch (error) {
104
+ logger?.error(`Error refreshing token for URL: ${url}`);
105
+ throw error;
106
+ }
97
107
  }
98
108
  };
99
109
  createAuthRefreshInterceptor(axiosInstance, refreshAuthLogic);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebspark/openapi-client",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",