@next-k8s/auth 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +1 -0
- package/CHANGELOG.md +72 -0
- package/Dockerfile +7 -0
- package/build/app.js +42 -0
- package/build/index.js +33 -0
- package/build/models/user.js +35 -0
- package/build/routes/__test__/current-user.test.js +35 -0
- package/build/routes/__test__/signin.test.js +52 -0
- package/build/routes/__test__/signout.test.js +24 -0
- package/build/routes/__test__/signup.test.js +62 -0
- package/build/routes/current-user.js +22 -0
- package/build/routes/signin.js +39 -0
- package/build/routes/signout.js +12 -0
- package/build/routes/signup.js +45 -0
- package/build/test/setup.js +32 -0
- package/build/test/utils.js +27 -0
- package/package.json +52 -0
- package/pnpm-lock.yaml +3600 -0
- package/src/app.ts +36 -0
- package/src/index.ts +19 -0
- package/src/models/user.ts +39 -0
- package/src/routes/__test__/current-user.test.ts +26 -0
- package/src/routes/__test__/signin.test.ts +45 -0
- package/src/routes/__test__/signout.test.ts +12 -0
- package/src/routes/__test__/signup.test.ts +57 -0
- package/src/routes/current-user.ts +10 -0
- package/src/routes/signin.ts +29 -0
- package/src/routes/signout.ts +9 -0
- package/src/routes/signup.ts +37 -0
- package/src/test/setup.ts +21 -0
- package/src/test/utils.ts +13 -0
- package/src/types/mongoose-bcrypt.d.ts +1 -0
- package/tsconfig.json +101 -0
package/src/app.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import express from 'express'
|
|
2
|
+
import 'express-async-errors'
|
|
3
|
+
import { json } from 'body-parser'
|
|
4
|
+
import cookieSession from 'cookie-session'
|
|
5
|
+
import { errorHandler, NotFoundError } from '@next-k8s/common'
|
|
6
|
+
|
|
7
|
+
import User from './models/user'
|
|
8
|
+
|
|
9
|
+
import currentUserRouter from './routes/current-user'
|
|
10
|
+
import signinRouter from './routes/signin'
|
|
11
|
+
import signoutRouter from './routes/signout'
|
|
12
|
+
import signupRouter from './routes/signup'
|
|
13
|
+
|
|
14
|
+
if (!process.env.JWT_KEY) throw new Error('JWT_KEY secret not set')
|
|
15
|
+
|
|
16
|
+
const app = express()
|
|
17
|
+
app.disable('x-powered-by')
|
|
18
|
+
app.set('trust proxy', true)
|
|
19
|
+
app.use(json())
|
|
20
|
+
app.use(cookieSession({
|
|
21
|
+
signed: false,
|
|
22
|
+
secure: process.env.NODE_ENV !== 'test'
|
|
23
|
+
}))
|
|
24
|
+
|
|
25
|
+
app.use(currentUserRouter)
|
|
26
|
+
app.use(signinRouter)
|
|
27
|
+
app.use(signoutRouter)
|
|
28
|
+
app.use(signupRouter)
|
|
29
|
+
|
|
30
|
+
app.use('*', async (req, res) => {
|
|
31
|
+
throw new NotFoundError()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
app.use(errorHandler)
|
|
35
|
+
|
|
36
|
+
export default app
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import mongoose from 'mongoose'
|
|
2
|
+
import app from './app'
|
|
3
|
+
|
|
4
|
+
const start = async () => {
|
|
5
|
+
try {
|
|
6
|
+
if (process.env.MONGO_URI) await mongoose.connect(process.env.MONGO_URI)
|
|
7
|
+
else throw new Error('Auth: MONGO_URI is undefined')
|
|
8
|
+
console.log('Auth database connected!')
|
|
9
|
+
} catch (err) {
|
|
10
|
+
console.error(err)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const port = process.env.PORT || 3000
|
|
14
|
+
app.listen(port, () => {
|
|
15
|
+
console.log('Auth service running on port:', port)
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
start()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import mongoose from 'mongoose'
|
|
2
|
+
import bcrypt from 'mongoose-bcrypt'
|
|
3
|
+
|
|
4
|
+
interface UserAttributes {
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
createdAt?: Date;
|
|
8
|
+
updatedAt?: Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const userSchema = new mongoose.Schema({
|
|
12
|
+
email: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
password: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
toJSON: {
|
|
23
|
+
versionKey: false,
|
|
24
|
+
transform (doc, ret) {
|
|
25
|
+
ret.id = ret._id
|
|
26
|
+
delete ret._id
|
|
27
|
+
delete ret.password
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
userSchema.plugin(bcrypt)
|
|
33
|
+
|
|
34
|
+
export const UserModel = mongoose.model('User', userSchema)
|
|
35
|
+
export default class User extends UserModel {
|
|
36
|
+
constructor(attributes: UserAttributes) {
|
|
37
|
+
super(attributes)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import request from 'supertest'
|
|
2
|
+
import app from '../../app'
|
|
3
|
+
import { getTokenCookie } from '../../test/utils'
|
|
4
|
+
|
|
5
|
+
describe('Route: /api/users/current', () => {
|
|
6
|
+
it('responds with the current user', async () => {
|
|
7
|
+
const cookie = await getTokenCookie()
|
|
8
|
+
|
|
9
|
+
const response = await request(app)
|
|
10
|
+
.get('/api/users/current')
|
|
11
|
+
.set('Cookie', cookie)
|
|
12
|
+
.send()
|
|
13
|
+
.expect(200)
|
|
14
|
+
|
|
15
|
+
expect(response.body.user.email).toEqual('test@test.com')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('responds with null if not authenticated', async () => {
|
|
19
|
+
const response = await request(app)
|
|
20
|
+
.get('/api/users/current')
|
|
21
|
+
.send()
|
|
22
|
+
.expect(401)
|
|
23
|
+
|
|
24
|
+
expect(response.body.user).toEqual(null)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import request from 'supertest'
|
|
2
|
+
import app from '../../app'
|
|
3
|
+
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
return request(app)
|
|
6
|
+
.post('/api/users/signup')
|
|
7
|
+
.send({ email: 'test@test.com', password: 'testpass' })
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
describe('Route: /api/users/signin', () => {
|
|
11
|
+
it('responds with 200 to successful signin request', async () => {
|
|
12
|
+
return request(app)
|
|
13
|
+
.post('/api/users/signin')
|
|
14
|
+
.send({ email: 'test@test.com', password: 'testpass' })
|
|
15
|
+
.expect(200)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('throws error on invalid email address during signin', async () => {
|
|
19
|
+
return request(app)
|
|
20
|
+
.post('/api/users/signin')
|
|
21
|
+
.send({ email: 'test_test com', password: 'testpass' })
|
|
22
|
+
.expect(400)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('throws error on missing email or password during signin', async () => {
|
|
26
|
+
await request(app)
|
|
27
|
+
.post('/api/users/signin')
|
|
28
|
+
.send({ email: 'test@test.com', password: '' })
|
|
29
|
+
.expect(400)
|
|
30
|
+
|
|
31
|
+
await request(app)
|
|
32
|
+
.post('/api/users/signin')
|
|
33
|
+
.send({ email: '', password: 'testpass' })
|
|
34
|
+
.expect(400)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('sets a cookie after successful signin', async () => {
|
|
38
|
+
const response = await request(app)
|
|
39
|
+
.post('/api/users/signin')
|
|
40
|
+
.send({ email: 'test@test.com', password: 'testpass' })
|
|
41
|
+
.expect(200)
|
|
42
|
+
|
|
43
|
+
expect(response.get('Set-Cookie')).toBeDefined()
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import request from 'supertest'
|
|
2
|
+
import app from '../../app'
|
|
3
|
+
|
|
4
|
+
describe('Route: /api/users/signout', () => {
|
|
5
|
+
it('clears cookie after signout', async () => {
|
|
6
|
+
const response = await request(app)
|
|
7
|
+
.get('/api/users/signout')
|
|
8
|
+
.expect(200)
|
|
9
|
+
|
|
10
|
+
expect(response.get('Set-Cookie')).toBeDefined()
|
|
11
|
+
})
|
|
12
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import request from 'supertest'
|
|
2
|
+
import app from '../../app'
|
|
3
|
+
|
|
4
|
+
describe('Route: /api/users/signup', () => {
|
|
5
|
+
it('responds with 201 to successful signup request', async () => {
|
|
6
|
+
return request(app)
|
|
7
|
+
.post('/api/users/signup')
|
|
8
|
+
.send({ email: 'test@test.com', password: 'testpass' })
|
|
9
|
+
.expect(201)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('throws error on invalid email address during signup', async () => {
|
|
13
|
+
return request(app)
|
|
14
|
+
.post('/api/users/signup')
|
|
15
|
+
.send({ email: 'test_test com', password: 'testpass' })
|
|
16
|
+
.expect(400)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('throws error on invalid password during signup', async () => {
|
|
20
|
+
return request(app)
|
|
21
|
+
.post('/api/users/signup')
|
|
22
|
+
.send({ email: 'test@test.com', password: 'te' })
|
|
23
|
+
.expect(400)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('throws error on missing email or password during signup', async () => {
|
|
27
|
+
await request(app)
|
|
28
|
+
.post('/api/users/signup')
|
|
29
|
+
.send({ email: 'test@test.com', password: '' })
|
|
30
|
+
.expect(400)
|
|
31
|
+
|
|
32
|
+
await request(app)
|
|
33
|
+
.post('/api/users/signup')
|
|
34
|
+
.send({ email: '', password: 'testpass' })
|
|
35
|
+
.expect(400)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('throws error on existing email during signup', async () => {
|
|
39
|
+
await request(app)
|
|
40
|
+
.post('/api/users/signup')
|
|
41
|
+
.send({ email: 'test@test.com', password: 'testpass' })
|
|
42
|
+
.expect(201)
|
|
43
|
+
|
|
44
|
+
await request(app)
|
|
45
|
+
.post('/api/users/signup')
|
|
46
|
+
.send({ email: 'test@test.com', password: 'testpass' })
|
|
47
|
+
.expect(400)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('sets a cookie after successful signup', async () => {
|
|
51
|
+
const response = await request(app)
|
|
52
|
+
.post('/api/users/signup')
|
|
53
|
+
.send({ email: 'test@test.com', password: 'testpass' })
|
|
54
|
+
|
|
55
|
+
expect(response.get('Set-Cookie')).toBeDefined()
|
|
56
|
+
})
|
|
57
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import express, { Request, Response } from 'express'
|
|
2
|
+
import { currentUser } from '@next-k8s/common'
|
|
3
|
+
// import { currentUser } from '../../../common/src'
|
|
4
|
+
|
|
5
|
+
const router = express.Router()
|
|
6
|
+
router.get('/api/users/current', currentUser, async (req: Request, res: Response) => {
|
|
7
|
+
res.status(!req.currentUser ? 401 : 200).json({ user: req.currentUser || null })
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export default router
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import express, { Request, Response } from 'express'
|
|
2
|
+
import jwt from 'jsonwebtoken'
|
|
3
|
+
import { body } from 'express-validator'
|
|
4
|
+
import { UnauthorizedError, validateRequest } from '@next-k8s/common'
|
|
5
|
+
|
|
6
|
+
import User from '../models/user'
|
|
7
|
+
|
|
8
|
+
const validateInput = [
|
|
9
|
+
body('email').isEmail().withMessage('Email must be a valid email address'),
|
|
10
|
+
body('password').trim().notEmpty().withMessage('A password must be provided')
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
const router = express.Router()
|
|
14
|
+
router.post('/api/users/signin', validateInput, validateRequest, async (req: Request, res: Response) => {
|
|
15
|
+
const user = await User.findOne({ email: req.body.email }).exec()
|
|
16
|
+
if (!user) throw new UnauthorizedError('Incorrect username or password', 401, req.body.email)
|
|
17
|
+
const validPassword = await user.verifyPassword(req.body.password)
|
|
18
|
+
if (!validPassword) throw new UnauthorizedError('Incorrect username or password', 401, req.body.email)
|
|
19
|
+
|
|
20
|
+
const token = jwt.sign({
|
|
21
|
+
id: user.id,
|
|
22
|
+
email: user.email
|
|
23
|
+
}, process.env.JWT_KEY!)
|
|
24
|
+
|
|
25
|
+
req.session = { jwt: token }
|
|
26
|
+
res.json({ user, jwt: token })
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export default router
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import express, { NextFunction, Request, Response } from 'express'
|
|
2
|
+
import { body } from 'express-validator'
|
|
3
|
+
import jwt from 'jsonwebtoken'
|
|
4
|
+
import { BadRequestError, DatabaseConnectionError, validateRequest } from '@next-k8s/common'
|
|
5
|
+
|
|
6
|
+
import User from '../models/user'
|
|
7
|
+
|
|
8
|
+
const router = express.Router()
|
|
9
|
+
|
|
10
|
+
const validateInput = [
|
|
11
|
+
body('email').isEmail().withMessage('Email is not valid'),
|
|
12
|
+
body('password').trim().isLength({ min: 4, max: 32 }).withMessage('Password must be between 4 and 32 characters')
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
router.post('/api/users/signup', validateInput, validateRequest, async (req: Request, res: Response) => {
|
|
16
|
+
const { email, password } = req.body
|
|
17
|
+
const exists = await User.exists({ email: email.toLowerCase() })
|
|
18
|
+
if (exists) throw new BadRequestError('User already exists')
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const user = new User({ email: email.toLowerCase(), password })
|
|
22
|
+
await user.save()
|
|
23
|
+
|
|
24
|
+
const token = jwt.sign({
|
|
25
|
+
id: user.id,
|
|
26
|
+
email: user.email
|
|
27
|
+
}, process.env.JWT_KEY!)
|
|
28
|
+
|
|
29
|
+
req.session = { jwt: token }
|
|
30
|
+
res.status(201).json({ user, jwt: token })
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.error(err)
|
|
33
|
+
throw new DatabaseConnectionError('Failed to insert user')
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export default router
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MongoMemoryServer } from 'mongodb-memory-server'
|
|
2
|
+
import mongoose from 'mongoose'
|
|
3
|
+
|
|
4
|
+
let mongo: any
|
|
5
|
+
process.env.JWT_KEY = '!SuperSecretDevToken!'
|
|
6
|
+
|
|
7
|
+
beforeAll(async () => {
|
|
8
|
+
mongo = await MongoMemoryServer.create()
|
|
9
|
+
const uri = await mongo.getUri()
|
|
10
|
+
await mongoose.connect(uri)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
beforeEach(async () => {
|
|
14
|
+
const collections = await mongoose.connection.db.collections()
|
|
15
|
+
for (const collection of collections) await collection.deleteMany({})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
afterAll(async () => {
|
|
19
|
+
await mongoose.connection.close()
|
|
20
|
+
await mongo.stop()
|
|
21
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import request from 'supertest'
|
|
2
|
+
import app from '../app'
|
|
3
|
+
|
|
4
|
+
export const getTokenCookie = async () => {
|
|
5
|
+
const email = 'test@test.com'
|
|
6
|
+
const password = 'testpass'
|
|
7
|
+
const response = await request(app)
|
|
8
|
+
.post('/api/users/signup')
|
|
9
|
+
.send({ email, password })
|
|
10
|
+
.expect(201)
|
|
11
|
+
|
|
12
|
+
return response.get('Set-Cookie')
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'mongoose-bcrypt'
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
28
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
+
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
+
"typeRoots": ["./src/types", "./node_modules/@types"], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
+
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
+
|
|
39
|
+
/* JavaScript Support */
|
|
40
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
+
|
|
44
|
+
/* Emit */
|
|
45
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
+
"outDir": "./build", /* Specify an output folder for all emitted files. */
|
|
51
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
+
|
|
69
|
+
/* Interop Constraints */
|
|
70
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
+
|
|
76
|
+
/* Type Checking */
|
|
77
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
+
|
|
97
|
+
/* Completeness */
|
|
98
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
+
}
|
|
101
|
+
}
|