@bwi-mentorspaces/application-utils-npm 0.0.5 → 0.0.7
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 -36
- package/chat/index.js +58 -58
- package/chat/stream/enum/index.d.ts +33 -27
- package/chat/stream/enum/index.js +41 -34
- package/chat/stream/enum/index.js.map +1 -1
- package/chat/stream/index.d.ts +9 -9
- package/chat/stream/index.js +17 -17
- package/chat/stream/models/_/channel.data.d.ts +19 -19
- package/chat/stream/models/_/channel.data.js +2 -2
- package/chat/stream/models/_/channel.member.d.ts +14 -14
- package/chat/stream/models/_/channel.member.js +11 -11
- package/chat/stream/models/_/channel.response.d.ts +8 -8
- package/chat/stream/models/_/channel.response.js +2 -2
- package/chat/stream/models/_/event.data.d.ts +16 -0
- package/chat/stream/models/_/event.data.js +4 -0
- package/chat/stream/models/_/event.data.js.map +1 -0
- package/chat/stream/models/_/message.response.d.ts +8 -8
- package/chat/stream/models/_/message.response.js +2 -2
- package/chat/stream/models/_/stream.config.d.ts +22 -22
- package/chat/stream/models/_/stream.config.js +2 -2
- package/chat/stream/models/_/user.response.d.ts +8 -8
- package/chat/stream/models/_/user.response.js +2 -2
- package/chat/stream/models/index.d.ts +9 -7
- package/chat/stream/models/index.js +5 -5
- package/chat/stream/models/index.js.map +1 -1
- package/chat/stream/stream.api.d.ts +63 -63
- package/chat/stream/stream.api.js +76 -76
- package/chat/stream/stream.auth.d.ts +70 -70
- package/chat/stream/stream.auth.js +80 -80
- package/chat/stream/stream.base.d.ts +56 -56
- package/chat/stream/stream.base.js +93 -93
- package/chat/stream/stream.channel.d.ts +132 -118
- package/chat/stream/stream.channel.js +306 -285
- package/chat/stream/stream.channel.js.map +1 -1
- package/chat/stream/stream.error.d.ts +19 -19
- package/chat/stream/stream.error.js +17 -17
- package/chat/stream/stream.member.d.ts +75 -75
- package/chat/stream/stream.member.js +175 -175
- package/chat/stream/stream.message.d.ts +59 -59
- package/chat/stream/stream.message.js +112 -112
- package/chat/stream/stream.user.d.ts +49 -49
- package/chat/stream/stream.user.js +90 -90
- package/core/_/api-error.d.ts +24 -24
- package/core/_/api-error.js +21 -21
- package/core/_/api-response.d.ts +25 -25
- package/core/_/api-response.js +21 -21
- package/core/_/cors-headers.d.ts +16 -16
- package/core/_/cors-headers.js +32 -32
- package/core/_/model.d.ts +39 -31
- package/core/_/model.js +2 -2
- package/core/_/service-request.d.ts +66 -66
- package/core/_/service-request.js +104 -104
- package/core/_/service-request.js.map +1 -1
- package/core/index.d.ts +10 -10
- package/core/index.js +11 -11
- package/deployment/_/serverless.d.ts +26 -26
- package/deployment/_/serverless.js +43 -43
- package/deployment/index.d.ts +2 -2
- package/deployment/index.js +5 -5
- package/endpoint-test-factory/_/test-factory.d.ts +45 -45
- package/endpoint-test-factory/_/test-factory.js +91 -91
- package/endpoint-test-factory/index.d.ts +2 -2
- package/endpoint-test-factory/index.js +5 -5
- package/enums/index.d.ts +92 -92
- package/enums/index.js +2 -2
- package/meet/index.d.ts +36 -36
- package/meet/index.js +58 -58
- package/meet/twilio/enum/index.d.ts +6 -6
- package/meet/twilio/enum/index.js +10 -10
- package/meet/twilio/index.d.ts +5 -5
- package/meet/twilio/index.js +11 -11
- package/meet/twilio/models/_/room.data.d.ts +6 -6
- package/meet/twilio/models/_/room.data.js +2 -2
- package/meet/twilio/models/_/twilio.config.d.ts +29 -29
- package/meet/twilio/models/_/twilio.config.js +2 -2
- package/meet/twilio/models/index.d.ts +3 -3
- package/meet/twilio/models/index.js +2 -2
- package/meet/twilio/twilio.api.d.ts +28 -28
- package/meet/twilio/twilio.api.js +45 -45
- package/meet/twilio/twilio.auth.d.ts +55 -55
- package/meet/twilio/twilio.auth.js +83 -83
- package/meet/twilio/twilio.base.d.ts +41 -41
- package/meet/twilio/twilio.base.js +53 -53
- package/meet/twilio/twilio.room.d.ts +46 -46
- package/meet/twilio/twilio.room.js +124 -124
- package/package.json +57 -57
- package/swagger/_/swagger.config.d.ts +21 -21
- package/swagger/_/swagger.config.js +2 -2
- package/swagger/_/swagger.d.ts +37 -37
- package/swagger/_/swagger.js +78 -78
- package/swagger/index.d.ts +3 -3
- package/swagger/index.js +5 -5
- package/types/index.d.ts +19 -19
- package/types/index.js +2 -2
- package/utils/_/encoder.d.ts +19 -19
- package/utils/_/encoder.js +27 -27
- package/utils/_/encryptor.d.ts +26 -26
- package/utils/_/encryptor.js +67 -67
- package/utils/_/hasher.d.ts +25 -25
- package/utils/_/hasher.js +63 -63
- package/utils/_/object-mapper.d.ts +12 -12
- package/utils/_/object-mapper.js +22 -22
- package/utils/_/string-formatter.d.ts +34 -34
- package/utils/_/string-formatter.js +49 -49
- package/utils/_/utc-date.d.ts +35 -35
- package/utils/_/utc-date.js +84 -84
- package/utils/index.d.ts +7 -7
- package/utils/index.js +15 -15
- package/validators/_/checker.d.ts +62 -62
- package/validators/_/checker.js +98 -98
- package/validators/_/regex.d.ts +98 -98
- package/validators/_/regex.js +142 -142
- package/validators/_/regex.js.map +1 -1
- package/validators/index.d.ts +3 -3
- package/validators/index.js +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** Twilio Room data*/
|
|
2
|
-
export interface IRoomData {
|
|
3
|
-
sid: string;
|
|
4
|
-
exist: boolean;
|
|
5
|
-
status: string;
|
|
6
|
-
}
|
|
1
|
+
/** Twilio Room data*/
|
|
2
|
+
export interface IRoomData {
|
|
3
|
+
sid: string;
|
|
4
|
+
exist: boolean;
|
|
5
|
+
status: string;
|
|
6
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=room.data.js.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Twilio Configuration declaration
|
|
3
|
-
*/
|
|
4
|
-
export interface IMeetConfig {
|
|
5
|
-
account: {
|
|
6
|
-
main: {
|
|
7
|
-
sid: string;
|
|
8
|
-
api: {
|
|
9
|
-
key: string;
|
|
10
|
-
secret: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
sub: {
|
|
14
|
-
sid: string;
|
|
15
|
-
api: {
|
|
16
|
-
secret: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
options: ITwilioConfig;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Twilio config / type = option
|
|
24
|
-
*/
|
|
25
|
-
export interface ITwilioConfig {
|
|
26
|
-
room: {
|
|
27
|
-
expiration: number;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Twilio Configuration declaration
|
|
3
|
+
*/
|
|
4
|
+
export interface IMeetConfig {
|
|
5
|
+
account: {
|
|
6
|
+
main: {
|
|
7
|
+
sid: string;
|
|
8
|
+
api: {
|
|
9
|
+
key: string;
|
|
10
|
+
secret: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
sub: {
|
|
14
|
+
sid: string;
|
|
15
|
+
api: {
|
|
16
|
+
secret: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
options: ITwilioConfig;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Twilio config / type = option
|
|
24
|
+
*/
|
|
25
|
+
export interface ITwilioConfig {
|
|
26
|
+
room: {
|
|
27
|
+
expiration: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=twilio.config.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IRoomData } from "./_/room.data";
|
|
2
|
-
import { IMeetConfig, ITwilioConfig } from "./_/twilio.config";
|
|
3
|
-
export { IMeetConfig, ITwilioConfig, IRoomData };
|
|
1
|
+
import { IRoomData } from "./_/room.data";
|
|
2
|
+
import { IMeetConfig, ITwilioConfig } from "./_/twilio.config";
|
|
3
|
+
export { IMeetConfig, ITwilioConfig, IRoomData };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { IMeetConfig } from "./models/_/twilio.config";
|
|
2
|
-
import { TwilioBase } from "./twilio.base";
|
|
3
|
-
import { TwilioRoom } from "./twilio.room";
|
|
4
|
-
/**
|
|
5
|
-
* Twilio implementation
|
|
6
|
-
*/
|
|
7
|
-
export declare class TwilioApi extends TwilioBase {
|
|
8
|
-
private _config;
|
|
9
|
-
private _twilioRoom;
|
|
10
|
-
/**
|
|
11
|
-
* Twilio api constructor
|
|
12
|
-
*
|
|
13
|
-
* @param {IApiConfig} config api configuration
|
|
14
|
-
*/
|
|
15
|
-
constructor(config: IMeetConfig);
|
|
16
|
-
/**
|
|
17
|
-
* getter for Twilio API Room
|
|
18
|
-
*
|
|
19
|
-
* @returns {TwilioRoom} twilio room instance
|
|
20
|
-
*/
|
|
21
|
-
get twilioRoom(): TwilioRoom;
|
|
22
|
-
/**
|
|
23
|
-
* initialize method
|
|
24
|
-
*
|
|
25
|
-
* @returns {void} promise of type void
|
|
26
|
-
*/
|
|
27
|
-
private init;
|
|
28
|
-
}
|
|
1
|
+
import { IMeetConfig } from "./models/_/twilio.config";
|
|
2
|
+
import { TwilioBase } from "./twilio.base";
|
|
3
|
+
import { TwilioRoom } from "./twilio.room";
|
|
4
|
+
/**
|
|
5
|
+
* Twilio implementation
|
|
6
|
+
*/
|
|
7
|
+
export declare class TwilioApi extends TwilioBase {
|
|
8
|
+
private _config;
|
|
9
|
+
private _twilioRoom;
|
|
10
|
+
/**
|
|
11
|
+
* Twilio api constructor
|
|
12
|
+
*
|
|
13
|
+
* @param {IApiConfig} config api configuration
|
|
14
|
+
*/
|
|
15
|
+
constructor(config: IMeetConfig);
|
|
16
|
+
/**
|
|
17
|
+
* getter for Twilio API Room
|
|
18
|
+
*
|
|
19
|
+
* @returns {TwilioRoom} twilio room instance
|
|
20
|
+
*/
|
|
21
|
+
get twilioRoom(): TwilioRoom;
|
|
22
|
+
/**
|
|
23
|
+
* initialize method
|
|
24
|
+
*
|
|
25
|
+
* @returns {void} promise of type void
|
|
26
|
+
*/
|
|
27
|
+
private init;
|
|
28
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TwilioApi = void 0;
|
|
4
|
-
const twilio_auth_1 = require("./twilio.auth");
|
|
5
|
-
const twilio_base_1 = require("./twilio.base");
|
|
6
|
-
const twilio_1 = require("twilio");
|
|
7
|
-
const twilio_room_1 = require("./twilio.room");
|
|
8
|
-
/**
|
|
9
|
-
* Twilio implementation
|
|
10
|
-
*/
|
|
11
|
-
class TwilioApi extends twilio_base_1.TwilioBase {
|
|
12
|
-
/**
|
|
13
|
-
* Twilio api constructor
|
|
14
|
-
*
|
|
15
|
-
* @param {IApiConfig} config api configuration
|
|
16
|
-
*/
|
|
17
|
-
constructor(config) {
|
|
18
|
-
super();
|
|
19
|
-
this._config = config;
|
|
20
|
-
this.init();
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* getter for Twilio API Room
|
|
24
|
-
*
|
|
25
|
-
* @returns {TwilioRoom} twilio room instance
|
|
26
|
-
*/
|
|
27
|
-
get twilioRoom() {
|
|
28
|
-
return this._twilioRoom;
|
|
29
|
-
}
|
|
30
|
-
//methods
|
|
31
|
-
/**
|
|
32
|
-
* initialize method
|
|
33
|
-
*
|
|
34
|
-
* @returns {void} promise of type void
|
|
35
|
-
*/
|
|
36
|
-
init() {
|
|
37
|
-
// instance the client
|
|
38
|
-
super.server = new twilio_1.Twilio(this._config.account.sub.sid, this._config.account.sub.api.secret);
|
|
39
|
-
super.auth = new twilio_auth_1.TwilioAuth(this._config);
|
|
40
|
-
// create instances of all sub-api classes
|
|
41
|
-
this._twilioRoom = new twilio_room_1.TwilioRoom(super.auth, super.server, this._config.options.room.expiration);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.TwilioApi = TwilioApi;
|
|
45
|
-
module.exports = { TwilioApi };
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TwilioApi = void 0;
|
|
4
|
+
const twilio_auth_1 = require("./twilio.auth");
|
|
5
|
+
const twilio_base_1 = require("./twilio.base");
|
|
6
|
+
const twilio_1 = require("twilio");
|
|
7
|
+
const twilio_room_1 = require("./twilio.room");
|
|
8
|
+
/**
|
|
9
|
+
* Twilio implementation
|
|
10
|
+
*/
|
|
11
|
+
class TwilioApi extends twilio_base_1.TwilioBase {
|
|
12
|
+
/**
|
|
13
|
+
* Twilio api constructor
|
|
14
|
+
*
|
|
15
|
+
* @param {IApiConfig} config api configuration
|
|
16
|
+
*/
|
|
17
|
+
constructor(config) {
|
|
18
|
+
super();
|
|
19
|
+
this._config = config;
|
|
20
|
+
this.init();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* getter for Twilio API Room
|
|
24
|
+
*
|
|
25
|
+
* @returns {TwilioRoom} twilio room instance
|
|
26
|
+
*/
|
|
27
|
+
get twilioRoom() {
|
|
28
|
+
return this._twilioRoom;
|
|
29
|
+
}
|
|
30
|
+
//methods
|
|
31
|
+
/**
|
|
32
|
+
* initialize method
|
|
33
|
+
*
|
|
34
|
+
* @returns {void} promise of type void
|
|
35
|
+
*/
|
|
36
|
+
init() {
|
|
37
|
+
// instance the client
|
|
38
|
+
super.server = new twilio_1.Twilio(this._config.account.sub.sid, this._config.account.sub.api.secret);
|
|
39
|
+
super.auth = new twilio_auth_1.TwilioAuth(this._config);
|
|
40
|
+
// create instances of all sub-api classes
|
|
41
|
+
this._twilioRoom = new twilio_room_1.TwilioRoom(super.auth, super.server, this._config.options.room.expiration);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.TwilioApi = TwilioApi;
|
|
45
|
+
module.exports = { TwilioApi };
|
|
46
46
|
//# sourceMappingURL=twilio.api.js.map
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { IMeetConfig } from "./models";
|
|
2
|
-
/**
|
|
3
|
-
* Twilio Auth middleware
|
|
4
|
-
*/
|
|
5
|
-
interface ITwilioAuth {
|
|
6
|
-
/**
|
|
7
|
-
* Authentication initialization
|
|
8
|
-
*
|
|
9
|
-
* @param {string} apiSID api sid
|
|
10
|
-
* @param {string} apiKey api key
|
|
11
|
-
* @param {string} apiSecret apy secret
|
|
12
|
-
*/
|
|
13
|
-
init(apiSID: string, apiKey: string, apiSecret: string): void;
|
|
14
|
-
/**
|
|
15
|
-
* Get token to connect with Twilio
|
|
16
|
-
*
|
|
17
|
-
* @param {string} userId user id
|
|
18
|
-
* @param {string} roomSID room sid
|
|
19
|
-
* @param {boolean} refresh refresh token
|
|
20
|
-
* @returns {string} stream token string
|
|
21
|
-
*/
|
|
22
|
-
token(userId: string, roomSID: string, refresh?: boolean): string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Meet Auth implementation
|
|
26
|
-
*/
|
|
27
|
-
export declare class TwilioAuth implements ITwilioAuth {
|
|
28
|
-
private _mainAccountSID;
|
|
29
|
-
private _mainApiKeySID;
|
|
30
|
-
private _mainApiKeySecret;
|
|
31
|
-
/**
|
|
32
|
-
* Twilio auth constructor
|
|
33
|
-
*
|
|
34
|
-
* @param {IMeetConfig} config meet config
|
|
35
|
-
*/
|
|
36
|
-
constructor(config: IMeetConfig);
|
|
37
|
-
/**
|
|
38
|
-
* Instance the twilio client
|
|
39
|
-
*
|
|
40
|
-
* @param {string} mainAccountSID main account SID
|
|
41
|
-
* @param {string} mainApiKeySID main api SID
|
|
42
|
-
* @param {string} mainApiKeySecret main apy secret
|
|
43
|
-
* @returns {void} promise of type void
|
|
44
|
-
*/
|
|
45
|
-
init(mainAccountSID: string, mainApiKeySID: string, mainApiKeySecret: string): void;
|
|
46
|
-
/**
|
|
47
|
-
* Get token
|
|
48
|
-
*
|
|
49
|
-
* @param {string} userId user id
|
|
50
|
-
* @param {string} roomName room name
|
|
51
|
-
* @returns {string} returns token value
|
|
52
|
-
*/
|
|
53
|
-
token(userId: string, roomName: string): string;
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
1
|
+
import { IMeetConfig } from "./models";
|
|
2
|
+
/**
|
|
3
|
+
* Twilio Auth middleware
|
|
4
|
+
*/
|
|
5
|
+
interface ITwilioAuth {
|
|
6
|
+
/**
|
|
7
|
+
* Authentication initialization
|
|
8
|
+
*
|
|
9
|
+
* @param {string} apiSID api sid
|
|
10
|
+
* @param {string} apiKey api key
|
|
11
|
+
* @param {string} apiSecret apy secret
|
|
12
|
+
*/
|
|
13
|
+
init(apiSID: string, apiKey: string, apiSecret: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get token to connect with Twilio
|
|
16
|
+
*
|
|
17
|
+
* @param {string} userId user id
|
|
18
|
+
* @param {string} roomSID room sid
|
|
19
|
+
* @param {boolean} refresh refresh token
|
|
20
|
+
* @returns {string} stream token string
|
|
21
|
+
*/
|
|
22
|
+
token(userId: string, roomSID: string, refresh?: boolean): string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Meet Auth implementation
|
|
26
|
+
*/
|
|
27
|
+
export declare class TwilioAuth implements ITwilioAuth {
|
|
28
|
+
private _mainAccountSID;
|
|
29
|
+
private _mainApiKeySID;
|
|
30
|
+
private _mainApiKeySecret;
|
|
31
|
+
/**
|
|
32
|
+
* Twilio auth constructor
|
|
33
|
+
*
|
|
34
|
+
* @param {IMeetConfig} config meet config
|
|
35
|
+
*/
|
|
36
|
+
constructor(config: IMeetConfig);
|
|
37
|
+
/**
|
|
38
|
+
* Instance the twilio client
|
|
39
|
+
*
|
|
40
|
+
* @param {string} mainAccountSID main account SID
|
|
41
|
+
* @param {string} mainApiKeySID main api SID
|
|
42
|
+
* @param {string} mainApiKeySecret main apy secret
|
|
43
|
+
* @returns {void} promise of type void
|
|
44
|
+
*/
|
|
45
|
+
init(mainAccountSID: string, mainApiKeySID: string, mainApiKeySecret: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Get token
|
|
48
|
+
*
|
|
49
|
+
* @param {string} userId user id
|
|
50
|
+
* @param {string} roomName room name
|
|
51
|
+
* @returns {string} returns token value
|
|
52
|
+
*/
|
|
53
|
+
token(userId: string, roomName: string): string;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
-
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;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
};
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
-
if (mod && mod.__esModule) return mod;
|
|
22
|
-
var result = {};
|
|
23
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
-
__setModuleDefault(result, mod);
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
28
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.TwilioAuth = void 0;
|
|
32
|
-
const tsyringe_1 = require("tsyringe");
|
|
33
|
-
const AccessToken_1 = __importStar(require("twilio/lib/jwt/AccessToken"));
|
|
34
|
-
/**
|
|
35
|
-
* Meet Auth implementation
|
|
36
|
-
*/
|
|
37
|
-
let TwilioAuth = class TwilioAuth {
|
|
38
|
-
/**
|
|
39
|
-
* Twilio auth constructor
|
|
40
|
-
*
|
|
41
|
-
* @param {IMeetConfig} config meet config
|
|
42
|
-
*/
|
|
43
|
-
constructor(config) {
|
|
44
|
-
this.init(config.account.main.sid, config.account.main.api.key, config.account.main.api.secret);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Instance the twilio client
|
|
48
|
-
*
|
|
49
|
-
* @param {string} mainAccountSID main account SID
|
|
50
|
-
* @param {string} mainApiKeySID main api SID
|
|
51
|
-
* @param {string} mainApiKeySecret main apy secret
|
|
52
|
-
* @returns {void} promise of type void
|
|
53
|
-
*/
|
|
54
|
-
init(mainAccountSID, mainApiKeySID, mainApiKeySecret) {
|
|
55
|
-
this._mainAccountSID = mainAccountSID;
|
|
56
|
-
this._mainApiKeySID = mainApiKeySID;
|
|
57
|
-
this._mainApiKeySecret = mainApiKeySecret;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Get token
|
|
61
|
-
*
|
|
62
|
-
* @param {string} userId user id
|
|
63
|
-
* @param {string} roomName room name
|
|
64
|
-
* @returns {string} returns token value
|
|
65
|
-
*/
|
|
66
|
-
token(userId, roomName) {
|
|
67
|
-
//Instance the AccessToken token
|
|
68
|
-
const token = new AccessToken_1.default(this._mainAccountSID, this._mainApiKeySID, this._mainApiKeySecret);
|
|
69
|
-
// Assign identity to the token
|
|
70
|
-
token.identity = userId;
|
|
71
|
-
// Grant the access token Twilio Video capabilities
|
|
72
|
-
const grant = new AccessToken_1.VideoGrant();
|
|
73
|
-
grant.room = roomName;
|
|
74
|
-
token.addGrant(grant);
|
|
75
|
-
// Serialize the token to a JWT string
|
|
76
|
-
return token.toJwt();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
TwilioAuth = __decorate([
|
|
80
|
-
(0, tsyringe_1.injectable)(),
|
|
81
|
-
__metadata("design:paramtypes", [Object])
|
|
82
|
-
], TwilioAuth);
|
|
83
|
-
exports.TwilioAuth = TwilioAuth;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
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;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.TwilioAuth = void 0;
|
|
32
|
+
const tsyringe_1 = require("tsyringe");
|
|
33
|
+
const AccessToken_1 = __importStar(require("twilio/lib/jwt/AccessToken"));
|
|
34
|
+
/**
|
|
35
|
+
* Meet Auth implementation
|
|
36
|
+
*/
|
|
37
|
+
let TwilioAuth = class TwilioAuth {
|
|
38
|
+
/**
|
|
39
|
+
* Twilio auth constructor
|
|
40
|
+
*
|
|
41
|
+
* @param {IMeetConfig} config meet config
|
|
42
|
+
*/
|
|
43
|
+
constructor(config) {
|
|
44
|
+
this.init(config.account.main.sid, config.account.main.api.key, config.account.main.api.secret);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Instance the twilio client
|
|
48
|
+
*
|
|
49
|
+
* @param {string} mainAccountSID main account SID
|
|
50
|
+
* @param {string} mainApiKeySID main api SID
|
|
51
|
+
* @param {string} mainApiKeySecret main apy secret
|
|
52
|
+
* @returns {void} promise of type void
|
|
53
|
+
*/
|
|
54
|
+
init(mainAccountSID, mainApiKeySID, mainApiKeySecret) {
|
|
55
|
+
this._mainAccountSID = mainAccountSID;
|
|
56
|
+
this._mainApiKeySID = mainApiKeySID;
|
|
57
|
+
this._mainApiKeySecret = mainApiKeySecret;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get token
|
|
61
|
+
*
|
|
62
|
+
* @param {string} userId user id
|
|
63
|
+
* @param {string} roomName room name
|
|
64
|
+
* @returns {string} returns token value
|
|
65
|
+
*/
|
|
66
|
+
token(userId, roomName) {
|
|
67
|
+
//Instance the AccessToken token
|
|
68
|
+
const token = new AccessToken_1.default(this._mainAccountSID, this._mainApiKeySID, this._mainApiKeySecret);
|
|
69
|
+
// Assign identity to the token
|
|
70
|
+
token.identity = userId;
|
|
71
|
+
// Grant the access token Twilio Video capabilities
|
|
72
|
+
const grant = new AccessToken_1.VideoGrant();
|
|
73
|
+
grant.room = roomName;
|
|
74
|
+
token.addGrant(grant);
|
|
75
|
+
// Serialize the token to a JWT string
|
|
76
|
+
return token.toJwt();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
TwilioAuth = __decorate([
|
|
80
|
+
(0, tsyringe_1.injectable)(),
|
|
81
|
+
__metadata("design:paramtypes", [Object])
|
|
82
|
+
], TwilioAuth);
|
|
83
|
+
exports.TwilioAuth = TwilioAuth;
|
|
84
84
|
//# sourceMappingURL=twilio.auth.js.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { TwilioAuth } from "./twilio.auth";
|
|
2
|
-
import { Twilio } from "twilio";
|
|
3
|
-
/**
|
|
4
|
-
* Base client class
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class TwilioBase {
|
|
7
|
-
private _server;
|
|
8
|
-
private _auth;
|
|
9
|
-
/**
|
|
10
|
-
* getter for twilio instance
|
|
11
|
-
*
|
|
12
|
-
* @returns {Twilio} twilio instance
|
|
13
|
-
*/
|
|
14
|
-
get server(): Twilio;
|
|
15
|
-
/**
|
|
16
|
-
* setter for twilio instance
|
|
17
|
-
*
|
|
18
|
-
* @param {TwilioAuth} value twilio instance
|
|
19
|
-
*/
|
|
20
|
-
set server(value: Twilio);
|
|
21
|
-
/**
|
|
22
|
-
* getter for twilio auth
|
|
23
|
-
*
|
|
24
|
-
* @returns {TwilioAuth} twilio auth instance
|
|
25
|
-
*/
|
|
26
|
-
get auth(): TwilioAuth;
|
|
27
|
-
/**
|
|
28
|
-
* setter for twilio auth instance
|
|
29
|
-
*
|
|
30
|
-
* @param {TwilioAuth} value twilio auth instance
|
|
31
|
-
*/
|
|
32
|
-
set auth(value: TwilioAuth);
|
|
33
|
-
/**
|
|
34
|
-
* Get token for extended classes
|
|
35
|
-
*
|
|
36
|
-
* @param {string} userId user id
|
|
37
|
-
* @param {string} roomName room name
|
|
38
|
-
* @returns {string} returns the token value
|
|
39
|
-
*/
|
|
40
|
-
getToken(userId: string, roomName: string): string;
|
|
41
|
-
}
|
|
1
|
+
import { TwilioAuth } from "./twilio.auth";
|
|
2
|
+
import { Twilio } from "twilio";
|
|
3
|
+
/**
|
|
4
|
+
* Base client class
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class TwilioBase {
|
|
7
|
+
private _server;
|
|
8
|
+
private _auth;
|
|
9
|
+
/**
|
|
10
|
+
* getter for twilio instance
|
|
11
|
+
*
|
|
12
|
+
* @returns {Twilio} twilio instance
|
|
13
|
+
*/
|
|
14
|
+
get server(): Twilio;
|
|
15
|
+
/**
|
|
16
|
+
* setter for twilio instance
|
|
17
|
+
*
|
|
18
|
+
* @param {TwilioAuth} value twilio instance
|
|
19
|
+
*/
|
|
20
|
+
set server(value: Twilio);
|
|
21
|
+
/**
|
|
22
|
+
* getter for twilio auth
|
|
23
|
+
*
|
|
24
|
+
* @returns {TwilioAuth} twilio auth instance
|
|
25
|
+
*/
|
|
26
|
+
get auth(): TwilioAuth;
|
|
27
|
+
/**
|
|
28
|
+
* setter for twilio auth instance
|
|
29
|
+
*
|
|
30
|
+
* @param {TwilioAuth} value twilio auth instance
|
|
31
|
+
*/
|
|
32
|
+
set auth(value: TwilioAuth);
|
|
33
|
+
/**
|
|
34
|
+
* Get token for extended classes
|
|
35
|
+
*
|
|
36
|
+
* @param {string} userId user id
|
|
37
|
+
* @param {string} roomName room name
|
|
38
|
+
* @returns {string} returns the token value
|
|
39
|
+
*/
|
|
40
|
+
getToken(userId: string, roomName: string): string;
|
|
41
|
+
}
|