├── .babelrc ├── .codeclimate.yml ├── .editorconfig ├── .env.development ├── .env.test ├── .eslintrc.yml ├── .github └── FUNDING.yml ├── .gitignore ├── .graphqlconfig ├── .idea ├── jsLibraryMappings.xml ├── runConfigurations │ ├── Server.xml │ ├── emulate_cli.xml │ └── emulate_cli_staging.xml └── vcs.xml ├── .nvmrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── buildspec.yml ├── gql └── querySchema.js ├── jest-preload.js ├── package.json ├── schema.graphql ├── secrets-development.yml ├── secrets-example.yml ├── secrets-test.yml ├── serverless.yml ├── src ├── authorizers │ └── basic-auth.js ├── cli │ ├── commandsHandler.js │ └── index.js ├── constants.js ├── functions │ ├── cache-query.js │ ├── cache-query.test.js │ ├── epsagon.js │ ├── read-cache.js │ ├── refresh-cache.js │ ├── refresh-cache.test.js │ ├── reset-cache.js │ ├── reset-cache.test.js │ └── status.js └── utils │ ├── apolloClient.js │ ├── auth.js │ ├── auth.test.js │ ├── cache.js │ ├── cache.test.js │ ├── epsagon.js │ ├── graphql.js │ ├── graphql.test.js │ ├── queries.test.js │ ├── redis.js │ ├── redis.test.js │ └── timers.js ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "source-map-support" 4 | ], 5 | "presets": [ 6 | [ 7 | "@babel/preset-env", 8 | { 9 | "targets": { 10 | "node": true 11 | } 12 | } 13 | ] 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | # XXX See https://docs.codeclimate.com/docs/advanced-configuration 2 | version: "2" 3 | checks: 4 | argument-count: 5 | enabled: true 6 | config: 7 | threshold: 4 8 | complex-logic: 9 | enabled: true 10 | config: 11 | threshold: 4 12 | file-lines: 13 | enabled: true 14 | config: 15 | threshold: 400 # 250 by default 16 | method-complexity: 17 | enabled: true 18 | config: 19 | threshold: 5 20 | method-count: 21 | enabled: true 22 | config: 23 | threshold: 20 24 | method-lines: 25 | enabled: true 26 | config: 27 | threshold: 100 # 25 by default 28 | nested-control-flow: 29 | enabled: true 30 | config: 31 | threshold: 4 32 | return-statements: 33 | enabled: true 34 | config: 35 | threshold: 4 36 | 37 | plugins: 38 | # eslint: # https://docs.codeclimate.com/docs/eslint 39 | # enabled: true 40 | # channel: "eslint-4" # Depends on installed ESLint version - See https://docs.codeclimate.com/docs/eslint#section-eslint-versions 41 | duplication: # https://docs.codeclimate.com/docs/duplication 42 | enabled: true 43 | config: 44 | languages: 45 | javascript: 46 | mass_threshold: 50 # See https://docs.codeclimate.com/docs/duplication#section-understand-the-engine 47 | fixme: # https://docs.codeclimate.com/docs/fixme 48 | enabled: true 49 | config: 50 | strings: # Skip "XXX" as we don't use it for things to fix but rather for highlighting comments (DX) 51 | - FIXME 52 | - BUG 53 | - TODO 54 | - HACK 55 | git-legal: # https://docs.codeclimate.com/docs/git-legal 56 | enabled: true 57 | # tslint: # https://docs.codeclimate.com/docs/tslint 58 | # enabled: true 59 | # config: tslint.json 60 | 61 | # See https://docs.codeclimate.com/docs/excluding-files-and-folders 62 | exclude_patterns: 63 | - "**/*.test.*" 64 | - "**/*.spec.*" 65 | - "src/svg/" 66 | 67 | # Default CC excluded paths: 68 | - "config/" 69 | - "db/" 70 | - "dist/" 71 | - "features/" 72 | - "**/node_modules/" 73 | - "script/" 74 | - "**/spec/" 75 | - "**/test/" 76 | - "**/tests/" 77 | - "**/vendor/" 78 | - "**/*.d.ts" 79 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset=utf-8 3 | end_of_line=lf 4 | trim_trailing_whitespace=true 5 | insert_final_newline=true 6 | indent_style=space 7 | indent_size=2 8 | 9 | [{*.jhm,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.tld,*.fxml,*.jrxml,*.xml,*.jnlp,*.wsdl}] 10 | indent_style=space 11 | indent_size=4 12 | 13 | [{.babelrc,.prettierrc,.stylelintrc,.eslintrc,jest.config,*.json,*.jsb3,*.jsb2,*.bowerrc,*.graphqlconfig}] 14 | indent_style=space 15 | indent_size=2 16 | 17 | [.editorconfig] 18 | indent_style=space 19 | indent_size=4 20 | 21 | [*.less] 22 | indent_style=space 23 | indent_size=2 24 | 25 | [{jshint.json,*.jshintrc}] 26 | indent_style=space 27 | indent_size=2 28 | 29 | [{*.jscs.json,*.jscsrc}] 30 | indent_style=space 31 | indent_size=2 32 | 33 | [{tsconfig.lib.json,tsconfig.spec.json,tsconfig.app.json,tsconfig.json,tsconfig.e2e.json}] 34 | indent_style=space 35 | indent_size=2 36 | 37 | [*.js.map] 38 | indent_style=space 39 | indent_size=2 40 | 41 | [*.ejs] 42 | indent_style=space 43 | indent_size=4 44 | 45 | [{.analysis_options,*.yml,*.yaml}] 46 | indent_style=space 47 | indent_size=2 48 | 49 | [*.md] 50 | indent_size = 4 51 | -------------------------------------------------------------------------------- /.env.development: -------------------------------------------------------------------------------- 1 | # This file define environment variables used only in local development environment that will OVERRIDE env variables defined in serverless.yml 2 | # XXX Variables defined there will override variables defined in serverless.yml, useful when defining variables that are global to an environment and not specific per instance 3 | 4 | # Url where your Cache local instance is running 5 | # Required - For development/test environments only, handled through "serverless.yml" for other environments 6 | CACHE_BASE_URL=http://localhost:8085 7 | -------------------------------------------------------------------------------- /.env.test: -------------------------------------------------------------------------------- 1 | # This file define environment variables used only in local test environment that will OVERRIDE env variables defined in serverless.yml 2 | # XXX Variables defined there will override variables defined in serverless.yml, useful when defining variables that are global to an environment and not specific per instance 3 | 4 | # Url where your Cache local instance is running 5 | # Required - For development/test environments only, handled through "serverless.yml" for other environments 6 | CACHE_BASE_URL=http://localhost:8085 7 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | env: 2 | es6: true 3 | node: true 4 | extends: 5 | - airbnb-base 6 | - plugin:jest/recommended 7 | globals: 8 | Atomics: readonly 9 | SharedArrayBuffer: readonly 10 | parserOptions: 11 | ecmaVersion: 2018 12 | sourceType: module 13 | plugins: 14 | - jest 15 | rules: # See https://eslint.org/docs/rules 16 | semi: 17 | - error 18 | - always # Always put commas, to avoid multilines git diff when new lines are added 19 | quotes: 20 | - error 21 | - single # Prefer simple quotes 22 | - allowTemplateLiterals: true # Allow the use of `` instead of '' and don't try to replace it, even when `` isn't needed 23 | comma-spacing: 24 | - error 25 | - before: false 26 | after: true 27 | indent: 28 | - error 29 | - 2 30 | arrow-parens: 31 | - error 32 | - always 33 | max-len: 0 # Disable line length checks, because the IDE is already configured to warn about it, and it's a waste of time to check for lines that are too long, especially in comments (like this one!) 34 | strict: 'off' 35 | no-console: 2 # Shouldn't use "console", but "logger" instead 36 | allowArrowFunctions: 0 37 | no-unused-vars: 38 | - error 39 | - args: none # Allow to declare unused variables in function arguments, meant to be used later 40 | import/prefer-default-export: 0 # When there is only a single export from a module, don't enforce a default export, but rather let developer choose what's best 41 | no-else-return: 0 # Don't enforce, let developer choose. Sometimes we like to specifically use "return" for the sake of comprehensibility and avoid ambiguity 42 | no-underscore-dangle: 0 # Allow _ before/after variables and functions, convention for something meant to be "private" 43 | arrow-body-style: 0 # Don't enforce, let developer choose. Sometimes we like to specifically use "return" for ease of debugging and printing 44 | quote-props: 45 | - warn 46 | - consistent-as-needed # Enforce consistency with quotes on props, either all must be quoted, or all unquoted for a given object 47 | no-return-await: 0 # Useful before, but recent node.js enhancements make it useless on node 12+ (we use 10, but still, for consistency) - Read https://stackoverflow.com/questions/44806135/why-no-return-await-vs-const-x-await 48 | no-extra-boolean-cast: 0 # Don't enforce, let developer choose. Using "!!!" is sometimes useful (edge cases), and has a semantic value (dev intention) 49 | object-curly-newline: 50 | - warn 51 | - ObjectExpression: 52 | multiline: true 53 | minProperties: 5 54 | consistent: true 55 | ObjectPattern: 56 | multiline: true 57 | minProperties: 5 58 | consistent: true 59 | ImportDeclaration: never # Would conflict with WebStorm settings (WebStorm does the job better) 60 | ExportDeclaration: 61 | multiline: true 62 | minProperties: 5 63 | consistent: true 64 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | liberapay: unlyEd 2 | github: [UnlyEd, Vadorequest] 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/webstorm 2 | 3 | ### WebStorm ### 4 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 5 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 6 | 7 | # User-specific stuff 8 | .idea/**/workspace.xml 9 | .idea/**/tasks.xml 10 | .idea/**/usage.statistics.xml 11 | .idea/**/dictionaries 12 | .idea/**/shelf 13 | 14 | # Sensitive or high-churn files 15 | .idea/**/dataSources/ 16 | .idea/**/dataSources.ids 17 | .idea/**/dataSources.local.xml 18 | .idea/**/sqlDataSources.xml 19 | .idea/**/dynamic.xml 20 | .idea/**/uiDesigner.xml 21 | .idea/**/dbnavigator.xml 22 | 23 | # Gradle 24 | .idea/**/gradle.xml 25 | .idea/**/libraries 26 | 27 | # Gradle and Maven with auto-import 28 | # When using Gradle or Maven with auto-import, you should exclude module files, 29 | # since they will be recreated, and may cause churn. Uncomment if using 30 | # auto-import. 31 | # .idea/modules.xml 32 | # .idea/*.iml 33 | # .idea/modules 34 | 35 | # CMake 36 | cmake-build-*/ 37 | 38 | # Mongo Explorer plugin 39 | .idea/**/mongoSettings.xml 40 | 41 | # File-based project format 42 | *.iws 43 | 44 | # IntelliJ 45 | out/ 46 | 47 | # mpeltonen/sbt-idea plugin 48 | .idea_modules/ 49 | 50 | # JIRA plugin 51 | atlassian-ide-plugin.xml 52 | 53 | # Cursive Clojure plugin 54 | .idea/replstate.xml 55 | 56 | # Crashlytics plugin (for Android Studio and IntelliJ) 57 | com_crashlytics_export_strings.xml 58 | crashlytics.properties 59 | crashlytics-build.properties 60 | fabric.properties 61 | 62 | # Editor-based Rest Client 63 | .idea/httpRequests 64 | 65 | ### WebStorm Patch ### 66 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 67 | 68 | # XXX I don't like that patch, this project is meant to be forker/cloned and therefore renamed, 69 | # tracking those files messes up forks when this boilerplate's config is changed 70 | *.iml 71 | modules.xml 72 | .idea/misc.xml 73 | *.ipr 74 | $CACHE_FILE$ 75 | 76 | # Don't track plugin config 77 | markdown-navigator.xml 78 | 79 | # Don't track code style, as forks may update them and we shouldn't enforce code style from the IDE 80 | .idea/codeStyles 81 | 82 | # Sonarlint plugin 83 | .idea/sonarlint 84 | 85 | 86 | # End of https://www.gitignore.io/api/webstorm 87 | 88 | ######################### CUSTOM/MANUAL ############################# 89 | 90 | # See https://help.github.com/ignore-files/ for more about ignoring files. 91 | 92 | # IDE plugins 93 | .idea/markdown-navigator*/** 94 | 95 | # package directories 96 | node_modules 97 | jspm_packages 98 | 99 | # Serverless directories 100 | .serverless 101 | .webpack 102 | .next 103 | dist 104 | 105 | .DS_Store 106 | .sls-simulate-registry 107 | 108 | # Builds 109 | build 110 | .firebase 111 | coverage/ 112 | 113 | # Sensitive values, do not share (development is for local personal use, not super sensitive but shouldn't be shared with the team) 114 | # XXX Feel free to track development/test/staging files if you wish so, it's usually not too sensitive if you split staging/production properly 115 | .env* 116 | !.env.development 117 | !.env.test 118 | 119 | secrets-*.yml 120 | !secrets-example.yml 121 | !secrets-development.yml 122 | !secrets-test.yml 123 | 124 | # Epsagon generated files 125 | epsagon_handlers/ 126 | -------------------------------------------------------------------------------- /.graphqlconfig: -------------------------------------------------------------------------------- 1 | { 2 | "schemaPath": "schema.graphql", 3 | "extensions": { 4 | "endpoints": { 5 | "staging": { 6 | "url": "https://api-eu-central-1.graphcms.com/v2/cjyi8gl5m00tm01e91polc50t/master", 7 | "introspect": true, 8 | "headers": { 9 | "user-agent": "JS GraphQL", 10 | "Authorization": "Bearer ${env:GRAPHCMS_TOKEN}" 11 | } 12 | }, 13 | "production": { 14 | "url": "https://api-eu-central-1.graphcms.com/v2/cjyi8gl5m00tm01e91polc50t/master", 15 | "introspect": true, 16 | "headers": { 17 | "user-agent": "JS GraphQL", 18 | "Authorization": "Bearer ${env:GRAPHCMS_TOKEN}" 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Server.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |