osu-stable-db 0.2.3 → 0.2.4

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/index.d.mts CHANGED
@@ -9,23 +9,25 @@ declare function readOsuDatabase(input: ArrayBuffer | Uint8Array): OsuDatabase;
9
9
  declare function writeOsuDatabase(database: OsuDatabase): Uint8Array;
10
10
  //#endregion
11
11
  //#region src/db/query.d.ts
12
- interface BeatmapScoresGroupMatch {
13
- beatmap: BeatmapEntry;
14
- scores: ScoreEntry[];
15
- }
16
- interface BeatmapScoreMatch {
17
- beatmap: BeatmapEntry;
18
- score: ScoreEntry;
19
- }
20
12
  type BeatmapQuerySource = OsuDatabase | BeatmapEntry[];
21
13
  type ScoreQuerySource = ScoresDatabase | ScoresBeatmapEntry[];
14
+ type GeneratorYield<TGeneratorFactory extends (...args: never[]) => Generator> = TGeneratorFactory extends ((...args: never[]) => Generator<infer TValue, void, unknown>) ? TValue : never;
22
15
  declare function createBeatmapScoreQuery(beatmapsSource: BeatmapQuerySource, scoresSource: ScoreQuerySource): {
23
- iterateBeatmapScoreGroups: () => Generator<BeatmapScoresGroupMatch>;
24
- iterateBeatmapScores: () => Generator<BeatmapScoreMatch>;
16
+ iterateBeatmapScoreGroups: () => Generator<{
17
+ beatmap: BeatmapEntry;
18
+ scores: ScoreEntry[];
19
+ }, void, unknown>;
20
+ iterateBeatmapScores: () => Generator<{
21
+ beatmap: BeatmapEntry;
22
+ score: ScoreEntry;
23
+ }, void, unknown>;
25
24
  };
25
+ type BeatmapScoreQuery = ReturnType<typeof createBeatmapScoreQuery>;
26
+ type BeatmapScoresGroupMatch = GeneratorYield<BeatmapScoreQuery['iterateBeatmapScoreGroups']>;
27
+ type BeatmapScoreMatch = GeneratorYield<BeatmapScoreQuery['iterateBeatmapScores']>;
26
28
  //#endregion
27
29
  //#region src/db/scores.d.ts
28
30
  declare function readScoresDatabase(input: ArrayBuffer | Uint8Array): ScoresDatabase;
29
31
  declare function writeScoresDatabase(database: ScoresDatabase): Uint8Array;
30
32
  //#endregion
31
- export { BeatmapEntry, BeatmapQuerySource, BeatmapScoreMatch, BeatmapScoresGroupMatch, CollectionDatabase, CollectionEntry, DateTimeTicks, GameplayMode, GameplayModes, Grade, Grades, IntFloatPair, MINIMUM_SUPPORTED_VERSION, Mod, ModFlags, Mods, OsuDatabase, RankedStatus, RankedStatuses, ScoreAdditionalModInfo, ScoreEntry, ScoreQuerySource, ScoresBeatmapEntry, ScoresDatabase, TimingPoint, UserPermission, UserPermissionFlags, UserPermissions, createBeatmapScoreQuery, readCollectionDatabase, readOsuDatabase, readScoresDatabase, writeCollectionDatabase, writeOsuDatabase, writeScoresDatabase };
33
+ export { BeatmapEntry, BeatmapQuerySource, BeatmapScoreMatch, BeatmapScoreQuery, BeatmapScoresGroupMatch, CollectionDatabase, CollectionEntry, DateTimeTicks, GameplayMode, GameplayModes, Grade, Grades, IntFloatPair, MINIMUM_SUPPORTED_VERSION, Mod, ModFlags, Mods, OsuDatabase, RankedStatus, RankedStatuses, ScoreAdditionalModInfo, ScoreEntry, ScoreQuerySource, ScoresBeatmapEntry, ScoresDatabase, TimingPoint, UserPermission, UserPermissionFlags, UserPermissions, createBeatmapScoreQuery, readCollectionDatabase, readOsuDatabase, readScoresDatabase, writeCollectionDatabase, writeOsuDatabase, writeScoresDatabase };
package/dist/node.d.mts CHANGED
@@ -3,6 +3,7 @@ import { _ as ScoreAdditionalModInfo, a as GameplayMode, b as ScoresDatabase, f
3
3
  //#region src/node.d.ts
4
4
  type DatabaseFilePath = string | URL;
5
5
  declare const OSU_STABLE_DIR_ENV_VAR = "OSU_STABLE_DIR";
6
+ type GeneratorYield<TGeneratorFactory extends (...args: never[]) => Generator> = TGeneratorFactory extends ((...args: never[]) => Generator<infer TValue, void, unknown>) ? TValue : never;
6
7
  declare function getConfiguredOsuFolderPath(): string | null;
7
8
  declare function getConfiguredOsuFolder(): OsuFolder | null;
8
9
  declare function readOsuDatabaseFile(path: DatabaseFilePath): Promise<OsuDatabase>;
@@ -193,5 +194,8 @@ declare class OsuFolder {
193
194
  getOsuFilePath(beatmap: BeatmapEntry): string;
194
195
  getOsrFilePath(score: ScoreEntry): string;
195
196
  }
197
+ type BeatmapScoreQuery = ReturnType<OsuFolder['createBeatmapScoreQuery']>;
198
+ type BeatmapScoresGroupMatch = GeneratorYield<BeatmapScoreQuery['iterateBeatmapScoreGroups']>;
199
+ type BeatmapScoreMatch = GeneratorYield<BeatmapScoreQuery['iterateBeatmapScores']>;
196
200
  //#endregion
197
- export { DatabaseFilePath, OSU_STABLE_DIR_ENV_VAR, OsuFolder, getConfiguredOsuFolder, getConfiguredOsuFolderPath, readCollectionDatabaseFile, readOsuDatabaseFile, readScoresDatabaseFile, writeCollectionDatabaseFile, writeOsuDatabaseFile, writeScoresDatabaseFile };
201
+ export { BeatmapScoreMatch, BeatmapScoreQuery, BeatmapScoresGroupMatch, DatabaseFilePath, OSU_STABLE_DIR_ENV_VAR, OsuFolder, getConfiguredOsuFolder, getConfiguredOsuFolderPath, readCollectionDatabaseFile, readOsuDatabaseFile, readScoresDatabaseFile, writeCollectionDatabaseFile, writeOsuDatabaseFile, writeScoresDatabaseFile };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "osu-stable-db",
3
3
  "type": "module",
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "description": "TypeScript reader and writer for osu!stable database files.",
6
6
  "author": "zzzzv",
7
7
  "license": "MIT",