@sapphire-sh/utils 1.41.0 → 1.43.0
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/eslint.js +1 -0
- package/lib/esm/eslint.js +1 -0
- package/lib/esm/index.d.ts +7 -7
- package/lib/esm/index.js +7 -7
- package/lib/esm/notify.js +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.js +16 -16
- package/lib/notify.js +5 -5
- package/package.json +1 -1
package/lib/eslint.js
CHANGED
|
@@ -27,6 +27,7 @@ exports.default = (0, config_1.defineConfig)(js_1.default.configs.recommended, .
|
|
|
27
27
|
'arrow-body-style': ['error', 'as-needed'],
|
|
28
28
|
'func-style': ['error', 'expression'],
|
|
29
29
|
yoda: 'error',
|
|
30
|
+
curly: 'error',
|
|
30
31
|
// TypeScript
|
|
31
32
|
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
|
|
32
33
|
'@typescript-eslint/naming-convention': [
|
package/lib/esm/eslint.js
CHANGED
|
@@ -22,6 +22,7 @@ export default defineConfig(eslint.configs.recommended, ...tseslint.configs.reco
|
|
|
22
22
|
'arrow-body-style': ['error', 'as-needed'],
|
|
23
23
|
'func-style': ['error', 'expression'],
|
|
24
24
|
yoda: 'error',
|
|
25
|
+
curly: 'error',
|
|
25
26
|
// TypeScript
|
|
26
27
|
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
|
|
27
28
|
'@typescript-eslint/naming-convention': [
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getEnumValue } from './getEnumValue';
|
|
2
|
-
export { isNonNullable } from './isNonNullable';
|
|
3
|
-
export { LogLevel, logger } from './logger';
|
|
4
|
-
export { notifyMattermost, notifySlack } from './notify';
|
|
5
|
-
export { Queue } from './queue';
|
|
6
|
-
export { sleep } from './sleep';
|
|
7
|
-
export { throttle } from './throttle';
|
|
1
|
+
export { getEnumValue } from './getEnumValue.js';
|
|
2
|
+
export { isNonNullable } from './isNonNullable.js';
|
|
3
|
+
export { LogLevel, logger } from './logger.js';
|
|
4
|
+
export { notifyMattermost, notifySlack } from './notify.js';
|
|
5
|
+
export { Queue } from './queue.js';
|
|
6
|
+
export { sleep } from './sleep.js';
|
|
7
|
+
export { throttle } from './throttle.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getEnumValue } from './getEnumValue';
|
|
2
|
-
export { isNonNullable } from './isNonNullable';
|
|
3
|
-
export { LogLevel, logger } from './logger';
|
|
4
|
-
export { notifyMattermost, notifySlack } from './notify';
|
|
5
|
-
export { Queue } from './queue';
|
|
6
|
-
export { sleep } from './sleep';
|
|
7
|
-
export { throttle } from './throttle';
|
|
1
|
+
export { getEnumValue } from './getEnumValue.js';
|
|
2
|
+
export { isNonNullable } from './isNonNullable.js';
|
|
3
|
+
export { LogLevel, logger } from './logger.js';
|
|
4
|
+
export { notifyMattermost, notifySlack } from './notify.js';
|
|
5
|
+
export { Queue } from './queue.js';
|
|
6
|
+
export { sleep } from './sleep.js';
|
|
7
|
+
export { throttle } from './throttle.js';
|
package/lib/esm/notify.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getEnumValue } from './getEnumValue';
|
|
2
|
-
export { isNonNullable } from './isNonNullable';
|
|
3
|
-
export { LogLevel, logger } from './logger';
|
|
4
|
-
export { notifyMattermost, notifySlack } from './notify';
|
|
5
|
-
export { Queue } from './queue';
|
|
6
|
-
export { sleep } from './sleep';
|
|
7
|
-
export { throttle } from './throttle';
|
|
1
|
+
export { getEnumValue } from './getEnumValue.js';
|
|
2
|
+
export { isNonNullable } from './isNonNullable.js';
|
|
3
|
+
export { LogLevel, logger } from './logger.js';
|
|
4
|
+
export { notifyMattermost, notifySlack } from './notify.js';
|
|
5
|
+
export { Queue } from './queue.js';
|
|
6
|
+
export { sleep } from './sleep.js';
|
|
7
|
+
export { throttle } from './throttle.js';
|
package/lib/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.throttle = exports.sleep = exports.Queue = exports.notifySlack = exports.notifyMattermost = exports.logger = exports.LogLevel = exports.isNonNullable = exports.getEnumValue = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "getEnumValue", { enumerable: true, get: function () { return
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "isNonNullable", { enumerable: true, get: function () { return
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return
|
|
10
|
-
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "notifyMattermost", { enumerable: true, get: function () { return
|
|
13
|
-
Object.defineProperty(exports, "notifySlack", { enumerable: true, get: function () { return
|
|
14
|
-
var
|
|
15
|
-
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return
|
|
16
|
-
var
|
|
17
|
-
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return
|
|
4
|
+
var getEnumValue_js_1 = require("./getEnumValue.js");
|
|
5
|
+
Object.defineProperty(exports, "getEnumValue", { enumerable: true, get: function () { return getEnumValue_js_1.getEnumValue; } });
|
|
6
|
+
var isNonNullable_js_1 = require("./isNonNullable.js");
|
|
7
|
+
Object.defineProperty(exports, "isNonNullable", { enumerable: true, get: function () { return isNonNullable_js_1.isNonNullable; } });
|
|
8
|
+
var logger_js_1 = require("./logger.js");
|
|
9
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return logger_js_1.LogLevel; } });
|
|
10
|
+
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_js_1.logger; } });
|
|
11
|
+
var notify_js_1 = require("./notify.js");
|
|
12
|
+
Object.defineProperty(exports, "notifyMattermost", { enumerable: true, get: function () { return notify_js_1.notifyMattermost; } });
|
|
13
|
+
Object.defineProperty(exports, "notifySlack", { enumerable: true, get: function () { return notify_js_1.notifySlack; } });
|
|
14
|
+
var queue_js_1 = require("./queue.js");
|
|
15
|
+
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return queue_js_1.Queue; } });
|
|
16
|
+
var sleep_js_1 = require("./sleep.js");
|
|
17
|
+
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return sleep_js_1.sleep; } });
|
|
18
|
+
var throttle_js_1 = require("./throttle.js");
|
|
19
|
+
Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return throttle_js_1.throttle; } });
|
package/lib/notify.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.notifyMattermost = exports.notifySlack = void 0;
|
|
4
|
-
const
|
|
4
|
+
const logger_js_1 = require("./logger.js");
|
|
5
5
|
const notifySlack = async (url, text) => {
|
|
6
|
-
|
|
6
|
+
logger_js_1.logger.debug('[notifySlack] posting to webhook', { textLength: text.length });
|
|
7
7
|
const resp = await fetch(url, {
|
|
8
8
|
method: 'POST',
|
|
9
9
|
headers: {
|
|
@@ -11,14 +11,14 @@ const notifySlack = async (url, text) => {
|
|
|
11
11
|
},
|
|
12
12
|
body: JSON.stringify({ text }),
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
logger_js_1.logger.debug('[notifySlack] response received', { status: resp.status });
|
|
15
15
|
if (!resp.ok) {
|
|
16
16
|
throw new Error(`Slack webhook failed: HTTP ${resp.status}`);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
exports.notifySlack = notifySlack;
|
|
20
20
|
const notifyMattermost = async (baseUrl, token, channelId, message) => {
|
|
21
|
-
|
|
21
|
+
logger_js_1.logger.debug('[notifyMattermost] posting to channel', { channelId, messageLength: message.length });
|
|
22
22
|
const resp = await fetch(`${baseUrl}/api/v4/posts`, {
|
|
23
23
|
method: 'POST',
|
|
24
24
|
headers: {
|
|
@@ -27,7 +27,7 @@ const notifyMattermost = async (baseUrl, token, channelId, message) => {
|
|
|
27
27
|
},
|
|
28
28
|
body: JSON.stringify({ channel_id: channelId, message }),
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
logger_js_1.logger.debug('[notifyMattermost] response received', { status: resp.status });
|
|
31
31
|
if (!resp.ok) {
|
|
32
32
|
throw new Error(`Mattermost post failed: HTTP ${resp.status}`);
|
|
33
33
|
}
|