├── .DS_Store ├── .gitignore ├── .vscode └── settings.json ├── Atlantis-Demo ├── .DS_Store ├── .gitignore ├── .travis.yml ├── Docker-compose-test.yml ├── Dockerfile ├── Dockerfile-dev ├── Dockerrun.aws.json ├── README.MD ├── atlantis-for-demo │ ├── helperFunctions │ │ ├── exportHelper.d.ts │ │ ├── exportHelper.d.ts.map │ │ ├── exportHelper.js │ │ ├── exportHelper.js.map │ │ ├── getMutationMap.d.ts │ │ ├── getMutationMap.d.ts.map │ │ ├── getMutationMap.js │ │ ├── getMutationMap.js.map │ │ ├── isSubset.d.ts │ │ ├── isSubset.d.ts.map │ │ ├── isSubset.js │ │ ├── isSubset.js.map │ │ ├── makeGQLrequest.d.ts │ │ ├── makeGQLrequest.d.ts.map │ │ ├── makeGQLrequest.js │ │ ├── makeGQLrequest.js.map │ │ ├── parseDataFromCache.d.ts │ │ ├── parseDataFromCache.d.ts.map │ │ ├── parseDataFromCache.js │ │ ├── parseDataFromCache.js.map │ │ ├── restructureAST.d.ts │ │ ├── restructureAST.d.ts.map │ │ ├── restructureAST.js │ │ ├── restructureAST.js.map │ │ ├── structureToString.d.ts │ │ ├── structureToString.d.ts.map │ │ ├── structureToString.js │ │ ├── structureToString.js.map │ │ ├── traverseAST.d.ts │ │ ├── traverseAST.d.ts.map │ │ ├── traverseAST.js │ │ ├── traverseAST.js.map │ │ ├── typesInQuery.d.ts │ │ ├── typesInQuery.d.ts.map │ │ ├── typesInQuery.js │ │ ├── typesInQuery.js.map │ │ ├── updateRedisAfterMutation.d.ts │ │ ├── updateRedisAfterMutation.d.ts.map │ │ ├── updateRedisAfterMutation.js │ │ └── updateRedisAfterMutation.js.map │ ├── index.d.ts │ ├── index.d.ts.map │ ├── index.js │ └── index.js.map ├── build │ ├── 34e0831da6d419cdc51c4caab9543b13.png │ ├── 440224c50031faa6c92d27288b1577f7.png │ ├── 6bfe81e7715f4cef324a826fe4f5f509.svg │ ├── 8293af0d69989b403d220a61e3747e99.png │ ├── 97c29504d7bf4255837c8341f638e3de.png │ ├── a17d2ab75193ff946030f9e58c118ae8.svg │ ├── bundle.js │ ├── bundle.js.LICENSE.txt │ └── index.html ├── client │ ├── .DS_Store │ ├── App.js │ ├── assets │ │ ├── Asset_3.svg │ │ ├── Atlantis_Cache.svg │ │ ├── Coral_v.2.png │ │ ├── Erik_v.2.png │ │ ├── Erik_v.png │ │ ├── Readme_banner.png │ │ ├── Sett_v.2.png │ │ ├── arrow.png │ │ ├── atlantis_QL.svg │ │ ├── drop_dark.svg │ │ ├── drop_light.svg │ │ ├── fast.svg │ │ ├── freq_bg.svg │ │ ├── frequency_banner.svg │ │ ├── github.svg │ │ ├── github_dark.svg │ │ ├── linkedin.svg │ │ ├── medium.svg │ │ ├── minus_dark.svg │ │ ├── minus_light.svg │ │ ├── npm_dark.svg │ │ ├── npm_light.svg │ │ ├── page_brk.svg │ │ ├── persisted.svg │ │ ├── plus_dark.svg │ │ ├── plus_light.svg │ │ ├── product_hunt.svg │ │ ├── servers_dark.svg │ │ ├── servers_light.svg │ │ ├── space_saving.svg │ │ ├── space_saving_updated.svg │ │ ├── space_update_drop.svg │ │ └── update.svg │ ├── components │ │ ├── Arrow.js │ │ ├── Dashboard.js │ │ ├── Dial.js │ │ ├── DropDownItem.js │ │ ├── ErikDial.js │ │ ├── Form.js │ │ ├── Gauge.js │ │ ├── QueryState.js │ │ ├── QueryWindow.js │ │ ├── Speedometer.js │ │ ├── Team.js │ │ ├── TeamSocials.js │ │ ├── TideHeader.js │ │ ├── Tree.js │ │ ├── TypeField.js │ │ └── UsersFields.js │ ├── containers │ │ ├── About.js │ │ ├── MainContainer.js │ │ ├── Navbar.js │ │ └── TeamContainer.js │ ├── helpers │ │ └── HelperFunctions.js │ ├── index.js │ ├── public │ │ └── index.html │ └── scss │ │ ├── _about.scss │ │ ├── _arrow.scss │ │ ├── _main.scss │ │ ├── _nav.scss │ │ ├── _speedometer.scss │ │ ├── _team.scss │ │ ├── _tree.scss │ │ ├── _variables.scss │ │ ├── _window.scss │ │ └── styles.scss ├── demo.zip ├── docker-compose-dev-hot.yml ├── package-lock.json ├── package.json ├── scripts │ └── deploy.sh ├── server │ ├── .DS_Store │ ├── middleware.js │ ├── models.js │ ├── schema │ │ ├── schema.js │ │ └── schemaOriginal.js │ └── server.js └── webpack.config.js ├── Atlantis-SourceCode ├── .gitignore ├── __tests__ │ └── parse.ts ├── dump.rdb ├── jest-setup.js ├── jest-teardown.js ├── jest.config.js ├── package-lock.json ├── package.json ├── server │ ├── .DS_Store │ ├── model.ts │ ├── schema │ │ └── schema.ts │ ├── server.ts │ └── views │ │ ├── index.html │ │ └── main.js ├── src │ ├── helper-functions │ │ ├── exportHelper.ts │ │ ├── getMutationMap.ts │ │ ├── isSubset.ts │ │ ├── makeGQLrequest.ts │ │ ├── parseDataFromCache.ts │ │ ├── restructureAST.ts │ │ ├── structureToString.ts │ │ ├── traverseAST.ts │ │ ├── typesInQuery.ts │ │ └── updateRedisAfterMutation.ts │ └── index.ts └── tsconfig.json ├── LICENSE ├── NPM-Package ├── .gitignore ├── package-lock.json └── package │ ├── .DS_Store │ ├── README.md │ ├── lib │ ├── helperFunctions │ │ ├── duplicateParseAST.d.ts │ │ ├── duplicateParseAST.d.ts.map │ │ ├── duplicateParseAST.js │ │ ├── duplicateParseAST.js.map │ │ ├── exportHelper.d.ts │ │ ├── exportHelper.d.ts.map │ │ ├── exportHelper.js │ │ ├── exportHelper.js.map │ │ ├── foundTypes.d.ts │ │ ├── foundTypes.d.ts.map │ │ ├── foundTypes.js │ │ ├── foundTypes.js.map │ │ ├── getMutationMap.d.ts │ │ ├── getMutationMap.d.ts.map │ │ ├── getMutationMap.js │ │ ├── getMutationMap.js.map │ │ ├── helper.d.ts │ │ ├── helper.d.ts.map │ │ ├── helper.js │ │ ├── helper.js.map │ │ ├── isSubset.d.ts │ │ ├── isSubset.d.ts.map │ │ ├── isSubset.js │ │ ├── isSubset.js.map │ │ ├── makeGQLrequest.d.ts │ │ ├── makeGQLrequest.d.ts.map │ │ ├── makeGQLrequest.js │ │ ├── makeGQLrequest.js.map │ │ ├── parseAST.d.ts │ │ ├── parseAST.d.ts.map │ │ ├── parseAST.js │ │ ├── parseAST.js.map │ │ ├── parseDataFromCache.d.ts │ │ ├── parseDataFromCache.d.ts.map │ │ ├── parseDataFromCache.js │ │ ├── parseDataFromCache.js.map │ │ ├── protoQueryString.d.ts │ │ ├── protoQueryString.d.ts.map │ │ ├── protoQueryString.js │ │ ├── protoQueryString.js.map │ │ ├── restructureAST.d.ts │ │ ├── restructureAST.d.ts.map │ │ ├── restructureAST.js │ │ ├── restructureAST.js.map │ │ ├── structureToString.d.ts │ │ ├── structureToString.d.ts.map │ │ ├── structureToString.js │ │ ├── structureToString.js.map │ │ ├── traverseAST.d.ts │ │ ├── traverseAST.d.ts.map │ │ ├── traverseAST.js │ │ ├── traverseAST.js.map │ │ ├── typesInQuery.d.ts │ │ ├── typesInQuery.d.ts.map │ │ ├── typesInQuery.js │ │ ├── typesInQuery.js.map │ │ ├── updateRedisAfterMutation.d.ts │ │ ├── updateRedisAfterMutation.d.ts.map │ │ ├── updateRedisAfterMutation.js │ │ └── updateRedisAfterMutation.js.map │ ├── index.d.ts │ ├── index.d.ts.map │ ├── index.js │ └── index.js.map │ └── package.json ├── README.md ├── Readme_banner.png ├── dump.rdb ├── package-lock.json └── package.json /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | it 2 | node_modules 3 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /Atlantis-Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/.DS_Store -------------------------------------------------------------------------------- /Atlantis-Demo/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules/ -------------------------------------------------------------------------------- /Atlantis-Demo/.travis.yml: -------------------------------------------------------------------------------- 1 | services: 2 | - docker 3 | 4 | dist: xenial 5 | 6 | script: 7 | - docker-compose -f docker-compose-test.yml up --abort-on-container-exit 8 | - python3 -VV 9 | - pip -V 10 | 11 | before_deploy: 12 | # install the aws cli 13 | - python3 -m pip install --user awscli 14 | # install the elastic beanstalk cli 15 | - python3 -m pip install --user awsebcli 16 | # Append exe location to our PATH 17 | - export PATH=$PATH:$HOME/.local/bin 18 | 19 | env: 20 | - PATH=/opt/python/3.7.1/bin:$PATH 21 | -------------------------------------------------------------------------------- /Atlantis-Demo/Docker-compose-test.yml: -------------------------------------------------------------------------------- 1 | version: '3.0' 2 | services: 3 | test: 4 | image: seeclabs/demo-dev 5 | container_name: democontainer 6 | ports: 7 | - '3000:3000' 8 | volumes: 9 | - ./:/usr/src/app 10 | - node_modules:/usr/src/app/node_modules 11 | command: npm run test 12 | volumes: 13 | node_modules: 14 | -------------------------------------------------------------------------------- /Atlantis-Demo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16.3 2 | WORKDIR '/usr/src/app' 3 | COPY ./ /usr/src/app 4 | RUN npm install 5 | RUN npm run build 6 | EXPOSE 3000 7 | ENTRYPOINT ["node", "./server/server.js"] -------------------------------------------------------------------------------- /Atlantis-Demo/Dockerfile-dev: -------------------------------------------------------------------------------- 1 | FROM node:16.3 2 | RUN npm install -g webpack 3 | WORKDIR '/usr/src/app' 4 | COPY package*.json ./ 5 | RUN npm install 6 | EXPOSE 3000 7 | -------------------------------------------------------------------------------- /Atlantis-Demo/Dockerrun.aws.json: -------------------------------------------------------------------------------- 1 | { 2 | "AWSEBDockerrunVersion": "1", 3 | "Image": { 4 | "Name": "0 026744380512.dkr.ecr.us-west-1.amazonaws.com/seeclabs:", 5 | "Update": "true" 6 | }, 7 | "Ports": [ 8 | { 9 | "ContainerPort": "3000" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /Atlantis-Demo/README.MD: -------------------------------------------------------------------------------- 1 | Read me for demo. 2 | -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/exportHelper.d.ts: -------------------------------------------------------------------------------- 1 | import { traverseAST } from './traverseAST'; 2 | import { restructureAST } from './restructureAST'; 3 | import { structureToString } from './structureToString'; 4 | import { isSubset } from './isSubset'; 5 | import { parseDataFromCache } from './parseDataFromCache'; 6 | import { makeGQLrequest } from './makeGQLrequest'; 7 | export { traverseAST, restructureAST, structureToString, isSubset, parseDataFromCache, makeGQLrequest, }; 8 | //# sourceMappingURL=exportHelper.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/exportHelper.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"exportHelper.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/exportHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,cAAc,GACf,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/exportHelper.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.makeGQLrequest = exports.parseDataFromCache = exports.isSubset = exports.structureToString = exports.restructureAST = exports.traverseAST = void 0; 4 | const traverseAST_1 = require("./traverseAST"); 5 | Object.defineProperty(exports, "traverseAST", { enumerable: true, get: function () { return traverseAST_1.traverseAST; } }); 6 | const restructureAST_1 = require("./restructureAST"); 7 | Object.defineProperty(exports, "restructureAST", { enumerable: true, get: function () { return restructureAST_1.restructureAST; } }); 8 | const structureToString_1 = require("./structureToString"); 9 | Object.defineProperty(exports, "structureToString", { enumerable: true, get: function () { return structureToString_1.structureToString; } }); 10 | const isSubset_1 = require("./isSubset"); 11 | Object.defineProperty(exports, "isSubset", { enumerable: true, get: function () { return isSubset_1.isSubset; } }); 12 | const parseDataFromCache_1 = require("./parseDataFromCache"); 13 | Object.defineProperty(exports, "parseDataFromCache", { enumerable: true, get: function () { return parseDataFromCache_1.parseDataFromCache; } }); 14 | const makeGQLrequest_1 = require("./makeGQLrequest"); 15 | Object.defineProperty(exports, "makeGQLrequest", { enumerable: true, get: function () { return makeGQLrequest_1.makeGQLrequest; } }); 16 | //# sourceMappingURL=exportHelper.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/exportHelper.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"exportHelper.js","sourceRoot":"","sources":["../../../src/helperFunctions/exportHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAQ1C,4FARO,yBAAW,OAQP;AAPb,qDAAkD;AAQhD,+FARO,+BAAc,OAQP;AAPhB,2DAAwD;AAQtD,kGARO,qCAAiB,OAQP;AAPnB,yCAAsC;AAQpC,yFARO,mBAAQ,OAQP;AAPV,6DAA0D;AAQxD,mGARO,uCAAkB,OAQP;AAPpB,qDAAkD;AAQhD,+FARO,+BAAc,OAQP"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/getMutationMap.d.ts: -------------------------------------------------------------------------------- 1 | declare const getMutationMap: (schema: any) => any; 2 | export { getMutationMap }; 3 | //# sourceMappingURL=getMutationMap.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/getMutationMap.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"getMutationMap.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/getMutationMap.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,WAAY,GAAG,QAwBlC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/getMutationMap.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getMutationMap = void 0; 4 | const getMutationMap = (schema) => { 5 | const mutationMap = {}; 6 | // get object containing all root mutations defined in the schema 7 | const mutationTypeFields = schema._mutationType._fields; 8 | // if queryTypeFields is a function, invoke it to get object with queries 9 | const mutationsObj = typeof mutationTypeFields === 'function' 10 | ? mutationTypeFields() 11 | : mutationTypeFields; 12 | for (const mutation in mutationsObj) { 13 | // get name of GraphQL type returned by query 14 | // if ofType --> this is collection, else not collection 15 | let returnedType; 16 | if (mutationsObj[mutation].type.ofType) { 17 | returnedType = []; 18 | returnedType.push(mutationsObj[mutation].type.ofType.name); 19 | } 20 | if (mutationsObj[mutation].type.name) { 21 | returnedType = mutationsObj[mutation].type.name; 22 | } 23 | mutationMap[mutation] = returnedType; 24 | } 25 | return mutationMap; 26 | }; 27 | exports.getMutationMap = getMutationMap; 28 | //# sourceMappingURL=getMutationMap.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/getMutationMap.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"getMutationMap.js","sourceRoot":"","sources":["../../../src/helperFunctions/getMutationMap.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG,CAAC,MAAW,EAAE,EAAE;IACrC,MAAM,WAAW,GAAQ,EAAE,CAAC;IAC5B,iEAAiE;IACjE,MAAM,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;IACxD,yEAAyE;IACzE,MAAM,YAAY,GAChB,OAAO,kBAAkB,KAAK,UAAU;QACtC,CAAC,CAAC,kBAAkB,EAAE;QACtB,CAAC,CAAC,kBAAkB,CAAC;IAEzB,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;QACnC,6CAA6C;QAC7C,wDAAwD;QACxD,IAAI,YAAY,CAAC;QACjB,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;YACtC,YAAY,GAAG,EAAE,CAAC;YAClB,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC5D;QACD,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;YACpC,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACjD;QACD,WAAW,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC;KACtC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEO,wCAAc"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/isSubset.d.ts: -------------------------------------------------------------------------------- 1 | declare const isSubset: (rootObj: any, subObj: any) => boolean; 2 | export { isSubset }; 3 | //# sourceMappingURL=isSubset.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/isSubset.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"isSubset.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/isSubset.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,QAAQ,YAAa,GAAG,UAAU,GAAG,KAAG,OAQ7C,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/isSubset.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isSubset = void 0; 4 | /* compare incoming queryStructure and existing queryStructure in redis to determine if all the fields in the incoming query exist in the cache*/ 5 | const isSubset = (rootObj, subObj) => { 6 | return Object.keys(subObj).every((el) => { 7 | if (typeof subObj[el] == 'object') { 8 | return isSubset(rootObj[el], subObj[el]); 9 | } 10 | if (!subObj || !rootObj) 11 | return false; 12 | return subObj[el] === rootObj[el]; 13 | }); 14 | }; 15 | exports.isSubset = isSubset; 16 | //# sourceMappingURL=isSubset.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/isSubset.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"isSubset.js","sourceRoot":"","sources":["../../../src/helperFunctions/isSubset.ts"],"names":[],"mappings":";;;AAAA,iJAAiJ;AACjJ,MAAM,QAAQ,GAAG,CAAC,OAAY,EAAE,MAAW,EAAW,EAAE;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;QACtC,IAAI,OAAO,MAAM,CAAC,EAAE,CAAC,IAAI,QAAQ,EAAE;YACjC,OAAO,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1C;QACD,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QACtC,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEO,4BAAQ"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/makeGQLrequest.d.ts: -------------------------------------------------------------------------------- 1 | declare const makeGQLrequest: (redisClient: any, schema: any, redisKey: any, queryMade: any, proto: any, operationType: any) => Promise; 2 | export { makeGQLrequest }; 3 | //# sourceMappingURL=makeGQLrequest.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/makeGQLrequest.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"makeGQLrequest.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/makeGQLrequest.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,cAAc,gBACL,GAAG,UACR,GAAG,YACD,GAAG,aACF,GAAG,SACP,GAAG,iBACK,GAAG,qBA8CnB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/makeGQLrequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.makeGQLrequest = void 0; 13 | const graphql_1 = require("graphql"); 14 | const typesInQuery_1 = require("./typesInQuery"); 15 | const updateRedisAfterMutation_1 = require("./updateRedisAfterMutation"); 16 | const makeGQLrequest = (redisClient, schema, redisKey, queryMade, proto, operationType) => __awaiter(void 0, void 0, void 0, function* () { 17 | return new Promise((resolve) => { 18 | graphql_1.graphql(schema, queryMade).then((response) => { 19 | const graphQLResponse = response.data; 20 | if (operationType == 'unCacheable') 21 | return graphQLResponse; 22 | if (operationType !== 'mutation') { 23 | const subscriptions = typesInQuery_1.typesInQuery(graphQLResponse); 24 | // subscribe the query to mutations of type subscription 25 | for (let key in subscriptions) { 26 | redisClient.get(`${subscriptions[key]}:Publisher`, (error, values) => { 27 | if (error) { 28 | return; 29 | } 30 | // Case where this query is the first to subscribe to this type. 31 | // Create a key, and subscribe the query to that key. 32 | if (!values) { 33 | const subsArr = [redisKey]; 34 | redisClient.set(`${subscriptions[key]}:Publisher`, JSON.stringify(subsArr)); 35 | } 36 | else { 37 | // Case where other queries are also subscribed to changes of this type. 38 | const subsArr = JSON.parse(`${values}`); 39 | subsArr.push(redisKey); 40 | redisClient.set(`${subscriptions[key]}:Publisher`, JSON.stringify(subsArr)); 41 | } 42 | }); 43 | } 44 | // store key-value for graphqlRespose from the database 45 | redisClient.set(redisKey, JSON.stringify({ data: graphQLResponse, fields: proto })); 46 | } 47 | else { 48 | // since we have a mutation we need to clear all subscribed queries 49 | updateRedisAfterMutation_1.updateRedisAfterMutation(redisClient, schema, graphQLResponse); 50 | } 51 | resolve(graphQLResponse); 52 | }); 53 | }); 54 | }); 55 | exports.makeGQLrequest = makeGQLrequest; 56 | //# sourceMappingURL=makeGQLrequest.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/makeGQLrequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"makeGQLrequest.js","sourceRoot":"","sources":["../../../src/helperFunctions/makeGQLrequest.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAElC,iDAA8C;AAC9C,yEAAsE;AAEtE,MAAM,cAAc,GAAG,CACrB,WAAgB,EAChB,MAAW,EACX,QAAa,EACb,SAAc,EACd,KAAU,EACV,aAAkB,EAClB,EAAE;IACF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,iBAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC3C,MAAM,eAAe,GAAQ,QAAQ,CAAC,IAAI,CAAC;YAC3C,IAAI,aAAa,IAAI,aAAa;gBAAE,OAAO,eAAe,CAAA;YAC1D,IAAI,aAAa,KAAK,UAAU,EAAE;gBAChC,MAAM,aAAa,GAAG,2BAAY,CAAC,eAAe,CAAC,CAAC;gBACpD,wDAAwD;gBACxD,KAAK,IAAI,GAAG,IAAI,aAAa,EAAE;oBAC7B,WAAW,CAAC,GAAG,CACb,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,EACjC,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;wBAC1B,IAAI,KAAK,EAAE;4BACT,OAAO;yBACR;wBACD,gEAAgE;wBAChE,qDAAqD;wBACrD,IAAI,CAAC,MAAM,EAAE;4BACX,MAAM,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;4BAC3B,WAAW,CAAC,GAAG,CACb,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,EACjC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CACxB,CAAC;yBACH;6BAAM;4BACL,wEAAwE;4BACxE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;4BACxC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;4BAEvB,WAAW,CAAC,GAAG,CACb,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,EACjC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CACxB,CAAC;yBACH;oBACH,CAAC,CACF,CAAC;iBACH;gBACD,uDAAuD;gBACvD,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;aACrF;iBAAM;gBACL,mEAAmE;gBACnE,mDAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;aAChE;YACD,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA,CAAC;AAEO,wCAAc"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/parseDataFromCache.d.ts: -------------------------------------------------------------------------------- 1 | declare function parseDataFromCache(cacheObj: any, fieldObj: any): any; 2 | export { parseDataFromCache }; 3 | //# sourceMappingURL=parseDataFromCache.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/parseDataFromCache.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parseDataFromCache.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/parseDataFromCache.ts"],"names":[],"mappings":"AAEA,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAiBvD;AAiCD,OAAO,EAAE,kBAAkB,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/parseDataFromCache.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseDataFromCache = void 0; 4 | /*ParseDataFromCache traverses redis's cache and filters object properties by keys from prototype object*/ 5 | function parseDataFromCache(cacheObj, fieldObj) { 6 | const result = {}; 7 | Object.keys(cacheObj).forEach((key) => { 8 | //get the value of cacheObj and FieldObj based on key 9 | const subCacheObj = cacheObj[key]; 10 | const subFieldObj = fieldObj[key]; 11 | //if subCacheObj is an array, iterate through ele and trigger ObjectFilter 12 | if (Array.isArray(subCacheObj)) { 13 | result[key] = subCacheObj.map((obj) => { 14 | return ObjectFilter(obj, subFieldObj); 15 | }); 16 | } 17 | else if (typeof subCacheObj === 'object') { 18 | result[key] = ObjectFilter(subCacheObj, subFieldObj); 19 | } 20 | }); 21 | return result; 22 | } 23 | exports.parseDataFromCache = parseDataFromCache; 24 | /*helper function filters out object properties on current layer and invoke rescursive call if there are nested fields */ 25 | const ObjectFilter = (cacheObj, fieldObj) => { 26 | let resultObj = {}; 27 | //iterate thorugh fieldObj 28 | fieldObj.forEach((field) => { 29 | //if cur field is a string, store the the properites to resultObj based on fields 30 | if (typeof field === 'string') { 31 | resultObj[field] = cacheObj[field]; 32 | } 33 | else { 34 | //if cur field is an object, invoke rescurive call on ObjectFilter based on value 35 | const fieldName = Object.keys(field)[0]; 36 | if (cacheObj[fieldName] === null) { 37 | resultObj[fieldName] = null; 38 | } 39 | else if (Array.isArray(cacheObj[fieldName])) { 40 | resultObj[fieldName] = cacheObj[fieldName].map((obj) => { 41 | return ObjectFilter(obj, field[fieldName]); 42 | }); 43 | } 44 | else if (typeof cacheObj[fieldName] === 'object') { 45 | resultObj[fieldName] = ObjectFilter(cacheObj[fieldName], field[fieldName]); 46 | } 47 | } 48 | }); 49 | return resultObj; 50 | }; 51 | //# sourceMappingURL=parseDataFromCache.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/parseDataFromCache.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parseDataFromCache.js","sourceRoot":"","sources":["../../../src/helperFunctions/parseDataFromCache.ts"],"names":[],"mappings":";;;AACA,0GAA0G;AAC1G,SAAS,kBAAkB,CAAC,QAAa,EAAE,QAAa;IACtD,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACpC,qDAAqD;QACrD,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAClC,0EAA0E;QAC1E,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBACpC,OAAO,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YAC1C,MAAM,CAAC,GAAG,CAAC,GA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demo/atlantis-for-demo/helperFunctions/restructureAST.d.ts: -------------------------------------------------------------------------------- 1 | declare const restructureAST: (AST: any) => any; 2 | export { restructureAST }; 3 | //# sourceMappingURL=restructureAST.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/restructureAST.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"restructureAST.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/restructureAST.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,QAAS,GAAG,QA6B/B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/restructureAST.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.restructureAST = void 0; 4 | const graphql_1 = require("graphql"); 5 | const restructureAST = (AST) => { 6 | let fields_Object; 7 | let layer = ''; 8 | graphql_1.visit(AST, { 9 | SelectionSet(node, key, parent) { 10 | if (parent.kind === 'Field') { 11 | const tempObj = {}; 12 | const parentName = parent.name.value; 13 | if (layer.length === 0) { 14 | layer = parentName; 15 | } 16 | const tempArray = []; 17 | node.selections.forEach((e) => tempArray.push(e.name.value)); 18 | tempObj[parentName] = tempArray; 19 | if (!fields_Object) { 20 | fields_Object = tempObj; 21 | } 22 | else { 23 | fields_Object[layer].forEach((e, i) => { 24 | if (e === parentName) { 25 | fields_Object[layer][i] = tempObj; 26 | } 27 | }); 28 | layer = parentName; 29 | } 30 | } 31 | }, 32 | }); 33 | return fields_Object; 34 | }; 35 | exports.restructureAST = restructureAST; 36 | //# sourceMappingURL=restructureAST.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/restructureAST.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"restructureAST.js","sourceRoot":"","sources":["../../../src/helperFunctions/restructureAST.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAEhC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAE,EAAE;IAClC,IAAI,aAAkB,CAAC;IACvB,IAAI,KAAK,GAAW,EAAE,CAAC;IAEvB,eAAK,CAAC,GAAG,EAAE;QACT,YAAY,CAAC,IAAS,EAAE,GAAG,EAAE,MAAW;YACtC,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC3B,MAAM,OAAO,GAAQ,EAAE,CAAC;gBACxB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;gBACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;oBACtB,KAAK,GAAG,UAAU,CAAC;iBACpB;gBACD,MAAM,SAAS,GAAQ,EAAE,CAAC;gBAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gBAClE,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;gBAChC,IAAI,CAAC,aAAa,EAAE;oBAClB,aAAa,GAAG,OAAO,CAAC;iBACzB;qBAAM;oBACL,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE;wBAC9C,IAAI,CAAC,KAAK,UAAU,EAAE;4BACpB,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;yBACnC;oBACH,CAAC,CAAC,CAAC;oBACH,KAAK,GAAG,UAAU,CAAC;iBACpB;aACF;QACH,CAAC;KACF,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEO,wCAAc"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/structureToString.d.ts: -------------------------------------------------------------------------------- 1 | declare const structureToString: (queryStructure: any, queryArgs: any) => string; 2 | export { structureToString }; 3 | //# sourceMappingURL=structureToString.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/structureToString.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"structureToString.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/structureToString.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,iBAAiB,mBAAoB,GAAG,aAAa,GAAG,WAgC7D,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/structureToString.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.structureToString = void 0; 4 | // Parse through AST proto and convert it into a GQL query string 5 | const structureToString = (queryStructure, queryArgs) => { 6 | const argsToQuery = (queryArgs) => { 7 | let string = ''; 8 | for (let key in queryArgs) { 9 | for (let innerKey in queryArgs[key]) { 10 | // accounts for edge case where an Int is passed in as an arguement. 11 | if (!isNaN(queryArgs[key][innerKey])) { 12 | string += innerKey + ': ' + queryArgs[key][innerKey] + ' '; 13 | break; 14 | } 15 | string += innerKey + ': ' + '"' + queryArgs[key][innerKey] + '"' + ' '; 16 | } 17 | } 18 | return '(' + string + ')'; 19 | }; 20 | let mainString = ''; 21 | for (let key in queryStructure) { 22 | if (typeof queryStructure[key] !== 'object') { 23 | mainString += ' ' + key + ' '; 24 | } 25 | else { 26 | mainString += ' ' + key + ' '; 27 | if (queryArgs) { 28 | if (typeof queryArgs[key] == 'object') { 29 | const inner = argsToQuery(queryArgs); 30 | mainString += inner; 31 | } 32 | } 33 | mainString += structureToString(queryStructure[key], {}); 34 | } 35 | } 36 | return '{' + mainString + '}'; 37 | }; 38 | exports.structureToString = structureToString; 39 | //# sourceMappingURL=structureToString.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/structureToString.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"structureToString.js","sourceRoot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c,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;SAC1D;KACF;IACD,OAAO,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC;AAChC,CAAC,CAAC;AAEO,8CAAiB"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/traverseAST.d.ts: -------------------------------------------------------------------------------- 1 | declare const traverseAST: (AST: any) => { 2 | queryStructure: {}; 3 | queryArgs: any; 4 | operationType: any; 5 | parentFieldName: any; 6 | fieldArgs: any; 7 | argsName: any; 8 | }; 9 | export { traverseAST }; 10 | //# sourceMappingURL=traverseAST.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/traverseAST.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"traverseAST.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/traverseAST.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW,QAAS,GAAG;;;;;;;CAgG5B,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/traverseAST.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.traverseAST = void 0; 4 | const graphql_1 = require("graphql"); 5 | const traverseAST = (AST) => { 6 | // initialize variables for tracking AST extraction 7 | const queryStructure = {}; 8 | let parentFieldName; 9 | let operationType; 10 | let fieldArgs; 11 | let argsName; 12 | let queryArgs = null; 13 | const stack = []; 14 | // built in GQL function that recursively vists all nodes in an AST tree 15 | graphql_1.visit(AST, { 16 | enter(node) { 17 | if (node.directives) { 18 | if (node.directives.length > 0) { 19 | // if a node has directives it is uncacheable 20 | operationType = 'unCacheable'; 21 | return graphql_1.BREAK; 22 | } 23 | } 24 | }, 25 | // 26 | OperationDefinition(node) { 27 | operationType = node.operation; 28 | if (node.operation === 'subscription') { 29 | // if a query is a subscription it is uncacheable 30 | operationType = 'unCacheable'; 31 | return graphql_1.BREAK; 32 | } 33 | }, 34 | Field: { 35 | enter(node) { 36 | if (node.alias) { 37 | // if a query has an alias it is uncacheable 38 | operationType = 'unCacheable'; 39 | return graphql_1.BREAK; 40 | } 41 | if (node.arguments && node.arguments.length > 0) { 42 | fieldArgs = node.arguments[0].value.value; 43 | argsName = node.arguments[0].name.value; 44 | queryArgs = queryArgs || {}; 45 | queryArgs[node.name.value] = {}; 46 | // collect arguments if arguments contain id, otherwise make query unCachable 47 | // hint: can check for graphQl type ID instead of string 'id' 48 | for (let i = 0; i < node.arguments.length; i++) { 49 | const key = node.arguments[i].name.value; 50 | const value = node.arguments[i].value.value; 51 | // for queries cache can handle only id as argument 52 | if (operationType === 'query') { 53 | if (!key.includes('id')) { 54 | operationType = 'unCacheable'; 55 | return graphql_1.BREAK; 56 | } 57 | } 58 | queryArgs[node.name.value][key] = value; 59 | } 60 | } 61 | // add value to stack 62 | stack.push(node.name.value); 63 | }, 64 | leave(node) { 65 | // remove value from stack 66 | stack.pop(); 67 | }, 68 | }, 69 | SelectionSet(node, key, parent, path, ancestors) { 70 | if (parent.kind === 'Field') { 71 | const tempObject = {}; 72 | for (let field of node.selections) { 73 | tempObject[field.name.value] = true; 74 | } 75 | // loop through stack to get correct path in proto for temp object; 76 | // mutates original prototype object; 77 | const protoObj = stack.reduce((prev, curr, index) => { 78 | return index + 1 === stack.length // if last item in path 79 | ? (prev[curr] = tempObject) // set value 80 | : (prev[curr] = prev[curr]); // otherwise, if index exists, keep value 81 | }, queryStructure); 82 | protoObj['__typename'] = true; 83 | } 84 | else { 85 | parentFieldName = node.selections[0].name.value; 86 | } 87 | }, 88 | }); 89 | return { 90 | queryStructure, 91 | queryArgs, 92 | operationType, 93 | parentFieldName, 94 | fieldArgs, 95 | argsName, 96 | }; 97 | }; 98 | exports.traverseAST = traverseAST; 99 | //# sourceMappingURL=traverseAST.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/traverseAST.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"traverseAST.js","sourceRoot":"","sources":["../../../src/helperFunctions/traverseAST.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC/B,mDAAmD;IACnD,MAAM,cAAc,GAAG,EAAE,CAAC;IAE1B,IAAI,eAAoB,CAAC;IACzB,IAAI,aAAkB,CAAC;IACvB,IAAI,SAAc,CAAC;IACnB,IAAI,QAAa,CAAC;IAClB,IAAI,SAAS,GAAQ,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAU,EAAE,CAAC;IAExB,wEAAwE;IACxE,eAAK,CAAC,GAAG,EAAE;QACT,KAAK,CAAC,IAAS;YACb,IAAI,IAAI,CAAC,UAAiB,EAAE;gBAC1B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC9B,6CAA6C;oBAC7C,aAAa,GAAG,aAAa,CAAC;oBAC9B,OAAO,eAAK,CAAC;iBACd;aACF;QACH,CAAC;QACD,GAAG;QACH,mBAAmB,CAAC,IAAI;YACtB,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC;YAC/B,IAAI,IAAI,CAAC,SAAS,KAAK,cAAc,EAAE;gBACrC,iDAAiD;gBACjD,aAAa,GAAG,aAAa,CAAC;gBAC9B,OAAO,eAAK,CAAC;aACd;QACH,CAAC;QACD,KAAK,EAAE;YACL,KAAK,CAAC,IAAS;gBACb,IAAI,IAAI,CAAC,KAAK,EAAE;oBACd,4CAA4C;oBAC5C,aAAa,GAAG,aAAa,CAAC;oBAC9B,OAAO,eAAK,CAAC;iBACd;gBACD,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC/C,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;oBAC1C,QAAQ,GAAG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AC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;iBACrC;gBACD,mEAAmE;gBACnE,qCAAqC;gBACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;oBAClD,OAAO,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,uBAAuB;wBACvD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,YAAY;wBACxC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,yCAAyC;gBAC1E,CAAC,EAAE,cAAc,CAAC,CAAC;gBACnB,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;aAC/B;iBAAM;gBACL,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;aACjD;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO;QACL,cAAc;QACd,SAAS;QACT,aAAa;QACb,eAAe;QACf,SAAS;QACT,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC;AAEO,kCAAW"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/typesInQuery.d.ts: -------------------------------------------------------------------------------- 1 | declare const typesInQuery: (graphQLResponse: any) => string[]; 2 | export { typesInQuery }; 3 | //# sourceMappingURL=typesInQuery.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/typesInQuery.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"typesInQuery.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/typesInQuery.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,YAAY,oBAAqB,GAAG,aAWzC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/typesInQuery.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.typesInQuery = void 0; 4 | /* extract __typenames after making a database request with Regex */ 5 | const typesInQuery = (graphQLResponse) => { 6 | const stringy = JSON.stringify(graphQLResponse); 7 | let regex = /(__typename)\":\"(.+?)\"/g; 8 | let found = new Set(stringy.match(regex)); 9 | const subArr = []; 10 | for (let item of found) { 11 | let newItem = item.slice(13, -1); 12 | subArr.push(newItem); 13 | } 14 | return subArr; 15 | }; 16 | exports.typesInQuery = typesInQuery; 17 | //# sourceMappingURL=typesInQuery.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/typesInQuery.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"typesInQuery.js","sourceRoot":"","sources":["../../../src/helperFunctions/typesInQuery.ts"],"names":[],"mappings":";;;AACA,oEAAoE;AACpE,MAAM,YAAY,GAAG,CAAC,eAAoB,EAAE,EAAE;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAChD,IAAI,KAAK,GAAG,2BAA2B,CAAC;IACxC,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACtB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEO,oCAAY"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/updateRedisAfterMutation.d.ts: -------------------------------------------------------------------------------- 1 | declare const updateRedisAfterMutation: (redisClient: any, schema: any, graphQLResponse: Object) => void; 2 | export { updateRedisAfterMutation }; 3 | //# sourceMappingURL=updateRedisAfterMutation.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/updateRedisAfterMutation.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"updateRedisAfterMutation.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/updateRedisAfterMutation.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,wBAAwB,gBACf,GAAG,UACR,GAAG,mBACM,MAAM,SAsBxB,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/updateRedisAfterMutation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.updateRedisAfterMutation = void 0; 4 | const getMutationMap_1 = require("./getMutationMap"); 5 | const updateRedisAfterMutation = (redisClient, schema, graphQLResponse) => { 6 | // get the type of mutation from the first key in GQLresponse 7 | const mutation = Object.keys(graphQLResponse)[0]; 8 | // get subscribed tables to the mutation from the mutation map 9 | const subscribedTable = getMutationMap_1.getMutationMap(schema); 10 | const keyToClear = `${subscribedTable[mutation]}:Publisher`; 11 | // query redis for key to clear 12 | redisClient.get(`${keyToClear}`, (error, values) => { 13 | if (error) { 14 | console.log('Redis error', error); 15 | } 16 | const queriesToClear = JSON.parse(`${values}`); 17 | if (queriesToClear) { 18 | // if queries to clear exists, iterate over queries and delete them from redis. 19 | for (let i = 0; i < queriesToClear.length; i++) { 20 | redisClient.del(queriesToClear[i]); 21 | } 22 | } 23 | // after subscribers array is cleared, delete the subscribed key. 24 | redisClient.del(`${keyToClear}`); 25 | }); 26 | }; 27 | exports.updateRedisAfterMutation = updateRedisAfterMutation; 28 | //# sourceMappingURL=updateRedisAfterMutation.js.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/helperFunctions/updateRedisAfterMutation.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"updateRedisAfterMutation.js","sourceRoot":"","sources":["../../../src/helperFunctions/updateRedisAfterMutation.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD,MAAM,wBAAwB,GAAG,CAC/B,WAAgB,EAChB,MAAW,EACX,eAAuB,EACvB,EAAE;IACF,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,8DAA8D;IAC9D,MAAM,eAAe,GAAG,+BAAc,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC5D,+BAA+B;IAC/B,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;QAC3D,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;SACnC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;QAC/C,IAAI,cAAc,EAAE;YAClB,+EAA+E;YAC/E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC9C,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC;SACF;QACD,iEAAiE;QACjE,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEO,4DAAwB"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/index.d.ts: -------------------------------------------------------------------------------- 1 | declare const atlantis: (redisClient: any, schema: any) => (req: any, res: any, next: any) => Promise; 2 | export { atlantis }; 3 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,QAAQ,gBACE,GAAG,UAAU,GAAG,WAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,iBA4GtE,CAAC;AAEJ,OAAO,EAAE,QAAQ,EAAE,CAAC"} -------------------------------------------------------------------------------- /Atlantis-Demo/atlantis-for-demo/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgC;AAChC,iEAOwC;AAExC,MAAM,QAAQ,GACZ,CAAC,WAAgB,EAAE,MAAW,EAAE,EAAE,CAAC,CAAO,GAAQ,EAAE,GAAQ,EAAE,IAAS,EAAE,EAAE;IACzE,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;IAC/B,4DAA4D;IAC5D,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,IAAI,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EACJ,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,SAAS,GACV,GAAQ,0BAAW,CAAC,GAAG,CAAC,CAAC;IAC1B,wCAAwC;IACxC,MAAM,iBAAiB,GAAW,6BAAc,CAAC,GAAG,CAAC,CAAC;IACtD,wEAAwE;IACxE,IAAI,SAAS,GAAG,gCAAiB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAC7D,mFAAmF;IACnF,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC;IAC3E,qEAAqE;IACrE,IAAI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AAC;QACxG,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;QAC7B,MAAM,GAAG,GAAG,GAAG,GAAG,KAAK,CAAA;QACvB,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAA;QACpB,IAAI,EAAE,CAAC;KACR;AACH,CAAC,CAAA,CAAC;AAEK,4BAAQ"} -------------------------------------------------------------------------------- /Atlantis-Demo/build/34e0831da6d419cdc51c4caab9543b13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/build/34e0831da6d419cdc51c4caab9543b13.png -------------------------------------------------------------------------------- /Atlantis-Demo/build/440224c50031faa6c92d27288b1577f7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/build/440224c50031faa6c92d27288b1577f7.png -------------------------------------------------------------------------------- /Atlantis-Demo/build/8293af0d69989b403d220a61e3747e99.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/build/8293af0d69989b403d220a61e3747e99.png -------------------------------------------------------------------------------- /Atlantis-Demo/build/97c29504d7bf4255837c8341f638e3de.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/build/97c29504d7bf4255837c8341f638e3de.png -------------------------------------------------------------------------------- /Atlantis-Demo/build/bundle.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /* 2 | object-assign 3 | (c) Sindre Sorhus 4 | @license MIT 5 | */ 6 | 7 | /*! 8 | * The MIT License (MIT) 9 | * 10 | * Copyright (c) 2016 Mykhailo Stadnyk 11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, and to permit persons to whom the Software is 17 | * furnished to do so, subject to the following conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software. 21 | * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 28 | * SOFTWARE. 29 | * 30 | * @version 2.1.7 31 | */ 32 | 33 | /** @license React v0.20.2 34 | * scheduler.production.min.js 35 | * 36 | * Copyright (c) Facebook, Inc. and its affiliates. 37 | * 38 | * This source code is licensed under the MIT license found in the 39 | * LICENSE file in the root directory of this source tree. 40 | */ 41 | 42 | /** @license React v16.13.1 43 | * react-is.production.min.js 44 | * 45 | * Copyright (c) Facebook, Inc. and its affiliates. 46 | * 47 | * This source code is licensed under the MIT license found in the 48 | * LICENSE file in the root directory of this source tree. 49 | */ 50 | 51 | /** @license React v17.0.2 52 | * react-dom.production.min.js 53 | * 54 | * Copyright (c) Facebook, Inc. and its affiliates. 55 | * 56 | * This source code is licensed under the MIT license found in the 57 | * LICENSE file in the root directory of this source tree. 58 | */ 59 | 60 | /** @license React v17.0.2 61 | * react.production.min.js 62 | * 63 | * Copyright (c) Facebook, Inc. and its affiliates. 64 | * 65 | * This source code is licensed under the MIT license found in the 66 | * LICENSE file in the root directory of this source tree. 67 | */ 68 | -------------------------------------------------------------------------------- /Atlantis-Demo/build/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Atlantis 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/client/.DS_Store -------------------------------------------------------------------------------- /Atlantis-Demo/client/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import MainContainer from './containers/MainContainer' 3 | import Navbar from './containers/Navbar'; 4 | import TideHeader from './components/TideHeader'; 5 | import styles from './scss/styles.scss'; 6 | 7 | function App() { 8 | return ( 9 |
10 |
11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 | ); 19 | } 20 | 21 | export default App; -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/Asset_3.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/Coral_v.2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/client/assets/Coral_v.2.png -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/Erik_v.2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/client/assets/Erik_v.2.png -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/Erik_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/client/assets/Erik_v.png -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/Readme_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/client/assets/Readme_banner.png -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/Sett_v.2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/client/assets/Sett_v.2.png -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/client/assets/arrow.png -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/drop_dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/drop_light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/fast.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/github_dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/linkedin.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/medium.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/minus_dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/minus_light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/npm_dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/npm_light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/page_brk.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/persisted.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/plus_dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/plus_light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/product_hunt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/servers_dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/servers_light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/assets/update.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/Arrow.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | function Arrow(props) { 4 | return ( 5 |
6 | 11 |
12 | ) 13 | } 14 | 15 | export default Arrow 16 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/DropDownItem.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | /* 4 | A reusable component for all dropdowns in the query 5 | */ 6 | 7 | const DropDownItem = (props) => { 8 | // console.log('hitting a dropdown item!'); 9 | const { func, item } = props; 10 | return ( 11 | <> 12 |
func(item)}> 13 | {item} 14 |
15 | 16 | ); 17 | }; 18 | 19 | export default DropDownItem; 20 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/Form.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | //import github from './github.svg'; 3 | class Form extends Component { 4 | state = { 5 | name: '', 6 | username: '', 7 | password: '', 8 | }; 9 | 10 | handleSubmit = (e) => { 11 | e.preventDefault(); 12 | this.props.handleSubmit(this.state); 13 | }; 14 | 15 | handleSubmit = (e) => { 16 | e.preventDefault(); 17 | 18 | // console.log("made it to handle sub") 19 | const user = this.props.users.find( 20 | (user) => user.username === this.state.username 21 | ); 22 | // console.log(user, "user & handle sub") 23 | return this.props.currentUser(user); 24 | }; 25 | 26 | handleChange = (e) => { 27 | let { name, value } = e.target; 28 | this.setState({ 29 | [name]: value, 30 | }); 31 | }; 32 | 33 | render() { 34 | let { formName } = this.props; 35 | let { name, username, password } = this.state; 36 | 37 | return ( 38 |
39 |
40 |

