Git Product home page Git Product logo

b-cho / galeforce Goto Github PK

View Code? Open in Web Editor NEW
41.0 2.0 9.0 4.52 MB

A customizable, promise-based, and command-oriented TypeScript fluent interface and library for the Riot Games API.

Home Page: https://b-cho.github.io/galeforce/

License: Apache License 2.0

TypeScript 66.12% JavaScript 33.88%
leagueoflegends league-of-legends nodejs javascript typescript nodejs-library es6 riot-games typescript-library redis

galeforce's People

Contributors

b-cho avatar dependabot[bot] avatar xecez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

galeforce's Issues

export all interfaces instead of just the 'top' interface

Hey,

could you change all the .d.ts files to export all interfaces? There are two reasons why I think this would be a good change:

  1. you could go from this: foo(match.info : any) to foo(match.info : Info) This has two advantages: first type safety and second enabling auto complete for the properties of Info in the method. I know you could also just always pass the entire match to any function. however i think thats kind of unnecessary.
  2. you could create a variable in a type safe way without having to define them right away. So instead of let matchInfo: any; you could write matchInfo : Info; This comes with the same adantages as the first reason.

Requests hang when cache set to redis

Description
When trying to make any request, the request will hang if the client's cache is set to redis.

Reproduction Steps

  1. Set rate limit cache to use redis
  2. Make any request to Riot's API

Expected/Actual behavior
The client to connect properly to the redis cache and execute the requests.

Additional Information
Here is the config I use:

{
  'riot-api': { key: 'XXXXXXXX' },
  'rate-limit': {
    type: 'bottleneck',
    cache: {
      type: 'redis',
      uri: 'redis://127.0.0.1:6379',
      'key-id': 'galeforce'
    },
    options: {
      intervals: [Object],
      'max-concurrent': null,
      'min-time': 0,
      'retry-count-after-429': 3
    }
  },
  debug: [ 'all' ]
}

Note that when setting the cache to internal, everything runs fine. Also, my redis server (Redis version=5.0.8, bits=64) is running and accessible through the passed URI. I've also tried setting the database in the URI as follows: redis://127.0.0.1:6379/0, but that didn't help.

galeforce_1.default is not a constructor

Hey,

I'd realy like to use this. However when I try to create a new instace of the GaleforceModule I get the error galeforce_1.default is not a constructor

I alreay tried adding "esModuleInterop": true, to my tsconfig. But it didnt help.
I am importing the module like so import GaleforceModule from "galeforce";
Here is my tsconfig.json:

  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "noImplicitOverride": true,
    "noPropertyAccessFromIndexSignature": true,
    "esModuleInterop": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2017",
    "module": "commonjs",
    "lib": [
      "es2020",
      "dom"
    ],
    "allowSyntheticDefaultImports": true,
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  }
}

Export private interfaces

When trying to separate code into multiple functions using typescript it is sometimes not possible to define the type of arguments because Galeforce does not export all interfaces. An example:

const match = getMatch(matchId) // MatchDTO from galeforce
for (const p of match.data.info.participants){
    const runeData = getRuneData(p)
    ...
}
...

// Here I can't define the type because the Participant type is not exported.
const getRuneData = (participant: ?): string[] => {
    ...
}

Simply exporting all interfaces would solve this issue.
If you don't want to do this (let's be honest it's a really boring task) but think it is a good idea I can create a PR with the changes.

Module not found: Can't resolve 'console'

Description
I set up my project using create-react-app and installed Galeforce, but when I try to import the package I get an error in the terminal: Module not found: Can't resolve 'console' in 'D:\Projects\LoLTest\node_modules\ts-node\dist'.

Reproduction Steps

  1. Create a new project by running the command npx create-react-app LoLTest
  2. In the project directory, install Galeforce by running npm i galeforce
  3. In the App.js file, import Galeforce using the following code:
    import GaleforceModule from 'galeforce';
  4. Run npm start and the page will fail to display due to the compile error described above

Specifications (please complete the following information):

  • OS: Windows

Upcoming match-v4 deprecation

All match-v4 endpoints will be deprecated on August 23, 2021 in compliance with Riot's 60-day deprecation timer and the upcoming release of the match-v5 endpoints. galeforce.lol.match will need to be rewritten in a manner that limits breaking changes and associated documentation within the project's README and docblocks will need to be updated accordingly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.