tiny-essentials 1.2.1 → 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.
Files changed (145) hide show
  1. package/README.md +3 -3
  2. package/dist/TinyEssentials.js +2375 -77105
  3. package/dist/TinyEssentials.min.js +1 -1
  4. package/dist/TinyEssentials.min.js.LICENSE.txt +0 -2
  5. package/dist/TinyLevelUp.js +16 -8
  6. package/dist/legacy/firebase/cookieSession.cjs +1 -1
  7. package/dist/legacy/firebase/cookieSession.d.mts +2 -2
  8. package/dist/legacy/firebase/cookieSession.mjs +1 -1
  9. package/dist/legacy/firebase/databaseLogger.cjs +5 -5
  10. package/dist/legacy/firebase/databaseLogger.d.mts +2 -2
  11. package/dist/legacy/firebase/databaseLogger.mjs +5 -5
  12. package/dist/legacy/firebase/discord/api/addGuildMember.cjs +2 -2
  13. package/dist/legacy/firebase/discord/api/addGuildMember.d.mts +3 -3
  14. package/dist/legacy/firebase/discord/api/addGuildMember.mjs +2 -2
  15. package/dist/legacy/firebase/discord/api/getGuildWidget.cjs +2 -2
  16. package/dist/legacy/firebase/discord/api/getGuildWidget.d.mts +3 -3
  17. package/dist/legacy/firebase/discord/api/getGuildWidget.mjs +2 -2
  18. package/dist/legacy/firebase/discord/api/getToken.cjs +2 -2
  19. package/dist/legacy/firebase/discord/api/getToken.d.mts +3 -3
  20. package/dist/legacy/firebase/discord/api/getToken.mjs +2 -2
  21. package/dist/legacy/firebase/discord/api/getUser.cjs +2 -2
  22. package/dist/legacy/firebase/discord/api/getUser.d.mts +3 -3
  23. package/dist/legacy/firebase/discord/api/getUser.mjs +2 -2
  24. package/dist/legacy/firebase/discord/api/getUserConnections.cjs +2 -2
  25. package/dist/legacy/firebase/discord/api/getUserConnections.d.mts +3 -3
  26. package/dist/legacy/firebase/discord/api/getUserConnections.mjs +2 -2
  27. package/dist/legacy/firebase/discord/api/getUserGuilds.cjs +2 -2
  28. package/dist/legacy/firebase/discord/api/getUserGuilds.d.mts +3 -3
  29. package/dist/legacy/firebase/discord/api/getUserGuilds.mjs +2 -2
  30. package/dist/legacy/firebase/discord/api/refreshToken.cjs +2 -2
  31. package/dist/legacy/firebase/discord/api/refreshToken.d.mts +3 -3
  32. package/dist/legacy/firebase/discord/api/refreshToken.mjs +2 -2
  33. package/dist/legacy/firebase/discord/api/revokeToken.cjs +2 -2
  34. package/dist/legacy/firebase/discord/api/revokeToken.d.mts +3 -3
  35. package/dist/legacy/firebase/discord/api/revokeToken.mjs +2 -2
  36. package/dist/legacy/firebase/discord/get/authURLGenerator.cjs +3 -3
  37. package/dist/legacy/firebase/discord/get/authURLGenerator.d.mts +4 -4
  38. package/dist/legacy/firebase/discord/get/authURLGenerator.mjs +3 -3
  39. package/dist/legacy/firebase/discord/get/cookie-session.cjs +1 -1
  40. package/dist/legacy/firebase/discord/get/cookie-session.d.mts +2 -2
  41. package/dist/legacy/firebase/discord/get/cookie-session.mjs +1 -1
  42. package/dist/legacy/firebase/discord/get/errorValidator.cjs +1 -1
  43. package/dist/legacy/firebase/discord/get/errorValidator.d.mts +2 -2
  44. package/dist/legacy/firebase/discord/get/errorValidator.mjs +1 -1
  45. package/dist/legacy/firebase/discord/http/login.cjs +3 -3
  46. package/dist/legacy/firebase/discord/http/login.d.mts +4 -4
  47. package/dist/legacy/firebase/discord/http/login.mjs +3 -3
  48. package/dist/legacy/firebase/discord/http/logout.cjs +4 -4
  49. package/dist/legacy/firebase/discord/http/logout.d.mts +5 -5
  50. package/dist/legacy/firebase/discord/http/logout.mjs +4 -4
  51. package/dist/legacy/firebase/discord/http/redirect.cjs +4 -4
  52. package/dist/legacy/firebase/discord/http/redirect.d.mts +5 -5
  53. package/dist/legacy/firebase/discord/http/redirect.mjs +4 -4
  54. package/dist/legacy/firebase/discord/http/refreshToken.cjs +4 -4
  55. package/dist/legacy/firebase/discord/http/refreshToken.d.mts +5 -5
  56. package/dist/legacy/firebase/discord/http/refreshToken.mjs +4 -4
  57. package/dist/legacy/firebase/discord/template/cookie-session.cjs +2 -2
  58. package/dist/legacy/firebase/discord/template/cookie-session.d.mts +5 -5
  59. package/dist/legacy/firebase/discord/template/cookie-session.mjs +2 -2
  60. package/dist/legacy/firebase/escape.cjs +1 -1
  61. package/dist/legacy/firebase/escape.d.mts +2 -2
  62. package/dist/legacy/firebase/escape.mjs +1 -1
  63. package/dist/legacy/firebase/index.cjs +6 -6
  64. package/dist/legacy/firebase/index.d.mts +7 -7
  65. package/dist/legacy/firebase/index.mjs +6 -6
  66. package/dist/legacy/firebase/logger.cjs +5 -5
  67. package/dist/legacy/firebase/logger.d.mts +4 -4
  68. package/dist/legacy/firebase/logger.mjs +5 -5
  69. package/dist/legacy/firebase/mySQL.cjs +2 -2
  70. package/dist/legacy/firebase/mySQL.d.mts +3 -3
  71. package/dist/legacy/firebase/mySQL.mjs +2 -2
  72. package/dist/legacy/firebase/mysqlConnector/create.cjs +4 -4
  73. package/dist/legacy/firebase/mysqlConnector/create.d.mts +5 -5
  74. package/dist/legacy/firebase/mysqlConnector/create.mjs +4 -4
  75. package/dist/legacy/firebase/mysqlConnector/nextPrev.cjs +2 -2
  76. package/dist/legacy/firebase/mysqlConnector/nextPrev.d.mts +4 -4
  77. package/dist/legacy/firebase/mysqlConnector/nextPrev.mjs +2 -2
  78. package/dist/legacy/firebase/mysqlConnector/pagination.cjs +4 -4
  79. package/dist/legacy/firebase/mysqlConnector/pagination.d.mts +6 -6
  80. package/dist/legacy/firebase/mysqlConnector/pagination.mjs +4 -4
  81. package/dist/legacy/firebase/transactionDBAsync.cjs +1 -1
  82. package/dist/legacy/firebase/transactionDBAsync.d.mts +2 -2
  83. package/dist/legacy/firebase/transactionDBAsync.mjs +1 -1
  84. package/dist/legacy/get/pagination.cjs +1 -1
  85. package/dist/legacy/get/pagination.d.mts +2 -2
  86. package/dist/legacy/get/pagination.mjs +1 -1
  87. package/dist/legacy/get/versionCheck.cjs +1 -1
  88. package/dist/legacy/get/versionCheck.d.mts +2 -2
  89. package/dist/legacy/get/versionCheck.mjs +1 -1
  90. package/dist/legacy/http/check_domain.cjs +2 -2
  91. package/dist/legacy/http/check_domain.d.mts +2 -2
  92. package/dist/legacy/http/check_domain.mjs +2 -2
  93. package/dist/legacy/http/csrfTokenAnalyze.cjs +2 -2
  94. package/dist/legacy/http/csrfTokenAnalyze.d.mts +3 -3
  95. package/dist/legacy/http/csrfTokenAnalyze.mjs +2 -2
  96. package/dist/legacy/http/domainValidator.cjs +3 -3
  97. package/dist/legacy/http/domainValidator.d.mts +4 -4
  98. package/dist/legacy/http/domainValidator.mjs +3 -3
  99. package/dist/legacy/http/userIP.cjs +1 -1
  100. package/dist/legacy/http/userIP.d.mts +2 -4
  101. package/dist/legacy/http/userIP.mjs +1 -1
  102. package/dist/legacy/index.d.mts +4 -4
  103. package/dist/legacy/libs/custom_module_loader.cjs +2 -2
  104. package/dist/legacy/libs/custom_module_loader.d.mts +2 -2
  105. package/dist/legacy/libs/custom_module_loader.mjs +2 -2
  106. package/dist/legacy/libs/userLevel.cjs +16 -8
  107. package/dist/legacy/libs/userLevel.d.mts +34 -12
  108. package/dist/legacy/libs/userLevel.mjs +14 -8
  109. package/dist/legacy/socket.io/antiFlood/install.cjs +3 -3
  110. package/dist/legacy/socket.io/antiFlood/install.d.mts +4 -6
  111. package/dist/legacy/socket.io/antiFlood/install.mjs +3 -3
  112. package/dist/legacy/socket.io/antiFlood/verify.cjs +4 -4
  113. package/dist/legacy/socket.io/antiFlood/verify.d.mts +5 -7
  114. package/dist/legacy/socket.io/antiFlood/verify.mjs +4 -4
  115. package/dist/legacy/socket.io/cookie-session.cjs +2 -2
  116. package/dist/legacy/socket.io/cookie-session.d.mts +3 -3
  117. package/dist/legacy/socket.io/cookie-session.mjs +2 -2
  118. package/dist/legacy/socket.io/discord.cjs +3 -3
  119. package/dist/legacy/socket.io/discord.d.mts +4 -4
  120. package/dist/legacy/socket.io/discord.mjs +3 -3
  121. package/dist/v1/index.cjs +0 -4
  122. package/dist/v1/index.d.mts +1 -3
  123. package/dist/v1/index.mjs +1 -3
  124. package/docs/README.md +1 -11
  125. package/package.json +2 -5
  126. package/dist/TinyCertCrypto.js +0 -31364
  127. package/dist/TinyCertCrypto.min.js +0 -2
  128. package/dist/TinyCertCrypto.min.js.LICENSE.txt +0 -8
  129. package/dist/TinyCrypto.js +0 -48138
  130. package/dist/TinyCrypto.min.js +0 -2
  131. package/dist/TinyCrypto.min.js.LICENSE.txt +0 -10
  132. package/dist/v1/build/TinyCertCrypto.cjs +0 -7
  133. package/dist/v1/build/TinyCertCrypto.d.mts +0 -2
  134. package/dist/v1/build/TinyCertCrypto.mjs +0 -2
  135. package/dist/v1/build/TinyCrypto.cjs +0 -7
  136. package/dist/v1/build/TinyCrypto.d.mts +0 -2
  137. package/dist/v1/build/TinyCrypto.mjs +0 -2
  138. package/dist/v1/libs/TinyCertCrypto.cjs +0 -573
  139. package/dist/v1/libs/TinyCertCrypto.d.mts +0 -193
  140. package/dist/v1/libs/TinyCertCrypto.mjs +0 -481
  141. package/dist/v1/libs/TinyCrypto.cjs +0 -640
  142. package/dist/v1/libs/TinyCrypto.d.mts +0 -306
  143. package/dist/v1/libs/TinyCrypto.mjs +0 -597
  144. package/docs/libs/TinyCertCrypto.md +0 -202
  145. package/docs/libs/TinyCrypto.md +0 -177
