Giter Site home page Giter Site logo

tilde-lab / optimade-client Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 533 KB

Isomorphic TypeScript / JavaScript client to aggregate all the official Optimade providers

Home Page: https://optimade.science

License: MIT License

JavaScript 25.30% TypeScript 74.70%
materials materials-science materials-informatics materials-design materials-genome materials-platform materials-discoveries materials-discovery chemoinformatics optimade

optimade-client's People

Contributors

blokhin avatar dxpm avatar paulmaly avatar valexr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lgtm-migrator

optimade-client's Issues

Prefetch does not work (but then works)

$ node prefetch.js
C:\cygwin64\home\Evgeny\basf\bscience-gui\node_modules\optimade\prefetch.js:24
        const source = Object.keys(optimade.providers).sort().reduce(
                              ^

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at C:\cygwin64\home\Evgeny\basf\bscience-gui\node_modules\optimade\prefetch.js:24:24
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

re-running helps

optimade.prefetch() method

Add optimade.prefetch() method to make custom local cache

const optimade = new Optimade({
  providersUrl: "https://providers.optimade.org/providers.json",
});

optimade.prefetch({
  pathWithFileName: './prefetch.json', 
  excludeProviders: [''],
  batch: false
})

pathWithFileName - path to file output filename.json location
excludeProviders - array for exclude providers from cache
batch - portion statusable prefetching

Set HTTP `User-Agent` header for `isomorphic-unfetch`

It is usually very nice when software presents itself in the HTTP User-Agent header. Web browsers almost always present themselves in a verbose but neat way. This way the server-side developers are informed about what software makes requests to their servers, and may occasionally forward common issues to the client developers. Moreover, usage statistics could be drawn at the server-size, which is nice.

optimade-client seems to be using JS isomorphic-unfetch package for HTTP requests. By default its User-Agent is node-fetch/<version> (+https://github.com/bitinn/node-fetch). Changing this should not be difficult. It would be nice to see tilde-lab-optimade-client/<version> (or something similar) at least.

If user privacy is concern, it should be kept in mind that this is F/LOSS, thus anyone concerned with their privacy are free to patch their copy of the client to their liking.

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.