npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

graphjql

v1.1.4

Published

Revisited and full JS(ON) implementation of GraphQL

Downloads

63

Readme

graphjql

Pure JS(ON) revisitation of GraphQL designed to run on a PostgreSQL and Redis clustered environment.

Don't try this at home.

todo / ideas / brainstorming

q()

Shall $op be always explicit or can it be deducted? (think in Form<add|edit> and Component logic) . get when !$values && $where . add when $values && !$where . edit when $values && $where . remove when $op(remove) => this sucks! . push/pushSync . pop/popSync

add/edit in place with return push/pop in place with return collision detect: if a=>c and b=>c I can not remove "c" hence destroying both a=>c and b=>c (maybe domain logic?) whereMiddlewares: user $token handling to check the root node

redis caching

cache(path): cache the query using the json encoded query as key; when path=>value changes entry is removed from cache how to cache sub branches? scenario: user[id=$token]=>A=>B=>C and just C really changes solution: . using q([query]) + $use(label) . queries are executed sequentially . first queries are always the same so cache is never invalidated . last query uses $use which interpolates $where values using the previous queries array of results ($where: { id: { $use: userQ.id } })

hop jump

. user => tokens => feeds . I need feed descendant of user[id=x] . beings feeds required and logically pushed just for one token . mi ritrovo con tokens che è un array in cui solo un array ha senso . $alimit e $required applicato sulla table association cosi user.tokens è un oggetto e user.tokens.feeds anche, poi con $map prendi solo ultimo

qui si profila l'uso di un limit(map) applicato alle rel; limit=1 l'association feeds e automaticamente torna solo il primo risultato (che esiste) come oggetto => $awheres però:

  1. io devo poter rinominare l'atype del parent (che va saltato) per chiamarla invece come il figlio ultimo
  2. joinare i risultati se sono array A=>[B]=>[C], se salto B ho un array [[C]] da flattenare e tornare come figlio diretto di A

array of operations

. sequence of queries . $use with indexed results to interpolate current query with previous results . begin/commit/rollback?

operators

prefixed with $ to not confuse with associations

. $where, $order, $limit, $offset: applied to model table . $awhere, $aorder, $alimit, $aoffset: applied to association table . $pick([key]): keys to pick . $map({ key => path }): key=>path mapping . $map(key): transform item=>value or [items]=>[values] (helpful for select and multiselects values binding) . $required(atype | [atypes] | true): discard result if atype or one of atypes or current row is empty . $func({ key => value }): map key to function "key" where "key" can be on of count/distinct/countDistinct/sum/avg/min/max

backend

. explain analyze . trigger on association to check if id1 and id2 exists in respective tables: currently not possible because we can not set dynamic table name in trigger query (at all on sqlite, dirty "execute" construct on postgresql) . binda cache su redis: cache(key) => salva in cache e quando arriva write(invalidator(key)) => refresha cache . omnid: model123 no need to bring around $model that can be interferred by id . while creating invalidators on redis there's no need to bring around the model everywhere . postgresql: add/edit/remove returning in place because we get ids to invalidate mtfkn cache . jsonb: custom data on associations . transactions my friends?

Scenario 1

Scenario: workout =down=> results <=up= user Result wanted: max(result.score) where workout=x and user=y

Scenario 2

Scenario: workout =down=> results Result wanted: avg(each workout.results) Solution: with return(key) you would have just the array of results arrays, aggregated functions should be computed with lowest priority at the end of the queue

models definitions

. models: descrivere siblings, i.e se user=>company allora user=>tax dove company e tax sono sibling entrambi mutualmente required . presenters: FormPresenter, SelectPresenter, Multiselected presenter embeddabili

con triggers posso verificare un meta jsonb che descrive i permessi sulle associations? . quando traverso => ogni volta prima di entrare in type posso applicare filtro utente/gruppi . insert transaction . vedo

add: permetti creazione intero branch add/edit con where come get: ritorna intero branch creato

Security

. queries defined server side and hashed: if client query hash does not match allowed queries hashes then refuse to run . checks at startup (database, redis, models consistencies, loops in associations) . redis + rejson