mcbe-leveldb 1.5.4 → 1.5.7
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/Changelog.md +9 -0
- package/DBUtils.d.ts +71 -0
- package/LevelUtils.d.ts +1449 -0
- package/SNBTUtils.d.ts +743 -0
- package/__biome_data__.d.ts +283 -0
- package/index.d.ts +29 -0
- package/index.ts +9 -0
- package/nbtSchemas.d.ts +19834 -0
- package/nbtSchemas.js +27 -0
- package/nbtSchemas.js.map +1 -1
- package/nbtSchemas.ts +27 -0
- package/package.json +7 -3
- package/tsconfig.json +1 -1
- package/tsconfig.production.json +2 -2
- package/types.d.ts +4 -0
- package/utils/JSONB.d.ts +128 -0
package/Changelog.md
CHANGED
package/DBUtils.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { LevelDB } from "@8crafter/leveldb-zlib";
|
|
2
|
+
import { type DBEntryContentType } from "./LevelUtils.ts";
|
|
3
|
+
import NBT from "prismarine-nbt";
|
|
4
|
+
/**
|
|
5
|
+
* Gets the keys from the LevelDB with a specific content type.
|
|
6
|
+
*
|
|
7
|
+
* @template T The content type to look for.
|
|
8
|
+
* @param db The LevelDB. Should match the type of the {@link LevelDB} class from the {@link https://www.npmjs.com/package/@8crafter/leveldb-zlib | @8crafter/leveldb-zlib} package. It does not have to be the one from that package, as long as the types match.
|
|
9
|
+
* @param type The {@link DBEntryContentType | content type} to look for.
|
|
10
|
+
* @returns The keys from the LevelDB with the specified content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getKeysOfType<T extends DBEntryContentType>(db: LevelDB, type: T): Promise<Buffer<ArrayBuffer>[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the keys from the list of LevelDB keys with a specific content type.
|
|
15
|
+
*
|
|
16
|
+
* @template T The content type to look for.
|
|
17
|
+
* @template TArrayBuffer The type of the buffers.
|
|
18
|
+
* @param dbKeys The LevelDB keys. Should be an array of Buffers.
|
|
19
|
+
* @param type The {@link DBEntryContentType | content type} to look for.
|
|
20
|
+
* @returns The keys from the provided LevelDB keys array with the specified content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getKeysOfType<T extends DBEntryContentType, TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(dbKeys: Buffer<TArrayBuffer>[], type: T): Buffer<TArrayBuffer>[];
|
|
23
|
+
/**
|
|
24
|
+
* Gets the keys from the LevelDB with one of the specified content types.
|
|
25
|
+
*
|
|
26
|
+
* @template T The content types to look for.
|
|
27
|
+
* @param db The LevelDB. Should match the type of the {@link LevelDB} class from the {@link https://www.npmjs.com/package/@8crafter/leveldb-zlib | @8crafter/leveldb-zlib} package. It does not have to be the one from that package, as long as the types match.
|
|
28
|
+
* @param types The {@link DBEntryContentType | content types} to look for.
|
|
29
|
+
* @returns An object mapping each of the specified content types to the keys from the LevelDB with that content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getKeysOfTypes<T extends DBEntryContentType[] | readonly DBEntryContentType[]>(db: LevelDB, types: T): Promise<{
|
|
32
|
+
[key in T[number]]: Buffer<ArrayBuffer>[];
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the keys from the list of LevelDB keys with one of the specified content types.
|
|
36
|
+
*
|
|
37
|
+
* @template T The content types to look for.
|
|
38
|
+
* @template TArrayBuffer The type of the buffers.
|
|
39
|
+
* @param dbKeys The LevelDB keys. Should be an array of Buffers.
|
|
40
|
+
* @param types The {@link DBEntryContentType | content types} to look for.
|
|
41
|
+
* @returns An object mapping each of the specified content types to the keys from the provided LevelDB keys array with that content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getKeysOfTypes<T extends DBEntryContentType[] | readonly DBEntryContentType[], TArrayBuffer extends ArrayBufferLike>(dbKeys: Buffer<TArrayBuffer>[], types: T): {
|
|
44
|
+
[key in T[number]]: Buffer<TArrayBuffer>[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Gets a player's name from their UUID.
|
|
48
|
+
*
|
|
49
|
+
* Only works if the player's name was stored in an add-on's dynamic properties with their ID linked to it, and it only works for a hardcoded list of add-ons,
|
|
50
|
+
* if you have your own add-on that you would like this to be able to read the player's names from, {@link https://www.8crafter.com/main/contact | contact 8Crafter},
|
|
51
|
+
* or make a pull request.
|
|
52
|
+
*
|
|
53
|
+
* @param db The LevelDB. Should match the type of the {@link LevelDB} class from the {@link https://www.npmjs.com/package/@8crafter/leveldb-zlib | @8crafter/leveldb-zlib} package. It does not have to be the one from that package, as long as the types match.
|
|
54
|
+
* @param uuid The UUID of the play to get the name of.
|
|
55
|
+
* @returns The name of the player, or `null` if the player's name cannot be found or the world has no dynamic properties.
|
|
56
|
+
*
|
|
57
|
+
* @throws {any} If there was an error reading the DynamicProperties from the DB.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getPlayerNameFromUUID(db: LevelDB, uuid: string | bigint): Promise<string | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets a player's name from their UUID using the provided dynamic properties data.
|
|
62
|
+
*
|
|
63
|
+
* Only works if the player's name was stored in an add-on's dynamic properties with their ID linked to it, and it only works for a hardcoded list of add-ons,
|
|
64
|
+
* if you have your own add-on that you would like this to be able to read the player's names from, {@link https://www.8crafter.com/main/contact | contact 8Crafter},
|
|
65
|
+
* or make a pull request.
|
|
66
|
+
*
|
|
67
|
+
* @param dynamicProperties The dynamic properties data, should be the data from the `DynamicProperties` LevelDB key.
|
|
68
|
+
* @param uuid The UUID of the play to get the name of.
|
|
69
|
+
* @returns The name of the player, or `null` if the player's name cannot be found .
|
|
70
|
+
*/
|
|
71
|
+
export declare function getPlayerNameFromUUIDSync(dynamicProperties: NBT.NBT, uuid: string | bigint): string | null;
|