├── .babelrc ├── .circleci └── config.yml ├── .github └── workflows │ ├── main.yml │ └── package-update.yml ├── .gitignore ├── README.md ├── __snapshots__ └── index.test.js.snap ├── async.js ├── async.test.js ├── index.js ├── index.test.js ├── package.json ├── react ├── __snapshots__ │ └── index.test.js.snap ├── index.js └── index.test.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "plugins": ["@babel/plugin-transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Javascript Node CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-javascript/ for more details 4 | # 5 | version: 2 6 | jobs: 7 | build: 8 | docker: 9 | # specify the version you desire here 10 | - image: circleci/node:lts 11 | 12 | # Specify service dependencies here if necessary 13 | # CircleCI maintains a library of pre-built images 14 | # documented at https://circleci.com/docs/2.0/circleci-images/ 15 | # - image: circleci/mongo:3.4.4 16 | 17 | working_directory: ~/repo 18 | 19 | steps: 20 | - checkout 21 | 22 | # Download and cache dependencies 23 | - restore_cache: 24 | keys: 25 | - v1-dependencies-{{ checksum "package.json" }} 26 | # fallback to using the latest cache if no exact match is found 27 | - v1-dependencies- 28 | 29 | - run: yarn install 30 | 31 | - save_cache: 32 | paths: 33 | - node_modules 34 | key: v1-dependencies-{{ checksum "package.json" }} 35 | 36 | # run tests! 37 | - run: yarn test 38 | - run: npx semantic-release 39 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v1 16 | - uses: actions/setup-node@v1 17 | with: 18 | node-version: 12 19 | - run: yarn 20 | - run: yarn test 21 | -------------------------------------------------------------------------------- /.github/workflows/package-update.yml: -------------------------------------------------------------------------------- 1 | on: 2 | schedule: 3 | - cron: 0 0 * * 3 4 | name: Update 5 | jobs: 6 | package-update: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@master 10 | - name: set remote url 11 | run: git remote set-url --push origin https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY 12 | - name: package-update 13 | uses: taichi/actions-package-update@master 14 | env: 15 | AUTHOR_EMAIL: brysgo@gmail.com 16 | AUTHOR_NAME: Bryan Goldstein 17 | EXECUTE: "true" 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 19 | UPDATE_COMMAND: yarn 20 | with: 21 | args: upgrade --latest 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | ██████╗ ██████╗ █████╗ ██████╗ ██╗ ██╗ ██████╗ ██╗ ██████╗ ██╗ ██╗███╗ ██╗ 3 | ██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██║ ██║██╔═══██╗██║ ██╔════╝ ██║ ██║████╗ ██║ 4 | ██║ ███╗██████╔╝███████║██████╔╝███████║██║ ██║██║ █████╗██║ ███╗██║ ██║██╔██╗ ██║ 5 | ██║ ██║██╔══██╗██╔══██║██╔═══╝ ██╔══██║██║▄▄ ██║██║ ╚════╝██║ ██║██║ ██║██║╚██╗██║ 6 | ╚██████╔╝██║ ██║██║ ██║██║ ██║ ██║╚██████╔╝███████╗ ╚██████╔╝╚██████╔╝██║ ╚████║ 7 | ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══▀▀═╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ 8 | ``` 9 | 10 |  11 | 12 | Augmented query interface for the graph universal database http://gun.js.org/ 13 | 14 | `npm install graphql-gun` 15 | 16 | ## With React 17 | 18 | Say you want to attach offline first, realtime data to the Color component. 19 | ```javascript 20 | const gql = require("graphql-tag"); 21 | const Gun = require("gun"); 22 | const React = require("react"); 23 | const ReactDOM = require("react-dom"); 24 | const gun = Gun(); 25 | const { createContainer, graphqlGun } = require('graphql-gun/react')({React, gun}); 26 | 27 | const Color = ({color, data}) => ( 28 | // data will be passed in by the container with all the data you asked for 29 | // component will also redraw when your subscriptions update 30 |