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

@frontegg/rest-api

Package Overview
Dependencies
Maintainers
1
Versions
607
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 1.8.0 to 1.9.0

audits/index.d.ts

9

constants.d.ts

@@ -8,5 +8,5 @@ export declare const AUTH_SERVICE_URL_V1 = "/identity/resources/auth/v1";

export declare const TEAMS_SERVICE_URL_V1 = "/team";
export declare const INTEGRATIONS_SERVICE_URL_V1 = "/integrations/resources/configurations/v1";
export declare const INTEGRATIONS_SERVICE_URL_V2 = "/integrations/resources/configurations/v2";
export declare const INTEGRATIONS_SERVICE_WEBHOOKS_URL = "/webhook";
export declare const CONNECTIVITY_SERVICE_URL_V1 = "/integrations/resources/configurations/v1";
export declare const CONNECTIVITY_SERVICE_URL_V2 = "/integrations/resources/configurations/v2";
export declare const CONNECTIVITY_SERVICE_WEBHOOKS_URL = "/webhook";
export declare const EVENT_RESOURCES_URL_V1 = "/event/resources/configurations/v1";

@@ -19,1 +19,4 @@ export declare const IDENTITY_SSO_SERVICE_URL_V1 = "/identity/resources/sso/v1";

export declare const NOTIFICATIONS_SERVICE_URL = "/notification";
export declare const AUDITS_SERVICE_URL = "/audits";
export declare const AUDITS_SERVICE_EXPORT_URL = "/audits/export";
export declare const TENANTS_SERVICE_V1 = "/tenants/resources/tenants/v1";

@@ -16,3 +16,3 @@ interface RequestOptions {

export declare const Delete: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
export declare const PostDownload: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
export declare const PostDownload: (url: string, body?: any, params?: any, opts?: any) => Promise<any>;
export {};

@@ -6,4 +6,6 @@ import * as auth from './auth';

import * as notifications from './notifications';
import * as audits from './audits';
import * as fetch from './fetch';
import * as integrations from './integrations';
import * as connectivity from './connectivity';
import * as tenants from './tenants';
import { ContextHolder, FronteggContext } from './ContextHolder';

@@ -15,4 +17,6 @@ export * from './interfaces';

export * from './reports/interfaces';
export * from './integrations/interfaces';
export * from './connectivity/interfaces';
export * from './notifications/interfaces';
export * from './audits/interfaces';
export * from './tenants/interfaces';
declare const api: {

@@ -23,5 +27,7 @@ auth: typeof auth;

reports: typeof reports;
integrations: typeof integrations;
connectivity: typeof connectivity;
notifications: typeof notifications;
audits: typeof audits;
tenants: typeof tenants;
};
export { fetch, ContextHolder, FronteggContext, api };

@@ -295,5 +295,6 @@ import { __awaiter, __generator, __assign, __rest } from 'tslib';

}); };
var PostDownload = function (url, body, opts) { return __awaiter(void 0, void 0, void 0, function () {
var PostDownload = function (url, body, params, opts) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, sendRequest(__assign({ url: url, method: 'GET', contentType: 'application/json', responseType: 'blob', body: body }, opts))];
return [2 /*return*/, sendRequest(__assign({ url: url, method: 'POST', contentType: 'application/json', responseType: 'blob', body: body,
params: params }, opts))];
});

@@ -316,5 +317,5 @@ }); };

var SSO_SERVICE_URL_V1 = '/team/resources/sso/v1';
var INTEGRATIONS_SERVICE_URL_V1 = '/integrations/resources/configurations/v1';
var INTEGRATIONS_SERVICE_URL_V2 = '/integrations/resources/configurations/v2';
var INTEGRATIONS_SERVICE_WEBHOOKS_URL = '/webhook';
var CONNECTIVITY_SERVICE_URL_V1 = '/integrations/resources/configurations/v1';
var CONNECTIVITY_SERVICE_URL_V2 = '/integrations/resources/configurations/v2';
var CONNECTIVITY_SERVICE_WEBHOOKS_URL = '/webhook';
var EVENT_RESOURCES_URL_V1 = '/event/resources/configurations/v1';

@@ -327,2 +328,5 @@ var IDENTITY_SSO_SERVICE_URL_V1 = '/identity/resources/sso/v1';

var NOTIFICATIONS_SERVICE_URL = '/notification';
var AUDITS_SERVICE_URL = '/audits';
var AUDITS_SERVICE_EXPORT_URL = '/audits/export';
var TENANTS_SERVICE_V1 = '/tenants/resources/tenants/v1';

@@ -908,2 +912,17 @@ /* tslint:disable:no-console */

}
function getIpMetadata(ip) {
return __awaiter(this, void 0, void 0, function () {
var data;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Get("/metadata/ip/" + ip)];
case 1:
data = _a.sent();
if (data)
return [2 /*return*/, data];
throw new Error("ip metadata not found");
}
});
});
}
var getNotificationsMetadata = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {

@@ -915,2 +934,8 @@ return [2 /*return*/, getMetadata({ entityName: 'notifications' })];

}); }); };
var getAuditsMetadata = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, getMetadata({ entityName: 'audits' })];
}); }); };
var getIpAdressMetadata = function (ip) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, getIpMetadata(ip)];
}); }); };

