diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 4c1244e..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = { - env: { - browser: false, - es6: true - }, - extends: [ - 'airbnb-base', - 'eslint:recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended' - ], - globals: { - Atomics: 'readonly', - SharedArrayBuffer: 'readonly' - }, - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module' - }, - plugins: ['@typescript-eslint'], - settings: { - 'import/parsers': { - '@typescript-eslint/parser': ['.ts', '.tsx'] - } - }, - rules: { - semi: ['error', 'always'], - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-explicit-any': 1, - '@typescript-eslint/no-inferrable-types': [ - 'warn', - { - ignoreParameters: true - } - ], - '@typescript-eslint/no-unused-vars': 'warn', - - 'comma-dangle': ['error', 'never'] - } -}; diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..ddfaf22 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,56 @@ +// { +// "env": { +// "es6": true, +// "node": true +// }, +// "extends": [ +// "eslint:recommended", +// "plugin:@typescript-eslint/eslint-recommended" +// ], +// "globals": { +// "Atomics": "readonly", +// "SharedArrayBuffer": "readonly" +// }, +// "parser": "@typescript-eslint/parser", +// "parserOptions": { +// "ecmaVersion": 2018, +// "sourceType": "module" +// }, +// "plugins": [ +// "@typescript-eslint" +// ], +// "rules": { +// "no-unused-vars": "off", +// "@typescript-eslint/no-unused-vars": "error" +// } +// } +{ + "parser": "@typescript-eslint/parser", + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "env": { + "es6": true, + "node": true, + "jest": true + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "rules": { + "semi": ["error", "always"], + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-inferrable-types": [ + "warn", + { + "ignoreParameters": true + } + ], + "@typescript-eslint/no-unused-vars": "warn" + } +} diff --git a/.eslintrc.json.bk b/.eslintrc.json.bk deleted file mode 100644 index 6b627db..0000000 --- a/.eslintrc.json.bk +++ /dev/null @@ -1,34 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es6": true - }, - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parser": "@typescript-eslint/parser", - "extends": [ - "airbnb-base", - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:import/errors", - "plugin:import/warnings", - "plugin:import/typescript" - ], - "parserOptions": { - "ecmaVersion": 2018, - "project": "./tsconfig.json", - "sourceType": "module" - }, - "plugins": ["@typescript-eslint"], - "rules": { - "comma-dangle": ["error", "always"] - }, - "settings": { - "import/parsers": { - "@typescript-eslint/parser": [".ts", ".tsx"] - } - } -} diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 index 38a13a4..cacaaef --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,66 @@ + +# Created by https://www.gitignore.io/api/node,linux +# Edit at https://www.gitignore.io/?templates=node,linux + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/ + +# Dependency directories node_modules/ -dist/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file .env -build/ \ No newline at end of file +.env.test + +# End of https://www.gitignore.io/api/node,linux diff --git a/Dockerfile b/Dockerfile index d8f6929..5049b01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,38 @@ -# Use the official Node.js 10 image. -# https://hub.docker.com/_/node -FROM node:12 +# ---- Base Node ---- +FROM node:12.15-slim AS base +# set working directory +WORKDIR /app +# copy project file +COPY package.json . -# Create and change to the app directory. -WORKDIR /usr/src/app - -# Copy application dependency manifests to the container image. -# A wildcard is used to ensure both package.json AND package-lock.json are copied. -# Copying this separately prevents re-running npm install on every code change. -COPY package.json package*.json ./ - -# Install production dependencies. +# +# ---- Dependencies ---- +FROM base AS dependencies +# install node packages +RUN npm set progress=false && npm config set depth 0 +RUN npm install --only=production +# copy production node_modules aside +RUN cp -R node_modules prod_node_modules +# install ALL node_modules, including 'devDependencies' RUN npm install -# Copy local code to the container image. +# +# ---- Test ---- +# run linters, setup and tests +FROM dependencies AS test COPY . . +RUN npm run lint && npm run setup && npm run test + +# +# ---- Release ---- +FROM base AS release +# copy production node_modules +COPY --from=dependencies /app/prod_node_modules ./node_modules +# copy app sources +COPY . . + +# expose port and define CMD +ENV PORT=8080 +EXPOSE ${PORT} -# Run the web service on container startup. -CMD [ "npm", "start" ] +CMD npm run start \ No newline at end of file diff --git a/LICENSE b/LICENSE index 489feb8..3a4d0d4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,5 @@ -MIT License +Copyright 2020 Darshan Shah -Copyright (c) 2020 Michele Memoli +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 2268d75..0000000 --- a/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -NAME = plumbline -REGISTRY = gcr.io/neo4j-k8s-marketplace-public -TAG=$(shell cat package.json | grep version | egrep -o '[0-9]+\.[0-9]+\.[0-9]+') -IMAGE=$(REGISTRY)/$(NAME):$(TAG) - -build:: .build/plumbline - -.build/plumbline: *.js Dockerfile - mkdir -p "$@" - docker build \ - --tag "$(IMAGE)" \ - -f Dockerfile \ - . - docker push "$(IMAGE)" - @touch "$@" - -GCP_PROJECT=testbed-187316 -NEO4J_URI ?= CONFIGURE_ENV_VAR_NEO4J_URI -NEO4J_PASSWORD ?= admin -NEO4J_USER ?= neo4j - -REGION ?= us-central1 - -cloudrun: - gcloud beta run deploy $(NAME) --image $(IMAGE) \ - --region $(REGION) \ - --update-env-vars NEO4J_URI=$(NEO4J_URI),NEO4J_PASSWORD=$(NEO4J_PASSWORD),NEO4J_USER=$(NEO4J_USER) \ No newline at end of file diff --git a/README.md b/README.md index a31af4d..5e2371c 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,23 @@ -# Plumbline +# Steps to run the compile and run the server -Plumbline is a utility container that allows the use of neo4j-graphql-js with a Neo4j instance. +- Run `yarn` or `npm install` +- Run `yarn build` or `npm run build` +- Run `yarn start` or `npm run start` -## Running on GCP Cloud Run +## To run using docker -1. Adjust parameters in the Makefile -2. Make sure to define -the `NEO4J_URI`, `NEO4J_USERNAME`, `NEO4J_PASSWORD` of your instance. -3. Define an env var `TYPEDEFS` with the typedefs you'd like to use with the Neo4j instance. -2. `make cloudrun` will deploy the plumbline service given those specifics. +- Run `docker-compose -f docker-compose.yml up` -## Running in any other Dockerized environment +## To run mongo as a container -Plumbline is just an apollo server running neo4j-graphql-js. Check the Makefile for the repository where the -docker image can be found, and deploy with the key environment variables mentioned above. +- Run `docker-compose -f docker-compose-resources.yml up` + +## Generate documentation for code. (uses tsconfig.json file present in your project for generating/serving docs) -## Build the container +- Run `yarn generate-docs` or `npm run generate-docs` +- Run `yarn serve-docs` or `npm run serve-docs` to host the generated documentation -You only need to do this if you're developing plumbline. Existing containers are already hosted in a public -repository, so you can run plumbline without this step. - -1. Adjust the registry setting at the top of the `Makefile`. -2. `make` will build and push your docker image +## Things to Remeber / Things to Do +- While coding, please follow proper code-commenting practices. +- **[Can refer and follow standards defined by Microsoft for the same](https://github.com/microsoft/tsdoc)** diff --git a/package.json b/package.json index 9cff033..4d428a1 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,59 @@ { - "name": "plumbline", - "version": "0.0.1", - "main": "index.js", - "description": "GraphQL container for Neo4j", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/moxious/plumbline.git" - }, + "name": "nodejs-express-typescript", + "version": "1.0.0", + "description": "A simple boilerplate for nodejs, express and typescript application.", + "main": "build/server.js", "scripts": { "watch": "tsc -w", "build": "tsc", + "start": "node ./build/server.js", + "lint": "./node_modules/.bin/eslint --ext ts ./src", "setup": "npm run lint && npm run build", - "lint": "eslint --ext=ts src", - "test": "echo 'no tests written!'", - "start": "npm run setup && node dist/index.js" + "compodoc": "compodoc", + "generate-docs": "compodoc -p ./tsconfig.json", + "serve-docs": "compodoc -s ./tsconfig.json", + "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "apollo-server": "^2.5.0", - "bunyan": "^1.8.12", + "apollo-server": "^2.11.0", + "apollo-server-express": "^2.11.0", + "body-parser": "^1.19.0", "dotenv": "^8.2.0", - "express": "^4.17.1", - "neo4j-driver": "^1.7.4", - "neo4j-graphql-js": "^2.13.0" + "helmet": "^3.21.3", + "log4js": "^6.1.2", + "mongoose": "^5.9.3", + "morgan": "^1.9.1", + "neo4j-driver": "^4.0.2", + "neo4j-graphql-js": "^2.13.0", + "typescript": "^3.8.3", + "winston": "^3.2.1" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^2.24.0", - "@typescript-eslint/parser": "^2.24.0", - "babel-cli": "^6.26.0", - "babel-plugin-transform-async-generator-functions": "^6.24.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-env": "^1.7.0", - "chai": "^4.2.0", + "@compodoc/compodoc": "^1.1.11", + "@types/body-parser": "^1.17.1", + "@types/eslint": "^6.1.1", + "@types/express": "^4.17.3", + "@types/helmet": "0.0.45", + "@types/mongoose": "^5.7.3", + "@types/morgan": "^1.9.0", + "@types/node": "^12.12.29", + "@typescript-eslint/eslint-plugin": "^2.22.0", + "@typescript-eslint/parser": "^2.22.0", "eslint": "^6.8.0", - "eslint-config-airbnb-base": "^14.1.0", - "eslint-import-resolver-ts": "^0.4.2", - "eslint-plugin-import": "^2.20.1", - "mocha": "^6.1.4", - "sinon": "^7.3.2", - "typescript": "^3.8.3" - } + "eslint-config-airbnb-base": "^14.0.0", + "eslint-plugin-import": "^2.20.1" + }, + "keywords": [ + "nodejs", + "typescript", + "express", + "boilerplate", + "rest", + "apis", + "oop", + "MVC", + "mongoDB" + ], + "author": "Darshan Shah", + "license": "ISC" } diff --git a/src/app.ts b/src/app.ts new file mode 100644 index 0000000..de125fc --- /dev/null +++ b/src/app.ts @@ -0,0 +1,105 @@ +import express from 'express'; +import { augmentTypeDefs, augmentSchema } from 'neo4j-graphql-js'; +import bodyParser from 'body-parser'; +import { ApolloServer, makeExecutableSchema } from 'apollo-server-express'; +import * as neo4j from 'neo4j-driver'; +import { + typeDefs as defaultTypedefs, + resolvers as defaultResolvers +} from './appConfigs/schema'; + +const typeDefs = process.env.TYPEDEFS || defaultTypedefs; +const resolvers = defaultResolvers; + +export interface Context { + driver: neo4j.Driver; + req: Express.Request; +} + +import errorMiddleware from './common/httpErrorHandler.middleware'; +import morgan from 'morgan'; +import helmet from 'helmet'; + +export default class App { + public app: express.Application; + public server: ApolloServer; + public port: number; + + /** + * @constructor + * @param controllers + * @param port + */ + constructor(port: number) { + const schema = makeExecutableSchema({ + typeDefs: augmentTypeDefs(typeDefs), + + resolverValidationOptions: { + requireResolversForResolveType: false + }, + resolvers + }); + + // Add auto-generated mutations + const augmentedSchema = augmentSchema(schema, { + query: { + exclude: ['LogContactPayload'] + } + }); + + const driver = neo4j.driver( + process.env.NEO4J_URI || 'bolt://localhost:7687', + neo4j.auth.basic( + process.env.NEO4J_USER || 'neo4j', + process.env.NEO4J_PASSWORD || 'letmein' + ), + { encrypted: true } + ); + + this.app = express(); + this.server = new ApolloServer({ + schema: augmentedSchema, + // inject the request object into the context to support middleware + // inject the Neo4j driver instance to handle database call + context: ({ req }: { req: Express.Request }): Context => ({ + driver, + req + }) + }); + this.port = port; + + this.initializeMiddlewares(); + this.initializeErrorhandling(); + } + + /** + * @func listen Make the server to listen at specified port. + */ + public listen() { + this.app.listen(this.port, () => { + console.log(`server started at http://localhost:${this.port}`); + }); + } + + /** + * @func initializeMiddlewares Initializes all the middleware + */ + private initializeMiddlewares() { + this.app.use(bodyParser.json()); + morgan.token('time', () => Date().toString()); // Both morgan and log4js are configured to same date format, so that log reading is meaningful and not confusing due to different date formats + this.app.use( + morgan( + '[:time] :remote-addr :method :url :status :res[content-length] :response-time ms' + ) + ); + this.app.use(helmet()); + this.server.applyMiddleware({ app: this.app }); + } + + /** + * @func initializeErrorhandling Initializes error handling middleware. + */ + private initializeErrorhandling() { + this.app.use(errorMiddleware); + } +} diff --git a/src/appConfigs/env/local.ts b/src/appConfigs/env/local.ts new file mode 100644 index 0000000..796efe9 --- /dev/null +++ b/src/appConfigs/env/local.ts @@ -0,0 +1,7 @@ +const config = { + MONGO_PATH: process.env.MONGO_PATH || 'localhost:27017', + MONGODB_DATABASE: process.env.MONGODB_DATABASE || 'superherodb', + PORT: Number(process.env.PORT) || 5000 +}; + +export default config; diff --git a/src/appConfigs/index.ts b/src/appConfigs/index.ts new file mode 100644 index 0000000..1b205f3 --- /dev/null +++ b/src/appConfigs/index.ts @@ -0,0 +1,3 @@ +import config from './env/local'; + +export default config; diff --git a/src/schema.ts b/src/appConfigs/schema.ts similarity index 100% rename from src/schema.ts rename to src/appConfigs/schema.ts diff --git a/src/common/exceptions/HttpException.ts b/src/common/exceptions/HttpException.ts new file mode 100644 index 0000000..671bf6f --- /dev/null +++ b/src/common/exceptions/HttpException.ts @@ -0,0 +1,11 @@ +export default class HttpException extends Error { + + status: number; + message: string; + + constructor(status: number, message: string) { + super(message); + this.status = status; + this.message = message; + } +} diff --git a/src/common/httpErrorHandler.middleware.ts b/src/common/httpErrorHandler.middleware.ts new file mode 100644 index 0000000..1388cb6 --- /dev/null +++ b/src/common/httpErrorHandler.middleware.ts @@ -0,0 +1,25 @@ +/** + * @description Error handler middleware, sends error response to client. + * @exports errorMiddleware + */ + +import { Request, Response, NextFunction } from 'express'; + +import HttpException from './exceptions/HttpException'; + +function errorMiddleware( + error: HttpException, + request: Request, + response: Response, + next: NextFunction +): void { + const status: number = error.status || 500; + const message: string = error.message || 'Something went wrong'; + response.status(status).send({ + status, + message + }); + next({ err: message }); +} + +export default errorMiddleware; diff --git a/src/common/interfaces/apiRouter.interface.ts b/src/common/interfaces/apiRouter.interface.ts new file mode 100644 index 0000000..64dc034 --- /dev/null +++ b/src/common/interfaces/apiRouter.interface.ts @@ -0,0 +1,14 @@ +/** + * @interface + * @description Defines a interface on ApiRouter. + * @exports ApiRouter + */ + +import { Router } from "express"; + +interface ApiRouter { + path: string; + router: Router; +} + +export default ApiRouter; diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index 17e8a7f..0000000 --- a/src/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { augmentTypeDefs, augmentSchema } from 'neo4j-graphql-js'; -import { ApolloServer, makeExecutableSchema } from 'apollo-server'; -import * as Express from 'express'; -import { v1 as neo4j } from 'neo4j-driver'; -import { - typeDefs as defaultTypedefs, - resolvers as defaultResolvers -} from './schema'; - -require('dotenv').config(); - -const typeDefs = process.env.TYPEDEFS || defaultTypedefs; -const resolvers = defaultResolvers; - -const schema = makeExecutableSchema({ - typeDefs: augmentTypeDefs(typeDefs), - - resolverValidationOptions: { - requireResolversForResolveType: false - }, - resolvers -}); - -// Add auto-generated mutations -const augmentedSchema = augmentSchema(schema, { - query: { - exclude: ['LogContactPayload'] - } -}); - -const driver = neo4j.driver( - process.env.NEO4J_URI || 'bolt://localhost:7687', - neo4j.auth.basic( - process.env.NEO4J_USER || 'neo4j', - process.env.NEO4J_PASSWORD || 'letmein' - ) -); - -export interface Context { - driver: neo4j.Driver; - req: Express.Request; -} - -const server = new ApolloServer({ - schema: augmentedSchema, - // inject the request object into the context to support middleware - // inject the Neo4j driver instance to handle database call - context: ({ req }): Context => ({ - driver, - req - }) -}); - -server - .listen( - process.env.PORT || process.env.GRAPHQL_LISTEN_PORT || 3000, - '0.0.0.0' - ) - .then(({ url }) => { - // eslint-disable-next-line no-console - console.log(`GraphQL API ready at ${url}`); - }); diff --git a/src/server.ts b/src/server.ts new file mode 100644 index 0000000..f2bcb1b --- /dev/null +++ b/src/server.ts @@ -0,0 +1,13 @@ +/** + * @description Entry point for application + */ + +require('dotenv').config(); + +import App from './app'; + +import config from './appConfigs'; + +const app = new App(config.PORT); + +app.listen(); diff --git a/src/types/neo4j-graphql-js/index.d.ts b/src/types/neo4j-graphql-js/index.d.ts new file mode 100755 index 0000000..ef6d9b7 --- /dev/null +++ b/src/types/neo4j-graphql-js/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for neo4j-graphql-js 2.0 +// Project: https://github.com/neo4j-graphql/neo4j-graphql-js#readme +// Definitions by: Gavin Williams +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'neo4j-graphql-js' { + export function augmentSchema(schema: any, config: any): any; + + export function augmentTypeDefs(typeDefs: any): any; + + export function cypherMutation( + _ref7: any, + context: any, + resolveInfo: any, + ...args: any[] + ): any; + + export function cypherQuery( + _ref2: any, + context: any, + resolveInfo: any, + ...args: any[] + ): any; + + export function makeAugmentedSchema(_ref8: any): any; + + export function neo4jgraphql( + _x2: any, + _x3: any, + _x4: any, + _x5: any, + ...args: any[] + ): any; + + export namespace augmentSchema { + const prototype: {}; + } + + export namespace augmentTypeDefs { + const prototype: {}; + } + + export namespace cypherMutation { + const prototype: {}; + } + + export namespace cypherQuery { + const prototype: {}; + } + + export namespace makeAugmentedSchema { + const prototype: {}; + } + + export namespace neo4jgraphql { + const prototype: {}; + } +} diff --git a/types/neo4j-graphql-js/neo4j-graphql-js-tests.ts b/src/types/neo4j-graphql-js/neo4j-graphql-js-tests.ts similarity index 100% rename from types/neo4j-graphql-js/neo4j-graphql-js-tests.ts rename to src/types/neo4j-graphql-js/neo4j-graphql-js-tests.ts diff --git a/tsconfig.json b/tsconfig.json index 4efa9de..b43d23b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,63 @@ { "compilerOptions": { - "module": "commonjs", - "declaration": true, - "esModuleInterop": true, - "noImplicitAny": false, - "removeComments": true, - "noLib": false, - "allowSyntheticDefaultImports": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "target": "es6", - "sourceMap": true, - "outDir": "./dist", - "baseUrl": "./" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "**/*.spec.ts"] + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "./build" /* Redirect output structure to the directory. */, + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */, + "noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */, + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } diff --git a/types/neo4j-graphql-js/index.d.ts b/types/neo4j-graphql-js/index.d.ts deleted file mode 100755 index 97730f9..0000000 --- a/types/neo4j-graphql-js/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -// Type definitions for neo4j-graphql-js 2.0 -// Project: https://github.com/neo4j-graphql/neo4j-graphql-js#readme -// Definitions by: Gavin Williams -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module 'neo4j-graphql-js' { - - export function augmentSchema(schema: any, config: any): any; - - export function augmentTypeDefs(typeDefs: any): any; - - export function cypherMutation(_ref7: any, context: any, resolveInfo: any, ...args: any[]): any; - - export function cypherQuery(_ref2: any, context: any, resolveInfo: any, ...args: any[]): any; - - export function makeAugmentedSchema(_ref8: any): any; - - export function neo4jgraphql(_x2: any, _x3: any, _x4: any, _x5: any, ...args: any[]): any; - - export namespace augmentSchema { - const prototype: { - }; - - } - - export namespace augmentTypeDefs { - const prototype: { - }; - - } - - export namespace cypherMutation { - const prototype: { - }; - - } - - export namespace cypherQuery { - const prototype: { - }; - - } - - export namespace makeAugmentedSchema { - const prototype: { - }; - - } - - export namespace neo4jgraphql { - const prototype: { - }; - - } - -} \ No newline at end of file