Remove validate from util package and point to tooling.

This commit is contained in:
Dirk Baeumer 2021-04-06 13:44:49 +02:00
Родитель 542505424f
Коммит edc759465e
6 изменённых файлов: 74 добавлений и 586 удалений

14
package-lock.json сгенерированный
Просмотреть файл

@ -11,7 +11,7 @@
"devDependencies": {
"@types/node": "^12.12.29",
"@types/shelljs": "^0.8.8",
"@types/yargs": "^16.0.0",
"@types/yargs": "^16.0.1",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"eslint": "^7.23.0",
@ -227,9 +227,9 @@
}
},
"node_modules/@types/yargs": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.0.tgz",
"integrity": "sha512-2nN6AGeMwe8+O6nO9ytQfbMQOJy65oi1yK2y/9oReR08DaXSGtMsrLyCM1ooKqfICpCx4oITaR4LkOmdzz41Ww==",
"version": "16.0.1",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.1.tgz",
"integrity": "sha512-x4HABGLyzr5hKUzBC9dvjciOTm11WVH1NWonNjGgxapnTHu5SWUqyqn0zQ6Re0yQU0lsQ6ztLCoMAKDGZflyxA==",
"dev": true,
"dependencies": {
"@types/yargs-parser": "*"
@ -2500,9 +2500,9 @@
}
},
"@types/yargs": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.0.tgz",
"integrity": "sha512-2nN6AGeMwe8+O6nO9ytQfbMQOJy65oi1yK2y/9oReR08DaXSGtMsrLyCM1ooKqfICpCx4oITaR4LkOmdzz41Ww==",
"version": "16.0.1",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.1.tgz",
"integrity": "sha512-x4HABGLyzr5hKUzBC9dvjciOTm11WVH1NWonNjGgxapnTHu5SWUqyqn0zQ6Re0yQU0lsQ6ztLCoMAKDGZflyxA==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"

Просмотреть файл

