@fluxerjs/util 1.2.4 → 1.3.1

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/dist/index.d.mts CHANGED
@@ -362,4 +362,46 @@ declare function resolveTenorToImageUrl(tenorViewUrl: string): Promise<TenorMedi
362
362
 
363
363
  declare function emitDeprecationWarning(symbol: string, message: string): void;
364
364
 
365
- export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, FLUXER_EPOCH, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parsePrefixCommand, parseRoleMention, parseUserMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };
365
+ interface FluxerErrorOptions {
366
+ code?: string;
367
+ cause?: Error;
368
+ }
369
+ declare class FluxerError extends Error {
370
+ readonly code?: string;
371
+ constructor(message: string, options?: FluxerErrorOptions);
372
+ }
373
+
374
+ declare const ErrorCodes: {
375
+ readonly ClientNotReady: "CLIENT_NOT_READY";
376
+ readonly NotLoggedIn: "NOT_LOGGED_IN";
377
+ readonly InvalidToken: "INVALID_TOKEN";
378
+ readonly AlreadyLoggedIn: "ALREADY_LOGGED_IN";
379
+ readonly ChannelNotFound: "CHANNEL_NOT_FOUND";
380
+ readonly MessageNotFound: "MESSAGE_NOT_FOUND";
381
+ readonly GuildNotFound: "GUILD_NOT_FOUND";
382
+ readonly MemberNotFound: "MEMBER_NOT_FOUND";
383
+ readonly RoleNotFound: "ROLE_NOT_FOUND";
384
+ readonly EmojiNotInGuild: "EMOJI_NOT_IN_GUILD";
385
+ readonly EmojiNotFound: "EMOJI_NOT_FOUND";
386
+ readonly InvalidEmoji: "INVALID_EMOJI";
387
+ readonly EmojiRequiresGuild: "EMOJI_REQUIRES_GUILD";
388
+ readonly WebhookTokenRequired: "WEBHOOK_TOKEN_REQUIRED";
389
+ readonly InvalidInvite: "INVALID_INVITE";
390
+ readonly InvalidFileUrl: "INVALID_FILE_URL";
391
+ readonly FileFetchFailed: "FILE_FETCH_FAILED";
392
+ readonly InvalidAttachment: "INVALID_ATTACHMENT";
393
+ readonly WebSocketLoadFailed: "WEBSOCKET_LOAD_FAILED";
394
+ readonly GatewayConnectionAborted: "GATEWAY_CONNECTION_ABORTED";
395
+ readonly GatewayFetchFailed: "GATEWAY_FETCH_FAILED";
396
+ readonly AttachmentFilenameRequired: "ATTACHMENT_FILENAME_REQUIRED";
397
+ readonly InvalidEmbedMediaUrl: "INVALID_EMBED_MEDIA_URL";
398
+ readonly InvalidEmbedUrl: "INVALID_EMBED_URL";
399
+ readonly VoiceWebSocketRequired: "VOICE_WEBSOCKET_REQUIRED";
400
+ readonly VoiceHttpError: "VOICE_HTTP_ERROR";
401
+ readonly VoiceNoResponseBody: "VOICE_NO_RESPONSE_BODY";
402
+ readonly InteractionOptionNotFound: "INTERACTION_OPTION_NOT_FOUND";
403
+ readonly InteractionOptionTypeMismatch: "INTERACTION_OPTION_TYPE_MISMATCH";
404
+ readonly InteractionInvalidPayload: "INTERACTION_INVALID_PAYLOAD";
405
+ };
406
+
407
+ export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, ErrorCodes, FLUXER_EPOCH, FluxerError, type FluxerErrorOptions, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parsePrefixCommand, parseRoleMention, parseUserMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };
package/dist/index.d.ts CHANGED
@@ -362,4 +362,46 @@ declare function resolveTenorToImageUrl(tenorViewUrl: string): Promise<TenorMedi
362
362
 
