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

chatkitty

Package Overview
Dependencies
Maintainers
1
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chatkitty - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

build/main/lib/model/channel/channel.model.d.ts

13

build/main/lib/chatkitty.d.ts
import { ChatKittyConfiguration } from './chatkitty.configuration';
import { CreateChannelRequest } from './model/channel/create/channel.create.request';
import { CreateChannelResult } from './model/channel/create/channel.create.results';
import { GetChannelsResult } from './model/channel/get/channel.get.results';
import { ChatkittyObserver } from './model/chatkitty.observer';

@@ -6,4 +9,4 @@ import { ChatkittyUnsubscribable } from './model/chatkitty.unsubscribable';

import { GetCurrentUserResult } from './model/current-user/get/current-user.get.results';
import { SessionStartRequest } from './model/session/start/session.start.request';
import { SessionAccessDeniedResult, SessionStartedResult } from './model/session/start/session.start.results';
import { StartSessionRequest } from './model/session/start/session.start.request';
import { StartSessionResult } from './model/session/start/session.start.results';
export default class ChatKitty {

@@ -16,7 +19,11 @@ private readonly configuration;

private readonly currentUserNextSubject;
private currentUser;
constructor(configuration: ChatKittyConfiguration);
startSession(request: SessionStartRequest): Promise<SessionStartedResult | SessionAccessDeniedResult>;
startSession(request: StartSessionRequest): Promise<StartSessionResult>;
getCurrentUser(): Promise<GetCurrentUserResult>;
onCurrentUserChanged(onNextOrObserver: ChatkittyObserver<CurrentUser | null> | ((user: CurrentUser | null) => void)): ChatkittyUnsubscribable;
createChannel(request: CreateChannelRequest): Promise<CreateChannelResult>;
getChannels(): Promise<GetChannelsResult>;
getJoinableChannels(): Promise<GetChannelsResult>;
endSession(): Promise<void>;
}

@@ -5,3 +5,6 @@ "use strict";

var environment_1 = require("../environments/environment");
var channel_create_results_1 = require("./model/channel/create/channel.create.results");
var channel_get_results_1 = require("./model/channel/get/channel.get.results");
var chatkitty_error_1 = require("./model/chatkitty.error");
var chatkitty_paginator_1 = require("./model/chatkitty.paginator");
var current_user_get_results_1 = require("./model/current-user/get/current-user.get.results");

@@ -41,4 +44,6 @@ var session_errors_1 = require("./model/session/start/session.errors");

onSuccess: function (user) {
_this.currentUser = user;
_this.client.listenToTopic(user._topics.channels);
_this.currentUserNextSubject.next(user);
resolve(new session_start_results_1.SessionStartedResult({ user: user }));
resolve(new session_start_results_1.StartedSessionResult({ user: user }));
}

@@ -49,6 +54,6 @@ });

if (error.error === 'AccessDeniedError') {
resolve(new session_start_results_1.SessionAccessDeniedResult(new session_errors_1.SessionAccessDeniedError()));
resolve(new session_start_results_1.AccessDeniedSessionResult(new session_errors_1.AccessDeniedSessionError()));
}
else {
resolve(new session_start_results_1.SessionAccessDeniedResult(new chatkitty_error_1.UnknownChatKittyError()));
resolve(new session_start_results_1.AccessDeniedSessionResult(new chatkitty_error_1.UnknownChatKittyError()));
}