@ -16,7 +16,7 @@
"devDependencies": {
"@types/node": "^12.12.29",
"@types/shelljs": "^0.8.8",
"@types/yargs": "^16.0.0",
"@types/yargs": "^16.0.1",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"eslint": "^7.23.0",

282
util/package-lock.json сгенерированный
Просмотреть файл

@ -10,10 +10,8 @@
"license": "MIT",
"dependencies": {
"fs-extra": "^9.1.0",
"jsonschema": "^1.4.0",
"lsif-protocol": "0.5.2",
"readline": "^1.3.0",
"typescript-json-schema": "^0.49.0",
"yargs": "^16.2.0"
},
"bin": {
@ -21,7 +19,7 @@
},
"devDependencies": {
"@types/fs-extra": "^9.0.7",
"@types/jest": "^26.0.20",
"@types/jest": "^26.0.22",
"jest": "^26.6.3",
"jest-junit": "^12.0.0",
"rimraf": "^3.0.2"
@ -1400,24 +1398,19 @@
}
},
"node_modules/@types/jest": {
"version": "26.0.20",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.20.tgz",
"integrity": "sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA==",
"version": "26.0.22",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.22.tgz",
"integrity": "sha512-eeWwWjlqxvBxc4oQdkueW5OF/gtfSceKk4OnOAGlUSwS/liBRtZppbJuz1YkgbrbfGOoeBHun9fOvXnjNwrSOw==",
"dev": true,
"dependencies": {
"jest-diff": "^26.0.0",
"pretty-format": "^26.0.0"
}
},
"node_modules/@types/json-schema": {
"version": "7.0.7",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz",
"integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA=="
},
"node_modules/@types/node": {
"version": "14.0.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.24.tgz",
"integrity": "sha512-btt/oNOiDWcSuI721MdL8VQGnjsKjlTMdrKyTcLCKeQp/n4AAMFJ961wMbp+09y8WuGPClDEv07RIItdXKIXAA==",
"version": "14.14.37",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz",
"integrity": "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==",
"dev": true
},
"node_modules/@types/normalize-package-data": {
@ -1557,11 +1550,6 @@
"node": ">= 8"
}
},
"node_modules/arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
},
"node_modules/argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@ -1829,7 +1817,8 @@
"node_modules/balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"node_modules/base": {
"version": "0.11.2",
@ -1912,6 +1901,7 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -1947,7 +1937,8 @@
"node_modules/buffer-from": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
"dev": true
},
"node_modules/cache-base": {
"version": "1.0.1",
@ -2161,7 +2152,8 @@
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"node_modules/convert-source-map": {
"version": "1.7.0",
@ -2187,11 +2179,6 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true
},
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
},
"node_modules/cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@ -2378,14 +2365,6 @@
"node": ">=8"
}
},
"node_modules/diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"engines": {
"node": ">=0.3.1"
}
},
"node_modules/diff-sequences": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz",
@ -2926,7 +2905,8 @@
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"node_modules/fsevents": {
"version": "2.3.1",
@ -3007,6 +2987,7 @@
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@ -3235,6 +3216,7 @@
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
@ -3243,7 +3225,8 @@
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
"node_modules/ip-regex": {
"version": "2.1.0",
@ -6340,14 +6323,6 @@
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
},
"node_modules/json-stable-stringify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
"integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
"dependencies": {
"jsonify": "~0.0.0"
}
},
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@ -6378,19 +6353,6 @@
"universalify": "^2.0.0"
}
},
"node_modules/jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
"integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM="
},
"node_modules/jsonschema": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz",
"integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==",
"engines": {
"node": "*"
}
},
"node_modules/jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@ -6505,11 +6467,6 @@
"semver": "bin/semver.js"
}
},
"node_modules/make-error": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
},
"node_modules/makeerror": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
@ -6593,6 +6550,7 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -6859,6 +6817,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"dependencies": {
"wrappy": "1"
}
@ -6965,6 +6924,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
@ -7942,6 +7902,7 @@
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
@ -7963,6 +7924,7 @@
"version": "0.5.19",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
"dev": true,
"dependencies": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
@ -8328,28 +8290,6 @@
"node": ">=8"
}
},
"node_modules/ts-node": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz",
"integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==",
"dependencies": {
"arg": "^4.1.0",
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.17",
"yn": "3.1.1"
},
"bin": {
"ts-node": "dist/bin.js",
"ts-node-script": "dist/bin-script.js",
"ts-node-transpile-only": "dist/bin-transpile.js",
"ts-script": "dist/bin-script-deprecated.js"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -8407,34 +8347,6 @@
"is-typedarray": "^1.0.0"
}
},
"node_modules/typescript": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz",
"integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/typescript-json-schema": {
"version": "0.49.0",
"resolved": "https://registry.npmjs.org/typescript-json-schema/-/typescript-json-schema-0.49.0.tgz",
"integrity": "sha512-PumZkTmEE3T8TVyoJU6ZCp3K6VCmCb3Ei6fUaRIuDsIzYtmdJc6jV1D0RyBe5sd5mJ1iB6Zckm4KAKbqXs9oDw==",
"dependencies": {
"@types/json-schema": "^7.0.6",
"glob": "^7.1.6",
"json-stable-stringify": "^1.0.1",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"yargs": "^16.2.0"
},
"bin": {
"typescript-json-schema": "bin/typescript-json-schema"
}
},
"node_modules/union-value": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
@ -8707,7 +8619,8 @@
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"node_modules/write-file-atomic": {
"version": "3.0.3",
@ -8749,9 +8662,9 @@
"dev": true
},
"node_modules/y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==",
"dev": true
},
"node_modules/yallist": {
@ -8887,14 +8800,6 @@
"engines": {
"node": ">=10"
}
},
"node_modules/yn": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
"engines": {
"node": ">=6"
}
}
},
"dependencies": {
@ -10110,24 +10015,19 @@
}
},
"@types/jest": {
"version": "26.0.20",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.20.tgz",
"integrity": "sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA==",
"version": "26.0.22",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.22.tgz",
"integrity": "sha512-eeWwWjlqxvBxc4oQdkueW5OF/gtfSceKk4OnOAGlUSwS/liBRtZppbJuz1YkgbrbfGOoeBHun9fOvXnjNwrSOw==",
"dev": true,
"requires": {
"jest-diff": "^26.0.0",
"pretty-format": "^26.0.0"
}
},
"@types/json-schema": {
"version": "7.0.7",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz",
"integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA=="
},
"@types/node": {
"version": "14.0.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.24.tgz",
"integrity": "sha512-btt/oNOiDWcSuI721MdL8VQGnjsKjlTMdrKyTcLCKeQp/n4AAMFJ961wMbp+09y8WuGPClDEv07RIItdXKIXAA==",
"version": "14.14.37",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz",
"integrity": "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==",
"dev": true
},
"@types/normalize-package-data": {
@ -10245,11 +10145,6 @@
"picomatch": "^2.0.4"
}
},
"arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
},
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@ -10465,7 +10360,8 @@
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"base": {
"version": "0.11.2",
@ -10535,6 +10431,7 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -10567,7 +10464,8 @@
"buffer-from": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
"dev": true
},
"cache-base": {
"version": "1.0.1",
@ -10745,7 +10643,8 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"convert-source-map": {
"version": "1.7.0",
@ -10768,11 +10667,6 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true
},
"create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@ -10921,11 +10815,6 @@
"integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==",
"dev": true
},
"diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
},
"diff-sequences": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz",
@ -11360,7 +11249,8 @@
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"fsevents": {
"version": "2.3.1",
@ -11420,6 +11310,7 @@
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@ -11597,6 +11488,7 @@
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
@ -11605,7 +11497,8 @@
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
"ip-regex": {
"version": "2.1.0",
@ -14146,14 +14039,6 @@
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
},
"json-stable-stringify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
"integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
"requires": {
"jsonify": "~0.0.0"
}
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@ -14178,16 +14063,6 @@
"universalify": "^2.0.0"
}
},
"jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
"integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM="
},
"jsonschema": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz",
"integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw=="
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@ -14280,11 +14155,6 @@
}
}
},
"make-error": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
},
"makeerror": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
@ -14350,6 +14220,7 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -14565,6 +14436,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
@ -14646,7 +14518,8 @@
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"path-key": {
"version": "2.0.1",
@ -15444,7 +15317,8 @@
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"source-map-resolve": {
"version": "0.5.3",
@ -15463,6 +15337,7 @@
"version": "0.5.19",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
@ -15761,19 +15636,6 @@
"punycode": "^2.1.1"
}
},
"ts-node": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz",
"integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==",
"requires": {
"arg": "^4.1.0",
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.17",
"yn": "3.1.1"
}
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -15819,24 +15681,6 @@
"is-typedarray": "^1.0.0"
}
},
"typescript": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz",
"integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA=="
},
"typescript-json-schema": {
"version": "0.49.0",
"resolved": "https://registry.npmjs.org/typescript-json-schema/-/typescript-json-schema-0.49.0.tgz",
"integrity": "sha512-PumZkTmEE3T8TVyoJU6ZCp3K6VCmCb3Ei6fUaRIuDsIzYtmdJc6jV1D0RyBe5sd5mJ1iB6Zckm4KAKbqXs9oDw==",
"requires": {
"@types/json-schema": "^7.0.6",
"glob": "^7.1.6",
"json-stable-stringify": "^1.0.1",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"yargs": "^16.2.0"
}
},
"union-value": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
@ -16064,7 +15908,8 @@
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"write-file-atomic": {
"version": "3.0.3",
@ -16103,9 +15948,9 @@
"dev": true
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==",
"dev": true
},
"yallist": {
@ -16213,11 +16058,6 @@
"integrity": "sha512-jYRGS3zWy20NtDtK2kBgo/TlAoy5YUuhD9/LZ7z7W4j1Fdw2cqD0xEEclf8fxc8xjD6X5Qr+qQQwCEsP8iRiYg=="
}
}
},
"yn": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
}
}
}

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "lsif-util",
"version": "0.2.15",
"version": "0.2.16",
"description": "Utility tools for LSIF development.",
"main": "./lib/main.js",
"repository": {
@ -30,17 +30,15 @@
"preferGlobal": true,
"devDependencies": {
"@types/fs-extra": "^9.0.7",
"@types/jest": "^26.0.20",
"@types/jest": "^26.0.22",
"jest": "^26.6.3",
"jest-junit": "^12.0.0",
"rimraf": "^3.0.2"
},
"dependencies": {
"fs-extra": "^9.1.0",
"jsonschema": "^1.4.0",
"lsif-protocol": "0.5.2",
"readline": "^1.3.0",
"typescript-json-schema": "^0.49.0",
"yargs": "^16.2.0"
},
"jest": {

Просмотреть файл

@ -7,7 +7,6 @@ import * as LSIF from 'lsif-protocol';
import * as readline from 'readline';
import * as yargs from 'yargs';
import { getFilteredIds, IFilter } from './filter';
import { validate } from './validate';
import { visualize } from './visualize';
function readInput(format: string, inputPath: string, callback: (input: LSIF.Element[]) => void): void {
@ -69,20 +68,9 @@ export function main(): void {
describe: 'Path to input file or --stdin',
type: 'string',
},
}, (argv: yargs.Arguments) => {
if (!argv.stdin && argv.file === undefined) {
yargs.showHelp('log');
console.error('\nError: Missing input file. Did you forget --stdin?');
process.exitCode = 1;
} else {
readInput(
argv.inputFormat as string,
argv.stdin ? '--stdin' : argv.file as string,
(input: LSIF.Element[]) => {
const filter: IFilter = argv as unknown as IFilter;
process.exitCode = validate(input, getFilteredIds(filter, input));
});
}
}, () => {
console.error(`The validate command got removed. Please use lsif validate instead.`);
process.exitCode = -1;
})
// Visualization tool

Просмотреть файл

@ -1,338 +0,0 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import * as fse from 'fs-extra';
import { validate as validateSchema, ValidationError, ValidatorResult } from 'jsonschema';
import * as LSIF from 'lsif-protocol';
import * as path from 'path';
import * as TJS from 'typescript-json-schema';
import { getInVs } from './shared';
const vertices: { [id: string]: Element } = {};
const edges: { [id: string]: Element } = {};
const visited: { [id: string]: boolean } = {};
const protocolSubPath: string = 'lsif-protocol/lib/protocol.d.ts';
const errors: Error[] = [];
enum Check {
vertexBeforeEdge = 0,
allVerticesUsed,
}
const checks: boolean[] = [true, true];
class Error {
public element: LSIF.Element;
public message: string;
constructor(element: LSIF.Element, message: string) {
this.element = element;
this.message = message;
}
public print(): void {
console.error(
`\n${this.element.type.toUpperCase()} ${this.element.id}: ` +
`FAIL> ${this.message}\n${JSON.stringify(this.element, undefined, 2)}`,
);
}
}
class Element {
public element: LSIF.Element;
public valid: boolean;
constructor(element: LSIF.Element) {
this.element = element;
this.valid = true;
}
public invalidate(): void {
this.valid = false;
}
}
class Statistics {
public passed: number;
public failed: number;
public total: number;
constructor(passed: number, failed: number) {
this.passed = passed;
this.failed = failed;
this.total = passed + failed;
}
}
export function validate(toolOutput: LSIF.Element[], ids: string[]): number {
const nodeModulesPath: string | null = findNodeModulesPath();
if (nodeModulesPath !== null) {
readInput(toolOutput);
checkAllVisited();
checkVertices(toolOutput.filter((e: LSIF.Element) => e.type === 'vertex')
.map((e: LSIF.Element) => e.id.toString()),
nodeModulesPath);
checkEdges( toolOutput.filter((e: LSIF.Element) => e.type === 'edge')
.map((e: LSIF.Element) => e.id.toString()),
nodeModulesPath);
} else {
console.error(`Error: protocol.d.ts was not found`);
return 1;
}
printOutput(ids);
return errors.length === 0 ? 0 : 1;
}
// Returns null if protocol.d.ts is not found
function findNodeModulesPath(): string | null {
let nodeModulesPath: string = path.join(__dirname, '../node_modules');
// Package installed globally
if (fse.pathExistsSync(path.join(nodeModulesPath, protocolSubPath))) {
return nodeModulesPath;
}
// Package installed locally
nodeModulesPath = path.join(__dirname, '../..');
return fse.pathExistsSync(path.join(nodeModulesPath, protocolSubPath)) ? nodeModulesPath : null;
}
function readInput(toolOutput: LSIF.Element[]): void {
const outputMessage: string = 'Reading input...';
process.stdout.write(`${outputMessage}\r`);
for (const object of toolOutput) {
if (object.type === LSIF.ElementTypes.edge) {
const edge: LSIF.Edge = object as LSIF.Edge;
const id: string = edge.id.toString();
edges[id] = new Element(edge);
if (edge.outV === undefined) {
errors.push(new Error(edge, `requires property "outV"`));
edges[id].invalidate();
}
if (!LSIF.Edge.is11(edge) && !LSIF.Edge.is1N(edge)) {
errors.push(new Error(edge, `requires property "inV" or "inVs"`));
edges[id].invalidate();
} else {
checkVertexBeforeEdge(edge);
}
} else if (object.type === 'vertex') {
vertices[object.id.toString()] = new Element(object);
} else {
errors.push(new Error(object, `unknown element type`));
}
}
console.log(`${outputMessage} done`);
}
function checkVertexBeforeEdge(edge: LSIF.Edge): void {
const inVs = getInVs(edge);
const outV = edge.outV.toString();
if (vertices[outV] === undefined ||
// The following will be true if any id in the inV array is not yet defined in the vertices dictionary
inVs.map((inV) => vertices[inV] === undefined).reduce((total, curr) => total || curr, false)) {
errors.push(new Error(edge, `was emitted before a vertex it refers to`));
edges[edge.id.toString()].invalidate();
checks[Check.vertexBeforeEdge] = false;
}
inVs.forEach((inV) => {
visited[inV] = true;
});
visited[outV] = true;
}
function checkAllVisited(): void {
Object.keys(vertices).forEach((key: string) => {
const vertex: LSIF.Vertex = vertices[key].element as LSIF.Vertex;
if (!visited[key] && vertex.label !== 'metaData' && vertex.label !== '$event') {
errors.push(new Error(vertex, `not connected to any other vertex`));
checks[Check.allVerticesUsed] = false;
vertices[key].invalidate();
}
});
}
function checkVertices(ids: string[], nodeModulesPath: string): void {
const compilerOptions: TJS.CompilerOptions = {
baseUrl: nodeModulesPath,
};
const program: TJS.Program = TJS.getProgramFromFiles([path.join(nodeModulesPath, protocolSubPath)], compilerOptions);
const schema: { [label: string]: TJS.Definition } = {};
let outputMessage: string | undefined;
let count: number = 1;
const length: number = ids.length;
ids.forEach((key: string) => {
const vertex: LSIF.Vertex = vertices[key].element as LSIF.Vertex;
outputMessage = `Verifying vertex ${count} of ${length}...`;
process.stdout.write(`${outputMessage}\r`);
count++;
if (vertex.label === undefined) {
vertices[key].invalidate();
errors.push(new Error(vertex, `requires property "label"`));
} else if (!Object.values(LSIF.VertexLabels).includes(vertex.label)) {
vertices[key].invalidate();
errors.push(new Error(vertex, `unknown label`));
} else {
try {
let className: string = '';
if (vertex.label === LSIF.VertexLabels.event) {
if (vertex.scope === undefined) {
vertices[key].invalidate();
errors.push(new Error(vertex, `requires property "scope"`));
} else if (!Object.values(LSIF.EventScope).includes(vertex.scope)) {
vertices[key].invalidate();
errors.push(new Error(vertex, `unknown scope`));
} else {
className = vertex.scope[0].toUpperCase() + vertex.scope.slice(1) + 'Event';
}
} else {
className = vertex.label[0].toUpperCase() + vertex.label.slice(1);
}
if (className === '') {
return;
}
if (schema[className] === undefined) {
const specificSchema: TJS.Definition | null = TJS.generateSchema(program, className, { required: true });
if (specificSchema) {
schema[className] = specificSchema;
} else {
throw new SyntaxError(`did not find class ${className}`);
}
}
const validation: ValidatorResult | null = validateSchema(vertex, schema[className]);
if (!validation.valid) {
vertices[key].invalidate();
errors.push(new Error(vertex, validation.errors.join('; ')));
}
} catch (ex) {
vertices[key].invalidate();
errors.push(new Error(vertex, `unable to validate: ${ex.message}`));
}
}
});
if (outputMessage !== undefined) {
console.log(`${outputMessage} done`);
}
}
function checkEdges(ids: string[], nodeModulesPath: string): void {
let outputMessage: string | undefined;
const compilerOptions: TJS.CompilerOptions = {
baseUrl: nodeModulesPath,
};
const program: TJS.Program = TJS.getProgramFromFiles([path.join(nodeModulesPath, protocolSubPath)], compilerOptions);
let count: number = 1;
const length: number = ids.length;
const e11Schema = TJS.generateSchema(program, 'E11', { required: true, noExtraProps: true });
const e1NSchema = TJS.generateSchema(program, 'E1N', { required: true, noExtraProps: true });
const itemSchema = TJS.generateSchema(program, 'ItemEdge', { required: true, noExtraProps: true });
ids.forEach((key: string) => {
const edge: LSIF.Edge = edges[key].element as LSIF.Edge;
outputMessage = `Verifying edge ${count} of ${length}...`;
process.stdout.write(`${outputMessage}\r`);
count++;
if ((!LSIF.Edge.is11(edge) && !(LSIF.Edge.is1N(edge))) || edge.outV === undefined) {
// This error was caught before
return;
}
if (edge.label === undefined || !Object.values(LSIF.EdgeLabels).includes(edge.label)) {
errors.push(new Error(edges[key].element, edge.label ? `requires property "label"` : `unknown label`));
edges[key].invalidate();
return;
}
let validation: ValidatorResult;
switch (edge.label) {
case LSIF.EdgeLabels.item:
validation = validateSchema(edge, itemSchema);
break;
case LSIF.EdgeLabels.contains:
validation = validateSchema(edge, e1NSchema);
break;
default:
validation = validateSchema(edge, e11Schema);
}
const validationErrors: ValidationError[] = validation.errors.filter((error) => error.property === 'instance');
if (validationErrors.length > 0) {
edges[key].invalidate();
errors.push(new Error(edges[key].element, validationErrors.join('; ')));
}
});
if (outputMessage !== undefined) {
console.log(`${outputMessage} done`);
}
}
function getCheckMessage(check: Check): string {
switch (check) {
case Check.vertexBeforeEdge:
return 'vertices emitted before connecting edges';
case Check.allVerticesUsed:
return 'all vertices are used in at least one edge';
default:
return 'unexpected check';
}
}
function printOutput(ids: string[]): void {
console.log('\nResults:');
for (let i: number = 0; i < checks.length; i++) {
console.log(`\t${checks[i] ? 'PASS' : 'FAIL'}> ${getCheckMessage(i)}`);
}
console.log();
const verticesStats: Statistics = getStatistics(vertices, ids);
console.log(`Vertices:\t${verticesStats.passed} passed, ` +
`${verticesStats.failed} failed, ${verticesStats.total} total`);
const edgesStats: Statistics = getStatistics(edges, ids);
console.log(`Edges:\t\t${edgesStats.passed} passed, ` +
`${edgesStats.failed} failed, ${edgesStats.total} total`);
errors.forEach((e: Error) => {
// Only print error for the elements verified
if (ids.includes(e.element.id.toString())) {
e.print();
}
});
}
function getStatistics(elements: { [id: string]: Element }, ids: string[]): Statistics {
let passed: number = 0;
let failed: number = 0;
Object.keys(elements).forEach((key: string) => {
if (ids.includes(key)) {
const element: Element = elements[key];
if (element.valid) {
passed++;
} else {
failed++;
}
}
});
return new Statistics(passed, failed);
}