akeyless-client-commons 1.1.67 → 1.1.69

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.
@@ -255,7 +255,13 @@ declare const cloudwiseDomain: string;
255
255
  declare const akeylessOnlineDomain: string;
256
256
  type Method = "GET" | "POST" | "PUT" | "DELETE";
257
257
  type ServerName = "devices" | "bi" | "call-center-geo" | "call-center-events" | "notifications" | "data-socket" | "data-sync" | "cloudwise";
258
- declare const nxApiCall: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
258
+ interface ErrorDetails {
259
+ serverName: ServerName;
260
+ method: Method;
261
+ url: string;
262
+ error: any;
263
+ }
264
+ declare const nxApiCall: <T = any>(serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<T | ErrorDetails>;
259
265
 
260
266
  declare const checkUserPermissions: <T extends keyof UserPermissionsObject>(userPermissions: UserPermissionsObject, entity: T, permissions?: userPermissionsObjectValue<T>[], mode?: "some" | "every") => boolean;
261
267
  declare const parsePermissions: (object: NxUser | Client) => TObject<TObject<boolean>>;
@@ -255,7 +255,13 @@ declare const cloudwiseDomain: string;
255
255
  declare const akeylessOnlineDomain: string;
256
256
  type Method = "GET" | "POST" | "PUT" | "DELETE";
257
257
  type ServerName = "devices" | "bi" | "call-center-geo" | "call-center-events" | "notifications" | "data-socket" | "data-sync" | "cloudwise";
258
- declare const nxApiCall: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
258
+ interface ErrorDetails {
259
+ serverName: ServerName;
260
+ method: Method;
261
+ url: string;
262
+ error: any;
263
+ }
264
+ declare const nxApiCall: <T = any>(serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<T | ErrorDetails>;
259
265
 
260
266
  declare const checkUserPermissions: <T extends keyof UserPermissionsObject>(userPermissions: UserPermissionsObject, entity: T, permissions?: userPermissionsObjectValue<T>[], mode?: "some" | "every") => boolean;
261
267
  declare const parsePermissions: (object: NxUser | Client) => TObject<TObject<boolean>>;
@@ -2475,7 +2475,7 @@ var cloudwiseDomain = isLocal ? "http://localhost:9012/api/cloudwise" : baseDoma
2475
2475
  var akeylessOnlineDomain = mode === "qa" ? "https://akeyless-online.xyz" : "https://akeyless-online.info";
2476
2476
  var nxApiCall = /*#__PURE__*/ function() {
2477
2477
  var _ref = _async_to_generator(function(serverName, method, url, data) {
2478
- var urlResult, headers, _tmp, _tmp1, _, response, error, _error_response;
2478
+ var urlResult, headers, _tmp, _tmp1, _, response, error, _error_response, _error_response1, details;
2479
2479
  return _ts_generator(this, function(_state) {
2480
2480
  switch(_state.label){
2481
2481
  case 0:
@@ -2535,6 +2535,9 @@ var nxApiCall = /*#__PURE__*/ function() {
2535
2535
  _state.label = 3;
2536
2536
  case 3:
2537
2537
  headers = (_tmp.authorization = _tmp1, _tmp);
2538
+ if (data.ignoreAuth) {
2539
+ delete data.ignoreAuth;
2540
+ }
2538
2541
  return [
2539
2542
  4,
2540
2543
  (0, import_axios2.default)({
@@ -2552,15 +2555,18 @@ var nxApiCall = /*#__PURE__*/ function() {
2552
2555
  ];
2553
2556
  case 5:
2554
2557
  error = _state.sent();
2555
- console.error("Error from nxApiCall: ".concat(JSON.stringify({
2558
+ details = {
2556
2559
  serverName: serverName,
2557
2560
  method: method,
2558
2561
  url: url,
2559
2562
  data: data
2560
- })), (error === null || error === void 0 ? void 0 : (_error_response = error.response) === null || _error_response === void 0 ? void 0 : _error_response.data) || error);
2563
+ };
2564
+ console.error("Error from nxApiCall: ".concat(JSON.stringify(details)), (error === null || error === void 0 ? void 0 : (_error_response = error.response) === null || _error_response === void 0 ? void 0 : _error_response.data) || error);
2561
2565
  return [
2562
2566
  2,
2563
- null
2567
+ _object_spread({
2568
+ error: (error === null || error === void 0 ? void 0 : (_error_response1 = error.response) === null || _error_response1 === void 0 ? void 0 : _error_response1.data) || error
2569
+ }, details)
2564
2570
  ];
2565
2571
  case 6:
2566
2572
  return [
@@ -2093,7 +2093,7 @@ var cloudwiseDomain = isLocal ? "http://localhost:9012/api/cloudwise" : baseDoma
2093
2093
  var akeylessOnlineDomain = mode === "qa" ? "https://akeyless-online.xyz" : "https://akeyless-online.info";
2094
2094
  var nxApiCall = /*#__PURE__*/ function() {
2095
2095
  var _ref = _async_to_generator(function(serverName, method, url, data) {
2096
- var urlResult, headers, _tmp, _tmp1, _, response, error, _error_response;
2096
+ var urlResult, headers, _tmp, _tmp1, _, response, error, _error_response, _error_response1, details;
2097
2097
  return _ts_generator(this, function(_state) {
2098
2098
  switch(_state.label){
2099
2099
  case 0:
@@ -2153,6 +2153,9 @@ var nxApiCall = /*#__PURE__*/ function() {
2153
2153
  _state.label = 3;
2154
2154
  case 3:
2155
2155
  headers = (_tmp.authorization = _tmp1, _tmp);
2156
+ if (data.ignoreAuth) {
2157
+ delete data.ignoreAuth;
2158
+ }
2156
2159
  return [
2157
2160
  4,
2158
2161
  axios2({
@@ -2170,15 +2173,18 @@ var nxApiCall = /*#__PURE__*/ function() {
2170
2173
  ];
2171
2174
  case 5:
2172
2175
  error = _state.sent();
2173
- console.error("Error from nxApiCall: ".concat(JSON.stringify({
2176
+ details = {
2174
2177
  serverName: serverName,
2175
2178
  method: method,
2176
2179
  url: url,
2177
2180
  data: data
2178
- })), (error === null || error === void 0 ? void 0 : (_error_response = error.response) === null || _error_response === void 0 ? void 0 : _error_response.data) || error);
2181
+ };
2182
+ console.error("Error from nxApiCall: ".concat(JSON.stringify(details)), (error === null || error === void 0 ? void 0 : (_error_response = error.response) === null || _error_response === void 0 ? void 0 : _error_response.data) || error);
2179
2183
  return [
2180
2184
  2,
2181
- null
2185
+ _object_spread({
2186
+ error: (error === null || error === void 0 ? void 0 : (_error_response1 = error.response) === null || _error_response1 === void 0 ? void 0 : _error_response1.data) || error
2187
+ }, details)
2182
2188
  ];
2183
2189
  case 6:
2184
2190
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.1.67",
3
+ "version": "1.1.69",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",