New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@frontegg/client

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontegg/client - npm Package Compare versions

Comparing version 1.0.59 to 1.0.60

dist/src/events/EventsClient.d.ts

4

dist/index.d.ts

@@ -5,3 +5,2 @@ import { AuditsClient } from './src/audits';

import { NotificationsClient } from './src/notifications';
import { EventsClient, channelTypes } from './src/events';
import { FronteggPermissions } from './src/permissions';

@@ -11,2 +10,3 @@ import { RbacMiddleware } from './src/rbac';

import { TenantsClient } from './src/tenants';
export { AuditsClient, NotificationsClient, TenantsClient, frontegg, FronteggPermissions, IFronteggOptions, FronteggAuthenticator, RbacMiddleware, SsoClient, EventsClient, channelTypes };
export * from './src/events';
export { AuditsClient, NotificationsClient, TenantsClient, frontegg, FronteggPermissions, IFronteggOptions, FronteggAuthenticator, RbacMiddleware, SsoClient, };
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,4 +14,2 @@ var audits_1 = require("./src/audits");

exports.NotificationsClient = notifications_1.NotificationsClient;
var events_1 = require("./src/events");
exports.EventsClient = events_1.EventsClient;
var permissions_1 = require("./src/permissions");

@@ -22,1 +23,2 @@ exports.FronteggPermissions = permissions_1.FronteggPermissions;

exports.TenantsClient = tenants_1.TenantsClient;
__export(require("./src/events"));

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

export declare type channelTypes = 'slack' | 'webhook' | 'webpush' | 'audit' | 'bell';
export declare class EventsClient {
private authenticator;
init(clientId: string, accessKey: string): Promise<void>;
triggerEvent(eventKey: string, metadata: object, channels: channelTypes[] | channelTypes, tenantId: string): Promise<any>;
}
export * from './EventsClient';
export * from './types';
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
var authenticator_1 = require("../authenticator");
var logger_1 = require("../helpers/logger");
var axios_1 = require("axios");
var config_1 = require("../config");
var EventsClient = /** @class */ (function () {
function EventsClient() {
this.authenticator = new authenticator_1.FronteggAuthenticator();
}
EventsClient.prototype.init = function (clientId, accessKey) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
logger_1.default.info('going to authenticate');
return [4 /*yield*/, this.authenticator.init(clientId, accessKey)];
case 1:
_a.sent();
logger_1.default.info('Authenticated with frontegg');
return [2 /*return*/];
}
});
});
};
EventsClient.prototype.triggerEvent = function (eventKey, metadata, channels, tenantId) {
return __awaiter(this, void 0, void 0, function () {
var response, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!Array.isArray(channels)) {
channels = [channels];
}
if (!eventKey) {
logger_1.default.warn('eventKey is required');
throw new Error('eventKey is required');
}
if (!metadata) {
logger_1.default.warn('metadata is required');
throw new Error('metadata is required');
}
if (!channels) {
logger_1.default.warn('channels is required');
throw new Error('channels is required');
}
if (!tenantId) {
logger_1.default.warn('tenantId is required');
throw new Error('tenantId is required');
}
_a.label = 1;
case 1:
_a.trys.push([1, 4, , 5]);
logger_1.default.info('going to trigger event');
return [4 /*yield*/, this.authenticator.validateAuthentication()];
case 2:
_a.sent();
return [4 /*yield*/, axios_1.default.post(config_1.config.urls.eventService + "/resources/triggers/v1", {
eventKey: eventKey,
metadata: metadata,
channels: channels
}, {
headers: {
'x-access-token': this.authenticator.accessToken,
'frontegg-tenant-id': tenantId
},
})];
case 3:
response = _a.sent();
logger_1.default.info('triggered event successfully');
return [2 /*return*/, response.data];
case 4:
e_1 = _a.sent();
logger_1.default.error('failed to trigger event ', e_1);
throw e_1;
case 5: return [2 /*return*/];
}
});
});
};
return EventsClient;
}());
exports.EventsClient = EventsClient;
__export(require("./EventsClient"));

@@ -5,3 +5,2 @@ import { AuditsClient } from './src/audits';

import { NotificationsClient } from './src/notifications';
import { EventsClient, channelTypes } from './src/events';
import { FronteggPermissions } from './src/permissions';

@@ -11,2 +10,3 @@ import { RbacMiddleware } from './src/rbac';

import { TenantsClient } from './src/tenants';
export * from './src/events';

@@ -23,4 +23,2 @@ export {

SsoClient,
EventsClient,
channelTypes
};
{
"name": "@frontegg/client",
"version": "1.0.59",
"version": "1.0.60",
"description": "Frontegg Javascript Library for backend",

@@ -21,2 +21,3 @@ "main": "dist/index.js",

"dependencies": {
"@slack/web-api": "^5.11.0",
"axios": "^0.19.0",

@@ -23,0 +24,0 @@ "http-proxy": "^1.18.1",

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