@@ -920,3 +945,5 @@ var metadata = /*#__PURE__*/Object.freeze({

getNotificationsMetadata: getNotificationsMetadata,
getSamlMetadata: getSamlMetadata
getSamlMetadata: getSamlMetadata,
getAuditsMetadata: getAuditsMetadata,
getIpAdressMetadata: getIpAdressMetadata
});

@@ -986,13 +1013,58 @@

/*****************************************
* Audits Api
*****************************************/
/**
* get Audits
*/
function getAudits(params) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
console.debug('getAudits()');
return [2 /*return*/, Get("" + AUDITS_SERVICE_URL, params)];
});
});
}
/**
* get Audits Stats
*/
function getAuditsStats(params) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
console.debug('getAuditsStats()');
return [2 /*return*/, Get(AUDITS_SERVICE_URL + "/stats", params)];
});
});
}
/**
* export Audits
*/
function exportAudits(params) {
return __awaiter(this, void 0, void 0, function () {
var format, headerProps, restParams;
return __generator(this, function (_a) {
format = params.format, headerProps = params.headerProps, restParams = __rest(params, ["format", "headerProps"]);
return [2 /*return*/, PostDownload(AUDITS_SERVICE_EXPORT_URL + "/" + format, { properties: headerProps }, restParams)];
});
});
}
var audits = /*#__PURE__*/Object.freeze({
__proto__: null,
getAudits: getAudits,
getAuditsStats: getAuditsStats,
exportAudits: exportAudits
});
var getSlackConfiguration = function () {
console.debug('getSlackConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/slack");
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/slack");
};
var getSlackScope = function () {
console.debug('getSlackConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/slack/applications");
console.debug('getSlackScope()');
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/slack/applications");
};
var getSlackChannels = function () {
console.debug('getSlackChannels()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/slack/channels");
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/slack/channels");
};

@@ -1002,17 +1074,17 @@ var postSlackConfiguration = function (data) {

if (data.id) {
return Patch(INTEGRATIONS_SERVICE_URL_V1 + "/slack/subscription/" + data.id, data);
return Patch(CONNECTIVITY_SERVICE_URL_V1 + "/slack/subscription/" + data.id, data);
}
return Post(INTEGRATIONS_SERVICE_URL_V1 + "/slack/subscriptions", data);
return Post(CONNECTIVITY_SERVICE_URL_V1 + "/slack/subscriptions", data);
};
var deleteSlackConfiguration = function (data) {
console.debug('deleteSlackConfiguration()', data);
return Delete(INTEGRATIONS_SERVICE_URL_V1 + "/slack/subscriptions/" + data.id);
return Delete(CONNECTIVITY_SERVICE_URL_V1 + "/slack/subscriptions/" + data.id);
};
var postSlackCode = function (code) {
console.debug('deleteSlackConfiguration()', { code: code });
return Post(INTEGRATIONS_SERVICE_URL_V1 + "/slack//applications/registrations", { code: code });
console.debug('postSlackCode()', { code: code });
return Post(CONNECTIVITY_SERVICE_URL_V1 + "/slack//applications/registrations", { code: code });
};
var getEmailConfiguration = function () {
console.debug('getEmailConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/emails");
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/emails");
};

@@ -1022,3 +1094,3 @@ var postEmailConfiguration = function (_a) {

console.debug('postEmailConfiguration()', __assign(__assign({}, data), { eventKey: eventKey }));
return Post(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey, data);
return Post(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey, data);
};

@@ -1028,19 +1100,19 @@ var patchEmailConfiguration = function (_a) {

console.debug('patchEmailConfiguration()', { eventKey: eventKey, enabled: enabled });
return Patch(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey, { enabled: enabled });
return Patch(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey, { enabled: enabled });
};
var deleteEmailSubscriptions = function (eventKey, subscriptionId) {
console.debug('deleteEmailSubscriptions()', { eventKey: eventKey, subscriptionId: subscriptionId });
return Delete(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId);
return Delete(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId);
};
var putEmailSubscriptions = function (subscriptionId, eventKey, data) {
console.debug('putEmailSubscriptions()', __assign(__assign({}, data), { subscriptionId: subscriptionId, eventKey: eventKey }));
return Put(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId, data);
return Put(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId, data);
};
var deleteEmailConfiguration = function (eventKey) {
console.debug('deleteEmailConfiguration()', { eventKey: eventKey });
return Delete(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey);
return Delete(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey);
};
var getSMSConfiguration = function () {
console.debug('getSMSConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V2 + "/sms");
return Get(CONNECTIVITY_SERVICE_URL_V2 + "/sms");
};

@@ -1050,3 +1122,3 @@ var postSMSConfiguration = function (_a) {

console.debug('postSMSConfiguration()', __assign(__assign({}, data), { eventKey: eventKey }));
return Post(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey, data);
return Post(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey, data);
};

@@ -1056,19 +1128,19 @@ var patchSMSConfiguration = function (_a) {

console.debug('patchSMSConfiguration()', { eventKey: eventKey, enabled: enabled });
return Patch(INTEGRATIONS_SERVICE_URL_V2 + "/sma/" + eventKey, { enabled: enabled });
return Patch(CONNECTIVITY_SERVICE_URL_V2 + "/sma/" + eventKey, { enabled: enabled });
};
var deletesmsSubscriptions = function (eventKey, subscriptionId) {
console.debug('deletesmsSubscriptions()', { eventKey: eventKey, subscriptionId: subscriptionId });
return Delete(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId);
return Delete(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId);
};
var putSMSSubscriptions = function (subscriptionId, eventKey, data) {
console.debug('putSMSSubscriptions()', __assign(__assign({}, data), { subscriptionId: subscriptionId, eventKey: eventKey }));
return Put(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId, data);
return Put(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId, data);
};
var deleteSMSConfiguration = function (eventKey) {
console.debug('deleteSMSConfiguration()', { eventKey: eventKey });
return Delete(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey);
return Delete(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey);
};
var getWebhooksConfigurations = function () {
console.debug('getWebhooksConfigurations()');
return Get(INTEGRATIONS_SERVICE_WEBHOOKS_URL);
return Get(CONNECTIVITY_SERVICE_WEBHOOKS_URL);
};

@@ -1078,6 +1150,6 @@ var postWebhooksConfiguration = function (data) {

if (data._id) {
return Patch(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/" + data._id, data);
return Patch(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/" + data._id, data);
}
else {
return Post(INTEGRATIONS_SERVICE_WEBHOOKS_URL, data);
return Post(CONNECTIVITY_SERVICE_WEBHOOKS_URL, data);
}

@@ -1087,3 +1159,3 @@ };

console.debug('deleteWebhooksConfiguration()', id);
return Delete(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/" + id);
return Delete(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/" + id);
};

@@ -1095,7 +1167,7 @@ var getWebhookLog = function (id, offset, limit) {

var query = new URLSearchParams({ id: id, offset: "" + offset, limit: "" + limit });
return Get(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/logs/?" + query.toString());
return Get(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/logs/?" + query.toString());
};
var postWebhookTest = function (data) {
console.debug('postWebhookTest', data);
return Post(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/test", data);
return Post(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/test", data);
};

@@ -1111,3 +1183,3 @@ var getCategories = function () {

var integrations = /*#__PURE__*/Object.freeze({
var connectivity = /*#__PURE__*/Object.freeze({
__proto__: null,

@@ -1141,2 +1213,36 @@ getSlackConfiguration: getSlackConfiguration,

/**
* switch logged in user to specific tenant by providing tenantId.
*
* @throws exception if invalid tenantId.
* ``authorized user``
*/
function switchTenant(body) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
console.debug('switchTenant()', body);
return [2 /*return*/, Put(USERS_SERVICE_URL_V1 + "/tenant", body)];
});
});
}
/**
* retrieve logged in user's available tenants.
*
* ``authorized user``
*/
function getTenants() {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
console.debug('getTenants()');
return [2 /*return*/, Get(TENANTS_SERVICE_V1)];
});
});
}
var tenants = /*#__PURE__*/Object.freeze({
__proto__: null,
switchTenant: switchTenant,
getTenants: getTenants
});
var SocialLoginsProviders;

@@ -1153,4 +1259,6 @@ (function (SocialLoginsProviders) {

reports: reports,
integrations: integrations,
connectivity: connectivity,
notifications: notifications,
audits: audits,
tenants: tenants,
};

@@ -1157,0 +1265,0 @@

@@ -206,4 +206,5 @@ import { __awaiter, __rest } from 'tslib';

});
const PostDownload = (url, body, opts) => __awaiter(void 0, void 0, void 0, function* () {
return sendRequest(Object.assign({ url, method: 'GET', contentType: 'application/json', responseType: 'blob', body }, opts));
const PostDownload = (url, body, params, opts) => __awaiter(void 0, void 0, void 0, function* () {
return sendRequest(Object.assign({ url, method: 'POST', contentType: 'application/json', responseType: 'blob', body,
params }, opts));
});

@@ -225,5 +226,5 @@

const SSO_SERVICE_URL_V1 = '/team/resources/sso/v1';
const INTEGRATIONS_SERVICE_URL_V1 = '/integrations/resources/configurations/v1';
const INTEGRATIONS_SERVICE_URL_V2 = '/integrations/resources/configurations/v2';
const INTEGRATIONS_SERVICE_WEBHOOKS_URL = '/webhook';
const CONNECTIVITY_SERVICE_URL_V1 = '/integrations/resources/configurations/v1';
const CONNECTIVITY_SERVICE_URL_V2 = '/integrations/resources/configurations/v2';
const CONNECTIVITY_SERVICE_WEBHOOKS_URL = '/webhook';
const EVENT_RESOURCES_URL_V1 = '/event/resources/configurations/v1';

@@ -236,2 +237,5 @@ const IDENTITY_SSO_SERVICE_URL_V1 = '/identity/resources/sso/v1';

const NOTIFICATIONS_SERVICE_URL = '/notification';
const AUDITS_SERVICE_URL = '/audits';
const AUDITS_SERVICE_EXPORT_URL = '/audits/export';
const TENANTS_SERVICE_V1 = '/tenants/resources/tenants/v1';

@@ -701,4 +705,14 @@ /* tslint:disable:no-console */

}
function getIpMetadata(ip) {
return __awaiter(this, void 0, void 0, function* () {
const data = yield Get(`/metadata/ip/${ip}`);
if (data)
return data;
throw new Error(`ip metadata not found`);
});
}
const getNotificationsMetadata = () => __awaiter(void 0, void 0, void 0, function* () { return getMetadata({ entityName: 'notifications' }); });
const getSamlMetadata = () => __awaiter(void 0, void 0, void 0, function* () { return getMetadata({ entityName: 'saml' }); });
const getAuditsMetadata = () => __awaiter(void 0, void 0, void 0, function* () { return getMetadata({ entityName: 'audits' }); });
const getIpAdressMetadata = (ip) => __awaiter(void 0, void 0, void 0, function* () { return getIpMetadata(ip); });

@@ -708,3 +722,5 @@ var metadata = /*#__PURE__*/Object.freeze({

getNotificationsMetadata: getNotificationsMetadata,
getSamlMetadata: getSamlMetadata
getSamlMetadata: getSamlMetadata,
getAuditsMetadata: getAuditsMetadata,
getIpAdressMetadata: getIpAdressMetadata
});

@@ -765,13 +781,51 @@

/*****************************************
* Audits Api
*****************************************/
/**
* get Audits
*/
function getAudits(params) {
return __awaiter(this, void 0, void 0, function* () {
console.debug('getAudits()');
return Get(`${AUDITS_SERVICE_URL}`, params);
});
}
/**
* get Audits Stats
*/
function getAuditsStats(params) {
return __awaiter(this, void 0, void 0, function* () {
console.debug('getAuditsStats()');
return Get(`${AUDITS_SERVICE_URL}/stats`, params);
});
}
/**
* export Audits
*/
function exportAudits(params) {
return __awaiter(this, void 0, void 0, function* () {
const { format, headerProps } = params, restParams = __rest(params, ["format", "headerProps"]);
return PostDownload(`${AUDITS_SERVICE_EXPORT_URL}/${format}`, { properties: headerProps }, restParams);
});
}
var audits = /*#__PURE__*/Object.freeze({
__proto__: null,
getAudits: getAudits,
getAuditsStats: getAuditsStats,
exportAudits: exportAudits
});
const getSlackConfiguration = () => {
console.debug('getSlackConfiguration()');
return Get(`${INTEGRATIONS_SERVICE_URL_V1}/slack`);
return Get(`${CONNECTIVITY_SERVICE_URL_V1}/slack`);
};
const getSlackScope = () => {
console.debug('getSlackConfiguration()');
return Get(`${INTEGRATIONS_SERVICE_URL_V1}/slack/applications`);
console.debug('getSlackScope()');
return Get(`${CONNECTIVITY_SERVICE_URL_V1}/slack/applications`);
};
const getSlackChannels = () => {
console.debug('getSlackChannels()');
return Get(`${INTEGRATIONS_SERVICE_URL_V1}/slack/channels`);
return Get(`${CONNECTIVITY_SERVICE_URL_V1}/slack/channels`);
};

@@ -781,17 +835,17 @@ const postSlackConfiguration = (data) => {

if (data.id) {
return Patch(`${INTEGRATIONS_SERVICE_URL_V1}/slack/subscription/${data.id}`, data);
return Patch(`${CONNECTIVITY_SERVICE_URL_V1}/slack/subscription/${data.id}`, data);
}
return Post(`${INTEGRATIONS_SERVICE_URL_V1}/slack/subscriptions`, data);
return Post(`${CONNECTIVITY_SERVICE_URL_V1}/slack/subscriptions`, data);
};
const deleteSlackConfiguration = (data) => {
console.debug('deleteSlackConfiguration()', data);
return Delete(`${INTEGRATIONS_SERVICE_URL_V1}/slack/subscriptions/${data.id}`);
return Delete(`${CONNECTIVITY_SERVICE_URL_V1}/slack/subscriptions/${data.id}`);
};
const postSlackCode = (code) => {
console.debug('deleteSlackConfiguration()', { code });
return Post(`${INTEGRATIONS_SERVICE_URL_V1}/slack//applications/registrations`, { code });
console.debug('postSlackCode()', { code });
return Post(`${CONNECTIVITY_SERVICE_URL_V1}/slack//applications/registrations`, { code });
};
const getEmailConfiguration = () => {
console.debug('getEmailConfiguration()');
return Get(`${INTEGRATIONS_SERVICE_URL_V1}/emails`);
return Get(`${CONNECTIVITY_SERVICE_URL_V1}/emails`);
};

@@ -801,23 +855,23 @@ const postEmailConfiguration = (_a) => {

console.debug('postEmailConfiguration()', Object.assign(Object.assign({}, data), { eventKey }));
return Post(`${INTEGRATIONS_SERVICE_URL_V1}/emails/${eventKey}`, data);
return Post(`${CONNECTIVITY_SERVICE_URL_V1}/emails/${eventKey}`, data);
};
const patchEmailConfiguration = ({ eventKey, enabled, }) => {
console.debug('patchEmailConfiguration()', { eventKey, enabled });
return Patch(`${INTEGRATIONS_SERVICE_URL_V1}/emails/${eventKey}`, { enabled });
return Patch(`${CONNECTIVITY_SERVICE_URL_V1}/emails/${eventKey}`, { enabled });
};
const deleteEmailSubscriptions = (eventKey, subscriptionId) => {
console.debug('deleteEmailSubscriptions()', { eventKey, subscriptionId });
return Delete(`${INTEGRATIONS_SERVICE_URL_V1}/emails/${eventKey}/subscriptions/${subscriptionId}`);
return Delete(`${CONNECTIVITY_SERVICE_URL_V1}/emails/${eventKey}/subscriptions/${subscriptionId}`);
};
const putEmailSubscriptions = (subscriptionId, eventKey, data) => {
console.debug('putEmailSubscriptions()', Object.assign(Object.assign({}, data), { subscriptionId, eventKey }));
return Put(`${INTEGRATIONS_SERVICE_URL_V1}/emails/${eventKey}/subscriptions/${subscriptionId}`, data);
return Put(`${CONNECTIVITY_SERVICE_URL_V1}/emails/${eventKey}/subscriptions/${subscriptionId}`, data);
};
const deleteEmailConfiguration = (eventKey) => {
console.debug('deleteEmailConfiguration()', { eventKey });
return Delete(`${INTEGRATIONS_SERVICE_URL_V1}/emails/${eventKey}`);
return Delete(`${CONNECTIVITY_SERVICE_URL_V1}/emails/${eventKey}`);
};
const getSMSConfiguration = () => {
console.debug('getSMSConfiguration()');
return Get(`${INTEGRATIONS_SERVICE_URL_V2}/sms`);
return Get(`${CONNECTIVITY_SERVICE_URL_V2}/sms`);
};

@@ -827,23 +881,23 @@ const postSMSConfiguration = (_a) => {

console.debug('postSMSConfiguration()', Object.assign(Object.assign({}, data), { eventKey }));
return Post(`${INTEGRATIONS_SERVICE_URL_V2}/sms/${eventKey}`, data);
return Post(`${CONNECTIVITY_SERVICE_URL_V2}/sms/${eventKey}`, data);
};
const patchSMSConfiguration = ({ eventKey, enabled, }) => {
console.debug('patchSMSConfiguration()', { eventKey, enabled });
return Patch(`${INTEGRATIONS_SERVICE_URL_V2}/sma/${eventKey}`, { enabled });
return Patch(`${CONNECTIVITY_SERVICE_URL_V2}/sma/${eventKey}`, { enabled });
};
const deletesmsSubscriptions = (eventKey, subscriptionId) => {
console.debug('deletesmsSubscriptions()', { eventKey, subscriptionId });
return Delete(`${INTEGRATIONS_SERVICE_URL_V2}/sms/${eventKey}/subscriptions/${subscriptionId}`);
return Delete(`${CONNECTIVITY_SERVICE_URL_V2}/sms/${eventKey}/subscriptions/${subscriptionId}`);
};
const putSMSSubscriptions = (subscriptionId, eventKey, data) => {
console.debug('putSMSSubscriptions()', Object.assign(Object.assign({}, data), { subscriptionId, eventKey }));
return Put(`${INTEGRATIONS_SERVICE_URL_V2}/sms/${eventKey}/subscriptions/${subscriptionId}`, data);
return Put(`${CONNECTIVITY_SERVICE_URL_V2}/sms/${eventKey}/subscriptions/${subscriptionId}`, data);
};
const deleteSMSConfiguration = (eventKey) => {
console.debug('deleteSMSConfiguration()', { eventKey });
return Delete(`${INTEGRATIONS_SERVICE_URL_V2}/sms/${eventKey}`);
return Delete(`${CONNECTIVITY_SERVICE_URL_V2}/sms/${eventKey}`);
};
const getWebhooksConfigurations = () => {
console.debug('getWebhooksConfigurations()');
return Get(INTEGRATIONS_SERVICE_WEBHOOKS_URL);
return Get(CONNECTIVITY_SERVICE_WEBHOOKS_URL);
};

@@ -853,6 +907,6 @@ const postWebhooksConfiguration = (data) => {

if (data._id) {
return Patch(`${INTEGRATIONS_SERVICE_WEBHOOKS_URL}/${data._id}`, data);
return Patch(`${CONNECTIVITY_SERVICE_WEBHOOKS_URL}/${data._id}`, data);
}
else {
return Post(INTEGRATIONS_SERVICE_WEBHOOKS_URL, data);
return Post(CONNECTIVITY_SERVICE_WEBHOOKS_URL, data);
}

@@ -862,3 +916,3 @@ };

console.debug('deleteWebhooksConfiguration()', id);
return Delete(`${INTEGRATIONS_SERVICE_WEBHOOKS_URL}/${id}`);
return Delete(`${CONNECTIVITY_SERVICE_WEBHOOKS_URL}/${id}`);
};

@@ -868,7 +922,7 @@ const getWebhookLog = (id, offset = 0, limit = 10) => {

const query = new URLSearchParams({ id, offset: `${offset}`, limit: `${limit}` });
return Get(`${INTEGRATIONS_SERVICE_WEBHOOKS_URL}/logs/?${query.toString()}`);
return Get(`${CONNECTIVITY_SERVICE_WEBHOOKS_URL}/logs/?${query.toString()}`);
};
const postWebhookTest = (data) => {
console.debug('postWebhookTest', data);
return Post(`${INTEGRATIONS_SERVICE_WEBHOOKS_URL}/test`, data);
return Post(`${CONNECTIVITY_SERVICE_WEBHOOKS_URL}/test`, data);
};

@@ -884,3 +938,3 @@ const getCategories = () => {

var integrations = /*#__PURE__*/Object.freeze({
var connectivity = /*#__PURE__*/Object.freeze({
__proto__: null,

@@ -914,2 +968,32 @@ getSlackConfiguration: getSlackConfiguration,

/**
* switch logged in user to specific tenant by providing tenantId.
*
* @throws exception if invalid tenantId.
* ``authorized user``
*/
function switchTenant(body) {
return __awaiter(this, void 0, void 0, function* () {
console.debug('switchTenant()', body);
return Put(`${USERS_SERVICE_URL_V1}/tenant`, body);
});
}
/**
* retrieve logged in user's available tenants.
*
* ``authorized user``
*/
function getTenants() {
return __awaiter(this, void 0, void 0, function* () {
console.debug('getTenants()');
return Get(TENANTS_SERVICE_V1);
});
}
var tenants = /*#__PURE__*/Object.freeze({
__proto__: null,
switchTenant: switchTenant,
getTenants: getTenants
});
var SocialLoginsProviders;

@@ -926,4 +1010,6 @@ (function (SocialLoginsProviders) {

reports,
integrations,
connectivity,
notifications,
audits,
tenants,
};

@@ -930,0 +1016,0 @@

@@ -301,5 +301,6 @@ 'use strict';

}); };
var PostDownload = function (url, body, opts) { return tslib.__awaiter(void 0, void 0, void 0, function () {
var PostDownload = function (url, body, params, opts) { return tslib.__awaiter(void 0, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
return [2 /*return*/, sendRequest(tslib.__assign({ url: url, method: 'GET', contentType: 'application/json', responseType: 'blob', body: body }, opts))];
return [2 /*return*/, sendRequest(tslib.__assign({ url: url, method: 'POST', contentType: 'application/json', responseType: 'blob', body: body,
params: params }, opts))];
});

@@ -322,5 +323,5 @@ }); };

var SSO_SERVICE_URL_V1 = '/team/resources/sso/v1';
var INTEGRATIONS_SERVICE_URL_V1 = '/integrations/resources/configurations/v1';
var INTEGRATIONS_SERVICE_URL_V2 = '/integrations/resources/configurations/v2';
var INTEGRATIONS_SERVICE_WEBHOOKS_URL = '/webhook';
var CONNECTIVITY_SERVICE_URL_V1 = '/integrations/resources/configurations/v1';
var CONNECTIVITY_SERVICE_URL_V2 = '/integrations/resources/configurations/v2';
var CONNECTIVITY_SERVICE_WEBHOOKS_URL = '/webhook';
var EVENT_RESOURCES_URL_V1 = '/event/resources/configurations/v1';

@@ -333,2 +334,5 @@ var IDENTITY_SSO_SERVICE_URL_V1 = '/identity/resources/sso/v1';

var NOTIFICATIONS_SERVICE_URL = '/notification';
var AUDITS_SERVICE_URL = '/audits';
var AUDITS_SERVICE_EXPORT_URL = '/audits/export';
var TENANTS_SERVICE_V1 = '/tenants/resources/tenants/v1';

@@ -914,2 +918,17 @@ /* tslint:disable:no-console */

}
function getIpMetadata(ip) {
return tslib.__awaiter(this, void 0, void 0, function () {
var data;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Get("/metadata/ip/" + ip)];
case 1:
data = _a.sent();
if (data)
return [2 /*return*/, data];
throw new Error("ip metadata not found");
}
});
});
}
var getNotificationsMetadata = function () { return tslib.__awaiter(void 0, void 0, void 0, function () { return tslib.__generator(this, function (_a) {

@@ -921,2 +940,8 @@ return [2 /*return*/, getMetadata({ entityName: 'notifications' })];

}); }); };
var getAuditsMetadata = function () { return tslib.__awaiter(void 0, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
return [2 /*return*/, getMetadata({ entityName: 'audits' })];
}); }); };
var getIpAdressMetadata = function (ip) { return tslib.__awaiter(void 0, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
return [2 /*return*/, getIpMetadata(ip)];
}); }); };

