Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@frontegg/rest-api

Package Overview
Dependencies
Maintainers
3
Versions
621
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontegg/rest-api - npm Package Compare versions

Comparing version 3.1.74-alpha.9436511986 to 3.1.74-alpha.9436935127

5

ContextHolder/index.d.ts

@@ -115,10 +115,11 @@ import { SessionContext, ContextOptions, RedirectOptions, RequestSource } from '../interfaces';

getAccessToken: () => string | null;
setAccessToken: (accessToken: string | null) => void;
getUser: () => IUserProfile | null;
setUser: (user: IUserProfile | null) => void;
onRedirectTo: (path: string, opts?: RedirectOptions | undefined) => void;
setOnRedirectTo: (onRedirectTo: (path: string, opts?: RedirectOptions | undefined) => void) => void;
logout: (callback?: (() => void) | undefined) => void;
getRequestSource: () => RequestSource | null;
setAccessToken: (accessToken: string | null) => void;
setUser: (user: IUserProfile | null) => void;
isSessionPerTenantEnabled: () => boolean;
shouldLoadEntitlements: () => boolean;
};

@@ -126,10 +126,11 @@ export class ContextHolder {

getAccessToken: () => ContextHolder.getAccessToken(appName),
setAccessToken: accessToken => ContextHolder.setAccessToken(accessToken, appName),
getUser: () => ContextHolder.getUser(appName),
setUser: user => ContextHolder.setUser(user, appName),
onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts, appName),
setOnRedirectTo: onRedirectTo => ContextHolder.setOnRedirectTo(onRedirectTo, appName),
logout: callback => ContextHolder.logout(callback, appName),
getRequestSource: () => ContextHolder.getRequestSource(appName),
setAccessToken: accessToken => ContextHolder.setAccessToken(accessToken, appName),
setUser: user => ContextHolder.setUser(user, appName),
isSessionPerTenantEnabled: () => ContextHolder.isSessionPerTenantEnabled(appName),
shouldLoadEntitlements: () => ContextHolder.shouldLoadEntitlements(appName)
});

13

FetchClient.d.ts

@@ -25,6 +25,13 @@ import { ContextOptions, RequestOptions, UserJwtOptions } from './interfaces';

};
/** @deprecated use getContextBaseUrl instead */
static getBaseUrl: (context: ContextOptions, url: string, withFronteggPrefix?: boolean) => string;
/** @deprecated use getContextBaseUrl instead */
getBaseUrl: (context: ContextOptions, url: string, withFronteggPrefix?: boolean) => string;
getContextBaseUrl: (url: string, withFronteggPrefix?: boolean) => string;
static getMetadataHeaders: (context: ContextOptions) => Record<string, string>;
/** @deprecated - use getContextMetadataHeaders instead */
getMetadataHeaders: (context: ContextOptions) => Record<string, string>;
getContextMetadataHeaders: () => Record<string, string>;
static getScopedTenant: () => string | null;
}
export declare function getBaseUrl(context: ContextOptions, url: string, withFronteggPrefix?: boolean): string;
export declare function getMetadataHeaders(context: ContextOptions): Record<string, string>;
export declare function getScopedTenant(): string | null;
declare const _default: FetchClient;

