tilde-lab / optimade-client Goto Github PK
View Code? Open in Web Editor NEWIsomorphic TypeScript / JavaScript client to aggregate all the official Optimade providers
Home Page: https://optimade.science
License: MIT License
Isomorphic TypeScript / JavaScript client to aggregate all the official Optimade providers
Home Page: https://optimade.science
License: MIT License
By experience, many Optimade instances now support CORS header, so proxy usage may be not needed anymore. We should refuse of it gradually.
This is needed to expose the properties:
to the client users, cf. tilde-lab/optimade.science#21
$ 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
e.g. like this:
#!/usr/bin/env node
const fs = require('fs');
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
Now done by prefetch.js
with each new release at the npm. This is suboptimal.
Currently it's const results = await optimadeClient.getStructuresAll(providerIds, YOUR_OPTIMADE_QUERY);
which leads to a bottleneck described in tilde-lab/optimade.science#30
We need to design a non-blocking way to receive the results.
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.
Currently the requests are not aborted via the timeout, this should be achieved with the AbortController.
const providerArray = Object.values(providersMap);
^
TypeError: Cannot convert undefined or null to object
As mentioned in tilde-lab/optimade.science#31 there might be various status codes possible, however the client is unaware of them...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.