@@ -926,3 +951,5 @@ var metadata = /*#__PURE__*/Object.freeze({

getNotificationsMetadata: getNotificationsMetadata,
getSamlMetadata: getSamlMetadata
getSamlMetadata: getSamlMetadata,
getAuditsMetadata: getAuditsMetadata,
getIpAdressMetadata: getIpAdressMetadata
});

@@ -992,13 +1019,58 @@

/*****************************************
* Audits Api
*****************************************/
/**
* get Audits
*/
function getAudits(params) {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
console.debug('getAudits()');
return [2 /*return*/, Get("" + AUDITS_SERVICE_URL, params)];
});
});
}
/**
* get Audits Stats
*/
function getAuditsStats(params) {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
console.debug('getAuditsStats()');
return [2 /*return*/, Get(AUDITS_SERVICE_URL + "/stats", params)];
});
});
}
/**
* export Audits
*/
function exportAudits(params) {
return tslib.__awaiter(this, void 0, void 0, function () {
var format, headerProps, restParams;
return tslib.__generator(this, function (_a) {
format = params.format, headerProps = params.headerProps, restParams = tslib.__rest(params, ["format", "headerProps"]);
return [2 /*return*/, PostDownload(AUDITS_SERVICE_EXPORT_URL + "/" + format, { properties: headerProps }, restParams)];
});
});
}
var audits = /*#__PURE__*/Object.freeze({
__proto__: null,
getAudits: getAudits,
getAuditsStats: getAuditsStats,
exportAudits: exportAudits
});
var getSlackConfiguration = function () {
console.debug('getSlackConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/slack");
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/slack");
};
var getSlackScope = function () {
console.debug('getSlackConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/slack/applications");
console.debug('getSlackScope()');
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/slack/applications");
};
var getSlackChannels = function () {
console.debug('getSlackChannels()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/slack/channels");
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/slack/channels");
};

@@ -1008,17 +1080,17 @@ var postSlackConfiguration = function (data) {

if (data.id) {
return Patch(INTEGRATIONS_SERVICE_URL_V1 + "/slack/subscription/" + data.id, data);
return Patch(CONNECTIVITY_SERVICE_URL_V1 + "/slack/subscription/" + data.id, data);
}
return Post(INTEGRATIONS_SERVICE_URL_V1 + "/slack/subscriptions", data);
return Post(CONNECTIVITY_SERVICE_URL_V1 + "/slack/subscriptions", data);
};
var deleteSlackConfiguration = function (data) {
console.debug('deleteSlackConfiguration()', data);
return Delete(INTEGRATIONS_SERVICE_URL_V1 + "/slack/subscriptions/" + data.id);
return Delete(CONNECTIVITY_SERVICE_URL_V1 + "/slack/subscriptions/" + data.id);
};
var postSlackCode = function (code) {
console.debug('deleteSlackConfiguration()', { code: code });
return Post(INTEGRATIONS_SERVICE_URL_V1 + "/slack//applications/registrations", { code: code });
console.debug('postSlackCode()', { code: code });
return Post(CONNECTIVITY_SERVICE_URL_V1 + "/slack//applications/registrations", { code: code });
};
var getEmailConfiguration = function () {
console.debug('getEmailConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V1 + "/emails");
return Get(CONNECTIVITY_SERVICE_URL_V1 + "/emails");
};

@@ -1028,3 +1100,3 @@ var postEmailConfiguration = function (_a) {

console.debug('postEmailConfiguration()', tslib.__assign(tslib.__assign({}, data), { eventKey: eventKey }));
return Post(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey, data);
return Post(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey, data);
};

@@ -1034,19 +1106,19 @@ var patchEmailConfiguration = function (_a) {

console.debug('patchEmailConfiguration()', { eventKey: eventKey, enabled: enabled });
return Patch(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey, { enabled: enabled });
return Patch(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey, { enabled: enabled });
};
var deleteEmailSubscriptions = function (eventKey, subscriptionId) {
console.debug('deleteEmailSubscriptions()', { eventKey: eventKey, subscriptionId: subscriptionId });
return Delete(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId);
return Delete(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId);
};
var putEmailSubscriptions = function (subscriptionId, eventKey, data) {
console.debug('putEmailSubscriptions()', tslib.__assign(tslib.__assign({}, data), { subscriptionId: subscriptionId, eventKey: eventKey }));
return Put(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId, data);
return Put(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey + "/subscriptions/" + subscriptionId, data);
};
var deleteEmailConfiguration = function (eventKey) {
console.debug('deleteEmailConfiguration()', { eventKey: eventKey });
return Delete(INTEGRATIONS_SERVICE_URL_V1 + "/emails/" + eventKey);
return Delete(CONNECTIVITY_SERVICE_URL_V1 + "/emails/" + eventKey);
};
var getSMSConfiguration = function () {
console.debug('getSMSConfiguration()');
return Get(INTEGRATIONS_SERVICE_URL_V2 + "/sms");
return Get(CONNECTIVITY_SERVICE_URL_V2 + "/sms");
};

@@ -1056,3 +1128,3 @@ var postSMSConfiguration = function (_a) {

console.debug('postSMSConfiguration()', tslib.__assign(tslib.__assign({}, data), { eventKey: eventKey }));
return Post(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey, data);
return Post(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey, data);
};

@@ -1062,19 +1134,19 @@ var patchSMSConfiguration = function (_a) {

console.debug('patchSMSConfiguration()', { eventKey: eventKey, enabled: enabled });
return Patch(INTEGRATIONS_SERVICE_URL_V2 + "/sma/" + eventKey, { enabled: enabled });
return Patch(CONNECTIVITY_SERVICE_URL_V2 + "/sma/" + eventKey, { enabled: enabled });
};
var deletesmsSubscriptions = function (eventKey, subscriptionId) {
console.debug('deletesmsSubscriptions()', { eventKey: eventKey, subscriptionId: subscriptionId });
return Delete(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId);
return Delete(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId);
};
var putSMSSubscriptions = function (subscriptionId, eventKey, data) {
console.debug('putSMSSubscriptions()', tslib.__assign(tslib.__assign({}, data), { subscriptionId: subscriptionId, eventKey: eventKey }));
return Put(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId, data);
return Put(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey + "/subscriptions/" + subscriptionId, data);
};
var deleteSMSConfiguration = function (eventKey) {
console.debug('deleteSMSConfiguration()', { eventKey: eventKey });
return Delete(INTEGRATIONS_SERVICE_URL_V2 + "/sms/" + eventKey);
return Delete(CONNECTIVITY_SERVICE_URL_V2 + "/sms/" + eventKey);
};
var getWebhooksConfigurations = function () {
console.debug('getWebhooksConfigurations()');
return Get(INTEGRATIONS_SERVICE_WEBHOOKS_URL);
return Get(CONNECTIVITY_SERVICE_WEBHOOKS_URL);
};

@@ -1084,6 +1156,6 @@ var postWebhooksConfiguration = function (data) {

if (data._id) {
return Patch(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/" + data._id, data);
return Patch(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/" + data._id, data);
}
else {
return Post(INTEGRATIONS_SERVICE_WEBHOOKS_URL, data);
return Post(CONNECTIVITY_SERVICE_WEBHOOKS_URL, data);
}

@@ -1093,3 +1165,3 @@ };

console.debug('deleteWebhooksConfiguration()', id);
return Delete(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/" + id);
return Delete(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/" + id);
};

@@ -1101,7 +1173,7 @@ var getWebhookLog = function (id, offset, limit) {

var query = new URLSearchParams({ id: id, offset: "" + offset, limit: "" + limit });
return Get(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/logs/?" + query.toString());
return Get(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/logs/?" + query.toString());
};
var postWebhookTest = function (data) {
console.debug('postWebhookTest', data);
return Post(INTEGRATIONS_SERVICE_WEBHOOKS_URL + "/test", data);
return Post(CONNECTIVITY_SERVICE_WEBHOOKS_URL + "/test", data);
};

@@ -1117,3 +1189,3 @@ var getCategories = function () {

var integrations = /*#__PURE__*/Object.freeze({
var connectivity = /*#__PURE__*/Object.freeze({
__proto__: null,

@@ -1147,2 +1219,36 @@ getSlackConfiguration: getSlackConfiguration,

/**
* switch logged in user to specific tenant by providing tenantId.
*
* @throws exception if invalid tenantId.
* ``authorized user``
*/
function switchTenant(body) {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
console.debug('switchTenant()', body);
return [2 /*return*/, Put(USERS_SERVICE_URL_V1 + "/tenant", body)];
});
});
}
/**
* retrieve logged in user's available tenants.
*
* ``authorized user``
*/
function getTenants() {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
console.debug('getTenants()');
return [2 /*return*/, Get(TENANTS_SERVICE_V1)];
});
});
}
var tenants = /*#__PURE__*/Object.freeze({
__proto__: null,
switchTenant: switchTenant,
getTenants: getTenants
});
(function (SocialLoginsProviders) {

@@ -1158,4 +1264,6 @@ SocialLoginsProviders["Google"] = "google";

reports: reports,
integrations: integrations,
connectivity: connectivity,
notifications: notifications,
audits: audits,
tenants: tenants,
};

@@ -1162,0 +1270,0 @@

@@ -1,3 +0,5 @@

import { INotificationMetadata, ISamlMetadata } from './interfaces';
import { IAuditsMetadata, IMetadataIp, INotificationMetadata, ISamlMetadata } from './interfaces';
export declare const getNotificationsMetadata: () => Promise<INotificationMetadata>;
export declare const getSamlMetadata: () => Promise<ISamlMetadata>;
export declare const getAuditsMetadata: () => Promise<IAuditsMetadata>;
export declare const getIpAdressMetadata: (ip: string) => Promise<IMetadataIp>;
export declare type IGetMetadata = Pick<IBaseMetadata, 'entityName'>;
interface IBaseMetadata {
entityName: 'saml' | 'notifications';
entityName: 'saml' | 'notifications' | 'audits';
id: string;

@@ -29,2 +29,18 @@ createdAt: string;

}
export interface IAuditsMetadata extends IBaseMetadata {
entityName: 'audits';
theme: IMetadataTheme;
}
export interface IMetadataIp {
latitude: number;
longitude: number;
city: string | null;
country_name: string | null;
country_code: string | null;
zip: string | null;
location: {
country_flag?: string | null;
country_flag_emoji?: string | null;
};
}
export {};
{
"name": "@frontegg/rest-api",
"libName": "FronteggRestApi",
"version": "1.8.0",
"version": "1.9.0",
"author": "Frontegg LTD",

@@ -12,5 +12,5 @@ "module": "index.esm.js",

},
"gitHead": "f3b9aa23999d13b0fb4b1ef8bfa3dca391c3c3ed",
"gitHead": "e4b906e0fe742c65a5a6435df46a684d295f998f",
"main": "index.js",
"peerDependencies": {}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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