@frontegg/rest-api
Advanced tools
Comparing version 7.31.0-alpha.6 to 7.31.0
@@ -13,2 +13,3 @@ 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'; | ||
@@ -766,3 +767,7 @@ import { executeConditionalPromise, getCurrentUserTenantsFunction, getTabTenantFromSessionStorage, setTabTenantInSessionStorage } from './utils'; | ||
shouldLoadEntitlements() { | ||
return ContextHolder.for(this.appName).shouldLoadEntitlements(); | ||
if (!ContextHolder.for(this.appName).shouldLoadEntitlements()) { | ||
return false; | ||
} | ||
const [isEntitlementsFFOn] = FeatureFlags.getFeatureFlags([ADMIN_PORTAL_ENTITLEMENTS_FF], this.appName || ''); | ||
return isEntitlementsFFOn; | ||
} | ||
@@ -769,0 +774,0 @@ |
@@ -283,2 +283,1 @@ 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,3 +284,2 @@ export const urls = { | ||
}; | ||
export const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`; | ||
export const FRONTEGG_TRACE_ID = 'frontegg-trace-id'; | ||
export const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`; |
@@ -10,1 +10,5 @@ export interface Entitlement { | ||
} | ||
/** | ||
* entitlements feature flag | ||
*/ | ||
export declare const ADMIN_PORTAL_ENTITLEMENTS_FF = "admin_portal_entitlements"; |
export let NotEntitledJustification; | ||
/** | ||
* entitlements feature flag | ||
*/ | ||
(function (NotEntitledJustification) { | ||
@@ -6,2 +10,3 @@ NotEntitledJustification["MISSING_PERMISSION"] = "MISSING_PERMISSION"; | ||
NotEntitledJustification["BUNDLE_EXPIRED"] = "BUNDLE_EXPIRED"; | ||
})(NotEntitledJustification || (NotEntitledJustification = {})); | ||
})(NotEntitledJustification || (NotEntitledJustification = {})); | ||
export const ADMIN_PORTAL_ENTITLEMENTS_FF = 'admin_portal_entitlements'; |
export declare class FronteggApiError extends Error { | ||
private readonly _statusCode; | ||
private readonly _traceId; | ||
constructor(message: string, statusCode: number, traceId: string | null); | ||
constructor(message: string, statusCode: number); | ||
get statusCode(): number; | ||
get traceId(): string | null; | ||
} |
export class FronteggApiError extends Error { | ||
constructor(message, statusCode, traceId) { | ||
constructor(message, statusCode) { | ||
super(message); | ||
this._statusCode = void 0; | ||
this._traceId = void 0; | ||
this._statusCode = statusCode; | ||
this._traceId = traceId; | ||
} | ||
@@ -12,5 +10,2 @@ get statusCode() { | ||
} | ||
get traceId() { | ||
return this._traceId; | ||
} | ||
} |
@@ -15,3 +15,2 @@ import { ContextOptions, RequestOptions, UserJwtOptions } from './interfaces'; | ||
private buildRequestHeaders; | ||
private getResponseTraceId; | ||
sendRequest: (opts: RequestOptions) => Promise<any>; | ||
@@ -18,0 +17,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 { FRONTEGG_TRACE_ID, GENERIC_ERROR_MESSAGE } from './constants'; | ||
import { GENERIC_ERROR_MESSAGE } from './constants'; | ||
import { fronteggHeaders } from './interfaces'; | ||
@@ -98,6 +98,2 @@ | ||
}; | ||
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 => { | ||
@@ -124,3 +120,3 @@ var _opts$method, _ref, _opts$credentials; | ||
if (response.status === 413) { | ||
throw new FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response)); | ||
throw new FronteggApiError('Error request is too large', response.status); | ||
} | ||
@@ -141,3 +137,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, this.getResponseTraceId(response)); | ||
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status); | ||
} | ||
@@ -144,0 +140,0 @@ if (opts.responseType === 'stream') { |
@@ -1,2 +0,2 @@ | ||
/** @license Frontegg v7.31.0-alpha.6 | ||
/** @license Frontegg v7.31.0 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -78,2 +78,3 @@ "use strict"; | ||
var _interfaces = require("./interfaces"); | ||
var _interfaces2 = require("../entitlements/interfaces"); | ||
var _featureFlags = require("../feature-flags"); | ||
@@ -832,3 +833,7 @@ var _tenants = require("../tenants"); | ||
shouldLoadEntitlements() { | ||
return _ContextHolder.ContextHolder.for(this.appName).shouldLoadEntitlements(); | ||
if (!_ContextHolder.ContextHolder.for(this.appName).shouldLoadEntitlements()) { | ||
return false; | ||
} | ||
const [isEntitlementsFFOn] = _featureFlags.FeatureFlags.getFeatureFlags([_interfaces2.ADMIN_PORTAL_ENTITLEMENTS_FF], this.appName || ''); | ||
return isEntitlementsFFOn; | ||
} | ||
@@ -835,0 +840,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.urls = exports.GENERIC_ERROR_MESSAGE = exports.FRONTEGG_TRACE_ID = void 0; | ||
exports.urls = exports.GENERIC_ERROR_MESSAGE = void 0; | ||
const urls = { | ||
@@ -293,4 +293,2 @@ vendor: '/vendors', | ||
const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`; | ||
exports.GENERIC_ERROR_MESSAGE = GENERIC_ERROR_MESSAGE; | ||
const FRONTEGG_TRACE_ID = 'frontegg-trace-id'; | ||
exports.FRONTEGG_TRACE_ID = FRONTEGG_TRACE_ID; | ||
exports.GENERIC_ERROR_MESSAGE = GENERIC_ERROR_MESSAGE; |
@@ -6,4 +6,7 @@ "use strict"; | ||
}); | ||
exports.NotEntitledJustification = void 0; | ||
exports.NotEntitledJustification = exports.ADMIN_PORTAL_ENTITLEMENTS_FF = void 0; | ||
let NotEntitledJustification; | ||
/** | ||
* entitlements feature flag | ||
*/ | ||
exports.NotEntitledJustification = NotEntitledJustification; | ||
@@ -14,2 +17,4 @@ (function (NotEntitledJustification) { | ||
NotEntitledJustification["BUNDLE_EXPIRED"] = "BUNDLE_EXPIRED"; | ||
})(NotEntitledJustification || (exports.NotEntitledJustification = NotEntitledJustification = {})); | ||
})(NotEntitledJustification || (exports.NotEntitledJustification = NotEntitledJustification = {})); | ||
const ADMIN_PORTAL_ENTITLEMENTS_FF = 'admin_portal_entitlements'; | ||
exports.ADMIN_PORTAL_ENTITLEMENTS_FF = ADMIN_PORTAL_ENTITLEMENTS_FF; |
@@ -8,8 +8,6 @@ "use strict"; | ||
class FronteggApiError extends Error { | ||
constructor(message, statusCode, traceId) { | ||
constructor(message, statusCode) { | ||
super(message); | ||
this._statusCode = void 0; | ||
this._traceId = void 0; | ||
this._statusCode = statusCode; | ||
this._traceId = traceId; | ||
} | ||
@@ -19,6 +17,3 @@ get statusCode() { | ||
} | ||
get traceId() { | ||
return this._traceId; | ||
} | ||
} | ||
exports.FronteggApiError = FronteggApiError; |
@@ -104,6 +104,2 @@ "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 => { | ||
@@ -130,3 +126,3 @@ var _opts$method, _ref, _opts$credentials; | ||
if (response.status === 413) { | ||
throw new _error.FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response)); | ||
throw new _error.FronteggApiError('Error request is too large', response.status); | ||
} | ||
@@ -147,3 +143,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, this.getResponseTraceId(response)); | ||
throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status); | ||
} | ||
@@ -150,0 +146,0 @@ if (opts.responseType === 'stream') { |
@@ -1,2 +0,2 @@ | ||
/** @license Frontegg v7.31.0-alpha.6 | ||
/** @license Frontegg v7.31.0 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
{ | ||
"name": "@frontegg/rest-api", | ||
"version": "7.31.0-alpha.6", | ||
"version": "7.31.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
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
1
509850
13355