@bwi-mentorspaces/application-utils-npm 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chat/index.d.ts +36 -0
- package/chat/index.js +59 -0
- package/chat/index.js.map +1 -0
- package/chat/stream/enum/index.d.ts +27 -0
- package/chat/stream/enum/index.js +35 -0
- package/chat/stream/enum/index.js.map +1 -0
- package/chat/stream/index.d.ts +9 -0
- package/chat/stream/index.js +18 -0
- package/chat/stream/index.js.map +1 -0
- package/chat/stream/models/_/channel.data.d.ts +19 -0
- package/chat/stream/models/_/channel.data.js +3 -0
- package/chat/stream/models/_/channel.data.js.map +1 -0
- package/chat/stream/models/_/channel.member.d.ts +14 -0
- package/chat/stream/models/_/channel.member.js +12 -0
- package/chat/stream/models/_/channel.member.js.map +1 -0
- package/chat/stream/models/_/channel.response.d.ts +8 -0
- package/chat/stream/models/_/channel.response.js +3 -0
- package/chat/stream/models/_/channel.response.js.map +1 -0
- package/chat/stream/models/_/message.response.d.ts +8 -0
- package/chat/stream/models/_/message.response.js +3 -0
- package/chat/stream/models/_/message.response.js.map +1 -0
- package/chat/stream/models/_/stream.config.d.ts +22 -0
- package/chat/stream/models/_/stream.config.js +3 -0
- package/chat/stream/models/_/stream.config.js.map +1 -0
- package/chat/stream/models/_/user.response.d.ts +8 -0
- package/chat/stream/models/_/user.response.js +3 -0
- package/chat/stream/models/_/user.response.js.map +1 -0
- package/chat/stream/models/index.d.ts +7 -0
- package/chat/stream/models/index.js +6 -0
- package/chat/stream/models/index.js.map +1 -0
- package/chat/stream/stream.api.d.ts +63 -0
- package/chat/stream/stream.api.js +77 -0
- package/chat/stream/stream.api.js.map +1 -0
- package/chat/stream/stream.auth.d.ts +70 -0
- package/chat/stream/stream.auth.js +81 -0
- package/chat/stream/stream.auth.js.map +1 -0
- package/chat/stream/stream.base.d.ts +56 -0
- package/chat/stream/stream.base.js +94 -0
- package/chat/stream/stream.base.js.map +1 -0
- package/chat/stream/stream.channel.d.ts +118 -0
- package/chat/stream/stream.channel.js +275 -0
- package/chat/stream/stream.channel.js.map +1 -0
- package/chat/stream/stream.error.d.ts +19 -0
- package/chat/stream/stream.error.js +18 -0
- package/chat/stream/stream.error.js.map +1 -0
- package/chat/stream/stream.media.d.ts +0 -0
- package/chat/stream/stream.media.js +1 -0
- package/chat/stream/stream.media.js.map +1 -0
- package/chat/stream/stream.member.d.ts +75 -0
- package/chat/stream/stream.member.js +176 -0
- package/chat/stream/stream.member.js.map +1 -0
- package/chat/stream/stream.message.d.ts +59 -0
- package/chat/stream/stream.message.js +113 -0
- package/chat/stream/stream.message.js.map +1 -0
- package/chat/stream/stream.user.d.ts +49 -0
- package/chat/stream/stream.user.js +91 -0
- package/chat/stream/stream.user.js.map +1 -0
- package/core/_/api-error.d.ts +24 -0
- package/core/_/api-error.js +22 -0
- package/core/_/api-error.js.map +1 -0
- package/core/_/api-response.d.ts +25 -0
- package/core/_/api-response.js +22 -0
- package/core/_/api-response.js.map +1 -0
- package/core/_/cors-headers.d.ts +16 -0
- package/core/_/cors-headers.js +33 -0
- package/core/_/cors-headers.js.map +1 -0
- package/core/_/model.d.ts +31 -0
- package/core/_/model.js +3 -0
- package/core/_/model.js.map +1 -0
- package/core/_/service-request.d.ts +66 -0
- package/core/_/service-request.js +105 -0
- package/core/_/service-request.js.map +1 -0
- package/core/index.d.ts +10 -0
- package/core/index.js +12 -0
- package/core/index.js.map +1 -0
- package/deployment/_/serverless.d.ts +26 -0
- package/deployment/_/serverless.js +44 -0
- package/deployment/_/serverless.js.map +1 -0
- package/deployment/index.d.ts +2 -0
- package/deployment/index.js +6 -0
- package/deployment/index.js.map +1 -0
- package/endpoint-test-factory/_/test-factory.d.ts +45 -0
- package/endpoint-test-factory/_/test-factory.js +92 -0
- package/endpoint-test-factory/_/test-factory.js.map +1 -0
- package/endpoint-test-factory/index.d.ts +2 -0
- package/endpoint-test-factory/index.js +6 -0
- package/endpoint-test-factory/index.js.map +1 -0
- package/enums/index.d.ts +92 -0
- package/enums/index.js +3 -0
- package/enums/index.js.map +1 -0
- package/meet/index.d.ts +36 -0
- package/meet/index.js +59 -0
- package/meet/index.js.map +1 -0
- package/meet/twilio/enum/index.d.ts +6 -0
- package/meet/twilio/enum/index.js +11 -0
- package/meet/twilio/enum/index.js.map +1 -0
- package/meet/twilio/index.d.ts +5 -0
- package/meet/twilio/index.js +12 -0
- package/meet/twilio/index.js.map +1 -0
- package/meet/twilio/models/_/room.data.d.ts +6 -0
- package/meet/twilio/models/_/room.data.js +3 -0
- package/meet/twilio/models/_/room.data.js.map +1 -0
- package/meet/twilio/models/_/twilio.config.d.ts +29 -0
- package/meet/twilio/models/_/twilio.config.js +3 -0
- package/meet/twilio/models/_/twilio.config.js.map +1 -0
- package/meet/twilio/models/index.d.ts +3 -0
- package/meet/twilio/models/index.js +3 -0
- package/meet/twilio/models/index.js.map +1 -0
- package/meet/twilio/twilio.api.d.ts +28 -0
- package/meet/twilio/twilio.api.js +46 -0
- package/meet/twilio/twilio.api.js.map +1 -0
- package/meet/twilio/twilio.auth.d.ts +55 -0
- package/meet/twilio/twilio.auth.js +84 -0
- package/meet/twilio/twilio.auth.js.map +1 -0
- package/meet/twilio/twilio.base.d.ts +41 -0
- package/meet/twilio/twilio.base.js +54 -0
- package/meet/twilio/twilio.base.js.map +1 -0
- package/meet/twilio/twilio.room.d.ts +46 -0
- package/meet/twilio/twilio.room.js +125 -0
- package/meet/twilio/twilio.room.js.map +1 -0
- package/package.json +57 -0
- package/swagger/_/swagger.config.d.ts +21 -0
- package/swagger/_/swagger.config.js +3 -0
- package/swagger/_/swagger.config.js.map +1 -0
- package/swagger/_/swagger.d.ts +37 -0
- package/swagger/_/swagger.js +79 -0
- package/swagger/_/swagger.js.map +1 -0
- package/swagger/index.d.ts +3 -0
- package/swagger/index.js +6 -0
- package/swagger/index.js.map +1 -0
- package/types/index.d.ts +19 -0
- package/types/index.js +3 -0
- package/types/index.js.map +1 -0
- package/utils/_/encoder.d.ts +19 -0
- package/utils/_/encoder.js +28 -0
- package/utils/_/encoder.js.map +1 -0
- package/utils/_/encryptor.d.ts +26 -0
- package/utils/_/encryptor.js +68 -0
- package/utils/_/encryptor.js.map +1 -0
- package/utils/_/hasher.d.ts +25 -0
- package/utils/_/hasher.js +64 -0
- package/utils/_/hasher.js.map +1 -0
- package/utils/_/object-mapper.d.ts +12 -0
- package/utils/_/object-mapper.js +23 -0
- package/utils/_/object-mapper.js.map +1 -0
- package/utils/_/string-formatter.d.ts +34 -0
- package/utils/_/string-formatter.js +50 -0
- package/utils/_/string-formatter.js.map +1 -0
- package/utils/_/utc-date.d.ts +35 -0
- package/utils/_/utc-date.js +85 -0
- package/utils/_/utc-date.js.map +1 -0
- package/utils/index.d.ts +7 -0
- package/utils/index.js +16 -0
- package/utils/index.js.map +1 -0
- package/validators/_/checker.d.ts +62 -0
- package/validators/_/checker.js +99 -0
- package/validators/_/checker.js.map +1 -0
- package/validators/_/regex.d.ts +98 -0
- package/validators/_/regex.js +143 -0
- package/validators/_/regex.js.map +1 -0
- package/validators/index.d.ts +3 -0
- package/validators/index.js +8 -0
- package/validators/index.js.map +1 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StreamAuth = void 0;
|
|
13
|
+
const tsyringe_1 = require("tsyringe");
|
|
14
|
+
const stream_chat_1 = require("stream-chat");
|
|
15
|
+
const utils_1 = require("../../utils");
|
|
16
|
+
/**
|
|
17
|
+
* Chat Auth implementation
|
|
18
|
+
*/
|
|
19
|
+
let StreamAuth = class StreamAuth {
|
|
20
|
+
// methods
|
|
21
|
+
/**
|
|
22
|
+
* Stream auth constructor
|
|
23
|
+
*
|
|
24
|
+
* @param {IChatConfig} config chat config
|
|
25
|
+
*/
|
|
26
|
+
constructor(config) {
|
|
27
|
+
this.init(config.key, config.secret, config.options.token.expiration);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Generate the instance of the stream API Client.
|
|
31
|
+
* After the first call, the client configuration will not change if the key or options parameters change
|
|
32
|
+
*
|
|
33
|
+
* @param {string} apiKey api key
|
|
34
|
+
* @param {string} apiSecret api secret
|
|
35
|
+
* @param {number} expMins expiration time for token, in minutes.
|
|
36
|
+
* @returns {StreamChat} stream client
|
|
37
|
+
*/
|
|
38
|
+
init(apiKey, apiSecret, expMins) {
|
|
39
|
+
this._expMinutes = expMins;
|
|
40
|
+
this._server = stream_chat_1.StreamChat.getInstance(apiKey, apiSecret);
|
|
41
|
+
this._tokenProvider = new Map();
|
|
42
|
+
return this._server;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a new token for a specific user id
|
|
46
|
+
*
|
|
47
|
+
* @param {string} userId user id which needs a new token
|
|
48
|
+
* @returns {string} new token
|
|
49
|
+
*/
|
|
50
|
+
create(userId) {
|
|
51
|
+
//Create the timestamp, this._expMinutes is in minutes, and it is in global.config.json
|
|
52
|
+
const timestamp = utils_1.UtcDate.timestamp(this._expMinutes);
|
|
53
|
+
return this._server.createToken(userId, timestamp);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get and refresh token manager
|
|
57
|
+
*
|
|
58
|
+
* @param {string} userId user id
|
|
59
|
+
* @param {boolean} refresh refresh token
|
|
60
|
+
* @returns {string} returns token value
|
|
61
|
+
*/
|
|
62
|
+
token(userId, refresh = false) {
|
|
63
|
+
let token;
|
|
64
|
+
if (this._tokenProvider[userId] !== undefined && !refresh) {
|
|
65
|
+
return this._tokenProvider[userId];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
token = this.create(userId);
|
|
69
|
+
if (token) {
|
|
70
|
+
this._tokenProvider[userId] = token;
|
|
71
|
+
}
|
|
72
|
+
return token;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
StreamAuth = __decorate([
|
|
77
|
+
(0, tsyringe_1.injectable)(),
|
|
78
|
+
__metadata("design:paramtypes", [Object])
|
|
79
|
+
], StreamAuth);
|
|
80
|
+
exports.StreamAuth = StreamAuth;
|
|
81
|
+
//# sourceMappingURL=stream.auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.auth.js","sourceRoot":"","sources":["../../../chat/stream/stream.auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsC;AACtC,6CAAyC;AAEzC,uCAAsC;AAiCtC;;GAEG;AAEH,IAAa,UAAU,GAAvB,MAAa,UAAU;IAKnB,UAAU;IAEV;;;;OAIG;IACH,YAAY,MAAmB;QAC3B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,MAAc,EAAE,SAAiB,EAAE,OAAe;QACnD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,wBAAU,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAc;QACjB,uFAAuF;QACvF,MAAM,SAAS,GAAW,eAAO,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAc,EAAE,UAAmB,KAAK;QAC1C,IAAI,KAAa,CAAC;QAClB,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE;YACvD,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SACtC;aAAM;YACH,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC5B,IAAI,KAAK,EAAE;gBACP,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;aACvC;YACD,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;CACJ,CAAA;AA/DY,UAAU;IADtB,IAAA,qBAAU,GAAE;;GACA,UAAU,CA+DtB;AA/DY,gCAAU"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Channel, StreamChat } from "stream-chat";
|
|
2
|
+
import { StreamAuth } from "./stream.auth";
|
|
3
|
+
/**
|
|
4
|
+
* BaseClient class
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class StreamBase {
|
|
7
|
+
private _server;
|
|
8
|
+
private _auth;
|
|
9
|
+
/**
|
|
10
|
+
* getter for stream chat instance
|
|
11
|
+
*
|
|
12
|
+
* @returns {StreamChat} stream chat instance
|
|
13
|
+
*/
|
|
14
|
+
get server(): StreamChat;
|
|
15
|
+
/**
|
|
16
|
+
* setter for stream chat instance
|
|
17
|
+
*
|
|
18
|
+
* @param {StreamChat} value stream chat instance
|
|
19
|
+
*/
|
|
20
|
+
set server(value: StreamChat);
|
|
21
|
+
/**
|
|
22
|
+
* getter for stream auth
|
|
23
|
+
*
|
|
24
|
+
* @returns {StreamAuth} stream auth instance
|
|
25
|
+
*/
|
|
26
|
+
get auth(): StreamAuth;
|
|
27
|
+
/**
|
|
28
|
+
* setter for stream auth instance
|
|
29
|
+
*
|
|
30
|
+
* @param {StreamAuth} value stream auth instance
|
|
31
|
+
*/
|
|
32
|
+
set auth(value: StreamAuth);
|
|
33
|
+
/**
|
|
34
|
+
* Get token for extended classes
|
|
35
|
+
*
|
|
36
|
+
* @param {string} userId user id
|
|
37
|
+
* @param {boolean} refresh refresh token
|
|
38
|
+
* @returns {string} returns the token value
|
|
39
|
+
*/
|
|
40
|
+
getToken(userId: string, refresh?: boolean): string;
|
|
41
|
+
/**
|
|
42
|
+
* Get channel instance by id
|
|
43
|
+
*
|
|
44
|
+
* @param {string} channelId channel id
|
|
45
|
+
* @returns {Channel} channel instance
|
|
46
|
+
*/
|
|
47
|
+
getChannelById(channelId: string): Promise<Channel[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Handles the exceptions generated by the StreamAPI *(check for token expiration)
|
|
50
|
+
*
|
|
51
|
+
* @param {number} httpError http error from Stream
|
|
52
|
+
* @param {number} httpCode http error code
|
|
53
|
+
* @returns {boolean} Will be return a string with a friendly message or a new token(depending of the case)
|
|
54
|
+
*/
|
|
55
|
+
static hasTokenExpired(httpError: number, httpCode: number): boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StreamBase = void 0;
|
|
13
|
+
const enum_1 = require("./enum");
|
|
14
|
+
/**
|
|
15
|
+
* BaseClient class
|
|
16
|
+
*/
|
|
17
|
+
class StreamBase {
|
|
18
|
+
// getter / setter
|
|
19
|
+
/**
|
|
20
|
+
* getter for stream chat instance
|
|
21
|
+
*
|
|
22
|
+
* @returns {StreamChat} stream chat instance
|
|
23
|
+
*/
|
|
24
|
+
get server() {
|
|
25
|
+
return this._server;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* setter for stream chat instance
|
|
29
|
+
*
|
|
30
|
+
* @param {StreamChat} value stream chat instance
|
|
31
|
+
*/
|
|
32
|
+
set server(value) {
|
|
33
|
+
this._server = value;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* getter for stream auth
|
|
37
|
+
*
|
|
38
|
+
* @returns {StreamAuth} stream auth instance
|
|
39
|
+
*/
|
|
40
|
+
get auth() {
|
|
41
|
+
return this._auth;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* setter for stream auth instance
|
|
45
|
+
*
|
|
46
|
+
* @param {StreamAuth} value stream auth instance
|
|
47
|
+
*/
|
|
48
|
+
set auth(value) {
|
|
49
|
+
this._auth = value;
|
|
50
|
+
}
|
|
51
|
+
// methods
|
|
52
|
+
/**
|
|
53
|
+
* Get token for extended classes
|
|
54
|
+
*
|
|
55
|
+
* @param {string} userId user id
|
|
56
|
+
* @param {boolean} refresh refresh token
|
|
57
|
+
* @returns {string} returns the token value
|
|
58
|
+
*/
|
|
59
|
+
getToken(userId, refresh) {
|
|
60
|
+
return this.auth.token(userId, refresh);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get channel instance by id
|
|
64
|
+
*
|
|
65
|
+
* @param {string} channelId channel id
|
|
66
|
+
* @returns {Channel} channel instance
|
|
67
|
+
*/
|
|
68
|
+
getChannelById(channelId) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
//Create the filter
|
|
71
|
+
const filter = { type: enum_1.ChannelType.Team, id: { $eq: channelId } };
|
|
72
|
+
//return the result
|
|
73
|
+
return yield this._server.queryChannels(filter);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Handles the exceptions generated by the StreamAPI *(check for token expiration)
|
|
78
|
+
*
|
|
79
|
+
* @param {number} httpError http error from Stream
|
|
80
|
+
* @param {number} httpCode http error code
|
|
81
|
+
* @returns {boolean} Will be return a string with a friendly message or a new token(depending of the case)
|
|
82
|
+
*/
|
|
83
|
+
static hasTokenExpired(httpError, httpCode) {
|
|
84
|
+
//Check if the error belows an specific Authentication error code
|
|
85
|
+
if (httpError === 401 /* Unauthorized */ || httpError === 403 /* Forbidden */) {
|
|
86
|
+
//This is a token expired validation from API
|
|
87
|
+
if (httpCode == enum_1.ResponseCode.TokenExpired) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.StreamBase = StreamBase;
|
|
94
|
+
//# sourceMappingURL=stream.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.base.js","sourceRoot":"","sources":["../../../chat/stream/stream.base.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,iCAAmD;AAGnD;;GAEG;AACH,MAAsB,UAAU;IAK5B,kBAAkB;IAClB;;;;OAIG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACD;;;;OAIG;IACH,IAAW,MAAM,CAAC,KAAiB;QAC/B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,IAAW,IAAI,CAAC,KAAiB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,UAAU;IAEV;;;;;;OAMG;IACI,QAAQ,CAAC,MAAc,EAAE,OAAiB;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACU,cAAc,CAAC,SAAiB;;YACzC,mBAAmB;YACnB,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,kBAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC;YAClE,mBAAmB;YACnB,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACpD,CAAC;KAAA;IAED;;;;;;OAMG;IACI,MAAM,CAAC,eAAe,CAAC,SAAiB,EAAE,QAAgB;QAC7D,iEAAiE;QACjE,IAAI,SAAS,2BAAwB,IAAI,SAAS,wBAAqB,EAAE;YACrE,6CAA6C;YAC7C,IAAI,QAAQ,IAAI,mBAAY,CAAC,YAAY,EAAE;gBACvC,OAAO,IAAI,CAAC;aACf;SACJ;IACL,CAAC;CACJ;AAnFD,gCAmFC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { ChannelAPIResponse, StreamChat, Channel, ChannelSort, UpdateChannelAPIResponse, ChannelFilters, ChannelOptions } from "stream-chat";
|
|
2
|
+
import { IChannelData } from "./models/";
|
|
3
|
+
import { StreamBase } from "./stream.base";
|
|
4
|
+
import { StreamAuth } from "./stream.auth";
|
|
5
|
+
/**
|
|
6
|
+
* Channel Api declarations
|
|
7
|
+
*/
|
|
8
|
+
interface IStreamChannel {
|
|
9
|
+
/**
|
|
10
|
+
* Create channel with optional data object
|
|
11
|
+
*/
|
|
12
|
+
create(data: IChannelData): Promise<ChannelAPIResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Check if exist a channel with specific members
|
|
15
|
+
*/
|
|
16
|
+
getByMembers(data: IChannelData): Promise<Channel[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Get channel by filter
|
|
19
|
+
*/
|
|
20
|
+
getChannel(filter: ChannelFilters): Promise<Channel[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Delete a specific channel from stream, this will be delete the data too.
|
|
23
|
+
*/
|
|
24
|
+
deleteChannel(channelId: string, isHard: boolean): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Accept invited channel
|
|
27
|
+
*/
|
|
28
|
+
acceptInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Reject invited channel
|
|
31
|
+
*/
|
|
32
|
+
rejectInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Sync channel
|
|
35
|
+
*/
|
|
36
|
+
syncChannel(data: IChannelData): Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
40
|
+
*/
|
|
41
|
+
export declare class StreamChannel extends StreamBase implements IStreamChannel {
|
|
42
|
+
/**
|
|
43
|
+
* Stream channel constructor
|
|
44
|
+
*
|
|
45
|
+
* @param {StreamAuth} auth Auth class
|
|
46
|
+
* @param {StreamChat} server Stream API server
|
|
47
|
+
*/
|
|
48
|
+
constructor(auth: StreamAuth, server: StreamChat);
|
|
49
|
+
/**
|
|
50
|
+
* Create channel
|
|
51
|
+
*
|
|
52
|
+
* @param {IChannelData} data channel data object
|
|
53
|
+
* @returns {ChannelAPIResponse} channel object response
|
|
54
|
+
*/
|
|
55
|
+
create(data: IChannelData): Promise<ChannelAPIResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Add new members into a specific channel.
|
|
58
|
+
*
|
|
59
|
+
* @param {IChannelData} data channel data object
|
|
60
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
61
|
+
*/
|
|
62
|
+
addMembers(data: IChannelData): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Check if exist a channel with specific members
|
|
65
|
+
*
|
|
66
|
+
* @param {IChannelData} data channel data object
|
|
67
|
+
* @returns {Promise<Channel[]>} channel response
|
|
68
|
+
*/
|
|
69
|
+
getByMembers(data: IChannelData): Promise<Channel[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Get channel by filter
|
|
72
|
+
*
|
|
73
|
+
* @param {ChannelFilters} filter filter parameters
|
|
74
|
+
* @param {ChannelSort} sort sort parameters
|
|
75
|
+
* @param {ChannelOptions} options options parameter
|
|
76
|
+
* @returns {Promise<Channel[]>} channel response
|
|
77
|
+
*/
|
|
78
|
+
getChannel(filter: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<Channel[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Allow to partial update some fields on stream channel
|
|
81
|
+
*
|
|
82
|
+
* @param {IChannelData} data channel data object
|
|
83
|
+
* @returns {Promise<UpdateChannelAPIResponse>} channel object response
|
|
84
|
+
*/
|
|
85
|
+
updateChannel(data: IChannelData): Promise<UpdateChannelAPIResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* This will be delete a specific channel from Stream
|
|
88
|
+
*
|
|
89
|
+
* @param {string} channelId channel id of the channel
|
|
90
|
+
* @param {boolean} isHard is Hard delete
|
|
91
|
+
* @returns {Promise<boolean>} promise of the result to delete channel
|
|
92
|
+
*/
|
|
93
|
+
deleteChannel(channelId: string, isHard?: boolean): Promise<boolean>;
|
|
94
|
+
/**
|
|
95
|
+
* Accept invited channel
|
|
96
|
+
*
|
|
97
|
+
* @param {string} channelId channel id of the channel
|
|
98
|
+
* @param {string} userId user id from stream
|
|
99
|
+
* @returns {boolean} true / false
|
|
100
|
+
*/
|
|
101
|
+
acceptInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Reject invited channel
|
|
104
|
+
*
|
|
105
|
+
* @param {string} channelId channel id of the channel
|
|
106
|
+
* @param {string} userId user id from stream
|
|
107
|
+
* @returns {boolean} true / false
|
|
108
|
+
*/
|
|
109
|
+
rejectInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Sync a channel
|
|
112
|
+
*
|
|
113
|
+
* @param {IChannelData} data channel data
|
|
114
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
115
|
+
*/
|
|
116
|
+
syncChannel(data: IChannelData): Promise<boolean>;
|
|
117
|
+
}
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StreamChannel = void 0;
|
|
13
|
+
const utils_1 = require("../../utils");
|
|
14
|
+
const stream_base_1 = require("./stream.base");
|
|
15
|
+
/**
|
|
16
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
17
|
+
*/
|
|
18
|
+
class StreamChannel extends stream_base_1.StreamBase {
|
|
19
|
+
// properties
|
|
20
|
+
/**
|
|
21
|
+
* Stream channel constructor
|
|
22
|
+
*
|
|
23
|
+
* @param {StreamAuth} auth Auth class
|
|
24
|
+
* @param {StreamChat} server Stream API server
|
|
25
|
+
*/
|
|
26
|
+
constructor(auth, server) {
|
|
27
|
+
super();
|
|
28
|
+
super.auth = auth;
|
|
29
|
+
super.server = server;
|
|
30
|
+
}
|
|
31
|
+
// methods
|
|
32
|
+
/**
|
|
33
|
+
* Create channel
|
|
34
|
+
*
|
|
35
|
+
* @param {IChannelData} data channel data object
|
|
36
|
+
* @returns {ChannelAPIResponse} channel object response
|
|
37
|
+
*/
|
|
38
|
+
create(data) {
|
|
39
|
+
const _super = Object.create(null, {
|
|
40
|
+
server: { get: () => super.server }
|
|
41
|
+
});
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return _super.server
|
|
44
|
+
.channel(data.type, data.channelId, {
|
|
45
|
+
name: data.name,
|
|
46
|
+
created_by_id: data.createdById,
|
|
47
|
+
subType: data.subType ? data.subType.toString() : undefined,
|
|
48
|
+
companyId: data.companyId ? data.companyId.toString() : undefined,
|
|
49
|
+
topicRef: data.topicRef ? data.topicRef.toString() : undefined
|
|
50
|
+
})
|
|
51
|
+
.create();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Add new members into a specific channel.
|
|
56
|
+
*
|
|
57
|
+
* @param {IChannelData} data channel data object
|
|
58
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
59
|
+
*/
|
|
60
|
+
addMembers(data) {
|
|
61
|
+
const _super = Object.create(null, {
|
|
62
|
+
getChannelById: { get: () => super.getChannelById }
|
|
63
|
+
});
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
//Retrieve the channel
|
|
66
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
67
|
+
if (rChannel && rChannel.length > 0) {
|
|
68
|
+
//get the channel from the response
|
|
69
|
+
const channel = rChannel[0];
|
|
70
|
+
//retrieve the data for members
|
|
71
|
+
const existingMemberCount = channel.data.member_count;
|
|
72
|
+
//Create the message if is necessary
|
|
73
|
+
let message = undefined;
|
|
74
|
+
//Add message text if is necessary
|
|
75
|
+
if (data.inviteMessage !== undefined) {
|
|
76
|
+
message = { text: data.inviteMessage, user_id: channel.data.created_by["id"] };
|
|
77
|
+
}
|
|
78
|
+
//Send the invite request to stream
|
|
79
|
+
const r = yield channel.inviteMembers(data.members, message);
|
|
80
|
+
//check the result
|
|
81
|
+
if (existingMemberCount == r.members.length) {
|
|
82
|
+
// error, did not add members
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
//Members invited successfully
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Check if exist a channel with specific members
|
|
95
|
+
*
|
|
96
|
+
* @param {IChannelData} data channel data object
|
|
97
|
+
* @returns {Promise<Channel[]>} channel response
|
|
98
|
+
*/
|
|
99
|
+
getByMembers(data) {
|
|
100
|
+
const _super = Object.create(null, {
|
|
101
|
+
server: { get: () => super.server }
|
|
102
|
+
});
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
//Create the filter
|
|
105
|
+
const filter = { type: data.type, members: { $eq: data.members } };
|
|
106
|
+
//Create the sort
|
|
107
|
+
const sort = [{ last_message_at: -1 }];
|
|
108
|
+
//return the result of the querying
|
|
109
|
+
return _super.server.queryChannels(filter, sort);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get channel by filter
|
|
114
|
+
*
|
|
115
|
+
* @param {ChannelFilters} filter filter parameters
|
|
116
|
+
* @param {ChannelSort} sort sort parameters
|
|
117
|
+
* @param {ChannelOptions} options options parameter
|
|
118
|
+
* @returns {Promise<Channel[]>} channel response
|
|
119
|
+
*/
|
|
120
|
+
getChannel(filter, sort, options) {
|
|
121
|
+
const _super = Object.create(null, {
|
|
122
|
+
server: { get: () => super.server }
|
|
123
|
+
});
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
return _super.server.queryChannels(filter, sort, options);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Allow to partial update some fields on stream channel
|
|
130
|
+
*
|
|
131
|
+
* @param {IChannelData} data channel data object
|
|
132
|
+
* @returns {Promise<UpdateChannelAPIResponse>} channel object response
|
|
133
|
+
*/
|
|
134
|
+
updateChannel(data) {
|
|
135
|
+
const _super = Object.create(null, {
|
|
136
|
+
getChannelById: { get: () => super.getChannelById }
|
|
137
|
+
});
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
//Retrieve the channel
|
|
140
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
141
|
+
if (rChannel && rChannel.length > 0) {
|
|
142
|
+
//get the channel from the response
|
|
143
|
+
const channel = rChannel[0];
|
|
144
|
+
const partialObj = utils_1.ObjectMapper.keyValueMapper(data);
|
|
145
|
+
return channel.updatePartial({ set: partialObj });
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* This will be delete a specific channel from Stream
|
|
151
|
+
*
|
|
152
|
+
* @param {string} channelId channel id of the channel
|
|
153
|
+
* @param {boolean} isHard is Hard delete
|
|
154
|
+
* @returns {Promise<boolean>} promise of the result to delete channel
|
|
155
|
+
*/
|
|
156
|
+
deleteChannel(channelId, isHard = false) {
|
|
157
|
+
const _super = Object.create(null, {
|
|
158
|
+
getChannelById: { get: () => super.getChannelById }
|
|
159
|
+
});
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
//Retrieve the channel
|
|
162
|
+
const rChannel = yield _super.getChannelById.call(this, channelId);
|
|
163
|
+
if (rChannel && rChannel.length > 0) {
|
|
164
|
+
//get the channel from the response
|
|
165
|
+
const channel = rChannel[0];
|
|
166
|
+
let destroy = null;
|
|
167
|
+
//define if is a hard delete request
|
|
168
|
+
if (isHard) {
|
|
169
|
+
// server-side delete hard
|
|
170
|
+
destroy = yield channel.delete();
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
destroy = yield this.updateChannel({ channelId: channelId, frozen: true, disabled: true });
|
|
174
|
+
}
|
|
175
|
+
//Check the response
|
|
176
|
+
if (!destroy.channel) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Accept invited channel
|
|
188
|
+
*
|
|
189
|
+
* @param {string} channelId channel id of the channel
|
|
190
|
+
* @param {string} userId user id from stream
|
|
191
|
+
* @returns {boolean} true / false
|
|
192
|
+
*/
|
|
193
|
+
acceptInvite(channelId, userId) {
|
|
194
|
+
const _super = Object.create(null, {
|
|
195
|
+
getChannelById: { get: () => super.getChannelById }
|
|
196
|
+
});
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
let channelResponse;
|
|
199
|
+
//Retrieve the channel
|
|
200
|
+
const rChannel = yield _super.getChannelById.call(this, channelId);
|
|
201
|
+
if (rChannel && rChannel.length > 0) {
|
|
202
|
+
//get the channel from the response
|
|
203
|
+
const channel = rChannel[0];
|
|
204
|
+
//server-side accept invite
|
|
205
|
+
const r = yield channel.acceptInvite({ user_id: userId });
|
|
206
|
+
//Check the result
|
|
207
|
+
if (r) {
|
|
208
|
+
channelResponse = r;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return channelResponse;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Reject invited channel
|
|
216
|
+
*
|
|
217
|
+
* @param {string} channelId channel id of the channel
|
|
218
|
+
* @param {string} userId user id from stream
|
|
219
|
+
* @returns {boolean} true / false
|
|
220
|
+
*/
|
|
221
|
+
rejectInvite(channelId, userId) {
|
|
222
|
+
const _super = Object.create(null, {
|
|
223
|
+
getChannelById: { get: () => super.getChannelById }
|
|
224
|
+
});
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
let channelResponse;
|
|
227
|
+
//Retrieve the channel
|
|
228
|
+
const rChannel = yield _super.getChannelById.call(this, channelId);
|
|
229
|
+
if (rChannel && rChannel.length > 0) {
|
|
230
|
+
//get the channel from the response
|
|
231
|
+
const channel = rChannel[0];
|
|
232
|
+
//server-side accept invite
|
|
233
|
+
const r = yield channel.rejectInvite({ user_id: userId });
|
|
234
|
+
//Archive the channel if user reject invite
|
|
235
|
+
const ar = yield this.deleteChannel(channelId);
|
|
236
|
+
//Check the result
|
|
237
|
+
if (r && ar) {
|
|
238
|
+
channelResponse = r;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return channelResponse;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Sync a channel
|
|
246
|
+
*
|
|
247
|
+
* @param {IChannelData} data channel data
|
|
248
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
249
|
+
*/
|
|
250
|
+
syncChannel(data) {
|
|
251
|
+
const _super = Object.create(null, {
|
|
252
|
+
getChannelById: { get: () => super.getChannelById }
|
|
253
|
+
});
|
|
254
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
//Retrieve the channel
|
|
256
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
257
|
+
if (rChannel && rChannel.length > 0) {
|
|
258
|
+
//get the channel from the response
|
|
259
|
+
const channel = rChannel[0];
|
|
260
|
+
//Update the channel
|
|
261
|
+
const r = yield channel.update(data);
|
|
262
|
+
//Check the result
|
|
263
|
+
if (!r) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
exports.StreamChannel = StreamChannel;
|
|
275
|
+
//# sourceMappingURL=stream.channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.channel.js","sourceRoot":"","sources":["../../../chat/stream/stream.channel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,uCAA2C;AAE3C,+CAA2C;AA2C3C;;GAEG;AACH,MAAa,aAAc,SAAQ,wBAAU;IACzC,aAAa;IAEb;;;;;OAKG;IACH,YAAY,IAAgB,EAAE,MAAkB;QAC5C,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,CAAC;IACD,UAAU;IAEV;;;;;OAKG;IACG,MAAM,CAAC,IAAkB;;;;;YAC3B,OAAO,OAAM,MAAM;iBACd,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;gBAChC,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,aAAa,EAAE,IAAI,CAAC,WAAW;gBAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;gBAC3D,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;gBACjE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;aACjE,CAAC;iBACD,MAAM,EAAE,CAAC;QAClB,CAAC;KAAA;IAED;;;;;OAKG;IACG,UAAU,CAAC,IAAkB;;;;;YAC/B,sBAAsB;YACtB,MAAM,QAAQ,GAAG,MAAM,OAAM,cAAc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BAC/C,kBAAkB;gBAClB,IAAI,CAAC,IAAI,EAAE,EAAE;oBACT,eAAe,GAAG,CAAC,CAAC;iBACvB;aACJ;YACD,OAAO,eAAe,CAAC;QAC3B,CAAC;KAAA;IAED;;;;;OAKG;IACG,WAAW,CAAC,IAAkB;;;;;YAChC,sBAAsB;YACtB,MAAM,QAAQ,GAAG,MAAM,OAAM,cAAc,YAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5D,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACjC,mCAAmC;gBACnC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC5B,oBAAoB;gBACpB,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACrC,kBAAkB;gBAClB,IAAI,CAAC,CAAC,EAAE;oBACJ,OAAO,KAAK,CAAC;iBAChB;gBACD,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;CACJ;AAxND,sCAwNC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for API Error Responses
|
|
3
|
+
*/
|
|
4
|
+
interface IStreamErrorResponse {
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Stream Error Response implementation
|
|
9
|
+
*/
|
|
10
|
+
export declare class StreamErrorResponse implements IStreamErrorResponse {
|
|
11
|
+
message: string;
|
|
12
|
+
/**
|
|
13
|
+
* Stream Error Response constructor
|
|
14
|
+
*
|
|
15
|
+
* @param {string} msg error message
|
|
16
|
+
*/
|
|
17
|
+
constructor(msg: string);
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamErrorResponse = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Stream Error Response implementation
|
|
6
|
+
*/
|
|
7
|
+
class StreamErrorResponse {
|
|
8
|
+
/**
|
|
9
|
+
* Stream Error Response constructor
|
|
10
|
+
*
|
|
11
|
+
* @param {string} msg error message
|
|
12
|
+
*/
|
|
13
|
+
constructor(msg) {
|
|
14
|
+
this.message = msg;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.StreamErrorResponse = StreamErrorResponse;
|
|
18
|
+
//# sourceMappingURL=stream.error.js.map
|