utilitas 1990.1.35 → 1990.1.38
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/.github/workflows/npm-publish.yml +0 -6
- package/README.md +3 -0
- package/lib/dbio.mjs +5 -4
- package/lib/email.mjs +5 -3
- package/lib/manifest.mjs +1 -1
- package/lib/sentinel.mjs +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# utilitas
|
|
2
2
|
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
[](https://github.com/Leask/utilitas/actions/workflows/npm-publish.yml)
|
|
5
|
+
|
|
3
6
|
Just another common utility for JavaScript.
|
|
4
7
|
|
|
5
8
|
Works in Node.js and modern browsers.
|
package/lib/dbio.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assertSet, ensureArray, log as _log } from './utilitas.mjs';
|
|
2
|
+
import { isPrimary } from 'cluster';
|
|
2
3
|
|
|
3
4
|
const defaultPort = 3306;
|
|
4
5
|
const orders = { '+': 'ASC', '-': 'DESC' };
|
|
@@ -15,10 +16,10 @@ const init = async (options) => {
|
|
|
15
16
|
if (options) {
|
|
16
17
|
const mysql = await import('mysql2/promise');
|
|
17
18
|
pool = mysql.createPool(options);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
isPrimary && !options.silent && log(
|
|
20
|
+
`Initialized: mysql://${options.user}@${options.host}`
|
|
21
|
+
+ `:${options.port || defaultPort}/${options.database} .`
|
|
22
|
+
);
|
|
22
23
|
}
|
|
23
24
|
assert(pool, 'Database has not been initialized.', 501);
|
|
24
25
|
return pool;
|
package/lib/email.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isPrimary } from 'cluster';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
assertEmail, ensureArray, log as _log, throwError, trim, uniqueArray, which
|
|
3
5
|
} from './utilitas.mjs';
|
|
@@ -33,9 +35,9 @@ const init = async (options) => {
|
|
|
33
35
|
default:
|
|
34
36
|
throwInvalidProvider();
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
isPrimary && !options.silent && log(
|
|
39
|
+
`Initialized: ${senderName} <${senderEmail}> via ${provider}.`
|
|
40
|
+
);
|
|
39
41
|
}
|
|
40
42
|
assert(client, 'Email client has not been initialized.', 501);
|
|
41
43
|
return client;
|
package/lib/manifest.mjs
CHANGED
package/lib/sentinel.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPrimary } from 'cluster';
|
|
1
2
|
import { log as _log } from './utilitas.mjs';
|
|
2
3
|
|
|
3
4
|
const log = (content) => _log(content, import.meta.url);
|
|
@@ -13,7 +14,7 @@ const init = async (options) => {
|
|
|
13
14
|
if (options) {
|
|
14
15
|
sentry = await import('@sentry/node');
|
|
15
16
|
sentry.init(Object.assign({ integrations }, options));
|
|
16
|
-
|
|
17
|
+
isPrimary && !options.silent && log(`Initialized, dsn: ${options.dsn} .`);
|
|
17
18
|
}
|
|
18
19
|
assert(sentry, 'Sentry has not been initialized.', 501);
|
|
19
20
|
return sentry;
|