@20syldev/api 5.5.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.
- package/.prettierignore +5 -0
- package/README.md +204 -80
- package/dist/app.d.ts +2 -0
- package/dist/config/env.d.ts +21 -0
- package/dist/config/env.js +10 -2
- package/dist/config/env.js.map +1 -1
- package/dist/config/plans.d.ts +26 -0
- package/dist/config/versions.d.ts +18 -0
- package/dist/config/versions.js +6 -0
- package/dist/config/versions.js.map +1 -1
- package/dist/constants.d.ts +39 -0
- package/dist/constants.js +3 -1
- package/dist/constants.js.map +1 -1
- package/dist/middleware/cors.d.ts +2 -0
- package/dist/middleware/cors.js +2 -1
- package/dist/middleware/cors.js.map +1 -1
- package/dist/middleware/error.d.ts +4 -0
- package/dist/middleware/json.d.ts +2 -0
- package/dist/middleware/logger.d.ts +26 -0
- package/dist/middleware/logger.js +34 -1
- package/dist/middleware/logger.js.map +1 -1
- package/dist/middleware/ratelimit.d.ts +2 -0
- package/dist/middleware/version.d.ts +3 -0
- package/dist/middleware/version.js +2 -2
- package/dist/middleware/version.js.map +1 -1
- package/dist/modules/v3/algorithms.d.ts +82 -0
- package/dist/modules/v3/captcha.d.ts +8 -0
- package/dist/modules/v3/chat.d.ts +9 -0
- package/dist/modules/v3/chat.js +3 -3
- package/dist/modules/v3/chat.js.map +1 -1
- package/dist/modules/v3/color.d.ts +6 -0
- package/dist/modules/v3/convert.d.ts +10 -0
- package/dist/modules/v3/domain.d.ts +6 -0
- package/dist/modules/v3/hash.d.ts +8 -0
- package/dist/modules/v3/hyperplanning.d.ts +9 -0
- package/dist/modules/v3/levenshtein.d.ts +9 -0
- package/dist/modules/v3/personal.d.ts +6 -0
- package/dist/modules/v3/qrcode.d.ts +8 -0
- package/dist/modules/v3/tic_tac_toe.d.ts +9 -0
- package/dist/modules/v3/tic_tac_toe.js +3 -3
- package/dist/modules/v3/tic_tac_toe.js.map +1 -1
- package/dist/modules/v3/time.d.ts +12 -0
- package/dist/modules/v3/token.d.ts +9 -0
- package/dist/modules/v3/username.d.ts +6 -0
- package/dist/modules/v3/utils.d.ts +50 -0
- package/dist/modules/v3.d.ts +15 -0
- package/dist/modules/v4/address.d.ts +20 -0
- package/dist/modules/v4/agent.d.ts +30 -0
- package/dist/modules/v4/algorithms.d.ts +90 -0
- package/dist/modules/v4/avatar.d.ts +23 -0
- package/dist/modules/v4/barcode.d.ts +27 -0
- package/dist/modules/v4/captcha.d.ts +22 -0
- package/dist/modules/v4/chat.d.ts +21 -0
- package/dist/modules/v4/chat.js +3 -3
- package/dist/modules/v4/chat.js.map +1 -1
- package/dist/modules/v4/color.d.ts +16 -0
- package/dist/modules/v4/convert.d.ts +15 -0
- package/dist/modules/v4/credit.d.ts +22 -0
- package/dist/modules/v4/cron.d.ts +17 -0
- package/dist/modules/v4/dice.d.ts +16 -0
- package/dist/modules/v4/domain.d.ts +6 -0
- package/dist/modules/v4/encode.d.ts +81 -0
- package/dist/modules/v4/geo.d.ts +30 -0
- package/dist/modules/v4/hash.d.ts +15 -0
- package/dist/modules/v4/hyperplanning.d.ts +19 -0
- package/dist/modules/v4/ip.d.ts +19 -0
- package/dist/modules/v4/levenshtein.d.ts +13 -0
- package/dist/modules/v4/palette.d.ts +19 -0
- package/dist/modules/v4/password.d.ts +25 -0
- package/dist/modules/v4/personal.d.ts +6 -0
- package/dist/modules/v4/placeholder.d.ts +30 -0
- package/dist/modules/v4/qrcode.d.ts +25 -0
- package/dist/modules/v4/regex.d.ts +23 -0
- package/dist/modules/v4/statistics.d.ts +20 -0
- package/dist/modules/v4/text.d.ts +43 -0
- package/dist/modules/v4/tic_tac_toe.d.ts +19 -0
- package/dist/modules/v4/tic_tac_toe.js +3 -3
- package/dist/modules/v4/tic_tac_toe.js.map +1 -1
- package/dist/modules/v4/time.d.ts +15 -0
- package/dist/modules/v4/token.d.ts +9 -0
- package/dist/modules/v4/username.d.ts +6 -0
- package/dist/modules/v4/validate.d.ts +34 -0
- package/dist/modules/v4.d.ts +32 -0
- package/dist/modules/v5/address.d.ts +5 -0
- package/dist/modules/v5/algorithms.d.ts +9 -0
- package/dist/modules/v5/asymmetric.d.ts +26 -0
- package/dist/modules/v5/barcode.d.ts +27 -0
- package/dist/modules/v5/case.d.ts +10 -0
- package/dist/modules/v5/chart.d.ts +53 -0
- package/dist/modules/v5/chat.d.ts +21 -0
- package/dist/modules/v5/chat.js +3 -3
- package/dist/modules/v5/chat.js.map +1 -1
- package/dist/modules/v5/csv.d.ts +29 -0
- package/dist/modules/v5/csv.js +143 -0
- package/dist/modules/v5/csv.js.map +1 -0
- package/dist/modules/v5/evaluate.d.ts +14 -0
- package/dist/modules/v5/jwt.d.ts +11 -0
- package/dist/modules/v5/matrix.d.ts +77 -0
- package/dist/modules/v5/otp.d.ts +30 -0
- package/dist/modules/v5/symmetric.d.ts +15 -0
- package/dist/modules/v5/text.d.ts +5 -0
- package/dist/modules/v5/tic_tac_toe.d.ts +19 -0
- package/dist/modules/v5/tic_tac_toe.js +3 -3
- package/dist/modules/v5/tic_tac_toe.js.map +1 -1
- package/dist/modules/v5/url.d.ts +18 -0
- package/dist/modules/v5/url.js +51 -0
- package/dist/modules/v5/url.js.map +1 -0
- package/dist/modules/v5.d.ts +17 -0
- package/dist/modules/v5.js +2 -0
- package/dist/modules/v5.js.map +1 -1
- package/dist/routes/delete.d.ts +2 -0
- package/dist/routes/delete.js +2 -2
- package/dist/routes/delete.js.map +1 -1
- package/dist/routes/get.d.ts +2 -0
- package/dist/routes/get.js +104 -82
- package/dist/routes/get.js.map +1 -1
- package/dist/routes/index.d.ts +2 -0
- package/dist/routes/index.js +8 -4
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/patch.d.ts +2 -0
- package/dist/routes/patch.js +1 -1
- package/dist/routes/patch.js.map +1 -1
- package/dist/routes/post.d.ts +2 -0
- package/dist/routes/post.js +54 -29
- package/dist/routes/post.js.map +1 -1
- package/dist/storage/index.d.ts +4 -0
- package/dist/types/storage.d.ts +49 -0
- package/dist/utils/colors.d.ts +44 -0
- package/dist/utils/helpers.d.ts +55 -0
- package/dist/utils/response.d.ts +9 -0
- package/dist/utils/response.js +2 -4
- package/dist/utils/response.js.map +1 -1
- package/package.json +17 -16
- package/robots.txt +74 -0
- package/src/favicon.ico +0 -0
- package/dist/middleware/connection.js +0 -23
- package/dist/middleware/connection.js.map +0 -1
- package/dist/modules/v4/colors.js +0 -54
- package/dist/modules/v4/colors.js.map +0 -1
- package/dist/modules/v4/utils.js +0 -26
- package/dist/modules/v4/utils.js.map +0 -1
- package/dist/modules/v5/diff.js +0 -52
- package/dist/modules/v5/diff.js.map +0 -1
- package/dist/modules/v5/read.js +0 -39
- package/dist/modules/v5/read.js.map +0 -1
- package/dist/utils/version.js +0 -3
- package/dist/utils/version.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether two strings are anagrams of each other.
|
|
3
|
+
*
|
|
4
|
+
* @param value - First string
|
|
5
|
+
* @param value2 - Second string
|
|
6
|
+
* @returns True if the strings are anagrams, false otherwise
|
|
7
|
+
* @throws Error if either value is missing, not a string, or out of length bounds
|
|
8
|
+
*/
|
|
9
|
+
export declare function anagram(value: string, value2: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Sorts a comma-separated list of numbers using the bubble sort algorithm.
|
|
12
|
+
*
|
|
13
|
+
* @param value - Comma-separated string of numbers (e.g. "3,1,2")
|
|
14
|
+
* @returns Array of numbers sorted in ascending order
|
|
15
|
+
* @throws Error if value is missing, non-numeric, or contains fewer than two elements
|
|
16
|
+
*/
|
|
17
|
+
export declare function bubblesort(value: string): number[];
|
|
18
|
+
/**
|
|
19
|
+
* Computes the factorial of a non-negative integer.
|
|
20
|
+
*
|
|
21
|
+
* @param value - The integer to compute the factorial of
|
|
22
|
+
* @returns The factorial of the given number
|
|
23
|
+
* @throws Error if value is not a number, is negative, or exceeds the maximum allowed
|
|
24
|
+
*/
|
|
25
|
+
export declare function factorial(value: string | number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the first n numbers of the Fibonacci sequence.
|
|
28
|
+
*
|
|
29
|
+
* @param value - How many Fibonacci numbers to generate
|
|
30
|
+
* @returns Array of Fibonacci numbers starting from 0
|
|
31
|
+
* @throws Error if value is not a number, is negative, or exceeds 1000
|
|
32
|
+
*/
|
|
33
|
+
export declare function fibonacci(value: string | number): number[];
|
|
34
|
+
/**
|
|
35
|
+
* Computes the greatest common divisor of two positive integers using the Euclidean algorithm.
|
|
36
|
+
*
|
|
37
|
+
* @param value - First positive integer
|
|
38
|
+
* @param value2 - Second positive integer
|
|
39
|
+
* @returns The greatest common divisor
|
|
40
|
+
* @throws Error if either value is not a positive number or exceeds the maximum allowed
|
|
41
|
+
*/
|
|
42
|
+
export declare function gcd(value: string | number, value2: string | number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Determines whether a given number is prime.
|
|
45
|
+
*
|
|
46
|
+
* @param value - The number to test
|
|
47
|
+
* @returns True if the number is prime, false otherwise
|
|
48
|
+
* @throws Error if value is not a positive number or exceeds the maximum allowed
|
|
49
|
+
*/
|
|
50
|
+
export declare function isprime(value: string | number): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether a string reads the same forwards and backwards.
|
|
53
|
+
*
|
|
54
|
+
* @param value - The string to test
|
|
55
|
+
* @returns True if the string is a palindrome, false otherwise
|
|
56
|
+
* @throws Error if value is missing, not a string, or out of length bounds
|
|
57
|
+
*/
|
|
58
|
+
export declare function palindrome(value: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the prime factorization of a given integer.
|
|
61
|
+
*
|
|
62
|
+
* @param value - An integer greater than 1
|
|
63
|
+
* @returns Array of prime factors in ascending order
|
|
64
|
+
* @throws Error if value is not a number, less than 2, or exceeds the maximum allowed
|
|
65
|
+
*/
|
|
66
|
+
export declare function primefactors(value: string | number): number[];
|
|
67
|
+
/**
|
|
68
|
+
* Returns all prime numbers up to and including the given limit.
|
|
69
|
+
*
|
|
70
|
+
* @param value - The upper bound (inclusive)
|
|
71
|
+
* @returns Array of prime numbers up to the given limit
|
|
72
|
+
* @throws Error if value is not a number, less than 2, or exceeds the maximum allowed
|
|
73
|
+
*/
|
|
74
|
+
export declare function primelist(value: string | number): number[];
|
|
75
|
+
/**
|
|
76
|
+
* Reverses a string.
|
|
77
|
+
*
|
|
78
|
+
* @param value - The string to reverse
|
|
79
|
+
* @returns The reversed string
|
|
80
|
+
* @throws Error if value is missing or not a string
|
|
81
|
+
*/
|
|
82
|
+
export declare function reverse(value: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* Converts an integer to its Roman numeral representation, or a Roman numeral to an integer.
|
|
85
|
+
*
|
|
86
|
+
* @param value - An integer (1–3999) or a Roman numeral string
|
|
87
|
+
* @returns The converted value — a Roman numeral string if input was numeric, or an integer if input was a Roman numeral
|
|
88
|
+
* @throws Error if value is missing, out of range, or not a valid Roman numeral
|
|
89
|
+
*/
|
|
90
|
+
export declare function roman(value: string): number | string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface AvatarOptions {
|
|
2
|
+
seed?: string;
|
|
3
|
+
size?: number;
|
|
4
|
+
type?: string;
|
|
5
|
+
bg?: string;
|
|
6
|
+
format?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AvatarResult {
|
|
9
|
+
contentType: string;
|
|
10
|
+
body: Buffer | string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generates a deterministic identicon or pixel-art avatar from a seed string.
|
|
14
|
+
*
|
|
15
|
+
* @param options.seed - Seed string (default: random UUID)
|
|
16
|
+
* @param options.size - Output size in px (50–500, default 200)
|
|
17
|
+
* @param options.type - Avatar style: identicon or pixel (default: identicon)
|
|
18
|
+
* @param options.bg - Background hex color (default: #f0f0f0)
|
|
19
|
+
* @param options.format - Output format: png or svg (default: png)
|
|
20
|
+
* @returns Object with contentType and body (Buffer for PNG, string for SVG)
|
|
21
|
+
* @throws Error if type, format, or size is invalid
|
|
22
|
+
*/
|
|
23
|
+
export default function avatar(options?: AvatarOptions): AvatarResult;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface BarcodeOptions {
|
|
2
|
+
data: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
format?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
bg?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BarcodeResult {
|
|
11
|
+
contentType: string;
|
|
12
|
+
body: Buffer | string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates a barcode image in SVG or PNG format.
|
|
16
|
+
*
|
|
17
|
+
* @param options.data - Data to encode (required)
|
|
18
|
+
* @param options.type - Barcode type: code128, ean13, ean8, upca, code39 (default: code128)
|
|
19
|
+
* @param options.width - Bar unit width in px (1–5, default 2)
|
|
20
|
+
* @param options.height - Bar height in px (50–300, default 100)
|
|
21
|
+
* @param options.format - Output format: svg or png (default: svg)
|
|
22
|
+
* @param options.color - Bar color hex (default: #000000)
|
|
23
|
+
* @param options.bg - Background color hex (default: #ffffff)
|
|
24
|
+
* @returns Object with contentType and body
|
|
25
|
+
* @throws Error if data is missing, invalid for the type, or parameters are out of range
|
|
26
|
+
*/
|
|
27
|
+
export default function barcode(options: BarcodeOptions): BarcodeResult;
|
|
@@ -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 {};
|
package/dist/modules/v4/chat.js
CHANGED
|
@@ -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,CAAC;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEvB,cAAc,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAEnC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,EA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AQ,CAAC;IACzC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,gBAAgB,CACrB,MAAkB,EAClB,YAA2C,EAC3C,QAAwD,EACxD,CAAS;IAET,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAElC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACnE,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,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,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;
|