@frontegg/rest-api 7.40.0-alpha.2 → 7.40.0
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/FetchClient.js +3 -3
- package/constants.d.ts +1 -0
- package/constants.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +2 -2
- package/node/FetchClient.js +2 -2
- package/node/constants.js +3 -1
- package/node/index.js +17 -2
- package/package.json +1 -1
package/FetchClient.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { ContextHolder } from './ContextHolder';
|
|
3
3
|
import { FronteggApiError } from './error';
|
|
4
|
-
import { FRONTEGG_TRACE_ID, GENERIC_ERROR_MESSAGE } from './constants';
|
|
4
|
+
import { FRONTEGG_TRACE_ID, GENERIC_ERROR_CODE, GENERIC_ERROR_MESSAGE } from './constants';
|
|
5
5
|
import { fronteggHeaders } from './interfaces';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -118,7 +118,7 @@ export class FetchClient {
|
|
|
118
118
|
return new Promise(() => {});
|
|
119
119
|
}
|
|
120
120
|
if (!response.ok) {
|
|
121
|
-
var _errorMessage, _errorMessage2, _context$logLevel, _context$logLevel2;
|
|
121
|
+
var _errorMessage, _errorMessage2, _context$logLevel, _context$logLevel2, _errorCode;
|
|
122
122
|
if (response.status === 413) {
|
|
123
123
|
throw new FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response), undefined);
|
|
124
124
|
}
|
|
@@ -144,7 +144,7 @@ export class FetchClient {
|
|
|
144
144
|
errorMessage = `Error ${response.status} - ${response.statusText}`;
|
|
145
145
|
}
|
|
146
146
|
if (response.status >= 400 && response.status < 500 && ['warn'].includes((_context$logLevel = context.logLevel) != null ? _context$logLevel : '')) console.warn(errorMessage);else if (response.status === 500 && ['warn', 'error'].includes((_context$logLevel2 = context.logLevel) != null ? _context$logLevel2 : '')) console.error(errorMessage);
|
|
147
|
-
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response), errorCode, errorContext);
|
|
147
|
+
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response), (_errorCode = errorCode) != null ? _errorCode : GENERIC_ERROR_CODE, errorContext);
|
|
148
148
|
}
|
|
149
149
|
if (opts.responseType === 'stream') {
|
|
150
150
|
return response.body;
|
package/constants.d.ts
CHANGED
|
@@ -280,4 +280,5 @@ export declare const urls: {
|
|
|
280
280
|
};
|
|
281
281
|
};
|
|
282
282
|
export declare const GENERIC_ERROR_MESSAGE = "We're facing some difficulties, Please try again";
|
|
283
|
+
export declare const GENERIC_ERROR_CODE = "ER-ADMIN-PORTAL-GENERIC-ERROR";
|
|
283
284
|
export declare const FRONTEGG_TRACE_ID = "frontegg-trace-id";
|
package/constants.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export * from './security-center/interfaces';
|
|
|
57
57
|
export * from './user-phone-numbers/interfaces';
|
|
58
58
|
export * from './applications/interfaces';
|
|
59
59
|
export * from './velo/interfaces';
|
|
60
|
+
export { GENERIC_ERROR_CODE, GENERIC_ERROR_MESSAGE } from './constants';
|
|
60
61
|
/**
|
|
61
62
|
* Frontegg API client for default app
|
|
62
63
|
*
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v7.40.0
|
|
1
|
+
/** @license Frontegg v7.40.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -62,7 +62,7 @@ export * from './security-center/interfaces';
|
|
|
62
62
|
export * from './user-phone-numbers/interfaces';
|
|
63
63
|
export * from './applications/interfaces';
|
|
64
64
|
export * from './velo/interfaces';
|
|
65
|
-
|
|
65
|
+
export { GENERIC_ERROR_CODE, GENERIC_ERROR_MESSAGE } from './constants';
|
|
66
66
|
/**
|
|
67
67
|
* Frontegg API client for default app
|
|
68
68
|
*
|
package/node/FetchClient.js
CHANGED
|
@@ -124,7 +124,7 @@ class FetchClient {
|
|
|
124
124
|
return new Promise(() => {});
|
|
125
125
|
}
|
|
126
126
|
if (!response.ok) {
|
|
127
|
-
var _errorMessage, _errorMessage2, _context$logLevel, _context$logLevel2;
|
|
127
|
+
var _errorMessage, _errorMessage2, _context$logLevel, _context$logLevel2, _errorCode;
|
|
128
128
|
if (response.status === 413) {
|
|
129
129
|
throw new _error.FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response), undefined);
|
|
130
130
|
}
|
|
@@ -150,7 +150,7 @@ class FetchClient {
|
|
|
150
150
|
errorMessage = `Error ${response.status} - ${response.statusText}`;
|
|
151
151
|
}
|
|
152
152
|
if (response.status >= 400 && response.status < 500 && ['warn'].includes((_context$logLevel = context.logLevel) != null ? _context$logLevel : '')) console.warn(errorMessage);else if (response.status === 500 && ['warn', 'error'].includes((_context$logLevel2 = context.logLevel) != null ? _context$logLevel2 : '')) console.error(errorMessage);
|
|
153
|
-
throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response), errorCode, errorContext);
|
|
153
|
+
throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response), (_errorCode = errorCode) != null ? _errorCode : _constants.GENERIC_ERROR_CODE, errorContext);
|
|
154
154
|
}
|
|
155
155
|
if (opts.responseType === 'stream') {
|
|
156
156
|
return response.body;
|
package/node/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.urls = exports.GENERIC_ERROR_MESSAGE = exports.FRONTEGG_TRACE_ID = void 0;
|
|
6
|
+
exports.urls = exports.GENERIC_ERROR_MESSAGE = exports.GENERIC_ERROR_CODE = exports.FRONTEGG_TRACE_ID = void 0;
|
|
7
7
|
const urls = {
|
|
8
8
|
vendor: '/vendors',
|
|
9
9
|
identity: {
|
|
@@ -290,5 +290,7 @@ const urls = {
|
|
|
290
290
|
exports.urls = urls;
|
|
291
291
|
const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`;
|
|
292
292
|
exports.GENERIC_ERROR_MESSAGE = GENERIC_ERROR_MESSAGE;
|
|
293
|
+
const GENERIC_ERROR_CODE = 'ER-ADMIN-PORTAL-GENERIC-ERROR';
|
|
294
|
+
exports.GENERIC_ERROR_CODE = GENERIC_ERROR_CODE;
|
|
293
295
|
const FRONTEGG_TRACE_ID = 'frontegg-trace-id';
|
|
294
296
|
exports.FRONTEGG_TRACE_ID = FRONTEGG_TRACE_ID;
|
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v7.40.0
|
|
1
|
+
/** @license Frontegg v7.40.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -27,7 +27,9 @@ var _exportNames = {
|
|
|
27
27
|
fetch: true,
|
|
28
28
|
FetchClient: true,
|
|
29
29
|
ContextHolder: true,
|
|
30
|
-
FronteggContext: true
|
|
30
|
+
FronteggContext: true,
|
|
31
|
+
GENERIC_ERROR_CODE: true,
|
|
32
|
+
GENERIC_ERROR_MESSAGE: true
|
|
31
33
|
};
|
|
32
34
|
Object.defineProperty(exports, "AuthStrategyEnum", {
|
|
33
35
|
enumerable: true,
|
|
@@ -65,6 +67,18 @@ Object.defineProperty(exports, "FronteggContext", {
|
|
|
65
67
|
return _ContextHolder.FronteggContext;
|
|
66
68
|
}
|
|
67
69
|
});
|
|
70
|
+
Object.defineProperty(exports, "GENERIC_ERROR_CODE", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return _constants.GENERIC_ERROR_CODE;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "GENERIC_ERROR_MESSAGE", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _constants.GENERIC_ERROR_MESSAGE;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
68
82
|
Object.defineProperty(exports, "ISubscriptionCancellationPolicy", {
|
|
69
83
|
enumerable: true,
|
|
70
84
|
get: function () {
|
|
@@ -507,6 +521,7 @@ Object.keys(_interfaces24).forEach(function (key) {
|
|
|
507
521
|
}
|
|
508
522
|
});
|
|
509
523
|
});
|
|
524
|
+
var _constants = require("./constants");
|
|
510
525
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
511
526
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
512
527
|
/**
|