@spinajs/validation 1.0.0
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/lib/config/validation.d.ts +1 -0
- package/lib/config/validation.js +24 -0
- package/lib/config/validation.js.map +1 -0
- package/lib/decorators.d.ts +8 -0
- package/lib/decorators.js +17 -0
- package/lib/decorators.js.map +1 -0
- package/lib/exceptions/index.d.ts +11 -0
- package/lib/exceptions/index.js +15 -0
- package/lib/exceptions/index.js.map +1 -0
- package/lib/index.d.ts +44 -0
- package/lib/index.js +135 -0
- package/lib/index.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path_1 = require("path");
|
|
4
|
+
function dir(path) {
|
|
5
|
+
return path_1.resolve(path_1.normalize(path_1.join(__dirname, path)));
|
|
6
|
+
}
|
|
7
|
+
module.exports = {
|
|
8
|
+
system: {
|
|
9
|
+
dirs: {
|
|
10
|
+
schemas: [dir('./../schemas')],
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
validation: {
|
|
14
|
+
// enable all errors on validation, not only first one that occurred
|
|
15
|
+
allErrors: true,
|
|
16
|
+
// remove properties that are not defined in schema
|
|
17
|
+
removeAdditional: true,
|
|
18
|
+
// set default values if possible
|
|
19
|
+
useDefaults: true,
|
|
20
|
+
// The option coerceTypes allows you to have your data types coerced to the types specified in your schema type keywords
|
|
21
|
+
coerceTypes: true
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/config/validation.ts"],"names":[],"mappings":";;AAAA,+BAAgD;AAEhD,SAAS,GAAG,CAAC,IAAY;IACrB,OAAO,cAAO,CAAC,gBAAS,CAAC,WAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,OAAO,GAAG;IACb,MAAM,EAAE;QACJ,IAAI,EAAE;YACF,OAAO,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;SACjC;KACJ;IACD,UAAU,EAAE;QAER,qEAAqE;QACrE,SAAS,EAAE,IAAI;QAEf,mDAAmD;QACnD,gBAAgB,EAAE,IAAI;QAEtB,iCAAiC;QACjC,WAAW,EAAE,IAAI;QAEjB,wHAAwH;QACxH,WAAW,EAAE,IAAI;KACpB;CACJ,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Schema = exports.SCHEMA_SYMBOL = void 0;
|
|
4
|
+
exports.SCHEMA_SYMBOL = Symbol('SCHEMA_SYMBOL');
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* Add schema for object eg. model or dto.
|
|
8
|
+
*
|
|
9
|
+
* @param schema schema for object or schema name
|
|
10
|
+
*/
|
|
11
|
+
function Schema(schema) {
|
|
12
|
+
return (target) => {
|
|
13
|
+
Reflect.defineMetadata(exports.SCHEMA_SYMBOL, schema, target);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.Schema = Schema;
|
|
17
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAErD;;;;;GAKG;AACH,SAAgB,MAAM,CAAC,MAAuB;IAC1C,OAAO,CAAC,MAAW,EAAE,EAAE;QACnB,OAAO,CAAC,cAAc,CAAC,qBAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC,CAAC;AACN,CAAC;AAJD,wBAIC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exception } from "@spinajs/exceptions";
|
|
2
|
+
import { ErrorObject } from "ajv";
|
|
3
|
+
/**
|
|
4
|
+
* The exception that is thrown when JSON entity is checked against schema and is invalid
|
|
5
|
+
*/
|
|
6
|
+
export declare class ValidationFailed extends Exception {
|
|
7
|
+
parameter: any;
|
|
8
|
+
constructor(message: string, validationErrors: ValidationError[]);
|
|
9
|
+
}
|
|
10
|
+
export interface ValidationError extends ErrorObject {
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationFailed = void 0;
|
|
4
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
5
|
+
/**
|
|
6
|
+
* The exception that is thrown when JSON entity is checked against schema and is invalid
|
|
7
|
+
*/
|
|
8
|
+
class ValidationFailed extends exceptions_1.Exception {
|
|
9
|
+
constructor(message, validationErrors) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.parameter = validationErrors;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ValidationFailed = ValidationFailed;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD;;GAEG;AACF,MAAa,gBAAiB,SAAQ,sBAAS;IAG5C,YAAY,OAAe,EAAE,gBAAmC;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,gBAAgB,CAAC;IACpC,CAAC;CACF;AAPF,4CAOE"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AsyncModule, IContainer } from "@spinajs/di";
|
|
2
|
+
import Ajv from "ajv";
|
|
3
|
+
import { Configuration } from "@spinajs/configuration";
|
|
4
|
+
import { Log } from "@spinajs/log";
|
|
5
|
+
import { ValidationError } from "./exceptions";
|
|
6
|
+
export declare class DataValidator extends AsyncModule {
|
|
7
|
+
protected Validator: Ajv.Ajv;
|
|
8
|
+
protected Configuration: Configuration;
|
|
9
|
+
protected Container: IContainer;
|
|
10
|
+
protected Log: Log;
|
|
11
|
+
resolveAsync(container: IContainer): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Tries to validate given data
|
|
14
|
+
*
|
|
15
|
+
* @param data data to validate. Function will try to extract schema attached to object via @Schema decorator
|
|
16
|
+
* @return { array : [boolean, ValidationError[]]} [0] true if data is valid, false otherwise, [1] list of all errors. If
|
|
17
|
+
* set in config validation.allErrors is set to false, only firs error is returned
|
|
18
|
+
*/
|
|
19
|
+
tryValidate(data: any): [boolean, ValidationError[]];
|
|
20
|
+
/**
|
|
21
|
+
* Tries to validate given data
|
|
22
|
+
*
|
|
23
|
+
* @param {string|object|Boolean} schemaKeyRef key, ref or schema object
|
|
24
|
+
* @param {Any} data to be validated
|
|
25
|
+
* @return { array : [boolean, ValidationError[]]} [0] true if data is valid, false otherwise, [1] list of all errors. If
|
|
26
|
+
* set in config validation.allErrors is set to false, only firs error is returned
|
|
27
|
+
*/
|
|
28
|
+
tryValidate(schema: object | string | boolean, data: any): [boolean, ValidationError[]];
|
|
29
|
+
/**
|
|
30
|
+
* Validate given data. When failed, exception is thrown
|
|
31
|
+
*
|
|
32
|
+
* @param data data to validate. Function will try to extract schema attached to object via @Schema decorator
|
|
33
|
+
* @throws {InvalidArgumen | ValidationFailed }
|
|
34
|
+
*/
|
|
35
|
+
validate(data: any): void;
|
|
36
|
+
/**
|
|
37
|
+
* Validate given data
|
|
38
|
+
*
|
|
39
|
+
* @param {string|object|Boolean} schemaKeyRef key, ref or schema object
|
|
40
|
+
* @param {Any} data to be validated
|
|
41
|
+
* @throws {InvalidArgumen | ValidationFailed }
|
|
42
|
+
*/
|
|
43
|
+
validate(schema: object | string | boolean, data: any): void;
|
|
44
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
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;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.DataValidator = void 0;
|
|
35
|
+
const di_1 = require("@spinajs/di");
|
|
36
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
37
|
+
const configuration_1 = require("@spinajs/configuration");
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const glob = __importStar(require("glob"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const log_1 = require("@spinajs/log");
|
|
42
|
+
const exceptions_1 = require("./exceptions");
|
|
43
|
+
const exceptions_2 = require("@spinajs/exceptions");
|
|
44
|
+
const decorators_1 = require("./decorators");
|
|
45
|
+
class DataValidator extends di_1.AsyncModule {
|
|
46
|
+
async resolveAsync(container) {
|
|
47
|
+
this.Configuration = await container.resolve(configuration_1.Configuration);
|
|
48
|
+
this.Container = container;
|
|
49
|
+
const ajvConfig = Object.assign({ logger: {
|
|
50
|
+
log: this.Log.info.bind(this.Log),
|
|
51
|
+
warn: this.Log.warn.bind(this.Log),
|
|
52
|
+
error: this.Log.error.bind(this.Log)
|
|
53
|
+
} }, this.Configuration.get("validation"));
|
|
54
|
+
this.Validator = new ajv_1.default(ajvConfig);
|
|
55
|
+
// add $merge & $patch for json schema
|
|
56
|
+
require("ajv-merge-patch")(this.Validator);
|
|
57
|
+
// add common formats validation eg: date time
|
|
58
|
+
require("ajv-formats")(this.Validator);
|
|
59
|
+
// add keywords
|
|
60
|
+
require("ajv-keywords")(this.Validator);
|
|
61
|
+
this.Configuration.get("system.dirs.schemas", [])
|
|
62
|
+
.filter(dir => fs.existsSync(dir))
|
|
63
|
+
.flatMap((d) => glob.sync(path.join(d, "*.json")))
|
|
64
|
+
.map(f => {
|
|
65
|
+
return {
|
|
66
|
+
schema: require(f),
|
|
67
|
+
file: path.basename(f)
|
|
68
|
+
};
|
|
69
|
+
})
|
|
70
|
+
.filter(s => {
|
|
71
|
+
const isValid = this.Validator.validateSchema(s.schema);
|
|
72
|
+
if (!isValid) {
|
|
73
|
+
this.Log.warn(`Schema is not valid %s`, s.file);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
})
|
|
78
|
+
.forEach(s => {
|
|
79
|
+
var _a;
|
|
80
|
+
const schemaId = (_a = s.schema.$id) !== null && _a !== void 0 ? _a : path.basename(s.file);
|
|
81
|
+
this.Log.trace(`Added schema ${schemaId}`);
|
|
82
|
+
this.Validator.addSchema(s.schema, schemaId);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
tryValidate(schemaOrData, data) {
|
|
86
|
+
if (arguments.length === 1) {
|
|
87
|
+
const schema = Reflect.getMetadata(decorators_1.SCHEMA_SYMBOL, schemaOrData);
|
|
88
|
+
if (!schema) {
|
|
89
|
+
return [false, [{
|
|
90
|
+
keyword: "empty_schema",
|
|
91
|
+
dataPath: "data",
|
|
92
|
+
schemaPath: "",
|
|
93
|
+
params: "data"
|
|
94
|
+
}]];
|
|
95
|
+
}
|
|
96
|
+
const result = this.Validator.validate(schema, schemaOrData);
|
|
97
|
+
if (!result) {
|
|
98
|
+
return [false, this.Validator.errors];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (!data) {
|
|
103
|
+
return [false, [{
|
|
104
|
+
keyword: "invalid_argument",
|
|
105
|
+
dataPath: "data",
|
|
106
|
+
schemaPath: "",
|
|
107
|
+
params: "data"
|
|
108
|
+
}]];
|
|
109
|
+
}
|
|
110
|
+
const result = this.Validator.validate(schemaOrData, data);
|
|
111
|
+
if (!result) {
|
|
112
|
+
return [false, this.Validator.errors];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
validate(schemaOrData, data) {
|
|
117
|
+
const [isValid, errors] = this.tryValidate(schemaOrData, data);
|
|
118
|
+
if (!isValid) {
|
|
119
|
+
switch (errors[0].keyword) {
|
|
120
|
+
case "invalid_argument":
|
|
121
|
+
throw new exceptions_2.InvalidArgument("data is null or undefined");
|
|
122
|
+
case "empty_schema":
|
|
123
|
+
throw new exceptions_2.InvalidArgument("objects schema is not set");
|
|
124
|
+
default:
|
|
125
|
+
throw new exceptions_1.ValidationFailed("validation error", errors);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
__decorate([
|
|
131
|
+
log_1.Logger(),
|
|
132
|
+
__metadata("design:type", Object)
|
|
133
|
+
], DataValidator.prototype, "Log", void 0);
|
|
134
|
+
exports.DataValidator = DataValidator;
|
|
135
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsD;AACtD,8CAAsB;AACtB,0DAAuD;AACvD,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA6B;AAC7B,sCAA2C;AAC3C,6CAAiE;AACjE,oDAAsD;AACtD,6CAA6C;AAE7C,MAAa,aAAc,SAAQ,gBAAW;IAWnC,KAAK,CAAC,YAAY,CAAC,SAAqB;QAE3C,IAAI,CAAC,aAAa,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,6BAAa,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,MAAM,SAAS,mBACX,MAAM,EAAE;gBACJ,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;gBACjC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;gBAClC,KAAK,EAAE,IAAI,CAAC,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E;gBACT,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;aACxC;SACJ;IAGL,CAAC;IAkBM,QAAQ,CAAC,YAAuC,EAAE,IAAU;QAC/D,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,EAAE;YACV,QAAQ,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;gBACvB,KAAK,kBAAkB;oBACnB,MAAM,IAAI,4BAAe,CAAC,2BAA2B,CAAC,CAAC;gBAC3D,KAAK,cAAc;oBACf,MAAM,IAAI,4BAAe,CAAC,2BAA2B,CAAC,CAAC;gBAC3D;oBACI,MAAM,IAAI,6BAAgB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;aAE9D;SACJ;IACL,CAAC;CACJ;AA5IG;IADC,YAAM,EAAE;;0CACU;AATvB,sCAqJC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spinajs/validation",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "validation library for spinajs framework",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"private": false,
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
|
|
9
|
+
"coverage": "nyc npm run test",
|
|
10
|
+
"build-docs": "rimraf docs && typedoc --options typedoc.json src/",
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"prepare": "npm run build",
|
|
13
|
+
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
14
|
+
"lint": "tslint -p tsconfig.json",
|
|
15
|
+
"prepublishOnly": "",
|
|
16
|
+
"preversion": "npm run lint",
|
|
17
|
+
"version": "npm run format && git add -A src",
|
|
18
|
+
"postversion": "git push && git push --tags"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"lib/**/*"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/spinajs/validation.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"spinajs",
|
|
29
|
+
"validation",
|
|
30
|
+
"schema"
|
|
31
|
+
],
|
|
32
|
+
"author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/core)",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/spinajs/validation/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/spinajs/validation#readme",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@spinajs/configuration": "^1.0.16",
|
|
40
|
+
"@spinajs/di": "^1.1.0",
|
|
41
|
+
"@spinajs/exceptions": "^1.0.4",
|
|
42
|
+
"@spinajs/log": "^1.0.10",
|
|
43
|
+
"ajv": "^6.12.2",
|
|
44
|
+
"ajv-formats": "^2.1.1",
|
|
45
|
+
"ajv-keywords": "^5.1.0",
|
|
46
|
+
"ajv-merge-patch": "^4.1.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/bunyan": "^1.8.6",
|
|
50
|
+
"@types/chai": "^4.1.7",
|
|
51
|
+
"@types/chai-as-promised": "^7.1.0",
|
|
52
|
+
"@types/compression": "^1.7.0",
|
|
53
|
+
"@types/cookie-parser": "^1.4.2",
|
|
54
|
+
"@types/cookie-signature": "^1.0.3",
|
|
55
|
+
"@types/cors": "^2.8.6",
|
|
56
|
+
"@types/express": "^4.17.6",
|
|
57
|
+
"@types/formidable": "^1.0.31",
|
|
58
|
+
"@types/helmet": "^0.0.47",
|
|
59
|
+
"@types/lodash": "^4.14.136",
|
|
60
|
+
"@types/luxon": "^2.0.8",
|
|
61
|
+
"@types/mime": "^2.0.3",
|
|
62
|
+
"@types/mocha": "^5.2.7",
|
|
63
|
+
"@types/node": "^16.11.11",
|
|
64
|
+
"@types/pug": "^2.0.4",
|
|
65
|
+
"@types/randomstring": "^1.1.6",
|
|
66
|
+
"@types/sinon": "^7.0.13",
|
|
67
|
+
"@types/uuid": "^8.3.3",
|
|
68
|
+
"chai": "^4.2.0",
|
|
69
|
+
"chai-as-promised": "^7.1.1",
|
|
70
|
+
"chai-dom": "^1.8.2",
|
|
71
|
+
"chai-http": "^4.3.0",
|
|
72
|
+
"cpx": "^1.5.0",
|
|
73
|
+
"mocha": "^6.1.4",
|
|
74
|
+
"nyc": "^14.1.1",
|
|
75
|
+
"prettier": "^1.18.2",
|
|
76
|
+
"sinon": "^7.3.2",
|
|
77
|
+
"ts-mocha": "^6.0.0",
|
|
78
|
+
"ts-node": "^8.3.0",
|
|
79
|
+
"tslint": "^5.20.1",
|
|
80
|
+
"tslint-circular-dependencies": "^0.1.0",
|
|
81
|
+
"tslint-config-prettier": "^1.18.0",
|
|
82
|
+
"tslint-config-standard": "^8.0.1",
|
|
83
|
+
"tslint-no-unused-expression-chai": "^0.1.4",
|
|
84
|
+
"typedoc": "^0.14.2",
|
|
85
|
+
"typescript": "^3.7.3"
|
|
86
|
+
}
|
|
87
|
+
}
|