1.1.4 • Published 6 years ago

graphjql v1.1.4

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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: userid=$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 userid=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

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.40

6 years ago

1.0.39

6 years ago

1.0.38

6 years ago

1.0.37

6 years ago

1.0.36

6 years ago

1.0.35

6 years ago

1.0.34

6 years ago

1.0.33

6 years ago

1.0.32

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago