@ellipticltd/aml-utils 0.16.5 → 0.16.7
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 +19 -0
- package/lib/errors/errors.d.ts +9 -0
- package/lib/errors/errors.js +42 -0
- package/lib/errors/errors.js.map +1 -0
- package/lib/file-parser/errors.d.ts +3 -0
- package/lib/file-parser/errors.js +11 -0
- package/lib/file-parser/errors.js.map +1 -0
- package/lib/file-parser/file-parser.d.ts +6 -0
- package/lib/file-parser/file-parser.js +59 -0
- package/lib/file-parser/file-parser.js.map +1 -0
- package/lib/file-parser/parse-row.d.ts +2 -0
- package/lib/file-parser/parse-row.js +40 -0
- package/lib/file-parser/parse-row.js.map +1 -0
- package/lib/file-parser/sanitizeRows.d.ts +5 -0
- package/lib/file-parser/sanitizeRows.js +15 -0
- package/lib/file-parser/sanitizeRows.js.map +1 -0
- package/lib/formatting/formatting.d.ts +2 -0
- package/lib/formatting/formatting.js +17 -0
- package/lib/formatting/formatting.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/middleware/middleware.d.ts +4 -0
- package/lib/middleware/middleware.js +22 -0
- package/lib/middleware/middleware.js.map +1 -0
- package/lib/orm-helpers/ormHelpers.d.ts +1 -0
- package/lib/orm-helpers/ormHelpers.js +17 -0
- package/lib/orm-helpers/ormHelpers.js.map +1 -0
- package/lib/structured-file-parser/errors.d.ts +12 -0
- package/lib/structured-file-parser/errors.js +33 -0
- package/lib/structured-file-parser/errors.js.map +1 -0
- package/lib/structured-file-parser/parse-row.d.ts +2 -0
- package/lib/structured-file-parser/parse-row.js +40 -0
- package/lib/structured-file-parser/parse-row.js.map +1 -0
- package/lib/structured-file-parser/sanitize-rows.d.ts +2 -0
- package/lib/structured-file-parser/sanitize-rows.js +14 -0
- package/lib/structured-file-parser/sanitize-rows.js.map +1 -0
- package/lib/structured-file-parser/structured-file-parser.d.ts +10 -0
- package/lib/structured-file-parser/structured-file-parser.js +95 -0
- package/lib/structured-file-parser/structured-file-parser.js.map +1 -0
- package/lib/types/types.d.ts +11 -0
- package/lib/types/types.js +201 -0
- package/lib/types/types.js.map +1 -0
- package/lib/validations/validations.d.ts +211 -0
- package/lib/validations/validations.js +542 -0
- package/lib/validations/validations.js.map +1 -0
- package/package.json +3 -2
|
@@ -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,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,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;oBACxE,OAAO,CAAC,aAAa,CAAC,CAAC;iBACxB;gBAAC,OAAO,EAAE,EAAE;oBACX,MAAM,CAAC,EAAE,CAAC,CAAC;iBAC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M,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","sourcesContent":["/* eslint-disable no-restricted-syntax */\nimport parseRow from './parse-row';\nimport { InvalidFileError, TooManyRowsError, NoRowsError, InvalidHeadersError } from './errors';\nimport sanitizeRows from './sanitize-rows';\n\nexport type ProcessingEntry = {\n isValid: boolean;\n};\n\ntype Dependencies<T extends ProcessingEntry> = {\n processRow: (cells: string[], headers: string[]) => T;\n};\n\ntype CompleteDependencies<T extends ProcessingEntry, U extends string[]> = {\n processRow: (cells: string[], headers: U) => T;\n headers: U;\n};\n\nfunction chunk<T>(array: T[], size: number): T[][] {\n if (!array.length) {\n return [];\n }\n const head = array.slice(0, size);\n const tail = array.slice(size);\n\n return [head, ...chunk(tail, size)];\n}\n\nasync function processChunk<T extends ProcessingEntry, U extends string[]>(\n parsedRows: string[][],\n dependencies: CompleteDependencies<T, U>\n): Promise<T[]> {\n const { processRow, headers } = dependencies;\n return new Promise((resolve: (value: T[] | undefined) => void, reject: (error: Error) => void): void => {\n setTimeout(() => {\n try {\n const processedRows = parsedRows.map((row) => processRow(row, headers));\n resolve(processedRows);\n } catch (ex) {\n reject(ex);\n }\n }, 0);\n });\n}\n\n// a row is said to contain headers if two valid header names are present\nexport const hasHeaderRow = (rows: string[][], requiredHeaderNames: string[]): boolean => {\n const firstRow = rows[0];\n if (!firstRow) {\n return false;\n }\n const foundIndex = firstRow.findIndex((value) => requiredHeaderNames.includes(value.toLowerCase()));\n if (foundIndex < 0) {\n return false;\n }\n const containsSecondHeader = firstRow\n .filter((_val, i) => i !== foundIndex)\n .some((value) => requiredHeaderNames.includes(value.toLowerCase()));\n return containsSecondHeader;\n};\n\nexport const isHeaderRowValid = (rows: string[][], requiredHeaderNames: string[]): boolean => {\n const firstRow = rows[0];\n if (!firstRow) {\n return false;\n }\n return (\n requiredHeaderNames.every((header) => firstRow.map((value) => value.toLowerCase()).includes(header)) &&\n requiredHeaderNames.length === firstRow.length\n );\n};\n\nasync function parseFile<T extends ProcessingEntry>(\n fileContent: string,\n maxRows: number,\n requiredHeaderNames: string[],\n dependencies: Dependencies<T>\n): Promise<T[]> {\n if (fileContent === 'invalidFileType') {\n throw new InvalidFileError();\n }\n\n const rows = fileContent.split('\\n');\n const parsedRows = rows.map(parseRow);\n\n const sanitizedRows = sanitizeRows(parsedRows);\n\n if (sanitizedRows.length > maxRows) {\n throw new TooManyRowsError();\n }\n\n if (sanitizedRows.length === 0) {\n throw new NoRowsError();\n }\n\n const containsHeaders = hasHeaderRow(sanitizedRows, requiredHeaderNames);\n if (containsHeaders && !isHeaderRowValid(sanitizedRows, requiredHeaderNames)) {\n throw new InvalidHeadersError();\n }\n\n const firstSanitizedRow = sanitizedRows[0];\n\n if (!firstSanitizedRow) {\n throw new NoRowsError();\n }\n\n const headers = containsHeaders ? firstSanitizedRow.map((value) => value.toLowerCase()) : requiredHeaderNames;\n\n const dataRows = containsHeaders ? sanitizedRows.splice(1) : sanitizedRows;\n\n if (dataRows.length === 0) {\n throw new NoRowsError();\n }\n\n const parsedRowChunks = chunk(dataRows, 30);\n let results: T[] = [];\n for (const currentRowChunk of parsedRowChunks) {\n const chunkResult = await processChunk(currentRowChunk, {\n ...dependencies,\n headers,\n });\n results = results.concat(chunkResult);\n }\n\n return results;\n}\n\nexport default parseFile;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const withNullable: {};
|
|
2
|
+
export function parseType(str: any): any;
|
|
3
|
+
export function parsedTypeCheck(type: any, obj: any): any;
|
|
4
|
+
export function typeCheck(type: any, obj: any): any;
|
|
5
|
+
export namespace opts {
|
|
6
|
+
export { withNullable as customTypes };
|
|
7
|
+
}
|
|
8
|
+
export function ensureType(type: any, obj: any, msg: any): boolean;
|
|
9
|
+
export function checkArg(obj: any, prop: any, type: any, msg: any): any;
|
|
10
|
+
export function checkArgs(input: any, types: any): void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
const TC = require('type-check');
|
|
2
|
+
const _ = require('lodash');
|
|
3
|
+
const E = require('../errors/errors');
|
|
4
|
+
const V = require('../validations/validations');
|
|
5
|
+
const customTypes = {
|
|
6
|
+
Integer: {
|
|
7
|
+
typeOf: 'Number',
|
|
8
|
+
validate(x) {
|
|
9
|
+
return x % 1 === 0;
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
IntString: {
|
|
13
|
+
typeOf: 'String',
|
|
14
|
+
validate: V.isInt,
|
|
15
|
+
},
|
|
16
|
+
BoolString: {
|
|
17
|
+
typeOf: 'String',
|
|
18
|
+
validate: V.isBoolean,
|
|
19
|
+
},
|
|
20
|
+
Hex32: {
|
|
21
|
+
typeOf: 'String',
|
|
22
|
+
validate(x) {
|
|
23
|
+
return V.isHexadecimal(x) && x.length === 32;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
Email: {
|
|
27
|
+
typeOf: 'String',
|
|
28
|
+
validate: V.isEmail,
|
|
29
|
+
},
|
|
30
|
+
UUID: {
|
|
31
|
+
typeOf: 'String',
|
|
32
|
+
validate: V.isUUID,
|
|
33
|
+
},
|
|
34
|
+
UUIDv4: {
|
|
35
|
+
typeOf: 'String',
|
|
36
|
+
validate(x) {
|
|
37
|
+
return V.isUUID(x, 4);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
JSON: {
|
|
41
|
+
typeOf: 'String',
|
|
42
|
+
validate: V.isJSON,
|
|
43
|
+
},
|
|
44
|
+
Url: {
|
|
45
|
+
typeOf: 'String',
|
|
46
|
+
validate: V.isURL,
|
|
47
|
+
},
|
|
48
|
+
DateString: {
|
|
49
|
+
typeOf: 'String',
|
|
50
|
+
validate: V.isDate,
|
|
51
|
+
},
|
|
52
|
+
NonEmptyArray: {
|
|
53
|
+
typeOf: 'Array',
|
|
54
|
+
validate: V.nonEmpty,
|
|
55
|
+
},
|
|
56
|
+
NonNullString: {
|
|
57
|
+
typeOf: 'String',
|
|
58
|
+
validate: V.nonEmpty,
|
|
59
|
+
},
|
|
60
|
+
CustomerReference: {
|
|
61
|
+
typeOf: 'String',
|
|
62
|
+
validate: V.isCustomerReference,
|
|
63
|
+
},
|
|
64
|
+
CustomerLabelName: {
|
|
65
|
+
typeOf: 'String',
|
|
66
|
+
validate: V.isCustomerLabelName,
|
|
67
|
+
},
|
|
68
|
+
BitcoinAddress: {
|
|
69
|
+
typeOf: 'String',
|
|
70
|
+
validate: V.bitcoin.isAddress,
|
|
71
|
+
},
|
|
72
|
+
EthereumAddress: {
|
|
73
|
+
typeOf: 'String',
|
|
74
|
+
validate: V.ethereum.isAddress,
|
|
75
|
+
},
|
|
76
|
+
EthereumTx: {
|
|
77
|
+
typeOf: 'String',
|
|
78
|
+
validate: V.ethereum.isTxHash,
|
|
79
|
+
},
|
|
80
|
+
EthereumBlockHash: {
|
|
81
|
+
typeOf: 'String',
|
|
82
|
+
validate: V.ethereum.isBlockHash,
|
|
83
|
+
},
|
|
84
|
+
EthereumWeiAmount: {
|
|
85
|
+
typeOf: 'String',
|
|
86
|
+
validate: V.ethereum.isValidWeiAmount,
|
|
87
|
+
},
|
|
88
|
+
EthereumAddressCode: {
|
|
89
|
+
typeOf: 'String',
|
|
90
|
+
validate: V.ethereum.isAddressCode,
|
|
91
|
+
},
|
|
92
|
+
MineId: {
|
|
93
|
+
typeOf: 'String',
|
|
94
|
+
validate(x) {
|
|
95
|
+
return x === 'mine';
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
BitcoinTxHash: {
|
|
99
|
+
typeOf: 'String',
|
|
100
|
+
validate: V.bitcoin.isTxHash,
|
|
101
|
+
},
|
|
102
|
+
BitcoinAddressArray: {
|
|
103
|
+
typeOf: 'Array',
|
|
104
|
+
validate(as) {
|
|
105
|
+
return _.every(as, V.bitcoin.isAddress);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
BitcoinTxHashArray: {
|
|
109
|
+
typeOf: 'Array',
|
|
110
|
+
validate(as) {
|
|
111
|
+
return _.every(as, V.bitcoin.isTxHash);
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
BitcoinTxHex: {
|
|
115
|
+
typeOf: 'String',
|
|
116
|
+
validate: V.bitcoin.isTxHex,
|
|
117
|
+
},
|
|
118
|
+
BitcoinScriptHex: {
|
|
119
|
+
typeOf: 'String',
|
|
120
|
+
validate: V.bitcoin.isScriptHex,
|
|
121
|
+
},
|
|
122
|
+
BitcoinHDPath: {
|
|
123
|
+
typeOf: 'String',
|
|
124
|
+
validate: V.bitcoin.isHDPath,
|
|
125
|
+
},
|
|
126
|
+
BitcoinPublicKey: {
|
|
127
|
+
typeOf: 'String',
|
|
128
|
+
validate: V.bitcoin.isPublicKey,
|
|
129
|
+
},
|
|
130
|
+
BitcoinXpub: {
|
|
131
|
+
typeOf: 'String',
|
|
132
|
+
validate: V.bitcoin.isHDPublicKey,
|
|
133
|
+
},
|
|
134
|
+
BitcoinTxSignature: {
|
|
135
|
+
typeOf: 'String',
|
|
136
|
+
validate: V.bitcoin.isTxSignature,
|
|
137
|
+
},
|
|
138
|
+
BitcoinBlockHeight: {
|
|
139
|
+
typeOf: 'Number',
|
|
140
|
+
validate: V.bitcoin.isBlockHeight,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
// add support for nullable properties
|
|
144
|
+
const withNullable = Object.keys(customTypes).reduce((acc, type) => {
|
|
145
|
+
acc[type] = customTypes[type];
|
|
146
|
+
const { typeOf, validate } = customTypes[type];
|
|
147
|
+
// for every type, add Nullable+type. A nullable string can also be empty
|
|
148
|
+
acc[`Nullable${type}`] = Object.assign(Object.assign({}, customTypes[type]), { validate: (x) => x == null || (typeOf === 'String' && x === '') || validate(x) });
|
|
149
|
+
return acc;
|
|
150
|
+
}, {});
|
|
151
|
+
module.exports = {
|
|
152
|
+
parseType(str) {
|
|
153
|
+
return TC.parseType(str);
|
|
154
|
+
},
|
|
155
|
+
parsedTypeCheck(type, obj) {
|
|
156
|
+
return TC.parsedTypeCheck(type, obj, this.opts);
|
|
157
|
+
},
|
|
158
|
+
typeCheck(type, obj) {
|
|
159
|
+
return TC.typeCheck(type, obj, this.opts);
|
|
160
|
+
},
|
|
161
|
+
opts: {
|
|
162
|
+
customTypes: withNullable,
|
|
163
|
+
},
|
|
164
|
+
ensureType(type, obj, msg) {
|
|
165
|
+
return V.ensure(this.typeCheck(type, obj), msg);
|
|
166
|
+
},
|
|
167
|
+
checkArg(obj, prop, type, msg) {
|
|
168
|
+
let message;
|
|
169
|
+
if (msg == null) {
|
|
170
|
+
message = `Invalid ${prop}`;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
message = msg;
|
|
174
|
+
}
|
|
175
|
+
this.ensureType(type, obj[prop], message);
|
|
176
|
+
return obj[prop];
|
|
177
|
+
},
|
|
178
|
+
checkArgs(input, types) {
|
|
179
|
+
const inputKeys = {};
|
|
180
|
+
const [typ] = types;
|
|
181
|
+
const fields = typ.of;
|
|
182
|
+
let numInputKeys = 0;
|
|
183
|
+
let numKeys;
|
|
184
|
+
Object.keys(input).forEach((k) => {
|
|
185
|
+
inputKeys[k] = true;
|
|
186
|
+
numInputKeys += 1;
|
|
187
|
+
});
|
|
188
|
+
numKeys = 0;
|
|
189
|
+
Object.keys(fields).forEach((key) => {
|
|
190
|
+
const objTypes = fields[key];
|
|
191
|
+
V.ensure(this.parsedTypeCheck(objTypes, input[key]), `Invalid ${key}`);
|
|
192
|
+
if (inputKeys[key]) {
|
|
193
|
+
numKeys += 1;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
if (!(typ.subset || numInputKeys === numKeys)) {
|
|
197
|
+
throw new E.BadRequest('invalid extra arguments are present');
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../libs/aml-utils/lib/types/types.js"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEjC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE5B,MAAM,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEtC,MAAM,CAAC,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAEhD,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE;QACP,MAAM,EAAE,QAAQ;QAChB,QAAQ,CAAC,CAAC;YACR,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;KACF;IACD,SAAS,EAAE;QACT,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC,CAAC,KAAK;KAClB;IACD,UAAU,EAAE;QACV,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC,CAAC,SAAS;KACtB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,QAAQ;QAChB,QAAQ,CAAC,CAAC;YACR,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC;QAC/C,CAAC;KACF;IACD,KAAK,EAAE;QACL,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC,CAAC,OAAO;KACpB;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM;KACnB;IAC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AG,CAAC,EAAE;gBAClB,OAAO,IAAI,CAAC,CAAC;aACd;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,IAAI,YAAY,KAAK,OAAO,CAAC,EAAE;YAC7C,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,qCAAqC,CAAC,CAAC;SAC/D;IACH,CAAC;CACF,CAAC","sourcesContent":["const TC = require('type-check');\n\nconst _ = require('lodash');\n\nconst E = require('../errors/errors');\n\nconst V = require('../validations/validations');\n\nconst customTypes = {\n Integer: {\n typeOf: 'Number',\n validate(x) {\n return x % 1 === 0;\n },\n },\n IntString: {\n typeOf: 'String',\n validate: V.isInt,\n },\n BoolString: {\n typeOf: 'String',\n validate: V.isBoolean,\n },\n Hex32: {\n typeOf: 'String',\n validate(x) {\n return V.isHexadecimal(x) && x.length === 32;\n },\n },\n Email: {\n typeOf: 'String',\n validate: V.isEmail,\n },\n UUID: {\n typeOf: 'String',\n validate: V.isUUID,\n },\n UUIDv4: {\n typeOf: 'String',\n validate(x) {\n return V.isUUID(x, 4);\n },\n },\n JSON: {\n typeOf: 'String',\n validate: V.isJSON,\n },\n Url: {\n typeOf: 'String',\n validate: V.isURL,\n },\n DateString: {\n typeOf: 'String',\n validate: V.isDate,\n },\n NonEmptyArray: {\n typeOf: 'Array',\n validate: V.nonEmpty,\n },\n NonNullString: {\n typeOf: 'String',\n validate: V.nonEmpty,\n },\n CustomerReference: {\n typeOf: 'String',\n validate: V.isCustomerReference,\n },\n CustomerLabelName: {\n typeOf: 'String',\n validate: V.isCustomerLabelName,\n },\n BitcoinAddress: {\n typeOf: 'String',\n validate: V.bitcoin.isAddress,\n },\n EthereumAddress: {\n typeOf: 'String',\n validate: V.ethereum.isAddress,\n },\n EthereumTx: {\n typeOf: 'String',\n validate: V.ethereum.isTxHash,\n },\n EthereumBlockHash: {\n typeOf: 'String',\n validate: V.ethereum.isBlockHash,\n },\n EthereumWeiAmount: {\n typeOf: 'String',\n validate: V.ethereum.isValidWeiAmount,\n },\n EthereumAddressCode: {\n typeOf: 'String',\n validate: V.ethereum.isAddressCode,\n },\n MineId: {\n typeOf: 'String',\n validate(x) {\n return x === 'mine';\n },\n },\n BitcoinTxHash: {\n typeOf: 'String',\n validate: V.bitcoin.isTxHash,\n },\n BitcoinAddressArray: {\n typeOf: 'Array',\n validate(as) {\n return _.every(as, V.bitcoin.isAddress);\n },\n },\n BitcoinTxHashArray: {\n typeOf: 'Array',\n validate(as) {\n return _.every(as, V.bitcoin.isTxHash);\n },\n },\n BitcoinTxHex: {\n typeOf: 'String',\n validate: V.bitcoin.isTxHex,\n },\n BitcoinScriptHex: {\n typeOf: 'String',\n validate: V.bitcoin.isScriptHex,\n },\n BitcoinHDPath: {\n typeOf: 'String',\n validate: V.bitcoin.isHDPath,\n },\n BitcoinPublicKey: {\n typeOf: 'String',\n validate: V.bitcoin.isPublicKey,\n },\n BitcoinXpub: {\n typeOf: 'String',\n validate: V.bitcoin.isHDPublicKey,\n },\n BitcoinTxSignature: {\n typeOf: 'String',\n validate: V.bitcoin.isTxSignature,\n },\n BitcoinBlockHeight: {\n typeOf: 'Number',\n validate: V.bitcoin.isBlockHeight,\n },\n};\n\n// add support for nullable properties\nconst withNullable = Object.keys(customTypes).reduce((acc, type) => {\n acc[type] = customTypes[type];\n const { typeOf, validate } = customTypes[type];\n\n // for every type, add Nullable+type. A nullable string can also be empty\n acc[`Nullable${type}`] = { ...customTypes[type], validate: (x) => x == null || (typeOf === 'String' && x === '') || validate(x) };\n\n return acc;\n}, {});\n\nmodule.exports = {\n parseType(str) {\n return TC.parseType(str);\n },\n parsedTypeCheck(type, obj) {\n return TC.parsedTypeCheck(type, obj, this.opts);\n },\n typeCheck(type, obj) {\n return TC.typeCheck(type, obj, this.opts);\n },\n opts: {\n customTypes: withNullable,\n },\n ensureType(type, obj, msg) {\n return V.ensure(this.typeCheck(type, obj), msg);\n },\n checkArg(obj, prop, type, msg) {\n let message;\n if (msg == null) {\n message = `Invalid ${prop}`;\n } else {\n message = msg;\n }\n this.ensureType(type, obj[prop], message);\n return obj[prop];\n },\n checkArgs(input, types) {\n const inputKeys = {};\n const [typ] = types;\n const fields = typ.of;\n let numInputKeys = 0;\n let numKeys;\n\n Object.keys(input).forEach((k) => {\n inputKeys[k] = true;\n numInputKeys += 1;\n });\n\n numKeys = 0;\n\n Object.keys(fields).forEach((key) => {\n const objTypes = fields[key];\n V.ensure(this.parsedTypeCheck(objTypes, input[key]), `Invalid ${key}`);\n if (inputKeys[key]) {\n numKeys += 1;\n }\n });\n\n if (!(typ.subset || numInputKeys === numKeys)) {\n throw new E.BadRequest('invalid extra arguments are present');\n }\n },\n};\n"]}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
export function _validate(Err: any, pred: any, x: any, msg: any): any;
|
|
2
|
+
export function _validateArg(pred: any, x: any, msg: any): any;
|
|
3
|
+
export function _tryCheck(fn: any, arg: any): boolean;
|
|
4
|
+
export function exists(x: any): boolean;
|
|
5
|
+
export function nonEmpty(x: any): boolean;
|
|
6
|
+
export function isNonEmptyString(x: any): boolean;
|
|
7
|
+
export function isSafeString(str: any): boolean;
|
|
8
|
+
export function isAssetSafeString(str: any): boolean;
|
|
9
|
+
export function ensureShortEnough(limit: any, x: any): boolean;
|
|
10
|
+
export function ensure(crit: any, msg: any): boolean;
|
|
11
|
+
export function argExists(x: any, msg: any): any;
|
|
12
|
+
export namespace check {
|
|
13
|
+
function matches(required: any, given: any, msg: any): boolean;
|
|
14
|
+
function wasFound(type: any): (item: any) => any;
|
|
15
|
+
function wasCreated(msg: any): (arr: any) => any;
|
|
16
|
+
function isTrue(crit: any, msg: any): boolean;
|
|
17
|
+
function isFalse(crit: any, msg: any): boolean;
|
|
18
|
+
}
|
|
19
|
+
export function isCustomerReference(x: any): boolean;
|
|
20
|
+
export function isCustomerLabelName(x: any): boolean;
|
|
21
|
+
export namespace binanceChain {
|
|
22
|
+
function isAddress(str: any): boolean;
|
|
23
|
+
function isTxHash(str: any): boolean;
|
|
24
|
+
}
|
|
25
|
+
export namespace bitcoin {
|
|
26
|
+
function isAddress(str: any, asset: any): any;
|
|
27
|
+
function isTxHash(str: any): boolean;
|
|
28
|
+
}
|
|
29
|
+
export namespace bitcoinCash {
|
|
30
|
+
function isAddress(str: any): boolean;
|
|
31
|
+
function isTxHash(str: any): boolean;
|
|
32
|
+
}
|
|
33
|
+
export namespace ethereum {
|
|
34
|
+
function isAddress(str: any): any;
|
|
35
|
+
function isBlockHash(str: any): any;
|
|
36
|
+
function isTxHash(str: any): any;
|
|
37
|
+
function isAddressCode(str: any): any;
|
|
38
|
+
function isValidWeiAmount(str: any): boolean;
|
|
39
|
+
}
|
|
40
|
+
export namespace horizen {
|
|
41
|
+
function isAddress(str: any): any;
|
|
42
|
+
function isTxHash(str: any): boolean;
|
|
43
|
+
}
|
|
44
|
+
export namespace litecoin {
|
|
45
|
+
function isAddress(str: any): boolean;
|
|
46
|
+
function isTxHash(str: any): boolean;
|
|
47
|
+
}
|
|
48
|
+
export namespace ripple {
|
|
49
|
+
function isAddress(str: any): any;
|
|
50
|
+
function isTxHash(str: any): boolean;
|
|
51
|
+
}
|
|
52
|
+
export namespace stellar {
|
|
53
|
+
function isAddress(str: any): boolean;
|
|
54
|
+
function isTxHash(str: any): boolean;
|
|
55
|
+
}
|
|
56
|
+
export namespace zcash {
|
|
57
|
+
function isAddress(str: any): any;
|
|
58
|
+
function isTxHash(str: any): boolean;
|
|
59
|
+
}
|
|
60
|
+
export namespace zilliqa {
|
|
61
|
+
function isAddress(str: any): boolean;
|
|
62
|
+
function isTxHash(str: any): any;
|
|
63
|
+
}
|
|
64
|
+
export namespace algorand {
|
|
65
|
+
function isAddress(str: any): any;
|
|
66
|
+
function isTxHash(str: any): boolean;
|
|
67
|
+
}
|
|
68
|
+
export namespace tezos {
|
|
69
|
+
function isAddress(str: any): any;
|
|
70
|
+
function isTxHash(str: any): boolean;
|
|
71
|
+
}
|
|
72
|
+
export namespace polkadot {
|
|
73
|
+
function isAddress(str: any): any;
|
|
74
|
+
function isTxHash(str: any): any;
|
|
75
|
+
}
|
|
76
|
+
export namespace cardano {
|
|
77
|
+
function isAddress(str: any): any;
|
|
78
|
+
function isTxHash(str: any): boolean;
|
|
79
|
+
}
|
|
80
|
+
export namespace cryptocom {
|
|
81
|
+
function isAddress(str: any): any;
|
|
82
|
+
function isTxHash(str: any): boolean;
|
|
83
|
+
}
|
|
84
|
+
export namespace near {
|
|
85
|
+
function isAddress(str: any): boolean;
|
|
86
|
+
function isTxHash(str: any): boolean;
|
|
87
|
+
}
|
|
88
|
+
export namespace doge {
|
|
89
|
+
function isAddress(str: any): boolean;
|
|
90
|
+
function isTxHash(str: any): boolean;
|
|
91
|
+
}
|
|
92
|
+
export namespace cosmos {
|
|
93
|
+
function isAddress(str: any): boolean;
|
|
94
|
+
function isTxHash(str: any): any;
|
|
95
|
+
}
|
|
96
|
+
export namespace solana {
|
|
97
|
+
function isAddress(str: any): boolean;
|
|
98
|
+
function isTxHash(str: any): boolean;
|
|
99
|
+
}
|
|
100
|
+
export namespace binanceSmartChain {
|
|
101
|
+
function isAddress(str: any): any;
|
|
102
|
+
function isTxHash(str: any): any;
|
|
103
|
+
}
|
|
104
|
+
export namespace polygon {
|
|
105
|
+
function isAddress(str: any): any;
|
|
106
|
+
function isTxHash(str: any): any;
|
|
107
|
+
}
|
|
108
|
+
export namespace filecoin {
|
|
109
|
+
function isAddress(str: any): boolean;
|
|
110
|
+
function isTxHash(str: any): boolean;
|
|
111
|
+
}
|
|
112
|
+
export namespace optimism {
|
|
113
|
+
function isAddress(str: any): any;
|
|
114
|
+
function isTxHash(str: any): any;
|
|
115
|
+
}
|
|
116
|
+
export namespace avalanche {
|
|
117
|
+
function isAddress(str: any): any;
|
|
118
|
+
function isTxHash(str: any): any;
|
|
119
|
+
}
|
|
120
|
+
export namespace arbitrum {
|
|
121
|
+
function isAddress(str: any): any;
|
|
122
|
+
function isTxHash(str: any): any;
|
|
123
|
+
}
|
|
124
|
+
export namespace tron {
|
|
125
|
+
function isAddress(str: any): any;
|
|
126
|
+
function isTxHash(str: any): any;
|
|
127
|
+
}
|
|
128
|
+
export namespace fantom {
|
|
129
|
+
function isAddress(str: any): any;
|
|
130
|
+
function isTxHash(str: any): any;
|
|
131
|
+
}
|
|
132
|
+
export namespace celo {
|
|
133
|
+
function isAddress(str: any): any;
|
|
134
|
+
function isTxHash(str: any): any;
|
|
135
|
+
}
|
|
136
|
+
export namespace ethereumClassic {
|
|
137
|
+
function isAddress(str: any): any;
|
|
138
|
+
function isTxHash(str: any): any;
|
|
139
|
+
}
|
|
140
|
+
export namespace mobilecoin {
|
|
141
|
+
function isAddress(str: any): boolean;
|
|
142
|
+
function isTxHash(str: any): any;
|
|
143
|
+
}
|
|
144
|
+
export namespace sui {
|
|
145
|
+
function isAddress(str: any): boolean;
|
|
146
|
+
function isTxHash(str: any): boolean;
|
|
147
|
+
}
|
|
148
|
+
export namespace flare {
|
|
149
|
+
function isAddress(str: any): boolean;
|
|
150
|
+
function isTxHash(str: any): boolean;
|
|
151
|
+
}
|
|
152
|
+
export namespace ton {
|
|
153
|
+
function isAddress(str: any): boolean;
|
|
154
|
+
function isTxHash(str: any): boolean;
|
|
155
|
+
}
|
|
156
|
+
export namespace gnosis {
|
|
157
|
+
function isAddress(str: any): any;
|
|
158
|
+
function isTxHash(str: any): any;
|
|
159
|
+
}
|
|
160
|
+
export namespace dydx {
|
|
161
|
+
function isAddress(str: any): boolean;
|
|
162
|
+
function isTxHash(str: any): any;
|
|
163
|
+
}
|
|
164
|
+
export namespace hederaHashgraph {
|
|
165
|
+
function isAddress(str: any): boolean;
|
|
166
|
+
function isTxHash(str: any): boolean;
|
|
167
|
+
}
|
|
168
|
+
export namespace aptos {
|
|
169
|
+
function isAddress(str: any): any;
|
|
170
|
+
function isTxHash(str: any): any;
|
|
171
|
+
}
|
|
172
|
+
export namespace zksync {
|
|
173
|
+
function isAddress(str: any): any;
|
|
174
|
+
function isTxHash(str: any): any;
|
|
175
|
+
}
|
|
176
|
+
export namespace haqq {
|
|
177
|
+
function isAddress(str: any): any;
|
|
178
|
+
function isTxHash(str: any): any;
|
|
179
|
+
}
|
|
180
|
+
export namespace base {
|
|
181
|
+
function isAddress(str: any): any;
|
|
182
|
+
function isTxHash(str: any): any;
|
|
183
|
+
}
|
|
184
|
+
export namespace corechain {
|
|
185
|
+
function isAddress(str: any): any;
|
|
186
|
+
function isTxHash(str: any): any;
|
|
187
|
+
}
|
|
188
|
+
export namespace worldchain {
|
|
189
|
+
function isAddress(str: any): any;
|
|
190
|
+
function isTxHash(str: any): any;
|
|
191
|
+
}
|
|
192
|
+
export namespace injective {
|
|
193
|
+
function isAddress(str: any): boolean;
|
|
194
|
+
function isTxHash(str: any): any;
|
|
195
|
+
}
|
|
196
|
+
export namespace linea {
|
|
197
|
+
function isAddress(str: any): any;
|
|
198
|
+
function isTxHash(str: any): any;
|
|
199
|
+
}
|
|
200
|
+
export namespace xdc {
|
|
201
|
+
function isAddress(str: any): any;
|
|
202
|
+
function isTxHash(str: any): any;
|
|
203
|
+
}
|
|
204
|
+
export namespace internetcomputer {
|
|
205
|
+
function isAddress(str: any): any;
|
|
206
|
+
function isTxHash(str: any): any;
|
|
207
|
+
}
|
|
208
|
+
export namespace sei {
|
|
209
|
+
function isAddress(str: any): boolean;
|
|
210
|
+
function isTxHash(str: any): any;
|
|
211
|
+
}
|