@e-mc/types 0.12.14 → 0.12.15

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.12.14/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.15/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -204,10 +204,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
204
204
 
205
205
  ## References
206
206
 
207
- - https://www.unpkg.com/@e-mc/types@0.12.14/index.d.ts
208
- - https://www.unpkg.com/@e-mc/types@0.12.14/lib/logger.d.ts
209
- - https://www.unpkg.com/@e-mc/types@0.12.14/lib/module.d.ts
210
- - https://www.unpkg.com/@e-mc/types@0.12.14/lib/node.d.ts
207
+ - https://www.unpkg.com/@e-mc/types@0.12.15/index.d.ts
208
+ - https://www.unpkg.com/@e-mc/types@0.12.15/lib/logger.d.ts
209
+ - https://www.unpkg.com/@e-mc/types@0.12.15/lib/module.d.ts
210
+ - https://www.unpkg.com/@e-mc/types@0.12.15/lib/node.d.ts
211
211
 
212
212
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
213
213
  * https://www.npmjs.com/package/@types/bytes
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.12.14',
2
+ VERSION = '0.12.15',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -1029,18 +1029,18 @@ function asFunction(value, sync = true) {
1029
1029
  }
1030
1030
  function getEncoding(value, fallback) {
1031
1031
  if (typeof value === 'string') {
1032
- switch (value = value.trim().toLowerCase()) {
1033
- case 'utf8':
1034
- case 'utf-8':
1035
- return 'utf8';
1036
- case 'utf16le':
1037
- case 'utf-16le':
1038
- case 'utf16':
1039
- case 'utf-16':
1040
- return 'utf16le';
1032
+ const result = value.trim().toLowerCase();
1033
+ if (result.slice(0, 3) === 'utf') {
1034
+ switch (result.slice(result[3] === '-' ? 4 : 3)) {
1035
+ case '8':
1036
+ return 'utf8';
1037
+ case '16le':
1038
+ case '16':
1039
+ return 'utf16le';
1040
+ }
1041
1041
  }
1042
- if (Buffer.isEncoding(value)) {
1043
- return value;
1042
+ else if (Buffer.isEncoding(result)) {
1043
+ return result;
1044
1044
  }
1045
1045
  }
1046
1046
  return fallback || 'utf8';
package/lib/core.d.ts CHANGED
@@ -70,9 +70,10 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
70
70
  convertTime(value: number | string): number;
71
71
  findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): QueryResult | undefined;
72
72
  storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
73
+ /** @deprecated */
73
74
  storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, sessionKey: string, sessionExpires: number): QueryResult;
74
75
  storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue): QueryResult;
75
- storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue | undefined, options: StoreResultOptions): QueryResult;
76
+ storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue | undefined, options: Omit<StoreResultOptions, "cache">): QueryResult;
76
77
  purgeResult(prefix?: string): Promise<number>;
77
78
  extractUUID(credential: unknown): string;
78
79
  setPoolConfig(value: unknown): void;
package/lib/index.d.ts CHANGED
@@ -619,6 +619,7 @@ declare namespace functions {
619
619
  getThreadCount(full: true): ThreadCountStat;
620
620
  getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
621
621
  getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
622
+ parseIp(value: unknown, kind?: "ipv4" | "ipv6"): string;
622
623
  getLogDelayed(): FormatMessageArgs[];
623
624
  getPermissionFromSettings(freeze?: boolean): IPermission;
624
625
  readonly prototype: IHost;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.12.14",
3
+ "version": "0.12.15",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",