{formName}

41 |

Hey, Good to see you!

42 |
43 | 44 | 52 |
53 | 54 | 62 |
63 | 64 | 72 |
73 |
74 | 75 |

Or Authenticate with

76 | 77 | 78 | 79 |
80 | 81 | 82 |
83 |
84 | ); 85 | } 86 | } 87 | 88 | export default Form; 89 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/Gauge.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import GaugeChart from 'react-gauge-chart'; 3 | 4 | const styles = { 5 | dial: { 6 | display: 'inline-block', 7 | width: `95%`, 8 | height: `auto`, 9 | color: '#000', 10 | border: '0.5px solid #fff', 11 | padding: '2px', 12 | }, 13 | title: { 14 | fontSize: '1em', 15 | color: '#000', 16 | }, 17 | }; 18 | 19 | const Gauge = ({ responseTime }) => { 20 | // console.log('res time1 is :', responseTime); 21 | const maxGuage = (resT) => { 22 | if (resT > 650) { 23 | return (resT = 650); 24 | } 25 | return resT; 26 | }; 27 | responseTime = maxGuage(responseTime); 28 | // console.log('res time is :', responseTime); 29 | let resCopy = responseTime.toFixed(2); 30 | // console.log('rescopy', resCopy); 31 | let percent = responseTime / 700; 32 | // console.log('percent is', percent); 33 | return ( 34 |
35 | resCopy + ' ms'} 42 | /> 43 |
44 | ); 45 | }; 46 | 47 | export default Gauge; 48 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/Speedometer.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { RadialGauge } from "react-canvas-gauges"; 3 | 4 | function Speedometer({ responseTime, setResponseTime }) { 5 | 6 | 7 | 8 | return ( 9 |
10 | 11 | 38 | 47 | 48 | 49 |
50 | ) 51 | } 52 | 53 | export default Speedometer 54 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/Team.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import GitHubLogo from '../assets/github.svg'; 3 | import LinkedInLogo from '../assets/linkedin.svg'; 4 | import Coral from '../assets/Coral_v.2.png'; 5 | import Sett from '../assets/Sett_v.2.png'; 6 | import Erik from '../assets/Erik_v.2.png'; 7 | import Easy from '../assets/Erik_v.png'; 8 | 9 | function Team() { 10 | return ( 11 |
12 |
13 |
14 |
15 |

Coral Fussman

16 | 17 | 28 |
29 |
30 |
31 | 32 |
33 |
34 |
35 |

Sett Hein

36 | 37 | 45 |
46 |
47 |
48 | 49 |
50 |
51 |
52 |

Erik Matevosyan

53 | 54 | 65 |
66 |
67 |
68 | 69 |
70 |
71 |
72 |

Erik Rogel

73 | 74 | 82 |
83 |
84 |
85 |
86 | ); 87 | } 88 | 89 | export default Team; 90 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/TeamSocials.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import GitHubLogo from '../assets/github.svg'; 3 | import NPMLogo from '../assets/npm_light.svg'; 4 | import medium from '../assets/medium.svg'; 5 | import product_hunt from '../assets/product_hunt.svg'; 6 | 7 | export default function TeamSocials() { 8 | return ( 9 |
10 |

Atlantis

11 | 42 |
43 | ); 44 | } 45 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/TideHeader.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import banner from '../assets/frequency_banner.svg'; 3 | 4 | function TideHeader() { 5 | return ( 6 |
7 | {/* banner */} 8 |
9 |
10 |

ATLANTIS

11 |

Lightweight Server Side caching solution

12 |
13 | 21 |
22 |
23 | ); 24 | } 25 | 26 | export default TideHeader; 27 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/components/TypeField.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import MinusDark from '../assets/minus_dark.svg'; 3 | import MinusHover from '../assets/minus_light.svg'; 4 | // import images 5 | // import MinusHover fro 6 | 7 | /* 8 | component that renders each string-type field in our query 9 | */ 10 | 11 | const TypeField = (props) => { 12 | const { item, deleteItem, subQuery } = props; 13 | 14 | // Below is so that we don't render the minus button for the id field 15 | const [itemIsId, setItemIsId] = useState(false); 16 | useEffect(() => { 17 | if (item === 'user_id') setItemIsId(true); 18 | }, [itemIsId]); 19 | 20 | const tab =     , 21 | space =  ; 22 | 23 | // note: the "subQuery" tags are conditionally rendered only when we're in the cities field INSIDE the countries query 24 | return ( 25 | <> 26 |
27 | {tab} 28 | {tab} 29 | {subQuery && <>{tab}} 30 | {/* Generate minus button */} 31 | {/* Added {itemIsId && <>{space}{space}} so all the items are aligned vertically */} 32 | {itemIsId && ( 33 | <> 34 | {space} 35 | {space} 36 | 37 | )} 38 | {!itemIsId && ( 39 | 45 | )} 46 | {space} 47 | {item} 48 |
49 | 50 | ); 51 | }; 52 | 53 | export default TypeField; 54 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/containers/About.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import atlantis_QL from '../assets/atlantis_QL.svg'; 4 | import space_update_drop from '../assets/space_update_drop.svg'; 5 | import server_light from '../assets/servers_light.svg'; 6 | function About() { 7 | // const text = `Atlantis is a light-weight library that leverages Redis 8 | // key-value store to dynamically cache GraphQL queries as responses. \n 9 | // Atlantis is able to dynamically store deeply-nested queries and maintain 10 | // the most recent and relevant data as mutations are made to the database. \n 11 | // Queries that are more shallow and within the scope of previous queries 12 | // are pulled directly from the cache, offering further flexibility and \n 13 | // precision, without additional database requests or overriding previous key-values. \n` 14 | 15 | return ( 16 | <> 17 |
18 |
19 |

20 | Atlantis is a light-weight library that solves the issue of storing 21 | and maintaining deeply-nested GraphQL queries 22 |

23 |

24 | Ensuring the client always receives the most relevant data as 25 | mutations are made to the database.{' '} 26 |

27 |
28 |
29 |

The Power of Atlantis

30 | 31 |
32 |
33 |
34 |
35 |

Saving Time

36 | 40 |
41 |
42 |

43 | Atlantis leverages Redis's 'in-memory' quick lookup time to rapidly 44 | serve up cached graphQL responses regardless of size or structure. 45 |

46 | 47 |

48 | Redis integration along with Pub/Sub architecture also allows for 49 | scaling as your needs grow and you require more cache space or 50 | backup cache workers 51 |

52 |
53 |
54 |
55 |
56 |

57 | New queries that bear resemblance to previous queries are 58 | intelligently pulled from the existing cached nesting instead of 59 | creating a new key/value entry{' '} 60 |

61 |
62 |
63 |

Saving Space

64 | 65 |
66 |
67 | 68 | {/* s */} 69 | {/*

Queries that are more shallow and within the scope of previous queries 70 | are pulled directly from the cache, offering further flexibility and 71 | precision, without additional database requests or overriding previous key-values.

72 |

Atlantis that leverages Redis's 'in-memory' quick lookup time 73 | to dynamically cache GraphQL queries as responses.

*/} 74 | 75 | ); 76 | } 77 | 78 | export default About; 79 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/containers/MainContainer.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | // import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; 3 | import Dashboard from '../components/Dashboard'; 4 | import TeamContainer from './TeamContainer'; 5 | import About from './About'; 6 | import Tree from '../components/Tree'; 7 | import Arrow from '../components/Arrow'; 8 | 9 | function MainContainer() { 10 | // const [query, setQuery] = useState(() => {}); 11 | // const [queryInput, setQueryInput] = useState(() => ''); 12 | const ExpandTree = () => { 13 | const [displayTree, setDisplayTree] = useState(true); 14 | const onClick = () => setDisplayTree(!displayTree); 15 | 16 | return ( 17 |
18 | 19 | {displayTree ? null : } 20 |
21 | ); 22 | }; 23 | 24 | // else as button for now, arrow later 25 | return ( 26 |
27 | 28 |
29 |

