@zthun/romulator-api 1.9.0 → 1.10.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/dist/files/files-module.d.mts +2 -2
- package/dist/files/files-repository.d.mts +82 -0
- package/dist/files/files-system-json-repository.d.mts +28 -0
- package/dist/main.cjs +219 -172
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +223 -176
- package/dist/main.js.map +1 -1
- package/dist/media/media-service.d.mts +2 -2
- package/dist/systems/systems-service.d.mts +5 -4
- package/package.json +15 -15
- package/assets/systems.json +0 -4057
- package/dist/files/files-service.d.mts +0 -120
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IZRomulatorFilesRepository } from './files-repository.mjs';
|
|
2
2
|
export declare class ZRomulatorFilesModule {
|
|
3
3
|
private readonly _files;
|
|
4
|
-
constructor(_files:
|
|
4
|
+
constructor(_files: IZRomulatorFilesRepository);
|
|
5
5
|
onModuleInit(): Promise<void>;
|
|
6
6
|
onModuleDestroy(): Promise<void>;
|
|
7
7
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { IZFileRepository, IZFileSystemNode, IZFileSystemService } from '@zthun/crumbtrail-fs';
|
|
2
|
+
import { ZRomulatorSystemId } from '@zthun/romulator-client';
|
|
3
|
+
import { IZRomulatorConfigsService } from '../config/configs-service.mjs';
|
|
4
|
+
export declare const ZRomulatorFilesToken: unique symbol;
|
|
5
|
+
/**
|
|
6
|
+
* Represents the repository that you can use to
|
|
7
|
+
* scan the games folder for media, info, games, and systems.
|
|
8
|
+
*/
|
|
9
|
+
export interface IZRomulatorFilesRepository {
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves all media found in the games .media folder.
|
|
12
|
+
*
|
|
13
|
+
* @returns
|
|
14
|
+
* A list of all media found in the game media folder.
|
|
15
|
+
*/
|
|
16
|
+
media(): Promise<IZFileSystemNode[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves all systems found in the games folder.
|
|
19
|
+
*
|
|
20
|
+
* A system is a root folder that is a slug of a supported
|
|
21
|
+
* system.
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
* A list of all system folders found in the games folder.
|
|
25
|
+
*/
|
|
26
|
+
systems(): Promise<IZFileSystemNode[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves a single system found in the games folder.
|
|
29
|
+
*
|
|
30
|
+
* @param id -
|
|
31
|
+
* The id of the system, which is also the name of the folder.
|
|
32
|
+
*
|
|
33
|
+
* @returns
|
|
34
|
+
* The node that represents the system slug. Returns null if
|
|
35
|
+
* the folder does not exist or is not supported. Note
|
|
36
|
+
* that the path is relative to the configured games folder. If you
|
|
37
|
+
* want to supply a fully qualified absolute path, then this string
|
|
38
|
+
* should start with the root of an OS drive (not recommended).
|
|
39
|
+
*/
|
|
40
|
+
systems(id: ZRomulatorSystemId): Promise<IZFileSystemNode | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves the file that represents the systems info or games info
|
|
43
|
+
* for a given system.
|
|
44
|
+
*
|
|
45
|
+
* @param id -
|
|
46
|
+
* Which info item you want to receive - the root system information
|
|
47
|
+
* or the information for a given game list for an individual system.
|
|
48
|
+
*
|
|
49
|
+
* @returns
|
|
50
|
+
* The node that represents the info json, or null if no such file
|
|
51
|
+
* exists.
|
|
52
|
+
*/
|
|
53
|
+
info(id: "systems" | ZRomulatorSystemId): Promise<IZFileSystemNode | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Initializes the file repository.
|
|
56
|
+
*/
|
|
57
|
+
init(): Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Cleans up internal resources.
|
|
60
|
+
*/
|
|
61
|
+
dispose(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export declare class ZRomulatorFilesRepository implements IZRomulatorFilesRepository {
|
|
64
|
+
private readonly _configs;
|
|
65
|
+
private readonly _fileSystem;
|
|
66
|
+
private static readonly MediaFolderName;
|
|
67
|
+
private static readonly InfoFolderName;
|
|
68
|
+
private _repository;
|
|
69
|
+
private _folderStream;
|
|
70
|
+
private _globs;
|
|
71
|
+
private _systems;
|
|
72
|
+
constructor(_configs: IZRomulatorConfigsService, _fileSystem: IZFileSystemService);
|
|
73
|
+
private gamesFolder;
|
|
74
|
+
private mediaFolder;
|
|
75
|
+
private infoFolder;
|
|
76
|
+
dispose(): Promise<void>;
|
|
77
|
+
init(): Promise<IZFileRepository>;
|
|
78
|
+
media(): Promise<IZFileSystemNode[]>;
|
|
79
|
+
info(id?: "systems" | ZRomulatorSystemId): Promise<IZFileSystemNode | null>;
|
|
80
|
+
systems(): Promise<IZFileSystemNode[]>;
|
|
81
|
+
systems(id: ZRomulatorSystemId): Promise<IZFileSystemNode | null>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IZLogger } from '@zthun/lumberjacky-log';
|
|
2
|
+
import { ZRomulatorSystemId } from '@zthun/romulator-client';
|
|
3
|
+
import { IZRomulatorFilesRepository } from './files-repository.mjs';
|
|
4
|
+
export declare const ZRomulatorFilesSystemsJsonRepositoryToken: unique symbol;
|
|
5
|
+
/**
|
|
6
|
+
* A repository responsible for reading systems.json from the games info directory.
|
|
7
|
+
*/
|
|
8
|
+
export interface IZRomulatorFilesSystemsJsonRepository {
|
|
9
|
+
/**
|
|
10
|
+
* Reads all system entries in the systems.json file and returns a mapping.
|
|
11
|
+
*
|
|
12
|
+
* @returns
|
|
13
|
+
* A mapping of system ids to system entries. Any corrupted entries
|
|
14
|
+
* or entries that are not supported will be excluded from this map.
|
|
15
|
+
*/
|
|
16
|
+
systems(): Promise<Map<ZRomulatorSystemId, unknown>>;
|
|
17
|
+
}
|
|
18
|
+
export declare class ZRomulatorFilesSystemsJsonRepository implements IZRomulatorFilesSystemsJsonRepository {
|
|
19
|
+
private _files;
|
|
20
|
+
private _logger;
|
|
21
|
+
private _stream;
|
|
22
|
+
/**
|
|
23
|
+
* Initializes a new instance of this object.
|
|
24
|
+
*/
|
|
25
|
+
constructor(_files: IZRomulatorFilesRepository, logger: IZLogger);
|
|
26
|
+
private _read;
|
|
27
|
+
systems(): Promise<Map<ZRomulatorSystemId, unknown>>;
|
|
28
|
+
}
|