@gapi/auth 1.8.122
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/.prettierrc +4 -0
- package/README.md +150 -0
- package/dist/auth.config.d.ts +21 -0
- package/dist/auth.config.js +5 -0
- package/dist/auth.service.d.ts +10 -0
- package/dist/auth.service.js +60 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +43 -0
- package/package.json +42 -0
- package/src/auth.config.ts +27 -0
- package/src/auth.service.ts +53 -0
- package/src/index.ts +23 -0
- package/tsconfig.json +19 -0
package/.prettierrc
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @Gapi authentication Module
|
|
2
|
+
|
|
3
|
+
##### For questions/issues you can write ticket [here](http://gitlab.youvolio.com/Stradivario/gapi-auth/issues)
|
|
4
|
+
##### This module is intended to be used with [rxdi](https://github.com/rxdi/core) or [gapi](https://github.com/Stradivario/gapi)
|
|
5
|
+
|
|
6
|
+
## Installation and basic examples:
|
|
7
|
+
##### To install this Gapi module, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
$ npm install @gapi/auth --save
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Consuming @gapi/auth
|
|
14
|
+
|
|
15
|
+
##### Import inside AppModule or CoreModule
|
|
16
|
+
```typescript
|
|
17
|
+
import { Module } from "@rxdi/core";
|
|
18
|
+
import { AuthModule } from "@gapi/auth";
|
|
19
|
+
|
|
20
|
+
@Module({
|
|
21
|
+
imports: [
|
|
22
|
+
AuthModule.forRoot({
|
|
23
|
+
algorithm: 'HS256',
|
|
24
|
+
cert: 'dadada',
|
|
25
|
+
cyper: {
|
|
26
|
+
algorithm: 'dada',
|
|
27
|
+
iv: '',
|
|
28
|
+
privateKey: 'dadada'
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
export class CoreModule {}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
##### Create Auth Service and provide it
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
|
|
40
|
+
import { Service } from '@rxdi/core';
|
|
41
|
+
import * as Boom from 'boom';
|
|
42
|
+
import { AuthInterface, AuthInternalService, TokenData } from '@gapi/auth';
|
|
43
|
+
|
|
44
|
+
export interface UserInfo {
|
|
45
|
+
scope: ['ADMIN', 'USER'];
|
|
46
|
+
type: 'ADMIN' | 'USER';
|
|
47
|
+
iat: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Service()
|
|
51
|
+
export class AuthService implements AuthInterface {
|
|
52
|
+
|
|
53
|
+
constructor(
|
|
54
|
+
private authService: AuthInternalService
|
|
55
|
+
) { }
|
|
56
|
+
|
|
57
|
+
onSubOperation(message, params, webSocket) {
|
|
58
|
+
return params;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
onSubConnection(connectionParams): TokenData {
|
|
62
|
+
if (connectionParams.token) {
|
|
63
|
+
return this.validateToken(connectionParams.token, 'Subscription');
|
|
64
|
+
} else {
|
|
65
|
+
throw Boom.unauthorized();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
validateToken(token: string, requestType: 'Query' | 'Subscription' = 'Query'): any {
|
|
70
|
+
const user = <any>this.authService.verifyToken(token);
|
|
71
|
+
user.type = user.scope[0];
|
|
72
|
+
console.log(`${requestType} from: ${JSON.stringify(user)}`);
|
|
73
|
+
if (user) {
|
|
74
|
+
return user;
|
|
75
|
+
} else {
|
|
76
|
+
throw Boom.unauthorized();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
signJWTtoken(tokenData: TokenData): string {
|
|
81
|
+
return this.authService.sign(tokenData);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
issueJWTToken(tokenData: TokenData) {
|
|
85
|
+
const jwtToken = this.authService.sign({
|
|
86
|
+
email: '',
|
|
87
|
+
id: 1,
|
|
88
|
+
scope: ['ADMIN', 'USER']
|
|
89
|
+
});
|
|
90
|
+
return jwtToken;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
verifyToken(token: string): TokenData {
|
|
94
|
+
return this.authService.verifyToken(token);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
decryptPassword(password: string): string {
|
|
98
|
+
return this.authService.decrypt(password);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
encryptPassword(password: string): string {
|
|
102
|
+
return this.authService.encrypt(password);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
##### Provide this particular Auth Service to `authentication` parameter inside CoreModule.forRoot
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
|
|
113
|
+
import { CoreModule, Module } from '@gapi/core';
|
|
114
|
+
import { AuthService } from './app/core/services/auth/auth.service';
|
|
115
|
+
import { AuthModule } from '@gapi/auth';
|
|
116
|
+
import { readFileSync } from 'fs';
|
|
117
|
+
|
|
118
|
+
@Module({
|
|
119
|
+
imports: [
|
|
120
|
+
AuthModule.forRoot({
|
|
121
|
+
algorithm: 'HS256',
|
|
122
|
+
cert: readFileSync('./cert.key'),
|
|
123
|
+
cyper: {
|
|
124
|
+
algorithm: 'aes256',
|
|
125
|
+
iv: 'Jkyt1H3FA8JK9L3B',
|
|
126
|
+
privateKey: '8zTVzr3p53VC12jHV54rIYu2545x47lA'
|
|
127
|
+
}
|
|
128
|
+
}),
|
|
129
|
+
CoreModule.forRoot({
|
|
130
|
+
pubsub: {
|
|
131
|
+
authentication: AuthService
|
|
132
|
+
},
|
|
133
|
+
graphql: {
|
|
134
|
+
authentication: AuthService
|
|
135
|
+
},
|
|
136
|
+
}),
|
|
137
|
+
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
export class FrameworkImports {}
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Then Subscriptions, Mutations and Queries will be secured via single authentication method `validateToken` inside `AuthService`!
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
TODO: Better documentation...
|
|
149
|
+
|
|
150
|
+
Enjoy ! :)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InjectionToken } from '@rxdi/core';
|
|
2
|
+
export declare const AUTH_MODULE_CONFIG: InjectionToken<unknown>;
|
|
3
|
+
export interface AuthInterface {
|
|
4
|
+
onSubOperation(message: any, params: any, webSocket: any): unknown;
|
|
5
|
+
onSubConnection(connectionParams: any): TokenData;
|
|
6
|
+
validateToken(token: any, requestType: 'Query' | 'Subscription'): any;
|
|
7
|
+
}
|
|
8
|
+
export interface TokenData {
|
|
9
|
+
email: string;
|
|
10
|
+
scope: Array<string>;
|
|
11
|
+
id: number;
|
|
12
|
+
}
|
|
13
|
+
export interface AuthModuleConfig {
|
|
14
|
+
cert: unknown;
|
|
15
|
+
algorithm: string;
|
|
16
|
+
cyper: {
|
|
17
|
+
algorithm: string;
|
|
18
|
+
privateKey: string;
|
|
19
|
+
iv: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthModuleConfig, TokenData } from './auth.config';
|
|
2
|
+
export declare class AuthInternalService {
|
|
3
|
+
private config;
|
|
4
|
+
constructor(config: AuthModuleConfig);
|
|
5
|
+
verifyToken(token: any): TokenData;
|
|
6
|
+
decrypt(password: string): string;
|
|
7
|
+
encrypt(password: string): string;
|
|
8
|
+
validate(token: any, callback: any): any;
|
|
9
|
+
sign(tokenData: TokenData): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuthInternalService = void 0;
|
|
16
|
+
const core_1 = require("@rxdi/core");
|
|
17
|
+
const crypto_1 = require("crypto");
|
|
18
|
+
const jsonwebtoken_1 = require("jsonwebtoken");
|
|
19
|
+
const Moment = require("moment");
|
|
20
|
+
const auth_config_1 = require("./auth.config");
|
|
21
|
+
let AuthInternalService = class AuthInternalService {
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this.config = config;
|
|
24
|
+
}
|
|
25
|
+
verifyToken(token) {
|
|
26
|
+
return jsonwebtoken_1.verify(token, this.config.cert, { algorithm: 'HS256' });
|
|
27
|
+
}
|
|
28
|
+
decrypt(password) {
|
|
29
|
+
const decipher = crypto_1.createDecipheriv(this.config.cyper.algorithm, this.config.cyper.privateKey, this.config.cyper.iv);
|
|
30
|
+
let dec = decipher.update(password, 'hex', 'utf8');
|
|
31
|
+
dec += decipher.final('utf8');
|
|
32
|
+
return dec;
|
|
33
|
+
}
|
|
34
|
+
encrypt(password) {
|
|
35
|
+
const cipher = crypto_1.createCipheriv(this.config.cyper.algorithm, this.config.cyper.privateKey, this.config.cyper.iv);
|
|
36
|
+
let crypted = cipher.update(password, 'utf8', 'hex');
|
|
37
|
+
crypted += cipher.final('hex');
|
|
38
|
+
return crypted;
|
|
39
|
+
}
|
|
40
|
+
validate(token, callback) {
|
|
41
|
+
// Check token timestamp
|
|
42
|
+
const ttl = 30 * 1000 * 60;
|
|
43
|
+
const diff = Moment().diff(Moment(token.iat * 1000));
|
|
44
|
+
if (diff > ttl) {
|
|
45
|
+
return callback(null, false);
|
|
46
|
+
}
|
|
47
|
+
callback(null, true, token);
|
|
48
|
+
}
|
|
49
|
+
sign(tokenData) {
|
|
50
|
+
return jsonwebtoken_1.sign(tokenData, this.config.cert, {
|
|
51
|
+
algorithm: this.config.algorithm,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
AuthInternalService = __decorate([
|
|
56
|
+
core_1.Service(),
|
|
57
|
+
__param(0, core_1.Inject(auth_config_1.AUTH_MODULE_CONFIG)),
|
|
58
|
+
__metadata("design:paramtypes", [Object])
|
|
59
|
+
], AuthInternalService);
|
|
60
|
+
exports.AuthInternalService = AuthInternalService;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModuleWithServices } from '@rxdi/core';
|
|
2
|
+
import { AuthModuleConfig } from './auth.config';
|
|
3
|
+
export declare class AuthModule {
|
|
4
|
+
static forRoot(config?: AuthModuleConfig): ModuleWithServices;
|
|
5
|
+
}
|
|
6
|
+
export * from './auth.service';
|
|
7
|
+
export * from './auth.config';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
var AuthModule_1;
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.AuthModule = void 0;
|
|
21
|
+
const core_1 = require("@rxdi/core");
|
|
22
|
+
const auth_config_1 = require("./auth.config");
|
|
23
|
+
const auth_service_1 = require("./auth.service");
|
|
24
|
+
let AuthModule = AuthModule_1 = class AuthModule {
|
|
25
|
+
static forRoot(config) {
|
|
26
|
+
return {
|
|
27
|
+
module: AuthModule_1,
|
|
28
|
+
services: [
|
|
29
|
+
auth_service_1.AuthInternalService,
|
|
30
|
+
{
|
|
31
|
+
provide: auth_config_1.AUTH_MODULE_CONFIG,
|
|
32
|
+
useValue: config || {},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
AuthModule = AuthModule_1 = __decorate([
|
|
39
|
+
core_1.Module()
|
|
40
|
+
], AuthModule);
|
|
41
|
+
exports.AuthModule = AuthModule;
|
|
42
|
+
__exportStar(require("./auth.service"), exports);
|
|
43
|
+
__exportStar(require("./auth.config"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gapi/auth",
|
|
3
|
+
"version": "1.8.122",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/Stradivario/gapi-auth"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"start": "npx parcel ./examples/index.html --out-dir build/examples",
|
|
10
|
+
"patch": "npm run build && npm version patch && npm publish --update-readme --access public && npm run delete-dist",
|
|
11
|
+
"delete-dist": "rm -rf dist",
|
|
12
|
+
"clean": "git clean -dxf",
|
|
13
|
+
"lint": "npx eslint . --ext .ts",
|
|
14
|
+
"lint-fix": "npx eslint . --fix --ext .ts",
|
|
15
|
+
"build": "rm -rf dist && tsc || true"
|
|
16
|
+
},
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Kristian Tachev(Stradivario)",
|
|
19
|
+
"email": "kristiqn.tachev@gmail.com"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"graphql",
|
|
23
|
+
"gapi",
|
|
24
|
+
"node"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/Stradivario/gapi-auth/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/Stradivario/gapi-auth#readme",
|
|
31
|
+
"module": "index.js",
|
|
32
|
+
"typings": "index.d.ts",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"jsonwebtoken": "^8.3.0",
|
|
35
|
+
"moment": "^2.22.2"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@rxdi/core": "^0.7.114",
|
|
39
|
+
"@types/node": "^13.11.1",
|
|
40
|
+
"typescript": "^3.8.3"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InjectionToken } from '@rxdi/core';
|
|
2
|
+
|
|
3
|
+
export const AUTH_MODULE_CONFIG = new InjectionToken(
|
|
4
|
+
'gapi-auth-module-config-injection-token'
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
export interface AuthInterface {
|
|
8
|
+
onSubOperation(message, params, webSocket): unknown;
|
|
9
|
+
onSubConnection(connectionParams): TokenData;
|
|
10
|
+
validateToken(token, requestType: 'Query' | 'Subscription');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TokenData {
|
|
14
|
+
email: string;
|
|
15
|
+
scope: Array<string>;
|
|
16
|
+
id: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface AuthModuleConfig {
|
|
20
|
+
cert: unknown;
|
|
21
|
+
algorithm: string;
|
|
22
|
+
cyper: {
|
|
23
|
+
algorithm: string;
|
|
24
|
+
privateKey: string;
|
|
25
|
+
iv: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Inject, Service } from '@rxdi/core';
|
|
2
|
+
import { createCipheriv, createDecipheriv } from 'crypto';
|
|
3
|
+
import { sign, verify } from 'jsonwebtoken';
|
|
4
|
+
import * as Moment from 'moment';
|
|
5
|
+
|
|
6
|
+
import { AUTH_MODULE_CONFIG, AuthModuleConfig, TokenData } from './auth.config';
|
|
7
|
+
|
|
8
|
+
@Service()
|
|
9
|
+
export class AuthInternalService {
|
|
10
|
+
constructor(@Inject(AUTH_MODULE_CONFIG) private config: AuthModuleConfig) {}
|
|
11
|
+
|
|
12
|
+
verifyToken(token): TokenData {
|
|
13
|
+
return verify(token, this.config.cert, { algorithm: 'HS256' });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
decrypt(password: string) {
|
|
17
|
+
const decipher = createDecipheriv(
|
|
18
|
+
this.config.cyper.algorithm,
|
|
19
|
+
this.config.cyper.privateKey,
|
|
20
|
+
this.config.cyper.iv
|
|
21
|
+
);
|
|
22
|
+
let dec = decipher.update(password, 'hex', 'utf8');
|
|
23
|
+
dec += decipher.final('utf8');
|
|
24
|
+
return dec;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
encrypt(password: string) {
|
|
28
|
+
const cipher = createCipheriv(
|
|
29
|
+
this.config.cyper.algorithm,
|
|
30
|
+
this.config.cyper.privateKey,
|
|
31
|
+
this.config.cyper.iv
|
|
32
|
+
);
|
|
33
|
+
let crypted = cipher.update(password, 'utf8', 'hex');
|
|
34
|
+
crypted += cipher.final('hex');
|
|
35
|
+
return crypted;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
validate(token, callback) {
|
|
39
|
+
// Check token timestamp
|
|
40
|
+
const ttl = 30 * 1000 * 60;
|
|
41
|
+
const diff = Moment().diff(Moment(token.iat * 1000));
|
|
42
|
+
if (diff > ttl) {
|
|
43
|
+
return callback(null, false);
|
|
44
|
+
}
|
|
45
|
+
callback(null, true, token);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
sign(tokenData: TokenData): string {
|
|
49
|
+
return sign(tokenData, this.config.cert, {
|
|
50
|
+
algorithm: this.config.algorithm,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Module, ModuleWithServices } from '@rxdi/core';
|
|
2
|
+
|
|
3
|
+
import { AUTH_MODULE_CONFIG, AuthModuleConfig } from './auth.config';
|
|
4
|
+
import { AuthInternalService } from './auth.service';
|
|
5
|
+
|
|
6
|
+
@Module()
|
|
7
|
+
export class AuthModule {
|
|
8
|
+
public static forRoot(config?: AuthModuleConfig): ModuleWithServices {
|
|
9
|
+
return {
|
|
10
|
+
module: AuthModule,
|
|
11
|
+
services: [
|
|
12
|
+
AuthInternalService,
|
|
13
|
+
{
|
|
14
|
+
provide: AUTH_MODULE_CONFIG,
|
|
15
|
+
useValue: config || {},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export * from './auth.service';
|
|
23
|
+
export * from './auth.config';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"declaration": true,
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"target": "es6",
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"stripInternal": true,
|
|
8
|
+
"emitDecoratorMetadata": true,
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"rootDir": "src",
|
|
13
|
+
"lib": ["es2017", "es2016", "es2015", "es6", "dom", "esnext.asynciterable"],
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"types": ["node"],
|
|
16
|
+
"typeRoots": ["node_modules/@types"]
|
|
17
|
+
},
|
|
18
|
+
"files": ["src/index.ts"]
|
|
19
|
+
}
|