@dereekb/nestjs 13.11.13 → 13.11.15
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/discord/index.cjs.js +37 -34
- package/discord/index.esm.js +36 -33
- package/discord/package.json +4 -4
- package/discord/src/lib/discord.api.d.ts +6 -6
- package/discord/src/lib/discord.api.page.d.ts +4 -4
- package/discord/src/lib/discord.config.d.ts +2 -2
- package/discord/src/lib/discord.module.d.ts +2 -2
- package/discord/src/lib/discord.util.d.ts +3 -3
- package/discord/src/lib/webhook/webhook.discord.d.ts +2 -2
- package/discord/src/lib/webhook/webhook.discord.module.d.ts +2 -2
- package/discord/src/lib/webhook/webhook.discord.verify.d.ts +2 -2
- package/eslint/index.cjs.js +142 -145
- package/eslint/index.esm.js +141 -144
- package/eslint/package.json +4 -4
- package/eslint/src/lib/index.d.ts +2 -2
- package/eslint/src/lib/plugin.d.ts +1 -1
- package/eslint/src/lib/require-inject.rule.d.ts +1 -1
- package/index.cjs.js +98 -112
- package/index.esm.js +98 -112
- package/mailgun/index.cjs.js +17 -13
- package/mailgun/index.esm.js +17 -13
- package/mailgun/package.json +6 -6
- package/mailgun/src/lib/mailgun.d.ts +7 -5
- package/mailgun/src/lib/mailgun.service.module.d.ts +4 -3
- package/mailgun/src/lib/mailgun.util.d.ts +6 -5
- package/openai/index.cjs.js +9 -9
- package/openai/index.esm.js +9 -9
- package/openai/package.json +6 -6
- package/openai/src/lib/openai.module.d.ts +2 -2
- package/openai/src/lib/openai.util.d.ts +3 -3
- package/openai/src/lib/webhook/webhook.openai.module.d.ts +2 -2
- package/openai/src/lib/webhook/webhook.openai.verify.d.ts +2 -2
- package/package.json +5 -5
- package/src/lib/asset/asset.loader.node.d.ts +3 -3
- package/src/lib/asset/asset.nest.d.ts +6 -5
- package/src/lib/decorators/local.decorator.d.ts +2 -2
- package/src/lib/decorators/rawbody.d.ts +7 -7
- package/src/lib/module/client/client.config.d.ts +2 -2
- package/src/lib/module/client/client.module.d.ts +3 -2
- package/src/lib/module/env/env.d.ts +1 -1
- package/src/lib/module/env/env.nest.d.ts +2 -2
- package/src/lib/module/module.d.ts +5 -5
- package/src/lib/util/encryption/json.encrypt.d.ts +18 -16
- package/src/lib/util/file/file.json.d.ts +2 -2
- package/src/lib/util/pdf/pdf.encryption.d.ts +3 -3
- package/stripe/index.cjs.js +13 -13
- package/stripe/index.esm.js +13 -13
- package/stripe/package.json +6 -6
- package/stripe/src/lib/stripe.api.d.ts +4 -4
- package/stripe/src/lib/stripe.module.d.ts +3 -3
- package/stripe/src/lib/webhook/webhook.stripe.d.ts +4 -4
- package/typeform/index.cjs.js +12 -12
- package/typeform/index.esm.js +12 -12
- package/typeform/package.json +6 -6
- package/typeform/src/lib/typeform.module.d.ts +2 -2
- package/typeform/src/lib/typeform.util.d.ts +2 -2
- package/typeform/src/lib/webhook/webhook.typeform.form.d.ts +4 -4
- package/typeform/src/lib/webhook/webhook.typeform.module.d.ts +2 -2
- package/typeform/src/lib/webhook/webhook.typeform.verify.d.ts +2 -2
- package/vapiai/index.cjs.js +6 -6
- package/vapiai/index.esm.js +6 -6
- package/vapiai/package.json +6 -6
- package/vapiai/src/lib/vapiai.module.d.ts +2 -2
- package/vapiai/src/lib/webhook/webhook.vapiai.module.d.ts +2 -2
- package/vapiai/src/lib/webhook/webhook.vapiai.verify.d.ts +2 -2
package/discord/index.cjs.js
CHANGED
|
@@ -58,8 +58,8 @@ function _object_spread_props$1(target, source) {
|
|
|
58
58
|
/**
|
|
59
59
|
* Casts an untyped Discord interaction to a typed one.
|
|
60
60
|
*
|
|
61
|
-
* @param interaction -
|
|
62
|
-
* @returns
|
|
61
|
+
* @param interaction - The raw interaction to cast.
|
|
62
|
+
* @returns The interaction cast to the specified typed DiscordWebhookInteraction.
|
|
63
63
|
*/ function discordWebhookInteraction(interaction) {
|
|
64
64
|
return interaction;
|
|
65
65
|
}
|
|
@@ -300,8 +300,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
300
300
|
*
|
|
301
301
|
* Uses Node.js built-in crypto with JWK key import — no external dependencies required.
|
|
302
302
|
*
|
|
303
|
-
* @param config -
|
|
304
|
-
* @returns
|
|
303
|
+
* @param config - Verification config containing the application's public key.
|
|
304
|
+
* @returns A DiscordWebhookEventVerifier function that validates Ed25519-signed requests.
|
|
305
305
|
*
|
|
306
306
|
* @example
|
|
307
307
|
* ```ts
|
|
@@ -822,8 +822,8 @@ function _class_call_check$3(instance, Constructor) {
|
|
|
822
822
|
/**
|
|
823
823
|
* Factory that creates a DiscordWebhookServiceConfig from environment variables.
|
|
824
824
|
*
|
|
825
|
-
* @param configService -
|
|
826
|
-
* @returns
|
|
825
|
+
* @param configService - The NestJS config service used to read the Discord public key environment variable.
|
|
826
|
+
* @returns A validated DiscordWebhookServiceConfig populated from environment variables.
|
|
827
827
|
*/ function discordWebhookServiceConfigFactory(configService) {
|
|
828
828
|
var config = {
|
|
829
829
|
discordWebhook: {
|
|
@@ -904,7 +904,7 @@ function _define_property$2(obj, key, value) {
|
|
|
904
904
|
*
|
|
905
905
|
* Includes Guilds, GuildMessages, and MessageContent.
|
|
906
906
|
* Note: MessageContent is a privileged intent and must be enabled in the Discord Developer Portal.
|
|
907
|
-
*/ var
|
|
907
|
+
*/ var DEFAULT_DISCORD_INTENTS = [
|
|
908
908
|
discord_js.GatewayIntentBits.Guilds,
|
|
909
909
|
discord_js.GatewayIntentBits.GuildMessages,
|
|
910
910
|
discord_js.GatewayIntentBits.MessageContent
|
|
@@ -1128,7 +1128,7 @@ function _ts_generator(thisArg, body) {
|
|
|
1128
1128
|
this.config = config;
|
|
1129
1129
|
var clientOptions = config.discord.clientOptions;
|
|
1130
1130
|
this.client = new discord_js.Client(_object_spread$1({
|
|
1131
|
-
intents:
|
|
1131
|
+
intents: DEFAULT_DISCORD_INTENTS
|
|
1132
1132
|
}, clientOptions));
|
|
1133
1133
|
}
|
|
1134
1134
|
_create_class(DiscordApi, [
|
|
@@ -1187,10 +1187,10 @@ function _ts_generator(thisArg, body) {
|
|
|
1187
1187
|
*/ /**
|
|
1188
1188
|
* Sends a text message to the specified Discord channel.
|
|
1189
1189
|
*
|
|
1190
|
-
* @param channelId -
|
|
1191
|
-
* @param content -
|
|
1192
|
-
* @returns
|
|
1193
|
-
* @throws {Error}
|
|
1190
|
+
* @param channelId - Target channel's snowflake ID.
|
|
1191
|
+
* @param content - Message text to send.
|
|
1192
|
+
* @returns The sent Discord Message.
|
|
1193
|
+
* @throws {Error} When the channel is not found or is not a text channel.
|
|
1194
1194
|
*/ function sendMessage(channelId, content) {
|
|
1195
1195
|
return _async_to_generator(function() {
|
|
1196
1196
|
var channel;
|
|
@@ -1237,8 +1237,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1237
1237
|
*/ /**
|
|
1238
1238
|
* Registers a handler for incoming Discord messages (MessageCreate event).
|
|
1239
1239
|
*
|
|
1240
|
-
* @param handler -
|
|
1241
|
-
* @returns
|
|
1240
|
+
* @param handler - Callback invoked for each incoming Message.
|
|
1241
|
+
* @returns An unsubscribe function that removes the registered handler.
|
|
1242
1242
|
*/ key: "onMessage",
|
|
1243
1243
|
value: function onMessage(handler) {
|
|
1244
1244
|
var _this = this;
|
|
@@ -1264,8 +1264,8 @@ function _class_call_check(instance, Constructor) {
|
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Factory that creates a DiscordServiceConfig from environment variables.
|
|
1266
1266
|
*
|
|
1267
|
-
* @param configService -
|
|
1268
|
-
* @returns
|
|
1267
|
+
* @param configService - The NestJS config service used to read Discord environment variables.
|
|
1268
|
+
* @returns A validated DiscordServiceConfig populated from environment variables.
|
|
1269
1269
|
*/ function discordServiceConfigFactory(configService) {
|
|
1270
1270
|
var config = {
|
|
1271
1271
|
discord: {
|
|
@@ -1353,7 +1353,7 @@ function _object_spread_props(target, source) {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
/**
|
|
1355
1355
|
* Default number of messages per page when fetching Discord channel messages.
|
|
1356
|
-
*/ var
|
|
1356
|
+
*/ var DEFAULT_DISCORD_MESSAGES_PER_PAGE = 100;
|
|
1357
1357
|
/**
|
|
1358
1358
|
* Creates a page factory that wraps a Discord message fetch function with automatic cursor-based pagination.
|
|
1359
1359
|
*
|
|
@@ -1361,8 +1361,8 @@ function _object_spread_props(target, source) {
|
|
|
1361
1361
|
* message's ID from each response and sets it as the `before` cursor for the next request.
|
|
1362
1362
|
* When the number of returned messages is less than the requested limit, pagination stops.
|
|
1363
1363
|
*
|
|
1364
|
-
* @param input - The factory input configuration
|
|
1365
|
-
* @returns A page factory that produces iterable page fetchers
|
|
1364
|
+
* @param input - The factory input configuration.
|
|
1365
|
+
* @returns A page factory that produces iterable page fetchers.
|
|
1366
1366
|
*
|
|
1367
1367
|
* @example
|
|
1368
1368
|
* ```typescript
|
|
@@ -1395,18 +1395,21 @@ function _object_spread_props(target, source) {
|
|
|
1395
1395
|
var _ref, _options_maxItemsPerPage, _ref1;
|
|
1396
1396
|
var _pageResult_result;
|
|
1397
1397
|
var nextCursor = pageResult.nextPageCursor;
|
|
1398
|
-
var effectiveLimit = (_ref = (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.limit) !== null && _ref !== void 0 ? _ref :
|
|
1398
|
+
var effectiveLimit = (_ref = (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.limit) !== null && _ref !== void 0 ? _ref : DEFAULT_DISCORD_MESSAGES_PER_PAGE;
|
|
1399
1399
|
var resultCount = (_ref1 = (_pageResult_result = pageResult.result) === null || _pageResult_result === void 0 ? void 0 : _pageResult_result.data.length) !== null && _ref1 !== void 0 ? _ref1 : 0;
|
|
1400
|
+
var nextInput;
|
|
1400
1401
|
// Discord signals no more results when fewer items than the limit are returned
|
|
1401
1402
|
if (!nextCursor || resultCount < effectiveLimit) {
|
|
1402
|
-
|
|
1403
|
+
nextInput = undefined;
|
|
1404
|
+
} else {
|
|
1405
|
+
nextInput = _object_spread_props(_object_spread({}, input), {
|
|
1406
|
+
before: nextCursor,
|
|
1407
|
+
after: undefined,
|
|
1408
|
+
around: undefined,
|
|
1409
|
+
limit: effectiveLimit
|
|
1410
|
+
});
|
|
1403
1411
|
}
|
|
1404
|
-
return
|
|
1405
|
-
before: nextCursor,
|
|
1406
|
-
after: undefined,
|
|
1407
|
-
around: undefined,
|
|
1408
|
-
limit: effectiveLimit
|
|
1409
|
-
});
|
|
1412
|
+
return nextInput;
|
|
1410
1413
|
}
|
|
1411
1414
|
}));
|
|
1412
1415
|
}
|
|
@@ -1441,7 +1444,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1441
1444
|
*
|
|
1442
1445
|
* Includes Guilds, GuildMessages, and MessageContent intents.
|
|
1443
1446
|
*
|
|
1444
|
-
* @returns
|
|
1447
|
+
* @returns Partial ClientOptions with the default bot intents set.
|
|
1445
1448
|
*
|
|
1446
1449
|
* @example
|
|
1447
1450
|
* ```ts
|
|
@@ -1450,14 +1453,14 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1450
1453
|
* ```
|
|
1451
1454
|
*/ function discordDefaultClientOptions() {
|
|
1452
1455
|
return {
|
|
1453
|
-
intents:
|
|
1456
|
+
intents: DEFAULT_DISCORD_INTENTS
|
|
1454
1457
|
};
|
|
1455
1458
|
}
|
|
1456
1459
|
/**
|
|
1457
1460
|
* Returns ClientOptions with additional intents merged with the defaults.
|
|
1458
1461
|
*
|
|
1459
|
-
* @param additionalIntents -
|
|
1460
|
-
* @returns
|
|
1462
|
+
* @param additionalIntents - Extra intents to include beyond the defaults.
|
|
1463
|
+
* @returns Partial ClientOptions with the merged intent list.
|
|
1461
1464
|
*
|
|
1462
1465
|
* @example
|
|
1463
1466
|
* ```ts
|
|
@@ -1466,13 +1469,13 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1466
1469
|
* ```
|
|
1467
1470
|
*/ function discordClientOptionsWithIntents(additionalIntents) {
|
|
1468
1471
|
return {
|
|
1469
|
-
intents: _to_consumable_array(
|
|
1472
|
+
intents: _to_consumable_array(DEFAULT_DISCORD_INTENTS).concat(_to_consumable_array(additionalIntents))
|
|
1470
1473
|
};
|
|
1471
1474
|
}
|
|
1472
1475
|
|
|
1476
|
+
exports.DEFAULT_DISCORD_INTENTS = DEFAULT_DISCORD_INTENTS;
|
|
1477
|
+
exports.DEFAULT_DISCORD_MESSAGES_PER_PAGE = DEFAULT_DISCORD_MESSAGES_PER_PAGE;
|
|
1473
1478
|
exports.DISCORD_BOT_TOKEN_ENV_VAR = DISCORD_BOT_TOKEN_ENV_VAR;
|
|
1474
|
-
exports.DISCORD_DEFAULT_INTENTS = DISCORD_DEFAULT_INTENTS;
|
|
1475
|
-
exports.DISCORD_DEFAULT_MESSAGES_PER_PAGE = DISCORD_DEFAULT_MESSAGES_PER_PAGE;
|
|
1476
1479
|
exports.DISCORD_ED25519_PUBLIC_KEY_BYTE_LENGTH = DISCORD_ED25519_PUBLIC_KEY_BYTE_LENGTH;
|
|
1477
1480
|
exports.DISCORD_PUBLIC_KEY_ENV_VAR = DISCORD_PUBLIC_KEY_ENV_VAR;
|
|
1478
1481
|
exports.DiscordServiceConfig = DiscordServiceConfig;
|
package/discord/index.esm.js
CHANGED
|
@@ -56,8 +56,8 @@ function _object_spread_props$1(target, source) {
|
|
|
56
56
|
/**
|
|
57
57
|
* Casts an untyped Discord interaction to a typed one.
|
|
58
58
|
*
|
|
59
|
-
* @param interaction -
|
|
60
|
-
* @returns
|
|
59
|
+
* @param interaction - The raw interaction to cast.
|
|
60
|
+
* @returns The interaction cast to the specified typed DiscordWebhookInteraction.
|
|
61
61
|
*/ function discordWebhookInteraction(interaction) {
|
|
62
62
|
return interaction;
|
|
63
63
|
}
|
|
@@ -298,8 +298,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
298
298
|
*
|
|
299
299
|
* Uses Node.js built-in crypto with JWK key import — no external dependencies required.
|
|
300
300
|
*
|
|
301
|
-
* @param config -
|
|
302
|
-
* @returns
|
|
301
|
+
* @param config - Verification config containing the application's public key.
|
|
302
|
+
* @returns A DiscordWebhookEventVerifier function that validates Ed25519-signed requests.
|
|
303
303
|
*
|
|
304
304
|
* @example
|
|
305
305
|
* ```ts
|
|
@@ -820,8 +820,8 @@ function _class_call_check$3(instance, Constructor) {
|
|
|
820
820
|
/**
|
|
821
821
|
* Factory that creates a DiscordWebhookServiceConfig from environment variables.
|
|
822
822
|
*
|
|
823
|
-
* @param configService -
|
|
824
|
-
* @returns
|
|
823
|
+
* @param configService - The NestJS config service used to read the Discord public key environment variable.
|
|
824
|
+
* @returns A validated DiscordWebhookServiceConfig populated from environment variables.
|
|
825
825
|
*/ function discordWebhookServiceConfigFactory(configService) {
|
|
826
826
|
var config = {
|
|
827
827
|
discordWebhook: {
|
|
@@ -902,7 +902,7 @@ function _define_property$2(obj, key, value) {
|
|
|
902
902
|
*
|
|
903
903
|
* Includes Guilds, GuildMessages, and MessageContent.
|
|
904
904
|
* Note: MessageContent is a privileged intent and must be enabled in the Discord Developer Portal.
|
|
905
|
-
*/ var
|
|
905
|
+
*/ var DEFAULT_DISCORD_INTENTS = [
|
|
906
906
|
GatewayIntentBits.Guilds,
|
|
907
907
|
GatewayIntentBits.GuildMessages,
|
|
908
908
|
GatewayIntentBits.MessageContent
|
|
@@ -1126,7 +1126,7 @@ function _ts_generator(thisArg, body) {
|
|
|
1126
1126
|
this.config = config;
|
|
1127
1127
|
var clientOptions = config.discord.clientOptions;
|
|
1128
1128
|
this.client = new Client(_object_spread$1({
|
|
1129
|
-
intents:
|
|
1129
|
+
intents: DEFAULT_DISCORD_INTENTS
|
|
1130
1130
|
}, clientOptions));
|
|
1131
1131
|
}
|
|
1132
1132
|
_create_class(DiscordApi, [
|
|
@@ -1185,10 +1185,10 @@ function _ts_generator(thisArg, body) {
|
|
|
1185
1185
|
*/ /**
|
|
1186
1186
|
* Sends a text message to the specified Discord channel.
|
|
1187
1187
|
*
|
|
1188
|
-
* @param channelId -
|
|
1189
|
-
* @param content -
|
|
1190
|
-
* @returns
|
|
1191
|
-
* @throws {Error}
|
|
1188
|
+
* @param channelId - Target channel's snowflake ID.
|
|
1189
|
+
* @param content - Message text to send.
|
|
1190
|
+
* @returns The sent Discord Message.
|
|
1191
|
+
* @throws {Error} When the channel is not found or is not a text channel.
|
|
1192
1192
|
*/ function sendMessage(channelId, content) {
|
|
1193
1193
|
return _async_to_generator(function() {
|
|
1194
1194
|
var channel;
|
|
@@ -1235,8 +1235,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1235
1235
|
*/ /**
|
|
1236
1236
|
* Registers a handler for incoming Discord messages (MessageCreate event).
|
|
1237
1237
|
*
|
|
1238
|
-
* @param handler -
|
|
1239
|
-
* @returns
|
|
1238
|
+
* @param handler - Callback invoked for each incoming Message.
|
|
1239
|
+
* @returns An unsubscribe function that removes the registered handler.
|
|
1240
1240
|
*/ key: "onMessage",
|
|
1241
1241
|
value: function onMessage(handler) {
|
|
1242
1242
|
var _this = this;
|
|
@@ -1262,8 +1262,8 @@ function _class_call_check(instance, Constructor) {
|
|
|
1262
1262
|
/**
|
|
1263
1263
|
* Factory that creates a DiscordServiceConfig from environment variables.
|
|
1264
1264
|
*
|
|
1265
|
-
* @param configService -
|
|
1266
|
-
* @returns
|
|
1265
|
+
* @param configService - The NestJS config service used to read Discord environment variables.
|
|
1266
|
+
* @returns A validated DiscordServiceConfig populated from environment variables.
|
|
1267
1267
|
*/ function discordServiceConfigFactory(configService) {
|
|
1268
1268
|
var config = {
|
|
1269
1269
|
discord: {
|
|
@@ -1351,7 +1351,7 @@ function _object_spread_props(target, source) {
|
|
|
1351
1351
|
}
|
|
1352
1352
|
/**
|
|
1353
1353
|
* Default number of messages per page when fetching Discord channel messages.
|
|
1354
|
-
*/ var
|
|
1354
|
+
*/ var DEFAULT_DISCORD_MESSAGES_PER_PAGE = 100;
|
|
1355
1355
|
/**
|
|
1356
1356
|
* Creates a page factory that wraps a Discord message fetch function with automatic cursor-based pagination.
|
|
1357
1357
|
*
|
|
@@ -1359,8 +1359,8 @@ function _object_spread_props(target, source) {
|
|
|
1359
1359
|
* message's ID from each response and sets it as the `before` cursor for the next request.
|
|
1360
1360
|
* When the number of returned messages is less than the requested limit, pagination stops.
|
|
1361
1361
|
*
|
|
1362
|
-
* @param input - The factory input configuration
|
|
1363
|
-
* @returns A page factory that produces iterable page fetchers
|
|
1362
|
+
* @param input - The factory input configuration.
|
|
1363
|
+
* @returns A page factory that produces iterable page fetchers.
|
|
1364
1364
|
*
|
|
1365
1365
|
* @example
|
|
1366
1366
|
* ```typescript
|
|
@@ -1393,18 +1393,21 @@ function _object_spread_props(target, source) {
|
|
|
1393
1393
|
var _ref, _options_maxItemsPerPage, _ref1;
|
|
1394
1394
|
var _pageResult_result;
|
|
1395
1395
|
var nextCursor = pageResult.nextPageCursor;
|
|
1396
|
-
var effectiveLimit = (_ref = (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.limit) !== null && _ref !== void 0 ? _ref :
|
|
1396
|
+
var effectiveLimit = (_ref = (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.limit) !== null && _ref !== void 0 ? _ref : DEFAULT_DISCORD_MESSAGES_PER_PAGE;
|
|
1397
1397
|
var resultCount = (_ref1 = (_pageResult_result = pageResult.result) === null || _pageResult_result === void 0 ? void 0 : _pageResult_result.data.length) !== null && _ref1 !== void 0 ? _ref1 : 0;
|
|
1398
|
+
var nextInput;
|
|
1398
1399
|
// Discord signals no more results when fewer items than the limit are returned
|
|
1399
1400
|
if (!nextCursor || resultCount < effectiveLimit) {
|
|
1400
|
-
|
|
1401
|
+
nextInput = undefined;
|
|
1402
|
+
} else {
|
|
1403
|
+
nextInput = _object_spread_props(_object_spread({}, input), {
|
|
1404
|
+
before: nextCursor,
|
|
1405
|
+
after: undefined,
|
|
1406
|
+
around: undefined,
|
|
1407
|
+
limit: effectiveLimit
|
|
1408
|
+
});
|
|
1401
1409
|
}
|
|
1402
|
-
return
|
|
1403
|
-
before: nextCursor,
|
|
1404
|
-
after: undefined,
|
|
1405
|
-
around: undefined,
|
|
1406
|
-
limit: effectiveLimit
|
|
1407
|
-
});
|
|
1410
|
+
return nextInput;
|
|
1408
1411
|
}
|
|
1409
1412
|
}));
|
|
1410
1413
|
}
|
|
@@ -1439,7 +1442,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1439
1442
|
*
|
|
1440
1443
|
* Includes Guilds, GuildMessages, and MessageContent intents.
|
|
1441
1444
|
*
|
|
1442
|
-
* @returns
|
|
1445
|
+
* @returns Partial ClientOptions with the default bot intents set.
|
|
1443
1446
|
*
|
|
1444
1447
|
* @example
|
|
1445
1448
|
* ```ts
|
|
@@ -1448,14 +1451,14 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1448
1451
|
* ```
|
|
1449
1452
|
*/ function discordDefaultClientOptions() {
|
|
1450
1453
|
return {
|
|
1451
|
-
intents:
|
|
1454
|
+
intents: DEFAULT_DISCORD_INTENTS
|
|
1452
1455
|
};
|
|
1453
1456
|
}
|
|
1454
1457
|
/**
|
|
1455
1458
|
* Returns ClientOptions with additional intents merged with the defaults.
|
|
1456
1459
|
*
|
|
1457
|
-
* @param additionalIntents -
|
|
1458
|
-
* @returns
|
|
1460
|
+
* @param additionalIntents - Extra intents to include beyond the defaults.
|
|
1461
|
+
* @returns Partial ClientOptions with the merged intent list.
|
|
1459
1462
|
*
|
|
1460
1463
|
* @example
|
|
1461
1464
|
* ```ts
|
|
@@ -1464,8 +1467,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1464
1467
|
* ```
|
|
1465
1468
|
*/ function discordClientOptionsWithIntents(additionalIntents) {
|
|
1466
1469
|
return {
|
|
1467
|
-
intents: _to_consumable_array(
|
|
1470
|
+
intents: _to_consumable_array(DEFAULT_DISCORD_INTENTS).concat(_to_consumable_array(additionalIntents))
|
|
1468
1471
|
};
|
|
1469
1472
|
}
|
|
1470
1473
|
|
|
1471
|
-
export {
|
|
1474
|
+
export { DEFAULT_DISCORD_INTENTS, DEFAULT_DISCORD_MESSAGES_PER_PAGE, DISCORD_BOT_TOKEN_ENV_VAR, DISCORD_ED25519_PUBLIC_KEY_BYTE_LENGTH, DISCORD_PUBLIC_KEY_ENV_VAR, DiscordApi, DiscordModule, DiscordServiceConfig, DiscordWebhookController, DiscordWebhookModule, DiscordWebhookService, DiscordWebhookServiceConfig, discordClientOptionsWithIntents, discordDefaultClientOptions, discordFetchMessagePageFactory, discordInteractionHandlerConfigurerFactory, discordInteractionHandlerFactory, discordServiceConfigFactory, discordWebhookEventVerifier, discordWebhookInteraction, discordWebhookServiceConfigFactory };
|
package/discord/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/discord",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.15",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/nestjs": "13.11.
|
|
6
|
-
"@dereekb/rxjs": "13.11.
|
|
7
|
-
"@dereekb/util": "13.11.
|
|
5
|
+
"@dereekb/nestjs": "13.11.15",
|
|
6
|
+
"@dereekb/rxjs": "13.11.15",
|
|
7
|
+
"@dereekb/util": "13.11.15",
|
|
8
8
|
"@nestjs/common": "^11.1.19",
|
|
9
9
|
"@nestjs/config": "^4.0.4",
|
|
10
10
|
"discord.js": "^14.26.3",
|
|
@@ -34,10 +34,10 @@ export declare class DiscordApi implements OnModuleInit, OnModuleDestroy {
|
|
|
34
34
|
/**
|
|
35
35
|
* Sends a text message to the specified Discord channel.
|
|
36
36
|
*
|
|
37
|
-
* @param channelId -
|
|
38
|
-
* @param content -
|
|
39
|
-
* @returns
|
|
40
|
-
* @throws {Error}
|
|
37
|
+
* @param channelId - Target channel's snowflake ID.
|
|
38
|
+
* @param content - Message text to send.
|
|
39
|
+
* @returns The sent Discord Message.
|
|
40
|
+
* @throws {Error} When the channel is not found or is not a text channel.
|
|
41
41
|
*/
|
|
42
42
|
sendMessage(channelId: DiscordChannelId, content: string): Promise<Message>;
|
|
43
43
|
/**
|
|
@@ -62,8 +62,8 @@ export declare class DiscordApi implements OnModuleInit, OnModuleDestroy {
|
|
|
62
62
|
/**
|
|
63
63
|
* Registers a handler for incoming Discord messages (MessageCreate event).
|
|
64
64
|
*
|
|
65
|
-
* @param handler -
|
|
66
|
-
* @returns
|
|
65
|
+
* @param handler - Callback invoked for each incoming Message.
|
|
66
|
+
* @returns An unsubscribe function that removes the registered handler.
|
|
67
67
|
*/
|
|
68
68
|
onMessage(handler: (message: Message) => void): () => void;
|
|
69
69
|
}
|
|
@@ -4,7 +4,7 @@ import { type DiscordMessageId } from './discord.type';
|
|
|
4
4
|
/**
|
|
5
5
|
* Default number of messages per page when fetching Discord channel messages.
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const DEFAULT_DISCORD_MESSAGES_PER_PAGE = 100;
|
|
8
8
|
/**
|
|
9
9
|
* Base pagination parameters for Discord channel message endpoints.
|
|
10
10
|
*
|
|
@@ -27,7 +27,7 @@ export interface DiscordMessagePageFilter {
|
|
|
27
27
|
/**
|
|
28
28
|
* Maximum number of messages to return per page (1-100).
|
|
29
29
|
*
|
|
30
|
-
* Defaults to {@link
|
|
30
|
+
* Defaults to {@link DEFAULT_DISCORD_MESSAGES_PER_PAGE}.
|
|
31
31
|
*/
|
|
32
32
|
readonly limit?: Maybe<number>;
|
|
33
33
|
}
|
|
@@ -87,8 +87,8 @@ export interface DiscordFetchMessagePageFactoryInput<I extends DiscordMessagePag
|
|
|
87
87
|
* message's ID from each response and sets it as the `before` cursor for the next request.
|
|
88
88
|
* When the number of returned messages is less than the requested limit, pagination stops.
|
|
89
89
|
*
|
|
90
|
-
* @param input - The factory input configuration
|
|
91
|
-
* @returns A page factory that produces iterable page fetchers
|
|
90
|
+
* @param input - The factory input configuration.
|
|
91
|
+
* @returns A page factory that produces iterable page fetchers.
|
|
92
92
|
*
|
|
93
93
|
* @example
|
|
94
94
|
* ```typescript
|
|
@@ -10,14 +10,14 @@ export declare const DISCORD_BOT_TOKEN_ENV_VAR = "DISCORD_BOT_TOKEN";
|
|
|
10
10
|
* Includes Guilds, GuildMessages, and MessageContent.
|
|
11
11
|
* Note: MessageContent is a privileged intent and must be enabled in the Discord Developer Portal.
|
|
12
12
|
*/
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const DEFAULT_DISCORD_INTENTS: GatewayIntentBits[];
|
|
14
14
|
export interface DiscordServiceApiConfig {
|
|
15
15
|
/**
|
|
16
16
|
* The bot token used to authenticate with the Discord gateway.
|
|
17
17
|
*/
|
|
18
18
|
readonly botToken: DiscordBotToken;
|
|
19
19
|
/**
|
|
20
|
-
* discord.js Client options. Intents default to
|
|
20
|
+
* discord.js Client options. Intents default to DEFAULT_DISCORD_INTENTS if not provided.
|
|
21
21
|
*/
|
|
22
22
|
readonly clientOptions?: Partial<ClientOptions>;
|
|
23
23
|
/**
|
|
@@ -3,8 +3,8 @@ import { DiscordServiceConfig } from './discord.config';
|
|
|
3
3
|
/**
|
|
4
4
|
* Factory that creates a DiscordServiceConfig from environment variables.
|
|
5
5
|
*
|
|
6
|
-
* @param configService -
|
|
7
|
-
* @returns
|
|
6
|
+
* @param configService - The NestJS config service used to read Discord environment variables.
|
|
7
|
+
* @returns A validated DiscordServiceConfig populated from environment variables.
|
|
8
8
|
*/
|
|
9
9
|
export declare function discordServiceConfigFactory(configService: ConfigService): DiscordServiceConfig;
|
|
10
10
|
/**
|
|
@@ -4,7 +4,7 @@ import { type GatewayIntentBits, type ClientOptions } from 'discord.js';
|
|
|
4
4
|
*
|
|
5
5
|
* Includes Guilds, GuildMessages, and MessageContent intents.
|
|
6
6
|
*
|
|
7
|
-
* @returns
|
|
7
|
+
* @returns Partial ClientOptions with the default bot intents set.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
@@ -16,8 +16,8 @@ export declare function discordDefaultClientOptions(): Partial<ClientOptions>;
|
|
|
16
16
|
/**
|
|
17
17
|
* Returns ClientOptions with additional intents merged with the defaults.
|
|
18
18
|
*
|
|
19
|
-
* @param additionalIntents -
|
|
20
|
-
* @returns
|
|
19
|
+
* @param additionalIntents - Extra intents to include beyond the defaults.
|
|
20
|
+
* @returns Partial ClientOptions with the merged intent list.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
@@ -20,8 +20,8 @@ export type DiscordWebhookInteraction<T extends Interaction = Interaction> = T;
|
|
|
20
20
|
/**
|
|
21
21
|
* Casts an untyped Discord interaction to a typed one.
|
|
22
22
|
*
|
|
23
|
-
* @param interaction -
|
|
24
|
-
* @returns
|
|
23
|
+
* @param interaction - The raw interaction to cast.
|
|
24
|
+
* @returns The interaction cast to the specified typed DiscordWebhookInteraction.
|
|
25
25
|
*/
|
|
26
26
|
export declare function discordWebhookInteraction<T extends Interaction = Interaction>(interaction: UntypedDiscordInteraction): DiscordWebhookInteraction<T>;
|
|
27
27
|
export type DiscordInteractionHandler = Handler<UntypedDiscordInteraction, DiscordInteractionType>;
|
|
@@ -3,8 +3,8 @@ import { DiscordWebhookServiceConfig } from './webhook.discord.config';
|
|
|
3
3
|
/**
|
|
4
4
|
* Factory that creates a DiscordWebhookServiceConfig from environment variables.
|
|
5
5
|
*
|
|
6
|
-
* @param configService -
|
|
7
|
-
* @returns
|
|
6
|
+
* @param configService - The NestJS config service used to read the Discord public key environment variable.
|
|
7
|
+
* @returns A validated DiscordWebhookServiceConfig populated from environment variables.
|
|
8
8
|
*/
|
|
9
9
|
export declare function discordWebhookServiceConfigFactory(configService: ConfigService): DiscordWebhookServiceConfig;
|
|
10
10
|
/**
|
|
@@ -30,8 +30,8 @@ export type DiscordWebhookEventVerifier = (req: Request, rawBody: Buffer) => Pro
|
|
|
30
30
|
*
|
|
31
31
|
* Uses Node.js built-in crypto with JWK key import — no external dependencies required.
|
|
32
32
|
*
|
|
33
|
-
* @param config -
|
|
34
|
-
* @returns
|
|
33
|
+
* @param config - Verification config containing the application's public key.
|
|
34
|
+
* @returns A DiscordWebhookEventVerifier function that validates Ed25519-signed requests.
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* ```ts
|