chatkitty
Advanced tools
Comparing version 0.0.1 to 0.0.2
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -30,16 +19,18 @@ var environment_1 = require("../environments/environment"); | ||
var _this = this; | ||
var headers = { | ||
api_key: this.configuration.apiKey, | ||
stompx_user: request.username | ||
}; | ||
if (request.authParams) { | ||
headers = __assign(__assign({}, headers), { stompx_auth_params: JSON.stringify(request.authParams) }); | ||
} | ||
this.client.connect(headers, function () { | ||
_this.client.relayResource(ChatKitty.currentUserRelay, function (user) { | ||
request.callback(new session_start_results_1.SessionStartedResult({ user: user })); | ||
}); | ||
}, function (error) { | ||
if (error.error === 'AccessDeniedError') { | ||
request.callback(new session_start_results_1.SessionAccessDeniedErrorResult(new session_errors_1.SessionAccessDeniedError())); | ||
this.client.connect({ | ||
apiKey: this.configuration.apiKey, | ||
username: request.username, | ||
authParams: request.authParams, | ||
onSuccess: function () { | ||
_this.client.relayResource({ | ||
destination: ChatKitty.currentUserRelay, | ||
onSuccess: function (user) { | ||
request.callback(new session_start_results_1.SessionStartedResult({ user: user })); | ||
} | ||
}); | ||
}, | ||
onError: function (error) { | ||
if (error.error === 'AccessDeniedError') { | ||
request.callback(new session_start_results_1.SessionAccessDeniedResult(new session_errors_1.SessionAccessDeniedError())); | ||
} | ||
} | ||
@@ -49,4 +40,7 @@ }); | ||
ChatKitty.prototype.getCurrentUser = function (callback) { | ||
this.client.relayResource(ChatKitty.currentUserRelay, function (user) { | ||
callback(new current_user_get_results_1.GetCurrentUserResult(user)); | ||
this.client.relayResource({ | ||
destination: ChatKitty.currentUserRelay, | ||
onSuccess: function (user) { | ||
callback(new current_user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RUFBRSxVQUFDLEtBQUs7Z0JBQ2IsSUFBSSxLQUFLLENBQUMsS0FBSyxLQUFLLG1CQUFtQixFQUFFO29CQUN2QyxPQUFPLENBQUMsUUFBUSxDQUFDLElBQUksaURBQXlCLENBQUMsSUFBSSx5Q0FBd0IsRUFBRSxDQUFDLENBQUMsQ0FBQztpQkFDakY7WUFDSCxDQUFDO1NBQ0YsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQUVNLGtDQUFjLEdBQXJCLFVBQXNCLFFBQWdEO1FBQ3BFLElBQUksQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFjO1lBQ3JDLFdBQVcsRUFBRSxTQUFTLENBQUMsZ0JBQWdCO1lBQ3ZDLFNBQVMsRUFBRSxVQUFBLElBQUk7Z0JBQ2IsUUFBUSxDQUFDLElBQUksK0NBQW9CLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztZQUMzQyxDQUFDO1NBQ0YsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQXpDdUIsMEJBQWdCLEdBQUcsZ0NBQWdDLENBQUM7SUEwQzlFLGdCQUFDO0NBQUEsQUEzQ0QsSUEyQ0M7a0JBM0NvQixTQUFTIn0= |
import { ChatKittyError } from './chatkitty.error'; | ||
export interface ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
} | ||
export declare abstract class ChatKittySuccessfulResult implements ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
export declare abstract class ChatKittySucceededResult implements ChatKittyResult { | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
} | ||
export declare abstract class ChatKittyCancelledResult implements ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
} | ||
export declare abstract class ChatKittyErrorResult implements ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
export declare abstract class ChatKittyFailedResult implements ChatKittyResult { | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
abstract error: ChatKittyError; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ChatKittyErrorResult = exports.ChatKittyCancelledResult = exports.ChatKittySuccessfulResult = void 0; | ||
var ChatKittySuccessfulResult = /** @class */ (function () { | ||
function ChatKittySuccessfulResult() { | ||
this.wasSuccessful = true; | ||
this.wasCancelled = false; | ||
this.isError = false; | ||
exports.ChatKittyFailedResult = exports.ChatKittyCancelledResult = exports.ChatKittySucceededResult = void 0; | ||
var ChatKittySucceededResult = /** @class */ (function () { | ||
function ChatKittySucceededResult() { | ||
this.succeeded = true; | ||
this.cancelled = false; | ||
this.failed = false; | ||
} | ||
return ChatKittySuccessfulResult; | ||
return ChatKittySucceededResult; | ||
}()); | ||
exports.ChatKittySuccessfulResult = ChatKittySuccessfulResult; | ||
exports.ChatKittySucceededResult = ChatKittySucceededResult; | ||
var ChatKittyCancelledResult = /** @class */ (function () { | ||
function ChatKittyCancelledResult() { | ||
this.wasSuccessful = false; | ||
this.wasCancelled = true; | ||
this.isError = false; | ||
this.succeeded = false; | ||
this.cancelled = true; | ||
this.failed = false; | ||
} | ||
@@ -22,11 +22,11 @@ return ChatKittyCancelledResult; | ||
exports.ChatKittyCancelledResult = ChatKittyCancelledResult; | ||
var ChatKittyErrorResult = /** @class */ (function () { | ||
function ChatKittyErrorResult() { | ||
this.wasSuccessful = false; | ||
this.wasCancelled = false; | ||
this.isError = true; | ||
var ChatKittyFailedResult = /** @class */ (function () { | ||
function ChatKittyFailedResult() { | ||
this.succeeded = false; | ||
this.cancelled = false; | ||
this.failed = true; | ||
} | ||
return ChatKittyErrorResult; | ||
return ChatKittyFailedResult; | ||
}()); | ||
exports.ChatKittyErrorResult = ChatKittyErrorResult; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LnJlc3VsdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvbW9kZWwvY2hhdGtpdHR5LnJlc3VsdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFRQTtJQUFBO1FBQ0Usa0JBQWEsR0FBRyxJQUFJLENBQUM7UUFDckIsaUJBQVksR0FBRyxLQUFLLENBQUM7UUFDckIsWUFBTyxHQUFHLEtBQUssQ0FBQztJQUNsQixDQUFDO0lBQUQsZ0NBQUM7QUFBRCxDQUFDLEFBSkQsSUFJQztBQUpxQiw4REFBeUI7QUFNL0M7SUFBQTtRQUNFLGtCQUFhLEdBQUcsS0FBSyxDQUFDO1FBQ3RCLGlCQUFZLEdBQUcsSUFBSSxDQUFDO1FBQ3BCLFlBQU8sR0FBRyxLQUFLLENBQUM7SUFDbEIsQ0FBQztJQUFELCtCQUFDO0FBQUQsQ0FBQyxBQUpELElBSUM7QUFKcUIsNERBQXdCO0FBTTlDO0lBQUE7UUFDRSxrQkFBYSxHQUFHLEtBQUssQ0FBQztRQUN0QixpQkFBWSxHQUFHLEtBQUssQ0FBQztRQUNyQixZQUFPLEdBQUcsSUFBSSxDQUFDO0lBRWpCLENBQUM7SUFBRCwyQkFBQztBQUFELENBQUMsQUFMRCxJQUtDO0FBTHFCLG9EQUFvQiJ9 | ||
exports.ChatKittyFailedResult = ChatKittyFailedResult; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LnJlc3VsdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvbW9kZWwvY2hhdGtpdHR5LnJlc3VsdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFRQTtJQUFBO1FBQ0UsY0FBUyxHQUFHLElBQUksQ0FBQztRQUNqQixjQUFTLEdBQUcsS0FBSyxDQUFDO1FBQ2xCLFdBQU0sR0FBRyxLQUFLLENBQUM7SUFDakIsQ0FBQztJQUFELCtCQUFDO0FBQUQsQ0FBQyxBQUpELElBSUM7QUFKcUIsNERBQXdCO0FBTTlDO0lBQUE7UUFDRSxjQUFTLEdBQUcsS0FBSyxDQUFDO1FBQ2xCLGNBQVMsR0FBRyxJQUFJLENBQUM7UUFDakIsV0FBTSxHQUFHLEtBQUssQ0FBQztJQUNqQixDQUFDO0lBQUQsK0JBQUM7QUFBRCxDQUFDLEFBSkQsSUFJQztBQUpxQiw0REFBd0I7QUFNOUM7SUFBQTtRQUNFLGNBQVMsR0FBRyxLQUFLLENBQUM7UUFDbEIsY0FBUyxHQUFHLEtBQUssQ0FBQztRQUNsQixXQUFNLEdBQUcsSUFBSSxDQUFDO0lBRWhCLENBQUM7SUFBRCw0QkFBQztBQUFELENBQUMsQUFMRCxJQUtDO0FBTHFCLHNEQUFxQiJ9 |
@@ -1,6 +0,6 @@ | ||
import { ChatKittySuccessfulResult } from '../../chatkitty.result'; | ||
import { ChatKittySucceededResult } from '../../chatkitty.result'; | ||
import { CurrentUser } from '../current-user.model'; | ||
export declare class GetCurrentUserResult extends ChatKittySuccessfulResult { | ||
export declare class GetCurrentUserResult extends ChatKittySucceededResult { | ||
currentUser: CurrentUser; | ||
constructor(currentUser: CurrentUser); | ||
} |
@@ -26,4 +26,4 @@ "use strict"; | ||
return GetCurrentUserResult; | ||
}(chatkitty_result_1.ChatKittySuccessfulResult)); | ||
}(chatkitty_result_1.ChatKittySucceededResult)); | ||
exports.GetCurrentUserResult = GetCurrentUserResult; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVudC11c2VyLmdldC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jdXJyZW50LXVzZXIvZ2V0L2N1cnJlbnQtdXNlci5nZXQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkRBRWdDO0FBR2hDO0lBQTBDLHdDQUF5QjtJQUNqRSw4QkFBbUIsV0FBd0I7UUFBM0MsWUFDRSxpQkFBTyxTQUNSO1FBRmtCLGlCQUFXLEdBQVgsV0FBVyxDQUFhOztJQUUzQyxDQUFDO0lBQ0gsMkJBQUM7QUFBRCxDQUFDLEFBSkQsQ0FBMEMsNENBQXlCLEdBSWxFO0FBSlksb0RBQW9CIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVudC11c2VyLmdldC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jdXJyZW50LXVzZXIvZ2V0L2N1cnJlbnQtdXNlci5nZXQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkRBRWdDO0FBR2hDO0lBQTBDLHdDQUF3QjtJQUNoRSw4QkFBbUIsV0FBd0I7UUFBM0MsWUFDRSxpQkFBTyxTQUNSO1FBRmtCLGlCQUFXLEdBQVgsV0FBVyxDQUFhOztJQUUzQyxDQUFDO0lBQ0gsMkJBQUM7QUFBRCxDQUFDLEFBSkQsQ0FBMEMsMkNBQXdCLEdBSWpFO0FBSlksb0RBQW9CIn0= |
@@ -1,6 +0,6 @@ | ||
import { SessionAccessDeniedErrorResult, SessionStartedResult } from './session.start.results'; | ||
import { SessionAccessDeniedResult, SessionStartedResult } from './session.start.results'; | ||
export interface SessionStartRequest { | ||
username: string; | ||
authParams?: unknown; | ||
callback: (result: SessionStartedResult | SessionAccessDeniedErrorResult) => void; | ||
callback: (result: SessionStartedResult | SessionAccessDeniedResult) => void; | ||
} |
@@ -1,12 +0,12 @@ | ||
import { ChatKittyErrorResult, ChatKittySuccessfulResult } from '../../chatkitty.result'; | ||
import { ChatKittyFailedResult, ChatKittySucceededResult } from '../../chatkitty.result'; | ||
import { Session } from '../session.model'; | ||
import { SessionAccessDeniedError } from './session.errors'; | ||
export declare class SessionStartedResult extends ChatKittySuccessfulResult { | ||
export declare class SessionStartedResult extends ChatKittySucceededResult { | ||
session: Session; | ||
constructor(session: Session); | ||
} | ||
export declare class SessionAccessDeniedErrorResult extends ChatKittyErrorResult { | ||
export declare class SessionAccessDeniedResult extends ChatKittyFailedResult { | ||
error: SessionAccessDeniedError; | ||
constructor(error: SessionAccessDeniedError); | ||
} | ||
export declare function sessionWasStarted(result: SessionStartedResult | SessionAccessDeniedErrorResult): result is SessionStartedResult; | ||
export declare function sessionStarted(result: SessionStartedResult | SessionAccessDeniedResult): result is SessionStartedResult; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sessionWasStarted = exports.SessionAccessDeniedErrorResult = exports.SessionStartedResult = void 0; | ||
exports.sessionStarted = exports.SessionAccessDeniedResult = exports.SessionStartedResult = void 0; | ||
var chatkitty_result_1 = require("../../chatkitty.result"); | ||
@@ -27,7 +27,7 @@ var SessionStartedResult = /** @class */ (function (_super) { | ||
return SessionStartedResult; | ||
}(chatkitty_result_1.ChatKittySuccessfulResult)); | ||
}(chatkitty_result_1.ChatKittySucceededResult)); | ||
exports.SessionStartedResult = SessionStartedResult; | ||
var SessionAccessDeniedErrorResult = /** @class */ (function (_super) { | ||
__extends(SessionAccessDeniedErrorResult, _super); | ||
function SessionAccessDeniedErrorResult(error) { | ||
var SessionAccessDeniedResult = /** @class */ (function (_super) { | ||
__extends(SessionAccessDeniedResult, _super); | ||
function SessionAccessDeniedResult(error) { | ||
var _this = _super.call(this) || this; | ||
@@ -37,9 +37,9 @@ _this.error = error; | ||
} | ||
return SessionAccessDeniedErrorResult; | ||
}(chatkitty_result_1.ChatKittyErrorResult)); | ||
exports.SessionAccessDeniedErrorResult = SessionAccessDeniedErrorResult; | ||
function sessionWasStarted(result) { | ||
return SessionAccessDeniedResult; | ||
}(chatkitty_result_1.ChatKittyFailedResult)); | ||
exports.SessionAccessDeniedResult = SessionAccessDeniedResult; | ||
function sessionStarted(result) { | ||
return result.session !== undefined; | ||
} | ||
exports.sessionWasStarted = sessionWasStarted; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5zdGFydC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9zZXNzaW9uL3N0YXJ0L3Nlc3Npb24uc3RhcnQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkRBR2dDO0FBS2hDO0lBQTBDLHdDQUF5QjtJQUNqRSw4QkFBbUIsT0FBZ0I7UUFBbkMsWUFDRSxpQkFBTyxTQUNSO1FBRmtCLGFBQU8sR0FBUCxPQUFPLENBQVM7O0lBRW5DLENBQUM7SUFDSCwyQkFBQztBQUFELENBQUMsQUFKRCxDQUEwQyw0Q0FBeUIsR0FJbEU7QUFKWSxvREFBb0I7QUFNakM7SUFBb0Qsa0RBQW9CO0lBQ3RFLHdDQUFtQixLQUErQjtRQUFsRCxZQUNFLGlCQUFPLFNBQ1I7UUFGa0IsV0FBSyxHQUFMLEtBQUssQ0FBMEI7O0lBRWxELENBQUM7SUFDSCxxQ0FBQztBQUFELENBQUMsQUFKRCxDQUFvRCx1Q0FBb0IsR0FJdkU7QUFKWSx3RUFBOEI7QUFNM0MsU0FBZ0IsaUJBQWlCLENBQUMsTUFFZ0M7SUFFaEUsT0FBUSxNQUErQixDQUFDLE9BQU8sS0FBSyxTQUFTLENBQUM7QUFDaEUsQ0FBQztBQUxELDhDQUtDIn0= | ||
exports.sessionStarted = sessionStarted; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5zdGFydC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9zZXNzaW9uL3N0YXJ0L3Nlc3Npb24uc3RhcnQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkRBR2dDO0FBS2hDO0lBQTBDLHdDQUF3QjtJQUNoRSw4QkFBbUIsT0FBZ0I7UUFBbkMsWUFDRSxpQkFBTyxTQUNSO1FBRmtCLGFBQU8sR0FBUCxPQUFPLENBQVM7O0lBRW5DLENBQUM7SUFDSCwyQkFBQztBQUFELENBQUMsQUFKRCxDQUEwQywyQ0FBd0IsR0FJakU7QUFKWSxvREFBb0I7QUFNakM7SUFBK0MsNkNBQXFCO0lBQ2xFLG1DQUFtQixLQUErQjtRQUFsRCxZQUNFLGlCQUFPLFNBQ1I7UUFGa0IsV0FBSyxHQUFMLEtBQUssQ0FBMEI7O0lBRWxELENBQUM7SUFDSCxnQ0FBQztBQUFELENBQUMsQUFKRCxDQUErQyx3Q0FBcUIsR0FJbkU7QUFKWSw4REFBeUI7QUFNdEMsU0FBZ0IsY0FBYyxDQUFDLE1BRTJCO0lBRXhELE9BQVEsTUFBK0IsQ0FBQyxPQUFPLEtBQUssU0FBUyxDQUFDO0FBQ2hFLENBQUM7QUFMRCx3Q0FLQyJ9 |
@@ -0,3 +1,5 @@ | ||
import { StompXConnectRequest } from './request/stompx.connect.request'; | ||
import { StompXDisconnectRequest } from './request/stompx.disconnect.request'; | ||
import { StompXRelayResourceRequest } from './request/stompx.relay-resource.request'; | ||
import { StompXConfiguration } from './stompx.configuration'; | ||
import { StompXError } from './stompx.error'; | ||
export declare class StompXClient { | ||
@@ -7,6 +9,6 @@ private readonly rxStompConfig; | ||
constructor(configuration: StompXConfiguration); | ||
connect(headers: Record<string, string>, onSuccess: () => void, onError: (error: StompXError) => void): void; | ||
relayResource<R>(destination: string, onResourceRelayed: (resource: R) => void): void; | ||
disconnect(onDisconnected: () => void): void; | ||
connect(request: StompXConnectRequest): void; | ||
relayResource<R>(request: StompXRelayResourceRequest<R>): void; | ||
disconnect(request: StompXDisconnectRequest): void; | ||
private static generateReceipt; | ||
} |
@@ -43,4 +43,11 @@ "use strict"; | ||
} | ||
StompXClient.prototype.connect = function (headers, onSuccess, onError) { | ||
StompXClient.prototype.connect = function (request) { | ||
var _this = this; | ||
var headers = { | ||
api_key: request.apiKey, | ||
stompx_user: request.username | ||
}; | ||
if (request.authParams) { | ||
headers = __assign(__assign({}, headers), { stompx_auth_params: JSON.stringify(request.authParams) }); | ||
} | ||
var params = new URLSearchParams(headers); | ||
@@ -51,7 +58,7 @@ var brokerURL = this.rxStompConfig.brokerURL + '?' + params.toString(); | ||
var successSubscription = this.rxStomp.connected$.subscribe(function () { | ||
onSuccess(); | ||
request.onSuccess(); | ||
successSubscription.unsubscribe(); | ||
}); | ||
var errorSubscription = this.rxStomp.stompErrors$.subscribe(function (frame) { | ||
onError(JSON.parse(frame.body)); | ||
request.onError(JSON.parse(frame.body)); | ||
errorSubscription.unsubscribe(); | ||
@@ -61,14 +68,14 @@ _this.rxStomp.deactivate(); | ||
}; | ||
StompXClient.prototype.relayResource = function (destination, onResourceRelayed) { | ||
this.rxStomp.watch(destination, { | ||
id: destination, | ||
StompXClient.prototype.relayResource = function (request) { | ||
this.rxStomp.watch(request.destination, { | ||
id: request.destination, | ||
receipt: StompXClient.generateReceipt() | ||
}) | ||
.subscribe(function (message) { | ||
onResourceRelayed(JSON.parse(message.body)); | ||
request.onSuccess(JSON.parse(message.body)); | ||
}); | ||
}; | ||
StompXClient.prototype.disconnect = function (onDisconnected) { | ||
StompXClient.prototype.disconnect = function (request) { | ||
this.rxStomp.deactivate(); | ||
onDisconnected(); | ||
request.onSuccess(); | ||
}; | ||
@@ -81,2 +88,2 @@ StompXClient.generateReceipt = function () { | ||
exports.StompXClient = StompXClient; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvbXB4LmNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvc3RvbXB4L3N0b21weC5jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7QUFBQSw0Q0FBMEM7QUFFMUMsMENBQTBDO0FBQzFDLDZCQUEwQjtBQUsxQjtJQUtFLHNCQUFZLGFBQWtDO1FBRnRDLFlBQU8sR0FBWSxJQUFJLGtCQUFPLEVBQUUsQ0FBQztRQUd2QyxJQUFJLE1BQWMsQ0FBQztRQUNuQixJQUFJLGFBQWEsQ0FBQyxRQUFRLEVBQUU7WUFDMUIsTUFBTSxHQUFHLEtBQUssQ0FBQztTQUNoQjthQUFNO1lBQ0wsTUFBTSxHQUFHLElBQUksQ0FBQztTQUNmO1FBRUQsSUFBTSxTQUFTLEdBQUcsTUFBTSxHQUFHLEtBQUssR0FBRyxhQUFhLENBQUMsSUFBSSxHQUFHLG1CQUFtQixDQUFDO1FBRTVFLElBQUksQ0FBQyxhQUFhLEdBQUc7WUFDbkIsU0FBUyxFQUFFLFNBQVM7WUFFcEIsYUFBYSxFQUFFLElBQUksa0JBQVEsQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ3BDLGlCQUFpQixFQUFFLElBQUk7WUFDdkIsaUJBQWlCLEVBQUUsSUFBSTtZQUN2QixtQkFBbUIsRUFBRSxJQUFJO1lBQ3pCLDJCQUEyQixFQUFFLElBQUk7WUFFak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9BQU8sQ0FBQyxXQUFXLEVBQUU7WUFDdEMsRUFBRSxFQUFFLE9BQU8sQ0FBQyxXQUFXO1lBQ3ZCLE9BQU8sRUFBRSxZQUFZLENBQUMsZUFBZSxFQUFFO1NBQ3hDLENBQUM7YUFDRCxTQUFTLENBQUMsVUFBQSxPQUFPO1lBQ2hCLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztRQUM5QyxDQUFDLENBQUMsQ0FBQztJQUNMLENBQUM7SUFFTSxpQ0FBVSxHQUFqQixVQUFrQixPQUFnQztRQUNoRCxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsRUFBRSxDQUFDO1FBRTFCLE9BQU8sQ0FBQyxTQUFTLEVBQUUsQ0FBQztJQUN0QixDQUFDO0lBRWMsNEJBQWUsR0FBOUI7UUFDRSxPQUFPLFVBQVUsR0FBRyxTQUFFLEVBQUUsQ0FBQztJQUMzQixDQUFDO0lBQ0gsbUJBQUM7QUFBRCxDQUFDLEFBMUZELElBMEZDO0FBMUZZLG9DQUFZIn0= |
import { environment } from '../environments/environment'; | ||
import { GetCurrentUserResult } from './model/current-user/get/current-user.get.results'; | ||
import { SessionAccessDeniedError } from './model/session/start/session.errors'; | ||
import { SessionAccessDeniedErrorResult, SessionStartedResult } from './model/session/start/session.start.results'; | ||
import { SessionAccessDeniedResult, SessionStartedResult } from './model/session/start/session.start.results'; | ||
import { StompXClient } from './stompx/stompx.client'; | ||
@@ -16,19 +16,18 @@ export default class ChatKitty { | ||
startSession(request) { | ||
let headers = { | ||
api_key: this.configuration.apiKey, | ||
stompx_user: request.username | ||
}; | ||
if (request.authParams) { | ||
headers = { | ||
...headers, | ||
stompx_auth_params: JSON.stringify(request.authParams) | ||
}; | ||
} | ||
this.client.connect(headers, () => { | ||
this.client.relayResource(ChatKitty.currentUserRelay, user => { | ||
request.callback(new SessionStartedResult({ user: user })); | ||
}); | ||
}, (error) => { | ||
if (error.error === 'AccessDeniedError') { | ||
request.callback(new SessionAccessDeniedErrorResult(new SessionAccessDeniedError())); | ||
this.client.connect({ | ||
apiKey: this.configuration.apiKey, | ||
username: request.username, | ||
authParams: request.authParams, | ||
onSuccess: () => { | ||
this.client.relayResource({ | ||
destination: ChatKitty.currentUserRelay, | ||
onSuccess: user => { | ||
request.callback(new SessionStartedResult({ user: user })); | ||
} | ||
}); | ||
}, | ||
onError: (error) => { | ||
if (error.error === 'AccessDeniedError') { | ||
request.callback(new SessionAccessDeniedResult(new SessionAccessDeniedError())); | ||
} | ||
} | ||
@@ -38,4 +37,7 @@ }); | ||
getCurrentUser(callback) { | ||
this.client.relayResource(ChatKitty.currentUserRelay, user => { | ||
callback(new GetCurrentUserResult(user)); | ||
this.client.relayResource({ | ||
destination: ChatKitty.currentUserRelay, | ||
onSuccess: user => { | ||
callback(new GetCurrentUserResult(user)); | ||
} | ||
}); | ||
@@ -45,2 +47,2 @@ } | ||
ChatKitty.currentUserRelay = '/application/v1/users/me.relay'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9jaGF0a2l0dHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBSTFELE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLG1EQUFtRCxDQUFDO0FBQ3pGLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBRWhGLE9BQU8sRUFDTCw4QkFBOEIsRUFDOUIsb0JBQW9CLEVBQ3JCLE1BQU0sNkNBQTZDLENBQUM7QUFDckQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHdCQUF3Qix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9BQU8sQ0FBQyxRQUFRLENBQUMsSUFBSSx5QkFBeUIsQ0FBQyxJQUFJLHdCQUF3QixFQUFFLENBQUMsQ0FBQyxDQUFDO2lCQUNqRjtZQUNILENBQUM7U0FDRixDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU0sY0FBYyxDQUFDLFFBQWdEO1FBQ3BFLElBQUksQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFjO1lBQ3JDLFdBQVcsRUFBRSxTQUFTLENBQUMsZ0JBQWdCO1lBQ3ZDLFNBQVMsRUFBRSxJQUFJLENBQUMsRUFBRTtnQkFDaEIsUUFBUSxDQUFDLElBQUksb0JBQW9CLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztZQUMzQyxDQUFDO1NBQ0YsQ0FBQyxDQUFDO0lBQ0wsQ0FBQzs7QUF6Q3VCLDBCQUFnQixHQUFHLGdDQUFnQyxDQUFDIn0= |
import { ChatKittyError } from './chatkitty.error'; | ||
export interface ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
} | ||
export declare abstract class ChatKittySuccessfulResult implements ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
export declare abstract class ChatKittySucceededResult implements ChatKittyResult { | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
} | ||
export declare abstract class ChatKittyCancelledResult implements ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
} | ||
export declare abstract class ChatKittyErrorResult implements ChatKittyResult { | ||
wasSuccessful: boolean; | ||
wasCancelled: boolean; | ||
isError: boolean; | ||
export declare abstract class ChatKittyFailedResult implements ChatKittyResult { | ||
succeeded: boolean; | ||
cancelled: boolean; | ||
failed: boolean; | ||
abstract error: ChatKittyError; | ||
} |
@@ -1,6 +0,6 @@ | ||
export class ChatKittySuccessfulResult { | ||
export class ChatKittySucceededResult { | ||
constructor() { | ||
this.wasSuccessful = true; | ||
this.wasCancelled = false; | ||
this.isError = false; | ||
this.succeeded = true; | ||
this.cancelled = false; | ||
this.failed = false; | ||
} | ||
@@ -10,14 +10,14 @@ } | ||
constructor() { | ||
this.wasSuccessful = false; | ||
this.wasCancelled = true; | ||
this.isError = false; | ||
this.succeeded = false; | ||
this.cancelled = true; | ||
this.failed = false; | ||
} | ||
} | ||
export class ChatKittyErrorResult { | ||
export class ChatKittyFailedResult { | ||
constructor() { | ||
this.wasSuccessful = false; | ||
this.wasCancelled = false; | ||
this.isError = true; | ||
this.succeeded = false; | ||
this.cancelled = false; | ||
this.failed = true; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LnJlc3VsdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvbW9kZWwvY2hhdGtpdHR5LnJlc3VsdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFRQSxNQUFNLE9BQWdCLHlCQUF5QjtJQUEvQztRQUNFLGtCQUFhLEdBQUcsSUFBSSxDQUFDO1FBQ3JCLGlCQUFZLEdBQUcsS0FBSyxDQUFDO1FBQ3JCLFlBQU8sR0FBRyxLQUFLLENBQUM7SUFDbEIsQ0FBQztDQUFBO0FBRUQsTUFBTSxPQUFnQix3QkFBd0I7SUFBOUM7UUFDRSxrQkFBYSxHQUFHLEtBQUssQ0FBQztRQUN0QixpQkFBWSxHQUFHLElBQUksQ0FBQztRQUNwQixZQUFPLEdBQUcsS0FBSyxDQUFDO0lBQ2xCLENBQUM7Q0FBQTtBQUVELE1BQU0sT0FBZ0Isb0JBQW9CO0lBQTFDO1FBQ0Usa0JBQWEsR0FBRyxLQUFLLENBQUM7UUFDdEIsaUJBQVksR0FBRyxLQUFLLENBQUM7UUFDckIsWUFBTyxHQUFHLElBQUksQ0FBQztJQUVqQixDQUFDO0NBQUEifQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdGtpdHR5LnJlc3VsdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvbW9kZWwvY2hhdGtpdHR5LnJlc3VsdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFRQSxNQUFNLE9BQWdCLHdCQUF3QjtJQUE5QztRQUNFLGNBQVMsR0FBRyxJQUFJLENBQUM7UUFDakIsY0FBUyxHQUFHLEtBQUssQ0FBQztRQUNsQixXQUFNLEdBQUcsS0FBSyxDQUFDO0lBQ2pCLENBQUM7Q0FBQTtBQUVELE1BQU0sT0FBZ0Isd0JBQXdCO0lBQTlDO1FBQ0UsY0FBUyxHQUFHLEtBQUssQ0FBQztRQUNsQixjQUFTLEdBQUcsSUFBSSxDQUFDO1FBQ2pCLFdBQU0sR0FBRyxLQUFLLENBQUM7SUFDakIsQ0FBQztDQUFBO0FBRUQsTUFBTSxPQUFnQixxQkFBcUI7SUFBM0M7UUFDRSxjQUFTLEdBQUcsS0FBSyxDQUFDO1FBQ2xCLGNBQVMsR0FBRyxLQUFLLENBQUM7UUFDbEIsV0FBTSxHQUFHLElBQUksQ0FBQztJQUVoQixDQUFDO0NBQUEifQ== |
@@ -1,6 +0,6 @@ | ||
import { ChatKittySuccessfulResult } from '../../chatkitty.result'; | ||
import { ChatKittySucceededResult } from '../../chatkitty.result'; | ||
import { CurrentUser } from '../current-user.model'; | ||
export declare class GetCurrentUserResult extends ChatKittySuccessfulResult { | ||
export declare class GetCurrentUserResult extends ChatKittySucceededResult { | ||
currentUser: CurrentUser; | ||
constructor(currentUser: CurrentUser); | ||
} |
@@ -1,3 +0,3 @@ | ||
import { ChatKittySuccessfulResult } from '../../chatkitty.result'; | ||
export class GetCurrentUserResult extends ChatKittySuccessfulResult { | ||
import { ChatKittySucceededResult } from '../../chatkitty.result'; | ||
export class GetCurrentUserResult extends ChatKittySucceededResult { | ||
constructor(currentUser) { | ||
@@ -8,2 +8,2 @@ super(); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVudC11c2VyLmdldC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jdXJyZW50LXVzZXIvZ2V0L2N1cnJlbnQtdXNlci5nZXQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wseUJBQXlCLEVBQzFCLE1BQU0sd0JBQXdCLENBQUM7QUFHaEMsTUFBTSxPQUFPLG9CQUFxQixTQUFRLHlCQUF5QjtJQUNqRSxZQUFtQixXQUF3QjtRQUN6QyxLQUFLLEVBQUUsQ0FBQztRQURTLGdCQUFXLEdBQVgsV0FBVyxDQUFhO0lBRTNDLENBQUM7Q0FDRiJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVudC11c2VyLmdldC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9jdXJyZW50LXVzZXIvZ2V0L2N1cnJlbnQtdXNlci5nZXQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsd0JBQXdCLEVBQ3pCLE1BQU0sd0JBQXdCLENBQUM7QUFHaEMsTUFBTSxPQUFPLG9CQUFxQixTQUFRLHdCQUF3QjtJQUNoRSxZQUFtQixXQUF3QjtRQUN6QyxLQUFLLEVBQUUsQ0FBQztRQURTLGdCQUFXLEdBQVgsV0FBVyxDQUFhO0lBRTNDLENBQUM7Q0FDRiJ9 |
@@ -1,6 +0,6 @@ | ||
import { SessionAccessDeniedErrorResult, SessionStartedResult } from './session.start.results'; | ||
import { SessionAccessDeniedResult, SessionStartedResult } from './session.start.results'; | ||
export interface SessionStartRequest { | ||
username: string; | ||
authParams?: unknown; | ||
callback: (result: SessionStartedResult | SessionAccessDeniedErrorResult) => void; | ||
callback: (result: SessionStartedResult | SessionAccessDeniedResult) => void; | ||
} |
@@ -1,12 +0,12 @@ | ||
import { ChatKittyErrorResult, ChatKittySuccessfulResult } from '../../chatkitty.result'; | ||
import { ChatKittyFailedResult, ChatKittySucceededResult } from '../../chatkitty.result'; | ||
import { Session } from '../session.model'; | ||
import { SessionAccessDeniedError } from './session.errors'; | ||
export declare class SessionStartedResult extends ChatKittySuccessfulResult { | ||
export declare class SessionStartedResult extends ChatKittySucceededResult { | ||
session: Session; | ||
constructor(session: Session); | ||
} | ||
export declare class SessionAccessDeniedErrorResult extends ChatKittyErrorResult { | ||
export declare class SessionAccessDeniedResult extends ChatKittyFailedResult { | ||
error: SessionAccessDeniedError; | ||
constructor(error: SessionAccessDeniedError); | ||
} | ||
export declare function sessionWasStarted(result: SessionStartedResult | SessionAccessDeniedErrorResult): result is SessionStartedResult; | ||
export declare function sessionStarted(result: SessionStartedResult | SessionAccessDeniedResult): result is SessionStartedResult; |
@@ -1,3 +0,3 @@ | ||
import { ChatKittyErrorResult, ChatKittySuccessfulResult } from '../../chatkitty.result'; | ||
export class SessionStartedResult extends ChatKittySuccessfulResult { | ||
import { ChatKittyFailedResult, ChatKittySucceededResult } from '../../chatkitty.result'; | ||
export class SessionStartedResult extends ChatKittySucceededResult { | ||
constructor(session) { | ||
@@ -8,3 +8,3 @@ super(); | ||
} | ||
export class SessionAccessDeniedErrorResult extends ChatKittyErrorResult { | ||
export class SessionAccessDeniedResult extends ChatKittyFailedResult { | ||
constructor(error) { | ||
@@ -15,5 +15,5 @@ super(); | ||
} | ||
export function sessionWasStarted(result) { | ||
export function sessionStarted(result) { | ||
return result.session !== undefined; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5zdGFydC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9zZXNzaW9uL3N0YXJ0L3Nlc3Npb24uc3RhcnQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsb0JBQW9CLEVBQ3BCLHlCQUF5QixFQUMxQixNQUFNLHdCQUF3QixDQUFDO0FBS2hDLE1BQU0sT0FBTyxvQkFBcUIsU0FBUSx5QkFBeUI7SUFDakUsWUFBbUIsT0FBZ0I7UUFDakMsS0FBSyxFQUFFLENBQUM7UUFEUyxZQUFPLEdBQVAsT0FBTyxDQUFTO0lBRW5DLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTyw4QkFBK0IsU0FBUSxvQkFBb0I7SUFDdEUsWUFBbUIsS0FBK0I7UUFDaEQsS0FBSyxFQUFFLENBQUM7UUFEUyxVQUFLLEdBQUwsS0FBSyxDQUEwQjtJQUVsRCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLFVBQVUsaUJBQWlCLENBQUMsTUFFZ0M7SUFFaEUsT0FBUSxNQUErQixDQUFDLE9BQU8sS0FBSyxTQUFTLENBQUM7QUFDaEUsQ0FBQyJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi5zdGFydC5yZXN1bHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9tb2RlbC9zZXNzaW9uL3N0YXJ0L3Nlc3Npb24uc3RhcnQucmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wscUJBQXFCLEVBQ3JCLHdCQUF3QixFQUN6QixNQUFNLHdCQUF3QixDQUFDO0FBS2hDLE1BQU0sT0FBTyxvQkFBcUIsU0FBUSx3QkFBd0I7SUFDaEUsWUFBbUIsT0FBZ0I7UUFDakMsS0FBSyxFQUFFLENBQUM7UUFEUyxZQUFPLEdBQVAsT0FBTyxDQUFTO0lBRW5DLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTyx5QkFBMEIsU0FBUSxxQkFBcUI7SUFDbEUsWUFBbUIsS0FBK0I7UUFDaEQsS0FBSyxFQUFFLENBQUM7UUFEUyxVQUFLLEdBQUwsS0FBSyxDQUEwQjtJQUVsRCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLFVBQVUsY0FBYyxDQUFDLE1BRTJCO0lBRXhELE9BQVEsTUFBK0IsQ0FBQyxPQUFPLEtBQUssU0FBUyxDQUFDO0FBQ2hFLENBQUMifQ== |
@@ -0,3 +1,5 @@ | ||
import { StompXConnectRequest } from './request/stompx.connect.request'; | ||
import { StompXDisconnectRequest } from './request/stompx.disconnect.request'; | ||
import { StompXRelayResourceRequest } from './request/stompx.relay-resource.request'; | ||
import { StompXConfiguration } from './stompx.configuration'; | ||
import { StompXError } from './stompx.error'; | ||
export declare class StompXClient { | ||
@@ -7,6 +9,6 @@ private readonly rxStompConfig; | ||
constructor(configuration: StompXConfiguration); | ||
connect(headers: Record<string, string>, onSuccess: () => void, onError: (error: StompXError) => void): void; | ||
relayResource<R>(destination: string, onResourceRelayed: (resource: R) => void): void; | ||
disconnect(onDisconnected: () => void): void; | ||
connect(request: StompXConnectRequest): void; | ||
relayResource<R>(request: StompXRelayResourceRequest<R>): void; | ||
disconnect(request: StompXDisconnectRequest): void; | ||
private static generateReceipt; | ||
} |
@@ -29,3 +29,13 @@ import { RxStomp } from '@stomp/rx-stomp'; | ||
} | ||
connect(headers, onSuccess, onError) { | ||
connect(request) { | ||
let headers = { | ||
api_key: request.apiKey, | ||
stompx_user: request.username | ||
}; | ||
if (request.authParams) { | ||
headers = { | ||
...headers, | ||
stompx_auth_params: JSON.stringify(request.authParams) | ||
}; | ||
} | ||
const params = new URLSearchParams(headers); | ||
@@ -39,7 +49,7 @@ const brokerURL = this.rxStompConfig.brokerURL + '?' + params.toString(); | ||
const successSubscription = this.rxStomp.connected$.subscribe(() => { | ||
onSuccess(); | ||
request.onSuccess(); | ||
successSubscription.unsubscribe(); | ||
}); | ||
const errorSubscription = this.rxStomp.stompErrors$.subscribe(frame => { | ||
onError(JSON.parse(frame.body)); | ||
request.onError(JSON.parse(frame.body)); | ||
errorSubscription.unsubscribe(); | ||
@@ -49,14 +59,14 @@ this.rxStomp.deactivate(); | ||
} | ||
relayResource(destination, onResourceRelayed) { | ||
this.rxStomp.watch(destination, { | ||
id: destination, | ||
relayResource(request) { | ||
this.rxStomp.watch(request.destination, { | ||
id: request.destination, | ||
receipt: StompXClient.generateReceipt() | ||
}) | ||
.subscribe(message => { | ||
onResourceRelayed(JSON.parse(message.body)); | ||
request.onSuccess(JSON.parse(message.body)); | ||
}); | ||
} | ||
disconnect(onDisconnected) { | ||
disconnect(request) { | ||
this.rxStomp.deactivate(); | ||
onDisconnected(); | ||
request.onSuccess(); | ||
} | ||
@@ -67,2 +77,2 @@ static generateReceipt() { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvbXB4LmNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvc3RvbXB4L3N0b21weC5jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRTFDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMx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O1FBQzlDLENBQUMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQUVNLFVBQVUsQ0FBQyxPQUFnQztRQUNoRCxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsRUFBRSxDQUFDO1FBRTFCLE9BQU8sQ0FBQyxTQUFTLEVBQUUsQ0FBQztJQUN0QixDQUFDO0lBRU8sTUFBTSxDQUFDLGVBQWU7UUFDNUIsT0FBTyxVQUFVLEdBQUcsRUFBRSxFQUFFLENBQUM7SUFDM0IsQ0FBQztDQUNGIn0= |
{ | ||
"name": "chatkitty", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "JS SDK for the ChatKitty Chat API", | ||
@@ -5,0 +5,0 @@ "main": "build/main/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56168
79
764