363
363
  declare function emitDeprecationWarning(symbol: string, message: string): void;
364
364
 
365
- export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, FLUXER_EPOCH, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parsePrefixCommand, parseRoleMention, parseUserMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };
365
+ interface FluxerErrorOptions {
366
+ code?: string;
367
+ cause?: Error;
368
+ }
369
+ declare class FluxerError extends Error {
370
+ readonly code?: string;
371
+ constructor(message: string, options?: FluxerErrorOptions);
372
+ }
373
+
374
+ declare const ErrorCodes: {
375
+ readonly ClientNotReady: "CLIENT_NOT_READY";
376
+ readonly NotLoggedIn: "NOT_LOGGED_IN";
377
+ readonly InvalidToken: "INVALID_TOKEN";
378
+ readonly AlreadyLoggedIn: "ALREADY_LOGGED_IN";
379
+ readonly ChannelNotFound: "CHANNEL_NOT_FOUND";
380
+ readonly MessageNotFound: "MESSAGE_NOT_FOUND";
381
+ readonly GuildNotFound: "GUILD_NOT_FOUND";
382
+ readonly MemberNotFound: "MEMBER_NOT_FOUND";
383
+ readonly RoleNotFound: "ROLE_NOT_FOUND";
384
+ readonly EmojiNotInGuild: "EMOJI_NOT_IN_GUILD";
385
+ readonly EmojiNotFound: "EMOJI_NOT_FOUND";
386
+ readonly InvalidEmoji: "INVALID_EMOJI";
387
+ readonly EmojiRequiresGuild: "EMOJI_REQUIRES_GUILD";
388
+ readonly WebhookTokenRequired: "WEBHOOK_TOKEN_REQUIRED";
389
+ readonly InvalidInvite: "INVALID_INVITE";
390
+ readonly InvalidFileUrl: "INVALID_FILE_URL";
391
+ readonly FileFetchFailed: "FILE_FETCH_FAILED";
392
+ readonly InvalidAttachment: "INVALID_ATTACHMENT";
393
+ readonly WebSocketLoadFailed: "WEBSOCKET_LOAD_FAILED";
394
+ readonly GatewayConnectionAborted: "GATEWAY_CONNECTION_ABORTED";
395
+ readonly GatewayFetchFailed: "GATEWAY_FETCH_FAILED";
396
+ readonly AttachmentFilenameRequired: "ATTACHMENT_FILENAME_REQUIRED";
397
+ readonly InvalidEmbedMediaUrl: "INVALID_EMBED_MEDIA_URL";
398
+ readonly InvalidEmbedUrl: "INVALID_EMBED_URL";
399
+ readonly VoiceWebSocketRequired: "VOICE_WEBSOCKET_REQUIRED";
400
+ readonly VoiceHttpError: "VOICE_HTTP_ERROR";
401
+ readonly VoiceNoResponseBody: "VOICE_NO_RESPONSE_BODY";
402
+ readonly InteractionOptionNotFound: "INTERACTION_OPTION_NOT_FOUND";
403
+ readonly InteractionOptionTypeMismatch: "INTERACTION_OPTION_TYPE_MISMATCH";
404
+ readonly InteractionInvalidPayload: "INTERACTION_INVALID_PAYLOAD";
405
+ };
406
+
407
+ export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, ErrorCodes, FLUXER_EPOCH, FluxerError, type FluxerErrorOptions, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parsePrefixCommand, parseRoleMention, parseUserMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };
package/dist/index.js CHANGED
@@ -22,7 +22,9 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  ALL_PERMISSIONS_BIGINT: () => ALL_PERMISSIONS_BIGINT,
24
24
  BitField: () => BitField,
25
+ ErrorCodes: () => ErrorCodes,
25
26
  FLUXER_EPOCH: () => FLUXER_EPOCH,
27
+ FluxerError: () => FluxerError,
26
28
  MessageFlagsBitField: () => MessageFlagsBitField,
27
29
  MessageFlagsBits: () => MessageFlagsBits,
28
30
  PermissionFlags: () => PermissionFlags,
@@ -472,11 +474,58 @@ function emitDeprecationWarning(symbol, message) {
472
474
  warned.add(symbol);
473
475
  console.warn(`[Fluxer] DeprecationWarning: ${symbol} is deprecated. ${message}`);
474
476
  }
477
+
478
+ // src/errors/FluxerError.ts
479
+ var FluxerError = class _FluxerError extends Error {
480
+ code;
481
+ constructor(message, options) {
482
+ super(message, options?.cause ? { cause: options.cause } : void 0);
483
+ this.name = "FluxerError";
484
+ this.code = options?.code;
485
+ Object.setPrototypeOf(this, _FluxerError.prototype);
486
+ }
487
+ };
488
+
489
+ // src/errors/ErrorCodes.ts
490
+ var ErrorCodes = {
491
+ ClientNotReady: "CLIENT_NOT_READY",
492
+ NotLoggedIn: "NOT_LOGGED_IN",
493
+ InvalidToken: "INVALID_TOKEN",
494
+ AlreadyLoggedIn: "ALREADY_LOGGED_IN",
495
+ ChannelNotFound: "CHANNEL_NOT_FOUND",
496
+ MessageNotFound: "MESSAGE_NOT_FOUND",
497
+ GuildNotFound: "GUILD_NOT_FOUND",
498
+ MemberNotFound: "MEMBER_NOT_FOUND",
499
+ RoleNotFound: "ROLE_NOT_FOUND",
500
+ EmojiNotInGuild: "EMOJI_NOT_IN_GUILD",
501
+ EmojiNotFound: "EMOJI_NOT_FOUND",
502
+ InvalidEmoji: "INVALID_EMOJI",
503
+ EmojiRequiresGuild: "EMOJI_REQUIRES_GUILD",
504
+ WebhookTokenRequired: "WEBHOOK_TOKEN_REQUIRED",
505
+ InvalidInvite: "INVALID_INVITE",
506
+ InvalidFileUrl: "INVALID_FILE_URL",
507
+ FileFetchFailed: "FILE_FETCH_FAILED",
508
+ InvalidAttachment: "INVALID_ATTACHMENT",
509
+ WebSocketLoadFailed: "WEBSOCKET_LOAD_FAILED",
510
+ GatewayConnectionAborted: "GATEWAY_CONNECTION_ABORTED",
511
+ GatewayFetchFailed: "GATEWAY_FETCH_FAILED",
512
+ AttachmentFilenameRequired: "ATTACHMENT_FILENAME_REQUIRED",
513
+ InvalidEmbedMediaUrl: "INVALID_EMBED_MEDIA_URL",
514
+ InvalidEmbedUrl: "INVALID_EMBED_URL",
515
+ VoiceWebSocketRequired: "VOICE_WEBSOCKET_REQUIRED",
516
+ VoiceHttpError: "VOICE_HTTP_ERROR",
517
+ VoiceNoResponseBody: "VOICE_NO_RESPONSE_BODY",
518
+ InteractionOptionNotFound: "INTERACTION_OPTION_NOT_FOUND",
519
+ InteractionOptionTypeMismatch: "INTERACTION_OPTION_TYPE_MISMATCH",
520
+ InteractionInvalidPayload: "INTERACTION_INVALID_PAYLOAD"
521
+ };
475
522
  // Annotate the CommonJS export names for ESM import in node:
476
523
  0 && (module.exports = {
477
524
  ALL_PERMISSIONS_BIGINT,
478
525
  BitField,
526
+ ErrorCodes,
479
527
  FLUXER_EPOCH,
528
+ FluxerError,
480
529
  MessageFlagsBitField,
481
530
  MessageFlagsBits,
482
531
  PermissionFlags,
package/dist/index.mjs CHANGED
@@ -423,10 +423,57 @@ function emitDeprecationWarning(symbol, message) {
423
423
  warned.add(symbol);
424
424
  console.warn(`[Fluxer] DeprecationWarning: ${symbol} is deprecated. ${message}`);
425
425
  }
426
+
427
+ // src/errors/FluxerError.ts
428
+ var FluxerError = class _FluxerError extends Error {
429
+ code;
430
+ constructor(message, options) {
431
+ super(message, options?.cause ? { cause: options.cause } : void 0);
432
+ this.name = "FluxerError";
433
+ this.code = options?.code;
434
+ Object.setPrototypeOf(this, _FluxerError.prototype);
435
+ }
436
+ };
437
+
438
+ // src/errors/ErrorCodes.ts
439
+ var ErrorCodes = {
440
+ ClientNotReady: "CLIENT_NOT_READY",
441
+ NotLoggedIn: "NOT_LOGGED_IN",
442
+ InvalidToken: "INVALID_TOKEN",
443
+ AlreadyLoggedIn: "ALREADY_LOGGED_IN",
444
+ ChannelNotFound: "CHANNEL_NOT_FOUND",
445
+ MessageNotFound: "MESSAGE_NOT_FOUND",
446
+ GuildNotFound: "GUILD_NOT_FOUND",
447
+ MemberNotFound: "MEMBER_NOT_FOUND",
448
+ RoleNotFound: "ROLE_NOT_FOUND",
449
+ EmojiNotInGuild: "EMOJI_NOT_IN_GUILD",
450
+ EmojiNotFound: "EMOJI_NOT_FOUND",
451
+ InvalidEmoji: "INVALID_EMOJI",
452
+ EmojiRequiresGuild: "EMOJI_REQUIRES_GUILD",
453
+ WebhookTokenRequired: "WEBHOOK_TOKEN_REQUIRED",
454
+ InvalidInvite: "INVALID_INVITE",
455
+ InvalidFileUrl: "INVALID_FILE_URL",
456
+ FileFetchFailed: "FILE_FETCH_FAILED",
457
+ InvalidAttachment: "INVALID_ATTACHMENT",
458
+ WebSocketLoadFailed: "WEBSOCKET_LOAD_FAILED",
459
+ GatewayConnectionAborted: "GATEWAY_CONNECTION_ABORTED",
460
+ GatewayFetchFailed: "GATEWAY_FETCH_FAILED",
461
+ AttachmentFilenameRequired: "ATTACHMENT_FILENAME_REQUIRED",
462
+ InvalidEmbedMediaUrl: "INVALID_EMBED_MEDIA_URL",
463
+ InvalidEmbedUrl: "INVALID_EMBED_URL",
464
+ VoiceWebSocketRequired: "VOICE_WEBSOCKET_REQUIRED",
465
+ VoiceHttpError: "VOICE_HTTP_ERROR",
466
+ VoiceNoResponseBody: "VOICE_NO_RESPONSE_BODY",
467
+ InteractionOptionNotFound: "INTERACTION_OPTION_NOT_FOUND",
468
+ InteractionOptionTypeMismatch: "INTERACTION_OPTION_TYPE_MISMATCH",
469
+ InteractionInvalidPayload: "INTERACTION_INVALID_PAYLOAD"
470
+ };
426
471
  export {
427
472
  ALL_PERMISSIONS_BIGINT,
428
473
  BitField,
474
+ ErrorCodes,
429
475
  FLUXER_EPOCH,
476
+ FluxerError,
430
477
  MessageFlagsBitField,
431
478
  MessageFlagsBits,
432
479
  PermissionFlags,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.2.4",
6
+ "version": "1.3.1",
7
7
  "description": "Shared utilities for @fluxerjs/core",
8
8
  "repository": {
9
9
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@fluxerjs/types": "1.2.4"
23
+ "@fluxerjs/types": "1.3.1"
24
24
  },
25
25
  "main": "./dist/index.js",
26
26
  "module": "./dist/index.mjs",