@@ -31,0 +38,0 @@ /**

@@ -16,3 +16,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

const context = this.getFronteggContext().getContext();
const baseUrl = getBaseUrl(context, url);
const baseUrl = this.getContextBaseUrl(url);
const paramsToSend = await this.buildQueryParams(context, params);

@@ -94,6 +94,6 @@ let finalUrl = url.startsWith('http') ? url : `${baseUrl}${url}`;

const context = fronteggContext.getContext();
const headers = getMetadataHeaders(context);
const headers = FetchClient.getMetadataHeaders(context);
const authToken = await ((_context$tokenResolve = context == null ? void 0 : context.tokenResolver) != null ? _context$tokenResolve : fronteggContext.getAccessToken)();
const requestSource = fronteggContext.getRequestSource();
const scopedTenant = getScopedTenant();
const scopedTenant = FetchClient.getScopedTenant();

@@ -237,2 +237,20 @@ if (contentType) {

this.getBaseUrl = (context, url, withFronteggPrefix = true) => {
return FetchClient.getBaseUrl(context, url, withFronteggPrefix);
};
this.getContextBaseUrl = (url, withFronteggPrefix = true) => {
const context = this.getFronteggContext().getContext();
return this.getBaseUrl(context, url, withFronteggPrefix);
};
this.getMetadataHeaders = context => {
return FetchClient.getMetadataHeaders(context);
};
this.getContextMetadataHeaders = () => {
const context = this.getFronteggContext().getContext();
return FetchClient.getMetadataHeaders(context);
};
this.appName = appName;

@@ -242,3 +260,4 @@ }

}
export function getBaseUrl(context, url, withFronteggPrefix = true) {
FetchClient.getBaseUrl = (context, url, withFronteggPrefix = true) => {
let baseUrl;

@@ -264,4 +283,5 @@

return baseUrl;
}
export function getMetadataHeaders(context) {
};
FetchClient.getMetadataHeaders = context => {
var _context$metadataHead, _context$metadataHead2;

@@ -280,4 +300,5 @@

return headers;
}
export function getScopedTenant() {
};
FetchClient.getScopedTenant = () => {
const urlParams = new URLSearchParams(window.location.search);

@@ -291,3 +312,4 @@ const scopedTenant = urlParams.get('tenantId');

return null;
}
};
export default new FetchClient('default');

@@ -85,3 +85,3 @@ import { AuthStrategyEnum, MachineToMachineAuthStrategy, SocialLoginProviders } from './auth';

};
declare const createApiClient: (appName: string) => {
export declare type FronteggApiClient = {
auth: AuthenticationApi;

@@ -110,3 +110,4 @@ teams: TeamsApi;

};
export { fetch, ContextHolder, FronteggContext, getFronteggContext, api, createApiClient, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy, };
declare const createApiClient: (appName: string) => FronteggApiClient;
export { fetch, FetchClient, ContextHolder, FronteggContext, getFronteggContext, api, createApiClient, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy, };
declare const _default: {

@@ -126,8 +127,9 @@ fetch: FetchClient;

getAccessToken: () => string | null;
setAccessToken: (accessToken: string | null) => void;
getUser: () => import("./users/interfaces").IGetUsersV2Response | null;
setUser: (user: import("./users/interfaces").IGetUsersV2Response | null) => void;
onRedirectTo: (path: string, opts?: import("./interfaces").RedirectOptions | undefined) => void;
setOnRedirectTo: (onRedirectTo: (path: string, opts?: import("./interfaces").RedirectOptions | undefined) => void) => void;
logout: (callback?: (() => void) | undefined) => void;
getRequestSource: () => import("./interfaces").RequestSource | null;
setAccessToken: (accessToken: string | null) => void;
setUser: (user: import("./users/interfaces").IGetUsersV2Response | null) => void;
isSessionPerTenantEnabled: () => boolean;

@@ -160,26 +162,3 @@ shouldLoadEntitlements: () => boolean;

};
createApiClient: (appName: string) => {
auth: AuthenticationApi;
teams: TeamsApi;
metadata: MetadataApi;
reports: ReportsApi;
connectivity: ConnectivityApi;
notifications: NotificationsApi;
audits: AuditsApi;
tenants: TenantsApi;
accountSettings: AccountSettingsApi;
roles: RolesApi;
subscriptions: SubscriptionsApi;
vendor: VendorApi;
subTenants: SubTenantsApi;
featureFlags: FeatureFlagsApi;
directory: DirectoryApi;
impersonate: ImpersonateApi;
groups: GroupsApi;
users: UsersApi;
entitlements: EntitlementsApi;
securityCenter: SecurityCenterApi;
userPhoneNumbers: PhoneNumbersApi;
applications: ApplicationsApi;
};
createApiClient: (appName: string) => FronteggApiClient;
FronteggApiError: typeof FronteggApiError;

@@ -186,0 +165,0 @@ AuthStrategyEnum: typeof AuthStrategyEnum;

@@ -1,2 +0,2 @@

/** @license Frontegg v3.1.74-alpha.9436511986
/** @license Frontegg v3.1.74-alpha.9436935127
*

@@ -111,3 +111,3 @@ * This source code is licensed under the MIT license found in the

export { fetch, ContextHolder, FronteggContext, getFronteggContext, api, createApiClient, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy };
export { fetch, FetchClient, ContextHolder, FronteggContext, getFronteggContext, api, createApiClient, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy };
export default {

@@ -114,0 +114,0 @@ fetch,

@@ -137,8 +137,9 @@ "use strict";

getAccessToken: () => ContextHolder.getAccessToken(appName),
setAccessToken: accessToken => ContextHolder.setAccessToken(accessToken, appName),
getUser: () => ContextHolder.getUser(appName),
setUser: user => ContextHolder.setUser(user, appName),
onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts, appName),
setOnRedirectTo: onRedirectTo => ContextHolder.setOnRedirectTo(onRedirectTo, appName),
logout: callback => ContextHolder.logout(callback, appName),
getRequestSource: () => ContextHolder.getRequestSource(appName),
setAccessToken: accessToken => ContextHolder.setAccessToken(accessToken, appName),
setUser: user => ContextHolder.setUser(user, appName),
isSessionPerTenantEnabled: () => ContextHolder.isSessionPerTenantEnabled(appName),

@@ -145,0 +146,0 @@ shouldLoadEntitlements: () => ContextHolder.shouldLoadEntitlements(appName)

@@ -9,5 +9,2 @@ "use strict";

exports.default = exports.FetchClient = void 0;
exports.getBaseUrl = getBaseUrl;
exports.getMetadataHeaders = getMetadataHeaders;
exports.getScopedTenant = getScopedTenant;

@@ -34,3 +31,3 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

const context = this.getFronteggContext().getContext();
const baseUrl = getBaseUrl(context, url);
const baseUrl = this.getContextBaseUrl(url);
const paramsToSend = await this.buildQueryParams(context, params);

@@ -112,6 +109,6 @@ let finalUrl = url.startsWith('http') ? url : `${baseUrl}${url}`;

const context = fronteggContext.getContext();
const headers = getMetadataHeaders(context);
const headers = FetchClient.getMetadataHeaders(context);
const authToken = await ((_context$tokenResolve = context == null ? void 0 : context.tokenResolver) != null ? _context$tokenResolve : fronteggContext.getAccessToken)();
const requestSource = fronteggContext.getRequestSource();
const scopedTenant = getScopedTenant();
const scopedTenant = FetchClient.getScopedTenant();

@@ -255,2 +252,20 @@ if (contentType) {

this.getBaseUrl = (context, url, withFronteggPrefix = true) => {
return FetchClient.getBaseUrl(context, url, withFronteggPrefix);
};
this.getContextBaseUrl = (url, withFronteggPrefix = true) => {
const context = this.getFronteggContext().getContext();
return this.getBaseUrl(context, url, withFronteggPrefix);
};
this.getMetadataHeaders = context => {
return FetchClient.getMetadataHeaders(context);
};
this.getContextMetadataHeaders = () => {
const context = this.getFronteggContext().getContext();
return FetchClient.getMetadataHeaders(context);
};
this.appName = appName;

@@ -263,3 +278,3 @@ }

function getBaseUrl(context, url, withFronteggPrefix = true) {
FetchClient.getBaseUrl = (context, url, withFronteggPrefix = true) => {
let baseUrl;

@@ -285,5 +300,5 @@

return baseUrl;
}
};
function getMetadataHeaders(context) {
FetchClient.getMetadataHeaders = context => {
var _context$metadataHead, _context$metadataHead2;

@@ -302,5 +317,5 @@

return headers;
}
};
function getScopedTenant() {
FetchClient.getScopedTenant = () => {
const urlParams = new URLSearchParams(window.location.search);

@@ -314,3 +329,3 @@ const scopedTenant = urlParams.get('tenantId');

return null;
}
};

@@ -317,0 +332,0 @@ var _default = new FetchClient('default');

@@ -1,2 +0,2 @@

/** @license Frontegg v3.1.74-alpha.9436511986
/** @license Frontegg v3.1.74-alpha.9436935127
*

@@ -28,2 +28,3 @@ * This source code is licensed under the MIT license found in the

fetch: true,
FetchClient: true,
ContextHolder: true,

@@ -51,2 +52,8 @@ FronteggContext: true,

});
Object.defineProperty(exports, "FetchClient", {
enumerable: true,
get: function () {
return _FetchClient.FetchClient;
}
});
Object.defineProperty(exports, "FronteggApiError", {

@@ -53,0 +60,0 @@ enumerable: true,

{
"name": "@frontegg/rest-api",
"version": "3.1.74-alpha.9436511986",
"version": "3.1.74-alpha.9436935127",
"main": "./node/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc