plugnmeet-sdk-js 1.4.1 → 1.4.2-2
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/package.json +18 -17
- package/dist/PlugNmeet.cjs.js +0 -318
- package/dist/PlugNmeet.cjs.js.map +0 -1
- package/dist/PlugNmeet.js +0 -315
- package/dist/PlugNmeet.js.map +0 -1
- package/dist/PlugNmeet.mjs.js +0 -309
- package/dist/PlugNmeet.mjs.js.map +0 -1
- package/dist/index.d.ts +0 -476
- package/dist/index.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plugnmeet-sdk-js",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2-2",
|
|
4
4
|
"description": "plugNmeet JS SDK",
|
|
5
5
|
"author": "Jibon L. Costa",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"preinstall": "npx only-allow pnpm",
|
|
19
|
-
"start": "rm -rf ./dist && concurrently -c \"red,green\" --kill-others \"tsc --watch -p . --outDir ./dist && esw -w --fix ./src/**/*.{ts,js}\"",
|
|
20
19
|
"build": "rm -rf ./dist && parcel build",
|
|
21
|
-
"lint": "
|
|
20
|
+
"lint": "oxlint --config=./.oxlintrc.json --fix",
|
|
21
|
+
"lint:check": "oxlint --config=./.oxlintrc.json",
|
|
22
|
+
"format:check": "prettier --check src/**/*.{jsx,ts,tsx}",
|
|
22
23
|
"build-docs": "typedoc --sort source-order"
|
|
23
24
|
},
|
|
24
25
|
"targets": {
|
|
@@ -29,20 +30,20 @@
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@bufbuild/protobuf": "2.10.2",
|
|
35
|
+
"axios": "1.13.2",
|
|
36
|
+
"plugnmeet-protocol-js": "1.1.0"
|
|
37
|
+
},
|
|
32
38
|
"devDependencies": {
|
|
33
|
-
"@parcel/packager-ts": "2.
|
|
34
|
-
"@parcel/transformer-typescript-types": "2.
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"eslint-watch": "8.0.0",
|
|
43
|
-
"parcel": "2.12.0",
|
|
44
|
-
"prettier": "3.3.3",
|
|
45
|
-
"typedoc": "0.26.7",
|
|
46
|
-
"typescript": "5.6.2"
|
|
39
|
+
"@parcel/packager-ts": "2.16.3",
|
|
40
|
+
"@parcel/transformer-typescript-types": "2.16.3",
|
|
41
|
+
"@prettier/plugin-oxc": "0.1.3",
|
|
42
|
+
"@types/node": "25.0.3",
|
|
43
|
+
"oxlint": "1.36.0",
|
|
44
|
+
"parcel": "2.16.3",
|
|
45
|
+
"prettier": "3.7.4",
|
|
46
|
+
"typedoc": "0.28.15",
|
|
47
|
+
"typescript": "5.9.3"
|
|
47
48
|
}
|
|
48
49
|
}
|
package/dist/PlugNmeet.cjs.js
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
var $jMCoD$buffer = require("buffer");
|
|
2
|
-
var $jMCoD$http = require("http");
|
|
3
|
-
var $jMCoD$https = require("https");
|
|
4
|
-
var $jMCoD$crypto = require("crypto");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function $parcel$export(e, n, v, s) {
|
|
8
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function $parcel$interopDefault(a) {
|
|
12
|
-
return a && a.__esModule ? a.default : a;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
$parcel$export(module.exports, "PlugNmeet", () => $405dcbf07186a1ff$export$1402da7f2870faee);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var $e71a992b229cccd4$require$Buffer = $jMCoD$buffer.Buffer;
|
|
21
|
-
class $e71a992b229cccd4$export$5a82ec1641dd9681 {
|
|
22
|
-
constructor(apiEndPointURL, apiKey, apiSecret){
|
|
23
|
-
this.isSecure = false;
|
|
24
|
-
this.mainOptions = {};
|
|
25
|
-
this.prepareHeader = (body)=>{
|
|
26
|
-
const signature = (0, $jMCoD$crypto.createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
27
|
-
return {
|
|
28
|
-
"Content-Type": "application/json",
|
|
29
|
-
"API-KEY": this.apiKey,
|
|
30
|
-
"HASH-SIGNATURE": signature
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
this.sendRequest = async (path, body)=>{
|
|
34
|
-
return new Promise((resolve)=>{
|
|
35
|
-
const output = {
|
|
36
|
-
status: false,
|
|
37
|
-
response: undefined
|
|
38
|
-
};
|
|
39
|
-
const chunk = JSON.stringify(body);
|
|
40
|
-
const options = {
|
|
41
|
-
...this.mainOptions
|
|
42
|
-
};
|
|
43
|
-
options.path += path;
|
|
44
|
-
options.headers = this.prepareHeader(chunk);
|
|
45
|
-
const req = (this.isSecure ? (0, ($parcel$interopDefault($jMCoD$https))) : (0, ($parcel$interopDefault($jMCoD$http)))).request(options, (res)=>{
|
|
46
|
-
const body = [];
|
|
47
|
-
res.on("data", (chunk)=>body.push(chunk));
|
|
48
|
-
res.on("end", ()=>{
|
|
49
|
-
const resString = $e71a992b229cccd4$require$Buffer.concat(body).toString();
|
|
50
|
-
try {
|
|
51
|
-
output.status = true;
|
|
52
|
-
output.response = JSON.parse(resString);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
output.status = false;
|
|
55
|
-
output.response = error;
|
|
56
|
-
}
|
|
57
|
-
resolve(output);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
req.on("error", (error)=>{
|
|
61
|
-
output.response = error.message;
|
|
62
|
-
resolve(output);
|
|
63
|
-
});
|
|
64
|
-
req.write(chunk);
|
|
65
|
-
req.end();
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
this.apiEndPointURL = apiEndPointURL;
|
|
69
|
-
this.apiKey = apiKey;
|
|
70
|
-
this.apiSecret = apiSecret;
|
|
71
|
-
const url = new URL(apiEndPointURL);
|
|
72
|
-
let port = url.protocol === "https:" ? 443 : 80;
|
|
73
|
-
this.isSecure = url.protocol === "https:" ? true : false;
|
|
74
|
-
// use port if supplied with url
|
|
75
|
-
if (url.port) port = Number(url.port);
|
|
76
|
-
this.mainOptions = {
|
|
77
|
-
hostname: url.hostname,
|
|
78
|
-
path: url.pathname,
|
|
79
|
-
method: "POST",
|
|
80
|
-
port: port
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
87
|
-
/**
|
|
88
|
-
* @param serverUrl plugNmeet server URL
|
|
89
|
-
* @param apiKey plugNmeet API_Key
|
|
90
|
-
* @param apiSecret plugNmeet API_Secret
|
|
91
|
-
*/ constructor(serverUrl, apiKey, apiSecret){
|
|
92
|
-
this.defaultPath = "/auth";
|
|
93
|
-
this.apiTransport = new (0, $e71a992b229cccd4$export$5a82ec1641dd9681)(serverUrl + this.defaultPath, apiKey, apiSecret);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Create new room
|
|
97
|
-
* @param params
|
|
98
|
-
* @returns Promise<CreateRoomResponse>
|
|
99
|
-
*/ async createRoom(params) {
|
|
100
|
-
const output = await this.apiTransport.sendRequest("/room/create", params);
|
|
101
|
-
if (!output.status) return {
|
|
102
|
-
status: false,
|
|
103
|
-
msg: output.response
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
status: output.response.status,
|
|
107
|
-
msg: output.response.msg,
|
|
108
|
-
room_info: output.response.room_info
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Generate join token
|
|
113
|
-
* @param params
|
|
114
|
-
* @returns Promise<JoinTokenResponse>
|
|
115
|
-
*/ async getJoinToken(params) {
|
|
116
|
-
const output = await this.apiTransport.sendRequest("/room/getJoinToken", params);
|
|
117
|
-
if (!output.status) return {
|
|
118
|
-
status: false,
|
|
119
|
-
msg: output.response
|
|
120
|
-
};
|
|
121
|
-
return {
|
|
122
|
-
status: output.response.status,
|
|
123
|
-
msg: output.response.msg,
|
|
124
|
-
token: output.response.token
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* If room is active or not
|
|
129
|
-
* @param params
|
|
130
|
-
* @returns Promise<IsRoomActiveResponse>
|
|
131
|
-
*/ async isRoomActive(params) {
|
|
132
|
-
const output = await this.apiTransport.sendRequest("/room/isRoomActive", params);
|
|
133
|
-
if (!output.status) return {
|
|
134
|
-
status: false,
|
|
135
|
-
msg: output.response
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
status: output.response.status,
|
|
139
|
-
is_active: output.response.is_active,
|
|
140
|
-
msg: output.response.msg
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Get active room information
|
|
145
|
-
* @param params
|
|
146
|
-
* @returns Promise<ActiveRoomInfoResponse>
|
|
147
|
-
*/ async getActiveRoomInfo(params) {
|
|
148
|
-
const output = await this.apiTransport.sendRequest("/room/getActiveRoomInfo", params);
|
|
149
|
-
if (!output.status) return {
|
|
150
|
-
status: false,
|
|
151
|
-
msg: output.response
|
|
152
|
-
};
|
|
153
|
-
return {
|
|
154
|
-
status: output.response.status,
|
|
155
|
-
msg: output.response.msg,
|
|
156
|
-
room: output.response.room
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Get all active rooms
|
|
161
|
-
* @returns Promise<ActiveRoomsInfoResponse>
|
|
162
|
-
*/ async getActiveRoomsInfo() {
|
|
163
|
-
const output = await this.apiTransport.sendRequest("/room/getActiveRoomsInfo", {});
|
|
164
|
-
if (!output.status) return {
|
|
165
|
-
status: false,
|
|
166
|
-
msg: output.response
|
|
167
|
-
};
|
|
168
|
-
return {
|
|
169
|
-
status: output.response.status,
|
|
170
|
-
msg: output.response.msg,
|
|
171
|
-
rooms: output.response.rooms
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Fetch info about past rooms
|
|
176
|
-
* @param params
|
|
177
|
-
* @returns Promise<FetchRoomsInfoResponse>
|
|
178
|
-
*/ async fetchPastRoomsInfo(params) {
|
|
179
|
-
const output = await this.apiTransport.sendRequest("/room/fetchPastRooms", params);
|
|
180
|
-
if (!output.status) return {
|
|
181
|
-
status: false,
|
|
182
|
-
msg: output.response
|
|
183
|
-
};
|
|
184
|
-
return {
|
|
185
|
-
status: output.response.status,
|
|
186
|
-
msg: output.response.msg,
|
|
187
|
-
result: output.response.result
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* End active room
|
|
192
|
-
* @param params
|
|
193
|
-
* @returns Promise<EndRoomResponse>
|
|
194
|
-
*/ async endRoom(params) {
|
|
195
|
-
const output = await this.apiTransport.sendRequest("/room/endRoom", params);
|
|
196
|
-
if (!output.status) return {
|
|
197
|
-
status: false,
|
|
198
|
-
msg: output.response
|
|
199
|
-
};
|
|
200
|
-
return {
|
|
201
|
-
status: output.response.status,
|
|
202
|
-
msg: output.response.msg
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Fetch analytics
|
|
207
|
-
* @param params
|
|
208
|
-
* @returns Promise<FetchAnalyticsResponse>
|
|
209
|
-
*/ async fetchAnalytics(params) {
|
|
210
|
-
const output = await this.apiTransport.sendRequest("/analytics/fetch", params);
|
|
211
|
-
if (!output.status) return {
|
|
212
|
-
status: false,
|
|
213
|
-
msg: output.response
|
|
214
|
-
};
|
|
215
|
-
return {
|
|
216
|
-
status: output.response.status,
|
|
217
|
-
msg: output.response.msg,
|
|
218
|
-
result: output.response.result
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Delete analytics
|
|
223
|
-
* @param params
|
|
224
|
-
* @returns Promise<DeleteAnalyticsResponse>
|
|
225
|
-
*/ async deleteAnalytics(params) {
|
|
226
|
-
const output = await this.apiTransport.sendRequest("/analytics/delete", params);
|
|
227
|
-
if (!output.status) return {
|
|
228
|
-
status: false,
|
|
229
|
-
msg: output.response
|
|
230
|
-
};
|
|
231
|
-
return {
|
|
232
|
-
status: output.response.status,
|
|
233
|
-
msg: output.response.msg
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Generate token to download recording
|
|
238
|
-
* @param params
|
|
239
|
-
* @returns Promise<AnalyticsDownloadTokenResponse>
|
|
240
|
-
*/ async getAnalyticsDownloadToken(params) {
|
|
241
|
-
const output = await this.apiTransport.sendRequest("/analytics/getDownloadToken", params);
|
|
242
|
-
if (!output.status) return {
|
|
243
|
-
status: false,
|
|
244
|
-
msg: output.response
|
|
245
|
-
};
|
|
246
|
-
return {
|
|
247
|
-
status: output.response.status,
|
|
248
|
-
msg: output.response.msg,
|
|
249
|
-
token: output.response.token
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Fetch recordings
|
|
254
|
-
* @param params
|
|
255
|
-
* @returns Promise<FetchRecordingsResponse>
|
|
256
|
-
*/ async fetchRecordings(params) {
|
|
257
|
-
const output = await this.apiTransport.sendRequest("/recording/fetch", params);
|
|
258
|
-
if (!output.status) return {
|
|
259
|
-
status: false,
|
|
260
|
-
msg: output.response
|
|
261
|
-
};
|
|
262
|
-
return {
|
|
263
|
-
status: output.response.status,
|
|
264
|
-
msg: output.response.msg,
|
|
265
|
-
result: output.response.result
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Delete recording
|
|
270
|
-
* @param params
|
|
271
|
-
* @returns Promise<DeleteRecordingsResponse>
|
|
272
|
-
*/ async deleteRecordings(params) {
|
|
273
|
-
const output = await this.apiTransport.sendRequest("/recording/delete", params);
|
|
274
|
-
if (!output.status) return {
|
|
275
|
-
status: false,
|
|
276
|
-
msg: output.response
|
|
277
|
-
};
|
|
278
|
-
return {
|
|
279
|
-
status: output.response.status,
|
|
280
|
-
msg: output.response.msg
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Generate token to download recording
|
|
285
|
-
* @param params
|
|
286
|
-
* @returns Promise<RecordingDownloadTokenResponse>
|
|
287
|
-
*/ async getRecordingDownloadToken(params) {
|
|
288
|
-
const output = await this.apiTransport.sendRequest("/recording/getDownloadToken", params);
|
|
289
|
-
if (!output.status) return {
|
|
290
|
-
status: false,
|
|
291
|
-
msg: output.response
|
|
292
|
-
};
|
|
293
|
-
return {
|
|
294
|
-
status: output.response.status,
|
|
295
|
-
msg: output.response.msg,
|
|
296
|
-
token: output.response.token
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* To get JS & CSS files to build interface
|
|
301
|
-
* @returns Promise<ClientFilesResponse>
|
|
302
|
-
*/ async getClientFiles() {
|
|
303
|
-
const output = await this.apiTransport.sendRequest("/getClientFiles", {});
|
|
304
|
-
if (!output.status) return {
|
|
305
|
-
status: false,
|
|
306
|
-
msg: output.response
|
|
307
|
-
};
|
|
308
|
-
return {
|
|
309
|
-
status: output.response.status,
|
|
310
|
-
msg: output.response.msg,
|
|
311
|
-
css: output.response.css,
|
|
312
|
-
js: output.response.js
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
//# sourceMappingURL=PlugNmeet.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;ACSO,MAAM;IAQX,YAAY,cAAsB,EAAE,MAAc,EAAE,SAAiB,CAAE;aAH/D,WAAW;aACX,cAA8B,CAAC;aAwB/B,gBAAgB,CAAC;YACvB,MAAM,YAAY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AAQ,CAAC,MAAM;YAC9B,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,IAAI,OAAO,QAAQ,CAAC,EAAE;QACxB;IACF;AACF","sources":["src/PlugNmeet.ts","src/ApiTransport.ts"],"sourcesContent":["import { ApiTransport } from './ApiTransport';\nimport { CreateRoomParams, CreateRoomResponse } from './types/createRoom';\nimport { JoinTokenParams, JoinTokenResponse } from './types/joinToken';\nimport { IsRoomActiveParams, IsRoomActiveResponse } from './types/isRoomActive';\nimport {\n ActiveRoomInfoParams,\n ActiveRoomInfoResponse,\n} from './types/activeRoomInfo';\nimport { ActiveRoomsInfoResponse } from './types/activeRoomsInfo';\nimport { EndRoomParams, EndRoomResponse } from './types/endRoom';\nimport {\n FetchRecordingsParams,\n FetchRecordingsResponse,\n} from './types/fetchRecordings';\nimport {\n DeleteRecordingsParams,\n DeleteRecordingsResponse,\n} from './types/deleteRecordings';\nimport {\n RecordingDownloadTokenParams,\n RecordingDownloadTokenResponse,\n} from './types/recordingDownloadToken';\nimport { ClientFilesResponse } from './types/clientFiles';\nimport {\n FetchRoomsInfoResponse,\n FetchPastRoomsInfoParams,\n} from './types/fetchPastRoomsInfo';\nimport {\n FetchAnalyticsParams,\n FetchAnalyticsResponse,\n} from './types/fetchAnalytics';\nimport {\n DeleteAnalyticsParams,\n DeleteAnalyticsResponse,\n} from './types/deleteAnalytics';\nimport {\n AnalyticsDownloadTokenParams,\n AnalyticsDownloadTokenResponse,\n} from './types/analyticsDownloadToken';\nimport { PlugNmeetAPI } from './types/PlugNmeetAPI';\n\nexport class PlugNmeet implements PlugNmeetAPI {\n protected defaultPath = '/auth';\n private apiTransport: ApiTransport;\n\n /**\n * @param serverUrl plugNmeet server URL\n * @param apiKey plugNmeet API_Key\n * @param apiSecret plugNmeet API_Secret\n */\n constructor(serverUrl: string, apiKey: string, apiSecret: string) {\n this.apiTransport = new ApiTransport(\n serverUrl + this.defaultPath,\n apiKey,\n apiSecret,\n );\n }\n\n /**\n * Create new room\n * @param params\n * @returns Promise<CreateRoomResponse>\n */\n public async createRoom(\n params: CreateRoomParams,\n ): Promise<CreateRoomResponse> {\n const output = await this.apiTransport.sendRequest('/room/create', params);\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n room_info: output.response.room_info,\n };\n }\n\n /**\n * Generate join token\n * @param params\n * @returns Promise<JoinTokenResponse>\n */\n public async getJoinToken(\n params: JoinTokenParams,\n ): Promise<JoinTokenResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/getJoinToken',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n token: output.response.token,\n };\n }\n\n /**\n * If room is active or not\n * @param params\n * @returns Promise<IsRoomActiveResponse>\n */\n public async isRoomActive(\n params: IsRoomActiveParams,\n ): Promise<IsRoomActiveResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/isRoomActive',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n is_active: output.response.is_active,\n msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params\n * @returns Promise<ActiveRoomInfoResponse>\n */\n public async getActiveRoomInfo(\n params: ActiveRoomInfoParams,\n ): Promise<ActiveRoomInfoResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/getActiveRoomInfo',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n room: output.response.room,\n };\n }\n\n /**\n * Get all active rooms\n * @returns Promise<ActiveRoomsInfoResponse>\n */\n public async getActiveRoomsInfo(): Promise<ActiveRoomsInfoResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/getActiveRoomsInfo',\n {},\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n rooms: output.response.rooms,\n };\n }\n\n /**\n * Fetch info about past rooms\n * @param params\n * @returns Promise<FetchRoomsInfoResponse>\n */\n public async fetchPastRoomsInfo(\n params: FetchPastRoomsInfoParams,\n ): Promise<FetchRoomsInfoResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/fetchPastRooms',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n result: output.response.result,\n };\n }\n\n /**\n * End active room\n * @param params\n * @returns Promise<EndRoomResponse>\n */\n public async endRoom(params: EndRoomParams): Promise<EndRoomResponse> {\n const output = await this.apiTransport.sendRequest('/room/endRoom', params);\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n };\n }\n\n /**\n * Fetch analytics\n * @param params\n * @returns Promise<FetchAnalyticsResponse>\n */\n public async fetchAnalytics(\n params: FetchAnalyticsParams,\n ): Promise<FetchAnalyticsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/analytics/fetch',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n result: output.response.result,\n };\n }\n\n /**\n * Delete analytics\n * @param params\n * @returns Promise<DeleteAnalyticsResponse>\n */\n public async deleteAnalytics(\n params: DeleteAnalyticsParams,\n ): Promise<DeleteAnalyticsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/analytics/delete',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n };\n }\n\n /**\n * Generate token to download recording\n * @param params\n * @returns Promise<AnalyticsDownloadTokenResponse>\n */\n public async getAnalyticsDownloadToken(\n params: AnalyticsDownloadTokenParams,\n ): Promise<AnalyticsDownloadTokenResponse> {\n const output = await this.apiTransport.sendRequest(\n '/analytics/getDownloadToken',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n token: output.response.token,\n };\n }\n\n /**\n * Fetch recordings\n * @param params\n * @returns Promise<FetchRecordingsResponse>\n */\n public async fetchRecordings(\n params: FetchRecordingsParams,\n ): Promise<FetchRecordingsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/recording/fetch',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n result: output.response.result,\n };\n }\n\n /**\n * Delete recording\n * @param params\n * @returns Promise<DeleteRecordingsResponse>\n */\n public async deleteRecordings(\n params: DeleteRecordingsParams,\n ): Promise<DeleteRecordingsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/recording/delete',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n };\n }\n\n /**\n * Generate token to download recording\n * @param params\n * @returns Promise<RecordingDownloadTokenResponse>\n */\n public async getRecordingDownloadToken(\n params: RecordingDownloadTokenParams,\n ): Promise<RecordingDownloadTokenResponse> {\n const output = await this.apiTransport.sendRequest(\n '/recording/getDownloadToken',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n token: output.response.token,\n };\n }\n\n /**\n * To get JS & CSS files to build interface\n * @returns Promise<ClientFilesResponse>\n */\n public async getClientFiles(): Promise<ClientFilesResponse> {\n const output = await this.apiTransport.sendRequest('/getClientFiles', {});\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n css: output.response.css,\n js: output.response.js,\n };\n }\n}\n","import http from 'http';\nimport https, { RequestOptions } from 'https';\nimport { createHmac } from 'crypto';\n\nexport type APIResponse = {\n status: boolean;\n response: any;\n};\n\nexport class ApiTransport {\n protected apiEndPointURL: string;\n protected apiKey: string;\n protected apiSecret: string;\n\n private isSecure = false;\n private mainOptions: RequestOptions = {};\n\n constructor(apiEndPointURL: string, apiKey: string, apiSecret: string) {\n this.apiEndPointURL = apiEndPointURL;\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n\n const url = new URL(apiEndPointURL);\n let port = url.protocol === 'https:' ? 443 : 80;\n this.isSecure = url.protocol === 'https:' ? true : false;\n\n // use port if supplied with url\n if (url.port) {\n port = Number(url.port);\n }\n\n this.mainOptions = {\n hostname: url.hostname,\n path: url.pathname,\n method: 'POST',\n port,\n };\n }\n\n private prepareHeader = (body: string) => {\n const signature = createHmac('sha256', this.apiSecret)\n .update(body)\n .digest('hex');\n\n return {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n };\n\n public sendRequest = async (path: string, body: any) => {\n return new Promise<APIResponse>((resolve) => {\n const output: APIResponse = {\n status: false,\n response: undefined,\n };\n\n const chunk = JSON.stringify(body);\n\n const options = { ...this.mainOptions };\n options.path += path;\n options.headers = this.prepareHeader(chunk);\n\n const req = (this.isSecure ? https : http).request(options, (res) => {\n const body: Array<Uint8Array> = [];\n res.on('data', (chunk) => body.push(chunk));\n\n res.on('end', () => {\n const resString = Buffer.concat(body).toString();\n\n try {\n output.status = true;\n output.response = JSON.parse(resString);\n } catch (error) {\n output.status = false;\n output.response = error;\n }\n\n resolve(output);\n });\n });\n\n req.on('error', (error) => {\n output.response = error.message;\n resolve(output);\n });\n\n req.write(chunk);\n req.end();\n });\n };\n}\n"],"names":[],"version":3,"file":"PlugNmeet.cjs.js.map"}
|