@@ -81,2 +86,43 @@ }

};
ChatKitty.prototype.createChannel = function (request) {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.currentUser === undefined) {
reject(new chatkitty_error_1.NoActiveSessionChatKittyError());
}
else {
_this.client.performAction({
destination: _this.currentUser._actions.createChannel,
body: request,
onSuccess: function (channel) {
resolve(new channel_create_results_1.CreatedChannelResult(channel));
}
});
}
});
};
ChatKitty.prototype.getChannels = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.currentUser === undefined) {
reject(new chatkitty_error_1.NoActiveSessionChatKittyError());
}
else {
chatkitty_paginator_1.ChatKittyPaginator.createInstance(_this.client, _this.currentUser._relays.channels, 'channels')
.then(function (paginator) { return resolve(new channel_get_results_1.GetChannelsResult(paginator)); });
}
});
};
ChatKitty.prototype.getJoinableChannels = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.currentUser === undefined) {
reject(new chatkitty_error_1.NoActiveSessionChatKittyError());
}
else {
chatkitty_paginator_1.ChatKittyPaginator.createInstance(_this.client, _this.currentUser._relays.joinableChannels, 'channels')
.then(function (paginator) { return resolve(new channel_get_results_1.GetChannelsResult(paginator)); });
}
});
};
ChatKitty.prototype.endSession = function () {

@@ -98,2 +144,2 @@ var _this = this;

exports.default = ChatKitty;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9jaGF0a2l0dHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBdUM7QUFFdkMsMkRBQTBEO0FBRzFELDJEQUFnRTtBQUloRSw4RkFBeUY7QUFDekYsdUVBQWdGO0FBRWhGLHFGQUdxRDtBQUNyRCx3REFBc0Q7QUFFdEQ7SUF1QkUsbUJBQW9DLGFBQXFDO1FBQXJDLGtCQUFhLEdBQWIsYUFBYSxDQUF3QjtRQUZ4RCwyQkFBc0IsR0FBRyxJQUFJLHNCQUFlLENBQXFCLElBQUksQ0FBQyxDQUFDO1FBR3RGLElBQUksQ0FBQyxNQUFNLEdBQUcsSUFBSSw0QkFBWSxDQUFDO1lBQzdCLFFBQVEsRUFBRSxhQUFhLENBQUMsUUFBUSxLQUFLLFNBQVMsSUFBSSxhQUFhLENBQUMsUUFBUTtZQUN4RSxJQUFJLEVBQUUsYUFBYSxDQUFDLElBQUksSUFBSSxtQkFBbUI7WUFDL0MsT0FBTyxFQUFFLENBQUMseUJBQVcsQ0FBQyxVQUFVO1NBQ2pDLENBQUMsQ0FBQztJQUNMLENBQUM7SUF4QmEscUJBQVcsR0FBekIsVUFBMEIsTUFBYztRQUN0QyxJQUFJLFFBQVEsR0FBRyxTQUFTLENBQUMsVUFBVSxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUVoRCxJQUFJLFFBQVEsS0FBSyxTQUFTLEVBQUU7WUFDMUIsT0FBTyxRQUFRLENBQUM7U0FDakI7UUFFRCxRQUFRLEdBQUcsSUFBSSxTQUFTLENBQUMsR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0YsQ0FBQztJQUNKLENBQUM7SUFFTSw4QkFBVSxHQUFqQjtRQUFBLGlCQVlDO1FBWEMsT0FBTyxJQUFJLE9BQU8sQ0FDaEIsVUFBQSxPQUFPO1lBQ0wsS0FBSSxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUM7Z0JBQ3JCLFNBQVMsRUFBRTtvQkFDVCxLQUFJLENBQUMsc0JBQXNCLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO29CQUV2QyxPQUFPLEVBQUUsQ0FBQztnQkFDWixDQUFDO2FBQ0YsQ0FBQyxDQUFDO1FBQ0wsQ0FBQyxDQUNGLENBQUM7SUFDSixDQUFDO0lBdEp1QixvQkFBVSxHQUFHLElBQUksR0FBRyxFQUFxQixDQUFDO0lBRTFDLDBCQUFnQixHQUFHLGdDQUFnQyxDQUFDO0lBcUo5RSxnQkFBQztDQUFBLEFBeEpELElBd0pDO2tCQXhKb0IsU0FBUyJ9

@@ -9,1 +9,7 @@ export declare abstract class ChatKittyError {

}
export declare class NoActiveSessionChatKittyError extends ChatKittyError {
constructor();
}
export declare class PageOutOfBoundsChatKittyError extends ChatKittyError {
constructor();
}

@@ -16,3 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.UnknownChatKittyError = exports.ChatKittyError = void 0;
exports.PageOutOfBoundsChatKittyError = exports.NoActiveSessionChatKittyError = exports.UnknownChatKittyError = exports.ChatKittyError = void 0;
var ChatKittyError = /** @class */ (function () {

@@ -34,2 +34,18 @@ function ChatKittyError(type, message) {

exports.UnknownChatKittyError = UnknownChatKittyError;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LmVycm9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jaGF0a2l0dHkuZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0lBQ0Usd0JBQTZCLElBQVksRUFBUyxPQUFlO1FBQXBDLFNBQUksR0FBSixJQUFJLENBQVE7UUFBUyxZQUFPLEdBQVAsT0FBTyxDQUFRO0lBQ2pFLENBQUM7SUFDSCxxQkFBQztBQUFELENBQUMsQUFIRCxJQUdDO0FBSHFCLHdDQUFjO0FBS3BDO0lBQTJDLHlDQUFjO0lBQ3ZEO2VBQ0Usa0JBQU0sdUJBQXVCLEVBQUUsZ0NBQWdDLENBQUM7SUFDbEUsQ0FBQztJQUNILDRCQUFDO0FBQUQsQ0FBQyxBQUpELENBQTJDLGNBQWMsR0FJeEQ7QUFKWSxzREFBcUIifQ==
var NoActiveSessionChatKittyError = /** @class */ (function (_super) {
__extends(NoActiveSessionChatKittyError, _super);
function NoActiveSessionChatKittyError() {
return _super.call(this, 'NoActiveSessionChatKittyError', 'You\'re not connected to ChatKitty.') || this;
}
return NoActiveSessionChatKittyError;
}(ChatKittyError));
exports.NoActiveSessionChatKittyError = NoActiveSessionChatKittyError;
var PageOutOfBoundsChatKittyError = /** @class */ (function (_super) {
__extends(PageOutOfBoundsChatKittyError, _super);
function PageOutOfBoundsChatKittyError() {
return _super.call(this, 'PageOutOfBoundsChatKittyError', 'You\'ve requested a page that doesn\'t exists.') || this;
}
return PageOutOfBoundsChatKittyError;
}(ChatKittyError));
exports.PageOutOfBoundsChatKittyError = PageOutOfBoundsChatKittyError;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LmVycm9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jaGF0a2l0dHkuZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0lBQ0Usd0JBQTZCLElBQVksRUFBUyxPQUFlO1FBQXBDLFNBQUksR0FBSixJQUFJLENBQVE7UUFBUyxZQUFPLEdBQVAsT0FBTyxDQUFRO0lBQ2pFLENBQUM7SUFDSCxxQkFBQztBQUFELENBQUMsQUFIRCxJQUdDO0FBSHFCLHdDQUFjO0FBS3BDO0lBQTJDLHlDQUFjO0lBQ3ZEO2VBQ0Usa0JBQU0sdUJBQXVCLEVBQUUsZ0NBQWdDLENBQUM7SUFDbEUsQ0FBQztJQUNILDRCQUFDO0FBQUQsQ0FBQyxBQUpELENBQTJDLGNBQWMsR0FJeEQ7QUFKWSxzREFBcUI7QUFNbEM7SUFBbUQsaURBQWM7SUFDL0Q7ZUFDRSxrQkFBTSwrQkFBK0IsRUFBRSxxQ0FBcUMsQ0FBQztJQUMvRSxDQUFDO0lBQ0gsb0NBQUM7QUFBRCxDQUFDLEFBSkQsQ0FBbUQsY0FBYyxHQUloRTtBQUpZLHNFQUE2QjtBQU0xQztJQUFtRCxpREFBYztJQUMvRDtlQUNFLGtCQUFNLCtCQUErQixFQUFFLGdEQUFnRCxDQUFDO0lBQzFGLENBQUM7SUFDSCxvQ0FBQztBQUFELENBQUMsQUFKRCxDQUFtRCxjQUFjLEdBSWhFO0FBSlksc0VBQTZCIn0=

@@ -5,2 +5,16 @@ export declare class CurrentUser {

displayPictureUrl: string;
_relays: CurrentUserRelays;
_topics: CurrentUserTopics;
_actions: CurrentUserActions;
}
export declare class CurrentUserRelays {
self: string;
channels: string;
joinableChannels: string;
}
export declare class CurrentUserTopics {
channels: string;
}
export declare class CurrentUserActions {
createChannel: string;
}
import { ChatKittyError } from '../../chatkitty.error';
export declare class SessionAccessDeniedError extends ChatKittyError {
export declare class AccessDeniedSessionError extends ChatKittyError {
constructor();
}

@@ -16,12 +16,12 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionAccessDeniedError = void 0;
exports.AccessDeniedSessionError = void 0;
var chatkitty_error_1 = require("../../chatkitty.error");
var SessionAccessDeniedError = /** @class */ (function (_super) {
__extends(SessionAccessDeniedError, _super);
function SessionAccessDeniedError() {
return _super.call(this, 'SessionAccessDeniedError', 'ChatKitty session did not start. Access denied.') || this;
var AccessDeniedSessionError = /** @class */ (function (_super) {
__extends(AccessDeniedSessionError, _super);
function AccessDeniedSessionError() {
return _super.call(this, 'AccessDeniedSessionError', 'ChatKitty session did not start. Access denied.') || this;
}
return SessionAccessDeniedError;
return AccessDeniedSessionError;
}(chatkitty_error_1.ChatKittyError));
exports.SessionAccessDeniedError = SessionAccessDeniedError;
exports.AccessDeniedSessionError = AccessDeniedSessionError;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5lcnJvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbGliL21vZGVsL3Nlc3Npb24vc3RhcnQvc2Vzc2lvbi5lcnJvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHlEQUF1RDtBQUV2RDtJQUE4Qyw0Q0FBYztJQUMxRDtlQUNFLGtCQUFNLDBCQUEwQixFQUFFLGlEQUFpRCxDQUFDO0lBQ3RGLENBQUM7SUFDSCwrQkFBQztBQUFELENBQUMsQUFKRCxDQUE4QyxnQ0FBYyxHQUkzRDtBQUpZLDREQUF3QiJ9

@@ -1,4 +0,4 @@

export interface SessionStartRequest {
export declare class StartSessionRequest {
username: string;
authParams?: unknown;
}
import { ChatKittyFailedResult, ChatKittySucceededResult } from '../../chatkitty.result';
import { Session } from '../session.model';
import { SessionAccessDeniedError } from './session.errors';
export declare class SessionStartedResult extends ChatKittySucceededResult {
import { AccessDeniedSessionError } from './session.errors';
export declare type StartSessionResult = StartedSessionResult | AccessDeniedSessionResult;
export declare class StartedSessionResult extends ChatKittySucceededResult {
session: Session;
constructor(session: Session);
}
export declare class SessionAccessDeniedResult extends ChatKittyFailedResult {
error: SessionAccessDeniedError;
constructor(error: SessionAccessDeniedError);
export declare class AccessDeniedSessionResult extends ChatKittyFailedResult {
error: AccessDeniedSessionError;
constructor(error: AccessDeniedSessionError);
}
export declare function sessionStarted(result: SessionStartedResult | SessionAccessDeniedResult): result is SessionStartedResult;
export declare function startedSession(result: StartSessionResult): result is StartedSessionResult;

@@ -16,7 +16,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.sessionStarted = exports.SessionAccessDeniedResult = exports.SessionStartedResult = void 0;
exports.startedSession = exports.AccessDeniedSessionResult = exports.StartedSessionResult = void 0;
var chatkitty_result_1 = require("../../chatkitty.result");
var SessionStartedResult = /** @class */ (function (_super) {
__extends(SessionStartedResult, _super);
function SessionStartedResult(session) {
var StartedSessionResult = /** @class */ (function (_super) {
__extends(StartedSessionResult, _super);
function StartedSessionResult(session) {
var _this = _super.call(this) || this;

@@ -26,8 +26,8 @@ _this.session = session;

}
return SessionStartedResult;
return StartedSessionResult;
}(chatkitty_result_1.ChatKittySucceededResult));
exports.SessionStartedResult = SessionStartedResult;
var SessionAccessDeniedResult = /** @class */ (function (_super) {
__extends(SessionAccessDeniedResult, _super);
function SessionAccessDeniedResult(error) {
exports.StartedSessionResult = StartedSessionResult;
var AccessDeniedSessionResult = /** @class */ (function (_super) {
__extends(AccessDeniedSessionResult, _super);
function AccessDeniedSessionResult(error) {
var _this = _super.call(this) || this;

@@ -37,9 +37,9 @@ _this.error = error;

}
return SessionAccessDeniedResult;
return AccessDeniedSessionResult;
}(chatkitty_result_1.ChatKittyFailedResult));
exports.SessionAccessDeniedResult = SessionAccessDeniedResult;
function sessionStarted(result) {
exports.AccessDeniedSessionResult = AccessDeniedSessionResult;
function startedSession(result) {
return result.session !== undefined;
}
exports.sessionStarted = sessionStarted;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5zdGFydC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOl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UNoRSw4QkFBbUIsT0FBZ0I7UUFBbkMsWUFDRSxpQkFBTyxTQUNSO1FBRmtCLGFBQU8sR0FBUCxPQUFPLENBQVM7O0lBRW5DLENBQUM7SUFDSCwyQkFBQztBQUFELENBQUMsQUFKRCxDQUEwQywyQ0FBd0IsR0FJakU7QUFKWSxvREFBb0I7QUFNakM7SUFBK0MsNkNBQXFCO0lBQ2xFLG1DQUFtQixLQUErQjtRQUFsRCxZQUNFLGlCQUFPLFNBQ1I7UUFGa0IsV0FBSyxHQUFMLEtBQUssQ0FBMEI7O0lBRWxELENBQUM7SUFDSCxnQ0FBQztBQUFELENBQUMsQUFKRCxDQUErQyx3Q0FBcUIsR0FJbkU7QUFKWSw4REFBeUI7QUFNdEMsU0FBZ0IsY0FBYyxDQUFDLE1BQTBCO0lBQ3ZELE9BQVEsTUFBK0IsQ0FBQyxPQUFPLEtBQUssU0FBUyxDQUFDO0FBQ2hFLENBQUM7QUFGRCx3Q0FFQyJ9
import { StompXConnectRequest } from './request/stompx.connect.request';
import { StompXDisconnectRequest } from './request/stompx.disconnect.request';
import { StompXPerformActionRequest } from './request/stompx.perform-action.request';
import { StompXRelayResourceRequest } from './request/stompx.relay-resource.request';

@@ -7,8 +8,13 @@ import { StompXConfiguration } from './stompx.configuration';

private readonly rxStompConfig;
private rxStomp;
private readonly rxStomp;
private readonly topics;
private readonly pendingActions;
constructor(configuration: StompXConfiguration);
connect(request: StompXConnectRequest): void;
relayResource<R>(request: StompXRelayResourceRequest<R>): void;
listenToTopic(topic: string): void;
performAction<B, R>(request: StompXPerformActionRequest<B, R>): void;
disconnect(request: StompXDisconnectRequest): void;
private static generateSubscriptionId;
private static generateReceipt;
}

@@ -21,2 +21,4 @@ "use strict";

this.rxStomp = new rx_stomp_1.RxStomp();
this.topics = new Map();
this.pendingActions = new Map();
var scheme;

@@ -46,12 +48,8 @@ if (configuration.isSecure) {

var _this = this;
var headers = {
api_key: request.apiKey,
stompx_user: request.username
};
var brokerURL = this.rxStompConfig.brokerURL + '?' +
("api_key=" + encodeURIComponent(request.apiKey) + "&stompx_user=" + encodeURIComponent(request.username));
if (request.authParams) {
headers = __assign(__assign({}, headers), { stompx_auth_params: JSON.stringify(request.authParams) });
brokerURL = brokerURL + ("&stompx_auth_params=" + encodeURIComponent(JSON.stringify(request.authParams)));
}
var params = new URLSearchParams(headers);
var brokerURL = this.rxStompConfig.brokerURL + '?' + params.toString();
this.rxStomp.configure(__assign(__assign({}, this.rxStompConfig), { brokerURL: encodeURI(brokerURL) }));
this.rxStomp.configure(__assign(__assign({}, this.rxStompConfig), { brokerURL: brokerURL }));
this.rxStomp.activate();

@@ -70,4 +68,3 @@ var successSubscription = this.rxStomp.connected$.subscribe(function () {

this.rxStomp.watch(request.destination, {
id: request.destination,
receipt: StompXClient.generateReceipt()
id: StompXClient.generateSubscriptionId()
})

@@ -78,2 +75,34 @@ .subscribe(function (message) {

};
StompXClient.prototype.listenToTopic = function (topic) {
var _this = this;
var subscription = this.rxStomp.watch(topic, {
id: StompXClient.generateSubscriptionId(),
receipt: StompXClient.generateReceipt()
})
.subscribe(function (message) {
var receipt = message.headers['receipt-id'];
if (receipt !== undefined) {
var action = _this.pendingActions.get(receipt);
if (action !== undefined) {
action(JSON.parse(message.body).resource);
_this.pendingActions.delete(receipt);
}
}
});
this.topics.set(topic, subscription);
};
StompXClient.prototype.performAction = function (request) {
var receipt = StompXClient.generateReceipt();
if (request.onSuccess) {
this.pendingActions.set(receipt, request.onSuccess);
}
this.rxStomp.publish({
destination: request.destination,
headers: {
'content-type': 'application/json;charset=UTF-8',
'receipt': receipt
},
body: JSON.stringify(request.body)
});
};
StompXClient.prototype.disconnect = function (request) {

@@ -83,2 +112,5 @@ this.rxStomp.deactivate();

};
StompXClient.generateSubscriptionId = function () {
return 'subscription-id-' + uuid_1.v4();
};
StompXClient.generateReceipt = function () {

@@ -90,2 +122,2 @@ return 'receipt-' + uuid_1.v4();

exports.StompXClient = StompXClient;
//# sourceMappingURL=data:application/json;base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sR0FBOUI7UUFDRSxPQUFPLFVBQVUsR0FBRyxTQUFFLEVBQUUsQ0FBQztJQUMzQixDQUFDO0lBQ0gsbUJBQUM7QUFBRCxDQUFDLEFBaElELElBZ0lDO0FBaElZLG9DQUFZIn0=
import { ChatKittyConfiguration } from './chatkitty.configuration';
import { CreateChannelRequest } from './model/channel/create/channel.create.request';
import { CreateChannelResult } from './model/channel/create/channel.create.results';
import { GetChannelsResult } from './model/channel/get/channel.get.results';
import { ChatkittyObserver } from './model/chatkitty.observer';

@@ -6,4 +9,4 @@ import { ChatkittyUnsubscribable } from './model/chatkitty.unsubscribable';

import { GetCurrentUserResult } from './model/current-user/get/current-user.get.results';
import { SessionStartRequest } from './model/session/start/session.start.request';
import { SessionAccessDeniedResult, SessionStartedResult } from './model/session/start/session.start.results';
import { StartSessionRequest } from './model/session/start/session.start.request';
import { StartSessionResult } from './model/session/start/session.start.results';
export default class ChatKitty {

@@ -16,7 +19,11 @@ private readonly configuration;

private readonly currentUserNextSubject;
private currentUser;
constructor(configuration: ChatKittyConfiguration);
startSession(request: SessionStartRequest): Promise<SessionStartedResult | SessionAccessDeniedResult>;
startSession(request: StartSessionRequest): Promise<StartSessionResult>;
getCurrentUser(): Promise<GetCurrentUserResult>;
onCurrentUserChanged(onNextOrObserver: ChatkittyObserver<CurrentUser | null> | ((user: CurrentUser | null) => void)): ChatkittyUnsubscribable;
createChannel(request: CreateChannelRequest): Promise<CreateChannelResult>;
getChannels(): Promise<GetChannelsResult>;
getJoinableChannels(): Promise<GetChannelsResult>;
endSession(): Promise<void>;
}
import { BehaviorSubject } from 'rxjs';
import { environment } from '../environments/environment';
import { UnknownChatKittyError } from './model/chatkitty.error';
import { CreatedChannelResult } from './model/channel/create/channel.create.results';
import { GetChannelsResult } from './model/channel/get/channel.get.results';
import { NoActiveSessionChatKittyError, UnknownChatKittyError } from './model/chatkitty.error';
import { ChatKittyPaginator } from './model/chatkitty.paginator';
import { GetCurrentUserResult } from './model/current-user/get/current-user.get.results';
import { SessionAccessDeniedError } from './model/session/start/session.errors';
import { SessionAccessDeniedResult, SessionStartedResult } from './model/session/start/session.start.results';
import { AccessDeniedSessionError } from './model/session/start/session.errors';
import { AccessDeniedSessionResult, StartedSessionResult } from './model/session/start/session.start.results';
import { StompXClient } from './stompx/stompx.client';

@@ -37,4 +40,6 @@ export default class ChatKitty {

onSuccess: user => {
this.currentUser = user;
this.client.listenToTopic(user._topics.channels);
this.currentUserNextSubject.next(user);
resolve(new SessionStartedResult({ user: user }));
resolve(new StartedSessionResult({ user: user }));
}

@@ -45,6 +50,6 @@ });

if (error.error === 'AccessDeniedError') {
resolve(new SessionAccessDeniedResult(new SessionAccessDeniedError()));
resolve(new AccessDeniedSessionResult(new AccessDeniedSessionError()));
}
else {
resolve(new SessionAccessDeniedResult(new UnknownChatKittyError()));
resolve(new AccessDeniedSessionResult(new UnknownChatKittyError()));
}

@@ -76,2 +81,40 @@ }

}
createChannel(request) {
return new Promise((resolve, reject) => {
if (this.currentUser === undefined) {
reject(new NoActiveSessionChatKittyError());
}
else {
this.client.performAction({
destination: this.currentUser._actions.createChannel,
body: request,
onSuccess: channel => {
resolve(new CreatedChannelResult(channel));
}
});
}
});
}
getChannels() {
return new Promise((resolve, reject) => {
if (this.currentUser === undefined) {
reject(new NoActiveSessionChatKittyError());
}
else {
ChatKittyPaginator.createInstance(this.client, this.currentUser._relays.channels, 'channels')
.then(paginator => resolve(new GetChannelsResult(paginator)));
}
});
}
getJoinableChannels() {
return new Promise((resolve, reject) => {
if (this.currentUser === undefined) {
reject(new NoActiveSessionChatKittyError());
}
else {
ChatKittyPaginator.createInstance(this.client, this.currentUser._relays.joinableChannels, 'channels')
.then(paginator => resolve(new GetChannelsResult(paginator)));
}
});
}
endSession() {

@@ -90,2 +133,2 @@ return new Promise(resolve => {

ChatKitty.currentUserRelay = '/application/v1/users/me.relay';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5Lm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SixDQUFDO0lBRU0sbUJBQW1CO1FBQ3hCLE9BQU8sSUFBSSxPQUFPLENBQ2hCLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxFQUFFO1lBQ2xCLElBQUksSUFBSSxDQUFDLFdBQVcsS0FBSyxTQUFTLEVBQUU7Z0JBQ2xDLE1BQU0sQ0FBQyxJQUFJLDZCQUE2QixFQUFFLENBQUMsQ0FBQzthQUM3QztpQkFBTTtnQkFDTCxrQkFBa0IsQ0FBQyxjQUFjLENBQVUsSUFBSSxDQUFDLE1BQU0sRUFBRSxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxnQkFBZ0IsRUFBRSxVQUFVLENBQUM7cUJBQzdHLElBQUksQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLE9BQU8sQ0FBQyxJQUFJLGlCQUFpQixDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsQ0FBQzthQUMvRDtRQUNILENBQUMsQ0FDRixDQUFDO0lBQ0osQ0FBQztJQUVNLFVBQVU7UUFDZixPQUFPLElBQUksT0FBTyxDQUNoQixPQUFPLENBQUMsRUFBRTtZQUNSLElBQUksQ0FBQyxNQUFNLENBQUMsVUFBVSxDQUFDO2dCQUNyQixTQUFTLEVBQUUsR0FBRyxFQUFFO29CQUNkLElBQUksQ0FBQyxzQkFBc0IsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7b0JBRXZDLE9BQU8sRUFBRSxDQUFDO2dCQUNaLENBQUM7YUFDRixDQUFDLENBQUM7UUFDTCxDQUFDLENBQ0YsQ0FBQztJQUNKLENBQUM7O0FBdEp1QixvQkFBVSxHQUFHLElBQUksR0FBRyxFQUFxQixDQUFDO0FBRTFDLDBCQUFnQixHQUFHLGdDQUFnQyxDQUFDIn0=

@@ -9,1 +9,7 @@ export declare abstract class ChatKittyError {

}
export declare class NoActiveSessionChatKittyError extends ChatKittyError {
constructor();
}
export declare class PageOutOfBoundsChatKittyError extends ChatKittyError {
constructor();
}

@@ -12,2 +12,12 @@ export class ChatKittyError {

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LmVycm9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jaGF0a2l0dHkuZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxPQUFnQixjQUFjO0lBQ2xDLFlBQTZCLElBQVksRUFBUyxPQUFlO1FBQXBDLFNBQUksR0FBSixJQUFJLENBQVE7UUFBUyxZQUFPLEdBQVAsT0FBTyxDQUFRO0lBQ2pFLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTyxxQkFBc0IsU0FBUSxjQUFjO0lBQ3ZEO1FBQ0UsS0FBSyxDQUFDLHVCQUF1QixFQUFFLGdDQUFnQyxDQUFDLENBQUM7SUFDbkUsQ0FBQztDQUNGIn0=
export class NoActiveSessionChatKittyError extends ChatKittyError {
constructor() {
super('NoActiveSessionChatKittyError', 'You\'re not connected to ChatKitty.');
}
}
export class PageOutOfBoundsChatKittyError extends ChatKittyError {
constructor() {
super('PageOutOfBoundsChatKittyError', 'You\'ve requested a page that doesn\'t exists.');
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LmVycm9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jaGF0a2l0dHkuZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxPQUFnQixjQUFjO0lBQ2xDLFlBQTZCLElBQVksRUFBUyxPQUFlO1FBQXBDLFNBQUksR0FBSixJQUFJLENBQVE7UUFBUyxZQUFPLEdBQVAsT0FBTyxDQUFRO0lBQ2pFLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTyxxQkFBc0IsU0FBUSxjQUFjO0lBQ3ZEO1FBQ0UsS0FBSyxDQUFDLHVCQUF1QixFQUFFLGdDQUFnQyxDQUFDLENBQUM7SUFDbkUsQ0FBQztDQUNGO0FBRUQsTUFBTSxPQUFPLDZCQUE4QixTQUFRLGNBQWM7SUFDL0Q7UUFDRSxLQUFLLENBQUMsK0JBQStCLEVBQUUscUNBQXFDLENBQUMsQ0FBQztJQUNoRixDQUFDO0NBQ0Y7QUFFRCxNQUFNLE9BQU8sNkJBQThCLFNBQVEsY0FBYztJQUMvRDtRQUNFLEtBQUssQ0FBQywrQkFBK0IsRUFBRSxnREFBZ0QsQ0FBQyxDQUFDO0lBQzNGLENBQUM7Q0FDRiJ9

@@ -5,2 +5,16 @@ export declare class CurrentUser {

displayPictureUrl: string;
_relays: CurrentUserRelays;
_topics: CurrentUserTopics;
_actions: CurrentUserActions;
}
export declare class CurrentUserRelays {
self: string;
channels: string;
joinableChannels: string;
}
export declare class CurrentUserTopics {
channels: string;
}
export declare class CurrentUserActions {
createChannel: string;
}
import { ChatKittyError } from '../../chatkitty.error';
export declare class SessionAccessDeniedError extends ChatKittyError {
export declare class AccessDeniedSessionError extends ChatKittyError {
constructor();
}
import { ChatKittyError } from '../../chatkitty.error';
export class SessionAccessDeniedError extends ChatKittyError {
export class AccessDeniedSessionError extends ChatKittyError {
constructor() {
super('SessionAccessDeniedError', 'ChatKitty session did not start. Access denied.');
super('AccessDeniedSessionError', 'ChatKitty session did not start. Access denied.');
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5lcnJvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbGliL21vZGVsL3Nlc3Npb24vc3RhcnQvc2Vzc2lvbi5lcnJvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXZELE1BQU0sT0FBTyx3QkFBeUIsU0FBUSxjQUFjO0lBQzFEO1FBQ0UsS0FBSyxDQUFDLDBCQUEwQixFQUFFLGlEQUFpRCxDQUFDLENBQUM7SUFDdkYsQ0FBQztDQUNGIn0=

@@ -1,4 +0,4 @@

export interface SessionStartRequest {
export declare class StartSessionRequest {
username: string;
authParams?: unknown;
}
import { ChatKittyFailedResult, ChatKittySucceededResult } from '../../chatkitty.result';
import { Session } from '../session.model';
import { SessionAccessDeniedError } from './session.errors';
export declare class SessionStartedResult extends ChatKittySucceededResult {
import { AccessDeniedSessionError } from './session.errors';
export declare type StartSessionResult = StartedSessionResult | AccessDeniedSessionResult;
export declare class StartedSessionResult extends ChatKittySucceededResult {
session: Session;
constructor(session: Session);
}
export declare class SessionAccessDeniedResult extends ChatKittyFailedResult {
error: SessionAccessDeniedError;
constructor(error: SessionAccessDeniedError);
export declare class AccessDeniedSessionResult extends ChatKittyFailedResult {
error: AccessDeniedSessionError;
constructor(error: AccessDeniedSessionError);
}
export declare function sessionStarted(result: SessionStartedResult | SessionAccessDeniedResult): result is SessionStartedResult;
export declare function startedSession(result: StartSessionResult): result is StartedSessionResult;
import { ChatKittyFailedResult, ChatKittySucceededResult } from '../../chatkitty.result';
export class SessionStartedResult extends ChatKittySucceededResult {
export class StartedSessionResult extends ChatKittySucceededResult {
constructor(session) {

@@ -8,3 +8,3 @@ super();

}
export class SessionAccessDeniedResult extends ChatKittyFailedResult {
export class AccessDeniedSessionResult extends ChatKittyFailedResult {
constructor(error) {

@@ -15,5 +15,5 @@ super();

}
export function sessionStarted(result) {
export function startedSession(result) {
return result.session !== undefined;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5zdGFydC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4v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EUyxZQUFPLEdBQVAsT0FBTyxDQUFTO0lBRW5DLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTyx5QkFBMEIsU0FBUSxxQkFBcUI7SUFDbEUsWUFBbUIsS0FBK0I7UUFDaEQsS0FBSyxFQUFFLENBQUM7UUFEUyxVQUFLLEdBQUwsS0FBSyxDQUEwQjtJQUVsRCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLFVBQVUsY0FBYyxDQUFDLE1BQTBCO0lBQ3ZELE9BQVEsTUFBK0IsQ0FBQyxPQUFPLEtBQUssU0FBUyxDQUFDO0FBQ2hFLENBQUMifQ==
import { StompXConnectRequest } from './request/stompx.connect.request';
import { StompXDisconnectRequest } from './request/stompx.disconnect.request';
import { StompXPerformActionRequest } from './request/stompx.perform-action.request';
import { StompXRelayResourceRequest } from './request/stompx.relay-resource.request';

@@ -7,8 +8,13 @@ import { StompXConfiguration } from './stompx.configuration';

private readonly rxStompConfig;
private rxStomp;
private readonly rxStomp;
private readonly topics;
private readonly pendingActions;
constructor(configuration: StompXConfiguration);
connect(request: StompXConnectRequest): void;
relayResource<R>(request: StompXRelayResourceRequest<R>): void;
listenToTopic(topic: string): void;
performAction<B, R>(request: StompXPerformActionRequest<B, R>): void;
disconnect(request: StompXDisconnectRequest): void;
private static generateSubscriptionId;
private static generateReceipt;
}

@@ -7,2 +7,4 @@ import { RxStomp } from '@stomp/rx-stomp';

this.rxStomp = new RxStomp();
this.topics = new Map();
this.pendingActions = new Map();
let scheme;

@@ -31,17 +33,10 @@ if (configuration.isSecure) {

connect(request) {
let headers = {
api_key: request.apiKey,
stompx_user: request.username
};
let brokerURL = this.rxStompConfig.brokerURL + '?' +
`api_key=${encodeURIComponent(request.apiKey)}&stompx_user=${encodeURIComponent(request.username)}`;
if (request.authParams) {
headers = {
...headers,
stompx_auth_params: JSON.stringify(request.authParams)
};
brokerURL = brokerURL + `&stompx_auth_params=${encodeURIComponent(JSON.stringify(request.authParams))}`;
}
const params = new URLSearchParams(headers);
const brokerURL = this.rxStompConfig.brokerURL + '?' + params.toString();
this.rxStomp.configure({
...this.rxStompConfig,
brokerURL: encodeURI(brokerURL)
brokerURL: brokerURL
});

@@ -61,4 +56,3 @@ this.rxStomp.activate();

this.rxStomp.watch(request.destination, {
id: request.destination,
receipt: StompXClient.generateReceipt()
id: StompXClient.generateSubscriptionId()
})

@@ -69,2 +63,33 @@ .subscribe(message => {

}
listenToTopic(topic) {
const subscription = this.rxStomp.watch(topic, {
id: StompXClient.generateSubscriptionId(),
receipt: StompXClient.generateReceipt()
})
.subscribe(message => {
const receipt = message.headers['receipt-id'];
if (receipt !== undefined) {
const action = this.pendingActions.get(receipt);
if (action !== undefined) {
action(JSON.parse(message.body).resource);
this.pendingActions.delete(receipt);
}
}
});
this.topics.set(topic, subscription);
}
performAction(request) {
const receipt = StompXClient.generateReceipt();
if (request.onSuccess) {
this.pendingActions.set(receipt, request.onSuccess);
}
this.rxStomp.publish({
destination: request.destination,
headers: {
'content-type': 'application/json;charset=UTF-8',
'receipt': receipt
},
body: JSON.stringify(request.body)
});
}
disconnect(request) {

@@ -74,2 +99,5 @@ this.rxStomp.deactivate();

}
static generateSubscriptionId() {
return 'subscription-id-' + v4();
}
static generateReceipt() {

@@ -79,2 +107,2 @@ return 'receipt-' + v4();

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvbXB4LmNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvc3RvbXB4L3N0b21weC5jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRTFDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMxQyxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sTUFBTSxDQU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API",

@@ -5,0 +5,0 @@ "main": "build/main/index.js",

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