@20syldev/api 5.6.0 → 5.7.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.
Files changed (129) hide show
  1. package/.prettierignore +5 -0
  2. package/README.md +204 -80
  3. package/dist/app.d.ts +2 -0
  4. package/dist/config/env.d.ts +21 -0
  5. package/dist/config/env.js +10 -2
  6. package/dist/config/env.js.map +1 -1
  7. package/dist/config/plans.d.ts +26 -0
  8. package/dist/config/versions.d.ts +18 -0
  9. package/dist/constants.d.ts +39 -0
  10. package/dist/constants.js +0 -1
  11. package/dist/constants.js.map +1 -1
  12. package/dist/middleware/cors.d.ts +2 -0
  13. package/dist/middleware/cors.js +2 -1
  14. package/dist/middleware/cors.js.map +1 -1
  15. package/dist/middleware/error.d.ts +4 -0
  16. package/dist/middleware/json.d.ts +2 -0
  17. package/dist/middleware/logger.d.ts +26 -0
  18. package/dist/middleware/logger.js +34 -1
  19. package/dist/middleware/logger.js.map +1 -1
  20. package/dist/middleware/ratelimit.d.ts +2 -0
  21. package/dist/middleware/version.d.ts +3 -0
  22. package/dist/middleware/version.js +2 -2
  23. package/dist/middleware/version.js.map +1 -1
  24. package/dist/modules/v3/algorithms.d.ts +82 -0
  25. package/dist/modules/v3/captcha.d.ts +8 -0
  26. package/dist/modules/v3/chat.d.ts +9 -0
  27. package/dist/modules/v3/chat.js +3 -3
  28. package/dist/modules/v3/chat.js.map +1 -1
  29. package/dist/modules/v3/color.d.ts +6 -0
  30. package/dist/modules/v3/convert.d.ts +10 -0
  31. package/dist/modules/v3/domain.d.ts +6 -0
  32. package/dist/modules/v3/hash.d.ts +8 -0
  33. package/dist/modules/v3/hyperplanning.d.ts +9 -0
  34. package/dist/modules/v3/levenshtein.d.ts +9 -0
  35. package/dist/modules/v3/personal.d.ts +6 -0
  36. package/dist/modules/v3/qrcode.d.ts +8 -0
  37. package/dist/modules/v3/tic_tac_toe.d.ts +9 -0
  38. package/dist/modules/v3/tic_tac_toe.js +3 -3
  39. package/dist/modules/v3/tic_tac_toe.js.map +1 -1
  40. package/dist/modules/v3/time.d.ts +12 -0
  41. package/dist/modules/v3/token.d.ts +9 -0
  42. package/dist/modules/v3/username.d.ts +6 -0
  43. package/dist/modules/v3/utils.d.ts +50 -0
  44. package/dist/modules/v3.d.ts +15 -0
  45. package/dist/modules/v4/address.d.ts +20 -0
  46. package/dist/modules/v4/agent.d.ts +30 -0
  47. package/dist/modules/v4/algorithms.d.ts +90 -0
  48. package/dist/modules/v4/avatar.d.ts +23 -0
  49. package/dist/modules/v4/barcode.d.ts +27 -0
  50. package/dist/modules/v4/captcha.d.ts +22 -0
  51. package/dist/modules/v4/chat.d.ts +21 -0
  52. package/dist/modules/v4/chat.js +3 -3
  53. package/dist/modules/v4/chat.js.map +1 -1
  54. package/dist/modules/v4/color.d.ts +16 -0
  55. package/dist/modules/v4/convert.d.ts +15 -0
  56. package/dist/modules/v4/credit.d.ts +22 -0
  57. package/dist/modules/v4/cron.d.ts +17 -0
  58. package/dist/modules/v4/dice.d.ts +16 -0
  59. package/dist/modules/v4/domain.d.ts +6 -0
  60. package/dist/modules/v4/encode.d.ts +81 -0
  61. package/dist/modules/v4/geo.d.ts +30 -0
  62. package/dist/modules/v4/hash.d.ts +15 -0
  63. package/dist/modules/v4/hyperplanning.d.ts +19 -0
  64. package/dist/modules/v4/ip.d.ts +19 -0
  65. package/dist/modules/v4/levenshtein.d.ts +13 -0
  66. package/dist/modules/v4/palette.d.ts +19 -0
  67. package/dist/modules/v4/password.d.ts +25 -0
  68. package/dist/modules/v4/personal.d.ts +6 -0
  69. package/dist/modules/v4/placeholder.d.ts +30 -0
  70. package/dist/modules/v4/qrcode.d.ts +25 -0
  71. package/dist/modules/v4/regex.d.ts +23 -0
  72. package/dist/modules/v4/statistics.d.ts +20 -0
  73. package/dist/modules/v4/text.d.ts +43 -0
  74. package/dist/modules/v4/tic_tac_toe.d.ts +19 -0
  75. package/dist/modules/v4/tic_tac_toe.js +3 -3
  76. package/dist/modules/v4/tic_tac_toe.js.map +1 -1
  77. package/dist/modules/v4/time.d.ts +15 -0
  78. package/dist/modules/v4/token.d.ts +9 -0
  79. package/dist/modules/v4/username.d.ts +6 -0
  80. package/dist/modules/v4/validate.d.ts +34 -0
  81. package/dist/modules/v4.d.ts +32 -0
  82. package/dist/modules/v5/address.d.ts +5 -0
  83. package/dist/modules/v5/algorithms.d.ts +9 -0
  84. package/dist/modules/v5/asymmetric.d.ts +26 -0
  85. package/dist/modules/v5/barcode.d.ts +27 -0
  86. package/dist/modules/v5/case.d.ts +10 -0
  87. package/dist/modules/v5/chart.d.ts +53 -0
  88. package/dist/modules/v5/chat.d.ts +21 -0
  89. package/dist/modules/v5/chat.js +3 -3
  90. package/dist/modules/v5/chat.js.map +1 -1
  91. package/dist/modules/v5/csv.d.ts +29 -0
  92. package/dist/modules/v5/evaluate.d.ts +14 -0
  93. package/dist/modules/v5/jwt.d.ts +11 -0
  94. package/dist/modules/v5/matrix.d.ts +77 -0
  95. package/dist/modules/v5/otp.d.ts +30 -0
  96. package/dist/modules/v5/symmetric.d.ts +15 -0
  97. package/dist/modules/v5/text.d.ts +5 -0
  98. package/dist/modules/v5/tic_tac_toe.d.ts +19 -0
  99. package/dist/modules/v5/tic_tac_toe.js +3 -3
  100. package/dist/modules/v5/tic_tac_toe.js.map +1 -1
  101. package/dist/modules/v5/url.d.ts +18 -0
  102. package/dist/modules/v5/url.js +12 -3
  103. package/dist/modules/v5/url.js.map +1 -1
  104. package/dist/modules/v5.d.ts +17 -0
  105. package/dist/routes/delete.d.ts +2 -0
  106. package/dist/routes/delete.js +2 -2
  107. package/dist/routes/delete.js.map +1 -1
  108. package/dist/routes/get.d.ts +2 -0
  109. package/dist/routes/get.js +84 -85
  110. package/dist/routes/get.js.map +1 -1
  111. package/dist/routes/index.d.ts +2 -0
  112. package/dist/routes/index.js +8 -4
  113. package/dist/routes/index.js.map +1 -1
  114. package/dist/routes/patch.d.ts +2 -0
  115. package/dist/routes/patch.js +1 -1
  116. package/dist/routes/patch.js.map +1 -1
  117. package/dist/routes/post.d.ts +2 -0
  118. package/dist/routes/post.js +32 -32
  119. package/dist/routes/post.js.map +1 -1
  120. package/dist/storage/index.d.ts +4 -0
  121. package/dist/types/storage.d.ts +49 -0
  122. package/dist/utils/colors.d.ts +44 -0
  123. package/dist/utils/helpers.d.ts +55 -0
  124. package/dist/utils/response.d.ts +9 -0
  125. package/dist/utils/response.js +2 -4
  126. package/dist/utils/response.js.map +1 -1
  127. package/package.json +17 -16
  128. package/robots.txt +74 -0
  129. package/src/favicon.ico +0 -0
