plugnmeet-sdk-js 1.2.6 → 1.3.0
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/dist/{PlugNmeet.cjs → PlugNmeet.cjs.js} +48 -48
- package/dist/PlugNmeet.cjs.js.map +1 -0
- package/dist/PlugNmeet.js +47 -47
- package/dist/PlugNmeet.js.map +1 -1
- package/dist/{PlugNmeet.mjs → PlugNmeet.mjs.js} +48 -48
- package/dist/PlugNmeet.mjs.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +14 -14
- package/dist/PlugNmeet.cjs.map +0 -1
- package/dist/PlugNmeet.mjs.map +0 -1
|
@@ -17,9 +17,53 @@ $parcel$export(module.exports, "PlugNmeet", () => $405dcbf07186a1ff$export$1402d
|
|
|
17
17
|
|
|
18
18
|
var $e71a992b229cccd4$require$Buffer = $jMCoD$buffer.Buffer;
|
|
19
19
|
class $e71a992b229cccd4$export$5a82ec1641dd9681 {
|
|
20
|
-
isSecure = false;
|
|
21
|
-
mainOptions = {};
|
|
22
20
|
constructor(apiEndPointURL, apiKey, apiSecret){
|
|
21
|
+
this.isSecure = false;
|
|
22
|
+
this.mainOptions = {};
|
|
23
|
+
this.prepareHeader = (body)=>{
|
|
24
|
+
const signature = (0, $jMCoD$crypto.createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
25
|
+
const headers = {
|
|
26
|
+
"Content-Type": "application/json",
|
|
27
|
+
"API-KEY": this.apiKey,
|
|
28
|
+
"HASH-SIGNATURE": signature
|
|
29
|
+
};
|
|
30
|
+
return headers;
|
|
31
|
+
};
|
|
32
|
+
this.sendRequest = async (path, body)=>{
|
|
33
|
+
return new Promise((resolve)=>{
|
|
34
|
+
const output = {
|
|
35
|
+
status: false,
|
|
36
|
+
response: undefined
|
|
37
|
+
};
|
|
38
|
+
const chunk = JSON.stringify(body);
|
|
39
|
+
const options = {
|
|
40
|
+
...this.mainOptions
|
|
41
|
+
};
|
|
42
|
+
options.path += path;
|
|
43
|
+
options.headers = this.prepareHeader(chunk);
|
|
44
|
+
const req = (this.isSecure ? (0, ($parcel$interopDefault($jMCoD$https))) : (0, ($parcel$interopDefault($jMCoD$http)))).request(options, (res)=>{
|
|
45
|
+
const body = [];
|
|
46
|
+
res.on("data", (chunk)=>body.push(chunk));
|
|
47
|
+
res.on("end", ()=>{
|
|
48
|
+
const resString = $e71a992b229cccd4$require$Buffer.concat(body).toString();
|
|
49
|
+
try {
|
|
50
|
+
output.status = true;
|
|
51
|
+
output.response = JSON.parse(resString);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
output.status = false;
|
|
54
|
+
output.response = error;
|
|
55
|
+
}
|
|
56
|
+
resolve(output);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
req.on("error", (error)=>{
|
|
60
|
+
output.response = error.message;
|
|
61
|
+
resolve(output);
|
|
62
|
+
});
|
|
63
|
+
req.write(chunk);
|
|
64
|
+
req.end();
|
|
65
|
+
});
|
|
66
|
+
};
|
|
23
67
|
this.apiEndPointURL = apiEndPointURL;
|
|
24
68
|
this.apiKey = apiKey;
|
|
25
69
|
this.apiSecret = apiSecret;
|
|
@@ -35,60 +79,16 @@ class $e71a992b229cccd4$export$5a82ec1641dd9681 {
|
|
|
35
79
|
port: port
|
|
36
80
|
};
|
|
37
81
|
}
|
|
38
|
-
prepareHeader = (body)=>{
|
|
39
|
-
const signature = (0, $jMCoD$crypto.createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
40
|
-
const headers = {
|
|
41
|
-
"Content-Type": "application/json",
|
|
42
|
-
"API-KEY": this.apiKey,
|
|
43
|
-
"HASH-SIGNATURE": signature
|
|
44
|
-
};
|
|
45
|
-
return headers;
|
|
46
|
-
};
|
|
47
|
-
sendRequest = async (path, body)=>{
|
|
48
|
-
return new Promise((resolve)=>{
|
|
49
|
-
const output = {
|
|
50
|
-
status: false,
|
|
51
|
-
response: undefined
|
|
52
|
-
};
|
|
53
|
-
const chunk = JSON.stringify(body);
|
|
54
|
-
const options = {
|
|
55
|
-
...this.mainOptions
|
|
56
|
-
};
|
|
57
|
-
options.path += path;
|
|
58
|
-
options.headers = this.prepareHeader(chunk);
|
|
59
|
-
const req = (this.isSecure ? (0, ($parcel$interopDefault($jMCoD$https))) : (0, ($parcel$interopDefault($jMCoD$http)))).request(options, (res)=>{
|
|
60
|
-
const body = [];
|
|
61
|
-
res.on("data", (chunk)=>body.push(chunk));
|
|
62
|
-
res.on("end", ()=>{
|
|
63
|
-
const resString = $e71a992b229cccd4$require$Buffer.concat(body).toString();
|
|
64
|
-
try {
|
|
65
|
-
output.status = true;
|
|
66
|
-
output.response = JSON.parse(resString);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
output.status = false;
|
|
69
|
-
output.response = error;
|
|
70
|
-
}
|
|
71
|
-
resolve(output);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
req.on("error", (error)=>{
|
|
75
|
-
output.response = error.message;
|
|
76
|
-
resolve(output);
|
|
77
|
-
});
|
|
78
|
-
req.write(chunk);
|
|
79
|
-
req.end();
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
86
|
-
defaultPath = "/auth";
|
|
87
86
|
/**
|
|
88
87
|
* @param serverUrl plugNmeet server URL
|
|
89
88
|
* @param apiKey plugNmeet API_Key
|
|
90
89
|
* @param apiSecret plugNmeet API_Secret
|
|
91
90
|
*/ constructor(serverUrl, apiKey, apiSecret){
|
|
91
|
+
this.defaultPath = "/auth";
|
|
92
92
|
this.apiTransport = new (0, $e71a992b229cccd4$export$5a82ec1641dd9681)(serverUrl + this.defaultPath, apiKey, apiSecret);
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -249,4 +249,4 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
249
249
|
}
|
|
250
250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ACrC,qBACA;QAEF,IAAI,CAAC,OAAO,QACV,OAAO;YACL,QAAQ;YACR,KAAK,OAAO;QACd;QAGF,OAAO;YACL,QAAQ,OAAO,SAAS;YACxB,KAAK,OAAO,SAAS;QACvB;IACF;IAEA;;GAEC,GACD,MAAa,iBAA+C;QAC1D,MAAM,SAAS,MAAM,IAAI,CAAC,aAAa,YAAY,mBAAmB,CAAC;QACvE,IAAI,CAAC,OAAO,QACV,OAAO;YACL,QAAQ;YACR,KAAK,OAAO;QACd;QAGF,OAAO;YACL,QAAQ,OAAO,SAAS;YACxB,KAAK,OAAO,SAAS;YACrB,KAAK,OAAO,SAAS;YACrB,IAAI,OAAO,SAAS;QACtB;IACF;IAEA;;;;GAIC,GACD,MAAa,0BACX,MAAoC,EACK;QACzC,MAAM,SAAS,MAAM,IAAI,CAAC,aAAa,YACrC,+BACA;QAEF,IAAI,CAAC,OAAO,QACV,OAAO;YACL,QAAQ;YACR,KAAK,OAAO;QACd;QAGF,OAAO;YACL,QAAQ,OAAO,SAAS;YACxB,KAAK,OAAO,SAAS;YACrB,OAAO,OAAO,SAAS;QACzB;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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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","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:' ?? 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 const headers = {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n\n return headers;\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"}
|
package/dist/PlugNmeet.js
CHANGED
|
@@ -14,9 +14,53 @@ $parcel$export(module.exports, "PlugNmeet", () => $8e30a24c4952589a$export$1402d
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class $3437a6ece6919767$export$5a82ec1641dd9681 {
|
|
17
|
-
isSecure = false;
|
|
18
|
-
mainOptions = {};
|
|
19
17
|
constructor(apiEndPointURL, apiKey, apiSecret){
|
|
18
|
+
this.isSecure = false;
|
|
19
|
+
this.mainOptions = {};
|
|
20
|
+
this.prepareHeader = (body)=>{
|
|
21
|
+
const signature = (0, $d6kgz$crypto.createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
22
|
+
const headers = {
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
"API-KEY": this.apiKey,
|
|
25
|
+
"HASH-SIGNATURE": signature
|
|
26
|
+
};
|
|
27
|
+
return headers;
|
|
28
|
+
};
|
|
29
|
+
this.sendRequest = async (path, body)=>{
|
|
30
|
+
return new Promise((resolve)=>{
|
|
31
|
+
const output = {
|
|
32
|
+
status: false,
|
|
33
|
+
response: undefined
|
|
34
|
+
};
|
|
35
|
+
const chunk = JSON.stringify(body);
|
|
36
|
+
const options = {
|
|
37
|
+
...this.mainOptions
|
|
38
|
+
};
|
|
39
|
+
options.path += path;
|
|
40
|
+
options.headers = this.prepareHeader(chunk);
|
|
41
|
+
const req = (this.isSecure ? (0, ($parcel$interopDefault($d6kgz$https))) : (0, ($parcel$interopDefault($d6kgz$http)))).request(options, (res)=>{
|
|
42
|
+
const body = [];
|
|
43
|
+
res.on("data", (chunk)=>body.push(chunk));
|
|
44
|
+
res.on("end", ()=>{
|
|
45
|
+
const resString = Buffer.concat(body).toString();
|
|
46
|
+
try {
|
|
47
|
+
output.status = true;
|
|
48
|
+
output.response = JSON.parse(resString);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
output.status = false;
|
|
51
|
+
output.response = error;
|
|
52
|
+
}
|
|
53
|
+
resolve(output);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
req.on("error", (error)=>{
|
|
57
|
+
output.response = error.message;
|
|
58
|
+
resolve(output);
|
|
59
|
+
});
|
|
60
|
+
req.write(chunk);
|
|
61
|
+
req.end();
|
|
62
|
+
});
|
|
63
|
+
};
|
|
20
64
|
this.apiEndPointURL = apiEndPointURL;
|
|
21
65
|
this.apiKey = apiKey;
|
|
22
66
|
this.apiSecret = apiSecret;
|
|
@@ -32,60 +76,16 @@ class $3437a6ece6919767$export$5a82ec1641dd9681 {
|
|
|
32
76
|
port: port
|
|
33
77
|
};
|
|
34
78
|
}
|
|
35
|
-
prepareHeader = (body)=>{
|
|
36
|
-
const signature = (0, $d6kgz$crypto.createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
37
|
-
const headers = {
|
|
38
|
-
"Content-Type": "application/json",
|
|
39
|
-
"API-KEY": this.apiKey,
|
|
40
|
-
"HASH-SIGNATURE": signature
|
|
41
|
-
};
|
|
42
|
-
return headers;
|
|
43
|
-
};
|
|
44
|
-
sendRequest = async (path, body)=>{
|
|
45
|
-
return new Promise((resolve)=>{
|
|
46
|
-
const output = {
|
|
47
|
-
status: false,
|
|
48
|
-
response: undefined
|
|
49
|
-
};
|
|
50
|
-
const chunk = JSON.stringify(body);
|
|
51
|
-
const options = {
|
|
52
|
-
...this.mainOptions
|
|
53
|
-
};
|
|
54
|
-
options.path += path;
|
|
55
|
-
options.headers = this.prepareHeader(chunk);
|
|
56
|
-
const req = (this.isSecure ? (0, ($parcel$interopDefault($d6kgz$https))) : (0, ($parcel$interopDefault($d6kgz$http)))).request(options, (res)=>{
|
|
57
|
-
const body = [];
|
|
58
|
-
res.on("data", (chunk)=>body.push(chunk));
|
|
59
|
-
res.on("end", ()=>{
|
|
60
|
-
const resString = Buffer.concat(body).toString();
|
|
61
|
-
try {
|
|
62
|
-
output.status = true;
|
|
63
|
-
output.response = JSON.parse(resString);
|
|
64
|
-
} catch (error) {
|
|
65
|
-
output.status = false;
|
|
66
|
-
output.response = error;
|
|
67
|
-
}
|
|
68
|
-
resolve(output);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
req.on("error", (error)=>{
|
|
72
|
-
output.response = error.message;
|
|
73
|
-
resolve(output);
|
|
74
|
-
});
|
|
75
|
-
req.write(chunk);
|
|
76
|
-
req.end();
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
class $8e30a24c4952589a$export$1402da7f2870faee {
|
|
83
|
-
defaultPath = "/auth";
|
|
84
83
|
/**
|
|
85
84
|
* @param serverUrl plugNmeet server URL
|
|
86
85
|
* @param apiKey plugNmeet API_Key
|
|
87
86
|
* @param apiSecret plugNmeet API_Secret
|
|
88
87
|
*/ constructor(serverUrl, apiKey, apiSecret){
|
|
88
|
+
this.defaultPath = "/auth";
|
|
89
89
|
this.apiTransport = new (0, $3437a6ece6919767$export$5a82ec1641dd9681)(serverUrl + this.defaultPath, apiKey, apiSecret);
|
|
90
90
|
}
|
|
91
91
|
/**
|
package/dist/PlugNmeet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;ACAA;;;AASO,MAAM;IAKH,WAAW,KAAK,CAAC;IACjB,cAA8B,CAAC,EAAE;IAEzC,YAAY,cAAsB,EAAE,MAAc,EAAE,SAAiB,CAAE;QACrE,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,SAAS,GAAG;QAEjB,MAAM,MAAM,IAAI,IAAI;QACpB,I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ACL,QAAQ,OAAO,QAAQ,CAAC,MAAM;YAC9B,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,OAAO,OAAO,QAAQ,CAAC,KAAK;QAC9B;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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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","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:' ?? 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 const headers = {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n\n return headers;\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.js.map","sourceRoot":"../"}
|
|
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,CAAA,GAAA,wBAAS,EAAE,UAAU,IAAI,CAAC,WACzC,OAAO,MACP,OAAO;YAEV,MAAM,UAAU;gBACd,gBAAgB;gBAChB,WAAW,IAAI,CAAC;gBAChB,kBAAkB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;;GAIC,GACD,MAAa,0BACX,MAAoC,EACK;QACzC,MAAM,SAAS,MAAM,IAAI,CAAC,aAAa,YACrC,+BACA;QAEF,IAAI,CAAC,OAAO,QACV,OAAO;YACL,QAAQ;YACR,KAAK,OAAO;QACd;QAGF,OAAO;YACL,QAAQ,OAAO,SAAS;YACxB,KAAK,OAAO,SAAS;YACrB,OAAO,OAAO,SAAS;QACzB;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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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","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:' ?? 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 const headers = {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n\n return headers;\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.js.map","sourceRoot":"../"}
|
|
@@ -9,9 +9,53 @@ import {createHmac as $gvjLo$createHmac} from "crypto";
|
|
|
9
9
|
|
|
10
10
|
var $e666bfa8019d90ff$require$Buffer = $gvjLo$Buffer;
|
|
11
11
|
class $e666bfa8019d90ff$export$5a82ec1641dd9681 {
|
|
12
|
-
isSecure = false;
|
|
13
|
-
mainOptions = {};
|
|
14
12
|
constructor(apiEndPointURL, apiKey, apiSecret){
|
|
13
|
+
this.isSecure = false;
|
|
14
|
+
this.mainOptions = {};
|
|
15
|
+
this.prepareHeader = (body)=>{
|
|
16
|
+
const signature = (0, $gvjLo$createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
17
|
+
const headers = {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
"API-KEY": this.apiKey,
|
|
20
|
+
"HASH-SIGNATURE": signature
|
|
21
|
+
};
|
|
22
|
+
return headers;
|
|
23
|
+
};
|
|
24
|
+
this.sendRequest = async (path, body)=>{
|
|
25
|
+
return new Promise((resolve)=>{
|
|
26
|
+
const output = {
|
|
27
|
+
status: false,
|
|
28
|
+
response: undefined
|
|
29
|
+
};
|
|
30
|
+
const chunk = JSON.stringify(body);
|
|
31
|
+
const options = {
|
|
32
|
+
...this.mainOptions
|
|
33
|
+
};
|
|
34
|
+
options.path += path;
|
|
35
|
+
options.headers = this.prepareHeader(chunk);
|
|
36
|
+
const req = (this.isSecure ? (0, $gvjLo$https) : (0, $gvjLo$http)).request(options, (res)=>{
|
|
37
|
+
const body = [];
|
|
38
|
+
res.on("data", (chunk)=>body.push(chunk));
|
|
39
|
+
res.on("end", ()=>{
|
|
40
|
+
const resString = $e666bfa8019d90ff$require$Buffer.concat(body).toString();
|
|
41
|
+
try {
|
|
42
|
+
output.status = true;
|
|
43
|
+
output.response = JSON.parse(resString);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
output.status = false;
|
|
46
|
+
output.response = error;
|
|
47
|
+
}
|
|
48
|
+
resolve(output);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
req.on("error", (error)=>{
|
|
52
|
+
output.response = error.message;
|
|
53
|
+
resolve(output);
|
|
54
|
+
});
|
|
55
|
+
req.write(chunk);
|
|
56
|
+
req.end();
|
|
57
|
+
});
|
|
58
|
+
};
|
|
15
59
|
this.apiEndPointURL = apiEndPointURL;
|
|
16
60
|
this.apiKey = apiKey;
|
|
17
61
|
this.apiSecret = apiSecret;
|
|
@@ -27,60 +71,16 @@ class $e666bfa8019d90ff$export$5a82ec1641dd9681 {
|
|
|
27
71
|
port: port
|
|
28
72
|
};
|
|
29
73
|
}
|
|
30
|
-
prepareHeader = (body)=>{
|
|
31
|
-
const signature = (0, $gvjLo$createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
32
|
-
const headers = {
|
|
33
|
-
"Content-Type": "application/json",
|
|
34
|
-
"API-KEY": this.apiKey,
|
|
35
|
-
"HASH-SIGNATURE": signature
|
|
36
|
-
};
|
|
37
|
-
return headers;
|
|
38
|
-
};
|
|
39
|
-
sendRequest = async (path, body)=>{
|
|
40
|
-
return new Promise((resolve)=>{
|
|
41
|
-
const output = {
|
|
42
|
-
status: false,
|
|
43
|
-
response: undefined
|
|
44
|
-
};
|
|
45
|
-
const chunk = JSON.stringify(body);
|
|
46
|
-
const options = {
|
|
47
|
-
...this.mainOptions
|
|
48
|
-
};
|
|
49
|
-
options.path += path;
|
|
50
|
-
options.headers = this.prepareHeader(chunk);
|
|
51
|
-
const req = (this.isSecure ? (0, $gvjLo$https) : (0, $gvjLo$http)).request(options, (res)=>{
|
|
52
|
-
const body = [];
|
|
53
|
-
res.on("data", (chunk)=>body.push(chunk));
|
|
54
|
-
res.on("end", ()=>{
|
|
55
|
-
const resString = $e666bfa8019d90ff$require$Buffer.concat(body).toString();
|
|
56
|
-
try {
|
|
57
|
-
output.status = true;
|
|
58
|
-
output.response = JSON.parse(resString);
|
|
59
|
-
} catch (error) {
|
|
60
|
-
output.status = false;
|
|
61
|
-
output.response = error;
|
|
62
|
-
}
|
|
63
|
-
resolve(output);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
req.on("error", (error)=>{
|
|
67
|
-
output.response = error.message;
|
|
68
|
-
resolve(output);
|
|
69
|
-
});
|
|
70
|
-
req.write(chunk);
|
|
71
|
-
req.end();
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
class $cdaf723153ba18be$export$1402da7f2870faee {
|
|
78
|
-
defaultPath = "/auth";
|
|
79
78
|
/**
|
|
80
79
|
* @param serverUrl plugNmeet server URL
|
|
81
80
|
* @param apiKey plugNmeet API_Key
|
|
82
81
|
* @param apiSecret plugNmeet API_Secret
|
|
83
82
|
*/ constructor(serverUrl, apiKey, apiSecret){
|
|
83
|
+
this.defaultPath = "/auth";
|
|
84
84
|
this.apiTransport = new (0, $e666bfa8019d90ff$export$5a82ec1641dd9681)(serverUrl + this.defaultPath, apiKey, apiSecret);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -242,4 +242,4 @@ class $cdaf723153ba18be$export$1402da7f2870faee {
|
|
|
242
242
|
|
|
243
243
|
|
|
244
244
|
export {$cdaf723153ba18be$export$1402da7f2870faee as PlugNmeet};
|
|
245
|
-
//# sourceMappingURL=PlugNmeet.mjs.map
|
|
245
|
+
//# sourceMappingURL=PlugNmeet.mjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAA,GAAA,iBAAS,EAAE,UAAU,IAAI,CAAC,WACzC,OAAO,MACP,OAAO;YAEV,MAAM,UAAU;gBACd,gBAAgB;gBAChB,WAAW,IAAI,CAAC;gBAChB,kBAAkB;YACpB;YAEA,OAAO;QACT;aAEO,cAAc,OAAO,MAAc;YACxC,OAAO,IAAI,QAAqB,CAAC;gBAC/B,MAAM,SAAsB;oBAC1B,QAAQ;oBACR,UAAU;gBACZ;gBAEA,MAAM,QAAQ,KAAK,UAAU;gBAE7B,MAAM,UAAU;oBAAE,GAAG,IAAI,CAAC,WAAW;gBAAC;gBACtC,QAAQ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S;QACzB;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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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","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:' ?? 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 const headers = {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n\n return headers;\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.mjs.js.map"}
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ type RoomFeaturesParams = {
|
|
|
29
29
|
breakout_room_features?: BreakoutRoomFeatures;
|
|
30
30
|
display_external_link_features?: DisplayExternalLinkFeatures;
|
|
31
31
|
ingress_features?: IngressFeatures;
|
|
32
|
+
speech_to_text_translation_features?: SpeechToTextTranslationFeatures;
|
|
33
|
+
end_to_end_encryption_features?: EndToEndEncryptionFeatures;
|
|
32
34
|
};
|
|
33
35
|
type RecordingFeaturesParams = {
|
|
34
36
|
is_allow: boolean;
|
|
@@ -64,6 +66,13 @@ type DisplayExternalLinkFeatures = {
|
|
|
64
66
|
type IngressFeatures = {
|
|
65
67
|
is_allow: boolean;
|
|
66
68
|
};
|
|
69
|
+
type SpeechToTextTranslationFeatures = {
|
|
70
|
+
is_allow: boolean;
|
|
71
|
+
is_allow_translation: boolean;
|
|
72
|
+
};
|
|
73
|
+
type EndToEndEncryptionFeatures = {
|
|
74
|
+
is_enabled: boolean;
|
|
75
|
+
};
|
|
67
76
|
type LockSettingsParams = {
|
|
68
77
|
lock_microphone?: boolean;
|
|
69
78
|
lock_webcam?: boolean;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACAA,wBAA+B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,mBAA0B;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,kBAAkB,CAAC;IAClC,qBAAqB,CAAC,EAAE,kBAAkB,CAAC;CAC5C,CAAC;AAEF,0BAAiC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,wBAAwB,EAAE,OAAO,CAAC;IAClC,2BAA2B,EAAE,OAAO,CAAC;IACrC,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,aAAa,EAAE,kBAAkB,CAAC;IAClC,wBAAwB,CAAC,EAAE,2BAA2B,CAAC;IACvD,mBAAmB,CAAC,EAAE,wBAAwB,CAAC;IAC/C,8BAA8B,CAAC,EAAE,2BAA2B,CAAC;IAC7D,qBAAqB,CAAC,EAAE,mBAAmB,CAAC;IAC5C,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ACvB,OAAO,CAAC,kBAAkB,CAAC;IAgB9B;;;;OAIG;IACU,YAAY,CACvB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,iBAAiB,CAAC;IAmB7B;;;;OAIG;IACU,YAAY,CACvB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,oBAAoB,CAAC;IAkBhC;;;;OAIG;IACU,iBAAiB,CAC5B,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,sBAAsB,CAAC;IAmBlC;;;OAGG;IACU,kBAAkB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAmBnE;;;;OAIG;IACU,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;IAerE;;;;OAIG;IACU,eAAe,CAC1B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,uBAAuB,CAAC;IAmBnC;;;;OAIG;IACU,gBAAgB,CAC3B,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,wBAAwB,CAAC;IAkBpC;;OAEG;IACU,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAiB3D;;;;OAIG;IACU,yBAAyB,CACpC,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,8BAA8B,CAAC;CAkB3C","sources":["src/src/ApiTransport.ts","src/src/types/createRoom.ts","src/src/types/joinToken.ts","src/src/types/isRoomActive.ts","src/src/types/activeRoomInfo.ts","src/src/types/activeRoomsInfo.ts","src/src/types/endRoom.ts","src/src/types/fetchRecordings.ts","src/src/types/deleteRecordings.ts","src/src/types/RecordingDownloadToken.ts","src/src/types/clientFiles.ts","src/src/PlugNmeet.ts","src/PlugNmeet.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,"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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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"],"names":[],"version":3,"file":"index.d.ts.map"}
|
|
1
|
+
{"mappings":"ACAA,wBAA+B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,mBAA0B;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,kBAAkB,CAAC;IAClC,qBAAqB,CAAC,EAAE,kBAAkB,CAAC;CAC5C,CAAC;AAEF,0BAAiC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,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AC;IAkBpC;;OAEG;IACU,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAiB3D;;;;OAIG;IACU,yBAAyB,CACpC,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,8BAA8B,CAAC;CAkB3C","sources":["src/src/ApiTransport.ts","src/src/types/createRoom.ts","src/src/types/joinToken.ts","src/src/types/isRoomActive.ts","src/src/types/activeRoomInfo.ts","src/src/types/activeRoomsInfo.ts","src/src/types/endRoom.ts","src/src/types/fetchRecordings.ts","src/src/types/deleteRecordings.ts","src/src/types/RecordingDownloadToken.ts","src/src/types/clientFiles.ts","src/src/PlugNmeet.ts","src/PlugNmeet.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,"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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plugnmeet-sdk-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "plugNmeet JS SDK",
|
|
5
5
|
"author": "Jibon L. Costa",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "https://github.com/mynaparrot/plugNmeet-sdk-js",
|
|
8
8
|
"source": "src/PlugNmeet.ts",
|
|
9
|
-
"main": "dist/PlugNmeet.cjs",
|
|
10
|
-
"module": "dist/PlugNmeet.mjs",
|
|
9
|
+
"main": "dist/PlugNmeet.cjs.js",
|
|
10
|
+
"module": "dist/PlugNmeet.mjs.js",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@parcel/packager-ts": "^2.
|
|
32
|
-
"@parcel/transformer-typescript-types": "^2.
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
|
35
|
-
"@typescript-eslint/parser": "5.59.
|
|
36
|
-
"concurrently": "8.0
|
|
37
|
-
"eslint": "8.
|
|
31
|
+
"@parcel/packager-ts": "^2.9.2",
|
|
32
|
+
"@parcel/transformer-typescript-types": "^2.9.2",
|
|
33
|
+
"@types/node": "^20.3.1",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "5.59.11",
|
|
35
|
+
"@typescript-eslint/parser": "5.59.11",
|
|
36
|
+
"concurrently": "8.2.0",
|
|
37
|
+
"eslint": "8.42.0",
|
|
38
38
|
"eslint-config-prettier": "8.8.0",
|
|
39
39
|
"eslint-plugin-prettier": "4.2.1",
|
|
40
40
|
"eslint-watch": "8.0.0",
|
|
41
|
-
"parcel": "^2.
|
|
42
|
-
"prettier": "2.8.
|
|
43
|
-
"typedoc": "0.24.
|
|
44
|
-
"typescript": "5.
|
|
41
|
+
"parcel": "^2.9.2",
|
|
42
|
+
"prettier": "2.8.8",
|
|
43
|
+
"typedoc": "0.24.8",
|
|
44
|
+
"typescript": "5.1.3"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/dist/PlugNmeet.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;ACAA;;;;;AASO,MAAM;IAKH,WAAW,KAAK,CAAC;IACjB,cAA8B,CAAC,EAAE;IAEzC,YAAY,cAAsB,EAAE,MAAc,EAAE,SAAiB,CAAE;QACrE,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,SAAS,GAAG;QAEjB,MAAM,MAAM,IAAI,IAAI;QACpB,IAAI,OAAO,IAAI,QAAQ,KAAK,WAAW,MAAM,EAAE;QAC/C,IAAI,CAAC,QAAQ,GAAG,CAAA,IAAI,QAAQ,KAAK,QAAO,KAAK,KAAK;QAElD,gCAAgC;QAChC,IAAI,IAAI,IAAI,EACV,OAAO,OAAO,IAAI,IAAI;QAGxB,IAAI,CAAC,WAAW,GAAG;YACjB,UAAU,IAAI,QAAQ;YACtB,MAAM,IAAI,QAAQ;YAClB,QAAQ;kBACR;QACF;IACF;IAEQ,gBAAgB,CAAC,OAAiB;QACxC,MAAM,YAAY,CAAA,GAAA,wBAAS,EAAE,UAAU,IAAI,CAAC,SAAS,EAClD,MAAM,CAAC,MACP,MAAM,CAAC;QAEV,MAAM,UAAU;YACd,gBAAgB;YAChB,WAAW,IAAI,CAAC,MAAM;YACtB,kBAAkB;QACpB;QAEA,OAAO;IACT,EAAE;IAEK,cAAc,OAAO,MAAc,OAAc;QACtD,OAAO,IAAI,QAAqB,CAAC,UAAY;YAC3C,MAAM,SAAsB;gBAC1B,Q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QAC1B;IACF;IAEA;;GAEC,GACD,MAAa,iBAA+C;QAC1D,MAAM,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,mBAAmB,CAAC;QACvE,IAAI,CAAC,OAAO,MAAM,EAChB,OAAO;YACL,QAAQ,KAAK;YACb,KAAK,OAAO,QAAQ;QACtB;QAGF,OAAO;YACL,QAAQ,OAAO,QAAQ,CAAC,MAAM;YAC9B,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,IAAI,OAAO,QAAQ,CAAC,EAAE;QACxB;IACF;IAEA;;;;GAIC,GACD,MAAa,0BACX,MAAoC,EACK;QACzC,MAAM,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAChD,+BACA;QAEF,IAAI,CAAC,OAAO,MAAM,EAChB,OAAO;YACL,QAAQ,KAAK;YACb,KAAK,OAAO,QAAQ;QACtB;QAGF,OAAO;YACL,QAAQ,OAAO,QAAQ,CAAC,MAAM;YAC9B,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,OAAO,OAAO,QAAQ,CAAC,KAAK;QAC9B;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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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","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:' ?? 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 const headers = {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n\n return headers;\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.map"}
|
package/dist/PlugNmeet.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;ACAA;;;;;AASO,MAAM;IAKH,WAAW,KAAK,CAAC;IACjB,cAA8B,CAAC,EAAE;IAEzC,YAAY,cAAsB,EAAE,MAAc,EAAE,SAAiB,CAAE;QACrE,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,SAAS,GAAG;QAEjB,MAAM,MAAM,IAAI,IAAI;QACpB,IAAI,OAAO,IAAI,QAAQ,KAAK,WAAW,MAAM,EAAE;QAC/C,IAAI,CAAC,QAAQ,GAAG,CAAA,IAAI,QAAQ,KAAK,QAAO,KAAK,KAAK;QAElD,gCAAgC;QAChC,IAAI,IAAI,IAAI,EACV,OAAO,OAAO,IAAI,IAAI;QAGxB,IAAI,CAAC,WAAW,GAAG;YACjB,UAAU,IAAI,QAAQ;YACtB,MAAM,IAAI,QAAQ;YAClB,QAAQ;kBACR;QACF;IACF;IAEQ,gBAAgB,CAAC,OAAiB;QACxC,MAAM,YAAY,CAAA,GAAA,iBAAS,EAAE,UAAU,IAAI,CAAC,SAAS,EAClD,MAAM,CAAC,MACP,MAAM,CAAC;QAEV,MAAM,UAAU;YACd,gBAAgB;YAChB,WAAW,IAAI,CAAC,MAAM;YACtB,kBAAkB;QACpB;QAEA,OAAO;IACT,EAAE;IAEK,cAAc,OAAO,MAAc,OAAc;QACtD,OAAO,IAAI,QAAqB,CAAC,UAAY;YAC3C,MAAM,SAAsB;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,GAAG;QAC1B;IACF;IAEA;;GAEC,GACD,MAAa,iBAA+C;QAC1D,MAAM,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,mBAAmB,CAAC;QACvE,IAAI,CAAC,OAAO,MAAM,EAChB,OAAO;YACL,QAAQ,KAAK;YACb,KAAK,OAAO,QAAQ;QACtB;QAGF,OAAO;YACL,QAAQ,OAAO,QAAQ,CAAC,MAAM;YAC9B,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,IAAI,OAAO,QAAQ,CAAC,EAAE;QACxB;IACF;IAEA;;;;GAIC,GACD,MAAa,0BACX,MAAoC,EACK;QACzC,MAAM,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAChD,+BACA;QAEF,IAAI,CAAC,OAAO,MAAM,EAChB,OAAO;YACL,QAAQ,KAAK;YACb,KAAK,OAAO,QAAQ;QACtB;QAGF,OAAO;YACL,QAAQ,OAAO,QAAQ,CAAC,MAAM;YAC9B,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,OAAO,OAAO,QAAQ,CAAC,KAAK;QAC9B;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';\n\nexport class PlugNmeet {\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: CreateRoomParams\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 roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params: JoinTokenParams\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: IsRoomActiveParams\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 msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params: ActiveRoomInfoParams\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 * End active room\n * @param params: EndRoomParams\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 recordings\n * @param params: FetchRecordingsParams\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: DeleteRecordingsParams\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 * @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 /**\n * Generate token to download recording\n * @param params: RecordingDownloadTokenParams\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","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:' ?? 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 const headers = {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n\n return headers;\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.mjs.map"}
|