@@ -6,5 +6,3 @@
6
6
  */
7
7
 
8
8
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
-
10
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -44,10 +44,18 @@ class TinyLevelUp {
44
44
  this.expLevel = expLevel;
45
45
  }
46
46
 
47
+ /**
48
+ * @typedef {{ exp: number, level: number, totalExp: number }} UserResult
49
+ */
50
+
51
+ /**
52
+ * @typedef {{ exp: number, level: number, totalExp: any }} UserEditor
53
+ */
54
+
47
55
  /**
48
56
  * Validates and adjusts the user's level based on their current experience.
49
- * @param {{ exp: number, level: number, totalExp: any }} user - The user object containing experience and level properties.
50
- * @returns {Object} The updated user object.
57
+ * @param {UserEditor} user - The user object containing experience and level properties.
58
+ * @returns {UserResult} The updated user object.
51
59
  */
52
60
  expValidator(user) {
53
61
  let extraValue = 0;
@@ -115,9 +123,9 @@ class TinyLevelUp {
115
123
 
116
124
  /**
117
125
  * Sets the experience value for the user, adjusting their level if necessary.
118
- * @param {{ exp: number, level: number, totalExp: any }} user - The user object.
126
+ * @param {UserEditor} user - The user object.
119
127
  * @param {number} value - The new experience value to set.
120
- * @returns {Object} The updated user object.
128
+ * @returns {UserResult} The updated user object.
121
129
  */
122
130
  set(user, value) {
123
131
  user.exp = value;
@@ -128,11 +136,11 @@ class TinyLevelUp {
128
136
 
129
137
  /**
130
138
  * Adds experience to the user, adjusting their level if necessary.
131
- * @param {{ exp: number, level: number, totalExp: any }} user - The user object.
139
+ * @param {UserEditor} user - The user object.
132
140
  * @param {number} extraExp - Additional experience to be added.
133
141
  * @param {'add' | 'extra'} type - Type of addition ('add' or 'extra').
134
142
  * @param {number} multi - Multiplier for experience generation.
135
- * @returns {Object} The updated user object.
143
+ * @returns {UserResult} The updated user object.
136
144
  */
137
145
  give(user, extraExp = 0, type = 'add', multi = 1) {
138
146
  if (type === 'add') user.exp += this.expGenerator(multi) + extraExp;
@@ -145,11 +153,11 @@ class TinyLevelUp {
145
153
 
146
154
  /**
147
155
  * Removes experience from the user, adjusting their level if necessary.
148
- * @param {{ exp: number, level: number, totalExp: any }} user - The user object.
156
+ * @param {UserEditor} user - The user object.
149
157
  * @param {number} extraExp - Experience to remove.
150
158
  * @param {'add' | 'extra'} type - Type of removal ('add' or 'extra').
151
159
  * @param {number} multi - Multiplier for experience generation.
152
- * @returns {Object} The updated user object.
160
+ * @returns {UserResult} The updated user object.
153
161
  */
154
162
  remove(user, extraExp = 0, type = 'add', multi = 1) {
155
163
  if (type === 'add') user.exp -= this.expGenerator(multi) + extraExp;
@@ -85,7 +85,7 @@ class AuthSystem {
85
85
  /**
86
86
  * Generates a session cookie for the user after verifying the ID token.
87
87
  *
88
- * @param {Object} auth - The authentication object used to verify the ID token and create session cookies.
88
+ * @param {Record<string, any>} auth - The authentication object used to verify the ID token and create session cookies.
89
89
  * @param {string} token - The ID token of the authenticated user.
90
90
  * @returns {Promise<string>} A promise that resolves with the session cookie or rejects with an error.
91
91
  */
@@ -48,9 +48,9 @@ declare class AuthSystem {
48
48
  /**
49
49
  * Generates a session cookie for the user after verifying the ID token.
50
50
  *
51
- * @param {Object} auth - The authentication object used to verify the ID token and create session cookies.
51
+ * @param {Record<string, any>} auth - The authentication object used to verify the ID token and create session cookies.
52
52
  * @param {string} token - The ID token of the authenticated user.
53
53
  * @returns {Promise<string>} A promise that resolves with the session cookie or rejects with an error.
54
54
  */
55
- genCookieSession(auth: Object, token: string): Promise<string>;
55
+ genCookieSession(auth: Record<string, any>, token: string): Promise<string>;
56
56
  }
@@ -77,7 +77,7 @@ class AuthSystem {
77
77
  /**
78
78
  * Generates a session cookie for the user after verifying the ID token.
79
79
  *
80
- * @param {Object} auth - The authentication object used to verify the ID token and create session cookies.
80
+ * @param {Record<string, any>} auth - The authentication object used to verify the ID token and create session cookies.
81
81
  * @param {string} token - The ID token of the authenticated user.
82
82
  * @returns {Promise<string>} A promise that resolves with the session cookie or rejects with an error.
83
83
  */
@@ -37,7 +37,7 @@ if (!('toJSON' in Error.prototype)) {
37
37
  *
38
38
  * @param {string} where - The location or context where the log is coming from.
39
39
  * @param {string} type - The type of log (log, error, info, or warn).
40
- * @param {Array} args - The arguments to log (can include strings, numbers, objects, arrays, or errors).
40
+ * @param {Array<*>} args - The arguments to log (can include strings, numbers, objects, arrays, or errors).
41
41
  * @returns {Promise<void>} Resolves once the log is stored in the database.
42
42
  */
43
43
  const tinyAction = async function (where, type, args) {
@@ -130,7 +130,7 @@ const checkLastTime = function (value) {
130
130
  * Each log type is stored in the database with a timestamp and arguments.
131
131
  *
132
132
  * @param {string} where - The location or context where the log is coming from.
133
- * @returns {Object} The logger object with methods for logging (log, error, info, warn).
133
+ * @returns {Record<string, any>} The logger object with methods for logging (log, error, info, warn).
134
134
  */
135
135
  const loggerGenerator = function (where) {
136
136
  // Done
@@ -172,9 +172,9 @@ const databaseLogger = {
172
172
  /**
173
173
  * Starts the logger with a new database instance and initializes cache values.
174
174
  *
175
- * @param {Object} newDB - The new database instance to use for storing logs.
175
+ * @param {Record<string, any>} newDB - The new database instance to use for storing logs.
176
176
  * @param {string} where - The context or location where the logger will be used.
177
- * @returns {Promise<Object>} The logger instance with methods for logging.
177
+ * @returns {Promise<Record<string, any>>} The logger instance with methods for logging.
178
178
  */
179
179
  start: async function (newDB, where) {
180
180
  // Prepare
@@ -231,7 +231,7 @@ const databaseLogger = {
231
231
  * Retrieves the logger instance for a given context.
232
232
  *
233
233
  * @param {string} where - The context or location where the logger will be used.
234
- * @returns {Object} The logger instance with methods for logging.
234
+ * @returns {Record<string, any>} The logger instance with methods for logging.
235
235
  */
236
236
  get: function (where) {
237
237
  return loggerGenerator(where);
@@ -1,7 +1,7 @@
1
1
  export default databaseLogger;
2
2
  declare namespace databaseLogger {
3
- function start(newDB: Object, where: string): Promise<Object>;
4
- function get(where: string): Object;
3
+ function start(newDB: Record<string, any>, where: string): Promise<Record<string, any>>;
4
+ function get(where: string): Record<string, any>;
5
5
  function changeCacheLimit(value: number): void;
6
6
  function setDebugMode(value: boolean): void;
7
7
  }
@@ -28,7 +28,7 @@ if (!('toJSON' in Error.prototype)) {
28
28
  *
29
29
  * @param {string} where - The location or context where the log is coming from.
30
30
  * @param {string} type - The type of log (log, error, info, or warn).
31
- * @param {Array} args - The arguments to log (can include strings, numbers, objects, arrays, or errors).
31
+ * @param {Array<*>} args - The arguments to log (can include strings, numbers, objects, arrays, or errors).
32
32
  * @returns {Promise<void>} Resolves once the log is stored in the database.
33
33
  */
34
34
  const tinyAction = async function (where, type, args) {
@@ -111,7 +111,7 @@ const checkLastTime = function (value) {
111
111
  * Each log type is stored in the database with a timestamp and arguments.
112
112
  *
113
113
  * @param {string} where - The location or context where the log is coming from.
114
- * @returns {Object} The logger object with methods for logging (log, error, info, warn).
114
+ * @returns {Record<string, any>} The logger object with methods for logging (log, error, info, warn).
115
115
  */
116
116
  const loggerGenerator = function (where) {
117
117
  // Done
@@ -149,9 +149,9 @@ const databaseLogger = {
149
149
  /**
150
150
  * Starts the logger with a new database instance and initializes cache values.
151
151
  *
152
- * @param {Object} newDB - The new database instance to use for storing logs.
152
+ * @param {Record<string, any>} newDB - The new database instance to use for storing logs.
153
153
  * @param {string} where - The context or location where the logger will be used.
154
- * @returns {Promise<Object>} The logger instance with methods for logging.
154
+ * @returns {Promise<Record<string, any>>} The logger instance with methods for logging.
155
155
  */
156
156
  start: async function (newDB, where) {
157
157
  // Prepare
@@ -207,7 +207,7 @@ const databaseLogger = {
207
207
  * Retrieves the logger instance for a given context.
208
208
  *
209
209
  * @param {string} where - The context or location where the logger will be used.
210
- * @returns {Object} The logger instance with methods for logging.
210
+ * @returns {Record<string, any>} The logger instance with methods for logging.
211
211
  */
212
212
  get: function (where) {
213
213
  return loggerGenerator(where);
@@ -21,9 +21,9 @@ var errorValidator = require('../get/errorValidator.cjs');
21
21
  * @param {boolean} [data.mute=false] - Whether the user should be server-muted.
22
22
  * @param {boolean} [data.deaf=false] - Whether the user should be server-deafened.
23
23
  *
24
- * @returns {Promise<Object>} Resolves with the user object if successful, or rejects with an error object.
24
+ * @returns {Promise<Record<string, any>>} Resolves with the user object if successful, or rejects with an error object.
25
25
  *
26
- * @throws {Object} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
26
+ * @throws {Record<string, any>} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
27
27
  *
28
28
  * @example
29
29
  * const result = await addGuildMember('your_bot_token', {
@@ -12,9 +12,9 @@
12
12
  * @param {boolean} [data.mute=false] - Whether the user should be server-muted.
13
13
  * @param {boolean} [data.deaf=false] - Whether the user should be server-deafened.
14
14
  *
15
- * @returns {Promise<Object>} Resolves with the user object if successful, or rejects with an error object.
15
+ * @returns {Promise<Record<string, any>>} Resolves with the user object if successful, or rejects with an error object.
16
16
  *
17
- * @throws {Object} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
17
+ * @throws {Record<string, any>} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
18
18
  *
19
19
  * @example
20
20
  * const result = await addGuildMember('your_bot_token', {
@@ -35,4 +35,4 @@ export default function addGuildMember(bot_token: string, data: {
35
35
  nickname?: string | undefined;
36
36
  mute?: boolean | undefined;
37
37
  deaf?: boolean | undefined;
38
- }): Promise<Object>;
38
+ }): Promise<Record<string, any>>;
@@ -16,9 +16,9 @@ import errorValidator from '../get/errorValidator.mjs';
16
16
  * @param {boolean} [data.mute=false] - Whether the user should be server-muted.
17
17
  * @param {boolean} [data.deaf=false] - Whether the user should be server-deafened.
18
18
  *
19
- * @returns {Promise<Object>} Resolves with the user object if successful, or rejects with an error object.
19
+ * @returns {Promise<Record<string, any>>} Resolves with the user object if successful, or rejects with an error object.
20
20
  *
21
- * @throws {Object} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
21
+ * @throws {Record<string, any>} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
22
22
  *
23
23
  * @example
24
24
  * const result = await addGuildMember('your_bot_token', {
@@ -14,9 +14,9 @@ var errorValidator = require('../get/errorValidator.cjs');
14
14
  *
15
15
  * @param {string} guildID - The ID of the guild whose widget is to be fetched.
16
16
  *
17
- * @returns {Promise<Object>} Resolves with the guild widget data if successful.
17
+ * @returns {Promise<Record<string, any>>} Resolves with the guild widget data if successful.
18
18
  *
19
- * @throws {Object} If the request fails or the widget is disabled, rejects with an object containing a `code` and `message`.
19
+ * @throws {Record<string, any>} If the request fails or the widget is disabled, rejects with an object containing a `code` and `message`.
20
20
  *
21
21
  * @example
22
22
  * getGuildWidget('123456789012345678')
@@ -5,13 +5,13 @@
5
5
  *
6
6
  * @param {string} guildID - The ID of the guild whose widget is to be fetched.
7
7
  *
8
- * @returns {Promise<Object>} Resolves with the guild widget data if successful.
8
+ * @returns {Promise<Record<string, any>>} Resolves with the guild widget data if successful.
9
9
  *
10
- * @throws {Object} If the request fails or the widget is disabled, rejects with an object containing a `code` and `message`.
10
+ * @throws {Record<string, any>} If the request fails or the widget is disabled, rejects with an object containing a `code` and `message`.
11
11
  *
12
12
  * @example
13
13
  * getGuildWidget('123456789012345678')
14
14
  * .then((data) => console.log(data))
15
15
  * .catch((err) => console.error('Widget error:', err));
16
16
  */
17
- export default function getGuildWidget(guildID: string): Promise<Object>;
17
+ export default function getGuildWidget(guildID: string): Promise<Record<string, any>>;
@@ -9,9 +9,9 @@ import errorValidator from '../get/errorValidator.mjs';
9
9
  *
10
10
  * @param {string} guildID - The ID of the guild whose widget is to be fetched.
11
11
  *
12
- * @returns {Promise<Object>} Resolves with the guild widget data if successful.
12
+ * @returns {Promise<Record<string, any>>} Resolves with the guild widget data if successful.
13
13
  *
14
- * @throws {Object} If the request fails or the widget is disabled, rejects with an object containing a `code` and `message`.
14
+ * @throws {Record<string, any>} If the request fails or the widget is disabled, rejects with an object containing a `code` and `message`.
15
15
  *
16
16
  * @example
17
17
  * getGuildWidget('123456789012345678')
@@ -20,9 +20,9 @@ var errorValidator = require('../get/errorValidator.cjs');
20
20
  * @param {string} dsData.redirect_uri - The redirect URI used during the authorization.
21
21
  * @param {string} [dsData.scope] - The OAuth2 scopes being requested (optional but recommended).
22
22
  *
23
- * @returns {Promise<Object>} Resolves with the access token data (access_token, token_type, expires_in, refresh_token, scope).
23
+ * @returns {Promise<Record<string, any>>} Resolves with the access token data (access_token, token_type, expires_in, refresh_token, scope).
24
24
  *
25
- * @throws {Object} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
25
+ * @throws {Record<string, any>} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
26
26
  *
27
27
  * @example
28
28
  * getToken({
@@ -11,9 +11,9 @@
11
11
  * @param {string} dsData.redirect_uri - The redirect URI used during the authorization.
12
12
  * @param {string} [dsData.scope] - The OAuth2 scopes being requested (optional but recommended).
13
13
  *
14
- * @returns {Promise<Object>} Resolves with the access token data (access_token, token_type, expires_in, refresh_token, scope).
14
+ * @returns {Promise<Record<string, any>>} Resolves with the access token data (access_token, token_type, expires_in, refresh_token, scope).
15
15
  *
16
- * @throws {Object} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
16
+ * @throws {Record<string, any>} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
17
17
  *
18
18
  * @example
19
19
  * getToken({
@@ -32,4 +32,4 @@ export default function getToken(dsData: {
32
32
  code: string;
33
33
  redirect_uri: string;
34
34
  scope?: string | undefined;
35
- }): Promise<Object>;
35
+ }): Promise<Record<string, any>>;
@@ -15,9 +15,9 @@ import errorValidator from '../get/errorValidator.mjs';
15
15
  * @param {string} dsData.redirect_uri - The redirect URI used during the authorization.
16
16
  * @param {string} [dsData.scope] - The OAuth2 scopes being requested (optional but recommended).
17
17
  *
18
- * @returns {Promise<Object>} Resolves with the access token data (access_token, token_type, expires_in, refresh_token, scope).
18
+ * @returns {Promise<Record<string, any>>} Resolves with the access token data (access_token, token_type, expires_in, refresh_token, scope).
19
19
  *
20
- * @throws {Object} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
20
+ * @throws {Record<string, any>} If the request fails or Discord returns an error, rejects with an object containing a `code` and `message`.
21
21
  *
22
22
  * @example
23
23
  * getToken({
@@ -18,9 +18,9 @@ var errorValidator = require('../get/errorValidator.cjs');
18
18
  * @param {string} [user='@me'] - The user ID to fetch. Use '@me' to get the authenticated user's profile.
19
19
  * @param {string} [version=''] - Optional API version prefix (e.g., 'v10/') if needed by your API setup.
20
20
  *
21
- * @returns {Promise<Object>} Resolves with the user's profile data returned by Discord.
21
+ * @returns {Promise<Record<string, any>>} Resolves with the user's profile data returned by Discord.
22
22
  *
23
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
23
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
24
24
  *
25
25
  * @example
26
26
  * getUser('access_token_here')
@@ -9,9 +9,9 @@
9
9
  * @param {string} [user='@me'] - The user ID to fetch. Use '@me' to get the authenticated user's profile.
10
10
  * @param {string} [version=''] - Optional API version prefix (e.g., 'v10/') if needed by your API setup.
11
11
  *
12
- * @returns {Promise<Object>} Resolves with the user's profile data returned by Discord.
12
+ * @returns {Promise<Record<string, any>>} Resolves with the user's profile data returned by Discord.
13
13
  *
14
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
14
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
15
15
  *
16
16
  * @example
17
17
  * getUser('access_token_here')
@@ -24,4 +24,4 @@
24
24
  * .then(user => console.log('User info:', user))
25
25
  * .catch(err => console.error('Error:', err));
26
26
  */
27
- export default function getUser(access_token: string, type?: string, user?: string, version?: string): Promise<Object>;
27
+ export default function getUser(access_token: string, type?: string, user?: string, version?: string): Promise<Record<string, any>>;
@@ -13,9 +13,9 @@ import errorValidator from '../get/errorValidator.mjs';
13
13
  * @param {string} [user='@me'] - The user ID to fetch. Use '@me' to get the authenticated user's profile.
14
14
  * @param {string} [version=''] - Optional API version prefix (e.g., 'v10/') if needed by your API setup.
15
15
  *
16
- * @returns {Promise<Object>} Resolves with the user's profile data returned by Discord.
16
+ * @returns {Promise<Record<string, any>>} Resolves with the user's profile data returned by Discord.
17
17
  *
18
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
18
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
19
19
  *
20
20
  * @example
21
21
  * getUser('access_token_here')
@@ -17,9 +17,9 @@ var errorValidator = require('../get/errorValidator.cjs');
17
17
  *
18
18
  * @param {string} access_token - The OAuth2 access token used to authenticate the user.
19
19
  *
20
- * @returns {Promise<Array<Object>>} Resolves with an array of connection objects.
20
+ * @returns {Promise<Array<Record<string, any>>>} Resolves with an array of connection objects.
21
21
  *
22
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
22
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
23
23
  *
24
24
  * @see {@link https://discord.com/developers/docs/resources/user#get-user-connections} Discord API Reference
25
25
  *
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * @param {string} access_token - The OAuth2 access token used to authenticate the user.
10
10
  *
11
- * @returns {Promise<Array<Object>>} Resolves with an array of connection objects.
11
+ * @returns {Promise<Array<Record<string, any>>>} Resolves with an array of connection objects.
12
12
  *
13
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
13
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
14
14
  *
15
15
  * @see {@link https://discord.com/developers/docs/resources/user#get-user-connections} Discord API Reference
16
16
  *
@@ -23,4 +23,4 @@
23
23
  * })
24
24
  * .catch(err => console.error('Failed to get connections:', err));
25
25
  */
26
- export default function getUserConnections(access_token: string): Promise<Array<Object>>;
26
+ export default function getUserConnections(access_token: string): Promise<Array<Record<string, any>>>;
@@ -12,9 +12,9 @@ import errorValidator from '../get/errorValidator.mjs';
12
12
  *
13
13
  * @param {string} access_token - The OAuth2 access token used to authenticate the user.
14
14
  *
15
- * @returns {Promise<Array<Object>>} Resolves with an array of connection objects.
15
+ * @returns {Promise<Array<Record<string, any>>>} Resolves with an array of connection objects.
16
16
  *
17
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
17
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
18
18
  *
19
19
  * @see {@link https://discord.com/developers/docs/resources/user#get-user-connections} Discord API Reference
20
20
  *
@@ -18,9 +18,9 @@ var errorValidator = require('../get/errorValidator.cjs');
18
18
  *
19
19
  * @param {string} access_token - The OAuth2 access token used to authenticate the user.
20
20
  *
21
- * @returns {Promise<Array<Object>>} Resolves with an array of guild objects the user is in.
21
+ * @returns {Promise<Array<Record<string, any>>>} Resolves with an array of guild objects the user is in.
22
22
  *
23
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
23
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
24
24
  *
25
25
  * @example
26
26
  * getUserGuilds('your_access_token')
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @param {string} access_token - The OAuth2 access token used to authenticate the user.
11
11
  *
12
- * @returns {Promise<Array<Object>>} Resolves with an array of guild objects the user is in.
12
+ * @returns {Promise<Array<Record<string, any>>>} Resolves with an array of guild objects the user is in.
13
13
  *
14
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
14
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
15
15
  *
16
16
  * @example
17
17
  * getUserGuilds('your_access_token')
@@ -22,4 +22,4 @@
22
22
  * })
23
23
  * .catch(err => console.error('Failed to get guilds:', err));
24
24
  */
25
- export default function getUserGuilds(access_token: string): Promise<Array<Object>>;
25
+ export default function getUserGuilds(access_token: string): Promise<Array<Record<string, any>>>;
@@ -13,9 +13,9 @@ import errorValidator from '../get/errorValidator.mjs';
13
13
  *
14
14
  * @param {string} access_token - The OAuth2 access token used to authenticate the user.
15
15
  *
16
- * @returns {Promise<Array<Object>>} Resolves with an array of guild objects the user is in.
16
+ * @returns {Promise<Array<Record<string, any>>>} Resolves with an array of guild objects the user is in.
17
17
  *
18
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
18
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
19
19
  *
20
20
  * @example
21
21
  * getUserGuilds('your_access_token')
@@ -21,7 +21,7 @@ var errorValidator = require('../get/errorValidator.cjs');
21
21
  * @param {string} dsData.redirect_uri - The redirect URI used in the original OAuth2 flow.
22
22
  * @param {string} dsData.scope - The scope(s) to request (e.g., 'identify guilds').
23
23
  *
24
- * @returns {Promise<Object>} Resolves with a new token object from the Discord API:
24
+ * @returns {Promise<Record<string, any>>} Resolves with a new token object from the Discord API:
25
25
  * {
26
26
  * access_token: string,
27
27
  * token_type: string,
@@ -30,7 +30,7 @@ var errorValidator = require('../get/errorValidator.cjs');
30
30
  * scope: string
31
31
  * }
32
32
  *
33
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
33
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
34
34
  *
35
35
  * @example
36
36
  * refreshToken({
@@ -12,7 +12,7 @@
12
12
  * @param {string} dsData.redirect_uri - The redirect URI used in the original OAuth2 flow.
13
13
  * @param {string} dsData.scope - The scope(s) to request (e.g., 'identify guilds').
14
14
  *
15
- * @returns {Promise<Object>} Resolves with a new token object from the Discord API:
15
+ * @returns {Promise<Record<string, any>>} Resolves with a new token object from the Discord API:
16
16
  * {
17
17
  * access_token: string,
18
18
  * token_type: string,
@@ -21,7 +21,7 @@
21
21
  * scope: string
22
22
  * }
23
23
  *
24
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
24
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
25
25
  *
26
26
  * @example
27
27
  * refreshToken({
@@ -42,4 +42,4 @@ export default function refreshToken(dsData: {
42
42
  refresh_token: string;
43
43
  redirect_uri: string;
44
44
  scope: string;
45
- }): Promise<Object>;
45
+ }): Promise<Record<string, any>>;
@@ -16,7 +16,7 @@ import errorValidator from '../get/errorValidator.mjs';
16
16
  * @param {string} dsData.redirect_uri - The redirect URI used in the original OAuth2 flow.
17
17
  * @param {string} dsData.scope - The scope(s) to request (e.g., 'identify guilds').
18
18
  *
19
- * @returns {Promise<Object>} Resolves with a new token object from the Discord API:
19
+ * @returns {Promise<Record<string, any>>} Resolves with a new token object from the Discord API:
20
20
  * {
21
21
  * access_token: string,
22
22
  * token_type: string,
@@ -25,7 +25,7 @@ import errorValidator from '../get/errorValidator.mjs';
25
25
  * scope: string
26
26
  * }
27
27
  *
28
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
28
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
29
29
  *
30
30
  * @example
31
31
  * refreshToken({
@@ -19,10 +19,10 @@ var errorValidator = require('../get/errorValidator.cjs');
19
19
  * @param {string} tinyAuth.client_id - The Discord application client ID.
20
20
  * @param {string} tinyAuth.client_secret - The Discord application client secret.
21
21
  *
22
- * @returns {Promise<Object>} Resolves when the token is successfully revoked.
22
+ * @returns {Promise<Record<string, any>>} Resolves when the token is successfully revoked.
23
23
  * The response may not contain any body if successful, so `result.data` may be empty.
24
24
  *
25
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
25
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
26
26
  *
27
27
  * @example
28
28
  * revokeToken('user-access-token', {
@@ -10,10 +10,10 @@
10
10
  * @param {string} tinyAuth.client_id - The Discord application client ID.
11
11
  * @param {string} tinyAuth.client_secret - The Discord application client secret.
12
12
  *
13
- * @returns {Promise<Object>} Resolves when the token is successfully revoked.
13
+ * @returns {Promise<Record<string, any>>} Resolves when the token is successfully revoked.
14
14
  * The response may not contain any body if successful, so `result.data` may be empty.
15
15
  *
16
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
16
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
17
17
  *
18
18
  * @example
19
19
  * revokeToken('user-access-token', {
@@ -26,4 +26,4 @@
26
26
  export default function revokeToken(access_token: string, tinyAuth: {
27
27
  client_id: string;
28
28
  client_secret: string;
29
- }): Promise<Object>;
29
+ }): Promise<Record<string, any>>;
@@ -15,10 +15,10 @@ import errorValidator from '../get/errorValidator.mjs';
15
15
  * @param {string} tinyAuth.client_id - The Discord application client ID.
16
16
  * @param {string} tinyAuth.client_secret - The Discord application client secret.
17
17
  *
18
- * @returns {Promise<Object>} Resolves when the token is successfully revoked.
18
+ * @returns {Promise<Record<string, any>>} Resolves when the token is successfully revoked.
19
19
  * The response may not contain any body if successful, so `result.data` may be empty.
20
20
  *
21
- * @throws {Object} If the request fails, rejects with an error object containing `code` and `message`.
21
+ * @throws {Record<string, any>} If the request fails, rejects with an error object containing `code` and `message`.
22
22
  *
23
23
  * @example
24
24
  * revokeToken('user-access-token', {
@@ -12,9 +12,9 @@ var config = require('../config.cjs');
12
12
  * authentication flows, such as logging in or connecting a webhook.
13
13
  *
14
14
  * @function
15
- * @param {Object} tinyCfg - The configuration object containing the app's OAuth2 settings.
16
- * @param {Object} jsonState - The state object to be encrypted and passed in the authorization URL.
17
- * @param {Object} tinyCrypto - The crypto object used to encrypt the state.
15
+ * @param {Record<string, any>} tinyCfg - The configuration object containing the app's OAuth2 settings.
16
+ * @param {Record<string, any>} jsonState - The state object to be encrypted and passed in the authorization URL.
17
+ * @param {Record<string, any>} tinyCrypto - The crypto object used to encrypt the state.
18
18
  * @param {string} type - The type of the request, which determines the URL generation process.
19
19
  * Can be `'login'`, `'login_command'`, or `'webhook'`.
20
20
  *
@@ -4,9 +4,9 @@
4
4
  * authentication flows, such as logging in or connecting a webhook.
5
5
  *
6
6
  * @function
7
- * @param {Object} tinyCfg - The configuration object containing the app's OAuth2 settings.
8
- * @param {Object} jsonState - The state object to be encrypted and passed in the authorization URL.
9
- * @param {Object} tinyCrypto - The crypto object used to encrypt the state.
7
+ * @param {Record<string, any>} tinyCfg - The configuration object containing the app's OAuth2 settings.
8
+ * @param {Record<string, any>} jsonState - The state object to be encrypted and passed in the authorization URL.
9
+ * @param {Record<string, any>} tinyCrypto - The crypto object used to encrypt the state.
10
10
  * @param {string} type - The type of the request, which determines the URL generation process.
11
11
  * Can be `'login'`, `'login_command'`, or `'webhook'`.
12
12
  *
@@ -20,4 +20,4 @@
20
20
  * const webhookAuthUrl = authURLGenerator(tinyCfg, jsonState, tinyCrypto, 'webhook');
21
21
  * console.log(webhookAuthUrl);
22
22
  */
23
- export default function authURLGenerator(tinyCfg: Object, jsonState: Object, tinyCrypto: Object, type: string): string;
23
+ export default function authURLGenerator(tinyCfg: Record<string, any>, jsonState: Record<string, any>, tinyCrypto: Record<string, any>, type: string): string;
@@ -7,9 +7,9 @@ import config from '../config.mjs';
7
7
  * authentication flows, such as logging in or connecting a webhook.
8
8
  *
9
9
  * @function
10
- * @param {Object} tinyCfg - The configuration object containing the app's OAuth2 settings.
11
- * @param {Object} jsonState - The state object to be encrypted and passed in the authorization URL.
12
- * @param {Object} tinyCrypto - The crypto object used to encrypt the state.
10
+ * @param {Record<string, any>} tinyCfg - The configuration object containing the app's OAuth2 settings.
11
+ * @param {Record<string, any>} jsonState - The state object to be encrypted and passed in the authorization URL.
12
+ * @param {Record<string, any>} tinyCrypto - The crypto object used to encrypt the state.
13
13
  * @param {string} type - The type of the request, which determines the URL generation process.
14
14
  * Can be `'login'`, `'login_command'`, or `'webhook'`.
15
15
  *