@@ -0,0 +1,22 @@
1
+ export interface CaptchaOptions {
2
+ text?: string;
3
+ length?: number;
4
+ width?: number;
5
+ height?: number;
6
+ noise?: 'low' | 'medium' | 'high';
7
+ bg?: string;
8
+ color?: string;
9
+ }
10
+ export interface CaptchaResult {
11
+ contentType: string;
12
+ body: Buffer;
13
+ text: string;
14
+ }
15
+ /**
16
+ * Generates a CAPTCHA image with random or custom text and configurable noise.
17
+ *
18
+ * @param options - Captcha configuration options
19
+ * @returns Object containing the PNG buffer, content type, and the challenge text
20
+ * @throws Error if any option is out of the accepted range
21
+ */
22
+ export default function captcha(options: CaptchaOptions): CaptchaResult;
@@ -0,0 +1,21 @@
1
+ import type { ChatMessage, ChatStorage } from '../../types/storage.js';
2
+ interface ChatParams {
3
+ username: string;
4
+ message?: string;
5
+ timestamp?: string;
6
+ session?: string;
7
+ token?: string;
8
+ storage: ChatStorage;
9
+ }
10
+ /**
11
+ * Handles real-time chat actions including sending, fetching, and clearing messages.
12
+ *
13
+ * @param action - The action to perform: "message", "private", "fetch", or "clear"
14
+ * @param params - Chat parameters including username, message, session, and shared storage
15
+ * @returns The result of the action — a message list, a sent confirmation, or a status message
16
+ * @throws Error if a required parameter is missing or the action is invalid
17
+ */
18
+ export default function chat(action: string, params: ChatParams): ChatMessage[] | ChatMessage | {
19
+ message: string;
20
+ };
21
+ export {};
@@ -55,18 +55,18 @@ function sendMessage(params, messages, privateChats, sessions, u, now) {
55
55
  privateChats[token].push(msg);
56
56
  setTimeout(() => {
57
57
  delete privateChats[token];
58
- }, SESSION_TTL);
58
+ }, SESSION_TTL).unref();
59
59
  }
