tilework / opus Goto Github PK
View Code? Open in Web Editor NEWLightweight and convenient builder-based strictly-typed GraphQL client
Lightweight and convenient builder-based strictly-typed GraphQL client
Currently, when an array-like field is getting created, it is necessary to pass an additional argument to the creation process:
const people = new Query('people', true)
.addField('friends', true)
.addField(new Field('parents', true)
.addField('gender')
.addField('age')
);
const result = await client.post(people);
result[0].friends[0];
result[0].parents[0].gender;
result[0].parents[0].age;
In the ideal world, this is handled completely automatically.
Brief mockup:
Native fetch accepts much more options than just an URL and headers.
If we add full options, we'll be able to use AbortController for example which is the right way of cancelling requests on the web.
Opus has started as a lightweight GraphQL client for the plugin system. It has proven itself very useful before, when being a part of the ScandiPWA technology.
The main feature that separates this package from the ScandiPWA implementation are typings.
Though, it is not yet clear how to extend the types of these queries. Opus has no idea about the plugin system, and if some query has additional fields coming from the plugins - they will not be respected by Opus typings.
In Opus, queries are built as objects and then serialized into a graphql document.
The serialization process, although is pretty fast already, can be improved with memoization, at least partly.
When having a query for e.g. product, one will fetch it several times for different products with different arguments, but the query itself will remain the same. Hence, when re-fetching a query, it will be necessary to:
Such a change will bring some additional bundle size. It is required to take a weighted decision on whether such an improvement in performance is worth it. The bundle size growth must be minimal.
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.