mybase 1.1.53 → 1.2.3
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/ip6addr.d.ts +10 -1
- package/mybase.d.ts +57 -0
- package/mybase.js +401 -684
- package/mybase.js.map +1 -0
- package/package.json +18 -2
- package/ts/funcs/Geoip2Paths.js +7 -5
- package/ts/funcs/Geoip2Paths.js.map +1 -0
- package/ts/funcs/MaxRuntimeHours.js.map +1 -0
- package/ts/funcs/asJSON.d.ts +1 -1
- package/ts/funcs/asJSON.js +6 -4
- package/ts/funcs/asJSON.js.map +1 -0
- package/ts/funcs/deepCopy.js.map +1 -0
- package/ts/funcs/ensureFolder.js.map +1 -0
- package/ts/funcs/fileCacheIsValid.js.map +1 -0
- package/ts/funcs/getMysql1.js.map +1 -0
- package/ts/funcs/getMysql2.js.map +1 -0
- package/ts/funcs/getWeekNumber.js.map +1 -0
- package/ts/funcs/hash_sha512.d.ts +1 -1
- package/ts/funcs/hash_sha512.js +4 -4
- package/ts/funcs/hash_sha512.js.map +1 -0
- package/ts/funcs/initMysql2Pool.js.map +1 -0
- package/ts/funcs/int2ip.js.map +1 -0
- package/ts/funcs/ip2int.js.map +1 -0
- package/ts/funcs/isLANIp.d.ts +2 -3
- package/ts/funcs/isLANIp.js +14 -15
- package/ts/funcs/isLANIp.js.map +1 -0
- package/ts/funcs/isLocal.js.map +1 -0
- package/ts/funcs/isLoopbackIP.d.ts +2 -3
- package/ts/funcs/isLoopbackIP.js +15 -16
- package/ts/funcs/isLoopbackIP.js.map +1 -0
- package/ts/funcs/knexConnection.js.map +1 -0
- package/ts/funcs/promiseTimeout.js.map +1 -0
- package/ts/funcs/randomIP.js.map +1 -0
- package/ts/funcs/randomIP6.js.map +1 -0
- package/ts/funcs/randomString.js.map +1 -0
- package/ts/funcs/randomTCPPort.js.map +1 -0
- package/ts/funcs/randomUTFString.js.map +1 -0
- package/ts/funcs/utcnow.js.map +1 -0
- package/ts/funcs/validEmail.d.ts +1 -1
- package/ts/funcs/validEmail.js +0 -3
- package/ts/funcs/validEmail.js.map +1 -0
- package/ts/funcs/validIp.js.map +1 -0
- package/ts/funcs/vaultFill.js +1 -1
- package/ts/funcs/vaultFill.js.map +1 -0
- package/ts/funcs/vaultRead.js +9 -3
- package/ts/funcs/vaultRead.js.map +1 -0
- package/ts/funcs/wait.js.map +1 -0
- package/ts/global.js.map +1 -0
- package/ts/index.js.map +1 -0
- package/ts/models/DateIterator.js.map +1 -0
- package/ts/models/IPAddress.d.ts +13 -13
- package/ts/models/IPAddress.js.map +1 -0
- package/ts/models/Interfaces.js.map +1 -0
- package/ts/models/OTPGenerator.js.map +1 -0
- package/ts/models/Timespan.js.map +1 -0
- package/ts/models/Unixtime.js.map +1 -0
- package/ts/types.d.ts +35 -0
- package/ts/types.js +1 -0
- package/ts/types.js.map +1 -0
- package/jest/isLANIp.test.js +0 -36
- package/jest/isLoopbackIP.test.js +0 -31
- package/jest.config.js +0 -7
- package/ts/funcs/Geoip2Paths.test.ts +0 -11
- package/ts/funcs/Geoip2Paths.ts +0 -26
- package/ts/funcs/MaxRuntimeHours.ts +0 -7
- package/ts/funcs/asJSON.test.js +0 -72
- package/ts/funcs/asJSON.ts +0 -6
- package/ts/funcs/deepCopy.test.ts +0 -108
- package/ts/funcs/deepCopy.ts +0 -34
- package/ts/funcs/ensureFolder.test.ts +0 -79
- package/ts/funcs/ensureFolder.ts +0 -21
- package/ts/funcs/fileCacheIsValid.ts +0 -13
- package/ts/funcs/getMysql1.ts +0 -41
- package/ts/funcs/getMysql2.ts +0 -42
- package/ts/funcs/getWeekNumber.test.ts +0 -9
- package/ts/funcs/getWeekNumber.ts +0 -31
- package/ts/funcs/hash_sha512.ts +0 -7
- package/ts/funcs/initMysql2Pool.ts +0 -11
- package/ts/funcs/int2ip.test.js +0 -33
- package/ts/funcs/int2ip.ts +0 -9
- package/ts/funcs/ip2int.test.js +0 -30
- package/ts/funcs/ip2int.ts +0 -10
- package/ts/funcs/isLANIp.test.ts +0 -59
- package/ts/funcs/isLANIp.ts +0 -37
- package/ts/funcs/isLocal.test.ts +0 -16
- package/ts/funcs/isLocal.ts +0 -5
- package/ts/funcs/isLoopbackIP.test.ts +0 -72
- package/ts/funcs/isLoopbackIP.ts +0 -32
- package/ts/funcs/knexConnection.ts +0 -42
- package/ts/funcs/promiseTimeout.test.js +0 -104
- package/ts/funcs/promiseTimeout.ts +0 -19
- package/ts/funcs/randomIP.test.ts +0 -16
- package/ts/funcs/randomIP.ts +0 -10
- package/ts/funcs/randomIP6.test.js +0 -18
- package/ts/funcs/randomIP6.ts +0 -12
- package/ts/funcs/randomString.test.ts +0 -15
- package/ts/funcs/randomString.ts +0 -5
- package/ts/funcs/randomTCPPort.test.ts +0 -62
- package/ts/funcs/randomTCPPort.ts +0 -58
- package/ts/funcs/randomUTFString.test.ts +0 -44
- package/ts/funcs/randomUTFString.ts +0 -33
- package/ts/funcs/utcnow.ts +0 -5
- package/ts/funcs/validEmail.test.js +0 -31
- package/ts/funcs/validEmail.ts +0 -13
- package/ts/funcs/validIp.test.ts +0 -33
- package/ts/funcs/validIp.ts +0 -5
- package/ts/funcs/vaultFill.ts +0 -89
- package/ts/funcs/vaultRead.ts +0 -45
- package/ts/funcs/wait.ts +0 -7
- package/ts/global.ts +0 -10
- package/ts/index.test.ts +0 -7
- package/ts/index.ts +0 -39
- package/ts/models/DateIterator.test.ts +0 -149
- package/ts/models/DateIterator.ts +0 -80
- package/ts/models/IPAddress.test.ts +0 -393
- package/ts/models/IPAddress.ts +0 -272
- package/ts/models/Interfaces.ts +0 -58
- package/ts/models/OTPGenerator.test.ts +0 -42
- package/ts/models/OTPGenerator.ts +0 -43
- package/ts/models/Timespan.ts +0 -80
- package/ts/models/Unixtime.test.ts +0 -168
- package/ts/models/Unixtime.ts +0 -208
- package/ts/types.ts +0 -1
- package/tsconfig.json +0 -36
package/ip6addr.d.ts
CHANGED
|
@@ -48,5 +48,14 @@ declare module '@7c/node-ip6addr' {
|
|
|
48
48
|
export function createCIDR(addr: string | Addr, len?: number): CIDR;
|
|
49
49
|
|
|
50
50
|
export function parse(input: string | number | Addr | BigInt): Addr;
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
interface Ip6addrModule {
|
|
53
|
+
compare: typeof compare
|
|
54
|
+
compareCIDR: typeof compareCIDR
|
|
55
|
+
createAddrRange: typeof createAddrRange
|
|
56
|
+
createCIDR: typeof createCIDR
|
|
57
|
+
parse: typeof parse
|
|
58
|
+
}
|
|
59
|
+
const ip6addr: Ip6addrModule
|
|
60
|
+
export default ip6addr
|
|
52
61
|
}
|
package/mybase.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { MysqlConfig, MysqlConnection, MysqlConnector, SqlQueryable } from './ts/types';
|
|
2
|
+
import { randomString } from './ts/funcs/randomString';
|
|
3
|
+
export { randomString };
|
|
4
|
+
export { wait } from './ts/funcs/wait';
|
|
5
|
+
export { utcnow } from './ts/funcs/utcnow';
|
|
6
|
+
export { isLocal } from './ts/funcs/isLocal';
|
|
7
|
+
export { validEmail } from './ts/funcs/validEmail';
|
|
8
|
+
export { asJSON } from './ts/funcs/asJSON';
|
|
9
|
+
export { promiseTimeout } from './ts/funcs/promiseTimeout';
|
|
10
|
+
export { randomIP } from './ts/funcs/randomIP';
|
|
11
|
+
export { MaxRuntimeHours } from './ts/funcs/MaxRuntimeHours';
|
|
12
|
+
export { Geoip2Paths } from './ts/funcs/Geoip2Paths';
|
|
13
|
+
export { vaultRead } from './ts/funcs/vaultRead';
|
|
14
|
+
export { vaultFill } from './ts/funcs/vaultFill';
|
|
15
|
+
export { hash_sha512 } from './ts/funcs/hash_sha512';
|
|
16
|
+
export { isLoopbackIP } from './ts/funcs/isLoopbackIP';
|
|
17
|
+
export { isLANIp } from './ts/funcs/isLANIp';
|
|
18
|
+
declare global {
|
|
19
|
+
interface Date {
|
|
20
|
+
yyyymmdd(): string;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare function validHPassword(hpassword: string): boolean;
|
|
24
|
+
export declare function randomHPassword(length?: number): string;
|
|
25
|
+
export declare function arrayRandomItem<T>(arry: unknown, defaultValue?: T | false): T | false;
|
|
26
|
+
export declare function validIp(str: unknown): boolean;
|
|
27
|
+
export declare function validIpNative(str: string): boolean;
|
|
28
|
+
export declare function isURL(url: unknown): URL | false;
|
|
29
|
+
export declare function validTime(t: unknown): number | false;
|
|
30
|
+
export declare function validURL(host: unknown): boolean;
|
|
31
|
+
export declare function isObject(a: unknown): boolean;
|
|
32
|
+
export declare function getMysql(mysqlClass: MysqlConnector, config: MysqlConfig, keep_pinging?: boolean): Promise<MysqlConnection>;
|
|
33
|
+
export declare function maxmindOpen(geoipFile: string): Promise<import("@maxmind/geoip2-node").ReaderModel>;
|
|
34
|
+
export declare function randomBase32(length?: number): string;
|
|
35
|
+
export declare function validAuthcode(authcode: string): boolean;
|
|
36
|
+
export declare function randomAuthcode(): string;
|
|
37
|
+
export declare function array_shuffle<T>(a: T[]): T[];
|
|
38
|
+
export declare function object_shuffle<T extends Record<string, unknown>>(object: T): T;
|
|
39
|
+
export declare function canReadAndWrite(targetPath: string, _create?: boolean): Promise<boolean>;
|
|
40
|
+
export declare function softexit(message?: string | false, seconds?: number, exitcode?: number): void;
|
|
41
|
+
export declare function validHostname(value: unknown): boolean;
|
|
42
|
+
export declare function validHostname2(domainName: unknown): boolean;
|
|
43
|
+
export declare function removeDoubleSlashes(url: unknown): string | false;
|
|
44
|
+
export declare function getTemp(filename?: string | false): string;
|
|
45
|
+
export declare function sqlQuery(sqlHandle: SqlQueryable, query: string, values?: unknown[]): Promise<unknown>;
|
|
46
|
+
export declare function isMochaRunning(): boolean;
|
|
47
|
+
export declare function validUUID4(uuid: string): boolean;
|
|
48
|
+
export declare function portCheck_tcp(port: number, opts?: {
|
|
49
|
+
timeout?: number;
|
|
50
|
+
host?: string;
|
|
51
|
+
}): Promise<boolean>;
|
|
52
|
+
export declare function ensureProperty<T>(target: Record<string, unknown>, propsString: string, defaultValue?: T | false, debugWalk?: boolean): unknown;
|
|
53
|
+
export declare function int2ip(ipInt: number): string;
|
|
54
|
+
export declare function ip2int(ip: string): number;
|
|
55
|
+
export declare function encryptAES_CBC_NOIV(plainString: string, encryptionKey: string): string | false;
|
|
56
|
+
export declare function decryptAES_CBC_NOIV(encryptedHex: string, encryptionKey: string): string | false;
|
|
57
|
+
export declare function isReservedLANIP(address: string): boolean;
|