utilitas 1989.9.40 → 1989.9.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/encryption.mjs +7 -0
- package/lib/utilitas.mjs +4 -2
- package/package.json +6 -6
package/lib/encryption.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as utilitas from './utilitas.mjs';
|
|
1
2
|
import crypto from 'crypto';
|
|
2
3
|
import fs from 'fs';
|
|
3
4
|
import qs from 'qs';
|
|
@@ -47,12 +48,18 @@ const digestObject = (object, algorithm) => {
|
|
|
47
48
|
return hash(getSortedQueryString(object), algorithm);
|
|
48
49
|
};
|
|
49
50
|
|
|
51
|
+
const hexToBigInt = (hex) => {
|
|
52
|
+
hex = `0x${utilitas.ensureString(hex || '0').replace(/^0x/ig, '')}`;
|
|
53
|
+
return BigInt(hex, 16).toString(10);
|
|
54
|
+
};
|
|
55
|
+
|
|
50
56
|
export {
|
|
51
57
|
defaultAlgorithm,
|
|
52
58
|
digestObject,
|
|
53
59
|
getSortedQueryString,
|
|
54
60
|
hash,
|
|
55
61
|
hashFile,
|
|
62
|
+
hexToBigInt,
|
|
56
63
|
random,
|
|
57
64
|
randomString,
|
|
58
65
|
sha256,
|
package/lib/utilitas.mjs
CHANGED
|
@@ -424,9 +424,11 @@ const modLog = (content, filename, options) => {
|
|
|
424
424
|
options = options || [];
|
|
425
425
|
const isErr = isError(content);
|
|
426
426
|
content = isObject(content) ? JSON.stringify(content) : content;
|
|
427
|
+
const strTime = options.time ? ` ${(isDate(
|
|
428
|
+
options.time, true
|
|
429
|
+
) ? options.time : new Date()).toISOString()}` : '';
|
|
427
430
|
const args = ['['
|
|
428
|
-
+ colors.red(basename(filename).toUpperCase())
|
|
429
|
-
+ colors.yellow(options.time ? ` ${new Date().toISOString()}` : '')
|
|
431
|
+
+ colors.red(basename(filename).toUpperCase()) + colors.yellow(strTime)
|
|
430
432
|
+ ']' + (isErr ? '' : ` ${content}`)];
|
|
431
433
|
if (isErr) { args.push(content); }
|
|
432
434
|
return console.info.apply(null, args);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "utilitas",
|
|
3
3
|
"description": "Just another common utility for Node.js.",
|
|
4
|
-
"version": "1989.9.
|
|
4
|
+
"version": "1989.9.43",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/utilitas",
|
|
7
7
|
"main": "index.mjs",
|
|
@@ -25,25 +25,25 @@
|
|
|
25
25
|
"url": "https://github.com/Leask/utilitas.git"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sentry/node": "^6.
|
|
28
|
+
"@sentry/node": "^6.18.1",
|
|
29
29
|
"base64url": "^3.0.1",
|
|
30
30
|
"colors": "1.4.0",
|
|
31
|
-
"fast-geoip": "^1.1.
|
|
31
|
+
"fast-geoip": "^1.1.61",
|
|
32
32
|
"file-type": "^17.1.1",
|
|
33
33
|
"ini": "github:Leask/ini",
|
|
34
34
|
"ioredis": "^4.28.5",
|
|
35
35
|
"jsonwebtoken": "^8.5.1",
|
|
36
36
|
"mailgun-js": "^0.22.0",
|
|
37
|
-
"mathjs": "^10.
|
|
37
|
+
"mathjs": "^10.3.0",
|
|
38
38
|
"mysql2": "^2.3.3",
|
|
39
39
|
"node-fetch": "^2.6.7",
|
|
40
|
-
"node-mailjet": "^3.3.
|
|
40
|
+
"node-mailjet": "^3.3.7",
|
|
41
41
|
"ping": "^0.4.1",
|
|
42
42
|
"qs": "^6.10.3",
|
|
43
43
|
"tail": "^2.2.4",
|
|
44
44
|
"telegraf": "^4.7.0",
|
|
45
45
|
"telesignsdk": "^2.2.1",
|
|
46
|
-
"twilio": "^3.
|
|
46
|
+
"twilio": "^3.75.0",
|
|
47
47
|
"uuid": "^8.3.2"
|
|
48
48
|
}
|
|
49
49
|
}
|