@ellipticltd/aml-utils 0.15.9 → 0.15.10-SCR-1297-2
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/README.md +9 -43
- package/{dist → lib}/file-parser/errors.js +1 -1
- package/lib/file-parser/errors.js.map +1 -0
- package/{dist → lib}/file-parser/file-parser.d.ts +1 -3
- package/{dist → lib}/file-parser/file-parser.js +10 -18
- package/lib/file-parser/file-parser.js.map +1 -0
- package/{dist/structured-file-parser → lib/file-parser}/parse-row.js +2 -1
- package/lib/file-parser/parse-row.js.map +1 -0
- package/{dist/file-parser/sanitzeRows.d.ts → lib/file-parser/sanitizeRows.d.ts} +3 -1
- package/lib/file-parser/sanitizeRows.js +15 -0
- package/lib/file-parser/sanitizeRows.js.map +1 -0
- package/{dist → lib}/index.d.ts +1 -1
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/{dist → lib}/structured-file-parser/errors.js +1 -0
- package/lib/structured-file-parser/errors.js.map +1 -0
- package/{dist/file-parser → lib/structured-file-parser}/parse-row.js +2 -1
- package/lib/structured-file-parser/parse-row.js.map +1 -0
- package/{dist → lib}/structured-file-parser/sanitize-rows.js +3 -4
- package/lib/structured-file-parser/sanitize-rows.js.map +1 -0
- package/{dist → lib}/structured-file-parser/structured-file-parser.js +16 -28
- package/lib/structured-file-parser/structured-file-parser.js.map +1 -0
- package/package.json +10 -61
- package/.circleci/config.yml +0 -87
- package/.eslintrc +0 -44
- package/.huskyrc +0 -5
- package/.mocharc.json +0 -3
- package/.nvmrc +0 -1
- package/.nyc_output/6b68ea83-db7a-45cb-b572-16338a5cea4b.json +0 -1
- package/.nyc_output/a74c6648-3619-4b08-bc8c-ac8cb4959f43.json +0 -1
- package/.nyc_output/c9b6c4ce-fddf-403b-aa2e-aac05145213c.json +0 -1
- package/.nyc_output/d9967655-96b8-471a-9686-a4585437f85a.json +0 -1
- package/.nyc_output/processinfo/6b68ea83-db7a-45cb-b572-16338a5cea4b.json +0 -1
- package/.nyc_output/processinfo/a74c6648-3619-4b08-bc8c-ac8cb4959f43.json +0 -1
- package/.nyc_output/processinfo/c9b6c4ce-fddf-403b-aa2e-aac05145213c.json +0 -1
- package/.nyc_output/processinfo/d9967655-96b8-471a-9686-a4585437f85a.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.nycrc.json +0 -11
- package/.releaserc.json +0 -18
- package/.snyk +0 -12
- package/codecov.yml +0 -29
- package/commitlint.config.js +0 -1
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -79
- package/coverage/errors/errors.js.html +0 -228
- package/coverage/errors/errors.spec.js.html +0 -180
- package/coverage/errors/index.html +0 -110
- package/coverage/file-parser/__tests/file-parser.spec.js.html +0 -390
- package/coverage/file-parser/__tests/index.html +0 -123
- package/coverage/file-parser/__tests/parse-row.spec.js.html +0 -174
- package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +0 -333
- package/coverage/formatting/formatting.js.html +0 -123
- package/coverage/formatting/formatting.spec.js.html +0 -204
- package/coverage/formatting/index.html +0 -110
- package/coverage/index.html +0 -175
- package/coverage/middleware/index.html +0 -97
- package/coverage/middleware/middleware.js.html +0 -144
- package/coverage/orm-helpers/index.html +0 -110
- package/coverage/orm-helpers/ormHelpers.js.html +0 -123
- package/coverage/orm-helpers/ormHelpers.spec.js.html +0 -192
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -170
- package/coverage/types/index.html +0 -97
- package/coverage/types/types.js.html +0 -708
- package/coverage/validations/index.html +0 -110
- package/coverage/validations/validations.js.html +0 -1419
- package/coverage/validations/validations.spec.js.html +0 -1800
- package/dist/errors/errors.d.ts +0 -9
- package/dist/errors/errors.js +0 -42
- package/dist/errors/errors.spec.d.ts +0 -1
- package/dist/errors/errors.spec.js +0 -23
- package/dist/file-parser/__tests/file-parser.spec.d.ts +0 -1
- package/dist/file-parser/__tests/file-parser.spec.js +0 -118
- package/dist/file-parser/__tests/parse-row.spec.d.ts +0 -1
- package/dist/file-parser/__tests/parse-row.spec.js +0 -29
- package/dist/file-parser/__tests/sanitize-rows.spec.d.ts +0 -1
- package/dist/file-parser/__tests/sanitize-rows.spec.js +0 -78
- package/dist/file-parser/sanitzeRows.js +0 -18
- package/dist/formatting/formatting.d.ts +0 -2
- package/dist/formatting/formatting.js +0 -17
- package/dist/formatting/formatting.spec.d.ts +0 -1
- package/dist/formatting/formatting.spec.js +0 -37
- package/dist/index.js +0 -22
- package/dist/middleware/middleware.d.ts +0 -4
- package/dist/middleware/middleware.js +0 -22
- package/dist/orm-helpers/ormHelpers.d.ts +0 -1
- package/dist/orm-helpers/ormHelpers.js +0 -17
- package/dist/orm-helpers/ormHelpers.spec.d.ts +0 -1
- package/dist/orm-helpers/ormHelpers.spec.js +0 -38
- package/dist/types/types.d.ts +0 -17
- package/dist/types/types.js +0 -203
- package/dist/validations/validations.d.ts +0 -232
- package/dist/validations/validations.js +0 -459
- package/dist/validations/validations.spec.d.ts +0 -1
- package/dist/validations/validations.spec.js +0 -463
- package/lib/errors/errors.js +0 -53
- package/lib/errors/errors.spec.js +0 -37
- package/lib/file-parser/__tests/file-parser.spec.js +0 -107
- package/lib/file-parser/__tests/parse-row.spec.js +0 -35
- package/lib/file-parser/__tests/sanitize-rows.spec.js +0 -88
- package/lib/file-parser/errors.ts +0 -7
- package/lib/file-parser/file-parser.ts +0 -84
- package/lib/file-parser/parse-row.ts +0 -52
- package/lib/file-parser/sanitzeRows.ts +0 -32
- package/lib/formatting/formatting.js +0 -18
- package/lib/formatting/formatting.spec.js +0 -45
- package/lib/index.ts +0 -19
- package/lib/middleware/middleware.js +0 -25
- package/lib/orm-helpers/ormHelpers.js +0 -18
- package/lib/orm-helpers/ormHelpers.spec.js +0 -41
- package/lib/structured-file-parser/errors.ts +0 -25
- package/lib/structured-file-parser/parse-row.ts +0 -52
- package/lib/structured-file-parser/sanitize-rows.ts +0 -24
- package/lib/structured-file-parser/structured-file-parser.ts +0 -155
- package/lib/types/types.js +0 -213
- package/lib/validations/validations.js +0 -466
- package/lib/validations/validations.spec.js +0 -603
- package/tsconfig.json +0 -26
- /package/{dist → lib}/file-parser/errors.d.ts +0 -0
- /package/{dist → lib}/file-parser/parse-row.d.ts +0 -0
- /package/{dist → lib}/structured-file-parser/errors.d.ts +0 -0
- /package/{dist → lib}/structured-file-parser/parse-row.d.ts +0 -0
- /package/{dist → lib}/structured-file-parser/sanitize-rows.d.ts +0 -0
- /package/{dist → lib}/structured-file-parser/structured-file-parser.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,51 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# aml-utils
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This lib contains some utility functions which originally lived in aml-utils repo.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- Formatting functions (sql escaping)
|
|
7
|
-
- Validator functions, also used by swagger node middleware. E.g. Bitcoin and Ethereum addresses validators
|
|
8
|
-
- Express middlewares to validate params types
|
|
9
|
-
- An async CSV file parser
|
|
5
|
+
## Running unit tests
|
|
10
6
|
|
|
7
|
+
Run `npx nx test aml-utils` to execute the unit tests via [Jest](https://jestjs.io).
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
-------
|
|
9
|
+
## Running lint
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
Run `npx nx lint aml-utils` to execute the lint via [ESLint](https://eslint.org/).
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
-----------
|
|
13
|
+
## Building and publishing
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
Run `npx nx build aml-utils` to build the package, then run `npx nx publish aml-utils` to publish the package
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
`npm run build:dev`:
|
|
25
|
-
- starts webpack on watch mode, recompiling any changes made to the code
|
|
26
|
-
|
|
27
|
-
To test your changes locally go to the repo you are working on's package.json and replace:
|
|
28
|
-
```
|
|
29
|
-
@ellipticltd/aml-utils: "*.*.*"
|
|
30
|
-
```
|
|
31
|
-
with
|
|
32
|
-
```
|
|
33
|
-
@ellipticltd/aml-utils: "file:../aml-utils"
|
|
34
|
-
```
|
|
35
|
-
(if you repositories are in the same directory).
|
|
36
|
-
|
|
37
|
-
Commiting
|
|
38
|
-
-----------
|
|
39
|
-
|
|
40
|
-
**N.B. The semantic release process described below currently does not work, meaning this package has to be deployed manually using npm publish.**
|
|
41
|
-
|
|
42
|
-
**If a permissions error is encountered when authenticating with an npm token, remove .npmrc and authenticate using npm login.**
|
|
43
|
-
|
|
44
|
-
This repository uses [Semantic release](https://semantic-release.gitbook.io/) for version publishing. To create a new version of the package simply push to bitbucket and CircleCI will create a new version. No change to this repo's package.json is required.
|
|
45
|
-
|
|
46
|
-
To work out what the next version of package should be a git commit linter is used. This is enforced by Husky and only commits with the following syntax can be [used](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-angular).
|
|
47
|
-
|
|
48
|
-
Setting up Semantic release
|
|
49
|
-
-----------
|
|
50
|
-
|
|
51
|
-
This [article](https://circleci.com/docs/2.0/gh-bb-integration/#creating-a-bitbucket-user-key) explains the integration between Bitbucket and CirlceCI. An NPM token also needs to be provided for the write access to the npm package
|
|
17
|
+
You can also publish temp version of the package to npm with a tag by running `npx nx publish aml-utils -- --tag "your-tag-name"`
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TooManyRowsError = void 0;
|
|
4
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
5
4
|
class TooManyRowsError extends Error {
|
|
6
5
|
constructor() {
|
|
7
6
|
super('More than configured number of rows imported');
|
|
@@ -9,3 +8,4 @@ class TooManyRowsError extends Error {
|
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
exports.TooManyRowsError = TooManyRowsError;
|
|
11
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/file-parser/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAiB,SAAQ,KAAK;IACzC;QACE,KAAK,CAAC,8CAA8C,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC"}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const parse_row_1 = tslib_1.__importDefault(require("./parse-row"));
|
|
16
5
|
const errors_1 = require("./errors");
|
|
17
|
-
const
|
|
6
|
+
const sanitizeRows_1 = tslib_1.__importDefault(require("./sanitizeRows"));
|
|
18
7
|
function chunk(array, size) {
|
|
19
8
|
if (!array.length) {
|
|
20
9
|
return [];
|
|
@@ -24,7 +13,7 @@ function chunk(array, size) {
|
|
|
24
13
|
return [head, ...chunk(tail, size)];
|
|
25
14
|
}
|
|
26
15
|
function processChunk(parsedRows, dependencies) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
17
|
const { processRow } = dependencies;
|
|
29
18
|
return new Promise((resolve, reject) => {
|
|
30
19
|
setTimeout(() => {
|
|
@@ -33,21 +22,23 @@ function processChunk(parsedRows, dependencies) {
|
|
|
33
22
|
resolve(processedRows);
|
|
34
23
|
}
|
|
35
24
|
catch (ex) {
|
|
36
|
-
|
|
25
|
+
if (ex instanceof Error) {
|
|
26
|
+
reject(ex);
|
|
27
|
+
}
|
|
37
28
|
}
|
|
38
29
|
}, 0);
|
|
39
30
|
});
|
|
40
31
|
});
|
|
41
32
|
}
|
|
42
33
|
function parseFile(fileContent, maxRows, dependencies) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
35
|
const { processRow } = dependencies;
|
|
45
36
|
if (fileContent === 'invalidFileType') {
|
|
46
37
|
throw Error('Invalid file type');
|
|
47
38
|
}
|
|
48
39
|
const rows = fileContent.split('\n');
|
|
49
40
|
const parsedRows = rows.map(parse_row_1.default);
|
|
50
|
-
const sanitizedRows =
|
|
41
|
+
const sanitizedRows = (0, sanitizeRows_1.default)(parsedRows, processRow);
|
|
51
42
|
if (sanitizedRows.length > maxRows) {
|
|
52
43
|
throw new errors_1.TooManyRowsError();
|
|
53
44
|
}
|
|
@@ -66,3 +57,4 @@ function parseFile(fileContent, maxRows, dependencies) {
|
|
|
66
57
|
});
|
|
67
58
|
}
|
|
68
59
|
exports.default = parseFile;
|
|
60
|
+
//# sourceMappingURL=file-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-parser.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/file-parser/file-parser.ts"],"names":[],"mappings":";;;AAAA,oEAAmC;AACnC,qCAA4C;AAC5C,0EAA+D;AAM/D,SAAS,KAAK,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CAAC,CAAC;QAE3D,IAAI,aAAa,CAAC,MAAM,GAAG,OAAO,EAAE;YAClC,MAAM,IAAI,yBAAgB,EAAE,CAAC;SAC9B;QAED,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;SAC5B;QAED,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QACjD,IAAI,OAAO,GAAQ,EAAE,CAAC;QACtB,gDAAgD;QAChD,KAAK,MAAM,eAAe,IAAI,eAAe,EAAE;YAC7C,4CAA4C;YAC5C,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;YACtE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;SACvC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAED,kBAAe,SAAS,CAAC"}
|
|
@@ -32,8 +32,9 @@ const parseRow = (row) => {
|
|
|
32
32
|
}
|
|
33
33
|
return line;
|
|
34
34
|
};
|
|
35
|
-
const splitRow = fp_1.pipe(trySplitByTab, trySplitByComa, trySplitByMultipleSpaces, trySplitBySpace, trySplitByNothing);
|
|
35
|
+
const splitRow = (0, fp_1.pipe)(trySplitByTab, trySplitByComa, trySplitByMultipleSpaces, trySplitBySpace, trySplitByNothing);
|
|
36
36
|
const cells = splitRow(row);
|
|
37
37
|
return cells.map((c) => c.trim());
|
|
38
38
|
};
|
|
39
39
|
exports.default = parseRow;
|
|
40
|
+
//# sourceMappingURL=parse-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-row.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/file-parser/parse-row.ts"],"names":[],"mappings":";;AAAA,kCAAiC;AAEjC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAY,EAAE;IACzC,MAAM,aAAa,GAAG,CAAC,IAAuB,EAAqB,EAAE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GAAG,CAAC,CAAC;IAE5B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export declare type ProcessingEntry = {
|
|
2
|
+
isValid: boolean;
|
|
3
|
+
};
|
|
2
4
|
declare function sanitizeRows<T extends ProcessingEntry>(parsedRows: string[][], processRow: (row: string[]) => T): string[][];
|
|
3
5
|
export default sanitizeRows;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sensicalRowCheck = (cells) => cells.some((cell) => !!cell);
|
|
4
|
+
function sanitizeRows(parsedRows, processRow) {
|
|
5
|
+
const firstSensicalRowIndex = parsedRows.findIndex(sensicalRowCheck);
|
|
6
|
+
const lastSensicalRowIndex = [...parsedRows].reverse().findIndex(sensicalRowCheck);
|
|
7
|
+
const sanitizedRows = parsedRows.splice(firstSensicalRowIndex, parsedRows.length - firstSensicalRowIndex - lastSensicalRowIndex);
|
|
8
|
+
const firstRow = processRow(sanitizedRows[0]);
|
|
9
|
+
if (firstRow.isValid) {
|
|
10
|
+
return sanitizedRows;
|
|
11
|
+
}
|
|
12
|
+
return sanitizedRows.splice(1);
|
|
13
|
+
}
|
|
14
|
+
exports.default = sanitizeRows;
|
|
15
|
+
//# sourceMappingURL=sanitizeRows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizeRows.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/file-parser/sanitizeRows.ts"],"names":[],"mappings":";;AAIA,MAAM,gBAAgB,GAAG,CAAC,KAAe,EAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAE5F,SAAS,YAAY,CAA4B,UAAsB,EAAE,UAAgC;IACvG,MAAM,qBAAqB,GAAG,UAAU,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAErE,MAAM,oBAAoB,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAEnF,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,qBAAqB,EAAE,UAAU,CAAC,MAAM,GAAG,qBAAqB,GAAG,oBAAoB,CAAC,CAAC;IAEjI,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9C,IAAI,QAAQ,CAAC,OAAO,EAAE;QACpB,OAAO,aAAa,CAAC;KACtB;IACD,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
package/{dist → lib}/index.d.ts
RENAMED
|
@@ -6,4 +6,4 @@ import middleware from './middleware/middleware';
|
|
|
6
6
|
import ormHelpers from './orm-helpers/ormHelpers';
|
|
7
7
|
import fileParser from './file-parser/file-parser';
|
|
8
8
|
import structuredFileParser from './structured-file-parser/structured-file-parser';
|
|
9
|
-
export { types, validations, errors, formatting, fileParser, structuredFileParser, middleware, ormHelpers
|
|
9
|
+
export { types, validations, errors, formatting, fileParser, structuredFileParser, middleware, ormHelpers };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ormHelpers = exports.middleware = exports.structuredFileParser = exports.fileParser = exports.formatting = exports.errors = exports.validations = exports.types = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const types_1 = tslib_1.__importDefault(require("./types/types"));
|
|
6
|
+
exports.types = types_1.default;
|
|
7
|
+
const validations_1 = tslib_1.__importDefault(require("./validations/validations"));
|
|
8
|
+
exports.validations = validations_1.default;
|
|
9
|
+
const errors_1 = tslib_1.__importDefault(require("./errors/errors"));
|
|
10
|
+
exports.errors = errors_1.default;
|
|
11
|
+
const formatting_1 = tslib_1.__importDefault(require("./formatting/formatting"));
|
|
12
|
+
exports.formatting = formatting_1.default;
|
|
13
|
+
const middleware_1 = tslib_1.__importDefault(require("./middleware/middleware"));
|
|
14
|
+
exports.middleware = middleware_1.default;
|
|
15
|
+
const ormHelpers_1 = tslib_1.__importDefault(require("./orm-helpers/ormHelpers"));
|
|
16
|
+
exports.ormHelpers = ormHelpers_1.default;
|
|
17
|
+
const file_parser_1 = tslib_1.__importDefault(require("./file-parser/file-parser"));
|
|
18
|
+
exports.fileParser = file_parser_1.default;
|
|
19
|
+
const structured_file_parser_1 = tslib_1.__importDefault(require("./structured-file-parser/structured-file-parser"));
|
|
20
|
+
exports.structuredFileParser = structured_file_parser_1.default;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/aml-utils/lib/index.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AASzB,gBATF,eAAK,CASE;AARd,oFAAoD;AAQpC,sBART,qBAAW,CAQS;AAP3B,qEAAqC;AAOR,iBAPtB,gBAAM,CAOsB;AANnC,iFAAiD;AAMZ,qBAN9B,oBAAU,CAM8B;AAL/C,iFAAiD;AAKkC,qBAL5E,oBAAU,CAK4E;AAJ7F,kFAAkD;AAI6C,qBAJxF,oBAAU,CAIwF;AAHzG,oFAAmD;AAGF,qBAH1C,qBAAU,CAG0C;AAF3D,qHAAmF;AAEtB,+BAFtD,gCAAoB,CAEsD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/structured-file-parser/errors.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,MAAa,gBAAiB,SAAQ,KAAK;IACzC;QACE,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AACD,MAAa,gBAAiB,SAAQ,KAAK;IACzC;QACE,KAAK,CAAC,8CAA8C,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AACD,MAAa,WAAY,SAAQ,KAAK;IACpC;QACE,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AACD,MAAa,mBAAoB,SAAQ,KAAK;IAC5C;QACE,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC"}
|
|
@@ -32,8 +32,9 @@ const parseRow = (row) => {
|
|
|
32
32
|
}
|
|
33
33
|
return line;
|
|
34
34
|
};
|
|
35
|
-
const splitRow = fp_1.pipe(trySplitByTab, trySplitByComa, trySplitByMultipleSpaces, trySplitBySpace, trySplitByNothing);
|
|
35
|
+
const splitRow = (0, fp_1.pipe)(trySplitByTab, trySplitByComa, trySplitByMultipleSpaces, trySplitBySpace, trySplitByNothing);
|
|
36
36
|
const cells = splitRow(row);
|
|
37
37
|
return cells.map((c) => c.trim());
|
|
38
38
|
};
|
|
39
39
|
exports.default = parseRow;
|
|
40
|
+
//# sourceMappingURL=parse-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-row.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/structured-file-parser/parse-row.ts"],"names":[],"mappings":";;AAAA,kCAAiC;AAEjC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAY,EAAE;IACzC,MAAM,aAAa,GAAG,CAAC,IAAuB,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AAQ,CAAC,GAAG,CAAC,CAAC;IAE5B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const sensicalRowCheck = (cells) =>
|
|
3
|
+
const sensicalRowCheck = (cells) => cells.some((cell) => !!cell);
|
|
4
4
|
function sanitizeRows(parsedRows) {
|
|
5
5
|
const firstSensicalRowIndex = parsedRows.findIndex(sensicalRowCheck);
|
|
6
|
-
const lastSensicalRowIndex = [...parsedRows]
|
|
7
|
-
.reverse()
|
|
8
|
-
.findIndex(sensicalRowCheck);
|
|
6
|
+
const lastSensicalRowIndex = [...parsedRows].reverse().findIndex(sensicalRowCheck);
|
|
9
7
|
if (firstSensicalRowIndex < 0) {
|
|
10
8
|
return [];
|
|
11
9
|
}
|
|
@@ -13,3 +11,4 @@ function sanitizeRows(parsedRows) {
|
|
|
13
11
|
return sanitizedRows;
|
|
14
12
|
}
|
|
15
13
|
exports.default = sanitizeRows;
|
|
14
|
+
//# sourceMappingURL=sanitize-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-rows.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/structured-file-parser/sanitize-rows.ts"],"names":[],"mappings":";;AAAA,MAAM,gBAAgB,GAAG,CAAC,KAAe,EAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAE5F,SAAS,YAAY,CAAC,UAAsB;IAC1C,MAAM,qBAAqB,GAAG,UAAU,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAErE,MAAM,oBAAoB,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAEnF,IAAI,qBAAqB,GAAG,CAAC,EAAE;QAC7B,OAAO,EAAE,CAAC;KACX;IAED,MAAM,aAAa,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,MAAM,CAAC,qBAAqB,EAAE,UAAU,CAAC,MAAM,GAAG,qBAAqB,GAAG,oBAAoB,CAAC,CAAC;IAEtI,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.isHeaderRowValid = exports.hasHeaderRow = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
16
5
|
/* eslint-disable no-await-in-loop */
|
|
17
6
|
/* eslint-disable no-restricted-syntax */
|
|
18
|
-
const parse_row_1 = __importDefault(require("./parse-row"));
|
|
7
|
+
const parse_row_1 = tslib_1.__importDefault(require("./parse-row"));
|
|
19
8
|
const errors_1 = require("./errors");
|
|
20
|
-
const sanitize_rows_1 = __importDefault(require("./sanitize-rows"));
|
|
9
|
+
const sanitize_rows_1 = tslib_1.__importDefault(require("./sanitize-rows"));
|
|
21
10
|
function chunk(array, size) {
|
|
22
11
|
if (!array.length) {
|
|
23
12
|
return [];
|
|
@@ -27,9 +16,8 @@ function chunk(array, size) {
|
|
|
27
16
|
return [head, ...chunk(tail, size)];
|
|
28
17
|
}
|
|
29
18
|
function processChunk(parsedRows, dependencies) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
20
|
const { processRow, headers } = dependencies;
|
|
32
|
-
// @ts-ignore
|
|
33
21
|
return new Promise((resolve, reject) => {
|
|
34
22
|
setTimeout(() => {
|
|
35
23
|
try {
|
|
@@ -37,7 +25,6 @@ function processChunk(parsedRows, dependencies) {
|
|
|
37
25
|
resolve(processedRows);
|
|
38
26
|
}
|
|
39
27
|
catch (ex) {
|
|
40
|
-
// @ts-ignore
|
|
41
28
|
reject(ex);
|
|
42
29
|
}
|
|
43
30
|
}, 0);
|
|
@@ -45,7 +32,7 @@ function processChunk(parsedRows, dependencies) {
|
|
|
45
32
|
});
|
|
46
33
|
}
|
|
47
34
|
// a row is said to contain headers if two valid header names are present
|
|
48
|
-
|
|
35
|
+
const hasHeaderRow = (rows, requiredHeaderNames) => {
|
|
49
36
|
const firstRow = rows[0];
|
|
50
37
|
if (!firstRow) {
|
|
51
38
|
return false;
|
|
@@ -59,39 +46,39 @@ exports.hasHeaderRow = (rows, requiredHeaderNames) => {
|
|
|
59
46
|
.some((value) => requiredHeaderNames.includes(value.toLowerCase()));
|
|
60
47
|
return containsSecondHeader;
|
|
61
48
|
};
|
|
62
|
-
exports.
|
|
49
|
+
exports.hasHeaderRow = hasHeaderRow;
|
|
50
|
+
const isHeaderRowValid = (rows, requiredHeaderNames) => {
|
|
63
51
|
const firstRow = rows[0];
|
|
64
52
|
if (!firstRow) {
|
|
65
53
|
return false;
|
|
66
54
|
}
|
|
67
|
-
return (requiredHeaderNames.every((header) => firstRow.map((value) => value.toLowerCase()).includes(header)) &&
|
|
55
|
+
return (requiredHeaderNames.every((header) => firstRow.map((value) => value.toLowerCase()).includes(header)) &&
|
|
56
|
+
requiredHeaderNames.length === firstRow.length);
|
|
68
57
|
};
|
|
58
|
+
exports.isHeaderRowValid = isHeaderRowValid;
|
|
69
59
|
function parseFile(fileContent, maxRows, requiredHeaderNames, dependencies) {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
71
61
|
if (fileContent === 'invalidFileType') {
|
|
72
62
|
throw new errors_1.InvalidFileError();
|
|
73
63
|
}
|
|
74
64
|
const rows = fileContent.split('\n');
|
|
75
65
|
const parsedRows = rows.map(parse_row_1.default);
|
|
76
|
-
const sanitizedRows = sanitize_rows_1.default(parsedRows);
|
|
66
|
+
const sanitizedRows = (0, sanitize_rows_1.default)(parsedRows);
|
|
77
67
|
if (sanitizedRows.length > maxRows) {
|
|
78
68
|
throw new errors_1.TooManyRowsError();
|
|
79
69
|
}
|
|
80
70
|
if (sanitizedRows.length === 0) {
|
|
81
71
|
throw new errors_1.NoRowsError();
|
|
82
72
|
}
|
|
83
|
-
const containsHeaders = exports.hasHeaderRow(sanitizedRows, requiredHeaderNames);
|
|
84
|
-
if (containsHeaders
|
|
85
|
-
&& !exports.isHeaderRowValid(sanitizedRows, requiredHeaderNames)) {
|
|
73
|
+
const containsHeaders = (0, exports.hasHeaderRow)(sanitizedRows, requiredHeaderNames);
|
|
74
|
+
if (containsHeaders && !(0, exports.isHeaderRowValid)(sanitizedRows, requiredHeaderNames)) {
|
|
86
75
|
throw new errors_1.InvalidHeadersError();
|
|
87
76
|
}
|
|
88
77
|
const firstSanitizedRow = sanitizedRows[0];
|
|
89
78
|
if (!firstSanitizedRow) {
|
|
90
79
|
throw new errors_1.NoRowsError();
|
|
91
80
|
}
|
|
92
|
-
const headers = containsHeaders
|
|
93
|
-
? firstSanitizedRow.map((value) => value.toLowerCase())
|
|
94
|
-
: requiredHeaderNames;
|
|
81
|
+
const headers = containsHeaders ? firstSanitizedRow.map((value) => value.toLowerCase()) : requiredHeaderNames;
|
|
95
82
|
const dataRows = containsHeaders ? sanitizedRows.splice(1) : sanitizedRows;
|
|
96
83
|
if (dataRows.length === 0) {
|
|
97
84
|
throw new errors_1.NoRowsError();
|
|
@@ -106,3 +93,4 @@ function parseFile(fileContent, maxRows, requiredHeaderNames, dependencies) {
|
|
|
106
93
|
});
|
|
107
94
|
}
|
|
108
95
|
exports.default = parseFile;
|
|
96
|
+
//# sourceMappingURL=structured-file-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured-file-parser.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/structured-file-parser/structured-file-parser.ts"],"names":[],"mappings":";;;;AAAA,qCAAqC;AACrC,yCAAyC;AACzC,oEAAmC;AACnC,qCAAgG;AAChG,4EAA2C;AAe3C,SAAS,KAAK,CAAI,KAAU,EAAE,IAAY;IACxC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,SAAe,YAAY,CACzB,UAAsB,EACtB,YAAwC;;QAExC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;QAC7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAyC,EAAE,MAA8B,EAAQ,EAAE;YACrG,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI;oBACF,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,C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,EAAE,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC;QAE9G,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAE3E,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,oBAAW,EAAE,CAAC;SACzB;QAED,MAAM,eAAe,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5C,IAAI,OAAO,GAAQ,EAAE,CAAC;QACtB,KAAK,MAAM,eAAe,IAAI,eAAe,EAAE;YAC7C,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,eAAe,kCACjD,YAAY,KACf,OAAO,IACP,CAAC;YACH,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;SACvC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAED,kBAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,70 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ellipticltd/aml-utils",
|
|
3
|
-
"version": "0.15.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"node": "10.1.0",
|
|
7
|
-
"npm": "6.1.0"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+ssh://git@bitbucket.org/elliptic/aml-utils.git"
|
|
12
|
-
},
|
|
13
|
-
"homepage": "https://bitbucket.org/elliptic/aml-utils#readme",
|
|
14
|
-
"main": "dist/index.js",
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsc",
|
|
17
|
-
"build:dev": "tsc --watch",
|
|
18
|
-
"test:unit": "ts-mocha --reporter spec \"lib/**/*.spec.js\" --watch-extensions js,ts",
|
|
19
|
-
"prepublishOnly": "npm run build",
|
|
20
|
-
"lint": "./node_modules/.bin/eslint --color 'lib/**/*.{js,ts}' 'test/**/*.js' ",
|
|
21
|
-
"test": "nyc npm run test:unit && nyc report --reporter=html",
|
|
22
|
-
"coverage": "nyc npm run test:unit && nyc report --reporter=lcov --reporter=text-lcov | codecov --pipe",
|
|
23
|
-
"prepare": "npm run snyk-protect",
|
|
24
|
-
"snyk-protect": "snyk-protect"
|
|
25
|
-
},
|
|
26
|
-
"author": "Adam Joyce <adam@ellipitc.co>",
|
|
27
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.15.10-SCR-1297-2",
|
|
4
|
+
"main": "./lib/index.js",
|
|
5
|
+
"types": "./lib/index.d.ts",
|
|
28
6
|
"dependencies": {
|
|
29
|
-
"@zilliqa-js/util": "^0.8.8",
|
|
30
|
-
"bitcore-lib": "^8.22.2",
|
|
31
7
|
"create-error": "0.3.1",
|
|
32
|
-
"lodash": "
|
|
33
|
-
"multicoin-address-validator": "^0.5.2",
|
|
34
|
-
"stellar-sdk": "4.0.2",
|
|
8
|
+
"lodash": "4.17.21",
|
|
35
9
|
"type-check": "0.3.2",
|
|
36
10
|
"validator": "10.10.0",
|
|
11
|
+
"bitcore-lib": "8.25.47",
|
|
12
|
+
"multicoin-address-validator": "0.5.12",
|
|
13
|
+
"@zilliqa-js/util": "0.8.8",
|
|
37
14
|
"web3-utils": "1.0.0",
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@commitlint/cli": "^11.0.0",
|
|
42
|
-
"@commitlint/config-angular": "^11.0.0",
|
|
43
|
-
"@commitlint/config-conventional": "^11.0.0",
|
|
44
|
-
"@semantic-release/git": "^9.0.0",
|
|
45
|
-
"@types/chai": "^4.2.14",
|
|
46
|
-
"@types/lodash": "^4.14.164",
|
|
47
|
-
"@types/mocha": "^8.0.3",
|
|
48
|
-
"@typescript-eslint/parser": "^4.6.1",
|
|
49
|
-
"chai": "^4.2.0",
|
|
50
|
-
"codecov": "^3.6.1",
|
|
51
|
-
"eslint": "^6.6.0",
|
|
52
|
-
"eslint-config-airbnb-base": "^14.2.0",
|
|
53
|
-
"eslint-import-resolver-typescript": "^2.3.0",
|
|
54
|
-
"eslint-plugin-coffeescript": "^1.0.0",
|
|
55
|
-
"eslint-plugin-import": "^2.18.2",
|
|
56
|
-
"eslint-plugin-jsx-a11y": "^6.2.3",
|
|
57
|
-
"eslint-plugin-chai-friendly": "^0.4.1",
|
|
58
|
-
"husky": "^4.3.0",
|
|
59
|
-
"mocha": "^8.2.1",
|
|
60
|
-
"mocha-lcov-reporter": "^1.3.0",
|
|
61
|
-
"nyc": "^14.1.1",
|
|
62
|
-
"semantic-release": "^17.2.2",
|
|
63
|
-
"sinon": "^9.2.1",
|
|
64
|
-
"sinon-chai": "^3.5.0",
|
|
65
|
-
"ts-mocha": "^8.0.0",
|
|
66
|
-
"ts-node": "^9.0.0",
|
|
67
|
-
"typescript": "^4.0.5"
|
|
15
|
+
"stellar-sdk": "4.0.2",
|
|
16
|
+
"tslib": "2.5.0"
|
|
68
17
|
},
|
|
69
|
-
"
|
|
18
|
+
"peerDependencies": {}
|
|
70
19
|
}
|
package/.circleci/config.yml
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
version: 2.1
|
|
2
|
-
|
|
3
|
-
executors:
|
|
4
|
-
node-12:
|
|
5
|
-
docker:
|
|
6
|
-
- image: circleci/node:12.16.1
|
|
7
|
-
working_directory: /tmp/workspace
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
install:
|
|
11
|
-
executor: node-12
|
|
12
|
-
steps:
|
|
13
|
-
- checkout
|
|
14
|
-
- restore_cache:
|
|
15
|
-
keys:
|
|
16
|
-
- npm-cache-{{ checksum "package-lock.json" }}
|
|
17
|
-
- run:
|
|
18
|
-
name: install node modules
|
|
19
|
-
command: |
|
|
20
|
-
npm i
|
|
21
|
-
- save_cache:
|
|
22
|
-
key: npm-cache-{{ checksum "package-lock.json" }}
|
|
23
|
-
paths:
|
|
24
|
-
- node_modules
|
|
25
|
-
- persist_to_workspace:
|
|
26
|
-
root: /tmp
|
|
27
|
-
paths:
|
|
28
|
-
- workspace
|
|
29
|
-
|
|
30
|
-
unit_test:
|
|
31
|
-
executor: node-12
|
|
32
|
-
steps:
|
|
33
|
-
- attach_workspace:
|
|
34
|
-
at: /tmp
|
|
35
|
-
- run:
|
|
36
|
-
name: unit_test
|
|
37
|
-
command: npm run coverage
|
|
38
|
-
- store_artifacts:
|
|
39
|
-
path: coverage
|
|
40
|
-
|
|
41
|
-
lint:
|
|
42
|
-
executor: node-12
|
|
43
|
-
steps:
|
|
44
|
-
- attach_workspace:
|
|
45
|
-
at: /tmp
|
|
46
|
-
- run:
|
|
47
|
-
name: lint
|
|
48
|
-
command: npm run lint
|
|
49
|
-
|
|
50
|
-
semantic_release:
|
|
51
|
-
executor: node-12
|
|
52
|
-
steps:
|
|
53
|
-
- checkout
|
|
54
|
-
- attach_workspace:
|
|
55
|
-
at: /tmp
|
|
56
|
-
- add_ssh_keys:
|
|
57
|
-
fingerprints:
|
|
58
|
-
- "14:c6:29:a4:9e:45:36:d2:0e:e9:be:41:35:d7:06:23"
|
|
59
|
-
- run:
|
|
60
|
-
command: npx semantic-release
|
|
61
|
-
|
|
62
|
-
workflows:
|
|
63
|
-
version: 2.1
|
|
64
|
-
build-test-deploy:
|
|
65
|
-
jobs:
|
|
66
|
-
- install:
|
|
67
|
-
context: npm
|
|
68
|
-
|
|
69
|
-
- unit_test:
|
|
70
|
-
context: npm
|
|
71
|
-
requires:
|
|
72
|
-
- install
|
|
73
|
-
|
|
74
|
-
- lint:
|
|
75
|
-
context: npm
|
|
76
|
-
requires:
|
|
77
|
-
- install
|
|
78
|
-
|
|
79
|
-
- semantic_release:
|
|
80
|
-
context: npm
|
|
81
|
-
requires:
|
|
82
|
-
- lint
|
|
83
|
-
- unit_test
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
# VS Code Extension Version: 1.5.1
|
package/.eslintrc
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["airbnb-base"],
|
|
3
|
-
"overrides": [
|
|
4
|
-
{
|
|
5
|
-
"files": [
|
|
6
|
-
"*.ts"
|
|
7
|
-
],
|
|
8
|
-
"parser": "@typescript-eslint/parser",
|
|
9
|
-
"parserOptions": {
|
|
10
|
-
"project": "tsconfig.json"
|
|
11
|
-
},
|
|
12
|
-
"rules": {
|
|
13
|
-
"no-unused-vars": 0
|
|
14
|
-
// annoyingly this must be switched off
|
|
15
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/46
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"files": [
|
|
20
|
-
"*.spec.js"
|
|
21
|
-
],
|
|
22
|
-
"env": {
|
|
23
|
-
"mocha": true
|
|
24
|
-
},
|
|
25
|
-
"rules": {
|
|
26
|
-
"no-unused-expressions": 0,
|
|
27
|
-
"chai-friendly/no-unused-expressions": 2
|
|
28
|
-
},
|
|
29
|
-
"plugins": [
|
|
30
|
-
"chai-friendly"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"rules": {
|
|
35
|
-
"no-underscore-dangle": 0,
|
|
36
|
-
"prefer-object-spread": 0,
|
|
37
|
-
"new-parens": 0
|
|
38
|
-
},
|
|
39
|
-
"settings": {
|
|
40
|
-
"import/resolver": {
|
|
41
|
-
"typescript": {}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
package/.huskyrc
DELETED
package/.mocharc.json
DELETED
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
10.1.0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|