Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-rally

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-rally - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

5

dist/exceptions/InvalidCredentials.js

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class InvalidCredentials extends Error {
export default class InvalidCredentials extends Error {
}
exports.default = InvalidCredentials;

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ProtectedValue extends Error {
export default class ProtectedValue extends Error {
}
exports.default = ProtectedValue;

7

dist/index.d.ts

@@ -1,4 +0,5 @@

declare const Twitch: any;
declare const StreamRally: {
Twitch: any;
import Twitch from './services/Twitch';
declare const _default: {
Twitch: typeof Twitch;
};
export default _default;

@@ -1,6 +0,4 @@

"use strict";
const Twitch = require('./services/Twitch');
const StreamRally = {
import Twitch from './services/Twitch';
export default {
Twitch,
};
module.exports = StreamRally;

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Twitch_1 = __importDefault(require("./services/Twitch"));
const chai_1 = require("chai");
import Twitch from './services/Twitch';
import { expect } from 'chai';
describe('Twitch Service', () => {
xit('Should get stream shroud and NICKMERCS', () => {
const twitch = new Twitch_1.default('mcqijt1d0a7vigass8xf2hzfqz1s2i', '6oyzr36m00fiw13y3iwymdc31pixlf');
const twitch = new Twitch('mcqijt1d0a7vigass8xf2hzfqz1s2i', '6oyzr36m00fiw13y3iwymdc31pixlf');
return twitch.getStreams([

@@ -16,3 +11,3 @@ 'shroud',

console.log(streams);
return chai_1.expect(streams[0].displayName()).to.equal('shroud');
return expect(streams[0].displayName()).to.equal('shroud');
})

@@ -24,3 +19,3 @@ .catch((err) => {

it('Should get Aion', () => {
const twitch = new Twitch_1.default('mcqijt1d0a7vigass8xf2hzfqz1s2i', '6oyzr36m00fiw13y3iwymdc31pixlf');
const twitch = new Twitch('mcqijt1d0a7vigass8xf2hzfqz1s2i', '6oyzr36m00fiw13y3iwymdc31pixlf');
return twitch.getStreamsByGame('Aion')

@@ -27,0 +22,0 @@ .then((streams) => {

@@ -1,8 +0,3 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const InvalidCredentials_1 = __importDefault(require("../exceptions/InvalidCredentials"));
const axios_1 = __importDefault(require("axios"));
import InvalidCredentials from '../exceptions/InvalidCredentials';
import Axios from 'axios';
class TwitchAPI {

@@ -13,3 +8,3 @@ constructor(clientId, clientSecret) {

this.request = () => {
return axios_1.default.create({
return Axios.create({
baseURL: 'https://api.twitch.tv/helix',

@@ -70,3 +65,3 @@ headers: {

if (clientId === '' || clientSecret === '') {
throw new InvalidCredentials_1.default('Invalid clientId or clientSecret.');
throw new InvalidCredentials('Invalid clientId or clientSecret.');
}

@@ -77,2 +72,2 @@ this.clientId = clientId;

}
exports.default = TwitchAPI;
export default TwitchAPI;

@@ -1,5 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Service {
}
exports.default = Service;
export default Service;

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Service_1 = __importDefault(require("./Service"));
const TwitchAPI_1 = __importDefault(require("../lib/TwitchAPI"));
const TwitchObject_1 = __importDefault(require("../StreamObjects/TwitchObject"));
const lodash_1 = require("lodash");
class Twitch extends Service_1.default {
import Service from './Service';
import TwitchAPI from '../lib/TwitchAPI';
import TwitchObject from '../StreamObjects/TwitchObject';
import { uniq } from 'lodash';
class Twitch extends Service {
constructor(clientId, clientSecret) {

@@ -23,2 +18,3 @@ super();

const userIds = streams.map((stream) => stream.user_id);
console.log(userIds);
return Promise.all([

@@ -28,6 +24,8 @@ this.api.getUsers(userIds),

]).then((result) => {
console.log('result', result);
const users = result[0];
console.log(users);
const followers = result[1];
return streams.map((stream, key) => {
return new TwitchObject_1.default({
return new TwitchObject({
stream,

@@ -50,3 +48,3 @@ // ts-ignore

const users = result[1].data;
let calls = [this.api.getGamesById(lodash_1.uniq(streams.map(stream => stream.game_id)))];
let calls = [this.api.getGamesById(uniq(streams.map(stream => stream.game_id)))];
const userIds = users.map((user) => {

@@ -62,3 +60,3 @@ return this.api.getNumFollowers(user.id);

return streams.map((stream, key) => {
return new TwitchObject_1.default({
return new TwitchObject({
stream,

@@ -74,5 +72,5 @@ // @ts-ignore

};
this.api = new TwitchAPI_1.default(clientId, clientSecret);
this.api = new TwitchAPI(clientId, clientSecret);
}
}
exports.default = Twitch;
export default Twitch;

@@ -1,8 +0,3 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("underscore");
const ProtectedValue_1 = __importDefault(require("../exceptions/ProtectedValue"));
import _ from 'lodash';
import ProtectedValue from '../exceptions/ProtectedValue';
class StreamObject {

@@ -86,3 +81,3 @@ /**

if (key in this.guardedMembers) {
throw new ProtectedValue_1.default();
throw new ProtectedValue();
}

@@ -139,2 +134,2 @@ else {

}
exports.default = StreamObject;
export default StreamObject;

@@ -1,8 +0,3 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const StreamObject_1 = __importDefault(require("./StreamObject"));
class TwitchObject extends StreamObject_1.default {
import StreamObject from './StreamObject';
class TwitchObject extends StreamObject {
constructor(streamData) {

@@ -29,2 +24,2 @@ super(streamData);

}
exports.default = TwitchObject;
export default TwitchObject;

@@ -1,6 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const validServices = [
'twitch',
];
exports.default = validServices;
export default validServices;
{
"name": "stream-rally",
"version": "1.0.3",
"version": "1.0.4",
"description": "A Node.js module to aggregate (or rally) and manipulate streams from different services into a single list.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc