@hardlydifficult/throttle 1.0.0 → 2.0.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/README.md +5 -19
- package/dist/Throttle.d.ts +13 -6
- package/dist/Throttle.d.ts.map +1 -1
- package/dist/Throttle.js +36 -14
- package/dist/Throttle.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
- package/dist/WeightedThrottle.d.ts +0 -20
- package/dist/WeightedThrottle.d.ts.map +0 -1
- package/dist/WeightedThrottle.js +0 -53
- package/dist/WeightedThrottle.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @hardlydifficult/throttle
|
|
2
2
|
|
|
3
|
-
Rate limiting
|
|
3
|
+
Rate limiting with optional weight and state persistence.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,33 +10,19 @@ npm install @hardlydifficult/throttle
|
|
|
10
10
|
|
|
11
11
|
## Throttle
|
|
12
12
|
|
|
13
|
-
Delay-based rate limiting with human-readable durations.
|
|
14
|
-
|
|
15
13
|
```typescript
|
|
16
14
|
import { Throttle } from '@hardlydifficult/throttle';
|
|
17
15
|
|
|
18
16
|
const throttle = new Throttle({
|
|
19
|
-
minimumDelay: { value: 1.5, unit: 'minutes' },
|
|
20
|
-
onSleep: (ms) => console.log(`Sleeping ${ms}ms`),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await throttle.wait(); // resolves immediately
|
|
24
|
-
await throttle.wait(); // sleeps 90s before resolving
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## WeightedThrottle
|
|
28
|
-
|
|
29
|
-
Per-operation weight support with optional state persistence across restarts.
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { WeightedThrottle } from '@hardlydifficult/throttle';
|
|
33
|
-
|
|
34
|
-
const throttle = new WeightedThrottle({
|
|
35
17
|
unitsPerSecond: 10,
|
|
36
18
|
persistKey: 'api-throttle', // optional: survives restarts
|
|
19
|
+
stateDirectory: './my-state', // optional: defaults to ~/.app-state
|
|
37
20
|
onSleep: (ms, info) => console.log(`Sleeping ${ms}ms (weight: ${info.weight})`),
|
|
38
21
|
});
|
|
39
22
|
|
|
23
|
+
await throttle.wait(); // consumes 1 unit (default)
|
|
40
24
|
await throttle.wait(5); // consumes 5 units
|
|
41
25
|
await throttle.wait(10); // consumes 10 units, sleeps if needed
|
|
42
26
|
```
|
|
27
|
+
|
|
28
|
+
When `persistKey` is set, throttle state is written to `{stateDirectory}/{persistKey}.json`. The default `stateDirectory` is `~/.app-state` (override with the `STATE_TRACKER_DIR` environment variable).
|
package/dist/Throttle.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
export interface ThrottleSleepInfo {
|
|
2
|
+
weight: number;
|
|
3
|
+
limitPerSecond: number;
|
|
4
|
+
scheduledStart: number;
|
|
5
|
+
}
|
|
2
6
|
export interface ThrottleOptions {
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
unitsPerSecond: number;
|
|
8
|
+
persistKey?: string;
|
|
9
|
+
stateDirectory?: string;
|
|
10
|
+
onSleep?: (delayMs: number, info: ThrottleSleepInfo) => void;
|
|
5
11
|
}
|
|
6
12
|
export declare class Throttle {
|
|
7
|
-
private
|
|
8
|
-
private readonly
|
|
13
|
+
private nextAvailableAt;
|
|
14
|
+
private readonly unitsPerSecond;
|
|
15
|
+
private readonly stateTracker?;
|
|
9
16
|
private readonly onSleep?;
|
|
10
17
|
constructor(options: ThrottleOptions);
|
|
11
|
-
wait(): Promise<void>;
|
|
18
|
+
wait(weight?: number): Promise<void>;
|
|
12
19
|
}
|
|
13
20
|
//# sourceMappingURL=Throttle.d.ts.map
|
package/dist/Throttle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Throttle.d.ts","sourceRoot":"","sources":["../src/Throttle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Throttle.d.ts","sourceRoot":"","sources":["../src/Throttle.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC9D;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAuB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAqD;gBAElE,OAAO,EAAE,eAAe;IAoB9B,IAAI,CAAC,MAAM,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAuBtC"}
|
package/dist/Throttle.js
CHANGED
|
@@ -1,29 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Throttle = void 0;
|
|
4
|
-
const
|
|
4
|
+
const state_tracker_1 = require("@hardlydifficult/state-tracker");
|
|
5
5
|
const sleep = (ms) => new Promise((resolve) => {
|
|
6
6
|
setTimeout(resolve, ms);
|
|
7
7
|
});
|
|
8
8
|
class Throttle {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
nextAvailableAt;
|
|
10
|
+
unitsPerSecond;
|
|
11
|
+
stateTracker;
|
|
11
12
|
onSleep;
|
|
12
13
|
constructor(options) {
|
|
13
|
-
this.
|
|
14
|
-
if (this.minimumDelayMs <= 0) {
|
|
15
|
-
throw new Error("Throttle minimumDelay must be a positive duration");
|
|
16
|
-
}
|
|
14
|
+
this.unitsPerSecond = options.unitsPerSecond;
|
|
17
15
|
this.onSleep = options.onSleep;
|
|
16
|
+
if (!Number.isFinite(this.unitsPerSecond) || this.unitsPerSecond <= 0) {
|
|
17
|
+
throw new Error("Throttle requires a positive unitsPerSecond value");
|
|
18
|
+
}
|
|
19
|
+
if (options.persistKey !== undefined) {
|
|
20
|
+
this.stateTracker = new state_tracker_1.StateTracker({
|
|
21
|
+
key: options.persistKey,
|
|
22
|
+
default: Date.now(),
|
|
23
|
+
stateDirectory: options.stateDirectory,
|
|
24
|
+
});
|
|
25
|
+
this.nextAvailableAt = this.stateTracker.load();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.nextAvailableAt = 0;
|
|
29
|
+
}
|
|
18
30
|
}
|
|
19
|
-
async wait() {
|
|
31
|
+
async wait(weight = 1) {
|
|
32
|
+
if (!Number.isFinite(weight) || weight <= 0) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
20
35
|
const now = Date.now();
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
const startAt = Math.max(now, this.nextAvailableAt);
|
|
37
|
+
const processingWindowMs = (weight / this.unitsPerSecond) * 1000;
|
|
38
|
+
const delayMs = startAt - now;
|
|
39
|
+
const newNextAvailableAt = startAt + processingWindowMs;
|
|
40
|
+
this.stateTracker?.save(newNextAvailableAt);
|
|
41
|
+
this.nextAvailableAt = newNextAvailableAt;
|
|
42
|
+
if (delayMs > 0) {
|
|
43
|
+
this.onSleep?.(delayMs, {
|
|
44
|
+
weight,
|
|
45
|
+
limitPerSecond: this.unitsPerSecond,
|
|
46
|
+
scheduledStart: startAt,
|
|
47
|
+
});
|
|
48
|
+
await sleep(delayMs);
|
|
27
49
|
}
|
|
28
50
|
}
|
|
29
51
|
}
|
package/dist/Throttle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Throttle.js","sourceRoot":"","sources":["../src/Throttle.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Throttle.js","sourceRoot":"","sources":["../src/Throttle.ts"],"names":[],"mappings":";;;AAAA,kEAA8D;AAE9D,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAC1C,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC;AAeL,MAAa,QAAQ;IACX,eAAe,CAAS;IACf,cAAc,CAAS;IACvB,YAAY,CAAwB;IACpC,OAAO,CAAsD;IAE9E,YAAY,OAAwB;QAClC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,cAAc,IAAI,CAAC,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAAC;gBACnC,GAAG,EAAE,OAAO,CAAC,UAAU;gBACvB,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;gBACnB,cAAc,EAAE,OAAO,CAAC,cAAc;aACvC,CAAC,CAAC;YACH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;YAC5C,OAAO;QACT,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACpD,MAAM,kBAAkB,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;QACjE,MAAM,OAAO,GAAG,OAAO,GAAG,GAAG,CAAC;QAC9B,MAAM,kBAAkB,GAAG,OAAO,GAAG,kBAAkB,CAAC;QAExD,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,kBAAkB,CAAC;QAE1C,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE;gBACtB,MAAM;gBACN,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,cAAc,EAAE,OAAO;aACxB,CAAC,CAAC;YACH,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AAjDD,4BAiDC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { Throttle, type ThrottleOptions } from "./Throttle";
|
|
2
|
-
export { WeightedThrottle, type WeightedThrottleOptions, type WeightedThrottleSleepInfo, } from "./WeightedThrottle";
|
|
1
|
+
export { Throttle, type ThrottleOptions, type ThrottleSleepInfo, } from "./Throttle";
|
|
3
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Throttle = void 0;
|
|
4
4
|
var Throttle_1 = require("./Throttle");
|
|
5
5
|
Object.defineProperty(exports, "Throttle", { enumerable: true, get: function () { return Throttle_1.Throttle; } });
|
|
6
|
-
var WeightedThrottle_1 = require("./WeightedThrottle");
|
|
7
|
-
Object.defineProperty(exports, "WeightedThrottle", { enumerable: true, get: function () { return WeightedThrottle_1.WeightedThrottle; } });
|
|
8
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAIoB;AAHlB,oGAAA,QAAQ,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardlydifficult/throttle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"clean": "rm -rf dist"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@hardlydifficult/state-tracker": "
|
|
19
|
-
"@hardlydifficult/date-time": "1.0.0"
|
|
18
|
+
"@hardlydifficult/state-tracker": "file:../state-tracker"
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
22
21
|
"@types/node": "20.19.31",
|
|
@@ -24,8 +23,7 @@
|
|
|
24
23
|
"vitest": "1.6.1"
|
|
25
24
|
},
|
|
26
25
|
"peerDependencies": {
|
|
27
|
-
"@hardlydifficult/state-tracker": "1.0.0"
|
|
28
|
-
"@hardlydifficult/date-time": "1.0.0"
|
|
26
|
+
"@hardlydifficult/state-tracker": ">=1.0.0"
|
|
29
27
|
},
|
|
30
28
|
"engines": {
|
|
31
29
|
"node": ">=18.0.0"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface WeightedThrottleSleepInfo {
|
|
2
|
-
weight: number;
|
|
3
|
-
limitPerSecond: number;
|
|
4
|
-
scheduledStart: number;
|
|
5
|
-
}
|
|
6
|
-
export interface WeightedThrottleOptions {
|
|
7
|
-
unitsPerSecond: number;
|
|
8
|
-
persistKey?: string;
|
|
9
|
-
stateDirectory?: string;
|
|
10
|
-
onSleep?: (delayMs: number, info: WeightedThrottleSleepInfo) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare class WeightedThrottle {
|
|
13
|
-
private nextAvailableAt;
|
|
14
|
-
private readonly unitsPerSecond;
|
|
15
|
-
private readonly stateTracker?;
|
|
16
|
-
private readonly onSleep?;
|
|
17
|
-
constructor(options: WeightedThrottleOptions);
|
|
18
|
-
wait(weight: number): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=WeightedThrottle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WeightedThrottle.d.ts","sourceRoot":"","sources":["../src/WeightedThrottle.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACtE;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAuB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAGf;gBAEE,OAAO,EAAE,uBAAuB;IAsBtC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAuB1C"}
|
package/dist/WeightedThrottle.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WeightedThrottle = void 0;
|
|
4
|
-
const state_tracker_1 = require("@hardlydifficult/state-tracker");
|
|
5
|
-
const sleep = (ms) => new Promise((resolve) => {
|
|
6
|
-
setTimeout(resolve, ms);
|
|
7
|
-
});
|
|
8
|
-
class WeightedThrottle {
|
|
9
|
-
nextAvailableAt;
|
|
10
|
-
unitsPerSecond;
|
|
11
|
-
stateTracker;
|
|
12
|
-
onSleep;
|
|
13
|
-
constructor(options) {
|
|
14
|
-
this.unitsPerSecond = options.unitsPerSecond;
|
|
15
|
-
this.onSleep = options.onSleep;
|
|
16
|
-
if (!Number.isFinite(this.unitsPerSecond) || this.unitsPerSecond <= 0) {
|
|
17
|
-
throw new Error("WeightedThrottle requires a positive unitsPerSecond value");
|
|
18
|
-
}
|
|
19
|
-
if (options.persistKey !== undefined) {
|
|
20
|
-
this.stateTracker = new state_tracker_1.StateTracker({
|
|
21
|
-
key: options.persistKey,
|
|
22
|
-
default: Date.now(),
|
|
23
|
-
stateDirectory: options.stateDirectory,
|
|
24
|
-
});
|
|
25
|
-
this.nextAvailableAt = this.stateTracker.load();
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.nextAvailableAt = 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async wait(weight) {
|
|
32
|
-
if (!Number.isFinite(weight) || weight <= 0) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const now = Date.now();
|
|
36
|
-
const startAt = Math.max(now, this.nextAvailableAt);
|
|
37
|
-
const processingWindowMs = (weight / this.unitsPerSecond) * 1000;
|
|
38
|
-
const delayMs = startAt - now;
|
|
39
|
-
const newNextAvailableAt = startAt + processingWindowMs;
|
|
40
|
-
this.stateTracker?.save(newNextAvailableAt);
|
|
41
|
-
this.nextAvailableAt = newNextAvailableAt;
|
|
42
|
-
if (delayMs > 0) {
|
|
43
|
-
this.onSleep?.(delayMs, {
|
|
44
|
-
weight,
|
|
45
|
-
limitPerSecond: this.unitsPerSecond,
|
|
46
|
-
scheduledStart: startAt,
|
|
47
|
-
});
|
|
48
|
-
await sleep(delayMs);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.WeightedThrottle = WeightedThrottle;
|
|
53
|
-
//# sourceMappingURL=WeightedThrottle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WeightedThrottle.js","sourceRoot":"","sources":["../src/WeightedThrottle.ts"],"names":[],"mappings":";;;AAAA,kEAA8D;AAE9D,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAC1C,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC;AAeL,MAAa,gBAAgB;IACnB,eAAe,CAAS;IACf,cAAc,CAAS;IACvB,YAAY,CAAwB;IACpC,OAAO,CAGd;IAEV,YAAY,OAAgC;QAC1C,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QA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