@rian8337/osu-base 4.0.0-beta.97 → 4.0.0-beta.98
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.js +150 -53
- package/package.json +2 -2
- package/typings/index.d.ts +79 -26
package/dist/index.js
CHANGED
|
@@ -2956,7 +2956,7 @@ class ModTouchDevice extends Mod {
|
|
|
2956
2956
|
constructor() {
|
|
2957
2957
|
super(...arguments);
|
|
2958
2958
|
this.acronym = "TD";
|
|
2959
|
-
this.name = "
|
|
2959
|
+
this.name = "Touch Device";
|
|
2960
2960
|
this.osuRanked = true;
|
|
2961
2961
|
this.bitwise = 1 << 2;
|
|
2962
2962
|
this.isOsuRelevant = true;
|
|
@@ -2996,7 +2996,7 @@ class ModSpunOut extends Mod {
|
|
|
2996
2996
|
constructor() {
|
|
2997
2997
|
super(...arguments);
|
|
2998
2998
|
this.acronym = "SO";
|
|
2999
|
-
this.name = "
|
|
2999
|
+
this.name = "Spun Out";
|
|
3000
3000
|
this.osuRanked = true;
|
|
3001
3001
|
this.bitwise = 1 << 12;
|
|
3002
3002
|
this.isOsuRelevant = true;
|
|
@@ -4496,7 +4496,7 @@ class ModHardRock extends Mod {
|
|
|
4496
4496
|
constructor() {
|
|
4497
4497
|
super(...arguments);
|
|
4498
4498
|
this.acronym = "HR";
|
|
4499
|
-
this.name = "
|
|
4499
|
+
this.name = "Hard Rock";
|
|
4500
4500
|
this.droidRanked = true;
|
|
4501
4501
|
this.isDroidRelevant = true;
|
|
4502
4502
|
this.osuRanked = true;
|
|
@@ -4699,7 +4699,7 @@ class ModSmallCircle extends Mod {
|
|
|
4699
4699
|
constructor() {
|
|
4700
4700
|
super(...arguments);
|
|
4701
4701
|
this.acronym = "SC";
|
|
4702
|
-
this.name = "
|
|
4702
|
+
this.name = "Small Circle";
|
|
4703
4703
|
this.droidRanked = false;
|
|
4704
4704
|
this.isDroidRelevant = true;
|
|
4705
4705
|
}
|
|
@@ -4889,18 +4889,6 @@ class ModDifficultyAdjust extends Mod {
|
|
|
4889
4889
|
get isDroidRelevant() {
|
|
4890
4890
|
return this.isRelevant;
|
|
4891
4891
|
}
|
|
4892
|
-
/**
|
|
4893
|
-
* Sets this `ModDifficultyAdjust`'s default difficulty values. This does not change the current values of the
|
|
4894
|
-
* settings, but rather the default values that are used when the settings are reset.
|
|
4895
|
-
*
|
|
4896
|
-
* @param difficulty The `BeatmapDifficulty` to use as the default values.
|
|
4897
|
-
*/
|
|
4898
|
-
applyFromBeatmapDifficulty(difficulty) {
|
|
4899
|
-
this.cs.defaultValue = difficulty.cs;
|
|
4900
|
-
this.ar.defaultValue = difficulty.ar;
|
|
4901
|
-
this.od.defaultValue = difficulty.od;
|
|
4902
|
-
this.hp.defaultValue = difficulty.hp;
|
|
4903
|
-
}
|
|
4904
4892
|
applyToDifficultyWithMods(_, difficulty, mods) {
|
|
4905
4893
|
var _a, _b, _c, _d;
|
|
4906
4894
|
difficulty.cs = (_a = this.cs.value) !== null && _a !== void 0 ? _a : difficulty.cs;
|
|
@@ -5511,7 +5499,7 @@ class ModNightCore extends ModRateAdjust {
|
|
|
5511
5499
|
constructor() {
|
|
5512
5500
|
super(...arguments);
|
|
5513
5501
|
this.acronym = "NC";
|
|
5514
|
-
this.name = "
|
|
5502
|
+
this.name = "Night Core";
|
|
5515
5503
|
this.droidRanked = true;
|
|
5516
5504
|
this.osuRanked = true;
|
|
5517
5505
|
this.bitwise = 1 << 9;
|
|
@@ -5536,7 +5524,7 @@ class ModHalfTime extends ModRateAdjust {
|
|
|
5536
5524
|
constructor() {
|
|
5537
5525
|
super(...arguments);
|
|
5538
5526
|
this.acronym = "HT";
|
|
5539
|
-
this.name = "
|
|
5527
|
+
this.name = "Half Time";
|
|
5540
5528
|
this.droidRanked = true;
|
|
5541
5529
|
this.osuRanked = true;
|
|
5542
5530
|
this.bitwise = 1 << 8;
|
|
@@ -5561,7 +5549,7 @@ class ModDoubleTime extends ModRateAdjust {
|
|
|
5561
5549
|
constructor() {
|
|
5562
5550
|
super(...arguments);
|
|
5563
5551
|
this.acronym = "DT";
|
|
5564
|
-
this.name = "
|
|
5552
|
+
this.name = "Double Time";
|
|
5565
5553
|
this.droidRanked = true;
|
|
5566
5554
|
this.osuRanked = true;
|
|
5567
5555
|
this.bitwise = 1 << 6;
|
|
@@ -5721,7 +5709,7 @@ class ModScoreV2 extends Mod {
|
|
|
5721
5709
|
constructor() {
|
|
5722
5710
|
super(...arguments);
|
|
5723
5711
|
this.acronym = "V2";
|
|
5724
|
-
this.name = "
|
|
5712
|
+
this.name = "Score V2";
|
|
5725
5713
|
this.droidRanked = false;
|
|
5726
5714
|
this.isDroidRelevant = true;
|
|
5727
5715
|
this.osuRanked = false;
|
|
@@ -6443,7 +6431,9 @@ class ScoreMultiplierCalculator {
|
|
|
6443
6431
|
combination(modClass1, modClass2, multiplier) {
|
|
6444
6432
|
this.combinationMultipliers.push([
|
|
6445
6433
|
[modClass1, modClass2],
|
|
6446
|
-
|
|
6434
|
+
typeof multiplier === "number"
|
|
6435
|
+
? () => multiplier
|
|
6436
|
+
: ([mod1, mod2]) => multiplier(mod1, mod2),
|
|
6447
6437
|
]);
|
|
6448
6438
|
}
|
|
6449
6439
|
/**
|
|
@@ -6458,7 +6448,9 @@ class ScoreMultiplierCalculator {
|
|
|
6458
6448
|
group(modClass, multiplier) {
|
|
6459
6449
|
this.groupMultipliers.push([
|
|
6460
6450
|
modClass,
|
|
6461
|
-
multiplier
|
|
6451
|
+
typeof multiplier === "number"
|
|
6452
|
+
? () => multiplier
|
|
6453
|
+
: (mods) => multiplier(mods),
|
|
6462
6454
|
]);
|
|
6463
6455
|
}
|
|
6464
6456
|
/**
|
|
@@ -6612,9 +6604,9 @@ class DroidScoreMultiplierCalculator extends ScoreMultiplierCalculator {
|
|
|
6612
6604
|
? // Linear from 1.0 to 1.46.
|
|
6613
6605
|
// Default DT (1.5x) = 1.23
|
|
6614
6606
|
1 + (rate - 1) * 0.46
|
|
6615
|
-
: // 0.
|
|
6616
|
-
// Default HT (0.75x) = 0.
|
|
6617
|
-
|
|
6607
|
+
: // 0.25x at 0.5x speed, +0.075x per 0.05x speed increment.
|
|
6608
|
+
// Default HT (0.75x) = 0.625.
|
|
6609
|
+
Math.max(0.1, rate * 1.5 - 0.5);
|
|
6618
6610
|
}
|
|
6619
6611
|
timeRampMultiplier(mod) {
|
|
6620
6612
|
const minSpeed = Math.min(mod.initialRate.value, mod.finalRate.value);
|
|
@@ -6653,6 +6645,12 @@ class OsuLegacyScoreMultiplierCalculator extends ScoreMultiplierCalculator {
|
|
|
6653
6645
|
// ScoreV2
|
|
6654
6646
|
// Target Practice
|
|
6655
6647
|
//#endregion
|
|
6648
|
+
//#region ScoreV2-specific
|
|
6649
|
+
this.combination(ModNoFail, ModScoreV2, 1);
|
|
6650
|
+
this.combination(ModHardRock, ModScoreV2, 1.1);
|
|
6651
|
+
this.combination(ModDoubleTime, ModScoreV2, 1.2);
|
|
6652
|
+
this.combination(ModNightCore, ModScoreV2, 1.2);
|
|
6653
|
+
//#endregion
|
|
6656
6654
|
}
|
|
6657
6655
|
}
|
|
6658
6656
|
|
|
@@ -12595,6 +12593,28 @@ class ModOldNightCore extends ModNightCore {
|
|
|
12595
12593
|
}
|
|
12596
12594
|
}
|
|
12597
12595
|
|
|
12596
|
+
/**
|
|
12597
|
+
* Represents a transport-level failure of an API request (e.g., DNS failure, timeout,
|
|
12598
|
+
* connection refused) that persisted across every retry attempt.
|
|
12599
|
+
*
|
|
12600
|
+
* This is distinct from a received HTTP response with a non-2xx status code, which is
|
|
12601
|
+
* not an error at the transport level and is represented by a normal `RequestResponse`.
|
|
12602
|
+
*/
|
|
12603
|
+
class APIRequestError extends Error {
|
|
12604
|
+
/**
|
|
12605
|
+
* @param message The error message.
|
|
12606
|
+
* @param url The URL that was requested.
|
|
12607
|
+
* @param attempts The amount of attempts that were made before giving up.
|
|
12608
|
+
* @param cause The underlying error that was thrown on the final attempt.
|
|
12609
|
+
*/
|
|
12610
|
+
constructor(message, url, attempts, cause) {
|
|
12611
|
+
super(message, { cause });
|
|
12612
|
+
this.url = url;
|
|
12613
|
+
this.attempts = attempts;
|
|
12614
|
+
this.name = "APIRequestError";
|
|
12615
|
+
}
|
|
12616
|
+
}
|
|
12617
|
+
|
|
12598
12618
|
/**
|
|
12599
12619
|
* Available genres in an online osu! beatmap.
|
|
12600
12620
|
*/
|
|
@@ -12670,6 +12690,61 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
12670
12690
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
12671
12691
|
};
|
|
12672
12692
|
|
|
12693
|
+
/**
|
|
12694
|
+
* Wraps the `fetch` response an API request obtained, pairing it with the pre-read
|
|
12695
|
+
* request body and the amount of attempts it took to obtain it.
|
|
12696
|
+
*
|
|
12697
|
+
* The body is read out once, eagerly, rather than lazily from the underlying `Response`
|
|
12698
|
+
* itself, since a `fetch` response body stream can only be consumed once - reading it
|
|
12699
|
+
* eagerly avoids that footgun and lets `data` be read as many times as needed.
|
|
12700
|
+
*/
|
|
12701
|
+
class RequestResponse {
|
|
12702
|
+
/**
|
|
12703
|
+
* @param response The raw `fetch` response this result was obtained from.
|
|
12704
|
+
* @param data The result of the API request, already read out of `response`'s body.
|
|
12705
|
+
* @param attempts The amount of attempts it took to obtain this response.
|
|
12706
|
+
*/
|
|
12707
|
+
constructor(response, data, attempts) {
|
|
12708
|
+
this.response = response;
|
|
12709
|
+
this.data = data;
|
|
12710
|
+
this.attempts = attempts;
|
|
12711
|
+
}
|
|
12712
|
+
/**
|
|
12713
|
+
* The status code of the API request.
|
|
12714
|
+
*/
|
|
12715
|
+
get statusCode() {
|
|
12716
|
+
return this.response.status;
|
|
12717
|
+
}
|
|
12718
|
+
/**
|
|
12719
|
+
* The status text of the API request (e.g., "Too Many Requests" for status code 429).
|
|
12720
|
+
*/
|
|
12721
|
+
get statusText() {
|
|
12722
|
+
return this.response.statusText;
|
|
12723
|
+
}
|
|
12724
|
+
/**
|
|
12725
|
+
* The final URL of the API request, after any redirects.
|
|
12726
|
+
*/
|
|
12727
|
+
get url() {
|
|
12728
|
+
return this.response.url;
|
|
12729
|
+
}
|
|
12730
|
+
/**
|
|
12731
|
+
* The response headers of the API request.
|
|
12732
|
+
*/
|
|
12733
|
+
get headers() {
|
|
12734
|
+
return this.response.headers;
|
|
12735
|
+
}
|
|
12736
|
+
/**
|
|
12737
|
+
* Formats the status code, status text, and (if present) `Retry-After` header of
|
|
12738
|
+
* this response into a human-readable diagnostic string, e.g.
|
|
12739
|
+
* `"429 Too Many Requests (Retry-After: 30)"`.
|
|
12740
|
+
*/
|
|
12741
|
+
describeFailure() {
|
|
12742
|
+
const retryAfter = this.headers.get("retry-after");
|
|
12743
|
+
return (`${this.statusCode.toString()} ${this.statusText}` +
|
|
12744
|
+
(retryAfter ? ` (Retry-After: ${retryAfter})` : ""));
|
|
12745
|
+
}
|
|
12746
|
+
}
|
|
12747
|
+
|
|
12673
12748
|
/**
|
|
12674
12749
|
* The base of API request builders.
|
|
12675
12750
|
*/
|
|
@@ -12688,7 +12763,6 @@ class APIRequestBuilder {
|
|
|
12688
12763
|
* The parameters of this builder.
|
|
12689
12764
|
*/
|
|
12690
12765
|
this.params = new Map();
|
|
12691
|
-
this.fetchAttempts = 0;
|
|
12692
12766
|
}
|
|
12693
12767
|
/**
|
|
12694
12768
|
* The base URL of this builder.
|
|
@@ -12730,37 +12804,54 @@ class APIRequestBuilder {
|
|
|
12730
12804
|
}
|
|
12731
12805
|
return url;
|
|
12732
12806
|
}
|
|
12807
|
+
static backoffDelay(attempt) {
|
|
12808
|
+
const base = 0.25;
|
|
12809
|
+
const exponential = base * Math.pow(2, (attempt - 1));
|
|
12810
|
+
const jitter = exponential * 0.25 * Math.random();
|
|
12811
|
+
return exponential + jitter;
|
|
12812
|
+
}
|
|
12813
|
+
/**
|
|
12814
|
+
* Redacts the API key value from a URL string so it does not leak into logs or thrown errors.
|
|
12815
|
+
*/
|
|
12816
|
+
static redactURL(url) {
|
|
12817
|
+
return url.replace(/([?&](?:k|apiKey)=)[^&]*/g, "$1<redacted>");
|
|
12818
|
+
}
|
|
12733
12819
|
/**
|
|
12734
12820
|
* Sends a request to the API using built parameters.
|
|
12735
12821
|
*
|
|
12736
|
-
* If the request fails, it will be
|
|
12822
|
+
* If the request fails (a 5xx response, or the request itself throwing), it will be
|
|
12823
|
+
* retried up to 5 times with exponential backoff between attempts.
|
|
12824
|
+
*
|
|
12825
|
+
* Resolves with the response for any HTTP response actually received, whatever its
|
|
12826
|
+
* status code. Only rejects with an `APIRequestError` if every attempt's request threw
|
|
12827
|
+
* (e.g., DNS failure, timeout, connection refused) rather than receiving a response.
|
|
12737
12828
|
*/
|
|
12738
12829
|
sendRequest() {
|
|
12739
|
-
return
|
|
12830
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12740
12831
|
const url = this.buildURL();
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12832
|
+
const maxAttempts = APIRequestBuilder.maxAttempts;
|
|
12833
|
+
let lastError;
|
|
12834
|
+
for (let attempt = 1; attempt <= maxAttempts; ++attempt) {
|
|
12835
|
+
try {
|
|
12836
|
+
const res = yield fetch(url);
|
|
12837
|
+
if (res.status >= 500 && attempt < maxAttempts) {
|
|
12838
|
+
const body = yield res.text();
|
|
12839
|
+
console.error(`Request to ${APIRequestBuilder.redactURL(url)} failed with status ${res.status.toString()}: ${body}; attempt ${attempt.toString()} of ${maxAttempts.toString()}; retrying`);
|
|
12840
|
+
yield Utils.sleep(APIRequestBuilder.backoffDelay(attempt));
|
|
12841
|
+
continue;
|
|
12842
|
+
}
|
|
12843
|
+
return new RequestResponse(res, Buffer.from(yield res.arrayBuffer()), attempt);
|
|
12748
12844
|
}
|
|
12749
|
-
|
|
12750
|
-
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
data: Buffer.from([]),
|
|
12760
|
-
statusCode: 400,
|
|
12761
|
-
});
|
|
12762
|
-
return;
|
|
12763
|
-
});
|
|
12845
|
+
catch (e) {
|
|
12846
|
+
lastError = e;
|
|
12847
|
+
if (attempt < maxAttempts) {
|
|
12848
|
+
console.error(`Request to ${APIRequestBuilder.redactURL(url)} failed with error: ${e.message}; attempt ${attempt.toString()} of ${maxAttempts.toString()}; retrying`);
|
|
12849
|
+
yield Utils.sleep(APIRequestBuilder.backoffDelay(attempt));
|
|
12850
|
+
}
|
|
12851
|
+
}
|
|
12852
|
+
}
|
|
12853
|
+
const redactedURL = APIRequestBuilder.redactURL(url);
|
|
12854
|
+
throw new APIRequestError(`Request to ${redactedURL} failed after ${maxAttempts.toString()} attempts`, redactedURL, maxAttempts, lastError);
|
|
12764
12855
|
});
|
|
12765
12856
|
}
|
|
12766
12857
|
/**
|
|
@@ -12783,6 +12874,10 @@ class APIRequestBuilder {
|
|
|
12783
12874
|
return this;
|
|
12784
12875
|
}
|
|
12785
12876
|
}
|
|
12877
|
+
/**
|
|
12878
|
+
* The maximum amount of attempts `sendRequest` will make before giving up.
|
|
12879
|
+
*/
|
|
12880
|
+
APIRequestBuilder.maxAttempts = 5;
|
|
12786
12881
|
|
|
12787
12882
|
/**
|
|
12788
12883
|
* An API request builder for osu!droid.
|
|
@@ -13044,7 +13139,7 @@ class MapInfo {
|
|
|
13044
13139
|
.addParameter(typeof beatmapIdOrHash === "string" ? "h" : "b", beatmapIdOrHash);
|
|
13045
13140
|
const result = yield apiRequestBuilder.sendRequest();
|
|
13046
13141
|
if (result.statusCode !== 200) {
|
|
13047
|
-
throw new Error(
|
|
13142
|
+
throw new Error(`osu! API error: ${result.describeFailure()}`);
|
|
13048
13143
|
}
|
|
13049
13144
|
const mapinfo = JSON.parse(result.data.toString("utf-8")).at(0);
|
|
13050
13145
|
if (!mapinfo) {
|
|
@@ -13388,14 +13483,14 @@ class OsuScoreMultiplierCalculatorV2 extends ScoreMultiplierCalculator {
|
|
|
13388
13483
|
this.single(ModDoubleTime, (dt) => this.doubleTimeMultiplier(dt.rate));
|
|
13389
13484
|
this.single(ModNightCore, (nc) => this.doubleTimeMultiplier(nc.rate));
|
|
13390
13485
|
const blindsMultiplier = 1.24;
|
|
13391
|
-
this.combination(ModHidden, ModBlinds,
|
|
13486
|
+
this.combination(ModHidden, ModBlinds, blindsMultiplier);
|
|
13392
13487
|
this.combination(ModHidden, ModWiggle, (hd) => this.hiddenMultiplier(hd, true));
|
|
13393
13488
|
this.combination(ModHidden, ModGrow, (hd) => this.hiddenMultiplier(hd, true));
|
|
13394
13489
|
this.combination(ModHidden, ModDeflate, (hd) => this.hiddenMultiplier(hd, true));
|
|
13395
13490
|
this.combination(ModHidden, ModRepel, (hd) => this.hiddenMultiplier(hd, true));
|
|
13396
13491
|
this.combination(ModHidden, ModDepth, (hd) => this.hiddenMultiplier(hd, true));
|
|
13397
13492
|
this.single(ModHidden, (hd) => this.hiddenMultiplier(hd, false));
|
|
13398
|
-
this.combination(ModTraceable, ModBlinds,
|
|
13493
|
+
this.combination(ModTraceable, ModBlinds, blindsMultiplier);
|
|
13399
13494
|
this.single(ModTraceable, 1.02);
|
|
13400
13495
|
this.combination(ModFlashlight, ModFreezeFrame, (fl) => 1 + (this.flashlightMultiplier(fl) - 1) / 2);
|
|
13401
13496
|
this.single(ModFlashlight, (fl) => this.flashlightMultiplier(fl));
|
|
@@ -13670,6 +13765,7 @@ class Accuracy {
|
|
|
13670
13765
|
*/
|
|
13671
13766
|
Accuracy.unresolvedN300 = -1;
|
|
13672
13767
|
|
|
13768
|
+
exports.APIRequestError = APIRequestError;
|
|
13673
13769
|
exports.Accuracy = Accuracy;
|
|
13674
13770
|
exports.BankHitSampleInfo = BankHitSampleInfo;
|
|
13675
13771
|
exports.Beatmap = Beatmap;
|
|
@@ -13806,6 +13902,7 @@ exports.Precision = Precision;
|
|
|
13806
13902
|
exports.RGBColor = RGBColor;
|
|
13807
13903
|
exports.Random = Random;
|
|
13808
13904
|
exports.RangeConstrainedModSetting = RangeConstrainedModSetting;
|
|
13905
|
+
exports.RequestResponse = RequestResponse;
|
|
13809
13906
|
exports.SampleBankInfo = SampleBankInfo;
|
|
13810
13907
|
exports.SampleControlPoint = SampleControlPoint;
|
|
13811
13908
|
exports.SampleControlPointManager = SampleControlPointManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-base",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.98",
|
|
4
4
|
"description": "Base module for all osu! related modules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osu",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "0d1f9256f0caee5123379cf5a8b3c92d1dcfa7bf"
|
|
39
39
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -4830,13 +4830,6 @@ declare class ModDifficultyAdjust extends Mod implements IModApplicableToDroid,
|
|
|
4830
4830
|
hp?: number;
|
|
4831
4831
|
});
|
|
4832
4832
|
get isDroidRelevant(): boolean;
|
|
4833
|
-
/**
|
|
4834
|
-
* Sets this `ModDifficultyAdjust`'s default difficulty values. This does not change the current values of the
|
|
4835
|
-
* settings, but rather the default values that are used when the settings are reset.
|
|
4836
|
-
*
|
|
4837
|
-
* @param difficulty The `BeatmapDifficulty` to use as the default values.
|
|
4838
|
-
*/
|
|
4839
|
-
applyFromBeatmapDifficulty(difficulty: BeatmapDifficulty): void;
|
|
4840
4833
|
applyToDifficultyWithMods(_: Modes, difficulty: BeatmapDifficulty, mods: ModMap): void;
|
|
4841
4834
|
applyToHitObjectWithMods(_: Modes, hitObject: HitObject, mods: ModMap): void;
|
|
4842
4835
|
isCompatibleWith(other: Mod): boolean;
|
|
@@ -4850,7 +4843,7 @@ declare class ModDifficultyAdjust extends Mod implements IModApplicableToDroid,
|
|
|
4850
4843
|
*/
|
|
4851
4844
|
declare class ModDoubleTime extends ModRateAdjust implements IModApplicableToDroid, IModApplicableToOsuStable {
|
|
4852
4845
|
readonly acronym = "DT";
|
|
4853
|
-
readonly name = "
|
|
4846
|
+
readonly name = "Double Time";
|
|
4854
4847
|
readonly droidRanked = true;
|
|
4855
4848
|
readonly osuRanked = true;
|
|
4856
4849
|
readonly bitwise: number;
|
|
@@ -4942,7 +4935,7 @@ declare class ModGrow extends ModObjectScaleTween implements IModApplicableToOsu
|
|
|
4942
4935
|
*/
|
|
4943
4936
|
declare class ModHalfTime extends ModRateAdjust implements IModApplicableToDroid, IModApplicableToOsuStable {
|
|
4944
4937
|
readonly acronym = "HT";
|
|
4945
|
-
readonly name = "
|
|
4938
|
+
readonly name = "Half Time";
|
|
4946
4939
|
readonly droidRanked = true;
|
|
4947
4940
|
readonly osuRanked = true;
|
|
4948
4941
|
readonly bitwise: number;
|
|
@@ -4957,7 +4950,7 @@ declare class ModHalfTime extends ModRateAdjust implements IModApplicableToDroid
|
|
|
4957
4950
|
*/
|
|
4958
4951
|
declare class ModHardRock extends Mod implements IModApplicableToDroid, IModApplicableToOsuStable, IModApplicableToDifficulty, IModApplicableToHitObject {
|
|
4959
4952
|
readonly acronym = "HR";
|
|
4960
|
-
readonly name = "
|
|
4953
|
+
readonly name = "Hard Rock";
|
|
4961
4954
|
readonly droidRanked = true;
|
|
4962
4955
|
readonly isDroidRelevant = true;
|
|
4963
4956
|
readonly osuRanked = true;
|
|
@@ -5068,7 +5061,7 @@ declare class ModMuted extends Mod implements IModApplicableToDroid, IModApplica
|
|
|
5068
5061
|
*/
|
|
5069
5062
|
declare class ModNightCore extends ModRateAdjust implements IModApplicableToDroid, IModApplicableToOsuStable {
|
|
5070
5063
|
readonly acronym = "NC";
|
|
5071
|
-
readonly name = "
|
|
5064
|
+
readonly name = "Night Core";
|
|
5072
5065
|
readonly droidRanked = true;
|
|
5073
5066
|
readonly osuRanked = true;
|
|
5074
5067
|
readonly bitwise: number;
|
|
@@ -5277,7 +5270,7 @@ declare class ModReplayV6 extends Mod implements IModApplicableToDroid, IModAppl
|
|
|
5277
5270
|
*/
|
|
5278
5271
|
declare class ModScoreV2 extends Mod implements IModApplicableToDroid, IModApplicableToOsuStable {
|
|
5279
5272
|
readonly acronym = "V2";
|
|
5280
|
-
readonly name = "
|
|
5273
|
+
readonly name = "Score V2";
|
|
5281
5274
|
readonly droidRanked = false;
|
|
5282
5275
|
readonly isDroidRelevant = true;
|
|
5283
5276
|
readonly osuRanked = false;
|
|
@@ -5304,7 +5297,7 @@ declare class ModSingleTap extends Mod implements IModApplicableToOsu {
|
|
|
5304
5297
|
*/
|
|
5305
5298
|
declare class ModSmallCircle extends Mod implements IModApplicableToDroid, IModApplicableToDifficulty, IMigratableDroidMod {
|
|
5306
5299
|
readonly acronym = "SC";
|
|
5307
|
-
readonly name = "
|
|
5300
|
+
readonly name = "Small Circle";
|
|
5308
5301
|
readonly droidRanked = false;
|
|
5309
5302
|
readonly isDroidRelevant = true;
|
|
5310
5303
|
migrateDroidMod(difficulty: BeatmapDifficulty): Mod & IModApplicableToDroid;
|
|
@@ -5329,7 +5322,7 @@ declare class ModSpinIn extends Mod implements IModApplicableToOsu {
|
|
|
5329
5322
|
*/
|
|
5330
5323
|
declare class ModSpunOut extends Mod implements IModApplicableToOsuStable {
|
|
5331
5324
|
readonly acronym = "SO";
|
|
5332
|
-
readonly name = "
|
|
5325
|
+
readonly name = "Spun Out";
|
|
5333
5326
|
readonly osuRanked = true;
|
|
5334
5327
|
readonly bitwise: number;
|
|
5335
5328
|
readonly isOsuRelevant = true;
|
|
@@ -5472,7 +5465,7 @@ declare abstract class ModTimeRamp extends Mod implements IModApplicableToBeatma
|
|
|
5472
5465
|
*/
|
|
5473
5466
|
declare class ModTouchDevice extends Mod implements IModApplicableToOsuStable {
|
|
5474
5467
|
readonly acronym = "TD";
|
|
5475
|
-
readonly name = "
|
|
5468
|
+
readonly name = "Touch Device";
|
|
5476
5469
|
readonly osuRanked = true;
|
|
5477
5470
|
readonly bitwise: number;
|
|
5478
5471
|
readonly isOsuRelevant = true;
|
|
@@ -5550,6 +5543,25 @@ declare class ModWindUp extends ModTimeRamp implements IModApplicableToDroid, IM
|
|
|
5550
5543
|
constructor();
|
|
5551
5544
|
}
|
|
5552
5545
|
|
|
5546
|
+
/**
|
|
5547
|
+
* Represents a transport-level failure of an API request (e.g., DNS failure, timeout,
|
|
5548
|
+
* connection refused) that persisted across every retry attempt.
|
|
5549
|
+
*
|
|
5550
|
+
* This is distinct from a received HTTP response with a non-2xx status code, which is
|
|
5551
|
+
* not an error at the transport level and is represented by a normal `RequestResponse`.
|
|
5552
|
+
*/
|
|
5553
|
+
declare class APIRequestError extends Error {
|
|
5554
|
+
readonly url: string;
|
|
5555
|
+
readonly attempts: number;
|
|
5556
|
+
/**
|
|
5557
|
+
* @param message The error message.
|
|
5558
|
+
* @param url The URL that was requested.
|
|
5559
|
+
* @param attempts The amount of attempts that were made before giving up.
|
|
5560
|
+
* @param cause The underlying error that was thrown on the final attempt.
|
|
5561
|
+
*/
|
|
5562
|
+
constructor(message: string, url: string, attempts: number, cause: unknown);
|
|
5563
|
+
}
|
|
5564
|
+
|
|
5553
5565
|
/**
|
|
5554
5566
|
* Available genres in an online osu! beatmap.
|
|
5555
5567
|
*/
|
|
@@ -5592,17 +5604,45 @@ declare enum BeatmapLanguage {
|
|
|
5592
5604
|
}
|
|
5593
5605
|
|
|
5594
5606
|
/**
|
|
5595
|
-
*
|
|
5607
|
+
* Wraps the `fetch` response an API request obtained, pairing it with the pre-read
|
|
5608
|
+
* request body and the amount of attempts it took to obtain it.
|
|
5609
|
+
*
|
|
5610
|
+
* The body is read out once, eagerly, rather than lazily from the underlying `Response`
|
|
5611
|
+
* itself, since a `fetch` response body stream can only be consumed once - reading it
|
|
5612
|
+
* eagerly avoids that footgun and lets `data` be read as many times as needed.
|
|
5596
5613
|
*/
|
|
5597
|
-
|
|
5614
|
+
declare class RequestResponse {
|
|
5615
|
+
private readonly response;
|
|
5616
|
+
readonly data: Buffer;
|
|
5617
|
+
readonly attempts: number;
|
|
5598
5618
|
/**
|
|
5599
|
-
* The result
|
|
5619
|
+
* @param response The raw `fetch` response this result was obtained from.
|
|
5620
|
+
* @param data The result of the API request, already read out of `response`'s body.
|
|
5621
|
+
* @param attempts The amount of attempts it took to obtain this response.
|
|
5600
5622
|
*/
|
|
5601
|
-
|
|
5623
|
+
constructor(response: Response, data: Buffer, attempts: number);
|
|
5602
5624
|
/**
|
|
5603
5625
|
* The status code of the API request.
|
|
5604
5626
|
*/
|
|
5605
|
-
|
|
5627
|
+
get statusCode(): number;
|
|
5628
|
+
/**
|
|
5629
|
+
* The status text of the API request (e.g., "Too Many Requests" for status code 429).
|
|
5630
|
+
*/
|
|
5631
|
+
get statusText(): string;
|
|
5632
|
+
/**
|
|
5633
|
+
* The final URL of the API request, after any redirects.
|
|
5634
|
+
*/
|
|
5635
|
+
get url(): string;
|
|
5636
|
+
/**
|
|
5637
|
+
* The response headers of the API request.
|
|
5638
|
+
*/
|
|
5639
|
+
get headers(): Headers;
|
|
5640
|
+
/**
|
|
5641
|
+
* Formats the status code, status text, and (if present) `Retry-After` header of
|
|
5642
|
+
* this response into a human-readable diagnostic string, e.g.
|
|
5643
|
+
* `"429 Too Many Requests (Retry-After: 30)"`.
|
|
5644
|
+
*/
|
|
5645
|
+
describeFailure(): string;
|
|
5606
5646
|
}
|
|
5607
5647
|
|
|
5608
5648
|
/**
|
|
@@ -5637,7 +5677,6 @@ declare abstract class APIRequestBuilder<TEndpoint extends string> {
|
|
|
5637
5677
|
* The base URL of this builder.
|
|
5638
5678
|
*/
|
|
5639
5679
|
protected get baseURL(): string;
|
|
5640
|
-
private fetchAttempts;
|
|
5641
5680
|
/**
|
|
5642
5681
|
* Sets the API endpoint.
|
|
5643
5682
|
*
|
|
@@ -5654,10 +5693,24 @@ declare abstract class APIRequestBuilder<TEndpoint extends string> {
|
|
|
5654
5693
|
* Builds the URL to request the API.
|
|
5655
5694
|
*/
|
|
5656
5695
|
buildURL(): string;
|
|
5696
|
+
/**
|
|
5697
|
+
* The maximum amount of attempts `sendRequest` will make before giving up.
|
|
5698
|
+
*/
|
|
5699
|
+
private static readonly maxAttempts;
|
|
5700
|
+
private static backoffDelay;
|
|
5701
|
+
/**
|
|
5702
|
+
* Redacts the API key value from a URL string so it does not leak into logs or thrown errors.
|
|
5703
|
+
*/
|
|
5704
|
+
private static redactURL;
|
|
5657
5705
|
/**
|
|
5658
5706
|
* Sends a request to the API using built parameters.
|
|
5659
5707
|
*
|
|
5660
|
-
* If the request fails, it will be
|
|
5708
|
+
* If the request fails (a 5xx response, or the request itself throwing), it will be
|
|
5709
|
+
* retried up to 5 times with exponential backoff between attempts.
|
|
5710
|
+
*
|
|
5711
|
+
* Resolves with the response for any HTTP response actually received, whatever its
|
|
5712
|
+
* status code. Only rejects with an `APIRequestError` if every attempt's request threw
|
|
5713
|
+
* (e.g., DNS failure, timeout, connection refused) rather than receiving a response.
|
|
5661
5714
|
*/
|
|
5662
5715
|
sendRequest(): Promise<RequestResponse>;
|
|
5663
5716
|
/**
|
|
@@ -6047,7 +6100,7 @@ declare class ScoreMultiplierCalculator {
|
|
|
6047
6100
|
* @param multiplier The multiplier to apply when both {@link Mod}s are present, or a function that returns the
|
|
6048
6101
|
* multiplier based on the two {@link Mod} instances.
|
|
6049
6102
|
*/
|
|
6050
|
-
protected combination<T1 extends Mod, T2 extends Mod>(modClass1: ModClass<T1>, modClass2: ModClass<T2>, multiplier: (mod1: T1, mod2: T2) => number): void;
|
|
6103
|
+
protected combination<T1 extends Mod, T2 extends Mod>(modClass1: ModClass<T1>, modClass2: ModClass<T2>, multiplier: number | ((mod1: T1, mod2: T2) => number)): void;
|
|
6051
6104
|
/**
|
|
6052
6105
|
* Defines a score multiplier for all {@link Mod}s that are instances of {@link TMod}, applied as a group. The multiplier
|
|
6053
6106
|
* function receives the full list of matched {@link Mod}s, allowing their combined state to influence the result.
|
|
@@ -6057,7 +6110,7 @@ declare class ScoreMultiplierCalculator {
|
|
|
6057
6110
|
* @param multiplier The multiplier to apply when one or more {@link Mod}s of the specified class are present, or a function
|
|
6058
6111
|
* that returns the multiplier based on the list of matched {@link Mod} instances.
|
|
6059
6112
|
*/
|
|
6060
|
-
protected group<TMod extends Mod>(modClass: ModClass<TMod>, multiplier: (mods: TMod[]) => number): void;
|
|
6113
|
+
protected group<TMod extends Mod>(modClass: ModClass<TMod>, multiplier: number | ((mods: TMod[]) => number)): void;
|
|
6061
6114
|
/**
|
|
6062
6115
|
* Calculates the multiplier to be applied to score with the given {@link Mod}s.
|
|
6063
6116
|
*
|
|
@@ -6892,5 +6945,5 @@ declare abstract class Utils {
|
|
|
6892
6945
|
static sleep(duration: number): Promise<void>;
|
|
6893
6946
|
}
|
|
6894
6947
|
|
|
6895
|
-
export { Accuracy, AccuracyMode, Anchor, AnimationLoopType, AnimationStyle, Axes, BankHitSampleInfo, Beatmap, BeatmapBackground, BeatmapColor, BeatmapControlPoints, BeatmapConverter, BeatmapCountdown, BeatmapDecoder, BeatmapDifficulty, BeatmapEditor, BeatmapEncoder, BeatmapEvents, BeatmapGeneral, BeatmapGenre, BeatmapHitObjects, BeatmapLanguage, BeatmapMetadata, BeatmapOverlayPosition, BeatmapProcessor, BeatmapVideo, Bin, BlendingEquation, BlendingParameters, BlendingType, BooleanModSetting, BreakPoint, Brent, Chandrupatla, Circle, CircleSizeCalculator, Command, CommandLoop, CommandTimeline, CommandTimelineGroup, CommandTrigger, ControlPointManager, DecimalModSetting, DifficultyAdjustModSetting, DifficultyControlPoint, DifficultyControlPointManager, DroidAPIRequestBuilder, DroidHitWindow, DroidLegacyModConverter, DroidLegacyScoreMultiplierCalculator, DroidPlayableBeatmap, DroidScoreMultiplierCalculator, Easing, EditorGridSize, EffectControlPoint, EffectControlPointManager, EmptyHitWindow, EnumModSetting, ErrorFunction, FileHitSampleInfo, GameMode, HitObject, HitObjectGenerationUtils, HitResult, HitSampleInfo, HitSoundType, HitWindow, IntegerModSetting, Interpolation, IterativePoissonBinomial, MapInfo, MathUtils, Mod, ModAccuracyChallenge, ModAlternate, ModApproachDifferent, ModAuto, ModAutopilot, ModBarrelRoll, ModBlinds, ModBloom, ModBubbles, ModCinema, ModClassic, ModCustomSpeed, ModDaycore, ModDeflate, ModDepth, ModDifficultyAdjust, ModDoubleTime, ModEasy, ModFlashlight, ModFreezeFrame, ModGrow, ModHalfTime, ModHardRock, ModHidden, ModMagnetised, ModMap, ModMirror, ModMuted, ModNightCore, ModNoFail, ModNoScope, ModObjectScaleTween, ModOldNightCore, ModPerfect, ModPrecise, ModRandom, ModRateAdjust, ModReallyEasy, ModRelax, ModRepel, ModReplayV6, ModScoreV2, ModSetting, ModSingleTap, ModSmallCircle, ModSpinIn, ModSpunOut, ModStrictTracking, ModSuddenDeath, ModSynesthesia, ModTargetPractice, ModTimeRamp, ModTouchDevice, ModTraceable, ModTransform, ModUtil, ModWiggle, ModWindDown, ModWindUp, Modes, NormalDistribution, NullableDecimalModSetting, NullableIntegerModSetting, NumberModSetting, ObjectTypes, OsuAPIRequestBuilder, OsuHitWindow, OsuLegacyScoreMultiplierCalculator, OsuPlayableBeatmap, OsuScoreMultiplierCalculatorV1, OsuScoreMultiplierCalculatorV2, PathApproximator, PathType, PlayableBeatmap, Playfield, PoissonBinomial, Polynomial, PreciseDroidHitWindow, Precision, RGBColor, Random, RangeConstrainedModSetting, RankedStatus, RotationDirection, SampleBank, SampleBankInfo, SampleControlPoint, SampleControlPointManager, ScoreMultiplierCalculator, SequenceHitSampleInfo, Slider, SliderHead, SliderNestedHitObject, SliderPath, SliderRepeat, SliderTail, SliderTick, Spinner, Storyboard, StoryboardAnimation, StoryboardCommandType, StoryboardDecoder, StoryboardElement, StoryboardEncoder, StoryboardEventType, StoryboardLayer, StoryboardLayerType, StoryboardParameterCommandType, StoryboardSample, StoryboardSprite, TimedHitSampleInfo, TimingControlPoint, TimingControlPointManager, UnadjustedOsuHitWindow, Utils, Vector2, Vector4, ZeroCrossingBracketing, normalize };
|
|
6896
|
-
export type { AccuracyHitCounts, ChandrupatlaOptions, CommandTimelineSelector, DroidAPIEndpoint, IBeatmap, ICommandTimeline, IMigratableDroidMod, IModApplicableToBeatmap, IModApplicableToDifficulty, IModApplicableToDifficultyWithMods, IModApplicableToDroid, IModApplicableToHitObject, IModApplicableToHitObjectWithMods, IModApplicableToOsu, IModApplicableToOsuStable, IModApplicableToTrackRate, IModFacilitatesAdjustment, If, ModSettingValueChange, ModSettingValueChangedListener, OmitType, OsuAPIEndpoint, OsuAPIResponse, PlaceableHitObject,
|
|
6948
|
+
export { APIRequestError, Accuracy, AccuracyMode, Anchor, AnimationLoopType, AnimationStyle, Axes, BankHitSampleInfo, Beatmap, BeatmapBackground, BeatmapColor, BeatmapControlPoints, BeatmapConverter, BeatmapCountdown, BeatmapDecoder, BeatmapDifficulty, BeatmapEditor, BeatmapEncoder, BeatmapEvents, BeatmapGeneral, BeatmapGenre, BeatmapHitObjects, BeatmapLanguage, BeatmapMetadata, BeatmapOverlayPosition, BeatmapProcessor, BeatmapVideo, Bin, BlendingEquation, BlendingParameters, BlendingType, BooleanModSetting, BreakPoint, Brent, Chandrupatla, Circle, CircleSizeCalculator, Command, CommandLoop, CommandTimeline, CommandTimelineGroup, CommandTrigger, ControlPointManager, DecimalModSetting, DifficultyAdjustModSetting, DifficultyControlPoint, DifficultyControlPointManager, DroidAPIRequestBuilder, DroidHitWindow, DroidLegacyModConverter, DroidLegacyScoreMultiplierCalculator, DroidPlayableBeatmap, DroidScoreMultiplierCalculator, Easing, EditorGridSize, EffectControlPoint, EffectControlPointManager, EmptyHitWindow, EnumModSetting, ErrorFunction, FileHitSampleInfo, GameMode, HitObject, HitObjectGenerationUtils, HitResult, HitSampleInfo, HitSoundType, HitWindow, IntegerModSetting, Interpolation, IterativePoissonBinomial, MapInfo, MathUtils, Mod, ModAccuracyChallenge, ModAlternate, ModApproachDifferent, ModAuto, ModAutopilot, ModBarrelRoll, ModBlinds, ModBloom, ModBubbles, ModCinema, ModClassic, ModCustomSpeed, ModDaycore, ModDeflate, ModDepth, ModDifficultyAdjust, ModDoubleTime, ModEasy, ModFlashlight, ModFreezeFrame, ModGrow, ModHalfTime, ModHardRock, ModHidden, ModMagnetised, ModMap, ModMirror, ModMuted, ModNightCore, ModNoFail, ModNoScope, ModObjectScaleTween, ModOldNightCore, ModPerfect, ModPrecise, ModRandom, ModRateAdjust, ModReallyEasy, ModRelax, ModRepel, ModReplayV6, ModScoreV2, ModSetting, ModSingleTap, ModSmallCircle, ModSpinIn, ModSpunOut, ModStrictTracking, ModSuddenDeath, ModSynesthesia, ModTargetPractice, ModTimeRamp, ModTouchDevice, ModTraceable, ModTransform, ModUtil, ModWiggle, ModWindDown, ModWindUp, Modes, NormalDistribution, NullableDecimalModSetting, NullableIntegerModSetting, NumberModSetting, ObjectTypes, OsuAPIRequestBuilder, OsuHitWindow, OsuLegacyScoreMultiplierCalculator, OsuPlayableBeatmap, OsuScoreMultiplierCalculatorV1, OsuScoreMultiplierCalculatorV2, PathApproximator, PathType, PlayableBeatmap, Playfield, PoissonBinomial, Polynomial, PreciseDroidHitWindow, Precision, RGBColor, Random, RangeConstrainedModSetting, RankedStatus, RequestResponse, RotationDirection, SampleBank, SampleBankInfo, SampleControlPoint, SampleControlPointManager, ScoreMultiplierCalculator, SequenceHitSampleInfo, Slider, SliderHead, SliderNestedHitObject, SliderPath, SliderRepeat, SliderTail, SliderTick, Spinner, Storyboard, StoryboardAnimation, StoryboardCommandType, StoryboardDecoder, StoryboardElement, StoryboardEncoder, StoryboardEventType, StoryboardLayer, StoryboardLayerType, StoryboardParameterCommandType, StoryboardSample, StoryboardSprite, TimedHitSampleInfo, TimingControlPoint, TimingControlPointManager, UnadjustedOsuHitWindow, Utils, Vector2, Vector4, ZeroCrossingBracketing, normalize };
|
|
6949
|
+
export type { AccuracyHitCounts, ChandrupatlaOptions, CommandTimelineSelector, DroidAPIEndpoint, IBeatmap, ICommandTimeline, IMigratableDroidMod, IModApplicableToBeatmap, IModApplicableToDifficulty, IModApplicableToDifficultyWithMods, IModApplicableToDroid, IModApplicableToHitObject, IModApplicableToHitObjectWithMods, IModApplicableToOsu, IModApplicableToOsuStable, IModApplicableToTrackRate, IModFacilitatesAdjustment, If, ModSettingValueChange, ModSettingValueChangedListener, OmitType, OsuAPIEndpoint, OsuAPIResponse, PlaceableHitObject, RootBounds, ScoreRank, SerializedMod };
|