60
60
  else {
61
61
  messages.push(msg);
62
- setTimeout(() => messages.splice(messages.indexOf(msg), 1), SESSION_TTL);
62
+ setTimeout(() => messages.splice(messages.indexOf(msg), 1), SESSION_TTL).unref();
63
63
  }
64
64
  sessions[u] = sessions[u] || { user: session, last: now };
65
65
  sessions[u].last = now;
66
66
  setTimeout(() => {
67
67
  if (sessions[u] && now - sessions[u].last >= SESSION_TTL)
68
68
  delete sessions[u];
69
- }, SESSION_TTL);
69
+ }, SESSION_TTL).unref();
70
70
  return { message: 'Message sent successfully' };
71
71
  }
72
72
  function getPrivateChat(params, privateChats) {
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/modules/v4/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAWxD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,MAAc,EAAE,MAAkB;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAE/B,OAAO,CAAC,QAAQ,KAAK,EAAE,CAAC;IACxB,OAAO,CAAC,YAAY,KAAK,EAAE,CAAC;IAC5B,OAAO,CAAC,QAAQ,KAAK,EAAE,CAAC;IACxB,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;IAE1B,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEjE,IAAI,CAAC,MAAM,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAEnE,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CA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E,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAEvE,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEnB,OAAO,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface ColorResult {
2
+ hex: string;
3
+ rgb: string;
4
+ hsl: string;
5
+ hsv: string;
6
+ hwb: string;
7
+ cmyk: string;
8
+ }
9
+ /**
10
+ * Converts a hex color to all major color space representations, or generates a random color.
11
+ *
12
+ * @param hex - Optional hex color string (e.g. "#ff5733"); generates a random color if omitted
13
+ * @returns Color in hex, RGB, HSL, HSV, HWB, and CMYK formats
14
+ * @throws Error if the hex string is invalid
15
+ */
16
+ export default function color(hex?: string): ColorResult;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Converts a numeric value from one unit to another.
3
+ *
4
+ * @param value - The numeric value to convert
5
+ * @param from - The source unit (e.g. "km", "celsius", "kg")
6
+ * @param to - The target unit (e.g. "mi", "fahrenheit", "lb")
7
+ * @returns Object with source unit, target unit, original value, and converted result
8
+ * @throws Error if the conversion pair is unsupported, the value is NaN, or the temperature is below absolute zero
9
+ */
10
+ export default function convert(value: number, from: string, to: string): {
11
+ from: string;
12
+ to: string;
13
+ value: number;
14
+ result: number;
15
+ };
@@ -0,0 +1,22 @@
1
+ export interface CreditCard {
2
+ number: string;
3
+ formatted: string;
4
+ brand: string;
5
+ expiry: string;
6
+ cvv: string;
7
+ luhn: true;
8
+ }
9
+ export interface CreditResult {
10
+ cards: CreditCard[];
11
+ }
12
+ /**
13
+ * Generates fictitious credit card numbers that pass Luhn validation.
14
+ * These are for testing purposes only — not real card numbers.
15
+ *
16
+ * @param brand - Card brand: visa, mastercard, amex, discover (default: random)
17
+ * @param count - Number of cards to generate (1–10, default 1)
18
+ * @param format - Response format: full or masked (default: masked)
19
+ * @returns Array of generated cards with number, formatted, expiry, cvv
20
+ * @throws Error if brand is unknown, count is out of range, or format is invalid
21
+ */
22
+ export default function credit(brand?: string, count?: number, format?: string): CreditResult;
@@ -0,0 +1,17 @@
1
+ export interface CronResult {
2
+ expression: string;
3
+ description: string;
4
+ next: string[];
5
+ timezone: string;
6
+ }
7
+ /**
8
+ * Parses a cron expression and returns the next scheduled execution dates.
9
+ *
10
+ * @param expr - Cron expression with 5 space-separated fields (minute hour dom month dow)
11
+ * @param count - Number of next executions to return (1–20, default 5)
12
+ * @param from - Starting date in ISO 8601 format (defaults to now)
13
+ * @param timezone - Timezone to evaluate the expression in (default "UTC")
14
+ * @returns Parsed expression with description and list of next execution timestamps
15
+ * @throws Error if the expression is invalid, count is out of range, or timezone is unsupported
16
+ */
17
+ export default function cron(expr: string, count?: number, from?: string, timezone?: string): CronResult;
@@ -0,0 +1,16 @@
1
+ export interface DiceResult {
2
+ roll: string;
3
+ count: number;
4
+ sides: number;
5
+ modifier: number;
6
+ results: number[];
7
+ total: number;
8
+ }
9
+ /**
10
+ * Rolls dice using standard tabletop notation and returns individual results with a total.
11
+ *
12
+ * @param roll - Dice notation string (e.g. "2d6+3", "d20", "4d8-1")
13
+ * @returns Roll breakdown including count, sides, modifier, individual results, and total
14
+ * @throws Error if the notation is missing, invalid, or out of bounds
15
+ */
16
+ export default function dice(roll: string): DiceResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generates a randomized fictional domain profile with metadata.
3
+ *
4
+ * @returns Object containing domain name, IP addresses, DNS info, SEO score, and other domain attributes
5
+ */
6
+ export default function domain(): Record<string, unknown>;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Encodes a UTF-8 string to Base64.
3
+ *
4
+ * @param value - The string to encode
5
+ * @returns Base64-encoded string
6
+ * @throws Error if value is missing, not a string, or too long
7
+ */
8
+ export declare function base64encode(value: string): string;
9
+ /**
10
+ * Decodes a Base64 string to UTF-8.
11
+ *
12
+ * @param value - The Base64 string to decode
13
+ * @returns Decoded UTF-8 string
14
+ * @throws Error if value is missing, not valid Base64, or too long
15
+ */
16
+ export declare function base64decode(value: string): string;
17
+ /**
18
+ * Percent-encodes a string for safe use in a URL.
19
+ *
20
+ * @param value - The string to encode
21
+ * @returns URL-encoded string
22
+ * @throws Error if value is missing, not a string, or too long
23
+ */
24
+ export declare function urlencode(value: string): string;
25
+ /**
26
+ * Decodes a percent-encoded URL string.
27
+ *
28
+ * @param value - The URL-encoded string to decode
29
+ * @returns Decoded string
30
+ * @throws Error if value is missing, not a valid URL-encoded string, or too long
31
+ */
32
+ export declare function urldecode(value: string): string;
33
+ /**
34
+ * Converts a plain text string to Morse code.
35
+ *
36
+ * @param value - The text to encode in Morse code
37
+ * @returns Morse code string where letters are separated by spaces and words by " / "
38
+ * @throws Error if value contains unsupported characters or is too long
39
+ */
40
+ export declare function morse(value: string): string;
41
+ /**
42
+ * Converts a Morse code string back to plain text.
43
+ *
44
+ * @param value - Morse code string (letters separated by spaces, words by " / ")
45
+ * @returns Decoded plain text string
46
+ * @throws Error if the Morse code contains an unrecognized sequence or is too long
47
+ */
48
+ export declare function unmorse(value: string): string;
49
+ /**
50
+ * Applies the ROT13 substitution cipher to a string.
51
+ *
52
+ * @param value - The string to encode
53
+ * @returns ROT13-encoded string (applying it twice restores the original)
54
+ * @throws Error if value is missing, not a string, or too long
55
+ */
56
+ export declare function rot13(value: string): string;
57
+ /**
58
+ * Applies the Caesar cipher by shifting alphabetic characters by a given amount.
59
+ *
60
+ * @param value - The string to encode
61
+ * @param shift - Number of positions to shift (can be negative for left shift)
62
+ * @returns Caesar-shifted string
63
+ * @throws Error if value is missing or shift is not a number
64
+ */
65
+ export declare function caesar(value: string, shift: string): string;
66
+ /**
67
+ * Converts a string to its binary representation, one byte per character.
68
+ *
69
+ * @param value - The string to convert
70
+ * @returns Space-separated 8-bit binary groups (one per character)
71
+ * @throws Error if value is missing, not a string, or too long
72
+ */
73
+ export declare function binary(value: string): string;
74
+ /**
75
+ * Converts a binary string back to plain text.
76
+ *
77
+ * @param value - Space-separated 8-bit binary groups
78
+ * @returns Decoded string
79
+ * @throws Error if value contains non-binary characters or groups are not 8 bits wide
80
+ */
81
+ export declare function unbinary(value: string): string;
@@ -0,0 +1,30 @@
1
+ export interface GeoResult {
2
+ distance: {
3
+ km: number;
4
+ miles: number;
5
+ nauticalMiles: number;
6
+ };
7
+ bearing: {
8
+ degrees: number;
9
+ cardinal: string;
10
+ };
11
+ from: {
12
+ lat: number;
13
+ lon: number;
14
+ };
15
+ to: {
16
+ lat: number;
17
+ lon: number;
18
+ };
19
+ }
20
+ /**
21
+ * Calculates the great-circle distance and bearing between two geographic coordinates.
22
+ *
23
+ * @param lat1 - Latitude of the first point (-90 to 90)
24
+ * @param lon1 - Longitude of the first point (-180 to 180)
25
+ * @param lat2 - Latitude of the second point (-90 to 90)
26
+ * @param lon2 - Longitude of the second point (-180 to 180)
27
+ * @returns Distance in km/miles/nautical miles, compass bearing, and both coordinates
28
+ * @throws Error if any coordinate is out of range or not a number
29
+ */
30
+ export default function geo(lat1: string, lon1: string, lat2: string, lon2: string): GeoResult;
@@ -0,0 +1,15 @@
1
+ export interface HashResult {
2
+ method: string;
3
+ hash: string;
4
+ encoding: string;
5
+ }
6
+ /**
7
+ * Hashes a text string using the specified algorithm and encoding.
8
+ *
9
+ * @param text - The text to hash
10
+ * @param method - Hashing algorithm (e.g. "sha256", "md5")
11
+ * @param encoding - Output encoding: "hex" (default) or "base64"
12
+ * @returns Object containing the method, hash result, and encoding used
13
+ * @throws Error if text is missing, the method is unsupported, or the encoding is invalid
14
+ */
15
+ export default function hash(text: string, method: string, encoding?: string): HashResult;
@@ -0,0 +1,19 @@
1
+ interface CalendarEvent {
2
+ summary: string[] | string;
3
+ subject?: string;
4
+ teacher?: string;
5
+ classes?: string[];
6
+ type?: string;
7
+ start: string;
8
+ end: string;
9
+ }
10
+ /**
11
+ * Fetches and parses an ICS calendar from a Hyperplanning URL, filtering out past events.
12
+ *
13
+ * @param url - HTTPS URL to the ICS calendar
14
+ * @param detail - Level of detail: "full" (subject/teacher/classes), "list" (summary/times), or default (summary only)
15
+ * @returns Array of calendar events sorted by start time, excluding past events
16
+ * @throws Error if the URL is invalid, uses HTTP, points to a private host, or does not return a valid ICS file
17
+ */
18
+ export default function hyperplanning(url: string, detail?: string): Promise<CalendarEvent[]>;
19
+ export {};
@@ -0,0 +1,19 @@
1
+ export interface IpResult {
2
+ ip: string;
3
+ version: 'IPv4' | 'IPv6';
4
+ type: 'public' | 'private' | 'loopback' | 'link-local' | 'multicast' | 'broadcast';
5
+ class?: 'A' | 'B' | 'C' | 'D' | 'E';
6
+ range?: string;
7
+ binary: string;
8
+ decimal?: number;
9
+ reverse: string;
10
+ }
11
+ /**
12
+ * Analyzes an IPv4 or IPv6 address and returns its type, class, binary
13
+ * representation, decimal value, and reverse DNS notation.
14
+ *
15
+ * @param address - The IP address to analyze
16
+ * @returns Detailed breakdown of the address
17
+ * @throws Error if the address is missing or invalid
18
+ */
19
+ export default function ip(address: string): IpResult;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Computes the Levenshtein edit distance between two strings.
3
+ *
4
+ * @param str1 - First string
5
+ * @param str2 - Second string
6
+ * @returns Object containing both strings and the minimum number of single-character edits to transform one into the other
7
+ * @throws Error if either string is missing, not a string, or exceeds the maximum length
8
+ */
9
+ export default function levenshtein(str1: string, str2: string): {
10
+ str1: string;
11
+ str2: string;
12
+ distance: number;
13
+ };
@@ -0,0 +1,19 @@
1
+ export interface PaletteColor {
2
+ hex: string;
3
+ rgb: string;
4
+ hsl: string;
5
+ }
6
+ export interface PaletteResult {
7
+ base: PaletteColor;
8
+ type: string;
9
+ colors: PaletteColor[];
10
+ }
11
+ /**
12
+ * Generates a color palette from a base hex color using a specified harmony type.
13
+ *
14
+ * @param color - Base hex color (e.g. "#ff5733")
15
+ * @param type - Palette type: "complementary", "triadic", "analogous", "tetradic", or "split-complementary"
16
+ * @returns Object containing the base color and the derived palette colors in hex, RGB, and HSL
17
+ * @throws Error if color or type is missing, or the type is not one of the accepted values
18
+ */
19
+ export default function palette(color: string, type: string): PaletteResult;
@@ -0,0 +1,25 @@
1
+ export interface PasswordResult {
2
+ passwords: string[];
3
+ type: string;
4
+ length: number;
5
+ strength: string;
6
+ entropy: number;
7
+ }
8
+ /**
9
+ * Generates one or more passwords using random characters or passphrase mode.
10
+ *
11
+ * @param type - Generation mode: "random" or "passphrase"
12
+ * @param length - Password length for random mode (8–128), or word count for passphrase mode (3–10)
13
+ * @param options - Character set options: uppercase, lowercase, digits, symbols, exclude, count, separator
14
+ * @returns Generated passwords with type, length, strength and entropy
15
+ * @throws Error if no charset is active, length is out of range, or count exceeds the maximum
16
+ */
17
+ export default function password(type?: string, length?: number, options?: {
18
+ uppercase?: boolean;
19
+ lowercase?: boolean;
20
+ digits?: boolean;
21
+ symbols?: boolean;
22
+ exclude?: string;
23
+ count?: number;
24
+ separator?: string;
25
+ }): PasswordResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generates a fictional personal profile with realistic demographic and contact data.
3
+ *
4
+ * @returns Object containing name, email, phone, address, job, hobbies, and other personal attributes
5
+ */
6
+ export default function personal(): Record<string, unknown>;
@@ -0,0 +1,30 @@
1
+ type AvatarShape = 'circle' | 'rounded' | 'square';
2
+ type AnimateMode = 'shimmer' | 'pulse' | 'none';
3
+ export interface PlaceholderOptions {
4
+ width: number;
5
+ height: number;
6
+ bg?: string;
7
+ color?: string;
8
+ text?: string;
9
+ rows?: number;
10
+ avatar?: AvatarShape;
11
+ lines?: number;
12
+ animate?: AnimateMode;
13
+ speed?: number;
14
+ radius?: number;
15
+ }
16
+ export interface PlaceholderResult {
17
+ type: string;
18
+ contentType: string;
19
+ body: string;
20
+ }
21
+ /**
22
+ * Generates an SVG placeholder image or skeleton loader with configurable dimensions and style.
23
+ *
24
+ * @param type - Placeholder type: "image" or "skeleton"
25
+ * @param query - Query parameters including width, height, bg, color, text, rows, avatar, animate, speed, and radius
26
+ * @returns Object containing the SVG body, content type, and placeholder type
27
+ * @throws Error if any parameter is invalid or out of range
28
+ */
29
+ export default function placeholder(type: string, query: Record<string, string | undefined>): PlaceholderResult;
30
+ export {};
@@ -0,0 +1,25 @@
1
+ export interface QRCodeOptions {
2
+ url: string;
3
+ size?: number;
4
+ margin?: number;
5
+ correction?: 'L' | 'M' | 'Q' | 'H';
6
+ dark?: string;
7
+ light?: string;
8
+ icon?: string;
9
+ iconSize?: number;
10
+ iconPadding?: number;
11
+ iconRadius?: number;
12
+ format?: 'png' | 'base64';
13
+ }
14
+ export interface QRCodeResult {
15
+ contentType: string;
16
+ body: Buffer | string;
17
+ }
18
+ /**
19
+ * Generates a QR code image for a given URL, with optional icon overlay and color customization.
20
+ *
21
+ * @param options - QR code generation options including URL, size, margin, correction level, colors, and optional icon
22
+ * @returns Object containing the QR code as a PNG buffer or Base64 string, and the content type
23
+ * @throws Error if the URL is missing, any option is invalid, or the icon URL cannot be fetched
24
+ */
25
+ export default function qrcode(options: QRCodeOptions): Promise<QRCodeResult>;
@@ -0,0 +1,23 @@
1
+ export interface RegexMatch {
2
+ match: string;
3
+ index: number;
4
+ groups: string[];
5
+ namedGroups: Record<string, string>;
6
+ }
7
+ export interface RegexResult {
8
+ valid: boolean;
9
+ pattern: string;
10
+ flags: string;
11
+ matches: RegexMatch[];
12
+ count: number;
13
+ }
14
+ /**
15
+ * Tests a regular expression pattern against a text and returns structured match results.
16
+ *
17
+ * @param pattern - The regex pattern to test (max 200 characters)
18
+ * @param text - The text to match against (max 1000 characters)
19
+ * @param flags - Optional regex flags; only g, i, m, s, u are accepted (g is always forced)
20
+ * @returns Match results with groups and named groups, or { valid: false } if the pattern is invalid
21
+ * @throws Error if pattern or text is missing or exceeds the maximum length
22
+ */
23
+ export default function regex(pattern: string, text: string, flags?: string): RegexResult;
@@ -0,0 +1,20 @@
1
+ export interface StatisticsResult {
2
+ count: number;
3
+ sum: number;
4
+ min: number;
5
+ max: number;
6
+ range: number;
7
+ mean: number;
8
+ median: number;
9
+ mode: number[];
10
+ variance: number;
11
+ stddev: number;
12
+ }
13
+ /**
14
+ * Computes descriptive statistics for a comma-separated list of numbers.
15
+ *
16
+ * @param values - Comma-separated numeric string (e.g. "1,2,3,4,5")
17
+ * @returns Object containing count, sum, min, max, range, mean, median, mode, variance, and standard deviation
18
+ * @throws Error if values is missing, contains non-numeric entries, or exceeds the maximum count
19
+ */
20
+ export default function statistics(values: string): StatisticsResult;
@@ -0,0 +1,43 @@
1
+ export interface TextStats {
2
+ characters: number;
3
+ charactersNoSpaces: number;
4
+ words: number;
5
+ sentences: number;
6
+ paragraphs: number;
7
+ readingTime: string;
8
+ mostFrequentChar: string;
9
+ }
10
+ /**
11
+ * Analyzes a text string and returns character, word, sentence, and reading time statistics.
12
+ *
13
+ * @param value - The text to analyze
14
+ * @returns Object containing character counts, word/sentence/paragraph counts, reading time, and most frequent character
15
+ * @throws Error if value is missing, not a string, or too long
16
+ */
17
+ export declare function stats(value: string): TextStats;
18
+ /**
19
+ * Converts a string to a URL-friendly slug.
20
+ *
21
+ * @param value - The string to slugify
22
+ * @returns Lowercase hyphenated slug with diacritics and special characters removed
23
+ * @throws Error if value is missing, not a string, or too long
24
+ */
25
+ export declare function slug(value: string): string;
26
+ /**
27
+ * Generates Lorem Ipsum placeholder text.
28
+ *
29
+ * @param type - Content type: "words", "sentences", or "paragraphs"
30
+ * @param count - Number of words, sentences, or paragraphs to generate
31
+ * @returns Generated Lorem Ipsum text
32
+ * @throws Error if count is out of range or type is not one of the accepted values
33
+ */
34
+ export declare function lorem(type: string, count: string): string;
35
+ /**
36
+ * Converts an integer to its written-out word form in French or English.
37
+ *
38
+ * @param value - The integer to convert (must be less than 1 billion)
39
+ * @param lang - Language: "fr" for French or "en" for English
40
+ * @returns The number written out in words
41
+ * @throws Error if value is not an integer, exceeds the maximum, or lang is not supported
42
+ */
43
+ export declare function number(value: string, lang: string): string;
@@ -0,0 +1,19 @@
1
+ import type { TicTacToeStorage } from '../../types/storage.js';
2
+ interface TicTacToeParams {
3
+ username?: string;
4
+ move?: string;
5
+ session?: string;
6
+ game?: string;
7
+ private?: boolean;
8
+ storage: TicTacToeStorage;
9
+ }
10
+ /**
11
+ * Handles Tic-Tac-Toe game actions including playing a move, fetching game state, listing games, and forfeiting.
12
+ *
13
+ * @param action - The action to perform: "play", "fetch", "list", or "forfeit"
14
+ * @param params - Game parameters including username, move, session, game ID, and shared storage
15
+ * @returns Game state or action result depending on the action
16
+ * @throws Error if a required parameter is missing, the action is invalid, or a rate limit is exceeded
17
+ */
18
+ export default function tic_tac_toe(action: string, params: TicTacToeParams): Record<string, unknown>;
19
+ export {};
@@ -98,19 +98,19 @@ function playMove(params, games, sessions, u, now) {
98
98
  moves.push(play);
99
99
  const result = checkGame(moves);
100
100
  if (result.winner || result.tie) {
101
- setTimeout(() => delete games[game], GAME_CLEANUP_TTL);
101
+ setTimeout(() => delete games[game], GAME_CLEANUP_TTL).unref();
102
102
  return {
103
103
  message: `Move sent successfully. ${result.winner ? result.winner + ' wins. ' + result.loser + ' loses.' : "It's a tie."}`,
104
104
  ...result,
105
105
  };
106
106
  }
107
- setTimeout(() => delete games[game], SESSION_TTL);
107
+ setTimeout(() => delete games[game], SESSION_TTL).unref();
108
108
  sessions[u] = sessions[u] ?? { user: session, last: now };
109
109
  sessions[u].last = now;
110
110
  setTimeout(() => {
111
111
  if (sessions[u] && now - sessions[u].last >= SESSION_TTL)
112
112
  delete sessions[u];
113
- }, SESSION_TTL);
113
+ }, SESSION_TTL).unref();
114
114
  return { message: 'Move sent successfully' };
115
115
  }
116
116
  function fetchGame(params, games, u) {