tiny-essentials 1.8.3 → 1.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TinyBasicsEs.js +31 -0
- package/dist/TinyBasicsEs.min.js +1 -1
- package/dist/TinyEssentials.js +31 -0
- package/dist/TinyEssentials.min.js +1 -1
- package/dist/legacy/crypto/decrypt.cjs +1 -1
- package/dist/legacy/crypto/decrypt.mjs +3 -3
- package/dist/legacy/crypto/default.cjs +0 -2
- package/dist/legacy/crypto/default.mjs +0 -1
- package/dist/legacy/crypto/encrypt.cjs +1 -2
- package/dist/legacy/crypto/encrypt.mjs +3 -4
- package/dist/legacy/crypto/index.cjs +1 -1
- package/dist/legacy/crypto/index.mjs +0 -1
- package/dist/legacy/firebase/database/presence.cjs +4 -1
- package/dist/legacy/firebase/database/presence.d.mts +3 -0
- package/dist/legacy/firebase/database/presence.mjs +4 -1
- package/dist/legacy/firebase/databaseLogger.cjs +2 -2
- package/dist/legacy/firebase/discord/get/cookie-session.cjs +2 -2
- package/dist/legacy/firebase/discord/get/errorValidator.cjs +2 -2
- package/dist/legacy/firebase/discord/http/login.cjs +7 -7
- package/dist/legacy/firebase/discord/http/logout.cjs +4 -4
- package/dist/legacy/firebase/discord/http/redirect.cjs +7 -7
- package/dist/legacy/firebase/discord/http/refreshToken.cjs +5 -5
- package/dist/legacy/firebase/discord/template/cookie-session.cjs +8 -8
- package/dist/legacy/firebase/logger.cjs +7 -7
- package/dist/legacy/firebase/mySQL.cjs +1 -0
- package/dist/legacy/firebase/mysqlConnector/sameUser.cjs +2 -2
- package/dist/legacy/get/countObj.cjs +2 -22
- package/dist/legacy/get/countObj.d.mts +2 -11
- package/dist/legacy/get/countObj.mjs +2 -22
- package/dist/legacy/get/decimalColor.cjs +10 -11
- package/dist/legacy/get/decimalColor.mjs +10 -10
- package/dist/legacy/get/objType.cjs +2 -40
- package/dist/legacy/get/objType.d.mts +2 -19
- package/dist/legacy/get/objType.mjs +2 -41
- package/dist/legacy/get/pagination.cjs +30 -25
- package/dist/legacy/get/pagination.d.mts +29 -12
- package/dist/legacy/get/pagination.mjs +30 -23
- package/dist/legacy/get/queryUrlByName.cjs +0 -2
- package/dist/legacy/get/queryUrlByName.mjs +0 -1
- package/dist/legacy/get/queryUrlJSON.cjs +2 -2
- package/dist/legacy/get/queryUrlJSON.mjs +1 -1
- package/dist/legacy/get/super_string_filter.cjs +14 -6
- package/dist/legacy/get/super_string_filter.mjs +11 -1
- package/dist/legacy/get/versionCheck.cjs +18 -19
- package/dist/legacy/get/versionCheck.d.mts +15 -5
- package/dist/legacy/get/versionCheck.mjs +16 -16
- package/dist/legacy/http/HTTP-1.0.cjs +2 -4
- package/dist/legacy/http/HTTP-1.0.d.mts +1 -1
- package/dist/legacy/http/HTTP-1.0.mjs +2 -3
- package/dist/legacy/http/auth.cjs +2 -4
- package/dist/legacy/http/auth.d.mts +4 -4
- package/dist/legacy/http/auth.mjs +2 -3
- package/dist/legacy/http/check_domain.cjs +15 -9
- package/dist/legacy/http/check_domain.d.mts +5 -6
- package/dist/legacy/http/check_domain.mjs +12 -8
- package/dist/legacy/http/csrfTokenAnalyze.cjs +5 -4
- package/dist/legacy/http/csrfTokenAnalyze.d.mts +3 -3
- package/dist/legacy/http/csrfTokenAnalyze.mjs +7 -4
- package/dist/legacy/http/domainValidator.cjs +13 -9
- package/dist/legacy/http/domainValidator.d.mts +15 -6
- package/dist/legacy/http/domainValidator.mjs +11 -6
- package/dist/legacy/http/errorsCallback.cjs +10 -4
- package/dist/legacy/http/errorsCallback.d.mts +13 -3
- package/dist/legacy/http/errorsCallback.mjs +12 -4
- package/dist/legacy/http/fetch/json.cjs +1 -3
- package/dist/legacy/http/fetch/json.mjs +1 -1
- package/dist/legacy/http/fetch/text.cjs +1 -3
- package/dist/legacy/http/fetch/text.mjs +1 -1
- package/dist/legacy/http/fileCache.cjs +2 -5
- package/dist/legacy/http/fileCache.d.mts +3 -3
- package/dist/legacy/http/fileCache.mjs +2 -3
- package/dist/legacy/http/getDomainURL.cjs +4 -7
- package/dist/legacy/http/getDomainURL.d.mts +2 -2
- package/dist/legacy/http/getDomainURL.mjs +4 -5
- package/dist/legacy/http/userIP.cjs +7 -5
- package/dist/legacy/http/userIP.d.mts +10 -4
- package/dist/legacy/http/userIP.mjs +7 -4
- package/dist/legacy/index.cjs +3 -4
- package/dist/legacy/index.d.mts +8 -9
- package/dist/legacy/libs/arraySortPositions.cjs +1 -3
- package/dist/legacy/libs/arraySortPositions.d.mts +2 -2
- package/dist/legacy/libs/arraySortPositions.mjs +1 -2
- package/dist/legacy/libs/capitalize.cjs +0 -2
- package/dist/legacy/libs/capitalize.mjs +0 -1
- package/dist/legacy/libs/convertBytes.cjs +1 -3
- package/dist/legacy/libs/convertBytes.mjs +1 -2
- package/dist/legacy/libs/custom_module_loader.cjs +13 -9
- package/dist/legacy/libs/custom_module_loader.d.mts +1 -1
- package/dist/legacy/libs/custom_module_loader.mjs +10 -5
- package/dist/legacy/libs/dice.cjs +0 -2
- package/dist/legacy/libs/dice.mjs +0 -1
- package/dist/legacy/libs/markdown.cjs +13 -4
- package/dist/legacy/libs/markdown.d.mts +7 -71
- package/dist/legacy/libs/markdown.mjs +13 -3
- package/dist/legacy/libs/percentage.cjs +0 -2
- package/dist/legacy/libs/percentage.mjs +0 -1
- package/dist/legacy/libs/regex/getLetter.cjs +0 -2
- package/dist/legacy/libs/regex/getLetter.mjs +0 -1
- package/dist/legacy/libs/rule3.cjs +0 -2
- package/dist/legacy/libs/rule3.mjs +0 -1
- package/dist/legacy/momentjs/getAge.cjs +0 -3
- package/dist/legacy/momentjs/getAge.d.mts +1 -0
- package/dist/legacy/momentjs/getAge.mjs +0 -1
- package/dist/legacy/momentjs/index.cjs +1 -1
- package/dist/legacy/momentjs/index.mjs +0 -1
- package/dist/legacy/momentjs/timeDuration.cjs +1 -3
- package/dist/legacy/momentjs/timeDuration.d.mts +1 -0
- package/dist/legacy/momentjs/timeDuration.mjs +1 -1
- package/dist/legacy/socket.io/antiFlood/index.cjs +1 -1
- package/dist/legacy/socket.io/antiFlood/index.mjs +0 -1
- package/dist/legacy/socket.io/antiFlood/install.cjs +3 -5
- package/dist/legacy/socket.io/antiFlood/install.d.mts +5 -3
- package/dist/legacy/socket.io/antiFlood/install.mjs +3 -3
- package/dist/legacy/socket.io/antiFlood/verify.cjs +10 -6
- package/dist/legacy/socket.io/antiFlood/verify.d.mts +8 -3
- package/dist/legacy/socket.io/antiFlood/verify.mjs +10 -6
- package/dist/legacy/socket.io/cookie-session.cjs +1 -2
- package/dist/legacy/socket.io/cookie-session.mjs +1 -1
- package/dist/legacy/socket.io/discord.cjs +0 -3
- package/dist/legacy/socket.io/discord.mjs +0 -1
- package/dist/legacy/socket.io/index.cjs +0 -3
- package/dist/legacy/socket.io/index.mjs +0 -1
- package/dist/v1/basics/index.cjs +3 -0
- package/dist/v1/basics/index.d.mts +3 -1
- package/dist/v1/basics/index.mjs +3 -2
- package/dist/v1/index.cjs +3 -0
- package/dist/v1/index.d.mts +3 -1
- package/dist/v1/index.mjs +3 -2
- package/docs/basics/array.md +61 -0
- package/package.json +8 -2
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Checks the internal type of an object using `Object.prototype.toString`.
|
|
4
|
-
*
|
|
5
|
-
* - If `type` is provided, returns `true` if it matches the object's internal type (case-insensitive).
|
|
6
|
-
* - If `type` is omitted, returns the object's internal type as a lowercase string.
|
|
7
|
-
*
|
|
8
|
-
* Examples:
|
|
9
|
-
* ```js
|
|
10
|
-
* objType([], 'array'); // true
|
|
11
|
-
* objType({}, 'object'); // true
|
|
12
|
-
* objType('hello'); // "string"
|
|
13
|
-
* objType(undefined); // null
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @param {*} obj - The value to check the type of.
|
|
17
|
-
* @param {string} [type] - Optional string to compare the object's type against.
|
|
18
|
-
* @returns {boolean|string|null} Returns true/false if checking, or type string/null if querying.
|
|
19
|
-
*/
|
|
20
|
-
export default function objType(obj, type) {
|
|
21
|
-
// Is Defined
|
|
22
|
-
if (typeof obj !== 'undefined') {
|
|
23
|
-
// Check Obj Type
|
|
24
|
-
if (typeof type === 'string') {
|
|
25
|
-
if (Object.prototype.toString.call(obj).toLowerCase() === `[object ${type}]`)
|
|
26
|
-
return true;
|
|
27
|
-
else
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
// Get Obj Type
|
|
31
|
-
else {
|
|
32
|
-
// Result
|
|
33
|
-
const result = Object.prototype.toString.call(obj).toLowerCase();
|
|
34
|
-
// Send Result
|
|
35
|
-
return result.substring(8, result.length - 1);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// Nope
|
|
39
|
-
else
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
1
|
+
import { objType } from '../../v1/basics/objFilter.mjs';
|
|
2
|
+
export default objType;
|
|
@@ -2,8 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
var queryUrlJSON = require('./queryUrlJSON.cjs');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {{
|
|
7
|
+
* url: string; // The updated URL prefix to use for each page link.
|
|
8
|
+
* extraClass: string; // Additional class name passed through.
|
|
9
|
+
* extraClass2: string; // Additional class name passed through.
|
|
10
|
+
* page: number; // The current page.
|
|
11
|
+
* pagination: number[]; // An array of page numbers to be displayed.
|
|
12
|
+
* previous: boolean; // Whether there are previous pages.
|
|
13
|
+
* next: boolean; // Whether there are next pages.
|
|
14
|
+
* firstPagination: boolean; // `true` if page 1 is not in the visible pagination and should be shown separately.
|
|
15
|
+
* lastPagination: boolean; // `true` if the last page is not in the visible pagination and should be shown separately.
|
|
16
|
+
* pages: number; // Total number of pages.
|
|
17
|
+
* }} PaginationData
|
|
18
|
+
*/
|
|
7
19
|
|
|
8
20
|
/**
|
|
9
21
|
* Generates pagination metadata for a given query and current page.
|
|
@@ -17,17 +29,8 @@ var queryUrlJSON = require('./queryUrlJSON.cjs');
|
|
|
17
29
|
* @param {string} [extraClass=''] - Additional class name for styling the pagination container.
|
|
18
30
|
* @param {string} [extraClass2=''] - Additional class name for individual page links.
|
|
19
31
|
*
|
|
20
|
-
* @returns {
|
|
21
|
-
|
|
22
|
-
* - `extraClass` {string} - Additional class name passed through.
|
|
23
|
-
* - `extraClass2` {string} - Additional class name passed through.
|
|
24
|
-
* - `page` {number} - The current page.
|
|
25
|
-
* - `pagination` {number[]} - An array of page numbers to be displayed.
|
|
26
|
-
* - `previous` {boolean} - Whether there are previous pages.
|
|
27
|
-
* - `next` {boolean} - Whether there are next pages.
|
|
28
|
-
* - `firstPagination` {boolean} - `true` if page 1 is not in the visible pagination and should be shown separately.
|
|
29
|
-
* - `lastPagination` {boolean} - `true` if the last page is not in the visible pagination and should be shown separately.
|
|
30
|
-
* - `pages` {number} - Total number of pages.
|
|
32
|
+
* @returns {PaginationData} Pagination metadata
|
|
33
|
+
|
|
31
34
|
*/
|
|
32
35
|
function pagination(
|
|
33
36
|
query,
|
|
@@ -60,39 +63,41 @@ function pagination(
|
|
|
60
63
|
} else url += finalURLResult('?');
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const pagination = [];
|
|
66
|
+
/** @type {PaginationData} */
|
|
66
67
|
const data = {
|
|
67
68
|
url: url,
|
|
68
69
|
extraClass: extraClass,
|
|
69
70
|
extraClass2: extraClass2,
|
|
71
|
+
next: false,
|
|
72
|
+
previous: false,
|
|
73
|
+
page: -1,
|
|
74
|
+
pages: -1,
|
|
75
|
+
pagination: [],
|
|
76
|
+
firstPagination: true,
|
|
77
|
+
lastPagination: true,
|
|
70
78
|
};
|
|
71
79
|
|
|
72
|
-
data.next = false;
|
|
73
|
-
data.previous = false;
|
|
74
80
|
for (let i = page - 1; i > page - 5; i--) {
|
|
75
81
|
if (i > 0) {
|
|
76
|
-
pagination.push(i);
|
|
82
|
+
data.pagination.push(i);
|
|
77
83
|
data.previous = true;
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
|
-
pagination.reverse();
|
|
81
|
-
pagination.push(page);
|
|
86
|
+
data.pagination.reverse();
|
|
87
|
+
data.pagination.push(page);
|
|
82
88
|
for (let i = page + 1; i < page + 5; i++) {
|
|
83
89
|
if (i <= total) {
|
|
84
|
-
pagination.push(i);
|
|
90
|
+
data.pagination.push(i);
|
|
85
91
|
data.next = true;
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
// Build Data and send it
|
|
90
96
|
data.page = page;
|
|
91
|
-
data.pagination = pagination;
|
|
92
97
|
|
|
93
|
-
if (pagination.indexOf(1) < 0) data.firstPagination = true;
|
|
98
|
+
if (data.pagination.indexOf(1) < 0) data.firstPagination = true;
|
|
94
99
|
else data.firstPagination = false;
|
|
95
|
-
if (pagination.indexOf(total) < 0) data.lastPagination = true;
|
|
100
|
+
if (data.pagination.indexOf(total) < 0) data.lastPagination = true;
|
|
96
101
|
else data.lastPagination = false;
|
|
97
102
|
|
|
98
103
|
data.pages = total;
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{
|
|
3
|
+
* url: string; // The updated URL prefix to use for each page link.
|
|
4
|
+
* extraClass: string; // Additional class name passed through.
|
|
5
|
+
* extraClass2: string; // Additional class name passed through.
|
|
6
|
+
* page: number; // The current page.
|
|
7
|
+
* pagination: number[]; // An array of page numbers to be displayed.
|
|
8
|
+
* previous: boolean; // Whether there are previous pages.
|
|
9
|
+
* next: boolean; // Whether there are next pages.
|
|
10
|
+
* firstPagination: boolean; // `true` if page 1 is not in the visible pagination and should be shown separately.
|
|
11
|
+
* lastPagination: boolean; // `true` if the last page is not in the visible pagination and should be shown separately.
|
|
12
|
+
* pages: number; // Total number of pages.
|
|
13
|
+
* }} PaginationData
|
|
14
|
+
*/
|
|
1
15
|
/**
|
|
2
16
|
* Generates pagination metadata for a given query and current page.
|
|
3
17
|
* It builds a list of pages to display and determines whether "next" and "previous" buttons should be shown.
|
|
@@ -10,17 +24,20 @@
|
|
|
10
24
|
* @param {string} [extraClass=''] - Additional class name for styling the pagination container.
|
|
11
25
|
* @param {string} [extraClass2=''] - Additional class name for individual page links.
|
|
12
26
|
*
|
|
13
|
-
* @returns {
|
|
14
|
-
|
|
15
|
-
* - `extraClass` {string} - Additional class name passed through.
|
|
16
|
-
* - `extraClass2` {string} - Additional class name passed through.
|
|
17
|
-
* - `page` {number} - The current page.
|
|
18
|
-
* - `pagination` {number[]} - An array of page numbers to be displayed.
|
|
19
|
-
* - `previous` {boolean} - Whether there are previous pages.
|
|
20
|
-
* - `next` {boolean} - Whether there are next pages.
|
|
21
|
-
* - `firstPagination` {boolean} - `true` if page 1 is not in the visible pagination and should be shown separately.
|
|
22
|
-
* - `lastPagination` {boolean} - `true` if the last page is not in the visible pagination and should be shown separately.
|
|
23
|
-
* - `pages` {number} - Total number of pages.
|
|
27
|
+
* @returns {PaginationData} Pagination metadata
|
|
28
|
+
|
|
24
29
|
*/
|
|
25
|
-
export default function pagination(query: string, page: number, total: number, url?: string, extraClass?: string, extraClass2?: string):
|
|
30
|
+
export default function pagination(query: string, page: number, total: number, url?: string, extraClass?: string, extraClass2?: string): PaginationData;
|
|
31
|
+
export type PaginationData = {
|
|
32
|
+
url: string;
|
|
33
|
+
extraClass: string;
|
|
34
|
+
extraClass2: string;
|
|
35
|
+
page: number;
|
|
36
|
+
pagination: number[];
|
|
37
|
+
previous: boolean;
|
|
38
|
+
next: boolean;
|
|
39
|
+
firstPagination: boolean;
|
|
40
|
+
lastPagination: boolean;
|
|
41
|
+
pages: number;
|
|
42
|
+
};
|
|
26
43
|
//# sourceMappingURL=pagination.d.mts.map
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import queryUrlJSON from './queryUrlJSON.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {{
|
|
4
|
+
* url: string; // The updated URL prefix to use for each page link.
|
|
5
|
+
* extraClass: string; // Additional class name passed through.
|
|
6
|
+
* extraClass2: string; // Additional class name passed through.
|
|
7
|
+
* page: number; // The current page.
|
|
8
|
+
* pagination: number[]; // An array of page numbers to be displayed.
|
|
9
|
+
* previous: boolean; // Whether there are previous pages.
|
|
10
|
+
* next: boolean; // Whether there are next pages.
|
|
11
|
+
* firstPagination: boolean; // `true` if page 1 is not in the visible pagination and should be shown separately.
|
|
12
|
+
* lastPagination: boolean; // `true` if the last page is not in the visible pagination and should be shown separately.
|
|
13
|
+
* pages: number; // Total number of pages.
|
|
14
|
+
* }} PaginationData
|
|
15
|
+
*/
|
|
3
16
|
/**
|
|
4
17
|
* Generates pagination metadata for a given query and current page.
|
|
5
18
|
* It builds a list of pages to display and determines whether "next" and "previous" buttons should be shown.
|
|
@@ -12,17 +25,8 @@ import queryUrlJSON from './queryUrlJSON.mjs';
|
|
|
12
25
|
* @param {string} [extraClass=''] - Additional class name for styling the pagination container.
|
|
13
26
|
* @param {string} [extraClass2=''] - Additional class name for individual page links.
|
|
14
27
|
*
|
|
15
|
-
* @returns {
|
|
16
|
-
|
|
17
|
-
* - `extraClass` {string} - Additional class name passed through.
|
|
18
|
-
* - `extraClass2` {string} - Additional class name passed through.
|
|
19
|
-
* - `page` {number} - The current page.
|
|
20
|
-
* - `pagination` {number[]} - An array of page numbers to be displayed.
|
|
21
|
-
* - `previous` {boolean} - Whether there are previous pages.
|
|
22
|
-
* - `next` {boolean} - Whether there are next pages.
|
|
23
|
-
* - `firstPagination` {boolean} - `true` if page 1 is not in the visible pagination and should be shown separately.
|
|
24
|
-
* - `lastPagination` {boolean} - `true` if the last page is not in the visible pagination and should be shown separately.
|
|
25
|
-
* - `pages` {number} - Total number of pages.
|
|
28
|
+
* @returns {PaginationData} Pagination metadata
|
|
29
|
+
|
|
26
30
|
*/
|
|
27
31
|
export default function pagination(query, page, total, url = '', extraClass = '', extraClass2 = '') {
|
|
28
32
|
// Fix URL
|
|
@@ -53,37 +57,40 @@ export default function pagination(query, page, total, url = '', extraClass = ''
|
|
|
53
57
|
else
|
|
54
58
|
url += finalURLResult('?');
|
|
55
59
|
}
|
|
56
|
-
|
|
57
|
-
const pagination = [];
|
|
60
|
+
/** @type {PaginationData} */
|
|
58
61
|
const data = {
|
|
59
62
|
url: url,
|
|
60
63
|
extraClass: extraClass,
|
|
61
64
|
extraClass2: extraClass2,
|
|
65
|
+
next: false,
|
|
66
|
+
previous: false,
|
|
67
|
+
page: -1,
|
|
68
|
+
pages: -1,
|
|
69
|
+
pagination: [],
|
|
70
|
+
firstPagination: true,
|
|
71
|
+
lastPagination: true,
|
|
62
72
|
};
|
|
63
|
-
data.next = false;
|
|
64
|
-
data.previous = false;
|
|
65
73
|
for (let i = page - 1; i > page - 5; i--) {
|
|
66
74
|
if (i > 0) {
|
|
67
|
-
pagination.push(i);
|
|
75
|
+
data.pagination.push(i);
|
|
68
76
|
data.previous = true;
|
|
69
77
|
}
|
|
70
78
|
}
|
|
71
|
-
pagination.reverse();
|
|
72
|
-
pagination.push(page);
|
|
79
|
+
data.pagination.reverse();
|
|
80
|
+
data.pagination.push(page);
|
|
73
81
|
for (let i = page + 1; i < page + 5; i++) {
|
|
74
82
|
if (i <= total) {
|
|
75
|
-
pagination.push(i);
|
|
83
|
+
data.pagination.push(i);
|
|
76
84
|
data.next = true;
|
|
77
85
|
}
|
|
78
86
|
}
|
|
79
87
|
// Build Data and send it
|
|
80
88
|
data.page = page;
|
|
81
|
-
data.pagination
|
|
82
|
-
if (pagination.indexOf(1) < 0)
|
|
89
|
+
if (data.pagination.indexOf(1) < 0)
|
|
83
90
|
data.firstPagination = true;
|
|
84
91
|
else
|
|
85
92
|
data.firstPagination = false;
|
|
86
|
-
if (pagination.indexOf(total) < 0)
|
|
93
|
+
if (data.pagination.indexOf(total) < 0)
|
|
87
94
|
data.lastPagination = true;
|
|
88
95
|
else
|
|
89
96
|
data.lastPagination = false;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Parses the query string from a URL into a JSON object.
|
|
7
5
|
*
|
|
@@ -32,6 +30,8 @@ function queryUrlJSON(url) {
|
|
|
32
30
|
question === -1 || hash === question + 1
|
|
33
31
|
? url.substring(hash)
|
|
34
32
|
: url.substring(question + 1, hash);
|
|
33
|
+
|
|
34
|
+
/** @type {Record<string, *>} */
|
|
35
35
|
var result = {};
|
|
36
36
|
query.split('&').forEach((part) => {
|
|
37
37
|
if (!part) return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Parses the query string from a URL into a JSON object.
|
|
4
3
|
*
|
|
@@ -31,6 +30,7 @@ export default function queryUrlJSON(url) {
|
|
|
31
30
|
var query = question === -1 || hash === question + 1
|
|
32
31
|
? url.substring(hash)
|
|
33
32
|
: url.substring(question + 1, hash);
|
|
33
|
+
/** @type {Record<string, *>} */
|
|
34
34
|
var result = {};
|
|
35
35
|
query.split('&').forEach((part) => {
|
|
36
36
|
if (!part)
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
// @ts-nocheck
|
|
6
|
-
|
|
3
|
+
var objFilter = require('../../v1/basics/objFilter.cjs');
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
6
|
* Filters a list of strings by comparing each item against a list of validators.
|
|
@@ -47,36 +44,47 @@ function super_string_filter(list, validator_list) {
|
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
// Object
|
|
50
|
-
else if (objType(validator_list[item2], 'object')) {
|
|
47
|
+
else if (objFilter.objType(validator_list[item2], 'object')) {
|
|
51
48
|
// Validator
|
|
52
49
|
const tiny_validator = {};
|
|
53
50
|
|
|
54
51
|
// Starts With
|
|
55
52
|
tiny_validator.starts = {};
|
|
53
|
+
// @ts-ignore
|
|
56
54
|
tiny_validator.starts.enabled = typeof validator_list[item2].starts === 'string';
|
|
55
|
+
// @ts-ignore
|
|
57
56
|
if (tiny_validator.starts.enabled) {
|
|
57
|
+
// @ts-ignore
|
|
58
58
|
tiny_validator.starts.result = list[item].startsWith(validator_list[item2].starts);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Ends With
|
|
62
62
|
tiny_validator.ends = {};
|
|
63
|
+
// @ts-ignore
|
|
63
64
|
tiny_validator.ends.enabled = typeof validator_list[item2].ends === 'string';
|
|
65
|
+
// @ts-ignore
|
|
64
66
|
if (tiny_validator.ends.enabled) {
|
|
67
|
+
// @ts-ignore
|
|
65
68
|
tiny_validator.ends.result = list[item].endsWith(validator_list[item2].ends);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
// RegExp
|
|
69
72
|
tiny_validator.regexp = {};
|
|
70
|
-
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
tiny_validator.regexp.enabled = objFilter.objType(validator_list[item2].regexp, 'regexp');
|
|
75
|
+
// @ts-ignore
|
|
71
76
|
if (tiny_validator.regexp.enabled) {
|
|
77
|
+
// @ts-ignore
|
|
72
78
|
tiny_validator.regexp.result = list[item].match(validator_list[item2].regexp);
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
// Check Validator
|
|
76
82
|
let allowed_timezone = true;
|
|
77
83
|
for (const item3 in tiny_validator) {
|
|
84
|
+
// @ts-ignore
|
|
78
85
|
if (tiny_validator[item3].enabled) {
|
|
79
86
|
// Invalid Result
|
|
87
|
+
// @ts-ignore
|
|
80
88
|
if (!tiny_validator[item3].result) {
|
|
81
89
|
allowed_timezone = false;
|
|
82
90
|
break;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import objType from './objType.mjs';
|
|
3
2
|
/**
|
|
4
3
|
* Filters a list of strings by comparing each item against a list of validators.
|
|
@@ -44,27 +43,38 @@ export default function super_string_filter(list, validator_list) {
|
|
|
44
43
|
const tiny_validator = {};
|
|
45
44
|
// Starts With
|
|
46
45
|
tiny_validator.starts = {};
|
|
46
|
+
// @ts-ignore
|
|
47
47
|
tiny_validator.starts.enabled = typeof validator_list[item2].starts === 'string';
|
|
48
|
+
// @ts-ignore
|
|
48
49
|
if (tiny_validator.starts.enabled) {
|
|
50
|
+
// @ts-ignore
|
|
49
51
|
tiny_validator.starts.result = list[item].startsWith(validator_list[item2].starts);
|
|
50
52
|
}
|
|
51
53
|
// Ends With
|
|
52
54
|
tiny_validator.ends = {};
|
|
55
|
+
// @ts-ignore
|
|
53
56
|
tiny_validator.ends.enabled = typeof validator_list[item2].ends === 'string';
|
|
57
|
+
// @ts-ignore
|
|
54
58
|
if (tiny_validator.ends.enabled) {
|
|
59
|
+
// @ts-ignore
|
|
55
60
|
tiny_validator.ends.result = list[item].endsWith(validator_list[item2].ends);
|
|
56
61
|
}
|
|
57
62
|
// RegExp
|
|
58
63
|
tiny_validator.regexp = {};
|
|
64
|
+
// @ts-ignore
|
|
59
65
|
tiny_validator.regexp.enabled = objType(validator_list[item2].regexp, 'regexp');
|
|
66
|
+
// @ts-ignore
|
|
60
67
|
if (tiny_validator.regexp.enabled) {
|
|
68
|
+
// @ts-ignore
|
|
61
69
|
tiny_validator.regexp.result = list[item].match(validator_list[item2].regexp);
|
|
62
70
|
}
|
|
63
71
|
// Check Validator
|
|
64
72
|
let allowed_timezone = true;
|
|
65
73
|
for (const item3 in tiny_validator) {
|
|
74
|
+
// @ts-ignore
|
|
66
75
|
if (tiny_validator[item3].enabled) {
|
|
67
76
|
// Invalid Result
|
|
77
|
+
// @ts-ignore
|
|
68
78
|
if (!tiny_validator[item3].result) {
|
|
69
79
|
allowed_timezone = false;
|
|
70
80
|
break;
|
|
@@ -4,14 +4,15 @@ var latestVersion = require('latest-version');
|
|
|
4
4
|
var compareVersions = require('compare-versions');
|
|
5
5
|
var moment = require('moment');
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// Modules
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {{
|
|
11
|
+
* needUpdate: boolean; // `true` if the current version is outdated, `false` otherwise.
|
|
12
|
+
* now: string; // The current version of the package.
|
|
13
|
+
* new: string; // The latest version of the package available on npm.
|
|
14
|
+
* }} VersionCheck
|
|
15
|
+
*/
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Checks if the package version is up-to-date by comparing it with the latest version available on npm.
|
|
@@ -21,12 +22,13 @@ const check_version = {
|
|
|
21
22
|
* @param {string} pkg.name - The name of the package.
|
|
22
23
|
* @param {string} pkg.version - The current version of the package.
|
|
23
24
|
*
|
|
24
|
-
* @returns {Promise<
|
|
25
|
-
|
|
26
|
-
* - `now`: {string} - The current version of the package.
|
|
27
|
-
* - `new`: {string} - The latest version of the package available on npm.
|
|
25
|
+
* @returns {Promise<VersionCheck>} The result object
|
|
26
|
+
|
|
28
27
|
*/
|
|
29
28
|
async function versionCheck(pkg) {
|
|
29
|
+
/** @type {{ t: import('moment').Moment, v: string }} */
|
|
30
|
+
const check_version = {};
|
|
31
|
+
|
|
30
32
|
// Time Now
|
|
31
33
|
const now = moment();
|
|
32
34
|
|
|
@@ -36,15 +38,12 @@ async function versionCheck(pkg) {
|
|
|
36
38
|
check_version.v = await latestVersion(pkg.name);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
// Insert Version
|
|
40
|
-
const result = { needUpdate: compareVersions.compare(pkg.version, check_version.v, '<') };
|
|
41
|
-
|
|
42
41
|
// Allowed Show Version
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
return {
|
|
43
|
+
now: pkg.version,
|
|
44
|
+
new: check_version.v,
|
|
45
|
+
needUpdate: compareVersions.compare(pkg.version, check_version.v, '<'),
|
|
46
|
+
};
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
module.exports = versionCheck;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{
|
|
3
|
+
* needUpdate: boolean; // `true` if the current version is outdated, `false` otherwise.
|
|
4
|
+
* now: string; // The current version of the package.
|
|
5
|
+
* new: string; // The latest version of the package available on npm.
|
|
6
|
+
* }} VersionCheck
|
|
7
|
+
*/
|
|
1
8
|
/**
|
|
2
9
|
* Checks if the package version is up-to-date by comparing it with the latest version available on npm.
|
|
3
10
|
* The version check is cached and updated every hour.
|
|
@@ -6,13 +13,16 @@
|
|
|
6
13
|
* @param {string} pkg.name - The name of the package.
|
|
7
14
|
* @param {string} pkg.version - The current version of the package.
|
|
8
15
|
*
|
|
9
|
-
* @returns {Promise<
|
|
10
|
-
|
|
11
|
-
* - `now`: {string} - The current version of the package.
|
|
12
|
-
* - `new`: {string} - The latest version of the package available on npm.
|
|
16
|
+
* @returns {Promise<VersionCheck>} The result object
|
|
17
|
+
|
|
13
18
|
*/
|
|
14
19
|
export default function versionCheck(pkg: {
|
|
15
20
|
name: string;
|
|
16
21
|
version: string;
|
|
17
|
-
}): Promise<
|
|
22
|
+
}): Promise<VersionCheck>;
|
|
23
|
+
export type VersionCheck = {
|
|
24
|
+
needUpdate: boolean;
|
|
25
|
+
now: string;
|
|
26
|
+
new: string;
|
|
27
|
+
};
|
|
18
28
|
//# sourceMappingURL=versionCheck.d.mts.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
// Modules
|
|
3
2
|
import latestVersion from 'latest-version';
|
|
4
3
|
import { compare } from 'compare-versions';
|
|
5
4
|
import moment from 'moment';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {{
|
|
7
|
+
* needUpdate: boolean; // `true` if the current version is outdated, `false` otherwise.
|
|
8
|
+
* now: string; // The current version of the package.
|
|
9
|
+
* new: string; // The latest version of the package available on npm.
|
|
10
|
+
* }} VersionCheck
|
|
11
|
+
*/
|
|
11
12
|
/**
|
|
12
13
|
* Checks if the package version is up-to-date by comparing it with the latest version available on npm.
|
|
13
14
|
* The version check is cached and updated every hour.
|
|
@@ -16,12 +17,12 @@ const check_version = {
|
|
|
16
17
|
* @param {string} pkg.name - The name of the package.
|
|
17
18
|
* @param {string} pkg.version - The current version of the package.
|
|
18
19
|
*
|
|
19
|
-
* @returns {Promise<
|
|
20
|
-
|
|
21
|
-
* - `now`: {string} - The current version of the package.
|
|
22
|
-
* - `new`: {string} - The latest version of the package available on npm.
|
|
20
|
+
* @returns {Promise<VersionCheck>} The result object
|
|
21
|
+
|
|
23
22
|
*/
|
|
24
23
|
export default async function versionCheck(pkg) {
|
|
24
|
+
/** @type {{ t: import('moment').Moment, v: string }} */
|
|
25
|
+
const check_version = {};
|
|
25
26
|
// Time Now
|
|
26
27
|
const now = moment();
|
|
27
28
|
// Check Version
|
|
@@ -29,11 +30,10 @@ export default async function versionCheck(pkg) {
|
|
|
29
30
|
check_version.t = now.add(1, 'hours');
|
|
30
31
|
check_version.v = await latestVersion(pkg.name);
|
|
31
32
|
}
|
|
32
|
-
// Insert Version
|
|
33
|
-
const result = { needUpdate: compare(pkg.version, check_version.v, '<') };
|
|
34
33
|
// Allowed Show Version
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
return {
|
|
35
|
+
now: pkg.version,
|
|
36
|
+
new: check_version.v,
|
|
37
|
+
needUpdate: compare(pkg.version, check_version.v, '<'),
|
|
38
|
+
};
|
|
39
39
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @module http_base
|
|
7
5
|
*
|
|
@@ -77,9 +75,9 @@ const http_base = {
|
|
|
77
75
|
* @function send
|
|
78
76
|
* @param {import('express').Response} res - Express response object.
|
|
79
77
|
* @param {number} http_code - HTTP status code to send.
|
|
80
|
-
* @param {function(number):
|
|
78
|
+
* @param {function(number): import('express').Response} [callback] - Optional callback to handle response body manually.
|
|
81
79
|
*
|
|
82
|
-
* @returns {
|
|
80
|
+
* @returns {import('express').Response} The result of `res.send()` or the callback function.
|
|
83
81
|
*
|
|
84
82
|
* @example
|
|
85
83
|
* http_base.send(res, 404); // Sends 404 Not Found with empty body
|
|
@@ -3,7 +3,7 @@ declare namespace http_base {
|
|
|
3
3
|
let list: {
|
|
4
4
|
[x: number]: string;
|
|
5
5
|
};
|
|
6
|
-
function send(res: import("express").Response, http_code: number, callback?: (arg0: number) =>
|
|
6
|
+
function send(res: import("express").Response, http_code: number, callback?: (arg0: number) => import("express").Response): import("express").Response;
|
|
7
7
|
function sendAsync(res: import("express").Response, http_code: number, callback?: (arg0: number) => Promise<any>): Promise<any>;
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=HTTP-1.0.d.mts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* @module http_base
|
|
4
3
|
*
|
|
@@ -68,9 +67,9 @@ const http_base = {
|
|
|
68
67
|
* @function send
|
|
69
68
|
* @param {import('express').Response} res - Express response object.
|
|
70
69
|
* @param {number} http_code - HTTP status code to send.
|
|
71
|
-
* @param {function(number):
|
|
70
|
+
* @param {function(number): import('express').Response} [callback] - Optional callback to handle response body manually.
|
|
72
71
|
*
|
|
73
|
-
* @returns {
|
|
72
|
+
* @returns {import('express').Response} The result of `res.send()` or the callback function.
|
|
74
73
|
*
|
|
75
74
|
* @example
|
|
76
75
|
* http_base.send(res, 404); // Sends 404 Not Found with empty body
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Creates an Express middleware for Basic HTTP Authentication.
|
|
7
5
|
*
|
|
@@ -15,10 +13,10 @@
|
|
|
15
13
|
* @param {Object} data - Configuration object.
|
|
16
14
|
* @param {string} data.login - The expected username.
|
|
17
15
|
* @param {string} data.password - The expected password.
|
|
18
|
-
* @param {
|
|
16
|
+
* @param {function(import('express').Request, import('express').Response): import('express').Response} [data.customError] - Optional function `(req, res) => {}` called on auth failure.
|
|
19
17
|
* @param {Function} [callback] - Optional fallback function `(req, res, next) => {}` executed after customError.
|
|
20
18
|
*
|
|
21
|
-
* @returns {
|
|
19
|
+
* @returns {function(import('express').Request, import('express').Response, import('express').NextFunction): void} Express middleware function.
|
|
22
20
|
*
|
|
23
21
|
* @example
|
|
24
22
|
* import express from 'express';
|