@akkadu/rsi-api-base
Advanced tools
Comparing version 0.2.4 to 0.2.7
export default class Base { | ||
emitter: any; | ||
constructor(); | ||
gatewayRequest(apiKey: string, roomName: string): { | ||
auth: { | ||
uid: number; | ||
channel: string; | ||
appId: string; | ||
token: string; | ||
rtmToken: string; | ||
}; | ||
publishers: { | ||
id: number; | ||
userId: number; | ||
eventId: number; | ||
pairId: string; | ||
interpreterId: number; | ||
language: string; | ||
sourceLanguage: boolean; | ||
sourceLanguageId: number; | ||
interpreterLevel: number; | ||
interpreterNeeded: boolean; | ||
createdAt: string; | ||
updatedAt: string; | ||
}[]; | ||
floorLang: string; | ||
userType: string; | ||
}; | ||
gatewayRequest(apiKey: string, roomName: string): Promise<{ | ||
stream: any; | ||
languageState: any; | ||
eventLanguages: any; | ||
}>; | ||
on(event: any, fn: any): void; | ||
} |
131
lib/index.js
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var events_1 = require("events"); | ||
/* const axios = require('axios') */ | ||
var Base = /** @class */ (function () { | ||
@@ -9,59 +46,41 @@ function Base() { | ||
Base.prototype.gatewayRequest = function (apiKey, roomName) { | ||
if (!apiKey) { | ||
throw Error('base akadu-rsi: apiKey is undefined.'); | ||
} | ||
if (!roomName) { | ||
throw Error('base akkadu-rsi: roomname is undefined.'); | ||
} | ||
// we get the stream /events/{eventId}/streams | ||
var streamTest = { | ||
"auth": { | ||
"uid": 0, | ||
"channel": "string", | ||
"appId": "string", | ||
"token": "string", | ||
"rtmToken": "string" | ||
}, | ||
"publishers": [ | ||
{ | ||
"id": 0, | ||
"userId": 0, | ||
"eventId": 0, | ||
"pairId": "string", | ||
"interpreterId": 0, | ||
"language": "string", | ||
"sourceLanguage": true, | ||
"sourceLanguageId": 0, | ||
"interpreterLevel": 0, | ||
"interpreterNeeded": true, | ||
"createdAt": "2021-05-25T07:49:48.840Z", | ||
"updatedAt": "2021-05-25T07:49:48.840Z" | ||
var _a, _b, _c; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var eventRequest, eventId, streamRequest, eventLanguagesRequest, eventLanguageState, stream, eventLanguages, languageState; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
if (!apiKey) { | ||
throw Error('base akadu-rsi: apiKey is undefined.'); | ||
} | ||
if (!roomName) { | ||
throw Error('base akkadu-rsi: roomName is undefined.'); | ||
} | ||
return [4 /*yield*/, fetch("https://devapi.akkadu.com/v2/events/?roomName=" + roomName)]; | ||
case 1: return [4 /*yield*/, (_d.sent()).json()]; | ||
case 2: | ||
eventRequest = _d.sent(); | ||
eventId = (_c = (_b = (_a = eventRequest === null || eventRequest === void 0 ? void 0 : eventRequest.data) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id; | ||
if (!eventId) { | ||
throw Error('no eventId for this event'); | ||
} | ||
return [4 /*yield*/, fetch("https://devapi.akkadu.com/v2/events/" + eventId + "/streams")]; | ||
case 3: return [4 /*yield*/, (_d.sent()).json()]; | ||
case 4: | ||
streamRequest = _d.sent(); | ||
return [4 /*yield*/, (fetch("https://devapi.akkadu.com/v2/events/" + eventId + "/languages"))]; | ||
case 5: return [4 /*yield*/, (_d.sent()).json()]; | ||
case 6: | ||
eventLanguagesRequest = _d.sent(); | ||
return [4 /*yield*/, (fetch("https://devapi.akkadu.com/v2/language-state?roomname=" + roomName))]; | ||
case 7: return [4 /*yield*/, (_d.sent()).json()]; | ||
case 8: | ||
eventLanguageState = _d.sent(); | ||
stream = streamRequest === null || streamRequest === void 0 ? void 0 : streamRequest.data; | ||
eventLanguages = eventLanguagesRequest === null || eventLanguagesRequest === void 0 ? void 0 : eventLanguagesRequest.data.languages; | ||
languageState = eventLanguageState === null || eventLanguageState === void 0 ? void 0 : eventLanguageState.data.languageState; | ||
return [2 /*return*/, { stream: stream, languageState: languageState, eventLanguages: eventLanguages }]; | ||
} | ||
], | ||
"floorLang": "en-US", | ||
"userType": "string" | ||
}; | ||
var eventTest = { | ||
bio: null, | ||
countryCode: null, | ||
createdAt: "2020-10-09T04:07:43.879Z", | ||
endDate: "2021-05-13T15:07:00.000Z", | ||
eventUrl: null, | ||
id: 2545, | ||
isActive: true, | ||
isAkkaduEvent: true, | ||
isPrivate: false, | ||
language: null, | ||
location: null, | ||
name: "testApi2", | ||
pdfUrl: null, | ||
posterUrl: null, | ||
roomName: "pkmj", | ||
startDate: "2021-05-12T21:07:00.000Z", | ||
tagIds: [4], | ||
timeZone: null, | ||
updatedAt: "2021-05-13T04:52:47.934Z", | ||
userId: 622 | ||
}; | ||
return streamTest; | ||
}); | ||
}); | ||
}; | ||
@@ -68,0 +87,0 @@ Base.prototype.on = function (event, fn) { |
{ | ||
"name": "@akkadu/rsi-api-base", | ||
"version": "0.2.4", | ||
"version": "0.2.7", | ||
"description": "", | ||
@@ -22,9 +22,11 @@ "main": "lib/index.js", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"dependencies": { | ||
"@akkadu/browser-info": "^2.5.3", | ||
"prettier": "^2.3.0", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.2.4" | ||
"typescript": "^4.2.4", | ||
"ua-parser-js": "^0.7.21" | ||
}, | ||
"gitHead": "e823373a0ae159cdce61912c6ce5e5940b6ce802" | ||
"gitHead": "97db53df4dbc121b78b67dac7a3bf434b1e3db3f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6943
0
6
101
4
+ Added@akkadu/browser-info@^2.5.3
+ Addedprettier@^2.3.0
+ Addedtslint@^6.1.3
+ Addedtypescript@^4.2.4
+ Addedua-parser-js@^0.7.21
+ Added@akkadu/browser-info@2.5.3(transitive)
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbuiltin-modules@1.1.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddiff@4.0.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedprettier@2.8.8(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedtslint@6.1.3(transitive)
+ Addedtslint-config-prettier@1.18.0(transitive)
+ Addedtsutils@2.29.0(transitive)
+ Addedtypescript@4.9.5(transitive)
+ Addedua-parser-js@0.7.39(transitive)
+ Addedwrappy@1.0.2(transitive)