LET'S TAKE A LOOK UNDER THE HOOD

30 |

Click Below to see the data flow

31 | 32 | 33 |
34 | 35 | 36 | 37 |
38 | ); 39 | } 40 | 41 | export default MainContainer; 42 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/containers/Navbar.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Logo from '../assets/Asset_3.svg'; 3 | 4 | const Navbar = () => { 5 | return ( 6 |
7 |
8 | 9 |
10 | 11 | 40 |
41 | ); 42 | }; 43 | 44 | export default Navbar; 45 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/containers/TeamContainer.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Team from '../components/Team'; 3 | import page_brk from '../assets/page_brk.svg'; 4 | import TeamSocials from '../components/TeamSocials'; 5 | 6 | export default function TeamContainer() { 7 | return ( 8 | <> 9 | 10 |

Developing Staff

11 |
12 | 13 | 14 |

A SeecLabs product Atantis™ made with intention

15 |
16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import Navbar from './containers/Navbar'; 4 | import App from './App'; 5 | 6 | import {BrowserRouter} from 'react-router-dom' 7 | // import styles from './scss/application.scss'; 8 | 9 | ReactDOM.render( 10 | 11 | 12 | 13 | ,document.getElementById('root')); 14 | 15 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Atlantis 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_about.scss: -------------------------------------------------------------------------------- 1 | .about-container { 2 | display: flex; 3 | flex-direction: row; 4 | height: 100%; 5 | align-items: center; 6 | } 7 | 8 | // .about { 9 | // display: flex; 10 | // flex-direction: column; 11 | // justify-content: center; 12 | // align-items: center; 13 | // text-align: center; 14 | // margin-bottom: 30px; 15 | // } 16 | 17 | .about-left { 18 | display: flex; 19 | flex-direction: column; 20 | height: 100%; 21 | width: 50%; 22 | color: $mainBlue; 23 | text-align: center; 24 | justify-content: center; 25 | align-items: center; 26 | h2 { 27 | // font-size: 20px; 28 | } 29 | } 30 | .about-right { 31 | display: flex; 32 | flex-direction: column; 33 | height: 100%; 34 | width: 50%; 35 | color: $mainBlue; 36 | justify-content: center; 37 | padding: 2%; 38 | h1 { 39 | text-align: end; 40 | font-size: 70px; 41 | 42 | margin-bottom: 1%; 43 | padding-right: 12%; 44 | } 45 | 46 | img { 47 | padding-left: 25%; 48 | align-self: center; 49 | width: 60%; 50 | padding-right: 12%; 51 | } 52 | } 53 | 54 | .redis-left { 55 | display: flex; 56 | flex-direction: column; 57 | height: 100%; 58 | width: 50%; 59 | color: $mainBlue; 60 | text-align: center; 61 | justify-content: center; 62 | h1 { 63 | font-size: 60px; 64 | margin-bottom: 0; 65 | } 66 | 67 | img { 68 | align-self: center; 69 | width: 70%; 70 | } 71 | } 72 | .redis-right { 73 | display: flex; 74 | flex-direction: column; 75 | height: 100%; 76 | width: 50%; 77 | color: $mainBlue; 78 | text-align: center; 79 | justify-content: center; 80 | padding: 2%; 81 | h3 { 82 | margin: 0; 83 | } 84 | } 85 | 86 | .server-left { 87 | display: flex; 88 | flex-direction: column; 89 | height: 100%; 90 | width: 50%; 91 | color: $mainBlue; 92 | text-align: center; 93 | justify-content: center; 94 | align-items: center; 95 | h2 { 96 | margin: 0; 97 | } 98 | } 99 | .server-right { 100 | display: flex; 101 | flex-direction: column; 102 | height: 100%; 103 | width: 50%; 104 | color: $mainBlue; 105 | text-align: center; 106 | justify-content: center; 107 | align-items: center; 108 | padding: 2%; 109 | h1 { 110 | font-size: 60px; 111 | margin-bottom: 0; 112 | } 113 | h3 { 114 | margin: 0; 115 | } 116 | img { 117 | padding-left: 3%; 118 | width: 60%; 119 | margin: 2%; 120 | margin-top: 8%; 121 | margin-bottom: 20%; 122 | // align-self: center; 123 | } 124 | } 125 | .server { 126 | align-self: center; 127 | width: 15%; 128 | } 129 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_arrow.scss: -------------------------------------------------------------------------------- 1 | #aniArrow { 2 | justify-content: center; 3 | align-content: center; 4 | align-items: center; 5 | margin-top: 10vh; 6 | // width: 30px; 7 | } 8 | .arrowButton { 9 | border: 0px; 10 | align-items: center; 11 | background: white; 12 | 13 | // width: 30px; 14 | } 15 | 16 | #aniArrow .arrow:first-child { 17 | opacity: 0.4; 18 | } 19 | #aniArrow .arrow:nth-child(2) { 20 | opacity: 0.7; 21 | } 22 | .arrow { 23 | padding-top: 10%; 24 | } 25 | .arrow:before { 26 | content: ''; 27 | width: 50px; 28 | height: 10px; 29 | background: $lightBlue; 30 | display: inline-block; 31 | transform: skewY(45deg); 32 | } 33 | .arrow:after { 34 | content: ''; 35 | width: 50px; 36 | height: 10px; 37 | background: $lightBlue; 38 | display: inline-block; 39 | transform: skewY(-45deg); 40 | } 41 | .arrowSliding { 42 | animation: slide 4s linear infinite; 43 | } 44 | .delay1 { 45 | animation-delay: 0s; 46 | } 47 | .delay2 { 48 | animation-delay: 1s; 49 | } 50 | .delay3 { 51 | animation-delay: 2s; 52 | } 53 | 54 | @keyframes slide { 55 | 0% { 56 | opacity: 1; 57 | } 58 | 25% { 59 | opacity: 0; 60 | } 61 | 55% { 62 | opacity: 0; 63 | } 64 | 100% { 65 | opacity: 1; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_main.scss: -------------------------------------------------------------------------------- 1 | /* row 1 */ 2 | 3 | .columnCenterContainer { 4 | background-color: white; 5 | display: flex; 6 | align-items: center; 7 | justify-content: center; 8 | flex-direction: column; 9 | overflow: auto; 10 | width: 85%; 11 | border-radius: 5%; 12 | padding: 2%; 13 | padding-top: 3%; 14 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 15 | -6px -2px 30px rgba(0, 0, 0, 0.15); 16 | border-radius: 30px 30px 30px 30px; 17 | } 18 | /* rowContainer */ 19 | 20 | .centerRow { 21 | display: flex; 22 | flex-direction: row; 23 | justify-content: center; 24 | flex-wrap: wrap; 25 | overflow: auto; 26 | } 27 | 28 | .entry { 29 | margin: 1%; 30 | padding: 0.5%; 31 | height: 350px; 32 | width: 20%; 33 | 34 | z-index: 1; 35 | border-radius: 10%; 36 | background: rgba(249, 249, 249, 0.075); 37 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 38 | -6px -2px 30px rgba(0, 0, 0, 0.15); 39 | border-radius: 30px 30px 30px 30px; 40 | font-size: 12px; 41 | } 42 | 43 | .entry1 { 44 | margin: 1%; 45 | padding: 0.5%; 46 | height: 100px; 47 | width: 50%; 48 | font-size: 20px; 49 | z-index: 1; 50 | border-radius: 10%; 51 | background: rgba(249, 249, 249, 0.075); 52 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 53 | -6px -2px 30px rgba(0, 0, 0, 0.15); 54 | border-radius: 30px 30px 30px 30px; 55 | font-size: 12px; 56 | } 57 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_nav.scss: -------------------------------------------------------------------------------- 1 | nav { 2 | margin-top: 10px; 3 | margin: auto; 4 | height: 40px; 5 | align-items: right; 6 | justify-content: center; 7 | font-weight: 400; 8 | z-index: 3; 9 | } 10 | 11 | // #info-header-container { 12 | // display: flex; 13 | // margin-bottom: 20px; 14 | // } 15 | 16 | // #info-header { 17 | // width: 30%; 18 | // margin: 10px auto; 19 | // } 20 | 21 | header { 22 | padding-top: 1%; 23 | width: 100vw; 24 | border-bottom: 2px solid $mainGrey; 25 | margin-bottom: 20px; 26 | font-weight: normal; 27 | letter-spacing: 7.2px; 28 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 29 | -6px -2px 30px rgba(0, 0, 0, 0.15); 30 | a { 31 | transition-duration: 50ms; 32 | } 33 | } 34 | 35 | // #logo-main-container { 36 | // display: flex; 37 | // justify-content: center; 38 | // } 39 | 40 | // #logo-main { 41 | // height: 60px; 42 | // margin: 1%; 43 | // } 44 | 45 | .nav-links { 46 | margin: auto; 47 | left: 50%; 48 | right: 50%; 49 | max-width: 800px; 50 | display: flex; 51 | justify-content: space-around; 52 | list-style-type: none; 53 | margin-bottom: 2%; 54 | } 55 | 56 | .nav-links li a { 57 | text-decoration: none; 58 | color: $mainBlue; 59 | } 60 | 61 | .nav-links li a:hover { 62 | text-decoration: underline; 63 | transform: scale(1.2); 64 | } 65 | 66 | .navLink { 67 | // margin: 2px; 68 | margin: 2%; 69 | // margin-top: 30px; 70 | padding: 5px; 71 | color: rgba(249, 249, 249); 72 | font-weight: 400; 73 | font-size: 20px; 74 | z-index: 4; 75 | } 76 | 77 | .tideHeader { 78 | margin-bottom: 2%; 79 | height: 65vh; 80 | width: 100vw; 81 | background-color: $mainBlue; 82 | background: url(../assets/frequency_banner.svg) bottom center $mainBlue; 83 | background-size: 100vw; 84 | } 85 | 86 | .headerMain { 87 | display: flex; 88 | flex-direction: row; 89 | height: 100%; 90 | } 91 | .left { 92 | display: flex; 93 | flex-direction: column; 94 | height: 100%; 95 | width: 50%; 96 | color: white; 97 | text-align: center; 98 | justify-content: center; 99 | h1 { 100 | font-size: 90px; 101 | margin-bottom: 0; 102 | } 103 | h3 { 104 | margin: 0; 105 | } 106 | } 107 | .right { 108 | display: flex; 109 | flex-direction: column; 110 | height: 100%; 111 | width: 50%; 112 | color: white; 113 | text-align: center; 114 | justify-content: center; 115 | a:hover { 116 | text-decoration: underline 0.05em; 117 | transform: scale(1.07); 118 | } 119 | a:active { 120 | color: white; 121 | } 122 | } 123 | 124 | .npm-button { 125 | font-family: 'Libre Baskerville', serif; 126 | font-weight: 600; 127 | font-size: 1.5em; 128 | align-self: center; 129 | width: 40%; 130 | border: 0; 131 | color: white; 132 | padding: 2%; 133 | // padding-top: 5%; 134 | // padding-bottom: 5%; 135 | border-radius: 10px 10px 10px 10px; 136 | background-color: rgba(249, 249, 249, 0.3); 137 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 138 | -6px -2px 30px rgba(0, 0, 0, 0.15); 139 | text-decoration: none; 140 | // a:hover { 141 | // text-decoration: underline; 142 | // transform: scale(1.5); 143 | // } 144 | // a:active { 145 | // color: white; 146 | // } 147 | } 148 | .right a { 149 | color: white; 150 | text-decoration: none; 151 | } 152 | .right a :link { 153 | color: white; 154 | } 155 | .right a :hover { 156 | text-decoration: underline; 157 | transform: scale(1.5); 158 | } 159 | .right a :active { 160 | color: white; 161 | } 162 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_speedometer.scss: -------------------------------------------------------------------------------- 1 | .speedometerContainer { 2 | // height: 20vh; 3 | height: 40vh; 4 | margin: 2%; 5 | background: rgba(249, 249, 249, 0.075); 6 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 7 | -6px -2px 30px rgba(0, 0, 0, 0.15); 8 | border-radius: 30px 30px 30px 30px; 9 | } 10 | .queryField { 11 | // height: 20vh; 12 | 13 | display: flex; 14 | 15 | justify-content: center; 16 | align-items: center; 17 | padding: 5%; 18 | } 19 | #meter { 20 | display: flex; 21 | flex-direction: row; 22 | 23 | padding-bottom: 0; 24 | margin: 0; 25 | } 26 | #speed { 27 | display: flex; 28 | flex-direction: column; 29 | width: 50%; 30 | padding-right: 0; 31 | } 32 | canvas { 33 | padding: 0; 34 | margin: 0; 35 | } 36 | #outer-window { 37 | overflow: hidden; 38 | } 39 | #window { 40 | height: 300px; 41 | width: 450px; 42 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 43 | -6px -2px 30px rgba(0, 0, 0, 0.15); 44 | border-radius: 5%; 45 | padding: 5%; 46 | overflow: auto; 47 | } 48 | 49 | .metricDash { 50 | display: flex; 51 | flex-direction: row; 52 | justify-content: center; 53 | align-items: center; 54 | } 55 | 56 | #metric { 57 | justify-content: center; 58 | align-items: center; 59 | text-align: center; 60 | height: 200px; 61 | width: 200px; 62 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 63 | -6px -2px 30px rgba(0, 0, 0, 0.15); 64 | border-radius: 5%; 65 | padding: 0; 66 | // align-self: center; 67 | margin: 1%; 68 | h5 { 69 | margin: 0%; 70 | } 71 | img { 72 | padding-top: 30%; 73 | } 74 | } 75 | #metric:hover { 76 | transform: scale(1.1); 77 | transition: all 0.5s; 78 | box-shadow: -2px -6px 15px #fff, 2px 6px 15px rgba(0, 0, 0, 0.15); 79 | } 80 | 81 | #field { 82 | display: flex; 83 | flex-direction: column; 84 | width: 50%; 85 | padding-left: 0; 86 | } 87 | .style { 88 | animation: true; 89 | animation-duration: 1000ms; 90 | } 91 | #dial { 92 | justify-content: center; 93 | align-items: center; 94 | text-align: center; 95 | height: 200px; 96 | width: 200px; 97 | box-shadow: -6px -2px 30px rgba(255, 255, 255, 0.15), 98 | -6px -2px 30px rgba(0, 0, 0, 0.15); 99 | border-radius: 5%; 100 | // padding-top: 30%; 101 | // align-self: center; 102 | margin: 1%; 103 | h5 { 104 | margin: 0%; 105 | } 106 | img { 107 | padding-top: 30%; 108 | } 109 | } 110 | #dial-down { 111 | padding-top: 25%; 112 | } 113 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_team.scss: -------------------------------------------------------------------------------- 1 | #team { 2 | display: flex; 3 | flex-direction: row; 4 | justify-content: center; 5 | width: 80vw; 6 | padding-bottom: 5%; 7 | } 8 | 9 | .social { 10 | display: flex; 11 | flex-direction: row; 12 | height: 80%; 13 | justify-content: center; 14 | align-items: center; 15 | flex: 0 0 25%; 16 | } 17 | .member-cards { 18 | display: flex; 19 | flex-direction: row; 20 | 21 | img { 22 | width: 150px; 23 | } 24 | } 25 | .personal { 26 | display: flex; 27 | flex-direction: column; 28 | align-items: center; 29 | 30 | img { 31 | width: 150px; 32 | } 33 | } 34 | .links { 35 | display: flex; 36 | 37 | a { 38 | margin: 0; 39 | } 40 | } 41 | #team-logo-icon { 42 | display: flex; 43 | margin: 5px; 44 | height: 60px; 45 | width: 60px; 46 | } 47 | #logo-main-container { 48 | display: flex; 49 | justify-content: center; 50 | } 51 | #logo-main { 52 | height: 60px; 53 | margin-left: 35px; 54 | } 55 | .team-social-container { 56 | display: flex; 57 | flex-direction: column; 58 | align-items: center; 59 | font-size: 25px; 60 | padding-bottom: 5%; 61 | } 62 | .team-social-icons { 63 | display: flex; 64 | justify-content: center; 65 | } 66 | .team-social { 67 | display: flex; 68 | justify-content: center; 69 | margin: 5%; 70 | } 71 | #team-container { 72 | p { 73 | justify-content: center; 74 | text-align: center; 75 | align-items: center; 76 | align-self: center; 77 | font-size: 12px; 78 | // margin-left: 50%; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_tree.scss: -------------------------------------------------------------------------------- 1 | .tree-div { 2 | min-height: 600px; 3 | h1 { 4 | margin-bottom: 0px; 5 | } 6 | h2 { 7 | margin-top: 0.5%; 8 | margin-bottom: 0px; 9 | } 10 | } 11 | .tree { 12 | margin: 1%; 13 | } 14 | 15 | div.custom-container { 16 | text-align: center; 17 | background-color: #242424; 18 | } 19 | 20 | svg.custom .node circle { 21 | fill: $lightBlue; 22 | stroke: #25b898; 23 | 24 | size: 10px; 25 | } 26 | 27 | svg.custom .node text { 28 | font-size: 20px; 29 | background-color: rgb(95, 93, 93); 30 | fill: #f4f4f4; 31 | text-shadow: 0 2px 10px rgb(59, 58, 58); 32 | // transform: rotate(-90deg); 33 | margin: 10px; 34 | } 35 | 36 | svg.custom .node { 37 | cursor: pointer; 38 | } 39 | 40 | svg.custom path.link { 41 | fill: none; 42 | stroke: $lightBlue; 43 | stroke-width: 6px; 44 | } 45 | 46 | // #body { 47 | // width: 50%; 48 | // margin: 0 auto; 49 | // position: relative; 50 | // } 51 | 52 | // rect { 53 | // fill: none; 54 | // pointer-events: all; 55 | // } 56 | 57 | // pre { 58 | // font-size: 22px; 59 | // } 60 | 61 | // line { 62 | // stroke: #0e0; 63 | // stroke-width: 5px; 64 | // } 65 | 66 | // .string, 67 | // .regexp { 68 | // color: #f39; 69 | // } 70 | 71 | // .keyword { 72 | // color: #00c; 73 | // } 74 | 75 | // .comment { 76 | // color: #777; 77 | // font-style: oblique; 78 | // } 79 | 80 | // .number { 81 | // color: #369; 82 | // } 83 | 84 | // .class, 85 | // .special { 86 | // color: #1181b8; 87 | // } 88 | 89 | // a:link, 90 | // a:visited { 91 | // color: rgb(108, 206, 185); 92 | // text-decoration: none; 93 | // } 94 | 95 | // a:hover { 96 | // color: #666; 97 | // } 98 | 99 | // .node circle { 100 | // cursor: pointer; 101 | // fill: #fff; 102 | // stroke: $mainBlue; 103 | // stroke-width: 2px; 104 | // } 105 | 106 | // .node text { 107 | // font-size: 18px; 108 | // } 109 | 110 | // path.link { 111 | // fill: none; 112 | // stroke: #ccc; 113 | // stroke-width: 3px; 114 | // } 115 | -------------------------------------------------------------------------------- /Atlantis-Demo/client/scss/_variables.scss: -------------------------------------------------------------------------------- 1 | // $white: rgba(249, 249, 249, 0.15); 2 | // $darkOrange: #f57921; 3 | $mainGrey: rgba(249, 249, 249, 0.075); 4 | $mainBlue: rgba(0, 51, 56); 5 | $lightBlue: rgb(129, 200, 202); 6 | -------------------------------------------------------------------------------- /Atlantis-Demo/demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/demo.zip -------------------------------------------------------------------------------- /Atlantis-Demo/docker-compose-dev-hot.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | dev: 4 | image: seeclabs/demo-dev 5 | container_name: 'demo-dev' 6 | ports: 7 | - '8080:8080' 8 | volumes: 9 | - .:/usr/src/app 10 | - node_modules:/usr/src/app/node_modules 11 | command: npm run dev 12 | volumes: 13 | node_modules: 14 | -------------------------------------------------------------------------------- /Atlantis-Demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Atlantis-Demo", 3 | "version": "1.0.0", 4 | "description": "caching solution for GraphQL", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "NODE_ENV=production node server/server.js", 8 | "build": "webpack --config ./webpack.config.js", 9 | "dev": "NODE_ENV=development webpack serve --open & NODE_ENV=development nodemon server/server.js", 10 | "gulp-prod": "node_modules/.bin/gulp prod", 11 | "docker-dev:hot": "docker-compose -f docker-compose-dev-hot.yml up", 12 | "gulp-dev": "node_modules/.bin/gulp dev" 13 | }, 14 | "nodemonConfig": { 15 | "ignore": [ 16 | "build", 17 | "client" 18 | ] 19 | }, 20 | "author": "Atlantis", 21 | "license": "ISC", 22 | "dependencies": { 23 | "browserify": "^17.0.0", 24 | "connect-redis": "^6.0.0", 25 | "cors": "^2.8.5", 26 | "d3": "^7.0.0", 27 | "d3-format": "^3.0.1", 28 | "d3-scale": "^4.0.0", 29 | "d3-shape": "^3.0.1", 30 | "express": "^4.12.3", 31 | "express-graphql": "^0.12.0", 32 | "graphql": "^15.5.0", 33 | "loader": "^2.1.1", 34 | "node": "^16.0.0", 35 | "pg": "^8.6.0", 36 | "prop-types": "^15.6.1", 37 | "react": "^17.0.2", 38 | "react-canvas-gauges": "^1.2.1", 39 | "react-dom": "^17.0.2", 40 | "react-gauge-chart": "^0.3.0", 41 | "react-router-dom": "^5.2.0", 42 | "react-svg-loader": "^3.0.3", 43 | "react-tree-graph": "^6.0.0", 44 | "redis": "^3.1.2", 45 | "resolve-url-loader": "^4.0.0", 46 | "styled-components": "^5.2.3", 47 | "svg-url-loader": "^7.1.1", 48 | "webpack-dev-server": "^3.11.2" 49 | }, 50 | "devDependencies": { 51 | "@babel/core": "^7.14.5", 52 | "@babel/plugin-syntax-jsx": "^7.14.5", 53 | "@babel/preset-env": "^7.14.5", 54 | "@babel/preset-react": "^7.13.13", 55 | "@svgr/webpack": "^5.5.0", 56 | "babel-loader": "^8.2.2", 57 | "concurrently": "^6.0.2", 58 | "cross-env": "^7.0.3", 59 | "css-loader": "^5.2.6", 60 | "dotenv": "^8.2.0", 61 | "file-loader": "^6.2.0", 62 | "html-webpack-plugin": "^5.3.1", 63 | "isomorphic-fetch": "^3.0.0", 64 | "node-sass": "^6.0.0", 65 | "nodemon": "^2.0.7", 66 | "sass": "^1.32.12", 67 | "sass-loader": "^11.1.1", 68 | "scss-loader": "0.0.1", 69 | "style": "0.0.3", 70 | "style-loader": "^2.0.0", 71 | "svg-inline-loader": "^0.8.2", 72 | "url-loader": "^4.1.1", 73 | "webpack": "^5.38.1", 74 | "webpack-cli": "^4.7.2" 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Atlantis-Demo/scripts/deploy.sh: -------------------------------------------------------------------------------- 1 | echo "Processing deploy.sh" 2 | # Set EB BUCKET as env variable 3 | EB_BUCKET=elasticbeanstalk-us-west-1-026744380512 4 | # Set the default region for aws cli 5 | aws configure set default.region us-east-1 6 | # Log in to ECR 7 | eval $(aws ecr get-login --no-include-email --region us-west-1) 8 | # Build docker image based on our production Dockerfile 9 | docker build -t seeclabs/mm . 10 | # tag the image with the Travis-CI SHA 11 | docker tag seeclabs/mm:latest 026744380512.dkr.ecr.us-west-1.amazonaws.com/seeclabs:$TRAVIS_COMMIT 12 | # Push built image to ECS 13 | docker push 026744380512.dkr.ecr.us-west-1.amazonaws.com/seeclabs:$TRAVIS_COMMIT 14 | # Use the linux sed command to replace the text '' in our Dockerrun file with the Travis-CI SHA key 15 | sed -i='' "s//$TRAVIS_COMMIT/" Dockerrun.aws.json 16 | # Zip up our codebase, along with modified Dockerrun and our .ebextensions directory 17 | zip -r mm-prod-deploy.zip Dockerrun.aws.json .ebextensions 18 | # Upload zip file to s3 bucket 19 | aws s3 cp mm-prod-deploy.zip s3://$EB_BUCKET/mm-prod-deploy.zip 20 | # Create a new application version with new Dockerrun 21 | aws elasticbeanstalk create-application-version --application-name seec-labs-demo --version-label $TRAVIS_COMMIT --source-bundle S3Bucket=$EB_BUCKET,S3Key=mm-prod-deploy.zip 22 | # Update environment to use new version number 23 | aws elasticbeanstalk update-environment --environment-name seec-labs-demo --version-label $TRAVIS_COMMIT -------------------------------------------------------------------------------- /Atlantis-Demo/server/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-Demo/server/.DS_Store -------------------------------------------------------------------------------- /Atlantis-Demo/server/models.js: -------------------------------------------------------------------------------- 1 | // connect to DB here 2 | 3 | const { Pool } = require('pg'); 4 | require('dotenv').config(); 5 | const url = 6 | 'postgres://ulaeigrr:UDxw3pikBUhDn4hcQVJ4b3CO8aJ0MICY@kashin.db.elephantsql.com/ulaeigrr'; 7 | 8 | // create a new pool here using the connection string above 9 | const pool = new Pool({ 10 | connectionString: url, 11 | }); 12 | 13 | module.exports = { 14 | query: (text, params, callback) => { 15 | console.log('executed query', text); 16 | return pool.query(text, params, callback); 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /Atlantis-Demo/server/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const path = require('path'); 4 | require('dotenv').config(); 5 | const { atlantis } = require('../atlantis-for-demo/index'); 6 | 7 | const { graphqlHTTP } = require('express-graphql'); 8 | const schema = require('./schema/schema.js'); 9 | 10 | const redis = require('redis'); 11 | 12 | const PORT = process.env.PORT || 3000; 13 | 14 | app.use(express.static(path.join(__dirname, '../build/'))); 15 | app.use(express.json()); 16 | app.use(express.urlencoded({ extended: true })); 17 | 18 | const redisClient = redis.createClient({ 19 | host: 'localhost', 20 | port: 6379, 21 | }); 22 | 23 | app.use('/cachetest/', atlantis(redisClient, schema), (req, res) => { 24 | console.log('backend hit!'); 25 | res.json({ data: res.locals.graphQLResponse, time: res.locals.dif }); 26 | }); 27 | 28 | app.use( 29 | '/graphql', 30 | graphqlHTTP({ 31 | schema: schema, 32 | graphiql: true, 33 | }) 34 | ); 35 | 36 | const clearCache = (req, res, next) => { 37 | const log = () => { 38 | console.log('Redis Cache Cleared'); 39 | }; 40 | redisClient.flushall('ASYNC', log); 41 | return next(); 42 | }; 43 | 44 | app.get('/clearcache/', clearCache, (req, res, next) => { 45 | res.locals.completed = 'cache cleared'; 46 | res.send(res.locals.completed); 47 | }); 48 | 49 | //app.use((req, res) => res.status(404).send('This is not the page you\'re looking for...')); 50 | 51 | // catch 404 and forward to error handler 52 | app.use(function (req, res, next) { 53 | const err = new Error('Not Found'); 54 | err.status = 404; 55 | next(err); 56 | }); 57 | 58 | // error handler 59 | app.use(function (err, req, res, next) { 60 | // set locals, only providing error in development 61 | res.locals.message = err.message; 62 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 63 | 64 | console.error(err); 65 | res.status(err.status || 500).send(res.locals.message); 66 | }); 67 | 68 | app.listen(PORT, () => { 69 | console.log('listening to localhost 3000'); 70 | }); //listens on port 3000 -> http://localhost:3000/ 71 | 72 | // console.log('nodeENV is ', process.env.NODE_ENV); 73 | 74 | // catch-all route handler for any requests to an unknown route 75 | app.get('*', (req, res) => { 76 | console.log('catch all route hit'); 77 | res.status(200).sendFile(path.join(__dirname, '../client/public/index.html')); 78 | }); 79 | // module.exports = { schema } 80 | -------------------------------------------------------------------------------- /Atlantis-Demo/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const path = require('path'); 3 | const entry = path.resolve(__dirname, './client/index.js'); 4 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 5 | 6 | module.exports = { 7 | module: { 8 | rules: [ 9 | { 10 | test: /\.jsx?/, 11 | exclude: /node_modules/, 12 | use: { 13 | loader: 'babel-loader', 14 | options: { 15 | presets: ['@babel/preset-env', '@babel/preset-react'], 16 | }, 17 | }, 18 | }, 19 | { 20 | test: /\.s[ac]ss$/i, 21 | exclude: /node_modules/, 22 | use: ['style-loader', 'css-loader', 'sass-loader'], 23 | }, 24 | { 25 | test: /\.(png|jpg|gif)$/i, 26 | use: [ 27 | { 28 | loader: 'url-loader', 29 | options: { 30 | limit: 8192, 31 | }, 32 | }, 33 | ], 34 | }, 35 | { 36 | test: /\.svg$/, 37 | use: [ 38 | { 39 | loader: 'svg-url-loader', 40 | options: { 41 | limit: 10000, 42 | }, 43 | }, 44 | ], 45 | }, 46 | ], 47 | }, 48 | entry: entry, 49 | output: { 50 | path: path.resolve(__dirname, 'build'), 51 | filename: 'bundle.js', 52 | publicPath: '/', 53 | }, 54 | devServer: { 55 | // host: '0.0.0.0', 56 | contentBase: [ 57 | path.resolve(__dirname, '/build'), 58 | path.resolve(__dirname + '/client/public'), 59 | ], 60 | historyApiFallback: true, 61 | proxy: { 62 | '/cachetest': { target: 'http://localhost:3000', changeOrigin: true }, 63 | '/clearcache/': { target: 'http://localhost:3000', changeOrigin: true }, 64 | '/eriktest/': 'http://localhost:3000', 65 | '/graphql/': 'http://localhost:3000', 66 | }, 67 | hot: true, 68 | }, 69 | mode: 'development', 70 | plugins: [ 71 | new HtmlWebpackPlugin({ 72 | template: path.resolve(__dirname, 'client', 'public', 'index.html'), 73 | }), 74 | ], 75 | }; 76 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules/ -------------------------------------------------------------------------------- /Atlantis-SourceCode/dump.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-SourceCode/dump.rdb -------------------------------------------------------------------------------- /Atlantis-SourceCode/jest-setup.js: -------------------------------------------------------------------------------- 1 | module.exports = async () => { 2 | global.testServer = await require('./server.ts'); 3 | }; 4 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/jest-teardown.js: -------------------------------------------------------------------------------- 1 | module.exports = async (globalConfig) => { 2 | testServer.close(); 3 | }; 4 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ['/__tests__'], 3 | testMatch: [ 4 | '**/__tests__/**/*.+(ts|tsx|js)', 5 | '**/?(*.)+(spec|test).+(ts|tsx|js)', 6 | ], 7 | transform: { 8 | '^.+\\.(ts|tsx)$': 'ts-jest', 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript-crud", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "src/server.ts", 6 | "scripts": { 7 | "test": "jest --detectOpenHandles", 8 | "start": "nodemon server/server.ts", 9 | "build": "tsc" 10 | }, 11 | "author": "coral", 12 | "license": "ISC", 13 | "jest": { 14 | "globalSetup": "./jest-setup.js", 15 | "globalTeardown": "./jest-teardown.js" 16 | }, 17 | "dependencies": { 18 | "@types/express-session": "^1.17.3", 19 | "atlantis-cache": "^3.0.0", 20 | "connect-redis": "^5.2.0", 21 | "dotenv": "^9.0.2", 22 | "express": "^4.17.1", 23 | "express-graphql": "^0.12.0", 24 | "express-session": "^1.17.2", 25 | "graphql": "^15.5.0", 26 | "jest": "^27.0.4", 27 | "node-fetch": "^2.6.1", 28 | "pg": "^8.6.0", 29 | "redis": "^3.1.2", 30 | "shelljs": "^0.8.4", 31 | "ts-jest": "^27.0.3", 32 | "type-graphql": "^1.1.1" 33 | }, 34 | "devDependencies": { 35 | "@types/connect-redis": "0.0.16", 36 | "@types/dotenv": "^8.2.0", 37 | "@types/express": "^4.17.11", 38 | "@types/jest": "26.0.23", 39 | "@types/node": "^15.3.0", 40 | "@types/node-fetch": "^2.5.10", 41 | "@types/redis": "^2.8.28", 42 | "morgan": "^1.10.0", 43 | "nodemon": "^2.0.7", 44 | "ts-node": "^9.1.1", 45 | "type-graphql": "^1.1.1", 46 | "typescript": "^4.2.4" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/server/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Atlantis-SourceCode/server/.DS_Store -------------------------------------------------------------------------------- /Atlantis-SourceCode/server/model.ts: -------------------------------------------------------------------------------- 1 | const { Pool } = require('pg'); 2 | require('dotenv').config(); 3 | const url:string = "postgres://yypgkmjh:AaJqfhwESQgDVWFxX8K2LL3FwAvEaXGA@batyr.db.elephantsql.com/yypgkmjh"; 4 | 5 | // create a new pool here using the connection string above 6 | const pool = new Pool({ 7 | connectionString: url, 8 | }); 9 | 10 | module.exports = { 11 | query: (text: any, params: any, callback: any) => { 12 | console.log('executed query', text); 13 | return pool.query(text, params, callback); 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/server/server.ts: -------------------------------------------------------------------------------- 1 | import express, { Application, Request, Response, NextFunction } from 'express'; 2 | //the extra variables available from express define express types 3 | import path from 'path'; 4 | import dotenv from 'dotenv'; 5 | import redis from 'redis'; 6 | //if curious see package.json, had to install types for some of these dependencies to work with TS 7 | import { graphqlHTTP } from 'express-graphql'; 8 | import { graphql, visit, parse, BREAK } from 'graphql'; 9 | const morgan = require('morgan'); 10 | const schema = require('./schema/schema'); 11 | // const { atlantis } = require('atlantis-cache'); 12 | const { atlantis } = require('../src/index'); 13 | const { performance } = require('perf_hooks'); 14 | 15 | dotenv.config(); 16 | const redisClient = redis.createClient({ 17 | host: 'localhost', 18 | port: 6379, 19 | }); 20 | 21 | const app: Application = express(); 22 | app.use(express.json()); 23 | app.use(morgan('dev')); 24 | app.use(express.static(path.join(__dirname, './views'))); 25 | 26 | 27 | app.use('/atlantis', atlantis(redisClient, schema), async (req, res) => { 28 | console.log('dif is', res.locals.dif); 29 | return res.status(202).json({ data: res.locals.graphQLResponse, responseTime: res.locals.dif }); 30 | }); 31 | 32 | app.use('/graphql', 33 | graphqlHTTP({ 34 | schema: schema, 35 | graphiql: true, 36 | }) 37 | ) 38 | 39 | 40 | const PORT = process.env.PORT || 3000 41 | 42 | 43 | app.get('/', (req: Request, res: Response) => { 44 | return res.status(200).sendFile(path.join(__dirname, './views/index.html')); 45 | }); 46 | 47 | app.listen(PORT, () => { 48 | console.log(`server started at http://localhost:${PORT}`); 49 | }); 50 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/server/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Typescript Todo 6 | 7 | 8 | 9 | 10 | 11 |
12 |

trying typescript

13 |

add to begin

14 | 15 | 16 | 17 |
18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/server/views/main.js: -------------------------------------------------------------------------------- 1 | const buttonAdd = document.getElementById('task-button'); 2 | const inputField = document.getElementById('task'); 3 | 4 | document.addEventListener('DOMContentLoaded', () => { 5 | console.log('DOM!'); 6 | const Taskdiv = document.createElement('div'); 7 | Taskdiv.innerHTML = 'from the JS script'; 8 | Taskdiv.id = 'task-div'; 9 | document.body.append(Taskdiv); 10 | document.getElementById('query-button').addEventListener('click', () => { 11 | const query = document.getElementById('task'); 12 | const queryValue = query.value; 13 | // assign the value of the input to body so we can send it to the DB. 14 | const body = { query: queryValue }; 15 | console.log(body); 16 | fetch('/atlantis', { 17 | method: 'POST', 18 | headers: { 19 | 'Content-Type': 'application/json', 20 | Accept: 'application/json', 21 | }, 22 | body: JSON.stringify(body), 23 | }) 24 | .then((res) => res.json()) 25 | .then((data) => console.log('data found in cache', data['responseTime'])); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/exportHelper.ts: -------------------------------------------------------------------------------- 1 | import { traverseAST } from './traverseAST'; 2 | import { restructureAST } from './restructureAST'; 3 | import { structureToString } from './structureToString'; 4 | import { isSubset } from './isSubset'; 5 | import { parseDataFromCache } from './parseDataFromCache'; 6 | import { makeGQLrequest } from './makeGQLrequest'; 7 | 8 | export { 9 | traverseAST, 10 | restructureAST, 11 | structureToString, 12 | isSubset, 13 | parseDataFromCache, 14 | makeGQLrequest, 15 | }; 16 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/getMutationMap.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | const getMutationMap = (schema: any) => { 4 | const mutationMap: any = {}; 5 | // get object containing all root mutations defined in the schema 6 | const mutationTypeFields = schema._mutationType._fields; 7 | // if queryTypeFields is a function, invoke it to get object with queries 8 | const mutationsObj = 9 | typeof mutationTypeFields === 'function' 10 | ? mutationTypeFields() 11 | : mutationTypeFields; 12 | 13 | for (const mutation in mutationsObj) { 14 | // get name of GraphQL type returned by query 15 | // if ofType --> this is collection, else not collection 16 | let returnedType; 17 | if (mutationsObj[mutation].type.ofType) { 18 | returnedType = []; 19 | returnedType.push(mutationsObj[mutation].type.ofType.name); 20 | } 21 | if (mutationsObj[mutation].type.name) { 22 | returnedType = mutationsObj[mutation].type.name; 23 | } 24 | mutationMap[mutation] = returnedType; 25 | } 26 | return mutationMap; 27 | }; 28 | 29 | export { getMutationMap }; 30 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/isSubset.ts: -------------------------------------------------------------------------------- 1 | /* compare incoming queryStructure and existing queryStructure in redis to determine if all the fields in the incoming query exist in the cache*/ 2 | const isSubset = (rootObj: any, subObj: any): boolean => { 3 | return Object.keys(subObj).every((el) => { 4 | if (typeof subObj[el] == 'object') { 5 | return isSubset(rootObj[el], subObj[el]); 6 | } 7 | if (!subObj || !rootObj) return false; 8 | return subObj[el] === rootObj[el]; 9 | }); 10 | }; 11 | 12 | export { isSubset }; 13 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/makeGQLrequest.ts: -------------------------------------------------------------------------------- 1 | import { graphql } from 'graphql'; 2 | import { typesInQuery } from './typesInQuery'; 3 | import { updateRedisAfterMutation } from './updateRedisAfterMutation'; 4 | 5 | const makeGQLrequest = async ( 6 | redisClient: any, 7 | schema: any, 8 | redisKey: any, 9 | queryMade: any, 10 | proto: any, 11 | operationType: any 12 | ) => { 13 | return new Promise((resolve) => { 14 | graphql(schema, queryMade).then((response) => { 15 | const graphQLResponse: any = response.data; 16 | if (operationType == 'unCacheable') return graphQLResponse 17 | if (operationType !== 'mutation') { 18 | const subscriptions = typesInQuery(graphQLResponse); 19 | // subscribe the query to mutations of type subscription 20 | for (let key in subscriptions) { 21 | redisClient.get( 22 | `${subscriptions[key]}:Publisher`, 23 | (error: any, values: any) => { 24 | if (error) { 25 | return; 26 | } 27 | // Case where this query is the first to subscribe to this type. 28 | // Create a key, and subscribe the query to that key. 29 | if (!values) { 30 | const subsArr = [redisKey]; 31 | redisClient.set( 32 | `${subscriptions[key]}:Publisher`, 33 | JSON.stringify(subsArr) 34 | ); 35 | } else { 36 | // Case where other queries are also subscribed to changes of this type. 37 | const subsArr = JSON.parse(`${values}`); 38 | subsArr.push(redisKey); 39 | 40 | redisClient.set( 41 | `${subscriptions[key]}:Publisher`, 42 | JSON.stringify(subsArr) 43 | ); 44 | } 45 | } 46 | ); 47 | } 48 | // store key-value for graphqlRespose from the database 49 | redisClient.set(redisKey, JSON.stringify({ data: graphQLResponse, fields: proto })); 50 | } else { 51 | // since we have a mutation we need to clear all subscribed queries 52 | updateRedisAfterMutation(redisClient, schema, graphQLResponse); 53 | } 54 | resolve(graphQLResponse); 55 | }); 56 | }) 57 | }; 58 | 59 | export { makeGQLrequest }; 60 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/parseDataFromCache.ts: -------------------------------------------------------------------------------- 1 | 2 | /*ParseDataFromCache traverses redis's cache and filters object properties by keys from prototype object*/ 3 | function parseDataFromCache(cacheObj: any, fieldObj: any) { 4 | const result: any = {}; 5 | 6 | Object.keys(cacheObj).forEach((key) => { 7 | //get the value of cacheObj and FieldObj based on key 8 | const subCacheObj = cacheObj[key]; 9 | const subFieldObj = fieldObj[key]; 10 | //if subCacheObj is an array, iterate through ele and trigger ObjectFilter 11 | if (Array.isArray(subCacheObj)) { 12 | result[key] = subCacheObj.map((obj) => { 13 | return ObjectFilter(obj, subFieldObj); 14 | }); 15 | } else if (typeof subCacheObj === 'object') { 16 | result[key] = ObjectFilter(subCacheObj, subFieldObj); 17 | } 18 | }); 19 | return result; 20 | } 21 | 22 | /*helper function filters out object properties on current layer and invoke rescursive call if there are nested fields */ 23 | const ObjectFilter = (cacheObj: any, fieldObj: any[]) => { 24 | let resultObj: any = {}; 25 | //iterate thorugh fieldObj 26 | fieldObj.forEach((field) => { 27 | //if cur field is a string, store the the properites to resultObj based on fields 28 | if (typeof field === 'string') { 29 | resultObj[field] = cacheObj[field]; 30 | } else { 31 | //if cur field is an object, invoke rescurive call on ObjectFilter based on value 32 | const fieldName = Object.keys(field)[0]; 33 | if (cacheObj[fieldName] === null) { 34 | resultObj[fieldName] = null; 35 | } else if (Array.isArray(cacheObj[fieldName])) { 36 | resultObj[fieldName] = cacheObj[fieldName].map((obj: any) => { 37 | return ObjectFilter(obj, field[fieldName]); 38 | }); 39 | } else if (typeof cacheObj[fieldName] === 'object') { 40 | resultObj[fieldName] = ObjectFilter( 41 | cacheObj[fieldName], 42 | field[fieldName] 43 | ); 44 | } 45 | } 46 | }); 47 | 48 | return resultObj; 49 | }; 50 | 51 | 52 | 53 | export { parseDataFromCache }; 54 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/restructureAST.ts: -------------------------------------------------------------------------------- 1 | import { visit } from 'graphql'; 2 | 3 | const restructureAST = (AST: any) => { 4 | let fields_Object: any; 5 | let layer: string = ''; 6 | 7 | visit(AST, { 8 | SelectionSet(node: any, key, parent: any) { 9 | if (parent.kind === 'Field') { 10 | const tempObj: any = {}; 11 | const parentName = parent.name.value; 12 | if (layer.length === 0) { 13 | layer = parentName; 14 | } 15 | const tempArray: any = []; 16 | node.selections.forEach((e: any) => tempArray.push(e.name.value)); 17 | tempObj[parentName] = tempArray; 18 | if (!fields_Object) { 19 | fields_Object = tempObj; 20 | } else { 21 | fields_Object[layer].forEach((e: any, i: any) => { 22 | if (e === parentName) { 23 | fields_Object[layer][i] = tempObj; 24 | } 25 | }); 26 | layer = parentName; 27 | } 28 | } 29 | }, 30 | }); 31 | return fields_Object; 32 | }; 33 | 34 | export { restructureAST }; 35 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/structureToString.ts: -------------------------------------------------------------------------------- 1 | // Parse through AST proto and convert it into a GQL query string 2 | const structureToString = (queryStructure: any, queryArgs: any) => { 3 | const argsToQuery = (queryArgs: any) => { 4 | let string = ''; 5 | for (let key in queryArgs) { 6 | for (let innerKey in queryArgs[key]) { 7 | // accounts for edge case where an Int is passed in as an arguement. 8 | if (!isNaN(queryArgs[key][innerKey])) { 9 | string += innerKey + ': ' + queryArgs[key][innerKey] + ' '; 10 | break; 11 | } 12 | string += innerKey + ': ' + '"' + queryArgs[key][innerKey] + '"' + ' '; 13 | } 14 | } 15 | return '(' + string + ')'; 16 | }; 17 | 18 | let mainString = ''; 19 | for (let key in queryStructure) { 20 | if (typeof queryStructure[key] !== 'object') { 21 | mainString += ' ' + key + ' '; 22 | } else { 23 | mainString += ' ' + key + ' '; 24 | if (queryArgs) { 25 | if (typeof queryArgs[key] == 'object') { 26 | const inner = argsToQuery(queryArgs); 27 | mainString += inner; 28 | } 29 | } 30 | mainString += structureToString(queryStructure[key], {}); 31 | } 32 | } 33 | return '{' + mainString + '}'; 34 | }; 35 | 36 | export { structureToString }; 37 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/traverseAST.ts: -------------------------------------------------------------------------------- 1 | import { visit, BREAK } from 'graphql'; 2 | 3 | const traverseAST = (AST: any) => { 4 | // initialize variables for tracking AST extraction 5 | const queryStructure = {}; 6 | 7 | let parentFieldName: any; 8 | let operationType: any; 9 | let fieldArgs: any; 10 | let argsName: any; 11 | let queryArgs: any = null; 12 | const stack: any[] = []; 13 | 14 | // built in GQL function that recursively vists all nodes in an AST tree 15 | visit(AST, { 16 | enter(node: any) { 17 | if (node.directives as any) { 18 | if (node.directives.length > 0) { 19 | // if a node has directives it is uncacheable 20 | operationType = 'unCacheable'; 21 | return BREAK; 22 | } 23 | } 24 | }, 25 | // 26 | OperationDefinition(node) { 27 | operationType = node.operation; 28 | if (node.operation === 'subscription') { 29 | // if a query is a subscription it is uncacheable 30 | operationType = 'unCacheable'; 31 | return BREAK; 32 | } 33 | }, 34 | Field: { 35 | enter(node: any) { 36 | if (node.alias) { 37 | // if a query has an alias it is uncacheable 38 | operationType = 'unCacheable'; 39 | return BREAK; 40 | } 41 | if (node.arguments && node.arguments.length > 0) { 42 | fieldArgs = node.arguments[0].value.value; 43 | argsName = node.arguments[0].name.value; 44 | queryArgs = queryArgs || {}; 45 | queryArgs[node.name.value] = {}; 46 | 47 | // collect arguments if arguments contain id, otherwise make query unCachable 48 | // hint: can check for graphQl type ID instead of string 'id' 49 | for (let i = 0; i < node.arguments.length; i++) { 50 | const key: any = node.arguments[i].name.value; 51 | const value: any = node.arguments[i].value.value; 52 | 53 | // for queries cache can handle only id as argument 54 | if (operationType === 'query') { 55 | if (!key.includes('id')) { 56 | operationType = 'unCacheable'; 57 | return BREAK; 58 | } 59 | } 60 | queryArgs[node.name.value][key] = value; 61 | } 62 | } 63 | // add value to stack 64 | stack.push(node.name.value); 65 | }, 66 | leave(node) { 67 | // remove value from stack 68 | stack.pop(); 69 | }, 70 | }, 71 | SelectionSet(node: any, key, parent: any, path, ancestors) { 72 | if (parent.kind === 'Field') { 73 | const tempObject: any = {}; 74 | for (let field of node.selections) { 75 | tempObject[field.name.value] = true; 76 | } 77 | // loop through stack to get correct path in proto for temp object; 78 | // mutates original prototype object; 79 | const protoObj = stack.reduce((prev, curr, index) => { 80 | return index + 1 === stack.length // if last item in path 81 | ? (prev[curr] = tempObject) // set value 82 | : (prev[curr] = prev[curr]); // otherwise, if index exists, keep value 83 | }, queryStructure); 84 | protoObj['__typename'] = true; 85 | } else { 86 | parentFieldName = node.selections[0].name.value; 87 | } 88 | }, 89 | }); 90 | 91 | return { 92 | queryStructure, 93 | queryArgs, 94 | operationType, 95 | parentFieldName, 96 | fieldArgs, 97 | argsName, 98 | }; 99 | }; 100 | 101 | export { traverseAST }; 102 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/typesInQuery.ts: -------------------------------------------------------------------------------- 1 | 2 | /* extract __typenames after making a database request with Regex */ 3 | const typesInQuery = (graphQLResponse: any) => { 4 | const stringy = JSON.stringify(graphQLResponse); 5 | let regex = /(__typename)\":\"(.+?)\"/g; 6 | let found = new Set(stringy.match(regex)); 7 | 8 | const subArr = []; 9 | for (let item of found) { 10 | let newItem = item.slice(13, -1); 11 | subArr.push(newItem); 12 | } 13 | return subArr; 14 | }; 15 | 16 | export { typesInQuery }; 17 | -------------------------------------------------------------------------------- /Atlantis-SourceCode/src/helper-functions/updateRedisAfterMutation.ts: -------------------------------------------------------------------------------- 1 | import { getMutationMap } from './getMutationMap'; 2 | 3 | const updateRedisAfterMutation = ( 4 | redisClient: any, 5 | schema: any, 6 | graphQLResponse: Object 7 | ) => { 8 | // get the type of mutation from the first key in GQLresponse 9 | const mutation = Object.keys(graphQLResponse)[0]; 10 | // get subscribed tables to the mutation from the mutation map 11 | const subscribedTable = getMutationMap(schema); 12 | const keyToClear = `${subscribedTable[mutation]}:Publisher`; 13 | // query redis for key to clear 14 | redisClient.get(`${keyToClear}`, (error: any, values: any) => { 15 | if (error) { 16 | console.log('Redis error', error); 17 | } 18 | const queriesToClear = JSON.parse(`${values}`); 19 | if (queriesToClear) { 20 | // if queries to clear exists, iterate over queries and delete them from redis. 21 | for (let i = 0; i < queriesToClear.length; i++) { 22 | redisClient.del(queriesToClear[i]); 23 | } 24 | } 25 | // after subscribers array is cleared, delete the subscribed key. 26 | redisClient.del(`${keyToClear}`); 27 | }); 28 | }; 29 | 30 | export { updateRedisAfterMutation }; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 OSLabs Beta 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NPM-Package/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules/ -------------------------------------------------------------------------------- /NPM-Package/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "atlantis-npm", 3 | "version": "4.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "version": "4.0.0", 9 | "license": "ISC", 10 | "dependencies": { 11 | "graphql": "^15.5.0" 12 | }, 13 | "devDependencies": { 14 | "typescript": "^4.3.2" 15 | } 16 | }, 17 | "node_modules/graphql": { 18 | "version": "15.5.0", 19 | "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.5.0.tgz", 20 | "integrity": "sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA==", 21 | "engines": { 22 | "node": ">= 10.x" 23 | } 24 | }, 25 | "node_modules/typescript": { 26 | "version": "4.3.2", 27 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz", 28 | "integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==", 29 | "dev": true, 30 | "bin": { 31 | "tsc": "bin/tsc", 32 | "tsserver": "bin/tsserver" 33 | }, 34 | "engines": { 35 | "node": ">=4.2.0" 36 | } 37 | } 38 | }, 39 | "dependencies": { 40 | "graphql": { 41 | "version": "15.5.0", 42 | "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.5.0.tgz", 43 | "integrity": "sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA==" 44 | }, 45 | "typescript": { 46 | "version": "4.3.2", 47 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz", 48 | "integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==", 49 | "dev": true 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /NPM-Package/package/README.md: -------------------------------------------------------------------------------- 1 |
    2 | 3 |

    Atlantis-Cache

    4 |
    5 | 6 | ## About 7 | 8 | Atlantis is a light-weight library that leverages a Redis key-value store to dynamically cache GraphQL queries as responses. Atlantis is able to dynamically store deeply-nested queries and maintain the most recent and relevant data as mutations are made to the database. Queries that are more shallow and within the scope of previous queries are pulled directly from the cache, offering further flexibility and precision, without additional network requests or overriding previous key-values. 9 | 10 | ## Getting Started 11 | 12 | ### 1. Installing and Connecting to a Redis Server 13 | 14 | This package is meant to work in conjunction with redis. To install redis: 15 | 16 | - Mac-HomeBrew: 17 | 18 | - At the terminal, `brew install redis` 19 | - Start redis server with `redis-server` 20 | - Test if redis server is running: `redis-cli ping`. If it replies “PONG”, then it’s good to go! 21 | - Default port is `6379` (Keep note of the port) 22 | 23 | - Linux or Window: 24 | - Download appropriate version of Redis from [redis.io/download](redis.io/download) 25 | - Follow the instructions 26 | - Once installation is completed, start redis server with `redis-server` 27 | - Default port is `6379` (Keep note of the port) 28 | 29 | ### 2. Installing Atlantis-Cache 30 | 31 | Install Atlantis-Cache as an npm module and save it to your package.json as a dependency. 32 | 33 | `npm i atlantis-cache` 34 | 35 | ## How to Use Atlantis-Cache 36 | 37 | ```js 38 | const express = require('express'); 39 | const redis = require('redis'); 40 | const { graphql } = require('graphql'); 41 | const schema = require('./schema/schema'); 42 | const { atlantis } = require('atlantis-cache'); 43 | 44 | const app = express(); 45 | 46 | // Configure your redis client 47 | const redisClient = redis.createClient({ 48 | host: 'localhost', 49 | port: 6379, 50 | }); 51 | 52 | // Define your endpoint for graphQL queries and pass in your redis, and schema 53 | app.use('/graphql', atlantis(redisClient, schema), async (req, res) => { 54 | return res.status(202).json({ data: res.locals.graphQLResponse }); 55 | }); 56 | ``` 57 | 58 | ## Contributors: 59 | 60 | - Coral Fussman - [Github](https://github.com/coralfussman) | [Linkedin](https://www.linkedin.com/in/coral-fussman-21721538/) 61 | - Sett Hein -[Github](https://github.com/settnaing199) | [Linkedin](https://www.linkedin.com/in/sett-hein/) 62 | - Erik Matevosyan - [Github](https://github.com/erik-matevosyan) | [Linkedin](https://www.linkedin.com/in/erik-matevosyan/) 63 | - Erik Rogel - [Github](https://github.com/erikjrogel) | [Linkedin](https://www.linkedin.com/in/erikjrogel/) 64 | 65 | ### Notes: 66 | 67 | if you want to use graphiQL (graphQL IDE), you can use a different endpoint for atlantis requests in devlopment. ie. app.use('/atlantis', atlants ..) as the middleware for all your queries. Then, app.use('/graphql',) for your graphQLHTTP import. 68 | -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/duplicateParseAST.d.ts: -------------------------------------------------------------------------------- 1 | declare const duplicatedParseAST: (AST: any) => any; 2 | export { duplicatedParseAST }; 3 | //# sourceMappingURL=duplicateParseAST.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/duplicateParseAST.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"duplicateParseAST.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/duplicateParseAST.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,kBAAkB,QAAS,GAAG,QA6BnC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/duplicateParseAST.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.duplicatedParseAST = void 0; 4 | const graphql_1 = require("graphql"); 5 | const duplicatedParseAST = (AST) => { 6 | let fields_Object; 7 | let layer = ''; 8 | graphql_1.visit(AST, { 9 | SelectionSet(node, key, parent) { 10 | if (parent.kind === 'Field') { 11 | const tempObj = {}; 12 | const parentName = parent.name.value; 13 | if (layer.length === 0) { 14 | layer = parentName; 15 | } 16 | const tempArray = []; 17 | node.selections.forEach((e) => tempArray.push(e.name.value)); 18 | tempObj[parentName] = tempArray; 19 | if (!fields_Object) { 20 | fields_Object = tempObj; 21 | } 22 | else { 23 | fields_Object[layer].forEach((e, i) => { 24 | if (e === parentName) { 25 | fields_Object[layer][i] = tempObj; 26 | } 27 | }); 28 | layer = parentName; 29 | } 30 | } 31 | }, 32 | }); 33 | return fields_Object; 34 | }; 35 | exports.duplicatedParseAST = duplicatedParseAST; 36 | //# sourceMappingURL=duplicateParseAST.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/duplicateParseAST.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"duplicateParseAST.js","sourceRoot":"","sources":["../../src/helperFunctions/duplicateParseAST.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAEhC,MAAM,kBAAkB,GAAG,CAAC,GAAQ,EAAE,EAAE;IACtC,IAAI,aAAkB,CAAC;IACvB,IAAI,KAAK,GAAW,EAAE,CAAC;IAEvB,eAAK,CAAC,GAAG,EAAE;QACT,YAAY,CAAC,IAAS,EAAE,GAAG,EAAE,MAAW;YACtC,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC3B,MAAM,OAAO,GAAQ,EAAE,CAAC;gBACxB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;gBACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;oBACtB,KAAK,GAAG,UAAU,CAAC;iBACpB;gBACD,MAAM,SAAS,GAAQ,EAAE,CAAC;gBAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gBAClE,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;gBAChC,IAAI,CAAC,aAAa,EAAE;oBAClB,aAAa,GAAG,OAAO,CAAC;iBACzB;qBAAM;oBACL,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE;wBAC9C,IAAI,CAAC,KAAK,UAAU,EAAE;4BACpB,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;yBACnC;oBACH,CAAC,CAAC,CAAC;oBACH,KAAK,GAAG,UAAU,CAAC;iBACpB;aACF;QACH,CAAC;KACF,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEO,gDAAkB"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/exportHelper.d.ts: -------------------------------------------------------------------------------- 1 | import { traverseAST } from './traverseAST'; 2 | import { restructureAST } from './restructureAST'; 3 | import { structureToString } from './structureToString'; 4 | import { isSubset } from './isSubset'; 5 | import { parseDataFromCache } from './parseDataFromCache'; 6 | import { makeGQLrequest } from './makeGQLrequest'; 7 | export { traverseAST, restructureAST, structureToString, isSubset, parseDataFromCache, makeGQLrequest, }; 8 | //# sourceMappingURL=exportHelper.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/exportHelper.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"exportHelper.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/exportHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,cAAc,GACf,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/exportHelper.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.makeGQLrequest = exports.parseDataFromCache = exports.isSubset = exports.structureToString = exports.restructureAST = exports.traverseAST = void 0; 4 | const traverseAST_1 = require("./traverseAST"); 5 | Object.defineProperty(exports, "traverseAST", { enumerable: true, get: function () { return traverseAST_1.traverseAST; } }); 6 | const restructureAST_1 = require("./restructureAST"); 7 | Object.defineProperty(exports, "restructureAST", { enumerable: true, get: function () { return restructureAST_1.restructureAST; } }); 8 | const structureToString_1 = require("./structureToString"); 9 | Object.defineProperty(exports, "structureToString", { enumerable: true, get: function () { return structureToString_1.structureToString; } }); 10 | const isSubset_1 = require("./isSubset"); 11 | Object.defineProperty(exports, "isSubset", { enumerable: true, get: function () { return isSubset_1.isSubset; } }); 12 | const parseDataFromCache_1 = require("./parseDataFromCache"); 13 | Object.defineProperty(exports, "parseDataFromCache", { enumerable: true, get: function () { return parseDataFromCache_1.parseDataFromCache; } }); 14 | const makeGQLrequest_1 = require("./makeGQLrequest"); 15 | Object.defineProperty(exports, "makeGQLrequest", { enumerable: true, get: function () { return makeGQLrequest_1.makeGQLrequest; } }); 16 | //# sourceMappingURL=exportHelper.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/exportHelper.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"exportHelper.js","sourceRoot":"","sources":["../../src/helperFunctions/exportHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAQ1C,4FARO,yBAAW,OAQP;AAPb,qDAAkD;AAQhD,+FARO,+BAAc,OAQP;AAPhB,2DAAwD;AAQtD,kGARO,qCAAiB,OAQP;AAPnB,yCAAsC;AAQpC,yFARO,mBAAQ,OAQP;AAPV,6DAA0D;AAQxD,mGARO,uCAAkB,OAQP;AAPpB,qDAAkD;AAQhD,+FARO,+BAAc,OAQP"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/foundTypes.d.ts: -------------------------------------------------------------------------------- 1 | declare const foundTypes: (graphQLResponse: any) => string[]; 2 | export { foundTypes }; 3 | //# sourceMappingURL=foundTypes.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/foundTypes.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"foundTypes.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/foundTypes.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU,oBAAqB,GAAG,aAWvC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/foundTypes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.foundTypes = void 0; 4 | //extract __typenames after GraphQL Response 5 | const foundTypes = (graphQLResponse) => { 6 | const stringy = JSON.stringify(graphQLResponse); 7 | let regex = /(__typename)\":\"(.+?)\"/g; 8 | let found = new Set(stringy.match(regex)); 9 | const subArr = []; 10 | for (let item of found) { 11 | let newItem = item.slice(13, -1); 12 | subArr.push(newItem); 13 | } 14 | return subArr; 15 | }; 16 | exports.foundTypes = foundTypes; 17 | //# sourceMappingURL=foundTypes.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/foundTypes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"foundTypes.js","sourceRoot":"","sources":["../../src/helperFunctions/foundTypes.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,MAAM,UAAU,GAAG,CAAC,eAAoB,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAChD,IAAI,KAAK,GAAG,2BAA2B,CAAC;IACxC,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACtB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEO,gCAAU"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/getMutationMap.d.ts: -------------------------------------------------------------------------------- 1 | declare const getMutationMap: (schema: any) => any; 2 | export { getMutationMap }; 3 | //# sourceMappingURL=getMutationMap.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/getMutationMap.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"getMutationMap.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/getMutationMap.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,WAAY,GAAG,QAwBlC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/getMutationMap.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getMutationMap = void 0; 4 | const getMutationMap = (schema) => { 5 | const mutationMap = {}; 6 | // get object containing all root mutations defined in the schema 7 | const mutationTypeFields = schema._mutationType._fields; 8 | // if queryTypeFields is a function, invoke it to get object with queries 9 | const mutationsObj = typeof mutationTypeFields === 'function' 10 | ? mutationTypeFields() 11 | : mutationTypeFields; 12 | for (const mutation in mutationsObj) { 13 | // get name of GraphQL type returned by query 14 | // if ofType --> this is collection, else not collection 15 | let returnedType; 16 | if (mutationsObj[mutation].type.ofType) { 17 | returnedType = []; 18 | returnedType.push(mutationsObj[mutation].type.ofType.name); 19 | } 20 | if (mutationsObj[mutation].type.name) { 21 | returnedType = mutationsObj[mutation].type.name; 22 | } 23 | mutationMap[mutation] = returnedType; 24 | } 25 | return mutationMap; 26 | }; 27 | exports.getMutationMap = getMutationMap; 28 | //# sourceMappingURL=getMutationMap.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/getMutationMap.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"getMutationMap.js","sourceRoot":"","sources":["../../src/helperFunctions/getMutationMap.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG,CAAC,MAAW,EAAE,EAAE;IACrC,MAAM,WAAW,GAAQ,EAAE,CAAC;IAC5B,iEAAiE;IACjE,MAAM,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;IACxD,yEAAyE;IACzE,MAAM,YAAY,GAChB,OAAO,kBAAkB,KAAK,UAAU;QACtC,CAAC,CAAC,kBAAkB,EAAE;QACtB,CAAC,CAAC,kBAAkB,CAAC;IAEzB,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;QACnC,6CAA6C;QAC7C,wDAAwD;QACxD,IAAI,YAAY,CAAC;QACjB,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;YACtC,YAAY,GAAG,EAAE,CAAC;YAClB,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC5D;QACD,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;YACpC,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACjD;QACD,WAAW,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC;KACtC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEO,wCAAc"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/helper.d.ts: -------------------------------------------------------------------------------- 1 | import { parseAST } from './parseAST'; 2 | import { duplicatedParseAST } from './duplicateParseAST'; 3 | import { protoQueryString } from './protoQueryString'; 4 | import { isSubset } from './isSubset'; 5 | import { parseDataFromCache } from './parseDataFromCache'; 6 | import { makeGQLrequest } from './makeGQLrequest'; 7 | export { parseAST, duplicatedParseAST, protoQueryString, isSubset, parseDataFromCache, makeGQLrequest, }; 8 | //# sourceMappingURL=helper.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/helper.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,cAAc,GACf,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/helper.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.makeGQLrequest = exports.parseDataFromCache = exports.isSubset = exports.protoQueryString = exports.duplicatedParseAST = exports.parseAST = void 0; 4 | const parseAST_1 = require("./parseAST"); 5 | Object.defineProperty(exports, "parseAST", { enumerable: true, get: function () { return parseAST_1.parseAST; } }); 6 | const duplicateParseAST_1 = require("./duplicateParseAST"); 7 | Object.defineProperty(exports, "duplicatedParseAST", { enumerable: true, get: function () { return duplicateParseAST_1.duplicatedParseAST; } }); 8 | const protoQueryString_1 = require("./protoQueryString"); 9 | Object.defineProperty(exports, "protoQueryString", { enumerable: true, get: function () { return protoQueryString_1.protoQueryString; } }); 10 | const isSubset_1 = require("./isSubset"); 11 | Object.defineProperty(exports, "isSubset", { enumerable: true, get: function () { return isSubset_1.isSubset; } }); 12 | const parseDataFromCache_1 = require("./parseDataFromCache"); 13 | Object.defineProperty(exports, "parseDataFromCache", { enumerable: true, get: function () { return parseDataFromCache_1.parseDataFromCache; } }); 14 | const makeGQLrequest_1 = require("./makeGQLrequest"); 15 | Object.defineProperty(exports, "makeGQLrequest", { enumerable: true, get: function () { return makeGQLrequest_1.makeGQLrequest; } }); 16 | //# sourceMappingURL=helper.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/helper.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/helperFunctions/helper.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAQpC,yFARO,mBAAQ,OAQP;AAPV,2DAAyD;AAQvD,mGARO,sCAAkB,OAQP;AAPpB,yDAAsD;AAQpD,iGARO,mCAAgB,OAQP;AAPlB,yCAAsC;AAQpC,yFARO,mBAAQ,OAQP;AAPV,6DAA0D;AAQxD,mGARO,uCAAkB,OAQP;AAPpB,qDAAkD;AAQhD,+FARO,+BAAc,OAQP"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/isSubset.d.ts: -------------------------------------------------------------------------------- 1 | declare const isSubset: (rootObj: any, subObj: any) => boolean; 2 | export { isSubset }; 3 | //# sourceMappingURL=isSubset.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/isSubset.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"isSubset.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/isSubset.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,QAAQ,YAAa,GAAG,UAAU,GAAG,KAAG,OAQ7C,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/isSubset.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isSubset = void 0; 4 | /* compare incoming queryStructure and existing queryStructure in redis to determine if all the fields in the incoming query exist in the cache*/ 5 | const isSubset = (rootObj, subObj) => { 6 | return Object.keys(subObj).every((el) => { 7 | if (typeof subObj[el] == 'object') { 8 | return isSubset(rootObj[el], subObj[el]); 9 | } 10 | if (!subObj || !rootObj) 11 | return false; 12 | return subObj[el] === rootObj[el]; 13 | }); 14 | }; 15 | exports.isSubset = isSubset; 16 | //# sourceMappingURL=isSubset.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/isSubset.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"isSubset.js","sourceRoot":"","sources":["../../src/helperFunctions/isSubset.ts"],"names":[],"mappings":";;;AAAA,iJAAiJ;AACjJ,MAAM,QAAQ,GAAG,CAAC,OAAY,EAAE,MAAW,EAAW,EAAE;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;QACtC,IAAI,OAAO,MAAM,CAAC,EAAE,CAAC,IAAI,QAAQ,EAAE;YACjC,OAAO,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1C;QACD,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QACtC,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEO,4BAAQ"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/makeGQLrequest.d.ts: -------------------------------------------------------------------------------- 1 | declare const makeGQLrequest: (redisClient: any, schema: any, redisKey: any, queryMade: any, proto: any, operationType: any) => Promise; 2 | export { makeGQLrequest }; 3 | //# sourceMappingURL=makeGQLrequest.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/makeGQLrequest.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"makeGQLrequest.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/makeGQLrequest.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,cAAc,gBACL,GAAG,UACR,GAAG,YACD,GAAG,aACF,GAAG,SACP,GAAG,iBACK,GAAG,qBA8CnB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/makeGQLrequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.makeGQLrequest = void 0; 13 | const graphql_1 = require("graphql"); 14 | const typesInQuery_1 = require("./typesInQuery"); 15 | const updateRedisAfterMutation_1 = require("./updateRedisAfterMutation"); 16 | const makeGQLrequest = (redisClient, schema, redisKey, queryMade, proto, operationType) => __awaiter(void 0, void 0, void 0, function* () { 17 | return new Promise((resolve) => { 18 | graphql_1.graphql(schema, queryMade).then((response) => { 19 | const graphQLResponse = response.data; 20 | if (operationType == 'unCacheable') 21 | return graphQLResponse; 22 | if (operationType !== 'mutation') { 23 | const subscriptions = typesInQuery_1.typesInQuery(graphQLResponse); 24 | // subscribe the query to mutations of type subscription 25 | for (let key in subscriptions) { 26 | redisClient.get(`${subscriptions[key]}:Publisher`, (error, values) => { 27 | if (error) { 28 | return; 29 | } 30 | // Case where this query is the first to subscribe to this type. 31 | // Create a key, and subscribe the query to that key. 32 | if (!values) { 33 | const subsArr = [redisKey]; 34 | redisClient.set(`${subscriptions[key]}:Publisher`, JSON.stringify(subsArr)); 35 | } 36 | else { 37 | // Case where other queries are also subscribed to changes of this type. 38 | const subsArr = JSON.parse(`${values}`); 39 | subsArr.push(redisKey); 40 | redisClient.set(`${subscriptions[key]}:Publisher`, JSON.stringify(subsArr)); 41 | } 42 | }); 43 | } 44 | // store key-value for graphqlRespose from the database 45 | redisClient.set(redisKey, JSON.stringify({ data: graphQLResponse, fields: proto })); 46 | } 47 | else { 48 | // since we have a mutation we need to clear all subscribed queries 49 | updateRedisAfterMutation_1.updateRedisAfterMutation(redisClient, schema, graphQLResponse); 50 | } 51 | resolve(graphQLResponse); 52 | }); 53 | }); 54 | }); 55 | exports.makeGQLrequest = makeGQLrequest; 56 | //# sourceMappingURL=makeGQLrequest.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/makeGQLrequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"makeGQLrequest.js","sourceRoot":"","sources":["../../src/helperFunctions/makeGQLrequest.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAClC,iDAA8C;AAC9C,yEAAsE;AAEtE,MAAM,cAAc,GAAG,CACrB,WAAgB,EAChB,MAAW,EACX,QAAa,EACb,SAAc,EACd,KAAU,EACV,aAAkB,EAClB,EAAE;IACF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,iBAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,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,CAAC;aAChE;YACD,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA,CAAC;AAEO,wCAAc"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/parseAST.d.ts: -------------------------------------------------------------------------------- 1 | declare const parseAST: (AST: any) => { 2 | proto: {}; 3 | protoArgs: any; 4 | operationType: any; 5 | parentFieldName: any; 6 | fieldArgs: any; 7 | argsName: any; 8 | }; 9 | export { parseAST }; 10 | //# sourceMappingURL=parseAST.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/parseAST.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parseAST.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/parseAST.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,QAAQ,QAAS,GAAG;;;;;;;CA8GzB,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/parseAST.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parseAST.js","sourceRoot":"","sources":["../../src/helperFunctions/parseAST.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC5B,uCAAuC;IACvC,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,IAAI,UAAmB,CAAC;IACxB,IAAI,eAAoB,CAAC;IAEzB,IAAI,aAAkB,CAAC;IAEvB,IAAI,eAAuB,CAAC;IAE5B,IAAI,SAAc,CAAC;IAEnB,IAAI,QAAa,CAAC;IAElB,gCAAgC;IAChC,IAAI,SAAS,GAAQ,IAAI,CAAC;IAE1B,wDAAwD;IACxD,MAAM,KAAK,GAAU,EAAE,CAAC;IAExB;;;;;;;;OAQG;IACH,eAAK,CAAC,GAAG,EAAE;QACT,KAAK,CAAC,IAAS;YACb,IAAI,IA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AAC;aAC/B;iBAAM;gBACL,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;aACjD;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,SAAS;QACT,aAAa;QACb,eAAe;QACf,SAAS;QACT,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC;AAEO,4BAAQ"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/parseDataFromCache.d.ts: -------------------------------------------------------------------------------- 1 | declare function parseDataFromCache(cacheObj: any, fieldObj: any): any; 2 | export { parseDataFromCache }; 3 | //# sourceMappingURL=parseDataFromCache.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/parseDataFromCache.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parseDataFromCache.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/parseDataFromCache.ts"],"names":[],"mappings":"AAEA,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAiBvD;AAiCD,OAAO,EAAE,kBAAkB,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/parseDataFromCache.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseDataFromCache = void 0; 4 | /*ParseDataFromCache traverses redis's cache and filters object properties by keys from prototype object*/ 5 | function parseDataFromCache(cacheObj, fieldObj) { 6 | const result = {}; 7 | Object.keys(cacheObj).forEach((key) => { 8 | //get the value of cacheObj and FieldObj based on key 9 | const subCacheObj = cacheObj[key]; 10 | const subFieldObj = fieldObj[key]; 11 | //if subCacheObj is an array, iterate through ele and trigger ObjectFilter 12 | if (Array.isArray(subCacheObj)) { 13 | result[key] = subCacheObj.map((obj) => { 14 | return ObjectFilter(obj, subFieldObj); 15 | }); 16 | } 17 | else if (typeof subCacheObj === 'object') { 18 | result[key] = ObjectFilter(subCacheObj, subFieldObj); 19 | } 20 | }); 21 | return result; 22 | } 23 | exports.parseDataFromCache = parseDataFromCache; 24 | /*helper function filters out object properties on current layer and invoke rescursive call if there are nested fields */ 25 | const ObjectFilter = (cacheObj, fieldObj) => { 26 | let resultObj = {}; 27 | //iterate thorugh fieldObj 28 | fieldObj.forEach((field) => { 29 | //if cur field is a string, store the the properites to resultObj based on fields 30 | if (typeof field === 'string') { 31 | resultObj[field] = cacheObj[field]; 32 | } 33 | else { 34 | //if cur field is an object, invoke rescurive call on ObjectFilter based on value 35 | const fieldName = Object.keys(field)[0]; 36 | if (cacheObj[fieldName] === null) { 37 | resultObj[fieldName] = null; 38 | } 39 | else if (Array.isArray(cacheObj[fieldName])) { 40 | resultObj[fieldName] = cacheObj[fieldName].map((obj) => { 41 | return ObjectFilter(obj, field[fieldName]); 42 | }); 43 | } 44 | else if (typeof cacheObj[fieldName] === 'object') { 45 | resultObj[fieldName] = ObjectFilter(cacheObj[fieldName], field[fieldName]); 46 | } 47 | } 48 | }); 49 | return resultObj; 50 | }; 51 | //# sourceMappingURL=parseDataFromCache.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/parseDataFromCache.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parseDataFromCache.js","sourceRoot":"","sources":["../../src/helperFunctions/parseDataFromCache.ts"],"names":[],"mappings":";;;AACA,0GAA0G;AAC1G,SAAS,kBAAkB,CAAC,QAAa,EAAE,QAAa;IACtD,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACpC,qDAAqD;QACrD,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAClC,0EAA0E;QAC1E,IAAI,KAAK,CAAC,OAAO,CAAC,WA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AAQ,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE;gBAClD,SAAS,CAAC,SAAS,CAAC,GAAG,YAAY,CACjC,QAAQ,CAAC,SAAS,CAAC,EACnB,KAAK,CAAC,SAAS,CAAC,CACjB,CAAC;aACH;SACF;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/protoQueryString.d.ts: -------------------------------------------------------------------------------- 1 | declare const protoQueryString: (obj: any, protoArgs: any) => string; 2 | export { protoQueryString }; 3 | //# sourceMappingURL=protoQueryString.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/protoQueryString.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"protoQueryString.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/protoQueryString.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,gBAAgB,QAAS,GAAG,aAAa,GAAG,WAgCjD,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/protoQueryString.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.protoQueryString = void 0; 4 | // Parse through AST proto and convert it into a GQL query string 5 | const protoQueryString = (obj, protoArgs) => { 6 | const argsToQuery = (protoArgs) => { 7 | let string = ''; 8 | for (let key in protoArgs) { 9 | for (let innerKey in protoArgs[key]) { 10 | // accounts for edge case where an Int is passed in as an arguement. 11 | if (!isNaN(protoArgs[key][innerKey])) { 12 | string += innerKey + ': ' + protoArgs[key][innerKey] + ' '; 13 | break; 14 | } 15 | string += innerKey + ': ' + '"' + protoArgs[key][innerKey] + '"' + ' '; 16 | } 17 | } 18 | return '(' + string + ')'; 19 | }; 20 | let mainString = ''; 21 | for (let key in obj) { 22 | if (typeof obj[key] !== 'object') { 23 | mainString += ' ' + key + ' '; 24 | } 25 | else { 26 | mainString += ' ' + key + ' '; 27 | if (protoArgs) { 28 | if (typeof protoArgs[key] == 'object') { 29 | const inner = argsToQuery(protoArgs); 30 | mainString += inner; 31 | } 32 | } 33 | mainString += protoQueryString(obj[key], {}); 34 | } 35 | } 36 | return '{' + mainString + '}'; 37 | }; 38 | exports.protoQueryString = protoQueryString; 39 | //# sourceMappingURL=protoQueryString.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/protoQueryString.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"protoQueryString.js","sourceRoot":"","sources":["../../src/helperFunctions/protoQueryString.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,MAAM,gBAAgB,GAAG,CAAC,GAAQ,EAAE,SAAc,EAAE,EAAE;IACpD,MAAM,WAAW,GAAG,CAAC,SAAc,EAAE,EAAE;QACrC,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,GAAG,IAAI,SAAS,EAAE;YACzB,KAAK,IAAI,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE;gBACnC,oEAAoE;gBACpE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACpC,MAAM,IAAI,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;oBAC3D,MAAM;iBACP;gBACD,MAAM,IAAI,QAAQ,GAAG,IAAI,GAAG,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;aACxE;SACF;QACD,OAAO,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC;IAC5B,CAAC,CAAC;IAEF,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;QACnB,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;YAChC,UAAU,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;SAC/B;aAAM;YACL,UAAU,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;YAC9B,IAAI,SAAS,EAAE;gBACb,IAAI,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,EAAE;oBACrC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;oBACrC,UAAU,IAAI,KAAK,CAAC;iBACrB;aACF;YACD,UAAU,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;SAC9C;KACF;IACD,OAAO,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC;AAChC,CAAC,CAAC;AAEO,4CAAgB"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/restructureAST.d.ts: -------------------------------------------------------------------------------- 1 | declare const restructureAST: (AST: any) => any; 2 | export { restructureAST }; 3 | //# sourceMappingURL=restructureAST.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/restructureAST.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"restructureAST.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/restructureAST.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,QAAS,GAAG,QA6B/B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/restructureAST.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.restructureAST = void 0; 4 | const graphql_1 = require("graphql"); 5 | const restructureAST = (AST) => { 6 | let fields_Object; 7 | let layer = ''; 8 | graphql_1.visit(AST, { 9 | SelectionSet(node, key, parent) { 10 | if (parent.kind === 'Field') { 11 | const tempObj = {}; 12 | const parentName = parent.name.value; 13 | if (layer.length === 0) { 14 | layer = parentName; 15 | } 16 | const tempArray = []; 17 | node.selections.forEach((e) => tempArray.push(e.name.value)); 18 | tempObj[parentName] = tempArray; 19 | if (!fields_Object) { 20 | fields_Object = tempObj; 21 | } 22 | else { 23 | fields_Object[layer].forEach((e, i) => { 24 | if (e === parentName) { 25 | fields_Object[layer][i] = tempObj; 26 | } 27 | }); 28 | layer = parentName; 29 | } 30 | } 31 | }, 32 | }); 33 | return fields_Object; 34 | }; 35 | exports.restructureAST = restructureAST; 36 | //# sourceMappingURL=restructureAST.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/restructureAST.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"restructureAST.js","sourceRoot":"","sources":["../../src/helperFunctions/restructureAST.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAEhC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAE,EAAE;IAClC,IAAI,aAAkB,CAAC;IACvB,IAAI,KAAK,GAAW,EAAE,CAAC;IAEvB,eAAK,CAAC,GAAG,EAAE;QACT,YAAY,CAAC,IAAS,EAAE,GAAG,EAAE,MAAW;YACtC,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC3B,MAAM,OAAO,GAAQ,EAAE,CAAC;gBACxB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;gBACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;oBACtB,KAAK,GAAG,UAAU,CAAC;iBACpB;gBACD,MAAM,SAAS,GAAQ,EAAE,CAAC;gBAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gBAClE,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;gBAChC,IAAI,CAAC,aAAa,EAAE;oBAClB,aAAa,GAAG,OAAO,CAAC;iBACzB;qBAAM;oBACL,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE;wBAC9C,IAAI,CAAC,KAAK,UAAU,EAAE;4BACpB,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;yBACnC;oBACH,CAAC,CAAC,CAAC;oBACH,KAAK,GAAG,UAAU,CAAC;iBACpB;aACF;QACH,CAAC;KACF,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEO,wCAAc"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/structureToString.d.ts: -------------------------------------------------------------------------------- 1 | declare const structureToString: (queryStructure: any, queryArgs: any) => string; 2 | export { structureToString }; 3 | //# sourceMappingURL=structureToString.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/structureToString.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"structureToString.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/structureToString.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,iBAAiB,mBAAoB,GAAG,aAAa,GAAG,WAgC7D,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/structureToString.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.structureToString = void 0; 4 | // Parse through AST proto and convert it into a GQL query string 5 | const structureToString = (queryStructure, queryArgs) => { 6 | const argsToQuery = (queryArgs) => { 7 | let string = ''; 8 | for (let key in queryArgs) { 9 | for (let innerKey in queryArgs[key]) { 10 | // accounts for edge case where an Int is passed in as an arguement. 11 | if (!isNaN(queryArgs[key][innerKey])) { 12 | string += innerKey + ': ' + queryArgs[key][innerKey] + ' '; 13 | break; 14 | } 15 | string += innerKey + ': ' + '"' + queryArgs[key][innerKey] + '"' + ' '; 16 | } 17 | } 18 | return '(' + string + ')'; 19 | }; 20 | let mainString = ''; 21 | for (let key in queryStructure) { 22 | if (typeof queryStructure[key] !== 'object') { 23 | mainString += ' ' + key + ' '; 24 | } 25 | else { 26 | mainString += ' ' + key + ' '; 27 | if (queryArgs) { 28 | if (typeof queryArgs[key] == 'object') { 29 | const inner = argsToQuery(queryArgs); 30 | mainString += inner; 31 | } 32 | } 33 | mainString += structureToString(queryStructure[key], {}); 34 | } 35 | } 36 | return '{' + mainString + '}'; 37 | }; 38 | exports.structureToString = structureToString; 39 | //# sourceMappingURL=structureToString.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/structureToString.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"structureToString.js","sourceRoot":"","sources":["../../src/helperFunctions/structureToString.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,CAAC,cAAmB,EAAE,SAAc,EAAE,EAAE;IAChE,MAAM,WAAW,GAAG,CAAC,SAAc,EAAE,EAAE;QACrC,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,GAAG,IAAI,SAAS,EAAE;YACzB,KAAK,IAAI,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE;gBACnC,oEAAoE;gBACpE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACpC,MAAM,IAAI,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;oBAC3D,MAAM;iBACP;gBACD,MAAM,IAAI,QAAQ,GAAG,IAAI,GAAG,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;aACxE;SACF;QACD,OAAO,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC;IAC5B,CAAC,CAAC;IAEF,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,KAAK,IAAI,GAAG,IAAI,cAAc,EAAE;QAC9B,IAAI,OAAO,cAAc,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;YAC3C,UAAU,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;SAC/B;aAAM;YACL,UAAU,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;YAC9B,IAAI,SAAS,EAAE;gBACb,IAAI,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,EAAE;oBACrC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;oBACrC,UAAU,IAAI,KAAK,CAAC;iBACrB;aACF;YACD,UAAU,IAAI,iBAAiB,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;SAC1D;KACF;IACD,OAAO,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC;AAChC,CAAC,CAAC;AAEO,8CAAiB"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/traverseAST.d.ts: -------------------------------------------------------------------------------- 1 | declare const traverseAST: (AST: any) => { 2 | queryStructure: {}; 3 | queryArgs: any; 4 | operationType: any; 5 | parentFieldName: any; 6 | fieldArgs: any; 7 | argsName: any; 8 | }; 9 | export { traverseAST }; 10 | //# sourceMappingURL=traverseAST.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/traverseAST.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"traverseAST.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/traverseAST.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW,QAAS,GAAG;;;;;;;CAgG5B,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/traverseAST.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.traverseAST = void 0; 4 | const graphql_1 = require("graphql"); 5 | const traverseAST = (AST) => { 6 | // initialize variables for tracking AST extraction 7 | const queryStructure = {}; 8 | let parentFieldName; 9 | let operationType; 10 | let fieldArgs; 11 | let argsName; 12 | let queryArgs = null; 13 | const stack = []; 14 | // built in GQL function that recursively vists all nodes in an AST tree 15 | graphql_1.visit(AST, { 16 | enter(node) { 17 | if (node.directives) { 18 | if (node.directives.length > 0) { 19 | // if a node has directives it is uncacheable 20 | operationType = 'unCacheable'; 21 | return graphql_1.BREAK; 22 | } 23 | } 24 | }, 25 | // 26 | OperationDefinition(node) { 27 | operationType = node.operation; 28 | if (node.operation === 'subscription') { 29 | // if a query is a subscription it is uncacheable 30 | operationType = 'unCacheable'; 31 | return graphql_1.BREAK; 32 | } 33 | }, 34 | Field: { 35 | enter(node) { 36 | if (node.alias) { 37 | // if a query has an alias it is uncacheable 38 | operationType = 'unCacheable'; 39 | return graphql_1.BREAK; 40 | } 41 | if (node.arguments && node.arguments.length > 0) { 42 | fieldArgs = node.arguments[0].value.value; 43 | argsName = node.arguments[0].name.value; 44 | queryArgs = queryArgs || {}; 45 | queryArgs[node.name.value] = {}; 46 | // collect arguments if arguments contain id, otherwise make query unCachable 47 | // hint: can check for graphQl type ID instead of string 'id' 48 | for (let i = 0; i < node.arguments.length; i++) { 49 | const key = node.arguments[i].name.value; 50 | const value = node.arguments[i].value.value; 51 | // for queries cache can handle only id as argument 52 | if (operationType === 'query') { 53 | if (!key.includes('id')) { 54 | operationType = 'unCacheable'; 55 | return graphql_1.BREAK; 56 | } 57 | } 58 | queryArgs[node.name.value][key] = value; 59 | } 60 | } 61 | // add value to stack 62 | stack.push(node.name.value); 63 | }, 64 | leave(node) { 65 | // remove value from stack 66 | stack.pop(); 67 | }, 68 | }, 69 | SelectionSet(node, key, parent, path, ancestors) { 70 | if (parent.kind === 'Field') { 71 | const tempObject = {}; 72 | for (let field of node.selections) { 73 | tempObject[field.name.value] = true; 74 | } 75 | // loop through stack to get correct path in proto for temp object; 76 | // mutates original prototype object; 77 | const protoObj = stack.reduce((prev, curr, index) => { 78 | return index + 1 === stack.length // if last item in path 79 | ? (prev[curr] = tempObject) // set value 80 | : (prev[curr] = prev[curr]); // otherwise, if index exists, keep value 81 | }, queryStructure); 82 | protoObj['__typename'] = true; 83 | } 84 | else { 85 | parentFieldName = node.selections[0].name.value; 86 | } 87 | }, 88 | }); 89 | return { 90 | queryStructure, 91 | queryArgs, 92 | operationType, 93 | parentFieldName, 94 | fieldArgs, 95 | argsName, 96 | }; 97 | }; 98 | exports.traverseAST = traverseAST; 99 | //# sourceMappingURL=traverseAST.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/traverseAST.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"traverseAST.js","sourceRoot":"","sources":["../../src/helperFunctions/traverseAST.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC/B,mDAAmD;IACnD,MAAM,cAAc,GAAG,EAAE,CAAC;IAE1B,IAAI,eAAoB,CAAC;IACzB,IAAI,aAAkB,CAAC;IACvB,IAAI,SAAc,CAAC;IACnB,IAAI,QAAa,CAAC;IAClB,IAAI,SAAS,GAAQ,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAU,EAAE,CAAC;IAExB,wEAAwE;IACxE,eAAK,CAAC,GAAG,EAAE;QACT,KAAK,CAAC,IAAS;YACb,IAAI,IAAI,CAAC,UAAiB,EAAE;gBAC1B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC9B,6CAA6C;oBAC7C,aAAa,GAAG,aAAa,CAAC;oBAC9B,OAAO,eAAK,CAAC;iBACd;aACF;QACH,CAAC;QACD,GAAG;QACH,mBAAmB,CAAC,IAAI;YACtB,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC;YAC/B,IAAI,IAAI,CAAC,SAAS,KAAK,cAAc,EAAE;gBACrC,iDAAiD;gBACjD,aAAa,GAAG,aA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K,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;YACD,KAAK,CAAC,IAAI;gBACR,0BAA0B;gBAC1B,KAAK,CAAC,GAAG,EAAE,CAAC;YACd,CAAC;SACF;QACD,YAAY,CAAC,IAAS,EAAE,GAAG,EAAE,MAAW,EAAE,IAAI,EAAE,SAAS;YACvD,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC3B,MAAM,UAAU,GAAQ,EAAE,CAAC;gBAC3B,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE;oBACjC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;iBACrC;gBACD,mEAAmE;gBACnE,qCAAqC;gBACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;oBAClD,OAAO,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,uBAAuB;wBACvD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,YAAY;wBACxC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,yCAAyC;gBAC1E,CAAC,EAAE,cAAc,CAAC,CAAC;gBACnB,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;aAC/B;iBAAM;gBACL,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;aACjD;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO;QACL,cAAc;QACd,SAAS;QACT,aAAa;QACb,eAAe;QACf,SAAS;QACT,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC;AAEO,kCAAW"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/typesInQuery.d.ts: -------------------------------------------------------------------------------- 1 | declare const typesInQuery: (graphQLResponse: any) => string[]; 2 | export { typesInQuery }; 3 | //# sourceMappingURL=typesInQuery.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/typesInQuery.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"typesInQuery.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/typesInQuery.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,YAAY,oBAAqB,GAAG,aAWzC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/typesInQuery.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.typesInQuery = void 0; 4 | /* extract __typenames after making a database request with Regex */ 5 | const typesInQuery = (graphQLResponse) => { 6 | const stringy = JSON.stringify(graphQLResponse); 7 | let regex = /(__typename)\":\"(.+?)\"/g; 8 | let found = new Set(stringy.match(regex)); 9 | const subArr = []; 10 | for (let item of found) { 11 | let newItem = item.slice(13, -1); 12 | subArr.push(newItem); 13 | } 14 | return subArr; 15 | }; 16 | exports.typesInQuery = typesInQuery; 17 | //# sourceMappingURL=typesInQuery.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/typesInQuery.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"typesInQuery.js","sourceRoot":"","sources":["../../src/helperFunctions/typesInQuery.ts"],"names":[],"mappings":";;;AACA,oEAAoE;AACpE,MAAM,YAAY,GAAG,CAAC,eAAoB,EAAE,EAAE;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAChD,IAAI,KAAK,GAAG,2BAA2B,CAAC;IACxC,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACtB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEO,oCAAY"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/updateRedisAfterMutation.d.ts: -------------------------------------------------------------------------------- 1 | declare const updateRedisAfterMutation: (redisClient: any, schema: any, graphQLResponse: Object) => void; 2 | export { updateRedisAfterMutation }; 3 | //# sourceMappingURL=updateRedisAfterMutation.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/updateRedisAfterMutation.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"updateRedisAfterMutation.d.ts","sourceRoot":"","sources":["../../src/helperFunctions/updateRedisAfterMutation.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,wBAAwB,gBACf,GAAG,UACR,GAAG,mBACM,MAAM,SAsBxB,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/updateRedisAfterMutation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.updateRedisAfterMutation = void 0; 4 | const getMutationMap_1 = require("./getMutationMap"); 5 | const updateRedisAfterMutation = (redisClient, schema, graphQLResponse) => { 6 | // get the type of mutation from the first key in GQLresponse 7 | const mutation = Object.keys(graphQLResponse)[0]; 8 | // get subscribed tables to the mutation from the mutation map 9 | const subscribedTable = getMutationMap_1.getMutationMap(schema); 10 | const keyToClear = `${subscribedTable[mutation]}:Publisher`; 11 | // query redis for key to clear 12 | redisClient.get(`${keyToClear}`, (error, values) => { 13 | if (error) { 14 | console.log('Redis error', error); 15 | } 16 | const queriesToClear = JSON.parse(`${values}`); 17 | if (queriesToClear) { 18 | // if queries to clear exists, iterate over queries and delete them from redis. 19 | for (let i = 0; i < queriesToClear.length; i++) { 20 | redisClient.del(queriesToClear[i]); 21 | } 22 | } 23 | // after subscribers array is cleared, delete the subscribed key. 24 | redisClient.del(`${keyToClear}`); 25 | }); 26 | }; 27 | exports.updateRedisAfterMutation = updateRedisAfterMutation; 28 | //# sourceMappingURL=updateRedisAfterMutation.js.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/helperFunctions/updateRedisAfterMutation.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"updateRedisAfterMutation.js","sourceRoot":"","sources":["../../src/helperFunctions/updateRedisAfterMutation.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD,MAAM,wBAAwB,GAAG,CAC/B,WAAgB,EAChB,MAAW,EACX,eAAuB,EACvB,EAAE;IACF,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,8DAA8D;IAC9D,MAAM,eAAe,GAAG,+BAAc,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC5D,+BAA+B;IAC/B,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;QAC3D,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;SACnC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;QAC/C,IAAI,cAAc,EAAE;YAClB,+EAA+E;YAC/E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC9C,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC;SACF;QACD,iEAAiE;QACjE,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEO,4DAAwB"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/index.d.ts: -------------------------------------------------------------------------------- 1 | declare const atlantis: (redisClient: any, schema: any) => (req: any, res: any, next: any) => Promise; 2 | export { atlantis }; 3 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /NPM-Package/package/lib/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,QAAQ,gBACE,GAAG,UAAU,GAAG,WAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,iBAkGtE,CAAC;AAEJ,OAAO,EAAE,QAAQ,EAAE,CAAC"} -------------------------------------------------------------------------------- /NPM-Package/package/lib/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgC;AAChC,iEAOwC;AAExC,MAAM,QAAQ,GACZ,CAAC,WAAgB,EAAE,MAAW,EAAE,EAAE,CAAC,CAAO,GAAQ,EAAE,GAAQ,EAAE,IAAS,EAAE,EAAE;IACzE,4DAA4D;IAC5D,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,IAAI,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EACJ,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,SAAS,GACV,GAAQ,0BAAW,CAAC,GAAG,CAAC,CAAC;IAC1B,wCAAwC;IACxC,MAAM,iBAAiB,GAAW,6BAAc,CAAC,GAAG,CAAC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CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;gBAC5C,qDAAqD;gBACrD,MAAM,kBAAkB,GAAG,MAAM,uBAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC;gBACjF,+EAA+E;gBAC/E,IAAI,CAAC,kBAAkB,EAAE;oBAEvB,GAAG,CAAC,MAAM,CAAC,eAAe,GAAG,MAAM,6BAAc,CAC/C,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,EACT,cAAc,EACd,aAAa,CACd,CAAC;oBACF,oDAAoD;oBACpD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe;wBAAE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAC;oBAExG,IAAI,EAAE,CAAC;iBACR;qBAAM;oBACL,8FAA8F;oBAC9F,GAAG,CAAC,MAAM,CAAC,eAAe,GAAG,iCAAkB,CAC7C,WAAW,CAAC,MAAM,CAAC,EACnB,iBAAiB,CAClB,CAAC;oBACF,IAAI,EAAE,CAAC;iBAER;aACF;QACH,CAAC,CAAA,CAAC,CAAC;KACJ;SAAM;QACL,0CAA0C;QAC1C,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;QACnC,GAAG,CAAC,MAAM,CAAC,eAAe,GAAG,MAAM,6BAAc,CAC/C,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,EACT,cAAc,EACd,aAAa,CACd,CAAC;QACF,oDAAoD;QACpD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe;YAAE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAC;QAExG,IAAI,EAAE,CAAC;KACR;AACH,CAAC,CAAA,CAAC;AAEK,4BAAQ"} -------------------------------------------------------------------------------- /NPM-Package/package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "atlantis-cache", 3 | "version": "1.0.5", 4 | "description": "Server-side caching solution for graphQL", 5 | "main": "lib/index.js", 6 | "types": "lib", 7 | "scripts": { 8 | "build": "tsc -p ." 9 | }, 10 | "keywords": [ 11 | "graphQL", 12 | "cache", 13 | "server-side", 14 | "redis", 15 | "atlantis", 16 | "caching", 17 | "apollo", 18 | "relay", 19 | "graphQL tools", 20 | "node redis", 21 | "cache graphQL" 22 | ], 23 | "author": "SeeC Labs", 24 | "license": "MIT", 25 | "devDependencies": { 26 | "typescript": "^4.3.2" 27 | }, 28 | "contributors": [ 29 | { 30 | "name": "Coral Fussman", 31 | "url": "https://github.com/coralfussman" 32 | }, 33 | { 34 | "name": "Sett Hein", 35 | "url": "https://github.com/settnaing199" 36 | }, 37 | { 38 | "name": "Erik Matevosyan", 39 | "url": "https://github.com/erik-matevosyan" 40 | }, 41 | { 42 | "name": "Erik Rogel", 43 | "url": "https://github.com/erikjrogel" 44 | } 45 | ], 46 | "homepage": "https://findatlantis.io", 47 | "dependencies": { 48 | "graphql": "^15.5.0" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
    2 | 3 | 4 | 5 |

    Atlantis-Cache

    6 | 7 |

    Light-weight server-side caching solution for GraphQL.

    8 | GitHub license 9 | npm 10 | GitHub issues 11 | 12 |
    13 | 14 | 15 | ## About 16 | 17 | Atlantis is a light-weight library that solves the issue of storing and maintaining deeply-nested GraphQL queries. This ensures the client always receives the most relevant data as mutations are made to the database. 18 | Atlantis leverages Redis’s ‘in-memory’ quick lookup time to rapidly serve up cached graphQL responses regardless of size or structure.Redis integration along with Pub/Sub architecture also allows for scaling as your needs grow and you require more cache space or backup cache workers. New queries that bare resemblance to previous queries, are intelligently pulled from the existing cached nesting instead of creating a new key/value entry. 19 | 20 | This package is meant to work in conjunction with Redis. For more information about Redis: check out: Redis 21 | 22 |                                            ![atlantis_demo](https://user-images.githubusercontent.com/36866275/122622799-79457e00-d05f-11eb-9d00-564df61f9289.gif) 23 | 24 | 25 | ## Getting Started 26 | 27 | ### 1. Installing and Connecting to a Redis Server 28 | 29 | - Mac-HomeBrew: 30 | 31 | - At the terminal, `brew install redis` 32 | - Start redis server with `redis-server` 33 | - Test if redis server is running: `redis-cli ping`. If it replies “PONG”, then it’s good to go! 34 | - Default port is `6379` (Keep note of the port) 35 | 36 | - Linux or non-Homebrew: 37 | - Download appropriate version of Redis from [redis.io/download](redis.io/download) 38 | - Follow the instructions 39 | - Once installation is completed, start redis server with `redis-server` 40 | - Default port is `6379` (Keep note of the port) 41 | 42 | ### 2. Installing Atlantis-Cache 43 | 44 | Install Atlantis-Cache as an npm module and save it to your package.json as a dependency. 45 | 46 | `npm i atlantis-cache` 47 | 48 | ## How to Use Atlantis-Cache 49 | 50 | ```js 51 | const express = require('express'); 52 | const redis = require('redis'); 53 | const { graphql } = require('graphql'); 54 | const schema = require('./schema/schema'); 55 | const { atlantis } = require('atlantis-cache'); 56 | 57 | const app = express(); 58 | 59 | // Configure your redis client 60 | const redisClient = redis.createClient({ 61 | host: 'localhost', 62 | port: 6379, 63 | }); 64 | 65 | // Define your endpoint for graphQL queries and pass in your redis, and schema 66 | app.use('/graphql', atlantis(redisClient, schema), async (req, res) => { 67 | return res.status(202).json({ data: res.locals.graphQLResponse }); 68 | }); 69 | ``` 70 | 71 | ## Contributors: 72 | 73 | - Coral Fussman - [Github](https://github.com/coralfussman) | [Linkedin](https://www.linkedin.com/in/coral-fussman-21721538/) 74 | - Sett Hein -[Github](https://github.com/settnaing199) | [Linkedin](https://www.linkedin.com/in/sett-hein/) 75 | - Erik Matevosyan - [Github](https://github.com/erik-matevosyan) | [Linkedin](https://www.linkedin.com/in/erik-matevosyan/) 76 | - Erik Rogel - [Github](https://github.com/erikjrogel) | [Linkedin](https://www.linkedin.com/in/erikjrogel/) 77 | 78 | ## License 79 | 80 | This product is licensed under the MIT License - see the LICENSE.md file for details.‌ 81 | 82 | This product is accelerated by OS Labs. 83 | -------------------------------------------------------------------------------- /Readme_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/Readme_banner.png -------------------------------------------------------------------------------- /dump.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Atlantis/2ac35dd862654e8506e19da0bf363f62b0e14607/dump.rdb -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "lockfileVersion": 1 3 | } 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | {} 2 | --------------------------------------------------------------------------------