osu-play 1.0.1 → 1.0.2
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/bin/osu-play.js +1 -1
- package/dist/cli/main.cjs +400 -0
- package/dist/cli/main.cjs.map +1 -0
- package/dist/cli/main.d.cts +3 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +365 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/mod.cjs +367 -0
- package/dist/mod.cjs.map +1 -0
- package/dist/mod.d.cts +121 -0
- package/dist/mod.d.ts +121 -0
- package/dist/mod.js +335 -0
- package/dist/mod.js.map +1 -0
- package/package.json +16 -4
- package/tsconfig.json +7 -3
- package/src/main.ts +0 -72
- package/src/realm/mod.ts +0 -54
- package/src/realm/schema/beatmap.ts +0 -85
- package/src/realm/schema/beatmapMetadata.ts +0 -33
- package/src/realm/schema/beatmapSet.ts +0 -36
- package/src/realm/schema/mod.ts +0 -7
- package/src/realm/schema/realmFile.ts +0 -15
- package/src/realm/schema/realmNamedFileUsage.ts +0 -19
- package/src/realm/schema/realmUser.ts +0 -21
- package/src/utils/mod.ts +0 -81
package/dist/mod.cjs
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/mod.ts
|
|
31
|
+
var mod_exports3 = {};
|
|
32
|
+
__export(mod_exports3, {
|
|
33
|
+
lazer: () => mod_exports2,
|
|
34
|
+
utils: () => mod_exports
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(mod_exports3);
|
|
37
|
+
|
|
38
|
+
// src/utils/mod.ts
|
|
39
|
+
var mod_exports = {};
|
|
40
|
+
__export(mod_exports, {
|
|
41
|
+
getConfigDir: () => getConfigDir,
|
|
42
|
+
getDataDir: () => getDataDir,
|
|
43
|
+
getRealmDBPath: () => getRealmDBPath
|
|
44
|
+
});
|
|
45
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
46
|
+
var import_node_fs = require("fs");
|
|
47
|
+
function getDataDir() {
|
|
48
|
+
switch (process.platform) {
|
|
49
|
+
case "linux":
|
|
50
|
+
case "openbsd":
|
|
51
|
+
case "freebsd": {
|
|
52
|
+
const xdg = process.env["XDG_DATA_HOME"];
|
|
53
|
+
if (xdg)
|
|
54
|
+
return xdg;
|
|
55
|
+
const home = process.env["HOME"];
|
|
56
|
+
if (home)
|
|
57
|
+
return import_node_path.default.join(home, ".local", "share");
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case "darwin": {
|
|
61
|
+
const home = process.env["HOME"];
|
|
62
|
+
if (home)
|
|
63
|
+
return import_node_path.default.join(home, "Library", "Application Support");
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "win32":
|
|
67
|
+
return process.env["LOCALAPPDATA"] ?? null;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
function getConfigDir() {
|
|
72
|
+
switch (process.platform) {
|
|
73
|
+
case "openbsd":
|
|
74
|
+
case "freebsd":
|
|
75
|
+
case "linux": {
|
|
76
|
+
const xdg = process.env["XDG_CONFIG_HOME"];
|
|
77
|
+
if (xdg)
|
|
78
|
+
return xdg;
|
|
79
|
+
const home = process.env["HOME"];
|
|
80
|
+
if (home)
|
|
81
|
+
return import_node_path.default.join(home, ".config");
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case "darwin": {
|
|
85
|
+
const home = process.env["HOME"];
|
|
86
|
+
if (home)
|
|
87
|
+
return import_node_path.default.join(home, "Library", "Preferences");
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case "win32":
|
|
91
|
+
return process.env["APPDATA"] ?? null;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function getRealmDBPath(appConfigDir, osuDataDir, reload = false) {
|
|
96
|
+
const localDBPath = import_node_path.default.join(appConfigDir, "client.realm");
|
|
97
|
+
if (!reload && (0, import_node_fs.existsSync)(localDBPath))
|
|
98
|
+
return localDBPath;
|
|
99
|
+
const osuDBPath = import_node_path.default.join(
|
|
100
|
+
osuDataDir || getDataDir() || ".",
|
|
101
|
+
"osu",
|
|
102
|
+
"client.realm"
|
|
103
|
+
);
|
|
104
|
+
if ((0, import_node_fs.existsSync)(osuDBPath)) {
|
|
105
|
+
console.log(
|
|
106
|
+
`[getRealmDBPath]: ${osuDBPath} is being imported from osu!lazer to ${localDBPath}`
|
|
107
|
+
);
|
|
108
|
+
(0, import_node_fs.mkdirSync)(appConfigDir);
|
|
109
|
+
(0, import_node_fs.copyFileSync)(osuDBPath, localDBPath);
|
|
110
|
+
return localDBPath;
|
|
111
|
+
} else {
|
|
112
|
+
console.log(`[getRealmDBPath]: ${osuDBPath} not found`);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/realm/mod.ts
|
|
118
|
+
var mod_exports2 = {};
|
|
119
|
+
__export(mod_exports2, {
|
|
120
|
+
getLazerDB: () => getLazerDB,
|
|
121
|
+
getNamedFileHash: () => getNamedFileHash,
|
|
122
|
+
hashedFilePath: () => hashedFilePath
|
|
123
|
+
});
|
|
124
|
+
var import_realm7 = __toESM(require("realm"), 1);
|
|
125
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
126
|
+
|
|
127
|
+
// src/realm/schema/beatmap.ts
|
|
128
|
+
var import_realm = __toESM(require("realm"), 1);
|
|
129
|
+
var Beatmap = class extends import_realm.default.Object {
|
|
130
|
+
ID;
|
|
131
|
+
DifficultyName;
|
|
132
|
+
Ruleset;
|
|
133
|
+
Difficulty;
|
|
134
|
+
Metadata;
|
|
135
|
+
UserSettings;
|
|
136
|
+
BeatmapSet;
|
|
137
|
+
Status;
|
|
138
|
+
OnlineID;
|
|
139
|
+
Length;
|
|
140
|
+
BPM;
|
|
141
|
+
Hash;
|
|
142
|
+
StarRating;
|
|
143
|
+
MD5Hash;
|
|
144
|
+
OnlineMD5Hash;
|
|
145
|
+
LastLocalUpdate;
|
|
146
|
+
LastOnlineUpdate;
|
|
147
|
+
Hidden;
|
|
148
|
+
AudioLeadIn;
|
|
149
|
+
StackLeniency;
|
|
150
|
+
SpecialStyle;
|
|
151
|
+
LetterboxInBreaks;
|
|
152
|
+
WidescreenStoryboard;
|
|
153
|
+
EpilepsyWarning;
|
|
154
|
+
SamplesMatchPlaybackRate;
|
|
155
|
+
LastPlayed;
|
|
156
|
+
DistanceSpacing;
|
|
157
|
+
BeatDivisor;
|
|
158
|
+
GridSize;
|
|
159
|
+
TimelineZoom;
|
|
160
|
+
EditorTimestamp;
|
|
161
|
+
CountdownOffset;
|
|
162
|
+
static schema = {
|
|
163
|
+
name: "Beatmap",
|
|
164
|
+
primaryKey: "ID",
|
|
165
|
+
properties: {
|
|
166
|
+
ID: { type: "uuid", default: "" },
|
|
167
|
+
DifficultyName: { type: "string", default: "", optional: true },
|
|
168
|
+
// Ruleset: { type: "object", objectType: "Ruleset", default: null },
|
|
169
|
+
// Difficulty: { type: "object", objectType: "BeatmapDifficulty", default: null },
|
|
170
|
+
Metadata: {
|
|
171
|
+
type: "object",
|
|
172
|
+
objectType: "BeatmapMetadata",
|
|
173
|
+
default: null
|
|
174
|
+
},
|
|
175
|
+
// UserSettings: { type: "object", objectType: "BeatmapUserSettings", default: null },
|
|
176
|
+
BeatmapSet: { type: "object", objectType: "BeatmapSet", default: null },
|
|
177
|
+
Status: { type: "int", default: -3 },
|
|
178
|
+
OnlineID: { type: "int", default: -1 },
|
|
179
|
+
Length: { type: "double", default: 0 },
|
|
180
|
+
BPM: { type: "double", default: 0 },
|
|
181
|
+
Hash: { type: "string", default: "", optional: true },
|
|
182
|
+
StarRating: { type: "double", default: -1 },
|
|
183
|
+
MD5Hash: { type: "string", default: "", optional: true },
|
|
184
|
+
OnlineMD5Hash: {
|
|
185
|
+
type: "string",
|
|
186
|
+
default: "",
|
|
187
|
+
optional: true
|
|
188
|
+
},
|
|
189
|
+
LastLocalUpdate: { type: "date", optional: true },
|
|
190
|
+
LastOnlineUpdate: { type: "date", optional: true },
|
|
191
|
+
Hidden: { type: "bool", default: false },
|
|
192
|
+
AudioLeadIn: { type: "double", default: 0 },
|
|
193
|
+
StackLeniency: { type: "float", default: 0.7 },
|
|
194
|
+
SpecialStyle: { type: "bool", default: false },
|
|
195
|
+
LetterboxInBreaks: { type: "bool", default: false },
|
|
196
|
+
WidescreenStoryboard: { type: "bool", default: false },
|
|
197
|
+
EpilepsyWarning: { type: "bool", default: false },
|
|
198
|
+
SamplesMatchPlaybackRate: { type: "bool", default: false },
|
|
199
|
+
LastPlayed: { type: "date", optional: true },
|
|
200
|
+
DistanceSpacing: { type: "double", default: 0 },
|
|
201
|
+
BeatDivisor: { type: "int", default: 0 },
|
|
202
|
+
GridSize: { type: "int", default: 0 },
|
|
203
|
+
TimelineZoom: { type: "double", default: 0 },
|
|
204
|
+
EditorTimestamp: { type: "double", optional: true },
|
|
205
|
+
CountdownOffset: { type: "int", default: 0 }
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// src/realm/schema/beatmapMetadata.ts
|
|
211
|
+
var import_realm2 = __toESM(require("realm"), 1);
|
|
212
|
+
var BeatmapMetadata = class extends import_realm2.default.Object {
|
|
213
|
+
Title;
|
|
214
|
+
TitleUnicode;
|
|
215
|
+
Artist;
|
|
216
|
+
ArtistUnicode;
|
|
217
|
+
Author;
|
|
218
|
+
Source;
|
|
219
|
+
Tags;
|
|
220
|
+
PreviewTime;
|
|
221
|
+
AudioFile;
|
|
222
|
+
BackgroundFile;
|
|
223
|
+
static schema = {
|
|
224
|
+
name: "BeatmapMetadata",
|
|
225
|
+
properties: {
|
|
226
|
+
Title: { type: "string", default: "", optional: true },
|
|
227
|
+
TitleUnicode: { type: "string", default: "", optional: true },
|
|
228
|
+
Artist: { type: "string", default: "", optional: true },
|
|
229
|
+
ArtistUnicode: { type: "string", default: "", optional: true },
|
|
230
|
+
Author: { type: "object", objectType: "RealmUser", default: null },
|
|
231
|
+
Source: { type: "string", default: "", optional: true },
|
|
232
|
+
Tags: { type: "string", default: "", optional: true },
|
|
233
|
+
PreviewTime: { type: "int", default: 0 },
|
|
234
|
+
AudioFile: { type: "string", default: "", optional: true },
|
|
235
|
+
BackgroundFile: { type: "string", default: "", optional: true }
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// src/realm/schema/beatmapSet.ts
|
|
241
|
+
var import_realm3 = __toESM(require("realm"), 1);
|
|
242
|
+
var BeatmapSet = class extends import_realm3.default.Object {
|
|
243
|
+
ID;
|
|
244
|
+
OnlineID;
|
|
245
|
+
DateAdded;
|
|
246
|
+
DateSubmitted;
|
|
247
|
+
DateRanked;
|
|
248
|
+
Beatmaps;
|
|
249
|
+
Files;
|
|
250
|
+
Status;
|
|
251
|
+
DeletePending;
|
|
252
|
+
Hash;
|
|
253
|
+
Protected;
|
|
254
|
+
static schema = {
|
|
255
|
+
name: "BeatmapSet",
|
|
256
|
+
primaryKey: "ID",
|
|
257
|
+
properties: {
|
|
258
|
+
ID: { type: "uuid", default: "" },
|
|
259
|
+
OnlineID: { type: "int", default: -1 },
|
|
260
|
+
DateAdded: { type: "date" },
|
|
261
|
+
DateSubmitted: { type: "date", optional: true },
|
|
262
|
+
DateRanked: { type: "date", optional: true },
|
|
263
|
+
Beatmaps: { type: "list", objectType: "Beatmap", default: [] },
|
|
264
|
+
Files: { type: "list", objectType: "RealmNamedFileUsage", default: [] },
|
|
265
|
+
Status: { type: "int", default: -3 },
|
|
266
|
+
DeletePending: { type: "bool", default: false },
|
|
267
|
+
Hash: { type: "string", default: "", optional: true },
|
|
268
|
+
Protected: { type: "bool", default: false }
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
// src/realm/schema/realmFile.ts
|
|
274
|
+
var import_realm4 = __toESM(require("realm"), 1);
|
|
275
|
+
var RealmFile = class extends import_realm4.default.Object {
|
|
276
|
+
Hash;
|
|
277
|
+
static schema = {
|
|
278
|
+
name: "File",
|
|
279
|
+
primaryKey: "Hash",
|
|
280
|
+
properties: {
|
|
281
|
+
Hash: { type: "string", default: "", optional: true }
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// src/realm/schema/realmUser.ts
|
|
287
|
+
var import_realm5 = __toESM(require("realm"), 1);
|
|
288
|
+
var RealmUser = class extends import_realm5.default.Object {
|
|
289
|
+
OnlineID;
|
|
290
|
+
Username;
|
|
291
|
+
CountryCode;
|
|
292
|
+
static embedded = true;
|
|
293
|
+
static schema = {
|
|
294
|
+
name: "RealmUser",
|
|
295
|
+
embedded: true,
|
|
296
|
+
properties: {
|
|
297
|
+
OnlineID: { type: "int", default: 1 },
|
|
298
|
+
Username: { type: "string", default: "", optional: true },
|
|
299
|
+
CountryCode: { type: "string", optional: true }
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// src/realm/schema/realmNamedFileUsage.ts
|
|
305
|
+
var import_realm6 = __toESM(require("realm"), 1);
|
|
306
|
+
var RealmNamedFileUsage = class extends import_realm6.default.Object {
|
|
307
|
+
File;
|
|
308
|
+
Filename;
|
|
309
|
+
static embedded = true;
|
|
310
|
+
static schema = {
|
|
311
|
+
name: "RealmNamedFileUsage",
|
|
312
|
+
embedded: true,
|
|
313
|
+
properties: {
|
|
314
|
+
File: "File",
|
|
315
|
+
Filename: { type: "string", optional: true }
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// src/realm/mod.ts
|
|
321
|
+
var getLazerDB = async (realmDBPath) => {
|
|
322
|
+
const realm = await import_realm7.default.open({
|
|
323
|
+
schema: [
|
|
324
|
+
BeatmapSet,
|
|
325
|
+
RealmFile,
|
|
326
|
+
RealmNamedFileUsage,
|
|
327
|
+
Beatmap,
|
|
328
|
+
BeatmapMetadata,
|
|
329
|
+
RealmUser
|
|
330
|
+
],
|
|
331
|
+
path: realmDBPath,
|
|
332
|
+
schemaVersion: 36,
|
|
333
|
+
onMigration: (oldRealm, newRealm) => {
|
|
334
|
+
console.log(
|
|
335
|
+
`[onMigration]: Migrating ${oldRealm.path} - ${oldRealm.schemaVersion} -> ${newRealm.path} - ${newRealm.schemaVersion}`
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
return realm;
|
|
340
|
+
};
|
|
341
|
+
var hashedFilePath = (hash) => {
|
|
342
|
+
const dataDir = getDataDir();
|
|
343
|
+
if (!dataDir)
|
|
344
|
+
return null;
|
|
345
|
+
return import_node_path2.default.join(
|
|
346
|
+
dataDir,
|
|
347
|
+
"osu",
|
|
348
|
+
"files",
|
|
349
|
+
hash.slice(0, 1),
|
|
350
|
+
hash.slice(0, 2),
|
|
351
|
+
hash
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
var getNamedFileHash = (fileName, beatmapSet) => {
|
|
355
|
+
const files = beatmapSet.Files;
|
|
356
|
+
for (const file of files) {
|
|
357
|
+
if (file.Filename == fileName)
|
|
358
|
+
return file.File.Hash;
|
|
359
|
+
}
|
|
360
|
+
return void 0;
|
|
361
|
+
};
|
|
362
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
363
|
+
0 && (module.exports = {
|
|
364
|
+
lazer,
|
|
365
|
+
utils
|
|
366
|
+
});
|
|
367
|
+
//# sourceMappingURL=mod.cjs.map
|
package/dist/mod.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mod.ts","../src/utils/mod.ts","../src/realm/mod.ts","../src/realm/schema/beatmap.ts","../src/realm/schema/beatmapMetadata.ts","../src/realm/schema/beatmapSet.ts","../src/realm/schema/realmFile.ts","../src/realm/schema/realmUser.ts","../src/realm/schema/realmNamedFileUsage.ts"],"sourcesContent":["export * as utils from \"./utils/mod.js\";\nexport * as lazer from \"./realm/mod.js\";\n","import path from \"node:path\";\nimport { copyFileSync, existsSync, mkdirSync } from \"node:fs\";\n\nexport function getDataDir(): string | null {\n switch (process.platform) {\n case \"linux\":\n case \"openbsd\":\n case \"freebsd\": {\n const xdg = process.env[\"XDG_DATA_HOME\"];\n if (xdg) return xdg;\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \".local\", \"share\");\n break;\n }\n\n case \"darwin\": {\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \"Library\", \"Application Support\");\n break;\n }\n\n case \"win32\":\n return process.env[\"LOCALAPPDATA\"] ?? null;\n }\n\n return null;\n}\n\nexport function getConfigDir(): string | null {\n switch (process.platform) {\n case \"openbsd\":\n case \"freebsd\":\n case \"linux\": {\n const xdg = process.env[\"XDG_CONFIG_HOME\"];\n if (xdg) return xdg;\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \".config\");\n break;\n }\n\n case \"darwin\": {\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \"Library\", \"Preferences\");\n break;\n }\n\n case \"win32\":\n return process.env[\"APPDATA\"] ?? null;\n }\n\n return null;\n}\n\n/**\n * Get Realm for the app, import to the config if it doesn't exist\n */\nexport function getRealmDBPath(\n appConfigDir: string,\n osuDataDir?: string,\n reload: boolean = false,\n) {\n const localDBPath = path.join(appConfigDir, \"client.realm\");\n if (!reload && existsSync(localDBPath)) return localDBPath;\n\n const osuDBPath = path.join(\n osuDataDir || getDataDir()! || \".\",\n \"osu\",\n \"client.realm\",\n );\n if (existsSync(osuDBPath)) {\n console.log(\n `[getRealmDBPath]: ${osuDBPath} is being imported from osu!lazer to ${localDBPath}`,\n );\n mkdirSync(appConfigDir);\n copyFileSync(osuDBPath, localDBPath);\n return localDBPath;\n } else {\n console.log(`[getRealmDBPath]: ${osuDBPath} not found`);\n return null;\n }\n}\n","import Realm from \"realm\";\nimport path from \"node:path\";\nimport { getDataDir } from \"../utils/mod.js\";\nimport {\n Beatmap,\n BeatmapMetadata,\n BeatmapSet,\n RealmFile,\n RealmNamedFileUsage,\n RealmUser,\n} from \"./schema/mod.js\";\n\nexport const getLazerDB = async (realmDBPath: string) => {\n const realm = await Realm.open({\n schema: [\n BeatmapSet,\n RealmFile,\n RealmNamedFileUsage,\n Beatmap,\n BeatmapMetadata,\n RealmUser,\n ],\n path: realmDBPath,\n schemaVersion: 36,\n onMigration: (oldRealm, newRealm) => {\n console.log(\n `[onMigration]: Migrating ${oldRealm.path} - ${oldRealm.schemaVersion} -> ${newRealm.path} - ${newRealm.schemaVersion}`,\n );\n },\n });\n\n return realm;\n};\n\nexport const hashedFilePath = (hash: string) => {\n const dataDir = getDataDir();\n if (!dataDir) return null;\n return path.join(\n dataDir,\n \"osu\",\n \"files\",\n hash.slice(0, 1),\n hash.slice(0, 2),\n hash,\n );\n};\n\nexport const getNamedFileHash = (fileName: string, beatmapSet: BeatmapSet) => {\n const files = beatmapSet.Files;\n for (const file of files) {\n if (file.Filename == fileName) return file.File.Hash;\n }\n return undefined;\n};\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { BeatmapMetadata } from \"./beatmapMetadata.js\";\n\nexport class Beatmap extends Realm.Object<Beatmap> {\n ID!: string;\n DifficultyName?: string;\n Ruleset!: any;\n Difficulty!: any;\n Metadata!: BeatmapMetadata;\n UserSettings!: any;\n BeatmapSet!: any;\n Status!: number;\n OnlineID!: number;\n Length!: number;\n BPM!: number;\n Hash?: string;\n StarRating!: number;\n MD5Hash?: string;\n OnlineMD5Hash?: string;\n LastLocalUpdate?: Date;\n LastOnlineUpdate?: Date;\n Hidden!: boolean;\n AudioLeadIn!: number;\n StackLeniency!: number;\n SpecialStyle!: boolean;\n LetterboxInBreaks!: boolean;\n WidescreenStoryboard!: boolean;\n EpilepsyWarning!: boolean;\n SamplesMatchPlaybackRate!: boolean;\n LastPlayed?: Date;\n DistanceSpacing!: number;\n BeatDivisor!: number;\n GridSize!: number;\n TimelineZoom!: number;\n EditorTimestamp?: number;\n CountdownOffset!: number;\n\n static schema: ObjectSchema = {\n name: \"Beatmap\",\n primaryKey: \"ID\",\n properties: {\n ID: { type: \"uuid\", default: \"\" },\n DifficultyName: { type: \"string\", default: \"\", optional: true },\n // Ruleset: { type: \"object\", objectType: \"Ruleset\", default: null },\n // Difficulty: { type: \"object\", objectType: \"BeatmapDifficulty\", default: null },\n Metadata: {\n type: \"object\",\n objectType: \"BeatmapMetadata\",\n default: null,\n },\n // UserSettings: { type: \"object\", objectType: \"BeatmapUserSettings\", default: null },\n BeatmapSet: { type: \"object\", objectType: \"BeatmapSet\", default: null },\n Status: { type: \"int\", default: -3 },\n OnlineID: { type: \"int\", default: -1 },\n Length: { type: \"double\", default: 0 },\n BPM: { type: \"double\", default: 0 },\n Hash: { type: \"string\", default: \"\", optional: true },\n StarRating: { type: \"double\", default: -1 },\n MD5Hash: { type: \"string\", default: \"\", optional: true },\n OnlineMD5Hash: {\n type: \"string\",\n default: \"\",\n optional: true,\n },\n LastLocalUpdate: { type: \"date\", optional: true },\n LastOnlineUpdate: { type: \"date\", optional: true },\n Hidden: { type: \"bool\", default: false },\n AudioLeadIn: { type: \"double\", default: 0 },\n StackLeniency: { type: \"float\", default: 0.7 },\n SpecialStyle: { type: \"bool\", default: false },\n LetterboxInBreaks: { type: \"bool\", default: false },\n WidescreenStoryboard: { type: \"bool\", default: false },\n EpilepsyWarning: { type: \"bool\", default: false },\n SamplesMatchPlaybackRate: { type: \"bool\", default: false },\n LastPlayed: { type: \"date\", optional: true },\n DistanceSpacing: { type: \"double\", default: 0 },\n BeatDivisor: { type: \"int\", default: 0 },\n GridSize: { type: \"int\", default: 0 },\n TimelineZoom: { type: \"double\", default: 0 },\n EditorTimestamp: { type: \"double\", optional: true },\n CountdownOffset: { type: \"int\", default: 0 },\n },\n };\n}\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { RealmUser } from \"./realmUser.js\";\n\nexport class BeatmapMetadata extends Realm.Object<BeatmapMetadata> {\n Title?: string;\n TitleUnicode?: string;\n Artist?: string;\n ArtistUnicode?: string;\n Author?: RealmUser;\n Source?: string;\n Tags?: string;\n PreviewTime?: number;\n AudioFile?: string;\n BackgroundFile?: string;\n\n static schema: ObjectSchema = {\n name: \"BeatmapMetadata\",\n properties: {\n Title: { type: \"string\", default: \"\", optional: true },\n TitleUnicode: { type: \"string\", default: \"\", optional: true },\n Artist: { type: \"string\", default: \"\", optional: true },\n ArtistUnicode: { type: \"string\", default: \"\", optional: true },\n Author: { type: \"object\", objectType: \"RealmUser\", default: null },\n Source: { type: \"string\", default: \"\", optional: true },\n Tags: { type: \"string\", default: \"\", optional: true },\n PreviewTime: { type: \"int\", default: 0 },\n AudioFile: { type: \"string\", default: \"\", optional: true },\n BackgroundFile: { type: \"string\", default: \"\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { Beatmap } from \"./beatmap.js\";\nimport { RealmNamedFileUsage } from \"./realmNamedFileUsage.js\";\n\nexport class BeatmapSet extends Realm.Object<BeatmapSet> {\n ID!: string;\n OnlineID!: number;\n DateAdded!: Date;\n DateSubmitted?: Date;\n DateRanked?: Date;\n Beatmaps!: Array<Beatmap>;\n Files!: Array<RealmNamedFileUsage>;\n Status!: number;\n DeletePending!: boolean;\n Hash?: string;\n Protected!: boolean;\n\n static schema: ObjectSchema = {\n name: \"BeatmapSet\",\n primaryKey: \"ID\",\n properties: {\n ID: { type: \"uuid\", default: \"\" },\n OnlineID: { type: \"int\", default: -1 },\n DateAdded: { type: \"date\" },\n DateSubmitted: { type: \"date\", optional: true },\n DateRanked: { type: \"date\", optional: true },\n Beatmaps: { type: \"list\", objectType: \"Beatmap\", default: [] },\n Files: { type: \"list\", objectType: \"RealmNamedFileUsage\", default: [] },\n Status: { type: \"int\", default: -3 },\n DeletePending: { type: \"bool\", default: false },\n Hash: { type: \"string\", default: \"\", optional: true },\n Protected: { type: \"bool\", default: false },\n },\n };\n}\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\n\nexport class RealmFile extends Realm.Object<RealmFile> {\n Hash?: string;\n\n static schema: ObjectSchema = {\n name: \"File\",\n primaryKey: \"Hash\",\n properties: {\n Hash: { type: \"string\", default: \"\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\n\nexport class RealmUser extends Realm.Object<RealmUser> {\n OnlineID!: number;\n Username?: string;\n CountryCode?: string;\n\n static embedded = true;\n\n static schema: ObjectSchema = {\n name: \"RealmUser\",\n embedded: true,\n properties: {\n OnlineID: { type: \"int\", default: 1 },\n Username: { type: \"string\", default: \"\", optional: true },\n CountryCode: { type: \"string\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { RealmFile } from \"./realmFile.js\";\n\nexport class RealmNamedFileUsage extends Realm.Object<RealmNamedFileUsage> {\n File!: RealmFile;\n Filename?: string;\n\n static embedded = true;\n\n static schema: ObjectSchema = {\n name: \"RealmNamedFileUsage\",\n embedded: true,\n properties: {\n File: \"File\",\n Filename: { type: \"string\", optional: true },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA;AAAA,SAAAA,cAAA;AAAA,eAAAA;AAAA,EAAA;AAAA;AAAA,8BAAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;AACjB,qBAAoD;AAE7C,SAAS,aAA4B;AAC1C,UAAQ,QAAQ,UAAU;AAAA,IACxB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,WAAW;AACd,YAAM,MAAM,QAAQ,IAAI,eAAe;AACvC,UAAI;AAAK,eAAO;AAChB,YAAM,OAAO,QAAQ,IAAI,MAAM;AAC/B,UAAI;AAAM,eAAO,iBAAAC,QAAK,KAAK,MAAM,UAAU,OAAO;AAClD;AAAA,IACF;AAAA,IAEA,KAAK,UAAU;AACb,YAAM,OAAO,QAAQ,IAAI,MAAM;AAC/B,UAAI;AAAM,eAAO,iBAAAA,QAAK,KAAK,MAAM,WAAW,qBAAqB;AACjE;AAAA,IACF;AAAA,IAEA,KAAK;AACH,aAAO,QAAQ,IAAI,cAAc,KAAK;AAAA,EAC1C;AAEA,SAAO;AACT;AAEO,SAAS,eAA8B;AAC5C,UAAQ,QAAQ,UAAU;AAAA,IACxB,KA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AAAA,EACF,CAAC;AAED,SAAO;AACT;AAEO,IAAM,iBAAiB,CAAC,SAAiB;AAC9C,QAAM,UAAU,WAAW;AAC3B,MAAI,CAAC;AAAS,WAAO;AACrB,SAAO,kBAAAC,QAAK;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK,MAAM,GAAG,CAAC;AAAA,IACf,KAAK,MAAM,GAAG,CAAC;AAAA,IACf;AAAA,EACF;AACF;AAEO,IAAM,mBAAmB,CAAC,UAAkB,eAA2B;AAC5E,QAAM,QAAQ,WAAW;AACzB,aAAW,QAAQ,OAAO;AACxB,QAAI,KAAK,YAAY;AAAU,aAAO,KAAK,KAAK;AAAA,EAClD;AACA,SAAO;AACT;","names":["mod_exports","path","mod_exports","import_realm","import_node_path","Realm","import_realm","Realm","import_realm","Realm","import_realm","Realm","import_realm","Realm","import_realm","Realm","Realm","path"]}
|
package/dist/mod.d.cts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import Realm, { ObjectSchema } from 'realm';
|
|
2
|
+
|
|
3
|
+
declare function getDataDir(): string | null;
|
|
4
|
+
declare function getConfigDir(): string | null;
|
|
5
|
+
/**
|
|
6
|
+
* Get Realm for the app, import to the config if it doesn't exist
|
|
7
|
+
*/
|
|
8
|
+
declare function getRealmDBPath(appConfigDir: string, osuDataDir?: string, reload?: boolean): string | null;
|
|
9
|
+
|
|
10
|
+
declare const mod$1_getConfigDir: typeof getConfigDir;
|
|
11
|
+
declare const mod$1_getDataDir: typeof getDataDir;
|
|
12
|
+
declare const mod$1_getRealmDBPath: typeof getRealmDBPath;
|
|
13
|
+
declare namespace mod$1 {
|
|
14
|
+
export {
|
|
15
|
+
mod$1_getConfigDir as getConfigDir,
|
|
16
|
+
mod$1_getDataDir as getDataDir,
|
|
17
|
+
mod$1_getRealmDBPath as getRealmDBPath,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class RealmUser extends Realm.Object<RealmUser> {
|
|
22
|
+
OnlineID: number;
|
|
23
|
+
Username?: string;
|
|
24
|
+
CountryCode?: string;
|
|
25
|
+
static embedded: boolean;
|
|
26
|
+
static schema: ObjectSchema;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class BeatmapMetadata extends Realm.Object<BeatmapMetadata> {
|
|
30
|
+
Title?: string;
|
|
31
|
+
TitleUnicode?: string;
|
|
32
|
+
Artist?: string;
|
|
33
|
+
ArtistUnicode?: string;
|
|
34
|
+
Author?: RealmUser;
|
|
35
|
+
Source?: string;
|
|
36
|
+
Tags?: string;
|
|
37
|
+
PreviewTime?: number;
|
|
38
|
+
AudioFile?: string;
|
|
39
|
+
BackgroundFile?: string;
|
|
40
|
+
static schema: ObjectSchema;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare class Beatmap extends Realm.Object<Beatmap> {
|
|
44
|
+
ID: string;
|
|
45
|
+
DifficultyName?: string;
|
|
46
|
+
Ruleset: any;
|
|
47
|
+
Difficulty: any;
|
|
48
|
+
Metadata: BeatmapMetadata;
|
|
49
|
+
UserSettings: any;
|
|
50
|
+
BeatmapSet: any;
|
|
51
|
+
Status: number;
|
|
52
|
+
OnlineID: number;
|
|
53
|
+
Length: number;
|
|
54
|
+
BPM: number;
|
|
55
|
+
Hash?: string;
|
|
56
|
+
StarRating: number;
|
|
57
|
+
MD5Hash?: string;
|
|
58
|
+
OnlineMD5Hash?: string;
|
|
59
|
+
LastLocalUpdate?: Date;
|
|
60
|
+
LastOnlineUpdate?: Date;
|
|
61
|
+
Hidden: boolean;
|
|
62
|
+
AudioLeadIn: number;
|
|
63
|
+
StackLeniency: number;
|
|
64
|
+
SpecialStyle: boolean;
|
|
65
|
+
LetterboxInBreaks: boolean;
|
|
66
|
+
WidescreenStoryboard: boolean;
|
|
67
|
+
EpilepsyWarning: boolean;
|
|
68
|
+
SamplesMatchPlaybackRate: boolean;
|
|
69
|
+
LastPlayed?: Date;
|
|
70
|
+
DistanceSpacing: number;
|
|
71
|
+
BeatDivisor: number;
|
|
72
|
+
GridSize: number;
|
|
73
|
+
TimelineZoom: number;
|
|
74
|
+
EditorTimestamp?: number;
|
|
75
|
+
CountdownOffset: number;
|
|
76
|
+
static schema: ObjectSchema;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare class RealmFile extends Realm.Object<RealmFile> {
|
|
80
|
+
Hash?: string;
|
|
81
|
+
static schema: ObjectSchema;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class RealmNamedFileUsage extends Realm.Object<RealmNamedFileUsage> {
|
|
85
|
+
File: RealmFile;
|
|
86
|
+
Filename?: string;
|
|
87
|
+
static embedded: boolean;
|
|
88
|
+
static schema: ObjectSchema;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class BeatmapSet extends Realm.Object<BeatmapSet> {
|
|
92
|
+
ID: string;
|
|
93
|
+
OnlineID: number;
|
|
94
|
+
DateAdded: Date;
|
|
95
|
+
DateSubmitted?: Date;
|
|
96
|
+
DateRanked?: Date;
|
|
97
|
+
Beatmaps: Array<Beatmap>;
|
|
98
|
+
Files: Array<RealmNamedFileUsage>;
|
|
99
|
+
Status: number;
|
|
100
|
+
DeletePending: boolean;
|
|
101
|
+
Hash?: string;
|
|
102
|
+
Protected: boolean;
|
|
103
|
+
static schema: ObjectSchema;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
declare const getLazerDB: (realmDBPath: string) => Promise<Realm>;
|
|
107
|
+
declare const hashedFilePath: (hash: string) => string | null;
|
|
108
|
+
declare const getNamedFileHash: (fileName: string, beatmapSet: BeatmapSet) => string | undefined;
|
|
109
|
+
|
|
110
|
+
declare const mod_getLazerDB: typeof getLazerDB;
|
|
111
|
+
declare const mod_getNamedFileHash: typeof getNamedFileHash;
|
|
112
|
+
declare const mod_hashedFilePath: typeof hashedFilePath;
|
|
113
|
+
declare namespace mod {
|
|
114
|
+
export {
|
|
115
|
+
mod_getLazerDB as getLazerDB,
|
|
116
|
+
mod_getNamedFileHash as getNamedFileHash,
|
|
117
|
+
mod_hashedFilePath as hashedFilePath,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { mod as lazer, mod$1 as utils };
|
package/dist/mod.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import Realm, { ObjectSchema } from 'realm';
|
|
2
|
+
|
|
3
|
+
declare function getDataDir(): string | null;
|
|
4
|
+
declare function getConfigDir(): string | null;
|
|
5
|
+
/**
|
|
6
|
+
* Get Realm for the app, import to the config if it doesn't exist
|
|
7
|
+
*/
|
|
8
|
+
declare function getRealmDBPath(appConfigDir: string, osuDataDir?: string, reload?: boolean): string | null;
|
|
9
|
+
|
|
10
|
+
declare const mod$1_getConfigDir: typeof getConfigDir;
|
|
11
|
+
declare const mod$1_getDataDir: typeof getDataDir;
|
|
12
|
+
declare const mod$1_getRealmDBPath: typeof getRealmDBPath;
|
|
13
|
+
declare namespace mod$1 {
|
|
14
|
+
export {
|
|
15
|
+
mod$1_getConfigDir as getConfigDir,
|
|
16
|
+
mod$1_getDataDir as getDataDir,
|
|
17
|
+
mod$1_getRealmDBPath as getRealmDBPath,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class RealmUser extends Realm.Object<RealmUser> {
|
|
22
|
+
OnlineID: number;
|
|
23
|
+
Username?: string;
|
|
24
|
+
CountryCode?: string;
|
|
25
|
+
static embedded: boolean;
|
|
26
|
+
static schema: ObjectSchema;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class BeatmapMetadata extends Realm.Object<BeatmapMetadata> {
|
|
30
|
+
Title?: string;
|
|
31
|
+
TitleUnicode?: string;
|
|
32
|
+
Artist?: string;
|
|
33
|
+
ArtistUnicode?: string;
|
|
34
|
+
Author?: RealmUser;
|
|
35
|
+
Source?: string;
|
|
36
|
+
Tags?: string;
|
|
37
|
+
PreviewTime?: number;
|
|
38
|
+
AudioFile?: string;
|
|
39
|
+
BackgroundFile?: string;
|
|
40
|
+
static schema: ObjectSchema;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare class Beatmap extends Realm.Object<Beatmap> {
|
|
44
|
+
ID: string;
|
|
45
|
+
DifficultyName?: string;
|
|
46
|
+
Ruleset: any;
|
|
47
|
+
Difficulty: any;
|
|
48
|
+
Metadata: BeatmapMetadata;
|
|
49
|
+
UserSettings: any;
|
|
50
|
+
BeatmapSet: any;
|
|
51
|
+
Status: number;
|
|
52
|
+
OnlineID: number;
|
|
53
|
+
Length: number;
|
|
54
|
+
BPM: number;
|
|
55
|
+
Hash?: string;
|
|
56
|
+
StarRating: number;
|
|
57
|
+
MD5Hash?: string;
|
|
58
|
+
OnlineMD5Hash?: string;
|
|
59
|
+
LastLocalUpdate?: Date;
|
|
60
|
+
LastOnlineUpdate?: Date;
|
|
61
|
+
Hidden: boolean;
|
|
62
|
+
AudioLeadIn: number;
|
|
63
|
+
StackLeniency: number;
|
|
64
|
+
SpecialStyle: boolean;
|
|
65
|
+
LetterboxInBreaks: boolean;
|
|
66
|
+
WidescreenStoryboard: boolean;
|
|
67
|
+
EpilepsyWarning: boolean;
|
|
68
|
+
SamplesMatchPlaybackRate: boolean;
|
|
69
|
+
LastPlayed?: Date;
|
|
70
|
+
DistanceSpacing: number;
|
|
71
|
+
BeatDivisor: number;
|
|
72
|
+
GridSize: number;
|
|
73
|
+
TimelineZoom: number;
|
|
74
|
+
EditorTimestamp?: number;
|
|
75
|
+
CountdownOffset: number;
|
|
76
|
+
static schema: ObjectSchema;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare class RealmFile extends Realm.Object<RealmFile> {
|
|
80
|
+
Hash?: string;
|
|
81
|
+
static schema: ObjectSchema;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class RealmNamedFileUsage extends Realm.Object<RealmNamedFileUsage> {
|
|
85
|
+
File: RealmFile;
|
|
86
|
+
Filename?: string;
|
|
87
|
+
static embedded: boolean;
|
|
88
|
+
static schema: ObjectSchema;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class BeatmapSet extends Realm.Object<BeatmapSet> {
|
|
92
|
+
ID: string;
|
|
93
|
+
OnlineID: number;
|
|
94
|
+
DateAdded: Date;
|
|
95
|
+
DateSubmitted?: Date;
|
|
96
|
+
DateRanked?: Date;
|
|
97
|
+
Beatmaps: Array<Beatmap>;
|
|
98
|
+
Files: Array<RealmNamedFileUsage>;
|
|
99
|
+
Status: number;
|
|
100
|
+
DeletePending: boolean;
|
|
101
|
+
Hash?: string;
|
|
102
|
+
Protected: boolean;
|
|
103
|
+
static schema: ObjectSchema;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
declare const getLazerDB: (realmDBPath: string) => Promise<Realm>;
|
|
107
|
+
declare const hashedFilePath: (hash: string) => string | null;
|
|
108
|
+
declare const getNamedFileHash: (fileName: string, beatmapSet: BeatmapSet) => string | undefined;
|
|
109
|
+
|
|
110
|
+
declare const mod_getLazerDB: typeof getLazerDB;
|
|
111
|
+
declare const mod_getNamedFileHash: typeof getNamedFileHash;
|
|
112
|
+
declare const mod_hashedFilePath: typeof hashedFilePath;
|
|
113
|
+
declare namespace mod {
|
|
114
|
+
export {
|
|
115
|
+
mod_getLazerDB as getLazerDB,
|
|
116
|
+
mod_getNamedFileHash as getNamedFileHash,
|
|
117
|
+
mod_hashedFilePath as hashedFilePath,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { mod as lazer, mod$1 as utils };
|