@frontegg/rest-api
Advanced tools
Comparing version 7.30.0 to 7.31.0-alpha.0
@@ -13,3 +13,2 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
import { LOAD_AUTHORIZATION_FF } from './interfaces'; | ||
import { ADMIN_PORTAL_ENTITLEMENTS_FF } from '../entitlements/interfaces'; | ||
import { FeatureFlags } from '../feature-flags'; | ||
@@ -767,7 +766,3 @@ import { executeConditionalPromise, getCurrentUserTenantsFunction, getTabTenantFromSessionStorage, setTabTenantInSessionStorage } from './utils'; | ||
shouldLoadEntitlements() { | ||
if (!ContextHolder.for(this.appName).shouldLoadEntitlements()) { | ||
return false; | ||
} | ||
const [isEntitlementsFFOn] = FeatureFlags.getFeatureFlags([ADMIN_PORTAL_ENTITLEMENTS_FF], this.appName || ''); | ||
return isEntitlementsFFOn; | ||
return ContextHolder.for(this.appName).shouldLoadEntitlements(); | ||
} | ||
@@ -774,0 +769,0 @@ |
@@ -283,1 +283,2 @@ export declare const urls: { | ||
export declare const GENERIC_ERROR_MESSAGE = "We're facing some difficulties, Please try again"; | ||
export declare const FRONTEGG_TRACE_ID = "frontegg-trace-id"; |
@@ -284,2 +284,3 @@ export const urls = { | ||
}; | ||
export const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`; | ||
export const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`; | ||
export const FRONTEGG_TRACE_ID = 'frontegg-trace-id'; |
@@ -10,5 +10,1 @@ export interface Entitlement { | ||
} | ||
/** | ||
* entitlements feature flag | ||
*/ | ||
export declare const ADMIN_PORTAL_ENTITLEMENTS_FF = "admin_portal_entitlements"; |
export let NotEntitledJustification; | ||
/** | ||
* entitlements feature flag | ||
*/ | ||
(function (NotEntitledJustification) { | ||
@@ -10,3 +6,2 @@ NotEntitledJustification["MISSING_PERMISSION"] = "MISSING_PERMISSION"; | ||
NotEntitledJustification["BUNDLE_EXPIRED"] = "BUNDLE_EXPIRED"; | ||
})(NotEntitledJustification || (NotEntitledJustification = {})); | ||
export const ADMIN_PORTAL_ENTITLEMENTS_FF = 'admin_portal_entitlements'; | ||
})(NotEntitledJustification || (NotEntitledJustification = {})); |
export declare class FronteggApiError extends Error { | ||
private readonly _statusCode; | ||
constructor(message: string, statusCode: number); | ||
private readonly _traceId; | ||
constructor(message: string, statusCode: number, traceId: string | null); | ||
get statusCode(): number; | ||
get traceId(): string | null; | ||
} |
export class FronteggApiError extends Error { | ||
constructor(message, statusCode) { | ||
constructor(message, statusCode, traceId) { | ||
super(message); | ||
this._statusCode = void 0; | ||
this._traceId = void 0; | ||
this._statusCode = statusCode; | ||
this._traceId = traceId; | ||
} | ||
@@ -10,2 +12,5 @@ get statusCode() { | ||
} | ||
get traceId() { | ||
return this._traceId; | ||
} | ||
} |
@@ -15,2 +15,3 @@ import { ContextOptions, RequestOptions, UserJwtOptions } from './interfaces'; | ||
private buildRequestHeaders; | ||
private getResponseTraceId; | ||
sendRequest: (opts: RequestOptions) => Promise<any>; | ||
@@ -17,0 +18,0 @@ get: (url: string, params?: any, opts?: Omit<RequestOptions, "method" | "url">) => Promise<any>; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import { ContextHolder } from './ContextHolder'; | ||
import { FronteggApiError } from './error'; | ||
import { GENERIC_ERROR_MESSAGE } from './constants'; | ||
import { FRONTEGG_TRACE_ID, GENERIC_ERROR_MESSAGE } from './constants'; | ||
import { fronteggHeaders } from './interfaces'; | ||
@@ -98,2 +98,6 @@ | ||
}; | ||
this.getResponseTraceId = response => { | ||
var _response$headers, _response$headers$get; | ||
return response == null ? void 0 : (_response$headers = response.headers) == null ? void 0 : (_response$headers$get = _response$headers.get) == null ? void 0 : _response$headers$get.call(_response$headers, FRONTEGG_TRACE_ID); | ||
}; | ||
this.sendRequest = async opts => { | ||
@@ -120,3 +124,3 @@ var _opts$method, _ref, _opts$credentials; | ||
if (response.status === 413) { | ||
throw new FronteggApiError('Error request is too large', response.status); | ||
throw new FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response)); | ||
} | ||
@@ -137,3 +141,3 @@ let errorMessage; | ||
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); | ||
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status); | ||
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response)); | ||
} | ||
@@ -140,0 +144,0 @@ if (opts.responseType === 'stream') { |
@@ -1,2 +0,2 @@ | ||
/** @license Frontegg v7.30.0 | ||
/** @license Frontegg v7.31.0-alpha.0 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -78,3 +78,2 @@ "use strict"; | ||
var _interfaces = require("./interfaces"); | ||
var _interfaces2 = require("../entitlements/interfaces"); | ||
var _featureFlags = require("../feature-flags"); | ||
@@ -833,7 +832,3 @@ var _tenants = require("../tenants"); | ||
shouldLoadEntitlements() { | ||
if (!_ContextHolder.ContextHolder.for(this.appName).shouldLoadEntitlements()) { | ||
return false; | ||
} | ||
const [isEntitlementsFFOn] = _featureFlags.FeatureFlags.getFeatureFlags([_interfaces2.ADMIN_PORTAL_ENTITLEMENTS_FF], this.appName || ''); | ||
return isEntitlementsFFOn; | ||
return _ContextHolder.ContextHolder.for(this.appName).shouldLoadEntitlements(); | ||
} | ||
@@ -840,0 +835,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.urls = exports.GENERIC_ERROR_MESSAGE = void 0; | ||
exports.urls = exports.GENERIC_ERROR_MESSAGE = exports.FRONTEGG_TRACE_ID = void 0; | ||
const urls = { | ||
@@ -293,2 +293,4 @@ vendor: '/vendors', | ||
const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`; | ||
exports.GENERIC_ERROR_MESSAGE = GENERIC_ERROR_MESSAGE; | ||
exports.GENERIC_ERROR_MESSAGE = GENERIC_ERROR_MESSAGE; | ||
const FRONTEGG_TRACE_ID = 'frontegg-trace-id'; | ||
exports.FRONTEGG_TRACE_ID = FRONTEGG_TRACE_ID; |
@@ -6,7 +6,4 @@ "use strict"; | ||
}); | ||
exports.NotEntitledJustification = exports.ADMIN_PORTAL_ENTITLEMENTS_FF = void 0; | ||
exports.NotEntitledJustification = void 0; | ||
let NotEntitledJustification; | ||
/** | ||
* entitlements feature flag | ||
*/ | ||
exports.NotEntitledJustification = NotEntitledJustification; | ||
@@ -17,4 +14,2 @@ (function (NotEntitledJustification) { | ||
NotEntitledJustification["BUNDLE_EXPIRED"] = "BUNDLE_EXPIRED"; | ||
})(NotEntitledJustification || (exports.NotEntitledJustification = NotEntitledJustification = {})); | ||
const ADMIN_PORTAL_ENTITLEMENTS_FF = 'admin_portal_entitlements'; | ||
exports.ADMIN_PORTAL_ENTITLEMENTS_FF = ADMIN_PORTAL_ENTITLEMENTS_FF; | ||
})(NotEntitledJustification || (exports.NotEntitledJustification = NotEntitledJustification = {})); |
@@ -8,6 +8,8 @@ "use strict"; | ||
class FronteggApiError extends Error { | ||
constructor(message, statusCode) { | ||
constructor(message, statusCode, traceId) { | ||
super(message); | ||
this._statusCode = void 0; | ||
this._traceId = void 0; | ||
this._statusCode = statusCode; | ||
this._traceId = traceId; | ||
} | ||
@@ -17,3 +19,6 @@ get statusCode() { | ||
} | ||
get traceId() { | ||
return this._traceId; | ||
} | ||
} | ||
exports.FronteggApiError = FronteggApiError; |
@@ -104,2 +104,6 @@ "use strict"; | ||
}; | ||
this.getResponseTraceId = response => { | ||
var _response$headers, _response$headers$get; | ||
return response == null ? void 0 : (_response$headers = response.headers) == null ? void 0 : (_response$headers$get = _response$headers.get) == null ? void 0 : _response$headers$get.call(_response$headers, _constants.FRONTEGG_TRACE_ID); | ||
}; | ||
this.sendRequest = async opts => { | ||
@@ -126,3 +130,3 @@ var _opts$method, _ref, _opts$credentials; | ||
if (response.status === 413) { | ||
throw new _error.FronteggApiError('Error request is too large', response.status); | ||
throw new _error.FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response)); | ||
} | ||
@@ -143,3 +147,3 @@ let errorMessage; | ||
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); | ||
throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status); | ||
throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response)); | ||
} | ||
@@ -146,0 +150,0 @@ if (opts.responseType === 'stream') { |
@@ -1,2 +0,2 @@ | ||
/** @license Frontegg v7.30.0 | ||
/** @license Frontegg v7.31.0-alpha.0 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
{ | ||
"name": "@frontegg/rest-api", | ||
"version": "7.30.0", | ||
"version": "7.31.0-alpha.0", | ||
"main": "./node/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
510357
13357
2