@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.
Files changed (163) hide show
  1. package/chat/index.d.ts +36 -0
  2. package/chat/index.js +59 -0
  3. package/chat/index.js.map +1 -0
  4. package/chat/stream/enum/index.d.ts +27 -0
  5. package/chat/stream/enum/index.js +35 -0
  6. package/chat/stream/enum/index.js.map +1 -0
  7. package/chat/stream/index.d.ts +9 -0
  8. package/chat/stream/index.js +18 -0
  9. package/chat/stream/index.js.map +1 -0
  10. package/chat/stream/models/_/channel.data.d.ts +19 -0
  11. package/chat/stream/models/_/channel.data.js +3 -0
  12. package/chat/stream/models/_/channel.data.js.map +1 -0
  13. package/chat/stream/models/_/channel.member.d.ts +14 -0
  14. package/chat/stream/models/_/channel.member.js +12 -0
  15. package/chat/stream/models/_/channel.member.js.map +1 -0
  16. package/chat/stream/models/_/channel.response.d.ts +8 -0
  17. package/chat/stream/models/_/channel.response.js +3 -0
  18. package/chat/stream/models/_/channel.response.js.map +1 -0
  19. package/chat/stream/models/_/message.response.d.ts +8 -0
  20. package/chat/stream/models/_/message.response.js +3 -0
  21. package/chat/stream/models/_/message.response.js.map +1 -0
  22. package/chat/stream/models/_/stream.config.d.ts +22 -0
  23. package/chat/stream/models/_/stream.config.js +3 -0
  24. package/chat/stream/models/_/stream.config.js.map +1 -0
  25. package/chat/stream/models/_/user.response.d.ts +8 -0
  26. package/chat/stream/models/_/user.response.js +3 -0
  27. package/chat/stream/models/_/user.response.js.map +1 -0
  28. package/chat/stream/models/index.d.ts +7 -0
  29. package/chat/stream/models/index.js +6 -0
  30. package/chat/stream/models/index.js.map +1 -0
  31. package/chat/stream/stream.api.d.ts +63 -0
  32. package/chat/stream/stream.api.js +77 -0
  33. package/chat/stream/stream.api.js.map +1 -0
  34. package/chat/stream/stream.auth.d.ts +70 -0
  35. package/chat/stream/stream.auth.js +81 -0
  36. package/chat/stream/stream.auth.js.map +1 -0
  37. package/chat/stream/stream.base.d.ts +56 -0
  38. package/chat/stream/stream.base.js +94 -0
  39. package/chat/stream/stream.base.js.map +1 -0
  40. package/chat/stream/stream.channel.d.ts +118 -0
  41. package/chat/stream/stream.channel.js +275 -0
  42. package/chat/stream/stream.channel.js.map +1 -0
  43. package/chat/stream/stream.error.d.ts +19 -0
  44. package/chat/stream/stream.error.js +18 -0
  45. package/chat/stream/stream.error.js.map +1 -0
  46. package/chat/stream/stream.media.d.ts +0 -0
  47. package/chat/stream/stream.media.js +1 -0
  48. package/chat/stream/stream.media.js.map +1 -0
  49. package/chat/stream/stream.member.d.ts +75 -0
  50. package/chat/stream/stream.member.js +176 -0
  51. package/chat/stream/stream.member.js.map +1 -0
  52. package/chat/stream/stream.message.d.ts +59 -0
  53. package/chat/stream/stream.message.js +113 -0
  54. package/chat/stream/stream.message.js.map +1 -0
  55. package/chat/stream/stream.user.d.ts +49 -0
  56. package/chat/stream/stream.user.js +91 -0
  57. package/chat/stream/stream.user.js.map +1 -0
  58. package/core/_/api-error.d.ts +24 -0
  59. package/core/_/api-error.js +22 -0
  60. package/core/_/api-error.js.map +1 -0
  61. package/core/_/api-response.d.ts +25 -0
  62. package/core/_/api-response.js +22 -0
  63. package/core/_/api-response.js.map +1 -0
  64. package/core/_/cors-headers.d.ts +16 -0
  65. package/core/_/cors-headers.js +33 -0
  66. package/core/_/cors-headers.js.map +1 -0
  67. package/core/_/model.d.ts +31 -0
  68. package/core/_/model.js +3 -0
  69. package/core/_/model.js.map +1 -0
  70. package/core/_/service-request.d.ts +66 -0
  71. package/core/_/service-request.js +105 -0
  72. package/core/_/service-request.js.map +1 -0
  73. package/core/index.d.ts +10 -0
  74. package/core/index.js +12 -0
  75. package/core/index.js.map +1 -0
  76. package/deployment/_/serverless.d.ts +26 -0
  77. package/deployment/_/serverless.js +44 -0
  78. package/deployment/_/serverless.js.map +1 -0
  79. package/deployment/index.d.ts +2 -0
  80. package/deployment/index.js +6 -0
  81. package/deployment/index.js.map +1 -0
  82. package/endpoint-test-factory/_/test-factory.d.ts +45 -0
  83. package/endpoint-test-factory/_/test-factory.js +92 -0
  84. package/endpoint-test-factory/_/test-factory.js.map +1 -0
  85. package/endpoint-test-factory/index.d.ts +2 -0
  86. package/endpoint-test-factory/index.js +6 -0
  87. package/endpoint-test-factory/index.js.map +1 -0
  88. package/enums/index.d.ts +92 -0
  89. package/enums/index.js +3 -0
  90. package/enums/index.js.map +1 -0
  91. package/meet/index.d.ts +36 -0
  92. package/meet/index.js +59 -0
  93. package/meet/index.js.map +1 -0
  94. package/meet/twilio/enum/index.d.ts +6 -0
  95. package/meet/twilio/enum/index.js +11 -0
  96. package/meet/twilio/enum/index.js.map +1 -0
  97. package/meet/twilio/index.d.ts +5 -0
  98. package/meet/twilio/index.js +12 -0
  99. package/meet/twilio/index.js.map +1 -0
  100. package/meet/twilio/models/_/room.data.d.ts +6 -0
  101. package/meet/twilio/models/_/room.data.js +3 -0
  102. package/meet/twilio/models/_/room.data.js.map +1 -0
  103. package/meet/twilio/models/_/twilio.config.d.ts +29 -0
  104. package/meet/twilio/models/_/twilio.config.js +3 -0
  105. package/meet/twilio/models/_/twilio.config.js.map +1 -0
  106. package/meet/twilio/models/index.d.ts +3 -0
  107. package/meet/twilio/models/index.js +3 -0
  108. package/meet/twilio/models/index.js.map +1 -0
  109. package/meet/twilio/twilio.api.d.ts +28 -0
  110. package/meet/twilio/twilio.api.js +46 -0
  111. package/meet/twilio/twilio.api.js.map +1 -0
  112. package/meet/twilio/twilio.auth.d.ts +55 -0
  113. package/meet/twilio/twilio.auth.js +84 -0
  114. package/meet/twilio/twilio.auth.js.map +1 -0
  115. package/meet/twilio/twilio.base.d.ts +41 -0
  116. package/meet/twilio/twilio.base.js +54 -0
  117. package/meet/twilio/twilio.base.js.map +1 -0
  118. package/meet/twilio/twilio.room.d.ts +46 -0
  119. package/meet/twilio/twilio.room.js +125 -0
  120. package/meet/twilio/twilio.room.js.map +1 -0
  121. package/package.json +57 -0
  122. package/swagger/_/swagger.config.d.ts +21 -0
  123. package/swagger/_/swagger.config.js +3 -0
  124. package/swagger/_/swagger.config.js.map +1 -0
  125. package/swagger/_/swagger.d.ts +37 -0
  126. package/swagger/_/swagger.js +79 -0
  127. package/swagger/_/swagger.js.map +1 -0
  128. package/swagger/index.d.ts +3 -0
  129. package/swagger/index.js +6 -0
  130. package/swagger/index.js.map +1 -0
  131. package/types/index.d.ts +19 -0
  132. package/types/index.js +3 -0
  133. package/types/index.js.map +1 -0
  134. package/utils/_/encoder.d.ts +19 -0
  135. package/utils/_/encoder.js +28 -0
  136. package/utils/_/encoder.js.map +1 -0
  137. package/utils/_/encryptor.d.ts +26 -0
  138. package/utils/_/encryptor.js +68 -0
  139. package/utils/_/encryptor.js.map +1 -0
  140. package/utils/_/hasher.d.ts +25 -0
  141. package/utils/_/hasher.js +64 -0
  142. package/utils/_/hasher.js.map +1 -0
  143. package/utils/_/object-mapper.d.ts +12 -0
  144. package/utils/_/object-mapper.js +23 -0
  145. package/utils/_/object-mapper.js.map +1 -0
  146. package/utils/_/string-formatter.d.ts +34 -0
  147. package/utils/_/string-formatter.js +50 -0
  148. package/utils/_/string-formatter.js.map +1 -0
  149. package/utils/_/utc-date.d.ts +35 -0
  150. package/utils/_/utc-date.js +85 -0
  151. package/utils/_/utc-date.js.map +1 -0
  152. package/utils/index.d.ts +7 -0
  153. package/utils/index.js +16 -0
  154. package/utils/index.js.map +1 -0
  155. package/validators/_/checker.d.ts +62 -0
  156. package/validators/_/checker.js +99 -0
  157. package/validators/_/checker.js.map +1 -0
  158. package/validators/_/regex.d.ts +98 -0
  159. package/validators/_/regex.js +143 -0
  160. package/validators/_/regex.js.map +1 -0
  161. package/validators/index.d.ts +3 -0
  162. package/validators/index.js +8 -0
  163. package/validators/index.js.map +1 -0
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Encryption Type enum
3
+ */
4
+ export declare const enum EncryptionType {
5
+ AES = 0
6
+ }
7
+ /**
8
+ * Type of request method
9
+ */
10
+ export declare const enum Method {
11
+ GET = "GET",
12
+ POST = "POST",
13
+ PUT = "PUT",
14
+ PATCH = "PATCH",
15
+ DELETE = "DELETE",
16
+ OPTIONS = "OPTIONS"
17
+ }
18
+ /**
19
+ * Type for MimeTypes
20
+ */
21
+ export declare const enum MimeType {
22
+ ApplicationJson = "application/json"
23
+ }
24
+ /**
25
+ * Type of Req/Res Header Names
26
+ */
27
+ export declare const enum Header {
28
+ Authorization = "Authorization",
29
+ Accept = "Accept",
30
+ AcceptCharset = "Accept-Charset",
31
+ AcceptEncoding = "Accept-Encoding",
32
+ ContentType = "Content-Type",
33
+ Cookie = "Cookie",
34
+ AccessControlAllowOrigin = "Access-Control-Allow-Origin",
35
+ AccessControlAllowMethods = "Access-Control-Allow-Methods",
36
+ AccessControlAllowHeaders = "Access-Control-Allow-Headers",
37
+ XAmzDate = "X-Amz-Date",
38
+ XAmzSecurityToken = "X-Amz-Security-Token",
39
+ XApiKey = "X-Api-Key",
40
+ Metadata = "Metadata"
41
+ }
42
+ /**
43
+ * Enum type for Http Status code
44
+ */
45
+ export declare const enum Status {
46
+ OK = 200,
47
+ BadRequest = 400,
48
+ Unauthorized = 401,
49
+ Forbidden = 403,
50
+ NotFound = 404,
51
+ MethodNotAllowed = 405,
52
+ Conflict = 409,
53
+ InternalServerError = 500,
54
+ NotImplemented = 501,
55
+ ServiceUnavailable = 503
56
+ }
57
+ /**
58
+ * Type of friendly Messages to display on UI
59
+ */
60
+ export declare const enum Message {
61
+ InvalidData = "Invalid data.",
62
+ Failure = "A failure occurred.",
63
+ Conflict = "A conflict occurred.",
64
+ InternalServerError = "An Internal Service Error occurred.",
65
+ MissingApiKeyHeader = "Missing Api Key header.",
66
+ MissingAuthorizationHeader = "Missing Authorization header.",
67
+ MissingMetadataHeader = "Missing Metadata header.",
68
+ Forbidden = "Access forbidden!",
69
+ Unauthorized = "You're not authorized!",
70
+ ExpiredToken = "Token Expired.",
71
+ InvalidToken = "Invalid Token.",
72
+ ExistingUser = "User already exists."
73
+ }
74
+ /**
75
+ * Routing options
76
+ */
77
+ export declare const enum RouteOption {
78
+ Filter = "filter"
79
+ }
80
+ /**
81
+ * Interval time
82
+ */
83
+ export declare const enum Interval {
84
+ Year = "year",
85
+ Quarter = "quarter",
86
+ Month = "month",
87
+ Week = "week",
88
+ Day = "day",
89
+ Hour = "hour",
90
+ Minute = "minute",
91
+ Second = "second"
92
+ }
package/enums/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../enums/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ import { ClientType } from "./twilio/enum";
2
+ import { IMeetConfig } from "./twilio/models/_/twilio.config";
3
+ /**
4
+ * Meet declarations
5
+ */
6
+ interface IMeet<T> {
7
+ client: T;
8
+ }
9
+ /**
10
+ * Meet implementation
11
+ */
12
+ export declare class Meet<T> implements IMeet<T> {
13
+ private _client;
14
+ private _config;
15
+ private _clientType;
16
+ /**
17
+ * Meet constructor
18
+ *
19
+ * @param {ClientType} clientType client type
20
+ * @param {IMeetConfig} config meet configuration
21
+ */
22
+ constructor(clientType: ClientType, config: IMeetConfig);
23
+ /**
24
+ * getter for client
25
+ *
26
+ * @returns {T} client of type T
27
+ */
28
+ get client(): T;
29
+ /**
30
+ * initialize method
31
+ *
32
+ * @returns {void} promise of type void
33
+ */
34
+ private init;
35
+ }
36
+ export {};
package/meet/index.js ADDED
@@ -0,0 +1,59 @@
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.Meet = void 0;
13
+ const tsyringe_1 = require("tsyringe");
14
+ const enum_1 = require("./twilio/enum");
15
+ const twilio_api_1 = require("./twilio/twilio.api");
16
+ /**
17
+ * Meet implementation
18
+ */
19
+ let Meet = class Meet {
20
+ /**
21
+ * Meet constructor
22
+ *
23
+ * @param {ClientType} clientType client type
24
+ * @param {IMeetConfig} config meet configuration
25
+ */
26
+ constructor(clientType, config) {
27
+ this._clientType = clientType;
28
+ this._config = config;
29
+ this.init();
30
+ }
31
+ // getter / setter
32
+ /**
33
+ * getter for client
34
+ *
35
+ * @returns {T} client of type T
36
+ */
37
+ get client() {
38
+ return this._client;
39
+ }
40
+ // methods
41
+ /**
42
+ * initialize method
43
+ *
44
+ * @returns {void} promise of type void
45
+ */
46
+ init() {
47
+ // change to switch when adding new client types
48
+ //Create a new Stream Client
49
+ if (this._clientType == enum_1.ClientType.Twilio) {
50
+ this._client = new twilio_api_1.TwilioApi(this._config);
51
+ }
52
+ }
53
+ };
54
+ Meet = __decorate([
55
+ (0, tsyringe_1.injectable)(),
56
+ __metadata("design:paramtypes", [String, Object])
57
+ ], Meet);
58
+ exports.Meet = Meet;
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../meet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsC;AACtC,wCAA2C;AAE3C,oDAAgD;AAUhD;;GAEG;AAEH,IAAa,IAAI,GAAjB,MAAa,IAAI;IAMb;;;;;OAKG;IACH,YAAY,UAAsB,EAAE,MAAmB;QACnD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB;;;;OAIG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,UAAU;IACV;;;;OAIG;IACK,IAAI;QACR,gDAAgD;QAChD,4BAA4B;QAC5B,IAAI,IAAI,CAAC,WAAW,IAAI,iBAAU,CAAC,MAAM,EAAE;YACvC,IAAI,CAAC,OAAO,GAAG,IAAI,sBAAS,CAAC,IAAI,CAAC,OAAO,CAAiB,CAAC;SAC9D;IACL,CAAC;CACJ,CAAA;AAzCY,IAAI;IADhB,IAAA,qBAAU,GAAE;;GACA,IAAI,CAyChB;AAzCY,oBAAI"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Client Type enum
3
+ */
4
+ export declare enum ClientType {
5
+ Twilio = "twilio"
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientType = void 0;
4
+ /**
5
+ * Client Type enum
6
+ */
7
+ var ClientType;
8
+ (function (ClientType) {
9
+ ClientType["Twilio"] = "twilio";
10
+ })(ClientType = exports.ClientType || (exports.ClientType = {}));
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../meet/twilio/enum/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,UAEX;AAFD,WAAY,UAAU;IAClB,+BAAiB,CAAA;AACrB,CAAC,EAFW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAErB"}
@@ -0,0 +1,5 @@
1
+ import { TwilioAuth } from "./twilio.auth";
2
+ import { TwilioApi } from "./twilio.api";
3
+ import { TwilioBase } from "./twilio.base";
4
+ import { TwilioRoom } from "./twilio.room";
5
+ export { TwilioApi, TwilioAuth, TwilioBase, TwilioRoom };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TwilioRoom = exports.TwilioBase = exports.TwilioAuth = exports.TwilioApi = void 0;
4
+ const twilio_auth_1 = require("./twilio.auth");
5
+ Object.defineProperty(exports, "TwilioAuth", { enumerable: true, get: function () { return twilio_auth_1.TwilioAuth; } });
6
+ const twilio_api_1 = require("./twilio.api");
7
+ Object.defineProperty(exports, "TwilioApi", { enumerable: true, get: function () { return twilio_api_1.TwilioApi; } });
8
+ const twilio_base_1 = require("./twilio.base");
9
+ Object.defineProperty(exports, "TwilioBase", { enumerable: true, get: function () { return twilio_base_1.TwilioBase; } });
10
+ const twilio_room_1 = require("./twilio.room");
11
+ Object.defineProperty(exports, "TwilioRoom", { enumerable: true, get: function () { return twilio_room_1.TwilioRoom; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../meet/twilio/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAKvB,2FALX,wBAAU,OAKW;AAJ9B,6CAAyC;AAIhC,0FAJA,sBAAS,OAIA;AAHlB,+CAA2C;AAGX,2FAHvB,wBAAU,OAGuB;AAF1C,+CAA2C;AAEC,2FAFnC,wBAAU,OAEmC"}
@@ -0,0 +1,6 @@
1
+ /** Twilio Room data*/
2
+ export interface IRoomData {
3
+ sid: string;
4
+ exist: boolean;
5
+ status: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=room.data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room.data.js","sourceRoot":"","sources":["../../../../../meet/twilio/models/_/room.data.ts"],"names":[],"mappings":""}
@@ -0,0 +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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=twilio.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twilio.config.js","sourceRoot":"","sources":["../../../../../meet/twilio/models/_/twilio.config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { IRoomData } from "./_/room.data";
2
+ import { IMeetConfig, ITwilioConfig } from "./_/twilio.config";
3
+ export { IMeetConfig, ITwilioConfig, IRoomData };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../meet/twilio/models/index.ts"],"names":[],"mappings":""}
@@ -0,0 +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
+ }
@@ -0,0 +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 };
46
+ //# sourceMappingURL=twilio.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twilio.api.js","sourceRoot":"","sources":["../../../meet/twilio/twilio.api.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAC3C,+CAA2C;AAE3C,mCAAgC;AAChC,+CAA2C;AAE3C;;GAEG;AACH,MAAa,SAAU,SAAQ,wBAAU;IAKrC;;;;OAIG;IACH,YAAY,MAAmB;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,SAAS;IAET;;;;OAIG;IACK,IAAI;QACR,sBAAsB;QACtB,KAAK,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7F,KAAK,CAAC,IAAI,GAAG,IAAI,wBAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE1C,0CAA0C;QAC1C,IAAI,CAAC,WAAW,GAAG,IAAI,wBAAU,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtG,CAAC;CACJ;AAxCD,8BAwCC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +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 {};
@@ -0,0 +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;
84
+ //# sourceMappingURL=twilio.auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twilio.auth.js","sourceRoot":"","sources":["../../../meet/twilio/twilio.auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAsC;AACtC,0EAAqE;AA2BrE;;GAEG;AAEH,IAAa,UAAU,GAAvB,MAAa,UAAU;IAMnB;;;;OAIG;IACH,YAAY,MAAmB;QAC3B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpG,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,cAAsB,EAAE,aAAqB,EAAE,gBAAwB;QACxE,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAc,EAAE,QAAgB;QAClC,gCAAgC;QAChC,MAAM,KAAK,GAAG,IAAI,qBAAW,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAEjG,+BAA+B;QAC/B,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;QAExB,mDAAmD;QACnD,MAAM,KAAK,GAAG,IAAI,wBAAU,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;QACtB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEtB,sCAAsC;QACtC,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACJ,CAAA;AAnDY,UAAU;IADtB,IAAA,qBAAU,GAAE;;GACA,UAAU,CAmDtB;AAnDY,gCAAU"}
@@ -0,0 +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
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TwilioBase = void 0;
4
+ /**
5
+ * Base client class
6
+ */
7
+ class TwilioBase {
8
+ // getter / setter
9
+ /**
10
+ * getter for twilio instance
11
+ *
12
+ * @returns {Twilio} twilio instance
13
+ */
14
+ get server() {
15
+ return this._server;
16
+ }
17
+ /**
18
+ * setter for twilio instance
19
+ *
20
+ * @param {TwilioAuth} value twilio instance
21
+ */
22
+ set server(value) {
23
+ this._server = value;
24
+ }
25
+ /**
26
+ * getter for twilio auth
27
+ *
28
+ * @returns {TwilioAuth} twilio auth instance
29
+ */
30
+ get auth() {
31
+ return this._auth;
32
+ }
33
+ /**
34
+ * setter for twilio auth instance
35
+ *
36
+ * @param {TwilioAuth} value twilio auth instance
37
+ */
38
+ set auth(value) {
39
+ this._auth = value;
40
+ }
41
+ // methods
42
+ /**
43
+ * Get token for extended classes
44
+ *
45
+ * @param {string} userId user id
46
+ * @param {string} roomName room name
47
+ * @returns {string} returns the token value
48
+ */
49
+ getToken(userId, roomName) {
50
+ return this.auth.token(userId, roomName);
51
+ }
52
+ }
53
+ exports.TwilioBase = TwilioBase;
54
+ //# sourceMappingURL=twilio.base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twilio.base.js","sourceRoot":"","sources":["../../../meet/twilio/twilio.base.ts"],"names":[],"mappings":";;;AAGA;;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,KAAa;QAC3B,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,QAAgB;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;CACJ;AArDD,gCAqDC"}