@metamask-previews/rate-limit-controller 4.0.2-preview.dad68d4 → 4.0.2-preview.eb2135e
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/CHANGELOG.md +19 -0
- package/dist/RateLimitController.js +6 -118
- package/dist/RateLimitController.js.map +1 -1
- package/dist/RateLimitController.mjs +7 -0
- package/dist/RateLimitController.mjs.map +1 -0
- package/dist/chunk-37GF32BR.js +117 -0
- package/dist/chunk-37GF32BR.js.map +1 -0
- package/dist/chunk-77ZMQ7YH.mjs +117 -0
- package/dist/chunk-77ZMQ7YH.mjs.map +1 -0
- package/dist/index.js +6 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/{RateLimitController.d.ts → types/RateLimitController.d.ts} +22 -12
- package/dist/types/RateLimitController.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +13 -2
- package/dist/RateLimitController.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add and export types `RateLimitedApiMap`, `RateLimitedRequests`. ([#3963](https://github.com/MetaMask/core/pull/3963))
|
|
13
|
+
- `RateLimitedApiMap` represents the type of the `RateLimitedApis` generic parameter used throughout the controller.
|
|
14
|
+
- `RateLimitedRequests` represents the type of the `request` property of `RateLimitState`.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **BREAKING:** Rename types to align with conventions followed by other controllers. ([#3963](https://github.com/MetaMask/core/pull/3963))
|
|
19
|
+
- `GetRateLimitState` is now `RateLimitControllerGetStateAction`.
|
|
20
|
+
- `RateLimitStateChange` is now `RateLimitControllerStateChangeEvent`.
|
|
21
|
+
- `CallApi` is now `RateLimitControllerCallApiAction`.
|
|
22
|
+
- Add `@metamask/utils` `^8.3.0` as a dependency. ([#3963](https://github.com/MetaMask/core/pull/3963))
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **BREAKING:** Fix `GetRateLimitState`, `RateLimitStateChange` types by replacing `RateLimitedApis` with `RateLimitState<RateLimitedApis>` as the state type passed in as generic arguments to `ControllerGetStateAction` and `ControllerStateChangeEvent` ([#3949](https://github.com/MetaMask/core/pull/3949))
|
|
27
|
+
- This bug was introduced in v4.0.0.
|
|
28
|
+
|
|
10
29
|
## [4.0.2]
|
|
11
30
|
|
|
12
31
|
### Changed
|
|
@@ -1,119 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RateLimitController = void 0;
|
|
13
|
-
const base_controller_1 = require("@metamask/base-controller");
|
|
14
|
-
const rpc_errors_1 = require("@metamask/rpc-errors");
|
|
15
|
-
const name = 'RateLimitController';
|
|
16
|
-
const metadata = {
|
|
17
|
-
requests: { persist: false, anonymous: false },
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Controller with logic for rate-limiting API endpoints per requesting origin.
|
|
21
|
-
*/
|
|
22
|
-
class RateLimitController extends base_controller_1.BaseController {
|
|
23
|
-
/**
|
|
24
|
-
* Creates a RateLimitController instance.
|
|
25
|
-
*
|
|
26
|
-
* @param options - Constructor options.
|
|
27
|
-
* @param options.messenger - A reference to the messaging system.
|
|
28
|
-
* @param options.state - Initial state to set on this controller.
|
|
29
|
-
* @param options.implementations - Mapping from API type to API implementation.
|
|
30
|
-
* @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
31
|
-
* @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
32
|
-
*/
|
|
33
|
-
constructor({ rateLimitTimeout = 5000, rateLimitCount = 1, messenger, state, implementations, }) {
|
|
34
|
-
const defaultState = {
|
|
35
|
-
requests: Object.keys(implementations).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: {} })), {}),
|
|
36
|
-
};
|
|
37
|
-
super({
|
|
38
|
-
name,
|
|
39
|
-
metadata,
|
|
40
|
-
messenger,
|
|
41
|
-
state: Object.assign(Object.assign({}, defaultState), state),
|
|
42
|
-
});
|
|
43
|
-
this.implementations = implementations;
|
|
44
|
-
this.rateLimitTimeout = rateLimitTimeout;
|
|
45
|
-
this.rateLimitCount = rateLimitCount;
|
|
46
|
-
this.messagingSystem.registerActionHandler(`${name}:call`, (origin, type, ...args) => this.call(origin, type, ...args));
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Calls an API if the requesting origin is not rate-limited.
|
|
50
|
-
*
|
|
51
|
-
* @param origin - The requesting origin.
|
|
52
|
-
* @param type - The type of API call to make.
|
|
53
|
-
* @param args - Arguments for the API call.
|
|
54
|
-
*/
|
|
55
|
-
call(origin, type, ...args) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
if (this.isRateLimited(type, origin)) {
|
|
58
|
-
throw rpc_errors_1.rpcErrors.limitExceeded({
|
|
59
|
-
message: `"${type.toString()}" is currently rate-limited. Please try again later.`,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
this.recordRequest(type, origin);
|
|
63
|
-
const implementation = this.implementations[type].method;
|
|
64
|
-
if (!implementation) {
|
|
65
|
-
throw new Error('Invalid api type');
|
|
66
|
-
}
|
|
67
|
-
return implementation(...args);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Checks whether an origin is rate limited for the a specific API.
|
|
72
|
-
*
|
|
73
|
-
* @param api - The API the origin is trying to access.
|
|
74
|
-
* @param origin - The origin trying to access the API.
|
|
75
|
-
* @returns `true` if rate-limited, and `false` otherwise.
|
|
76
|
-
*/
|
|
77
|
-
isRateLimited(api, origin) {
|
|
78
|
-
var _a;
|
|
79
|
-
const rateLimitCount = (_a = this.implementations[api].rateLimitCount) !== null && _a !== void 0 ? _a : this.rateLimitCount;
|
|
80
|
-
return this.state.requests[api][origin] >= rateLimitCount;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Records that an origin has made a request to call an API, for rate-limiting purposes.
|
|
84
|
-
*
|
|
85
|
-
* @param api - The API the origin is trying to access.
|
|
86
|
-
* @param origin - The origin trying to access the API.
|
|
87
|
-
*/
|
|
88
|
-
recordRequest(api, origin) {
|
|
89
|
-
var _a;
|
|
90
|
-
const rateLimitTimeout = (_a = this.implementations[api].rateLimitTimeout) !== null && _a !== void 0 ? _a : this.rateLimitTimeout;
|
|
91
|
-
this.update((state) => {
|
|
92
|
-
var _a;
|
|
93
|
-
// TODO: Replace `any` with type
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
-
const previous = (_a = state.requests[api][origin]) !== null && _a !== void 0 ? _a : 0;
|
|
96
|
-
// TODO: Replace `any` with type
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
-
state.requests[api][origin] = previous + 1;
|
|
99
|
-
if (previous === 0) {
|
|
100
|
-
setTimeout(() => this.resetRequestCount(api, origin), rateLimitTimeout);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
106
|
-
*
|
|
107
|
-
* @param api - The API in question.
|
|
108
|
-
* @param origin - The origin in question.
|
|
109
|
-
*/
|
|
110
|
-
resetRequestCount(api, origin) {
|
|
111
|
-
this.update((state) => {
|
|
112
|
-
// TODO: Replace `any` with type
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
|
-
state.requests[api][origin] = 0;
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.RateLimitController = RateLimitController;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk37GF32BRjs = require('./chunk-37GF32BR.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
exports.RateLimitController = _chunk37GF32BRjs.RateLimitController;
|
|
119
7
|
//# sourceMappingURL=RateLimitController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/RateLimitController.ts
|
|
2
|
+
var _basecontroller = require('@metamask/base-controller');
|
|
3
|
+
var _rpcerrors = require('@metamask/rpc-errors');
|
|
4
|
+
var _utils = require('@metamask/utils');
|
|
5
|
+
var name = "RateLimitController";
|
|
6
|
+
var metadata = {
|
|
7
|
+
requests: { persist: false, anonymous: false }
|
|
8
|
+
};
|
|
9
|
+
var RateLimitController = class extends _basecontroller.BaseController {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a RateLimitController instance.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Constructor options.
|
|
14
|
+
* @param options.messenger - A reference to the messaging system.
|
|
15
|
+
* @param options.state - Initial state to set on this controller.
|
|
16
|
+
* @param options.implementations - Mapping from API type to API implementation.
|
|
17
|
+
* @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
18
|
+
* @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
19
|
+
*/
|
|
20
|
+
constructor({
|
|
21
|
+
rateLimitTimeout = 5e3,
|
|
22
|
+
rateLimitCount = 1,
|
|
23
|
+
messenger,
|
|
24
|
+
state,
|
|
25
|
+
implementations
|
|
26
|
+
}) {
|
|
27
|
+
const defaultState = {
|
|
28
|
+
requests: _utils.getKnownPropertyNames.call(void 0, implementations).reduce((acc, key) => ({ ...acc, [key]: {} }), {})
|
|
29
|
+
};
|
|
30
|
+
super({
|
|
31
|
+
name,
|
|
32
|
+
metadata,
|
|
33
|
+
messenger,
|
|
34
|
+
state: { ...defaultState, ...state }
|
|
35
|
+
});
|
|
36
|
+
this.implementations = implementations;
|
|
37
|
+
this.rateLimitTimeout = rateLimitTimeout;
|
|
38
|
+
this.rateLimitCount = rateLimitCount;
|
|
39
|
+
this.messagingSystem.registerActionHandler(
|
|
40
|
+
`${name}:call`,
|
|
41
|
+
(origin, type, ...args) => this.call(origin, type, ...args)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Calls an API if the requesting origin is not rate-limited.
|
|
46
|
+
*
|
|
47
|
+
* @param origin - The requesting origin.
|
|
48
|
+
* @param type - The type of API call to make.
|
|
49
|
+
* @param args - Arguments for the API call.
|
|
50
|
+
*/
|
|
51
|
+
async call(origin, type, ...args) {
|
|
52
|
+
if (this.isRateLimited(type, origin)) {
|
|
53
|
+
throw _rpcerrors.rpcErrors.limitExceeded({
|
|
54
|
+
message: `"${type.toString()}" is currently rate-limited. Please try again later.`
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
this.recordRequest(type, origin);
|
|
58
|
+
const implementation = this.implementations[type].method;
|
|
59
|
+
if (!implementation) {
|
|
60
|
+
throw new Error("Invalid api type");
|
|
61
|
+
}
|
|
62
|
+
return implementation(...args);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Checks whether an origin is rate limited for the a specific API.
|
|
66
|
+
*
|
|
67
|
+
* @param api - The API the origin is trying to access.
|
|
68
|
+
* @param origin - The origin trying to access the API.
|
|
69
|
+
* @returns `true` if rate-limited, and `false` otherwise.
|
|
70
|
+
*/
|
|
71
|
+
isRateLimited(api, origin) {
|
|
72
|
+
const rateLimitCount = this.implementations[api].rateLimitCount ?? this.rateLimitCount;
|
|
73
|
+
return this.state.requests[api][origin] >= rateLimitCount;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Records that an origin has made a request to call an API, for rate-limiting purposes.
|
|
77
|
+
*
|
|
78
|
+
* @param api - The API the origin is trying to access.
|
|
79
|
+
* @param origin - The origin trying to access the API.
|
|
80
|
+
*/
|
|
81
|
+
recordRequest(api, origin) {
|
|
82
|
+
const rateLimitTimeout = this.implementations[api].rateLimitTimeout ?? this.rateLimitTimeout;
|
|
83
|
+
const previous = this.state.requests[api][origin] ?? 0;
|
|
84
|
+
this.update((state) => {
|
|
85
|
+
if (previous === 0) {
|
|
86
|
+
setTimeout(() => this.resetRequestCount(api, origin), rateLimitTimeout);
|
|
87
|
+
}
|
|
88
|
+
Object.assign(state, {
|
|
89
|
+
requests: {
|
|
90
|
+
...state.requests,
|
|
91
|
+
[api]: { [origin]: previous + 1 }
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
98
|
+
*
|
|
99
|
+
* @param api - The API in question.
|
|
100
|
+
* @param origin - The origin in question.
|
|
101
|
+
*/
|
|
102
|
+
resetRequestCount(api, origin) {
|
|
103
|
+
this.update((state) => {
|
|
104
|
+
Object.assign(state, {
|
|
105
|
+
requests: {
|
|
106
|
+
...state.requests,
|
|
107
|
+
[api]: { [origin]: 0 }
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
exports.RateLimitController = RateLimitController;
|
|
117
|
+
//# sourceMappingURL=chunk-37GF32BR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/RateLimitController.ts"],"names":[],"mappings":";AAMA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,6BAA6B;AAmCtC,IAAM,OAAO;AAoCb,IAAM,WAAW;AAAA,EACf,UAAU,EAAE,SAAS,OAAO,WAAW,MAAM;AAC/C;AAKO,IAAM,sBAAN,cAEG,eAIR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,YAAY;AAAA,IACV,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAMG;AACD,UAAM,eAAe;AAAA,MACnB,UAAU,sBAAsB,eAAe,EAAE,OAE/C,CAAC,KAAK,SAAS,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,CAAU;AAAA,IACtD;AACA,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,IACrC,CAAC;AACD,SAAK,kBAAkB;AACvB,SAAK,mBAAmB;AACxB,SAAK,iBAAiB;AAEtB,SAAK,gBAAgB;AAAA,MACnB,GAAG,IAAI;AAAA,MACP,CACE,QACA,SACG,SACA,KAAK,KAAK,QAAQ,MAAM,GAAG,IAAI;AAAA,IACtC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,KACJ,QACA,SACG,MACsD;AACzD,QAAI,KAAK,cAAc,MAAM,MAAM,GAAG;AACpC,YAAM,UAAU,cAAc;AAAA,QAC5B,SAAS,IAAI,KAAK,SAAS,CAAC;AAAA,MAC9B,CAAC;AAAA,IACH;AACA,SAAK,cAAc,MAAM,MAAM;AAE/B,UAAM,iBAAiB,KAAK,gBAAgB,IAAI,EAAE;AAElD,QAAI,CAAC,gBAAgB;AACnB,YAAM,IAAI,MAAM,kBAAkB;AAAA,IACpC;AAEA,WAAO,eAAe,GAAG,IAAI;AAAA,EAG/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,cAAc,KAA4B,QAAgB;AAChE,UAAM,iBACJ,KAAK,gBAAgB,GAAG,EAAE,kBAAkB,KAAK;AACnD,WAAO,KAAK,MAAM,SAAS,GAAG,EAAE,MAAM,KAAK;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,cAAc,KAA4B,QAAgB;AAChE,UAAM,mBACJ,KAAK,gBAAgB,GAAG,EAAE,oBAAoB,KAAK;AACrD,UAAM,WAAW,KAAK,MAAM,SAAS,GAAG,EAAE,MAAM,KAAK;AACrD,SAAK,OAAO,CAAC,UAAU;AACrB,UAAI,aAAa,GAAG;AAClB,mBAAW,MAAM,KAAK,kBAAkB,KAAK,MAAM,GAAG,gBAAgB;AAAA,MACxE;AACA,aAAO,OAAO,OAAO;AAAA,QACnB,UAAU;AAAA,UACR,GAAI,MAAM;AAAA,UACV,CAAC,GAAG,GAAG,EAAE,CAAC,MAAM,GAAG,WAAW,EAAE;AAAA,QAClC;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,kBAAkB,KAA4B,QAAgB;AACpE,SAAK,OAAO,CAAC,UAAU;AACrB,aAAO,OAAO,OAAO;AAAA,QACnB,UAAU;AAAA,UACR,GAAI,MAAM;AAAA,UACV,CAAC,GAAG,GAAG,EAAE,CAAC,MAAM,GAAG,EAAE;AAAA,QACvB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF","sourcesContent":["import type {\n ActionConstraint,\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { getKnownPropertyNames } from '@metamask/utils';\n\n/**\n * A rate-limited API endpoint.\n * @property method - The method that is rate-limited.\n * @property rateLimitTimeout - The time window in which the rate limit is applied (in ms).\n * @property rateLimitCount - The amount of calls an origin can make in the rate limit time window.\n */\nexport type RateLimitedApi = {\n method: ActionConstraint['handler'];\n rateLimitTimeout?: number;\n rateLimitCount?: number;\n};\n\n/**\n * A map of rate-limited API types to APIs.\n */\nexport type RateLimitedApiMap = Record<string, RateLimitedApi>;\n\n/**\n * A map of rate-limited API types to the number of requests made in a given interval for each origin and api type combination.\n * @template RateLimitedApis - A {@link RateLimitedApiMap} containing the rate-limited API endpoints that is used by the {@link RateLimitController}.\n */\nexport type RateLimitedRequests<RateLimitedApis extends RateLimitedApiMap> =\n Record<keyof RateLimitedApis, Record<string, number>>;\n\n/**\n * The state of the {@link RateLimitController}.\n * @template RateLimitedApis - A {@link RateLimitedApiMap} containing the rate-limited API endpoints that is used by the {@link RateLimitController}.\n * @property requests - An object containing the number of requests made in a given interval for each origin and api type combination.\n */\nexport type RateLimitState<RateLimitedApis extends RateLimitedApiMap> = {\n requests: RateLimitedRequests<RateLimitedApis>;\n};\n\nconst name = 'RateLimitController';\n\nexport type RateLimitControllerStateChangeEvent<\n RateLimitedApis extends RateLimitedApiMap,\n> = ControllerStateChangeEvent<typeof name, RateLimitState<RateLimitedApis>>;\n\nexport type RateLimitControllerGetStateAction<\n RateLimitedApis extends RateLimitedApiMap,\n> = ControllerGetStateAction<typeof name, RateLimitState<RateLimitedApis>>;\n\nexport type RateLimitControllerCallApiAction<\n RateLimitedApis extends RateLimitedApiMap,\n> = {\n type: `${typeof name}:call`;\n handler: RateLimitController<RateLimitedApis>['call'];\n};\n\nexport type RateLimitControllerActions<\n RateLimitedApis extends RateLimitedApiMap,\n> =\n | RateLimitControllerGetStateAction<RateLimitedApis>\n | RateLimitControllerCallApiAction<RateLimitedApis>;\n\nexport type RateLimitControllerEvents<\n RateLimitedApis extends RateLimitedApiMap,\n> = RateLimitControllerStateChangeEvent<RateLimitedApis>;\n\nexport type RateLimitMessenger<RateLimitedApis extends RateLimitedApiMap> =\n RestrictedControllerMessenger<\n typeof name,\n RateLimitControllerActions<RateLimitedApis>,\n RateLimitControllerEvents<RateLimitedApis>,\n never,\n never\n >;\n\nconst metadata = {\n requests: { persist: false, anonymous: false },\n};\n\n/**\n * Controller with logic for rate-limiting API endpoints per requesting origin.\n */\nexport class RateLimitController<\n RateLimitedApis extends RateLimitedApiMap,\n> extends BaseController<\n typeof name,\n RateLimitState<RateLimitedApis>,\n RateLimitMessenger<RateLimitedApis>\n> {\n private readonly implementations;\n\n private readonly rateLimitTimeout;\n\n private readonly rateLimitCount;\n\n /**\n * Creates a RateLimitController instance.\n *\n * @param options - Constructor options.\n * @param options.messenger - A reference to the messaging system.\n * @param options.state - Initial state to set on this controller.\n * @param options.implementations - Mapping from API type to API implementation.\n * @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).\n * @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.\n */\n constructor({\n rateLimitTimeout = 5000,\n rateLimitCount = 1,\n messenger,\n state,\n implementations,\n }: {\n rateLimitTimeout?: number;\n rateLimitCount?: number;\n messenger: RateLimitMessenger<RateLimitedApis>;\n state?: Partial<RateLimitState<RateLimitedApis>>;\n implementations: RateLimitedApis;\n }) {\n const defaultState = {\n requests: getKnownPropertyNames(implementations).reduce<\n RateLimitedRequests<RateLimitedApis>\n >((acc, key) => ({ ...acc, [key]: {} }), {} as never),\n };\n super({\n name,\n metadata,\n messenger,\n state: { ...defaultState, ...state },\n });\n this.implementations = implementations;\n this.rateLimitTimeout = rateLimitTimeout;\n this.rateLimitCount = rateLimitCount;\n\n this.messagingSystem.registerActionHandler(\n `${name}:call`,\n (\n origin: string,\n type: keyof RateLimitedApis,\n ...args: Parameters<RateLimitedApis[typeof type]['method']>\n ) => this.call(origin, type, ...args),\n );\n }\n\n /**\n * Calls an API if the requesting origin is not rate-limited.\n *\n * @param origin - The requesting origin.\n * @param type - The type of API call to make.\n * @param args - Arguments for the API call.\n */\n async call<ApiType extends keyof RateLimitedApis>(\n origin: string,\n type: ApiType,\n ...args: Parameters<RateLimitedApis[ApiType]['method']>\n ): Promise<ReturnType<RateLimitedApis[ApiType]['method']>> {\n if (this.isRateLimited(type, origin)) {\n throw rpcErrors.limitExceeded({\n message: `\"${type.toString()}\" is currently rate-limited. Please try again later.`,\n });\n }\n this.recordRequest(type, origin);\n\n const implementation = this.implementations[type].method;\n\n if (!implementation) {\n throw new Error('Invalid api type');\n }\n\n return implementation(...args) as ReturnType<\n RateLimitedApis[ApiType]['method']\n >;\n }\n\n /**\n * Checks whether an origin is rate limited for the a specific API.\n *\n * @param api - The API the origin is trying to access.\n * @param origin - The origin trying to access the API.\n * @returns `true` if rate-limited, and `false` otherwise.\n */\n private isRateLimited(api: keyof RateLimitedApis, origin: string) {\n const rateLimitCount =\n this.implementations[api].rateLimitCount ?? this.rateLimitCount;\n return this.state.requests[api][origin] >= rateLimitCount;\n }\n\n /**\n * Records that an origin has made a request to call an API, for rate-limiting purposes.\n *\n * @param api - The API the origin is trying to access.\n * @param origin - The origin trying to access the API.\n */\n private recordRequest(api: keyof RateLimitedApis, origin: string) {\n const rateLimitTimeout =\n this.implementations[api].rateLimitTimeout ?? this.rateLimitTimeout;\n const previous = this.state.requests[api][origin] ?? 0;\n this.update((state) => {\n if (previous === 0) {\n setTimeout(() => this.resetRequestCount(api, origin), rateLimitTimeout);\n }\n Object.assign(state, {\n requests: {\n ...(state.requests as RateLimitedRequests<RateLimitedApis>),\n [api]: { [origin]: previous + 1 },\n },\n });\n });\n }\n\n /**\n * Resets the request count for a given origin and API combination, for rate-limiting purposes.\n *\n * @param api - The API in question.\n * @param origin - The origin in question.\n */\n private resetRequestCount(api: keyof RateLimitedApis, origin: string) {\n this.update((state) => {\n Object.assign(state, {\n requests: {\n ...(state.requests as RateLimitedRequests<RateLimitedApis>),\n [api]: { [origin]: 0 },\n },\n });\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// src/RateLimitController.ts
|
|
2
|
+
import { BaseController } from "@metamask/base-controller";
|
|
3
|
+
import { rpcErrors } from "@metamask/rpc-errors";
|
|
4
|
+
import { getKnownPropertyNames } from "@metamask/utils";
|
|
5
|
+
var name = "RateLimitController";
|
|
6
|
+
var metadata = {
|
|
7
|
+
requests: { persist: false, anonymous: false }
|
|
8
|
+
};
|
|
9
|
+
var RateLimitController = class extends BaseController {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a RateLimitController instance.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Constructor options.
|
|
14
|
+
* @param options.messenger - A reference to the messaging system.
|
|
15
|
+
* @param options.state - Initial state to set on this controller.
|
|
16
|
+
* @param options.implementations - Mapping from API type to API implementation.
|
|
17
|
+
* @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
18
|
+
* @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
19
|
+
*/
|
|
20
|
+
constructor({
|
|
21
|
+
rateLimitTimeout = 5e3,
|
|
22
|
+
rateLimitCount = 1,
|
|
23
|
+
messenger,
|
|
24
|
+
state,
|
|
25
|
+
implementations
|
|
26
|
+
}) {
|
|
27
|
+
const defaultState = {
|
|
28
|
+
requests: getKnownPropertyNames(implementations).reduce((acc, key) => ({ ...acc, [key]: {} }), {})
|
|
29
|
+
};
|
|
30
|
+
super({
|
|
31
|
+
name,
|
|
32
|
+
metadata,
|
|
33
|
+
messenger,
|
|
34
|
+
state: { ...defaultState, ...state }
|
|
35
|
+
});
|
|
36
|
+
this.implementations = implementations;
|
|
37
|
+
this.rateLimitTimeout = rateLimitTimeout;
|
|
38
|
+
this.rateLimitCount = rateLimitCount;
|
|
39
|
+
this.messagingSystem.registerActionHandler(
|
|
40
|
+
`${name}:call`,
|
|
41
|
+
(origin, type, ...args) => this.call(origin, type, ...args)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Calls an API if the requesting origin is not rate-limited.
|
|
46
|
+
*
|
|
47
|
+
* @param origin - The requesting origin.
|
|
48
|
+
* @param type - The type of API call to make.
|
|
49
|
+
* @param args - Arguments for the API call.
|
|
50
|
+
*/
|
|
51
|
+
async call(origin, type, ...args) {
|
|
52
|
+
if (this.isRateLimited(type, origin)) {
|
|
53
|
+
throw rpcErrors.limitExceeded({
|
|
54
|
+
message: `"${type.toString()}" is currently rate-limited. Please try again later.`
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
this.recordRequest(type, origin);
|
|
58
|
+
const implementation = this.implementations[type].method;
|
|
59
|
+
if (!implementation) {
|
|
60
|
+
throw new Error("Invalid api type");
|
|
61
|
+
}
|
|
62
|
+
return implementation(...args);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Checks whether an origin is rate limited for the a specific API.
|
|
66
|
+
*
|
|
67
|
+
* @param api - The API the origin is trying to access.
|
|
68
|
+
* @param origin - The origin trying to access the API.
|
|
69
|
+
* @returns `true` if rate-limited, and `false` otherwise.
|
|
70
|
+
*/
|
|
71
|
+
isRateLimited(api, origin) {
|
|
72
|
+
const rateLimitCount = this.implementations[api].rateLimitCount ?? this.rateLimitCount;
|
|
73
|
+
return this.state.requests[api][origin] >= rateLimitCount;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Records that an origin has made a request to call an API, for rate-limiting purposes.
|
|
77
|
+
*
|
|
78
|
+
* @param api - The API the origin is trying to access.
|
|
79
|
+
* @param origin - The origin trying to access the API.
|
|
80
|
+
*/
|
|
81
|
+
recordRequest(api, origin) {
|
|
82
|
+
const rateLimitTimeout = this.implementations[api].rateLimitTimeout ?? this.rateLimitTimeout;
|
|
83
|
+
const previous = this.state.requests[api][origin] ?? 0;
|
|
84
|
+
this.update((state) => {
|
|
85
|
+
if (previous === 0) {
|
|
86
|
+
setTimeout(() => this.resetRequestCount(api, origin), rateLimitTimeout);
|
|
87
|
+
}
|
|
88
|
+
Object.assign(state, {
|
|
89
|
+
requests: {
|
|
90
|
+
...state.requests,
|
|
91
|
+
[api]: { [origin]: previous + 1 }
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
98
|
+
*
|
|
99
|
+
* @param api - The API in question.
|
|
100
|
+
* @param origin - The origin in question.
|
|
101
|
+
*/
|
|
102
|
+
resetRequestCount(api, origin) {
|
|
103
|
+
this.update((state) => {
|
|
104
|
+
Object.assign(state, {
|
|
105
|
+
requests: {
|
|
106
|
+
...state.requests,
|
|
107
|
+
[api]: { [origin]: 0 }
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
RateLimitController
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=chunk-77ZMQ7YH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/RateLimitController.ts"],"sourcesContent":["import type {\n ActionConstraint,\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { getKnownPropertyNames } from '@metamask/utils';\n\n/**\n * A rate-limited API endpoint.\n * @property method - The method that is rate-limited.\n * @property rateLimitTimeout - The time window in which the rate limit is applied (in ms).\n * @property rateLimitCount - The amount of calls an origin can make in the rate limit time window.\n */\nexport type RateLimitedApi = {\n method: ActionConstraint['handler'];\n rateLimitTimeout?: number;\n rateLimitCount?: number;\n};\n\n/**\n * A map of rate-limited API types to APIs.\n */\nexport type RateLimitedApiMap = Record<string, RateLimitedApi>;\n\n/**\n * A map of rate-limited API types to the number of requests made in a given interval for each origin and api type combination.\n * @template RateLimitedApis - A {@link RateLimitedApiMap} containing the rate-limited API endpoints that is used by the {@link RateLimitController}.\n */\nexport type RateLimitedRequests<RateLimitedApis extends RateLimitedApiMap> =\n Record<keyof RateLimitedApis, Record<string, number>>;\n\n/**\n * The state of the {@link RateLimitController}.\n * @template RateLimitedApis - A {@link RateLimitedApiMap} containing the rate-limited API endpoints that is used by the {@link RateLimitController}.\n * @property requests - An object containing the number of requests made in a given interval for each origin and api type combination.\n */\nexport type RateLimitState<RateLimitedApis extends RateLimitedApiMap> = {\n requests: RateLimitedRequests<RateLimitedApis>;\n};\n\nconst name = 'RateLimitController';\n\nexport type RateLimitControllerStateChangeEvent<\n RateLimitedApis extends RateLimitedApiMap,\n> = ControllerStateChangeEvent<typeof name, RateLimitState<RateLimitedApis>>;\n\nexport type RateLimitControllerGetStateAction<\n RateLimitedApis extends RateLimitedApiMap,\n> = ControllerGetStateAction<typeof name, RateLimitState<RateLimitedApis>>;\n\nexport type RateLimitControllerCallApiAction<\n RateLimitedApis extends RateLimitedApiMap,\n> = {\n type: `${typeof name}:call`;\n handler: RateLimitController<RateLimitedApis>['call'];\n};\n\nexport type RateLimitControllerActions<\n RateLimitedApis extends RateLimitedApiMap,\n> =\n | RateLimitControllerGetStateAction<RateLimitedApis>\n | RateLimitControllerCallApiAction<RateLimitedApis>;\n\nexport type RateLimitControllerEvents<\n RateLimitedApis extends RateLimitedApiMap,\n> = RateLimitControllerStateChangeEvent<RateLimitedApis>;\n\nexport type RateLimitMessenger<RateLimitedApis extends RateLimitedApiMap> =\n RestrictedControllerMessenger<\n typeof name,\n RateLimitControllerActions<RateLimitedApis>,\n RateLimitControllerEvents<RateLimitedApis>,\n never,\n never\n >;\n\nconst metadata = {\n requests: { persist: false, anonymous: false },\n};\n\n/**\n * Controller with logic for rate-limiting API endpoints per requesting origin.\n */\nexport class RateLimitController<\n RateLimitedApis extends RateLimitedApiMap,\n> extends BaseController<\n typeof name,\n RateLimitState<RateLimitedApis>,\n RateLimitMessenger<RateLimitedApis>\n> {\n private readonly implementations;\n\n private readonly rateLimitTimeout;\n\n private readonly rateLimitCount;\n\n /**\n * Creates a RateLimitController instance.\n *\n * @param options - Constructor options.\n * @param options.messenger - A reference to the messaging system.\n * @param options.state - Initial state to set on this controller.\n * @param options.implementations - Mapping from API type to API implementation.\n * @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).\n * @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.\n */\n constructor({\n rateLimitTimeout = 5000,\n rateLimitCount = 1,\n messenger,\n state,\n implementations,\n }: {\n rateLimitTimeout?: number;\n rateLimitCount?: number;\n messenger: RateLimitMessenger<RateLimitedApis>;\n state?: Partial<RateLimitState<RateLimitedApis>>;\n implementations: RateLimitedApis;\n }) {\n const defaultState = {\n requests: getKnownPropertyNames(implementations).reduce<\n RateLimitedRequests<RateLimitedApis>\n >((acc, key) => ({ ...acc, [key]: {} }), {} as never),\n };\n super({\n name,\n metadata,\n messenger,\n state: { ...defaultState, ...state },\n });\n this.implementations = implementations;\n this.rateLimitTimeout = rateLimitTimeout;\n this.rateLimitCount = rateLimitCount;\n\n this.messagingSystem.registerActionHandler(\n `${name}:call`,\n (\n origin: string,\n type: keyof RateLimitedApis,\n ...args: Parameters<RateLimitedApis[typeof type]['method']>\n ) => this.call(origin, type, ...args),\n );\n }\n\n /**\n * Calls an API if the requesting origin is not rate-limited.\n *\n * @param origin - The requesting origin.\n * @param type - The type of API call to make.\n * @param args - Arguments for the API call.\n */\n async call<ApiType extends keyof RateLimitedApis>(\n origin: string,\n type: ApiType,\n ...args: Parameters<RateLimitedApis[ApiType]['method']>\n ): Promise<ReturnType<RateLimitedApis[ApiType]['method']>> {\n if (this.isRateLimited(type, origin)) {\n throw rpcErrors.limitExceeded({\n message: `\"${type.toString()}\" is currently rate-limited. Please try again later.`,\n });\n }\n this.recordRequest(type, origin);\n\n const implementation = this.implementations[type].method;\n\n if (!implementation) {\n throw new Error('Invalid api type');\n }\n\n return implementation(...args) as ReturnType<\n RateLimitedApis[ApiType]['method']\n >;\n }\n\n /**\n * Checks whether an origin is rate limited for the a specific API.\n *\n * @param api - The API the origin is trying to access.\n * @param origin - The origin trying to access the API.\n * @returns `true` if rate-limited, and `false` otherwise.\n */\n private isRateLimited(api: keyof RateLimitedApis, origin: string) {\n const rateLimitCount =\n this.implementations[api].rateLimitCount ?? this.rateLimitCount;\n return this.state.requests[api][origin] >= rateLimitCount;\n }\n\n /**\n * Records that an origin has made a request to call an API, for rate-limiting purposes.\n *\n * @param api - The API the origin is trying to access.\n * @param origin - The origin trying to access the API.\n */\n private recordRequest(api: keyof RateLimitedApis, origin: string) {\n const rateLimitTimeout =\n this.implementations[api].rateLimitTimeout ?? this.rateLimitTimeout;\n const previous = this.state.requests[api][origin] ?? 0;\n this.update((state) => {\n if (previous === 0) {\n setTimeout(() => this.resetRequestCount(api, origin), rateLimitTimeout);\n }\n Object.assign(state, {\n requests: {\n ...(state.requests as RateLimitedRequests<RateLimitedApis>),\n [api]: { [origin]: previous + 1 },\n },\n });\n });\n }\n\n /**\n * Resets the request count for a given origin and API combination, for rate-limiting purposes.\n *\n * @param api - The API in question.\n * @param origin - The origin in question.\n */\n private resetRequestCount(api: keyof RateLimitedApis, origin: string) {\n this.update((state) => {\n Object.assign(state, {\n requests: {\n ...(state.requests as RateLimitedRequests<RateLimitedApis>),\n [api]: { [origin]: 0 },\n },\n });\n });\n }\n}\n"],"mappings":";AAMA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,6BAA6B;AAmCtC,IAAM,OAAO;AAoCb,IAAM,WAAW;AAAA,EACf,UAAU,EAAE,SAAS,OAAO,WAAW,MAAM;AAC/C;AAKO,IAAM,sBAAN,cAEG,eAIR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,YAAY;AAAA,IACV,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAMG;AACD,UAAM,eAAe;AAAA,MACnB,UAAU,sBAAsB,eAAe,EAAE,OAE/C,CAAC,KAAK,SAAS,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,CAAU;AAAA,IACtD;AACA,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,IACrC,CAAC;AACD,SAAK,kBAAkB;AACvB,SAAK,mBAAmB;AACxB,SAAK,iBAAiB;AAEtB,SAAK,gBAAgB;AAAA,MACnB,GAAG,IAAI;AAAA,MACP,CACE,QACA,SACG,SACA,KAAK,KAAK,QAAQ,MAAM,GAAG,IAAI;AAAA,IACtC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,KACJ,QACA,SACG,MACsD;AACzD,QAAI,KAAK,cAAc,MAAM,MAAM,GAAG;AACpC,YAAM,UAAU,cAAc;AAAA,QAC5B,SAAS,IAAI,KAAK,SAAS,CAAC;AAAA,MAC9B,CAAC;AAAA,IACH;AACA,SAAK,cAAc,MAAM,MAAM;AAE/B,UAAM,iBAAiB,KAAK,gBAAgB,IAAI,EAAE;AAElD,QAAI,CAAC,gBAAgB;AACnB,YAAM,IAAI,MAAM,kBAAkB;AAAA,IACpC;AAEA,WAAO,eAAe,GAAG,IAAI;AAAA,EAG/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,cAAc,KAA4B,QAAgB;AAChE,UAAM,iBACJ,KAAK,gBAAgB,GAAG,EAAE,kBAAkB,KAAK;AACnD,WAAO,KAAK,MAAM,SAAS,GAAG,EAAE,MAAM,KAAK;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,cAAc,KAA4B,QAAgB;AAChE,UAAM,mBACJ,KAAK,gBAAgB,GAAG,EAAE,oBAAoB,KAAK;AACrD,UAAM,WAAW,KAAK,MAAM,SAAS,GAAG,EAAE,MAAM,KAAK;AACrD,SAAK,OAAO,CAAC,UAAU;AACrB,UAAI,aAAa,GAAG;AAClB,mBAAW,MAAM,KAAK,kBAAkB,KAAK,MAAM,GAAG,gBAAgB;AAAA,MACxE;AACA,aAAO,OAAO,OAAO;AAAA,QACnB,UAAU;AAAA,UACR,GAAI,MAAM;AAAA,UACV,CAAC,GAAG,GAAG,EAAE,CAAC,MAAM,GAAG,WAAW,EAAE;AAAA,QAClC;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,kBAAkB,KAA4B,QAAgB;AACpE,SAAK,OAAO,CAAC,UAAU;AACrB,aAAO,OAAO,OAAO;AAAA,QACnB,UAAU;AAAA,UACR,GAAI,MAAM;AAAA,UACV,CAAC,GAAG,GAAG,EAAE,CAAC,MAAM,GAAG,EAAE;AAAA,QACvB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./RateLimitController"), exports);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk37GF32BRjs = require('./chunk-37GF32BR.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
exports.RateLimitController = _chunk37GF32BRjs.RateLimitController;
|
|
18
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../types/eth-ens-namehash.d.ts","../../../types/ethereum-ens-network-map.d.ts","../../../types/global.d.ts","../../../types/single-call-balance-checker-abi.d.ts","../../../types/@metamask/contract-metadata.d.ts","../../../types/@metamask/eth-hd-keyring.d.ts","../../../types/@metamask/eth-simple-keyring.d.ts","../../../types/@metamask/ethjs-provider-http.d.ts","../../../types/@metamask/ethjs-unit.d.ts","../../../types/@metamask/metamask-eth-abis.d.ts","../../../types/eth-json-rpc-infura/src/createProvider.d.ts","../../../types/eth-phishing-detect/src/config.json.d.ts","../../../types/eth-phishing-detect/src/detector.d.ts","../../base-controller/dist/types/BaseControllerV1.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct/dist/utils.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../../../node_modules/immer/dist/utils/env.d.ts","../../../node_modules/immer/dist/utils/errors.d.ts","../../../node_modules/immer/dist/types/types-external.d.ts","../../../node_modules/immer/dist/types/types-internal.d.ts","../../../node_modules/immer/dist/utils/common.d.ts","../../../node_modules/immer/dist/utils/plugins.d.ts","../../../node_modules/immer/dist/core/scope.d.ts","../../../node_modules/immer/dist/core/finalize.d.ts","../../../node_modules/immer/dist/core/proxy.d.ts","../../../node_modules/immer/dist/core/immerClass.d.ts","../../../node_modules/immer/dist/core/current.d.ts","../../../node_modules/immer/dist/internal.d.ts","../../../node_modules/immer/dist/plugins/es5.d.ts","../../../node_modules/immer/dist/plugins/patches.d.ts","../../../node_modules/immer/dist/plugins/mapset.d.ts","../../../node_modules/immer/dist/plugins/all.d.ts","../../../node_modules/immer/dist/immer.d.ts","../../base-controller/dist/types/RestrictedControllerMessenger.d.ts","../../base-controller/dist/types/ControllerMessenger.d.ts","../../base-controller/dist/types/BaseControllerV2.d.ts","../../base-controller/dist/types/index.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/RateLimitController.ts","../src/index.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/pretty-format/build/types.d.ts","../../../node_modules/pretty-format/build/index.d.ts","../../../node_modules/jest-diff/build/types.d.ts","../../../node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/jest-diff/build/index.d.ts","../../../node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/@types/jest-when/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/pbkdf2/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@types/secp256k1/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/sinonjs__fake-timers/index.d.ts","../../../node_modules/@types/sinon/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/uuid/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"70bbfaec021ac4a0c805374225b55d70887f987df8b8dd7711d79464bb7b4385","869089d60b67219f63e6aca810284c89bae1b384b5cbc7ce64e53d82ad223ed5",{"version":"18338b6a4b920ec7d49b4ffafcbf0fa8a86b4bfd432966efd722dab611157cf4","affectsGlobalScope":true},"62a0875a0397b35a2364f1d401c0ce17975dfa4d47bf6844de858ae04da349f9","ee7491d0318d1fafcba97d5b72b450eb52671570f7a4ecd9e8898d40eaae9472","e3e7d217d89b380c1f34395eadc9289542851b0f0a64007dfe1fb7cf7423d24e","fd79909e93b4d50fd0ed9f3d39ddf8ba0653290bac25c295aac49f6befbd081b","345a9cc2945406f53051cd0e9b51f82e1e53929848eab046fdda91ee8aa7da31","9debe2de883da37a914e5e784a7be54c201b8f1d783822ad6f443ff409a5ea21","dee5d5c5440cda1f3668f11809a5503c30db0476ad117dd450f7ba5a45300e8f","f5e396c1424c391078c866d6f84afe0b4d2f7f85a160b9c756cd63b5b1775d93","5caa6f4fff16066d377d4e254f6c34c16540da3809cd66cd626a303bc33c419f","730d055528bdf12c8524870bb33d237991be9084c57634e56e5d8075f6605e02","869b0f507115c42896d917642f821752e8a84827bfe9ed74c23d76fb0c64c681","e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","affb9dc7079c3a3522e046c5dc1325950a843b1ebd7dc0f0386aeb2397b9f0db","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","34693fb4a5e771e11668219221344dd1bd7d8b77ed005a1c1d965fb559be8406","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419",{"version":"8c61d5fc50490af59daf69c4e601cc76de260ee5b2ff057d608a78d6acb0b61a","affectsGlobalScope":true},"f51b4042a3ac86f1f707500a9768f88d0b0c1fc3f3e45a73333283dea720cdc6",{"version":"a7289d79eb84a59d2475b4d0136b4404be3cfdd17c3ea46b9194add1d645df01","affectsGlobalScope":true},"0bb26fa2a90ee890eed57ee812c71fa84d3d07850163ec4a204de86412cc57c1","132ca47da601c60141dd6f10bd08c70d0620177e5638439df2464ec3945b6d98",{"version":"55d2bbae076fed7269c3e16faeb32f988f558427b7a1c3bf04aa7551ab86ae90","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb","543c6e3a2353e9ad08b4090e1fb88a95cefb756d0d173b6ec045d7dc70a79964","3a41ebe7f089d50f447466b35b6cabb8b584c0994fc9809d0cd0a4ebc41e1239","f5350b93f10178838c23b3a81f3791d839bc44d1a2a89edb60069250fab90899","aa07f7230bcc5733919c941753d067cb8816dcad6651edb815cb302ae8ddd931","649ba4638a25c54a18dffe37367c6b7848a0bca53fa42fbbd7300b0c61aa861c","5f20d20b7607174caf1a6da9141aeb9f2142159ae2410ca30c7a0fccd1d19c99",{"version":"a34d65f61ec5aac5b53502c8b0bd4e00d217bccb95bf94d449e2571baa11fb8c","affectsGlobalScope":true},"8d42e5af5fb0a96a77e135ce84cc60636c9bad39d9dba043a4efe9d1bdeb3cc3","56fcc451e9065eb121c9cc4c1b9994a816306f3b0b3b1fce7ad59f0ac97a9999","d4a13a5a2e6df8ef02a84ac6fd5bad4a1ec54fdef47f33250da386ea6d5c1864","c3759b5bc5cc40f5988d86a497741a80fa91258629ae50a2b3735e774cd377cc","bf268a0aea37ad4ae3b7a9b58559190b6fc01ea16a31e35cd05817a0a60f895a","45dd82fb5aea9b12b2a90b427b28f3a014e8b2ee9b74087a5ab882841cb5fbc5",{"version":"d7dad6db394a3d9f7b49755e4b610fbf8ed6eb0c9810ae5f1a119f6b5d76de45","affectsGlobalScope":true},"48b2f9302651eb31acd5be69bb4e6b35797a7fcd6b77391d10a4ccadf7dc3609","605bed8af3052e790865a35e3d538a5447764a4ff01989c0f6b084a96f40e1cb","dd67d2b5e4e8a182a38de8e69fb736945eaa4588e0909c14e01a14bd3cc1fd1e",{"version":"2db274de1088f268805043df72e21258eae845e6418dada65331d2898998f330","affectsGlobalScope":true},{"version":"2923dee3c897f03e91b54a210cdbefea7290562f0ac4b948667d4c9ee844b79e","affectsGlobalScope":true},"79169698d09a2be54b14f3bcad2575b414bf3525063fde0a1e4fcd5d6efd380e","051d939bcf77caa3cef3282708ab3a6fdfb741a7366e1d74a9e7603b67417ec3","0be79b3ff0f16b6c2f9bc8c4cc7097ea417d8d67f8267f7e1eec8e32b548c2ff","1c61ffa3a71b77363b30d19832c269ef62fba787f5610cac7254728d3b69ab2e","f6877afc4b9d0b72e15378b187492a6547e48783980e9ff1301163b7b1c15b2e","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","09ed02a725db002693236b6dfc49b2c6eb5557be1421d7fbe4f07cfe38211d92","09d801ff4a303d4976d4b9cb94af3a9097c4a70345e662d176975872d2998e51","c8558b01389b5f7610ac293aa612ccea2ae64d83af43b49f8142f190be1f414c","c40fdf7b2e18df49ce0568e37f0292c12807a0748be79e272745e7216bed2606",{"version":"b10b426c56e220b5093bf8a2446ee47af47263b7b1a03f4b18e42326b231b111","affectsGlobalScope":true},"4e228e78c1e9b0a75c70588d59288f63a6258e8b1fe4a67b0c53fe03461421d9","b4635ef36bee17e1304337d591c3b6b461ecdbc1876d0effbe6a581e62201fe5","205d50c24359ead003dc537b9b65d2a64208dfdffe368f403cf9e0357831db9e","1265fddcd0c68be9d2a3b29805d0280484c961264dd95e0b675f7bd91f777e78",{"version":"e4507242542bd499238f693d88b2d32e22177cc508854625f87bcc9bc3fa1256","affectsGlobalScope":true},{"version":"d942354e4966a98d3a92d1b1af0b4ac06f33af3f88116743e2c304c027ca26ef","affectsGlobalScope":true},"39f0808e5be3cb38674726c21fe2eb453c55e48a901679b4ce30fef85549b892","6afd66a7432ef100027ea110449e874196381e019e30eda7e7d8ca390366b7a8","befb8a9a78ac99d8fbc3ed392810489a7b90760c7a58934e8f1c8538f581cff3","e670bdf01540d35c170fae68edfd2f288eff909936780c379d6a9103b787b22c","867f95abf1df444aab146b19847391fc2f922a55f6a970a27ed8226766cee29f",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"e3685a8957b4e2af64c3f04a58289ee0858a649dbcd963a2b897fe85858ae18a","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","93b7325b49dfbf613d940ed0e471216657b2d77459dac34f1b5b1678f08f884c","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","3140d587067e55ce4028275cf71b40a3fd431863ad148efc3106af84a0794cf9","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f","4df0891b133884cd9ed752d31c7d0ec0a09234e9ed5394abffd3c660761598db","b603b62d3dcd31ef757dc7339b4fa8acdbca318b0fb9ac485f9a1351955615f9","e642bd47b75ad6b53cbf0dfd7ddfa0f120bd10193f0c58ec37d87b59bf604aca","be90b24d2ee6f875ce3aaa482e7c41a54278856b03d04212681c4032df62baf9","78f5ff400b3cb37e7b90eef1ff311253ed31c8cb66505e9828fad099bffde021","372c47090e1131305d163469a895ff2938f33fa73aad988df31cd31743f9efb6","71c67dc6987bdbd5599353f90009ff825dd7db0450ef9a0aee5bb0c574d18512","6f12403b5eca6ae7ca8e3efe3eeb9c683b06ce3e3844ccfd04098d83cd7e4957","282c535df88175d64d9df4550d2fd1176fd940c1c6822f1e7584003237f179d3","c3a4752cf103e4c6034d5bd449c8f9d5e7b352d22a5f8f9a41a8efb11646f9c2","11a9e38611ac3c77c74240c58b6bd64a0032128b29354e999650f1de1e034b1c","4ed103ca6fff9cb244f7c4b86d1eb28ce8069c32db720784329946731badb5bb","d738f282842970e058672663311c6875482ee36607c88b98ffb6604fba99cb2a","ec859cd8226aa623e41bbb47c249a55ee16dc1b8647359585244d57d3a5ed0c7","8891c6e959d253a66434ff5dc9ae46058fb3493e84b4ca39f710ef2d350656b1","c4463cf02535444dcbc3e67ecd29f1972490f74e49957d6fd4282a1013796ba6","0cb0a957ff02de0b25fd0f3f37130ca7f22d1e0dea256569c714c1f73c6791f8","2f5075dc512d51786b1ba3b1696565641dfaae3ac854f5f13d61fa12ef81a47e","55fcfa6909a227963d5ad3d59ea9f99480106ebd9c69d87fce8a66f8f66e23c3","9000ad4e052d27b695eb893a3e5627ce8c51441eda73cf3482652fe6ea965064","45351e0d51780b6f4088277a4457b9879506ee2720a887de232df0f1efcb33d8","9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"e27f091d052a1650f0e7880c50e072261d47615396fec2e76ef021a2084d935a","signature":"8e66ab4c79d1836c4cc00f64910c9cadc6461a5f190810dc68698b0f250c38d9"},{"version":"6889a9fa5a1cda3eff8fb21d030b2eb3e2078d21813840e8c3737b583b7b7fac","signature":"2760c52da7d0ed79057fdfc52dd1b9ea9f608cab9972555e034ca60b6a015806"},"a5aaeca001d2f69093d04aac4db321e4c338fd9b20cbc4f0b0af3dc6ae0f235b","cc957354aa3c94c9961ebf46282cfde1e81d107fc5785a61f62c67f1dd3ac2eb","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","93de1c6dab503f053efe8d304cb522bb3a89feab8c98f307a674a4fae04773e9","29a46d003ca3c721e6405f00dee7e3de91b14e09701eba5d887bf76fb2d47d38","069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","df95e00612c1faa5e0e7ef0dba589b18665bbeb3221db2b6cee1fe4d0e61921f","afe73051ff6a03a9565cbd8ebb0e956ee3df5e913ad5c1ded64218aabfa3dcb5","8b06ac3faeacb8484d84ddb44571d8f410697f98d7bfa86c0fda60373a9f5215","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","f5638f7c2f12a9a1a57b5c41b3c1ea7db3876c003bab68e6a57afd6bcc169af0","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"ccfd8774cd9b929f63ff7dcf657977eb0652e3547f1fcac1b3a1dc5db22d4d58","affectsGlobalScope":true},"d92dc90fecd2552db74d8dc3c6fb4db9145b2aa0efe2c127236ba035969068d4","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","19c816167e076e7c24f074389c6cf3ed87bdbb917d1ea439ca281f9d26db2439","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","a73a445c1e0a6d0f8b48e8eb22dc9d647896783a7f8991cbbc31c0d94bf1f5a2","d88a5e779faf033be3d52142a04fbe1cb96009868e3bbdd296b2bc6c59e06c0e","cd1d2f103b79002cd94b85a640a103f094227a2c4c53bc8af1fdbf4e13d9729e","5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","3dce33e7eb25594863b8e615f14a45ab98190d85953436750644212d8a18c066","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","f83b320cceccfc48457a818d18fc9a006ab18d0bdd727aa2c2e73dc1b4a45e98","9d92b037978bb9525bc4b673ebddd443277542e010c0aef019c03a170ccdaa73","b0d10e46cfe3f6c476b69af02eaa38e4ccc7430221ce3109ae84bb9fb8282298","fab58e600970e66547644a44bc9918e3223aa2cbd9e8763cec004b2cfb48827e","70e9a18da08294f75bf23e46c7d69e67634c0765d355887b9b41f0d959e1426e","ed44ba6b95f08b758748be7902e0cc54178b1337c56d0e2469c77b03f63ac73b"],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"module":1,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7},"fileIdsList":[[119,194],[119],[90,119,126,127,128,143],[119,127,128,144,145],[119,126,127],[119,126,143,146,149],[119,126,146,149,150],[119,147,148,149,151,152],[119,126,149],[119,126,143,146,147,148,151],[119,126,134],[119,126],[90,119,126],[79,119,126],[119,130,131,132,133,134,135,136,137,138,139,140,141,142],[119,126,132,133],[119,126,132,134],[119,165,187],[119,187,188],[119,187,188,189,190],[119,165],[63,119],[66,119],[63,66,119],[64,65,66,67,68,69,70,71,72,73,74,119,154,157,158,159,160,161,162,163,164],[57,63,64,119],[66,72,74,119,153],[119,156],[66,67,119],[63,119,160],[119,194,195,196,197,198],[119,194,196],[119,155],[119,202,203,204],[91,119,126],[119,207],[119,208],[119,219],[119,213,218],[119,222,224,225,226,227,228,229,230,231,232,233,234],[119,222,223,225,226,227,228,229,230,231,232,233,234],[119,223,224,225,226,227,228,229,230,231,232,233,234],[119,222,223,224,226,227,228,229,230,231,232,233,234],[119,222,223,224,225,227,228,229,230,231,232,233,234],[119,222,223,224,225,226,228,229,230,231,232,233,234],[119,222,223,224,225,226,227,229,230,231,232,233,234],[119,222,223,224,225,226,227,228,230,231,232,233,234],[119,222,223,224,225,226,227,228,229,231,232,233,234],[119,222,223,224,225,226,227,228,229,230,232,233,234],[119,222,223,224,225,226,227,228,229,230,231,233,234],[119,222,223,224,225,226,227,228,229,230,231,232,234],[119,222,223,224,225,226,227,228,229,230,231,232,233],[75,119],[78,119],[79,84,110,119],[80,90,91,98,107,118,119],[80,81,90,98,119],[82,119],[83,84,91,99,119],[84,107,115,119],[85,87,90,98,119],[86,119],[87,88,119],[89,90,119],[90,119],[90,91,92,107,118,119],[90,91,92,107,119],[93,98,107,118,119],[90,91,93,94,98,107,115,118,119],[93,95,107,115,118,119],[75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],[90,96,119],[97,118,119,123],[87,90,98,107,119],[99,119],[100,119],[78,101,119],[102,117,119,123],[103,119],[104,119],[90,105,119],[105,106,119,121],[79,90,107,108,109,119],[79,107,109,119],[107,108,119],[110,119],[111,119],[90,113,114,119],[113,114,119],[84,98,115,119],[116,119],[98,117,119],[79,93,104,118,119],[84,119],[107,119,120],[119,121],[119,122],[79,84,90,92,101,107,118,119,121,123],[107,119,124],[119,126,240],[119,243,282],[119,243,267,282],[119,282],[119,243],[119,243,268,282],[119,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281],[119,268,282],[119,283],[119,287],[119,177],[119,177,178,179,180,181],[119,166,167,168,169,170,171,172,173,174,175,176],[119,211,214],[119,211,214,215,216],[119,213],[119,210,217],[119,212],[56,58,59,60,61,62,119],[56,57,119],[58,119],[57,58,119],[56,58,119],[119,165,182,183,184],[119,183],[119,184],[55,119,183,184,185],[119,165,186,191],[119,192],[186],[192]],"referencedMap":[[196,1],[194,2],[144,3],[127,2],[146,4],[128,5],[145,2],[150,6],[151,7],[147,7],[153,8],[148,7],[152,9],[149,10],[135,11],[132,12],[139,13],[133,11],[130,14],[138,2],[143,15],[140,2],[141,2],[142,2],[137,12],[134,16],[131,2],[136,17],[188,18],[190,2],[189,19],[191,20],[187,21],[64,22],[65,22],[67,23],[68,22],[69,22],[70,24],[71,2],[72,2],[73,2],[66,22],[165,25],[74,26],[154,27],[157,28],[158,2],[159,2],[160,2],[161,2],[162,2],[163,29],[164,30],[199,31],[195,1],[197,32],[198,1],[200,12],[156,33],[201,2],[202,2],[205,34],[203,2],[206,35],[207,2],[208,36],[209,37],[220,38],[219,39],[204,2],[221,2],[223,40],[224,41],[222,42],[225,43],[226,44],[227,45],[228,46],[229,47],[230,48],[231,49],[232,50],[233,51],[234,52],[235,2],[155,2],[75,53],[76,53],[78,54],[79,55],[80,56],[81,57],[82,58],[83,59],[84,60],[85,61],[86,62],[87,63],[88,63],[89,64],[90,65],[91,66],[92,67],[77,2],[125,2],[93,68],[94,69],[95,70],[126,71],[96,72],[97,73],[98,74],[99,75],[100,76],[101,77],[102,78],[103,79],[104,80],[105,81],[106,82],[107,83],[109,84],[108,85],[110,86],[111,87],[112,2],[113,88],[114,89],[115,90],[116,91],[117,92],[118,93],[119,94],[120,95],[121,96],[122,97],[123,98],[124,99],[236,2],[237,12],[238,2],[239,2],[241,100],[240,2],[242,12],[267,101],[268,102],[243,103],[246,103],[265,101],[266,101],[256,101],[255,104],[253,101],[248,101],[261,101],[259,101],[263,101],[247,101],[260,101],[264,101],[249,101],[250,101],[262,101],[244,101],[251,101],[252,101],[254,101],[258,101],[269,105],[257,101],[245,101],[282,106],[281,2],[276,105],[278,107],[277,105],[270,105],[271,105],[273,105],[275,105],[279,107],[280,107],[272,107],[274,107],[284,108],[283,2],[285,2],[286,2],[287,2],[288,109],[129,2],[210,2],[176,2],[173,110],[175,110],[174,110],[172,110],[182,111],[177,112],[181,2],[178,2],[180,2],[179,2],[168,110],[169,110],[170,110],[166,2],[167,2],[171,110],[211,2],[215,113],[217,114],[216,113],[214,115],[218,116],[213,117],[212,2],[56,2],[63,118],[58,119],[59,120],[60,120],[61,121],[62,121],[57,122],[8,2],[10,2],[9,2],[2,2],[11,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[3,2],[4,2],[22,2],[19,2],[20,2],[21,2],[23,2],[24,2],[25,2],[5,2],[26,2],[27,2],[28,2],[29,2],[6,2],[30,2],[31,2],[32,2],[33,2],[7,2],[34,2],[39,2],[40,2],[35,2],[36,2],[37,2],[38,2],[1,2],[41,2],[55,2],[185,123],[184,124],[183,125],[186,126],[192,127],[193,128],[46,2],[47,2],[48,2],[49,2],[50,2],[51,2],[42,2],[52,2],[53,2],[54,2],[43,2],[44,2],[45,2]],"exportedModulesMap":[[196,1],[194,2],[144,3],[127,2],[146,4],[128,5],[145,2],[150,6],[151,7],[147,7],[153,8],[148,7],[152,9],[149,10],[135,11],[132,12],[139,13],[133,11],[130,14],[138,2],[143,15],[140,2],[141,2],[142,2],[137,12],[134,16],[131,2],[136,17],[188,18],[190,2],[189,19],[191,20],[187,21],[64,22],[65,22],[67,23],[68,22],[69,22],[70,24],[71,2],[72,2],[73,2],[66,22],[165,25],[74,26],[154,27],[157,28],[158,2],[159,2],[160,2],[161,2],[162,2],[163,29],[164,30],[199,31],[195,1],[197,32],[198,1],[200,12],[156,33],[201,2],[202,2],[205,34],[203,2],[206,35],[207,2],[208,36],[209,37],[220,38],[219,39],[204,2],[221,2],[223,40],[224,41],[222,42],[225,43],[226,44],[227,45],[228,46],[229,47],[230,48],[231,49],[232,50],[233,51],[234,52],[235,2],[155,2],[75,53],[76,53],[78,54],[79,55],[80,56],[81,57],[82,58],[83,59],[84,60],[85,61],[86,62],[87,63],[88,63],[89,64],[90,65],[91,66],[92,67],[77,2],[125,2],[93,68],[94,69],[95,70],[126,71],[96,72],[97,73],[98,74],[99,75],[100,76],[101,77],[102,78],[103,79],[104,80],[105,81],[106,82],[107,83],[109,84],[108,85],[110,86],[111,87],[112,2],[113,88],[114,89],[115,90],[116,91],[117,92],[118,93],[119,94],[120,95],[121,96],[122,97],[123,98],[124,99],[236,2],[237,12],[238,2],[239,2],[241,100],[240,2],[242,12],[267,101],[268,102],[243,103],[246,103],[265,101],[266,101],[256,101],[255,104],[253,101],[248,101],[261,101],[259,101],[263,101],[247,101],[260,101],[264,101],[249,101],[250,101],[262,101],[244,101],[251,101],[252,101],[254,101],[258,101],[269,105],[257,101],[245,101],[282,106],[281,2],[276,105],[278,107],[277,105],[270,105],[271,105],[273,105],[275,105],[279,107],[280,107],[272,107],[274,107],[284,108],[283,2],[285,2],[286,2],[287,2],[288,109],[129,2],[210,2],[176,2],[173,110],[175,110],[174,110],[172,110],[182,111],[177,112],[181,2],[178,2],[180,2],[179,2],[168,110],[169,110],[170,110],[166,2],[167,2],[171,110],[211,2],[215,113],[217,114],[216,113],[214,115],[218,116],[213,117],[212,2],[56,2],[63,118],[58,119],[59,120],[60,120],[61,121],[62,121],[57,122],[8,2],[10,2],[9,2],[2,2],[11,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[3,2],[4,2],[22,2],[19,2],[20,2],[21,2],[23,2],[24,2],[25,2],[5,2],[26,2],[27,2],[28,2],[29,2],[6,2],[30,2],[31,2],[32,2],[33,2],[7,2],[34,2],[39,2],[40,2],[35,2],[36,2],[37,2],[38,2],[1,2],[41,2],[55,2],[185,123],[184,124],[183,125],[186,126],[192,129],[193,130],[46,2],[47,2],[48,2],[49,2],[50,2],[51,2],[42,2],[52,2],[53,2],[54,2],[43,2],[44,2],[45,2]],"semanticDiagnosticsPerFile":[196,194,144,127,146,128,145,150,151,147,153,148,152,149,135,132,139,133,130,138,143,140,141,142,137,134,131,136,188,190,189,191,187,64,65,67,68,69,70,71,72,73,66,165,74,154,157,158,159,160,161,162,163,164,199,195,197,198,200,156,201,202,205,203,206,207,208,209,220,219,204,221,223,224,222,225,226,227,228,229,230,231,232,233,234,235,155,75,76,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,77,125,93,94,95,126,96,97,98,99,100,101,102,103,104,105,106,107,109,108,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,236,237,238,239,241,240,242,267,268,243,246,265,266,256,255,253,248,261,259,263,247,260,264,249,250,262,244,251,252,254,258,269,257,245,282,281,276,278,277,270,271,273,275,279,280,272,274,284,283,285,286,287,288,129,210,176,173,175,174,172,182,177,181,178,180,179,168,169,170,166,167,171,211,215,217,216,214,218,213,212,56,63,58,59,60,61,62,57,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,34,39,40,35,36,37,38,1,41,55,185,184,183,186,192,193,46,47,48,49,50,51,42,52,53,54,43,44,45],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ActionConstraint, RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
|
|
2
2
|
import { BaseController } from '@metamask/base-controller';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* A rate-limited API endpoint.
|
|
5
5
|
* @property method - The method that is rate-limited.
|
|
6
6
|
* @property rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
7
7
|
* @property rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
@@ -12,26 +12,36 @@ export declare type RateLimitedApi = {
|
|
|
12
12
|
rateLimitCount?: number;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @property requests - Object containing number of requests in a given interval for each origin and api type combination
|
|
15
|
+
* A map of rate-limited API types to APIs.
|
|
17
16
|
*/
|
|
18
|
-
export declare type
|
|
19
|
-
|
|
17
|
+
export declare type RateLimitedApiMap = Record<string, RateLimitedApi>;
|
|
18
|
+
/**
|
|
19
|
+
* A map of rate-limited API types to the number of requests made in a given interval for each origin and api type combination.
|
|
20
|
+
* @template RateLimitedApis - A {@link RateLimitedApiMap} containing the rate-limited API endpoints that is used by the {@link RateLimitController}.
|
|
21
|
+
*/
|
|
22
|
+
export declare type RateLimitedRequests<RateLimitedApis extends RateLimitedApiMap> = Record<keyof RateLimitedApis, Record<string, number>>;
|
|
23
|
+
/**
|
|
24
|
+
* The state of the {@link RateLimitController}.
|
|
25
|
+
* @template RateLimitedApis - A {@link RateLimitedApiMap} containing the rate-limited API endpoints that is used by the {@link RateLimitController}.
|
|
26
|
+
* @property requests - An object containing the number of requests made in a given interval for each origin and api type combination.
|
|
27
|
+
*/
|
|
28
|
+
export declare type RateLimitState<RateLimitedApis extends RateLimitedApiMap> = {
|
|
29
|
+
requests: RateLimitedRequests<RateLimitedApis>;
|
|
20
30
|
};
|
|
21
31
|
declare const name = "RateLimitController";
|
|
22
|
-
export declare type
|
|
23
|
-
export declare type
|
|
24
|
-
export declare type
|
|
32
|
+
export declare type RateLimitControllerStateChangeEvent<RateLimitedApis extends RateLimitedApiMap> = ControllerStateChangeEvent<typeof name, RateLimitState<RateLimitedApis>>;
|
|
33
|
+
export declare type RateLimitControllerGetStateAction<RateLimitedApis extends RateLimitedApiMap> = ControllerGetStateAction<typeof name, RateLimitState<RateLimitedApis>>;
|
|
34
|
+
export declare type RateLimitControllerCallApiAction<RateLimitedApis extends RateLimitedApiMap> = {
|
|
25
35
|
type: `${typeof name}:call`;
|
|
26
36
|
handler: RateLimitController<RateLimitedApis>['call'];
|
|
27
37
|
};
|
|
28
|
-
export declare type RateLimitControllerActions<RateLimitedApis extends
|
|
29
|
-
export declare type RateLimitControllerEvents<RateLimitedApis extends
|
|
30
|
-
export declare type RateLimitMessenger<RateLimitedApis extends
|
|
38
|
+
export declare type RateLimitControllerActions<RateLimitedApis extends RateLimitedApiMap> = RateLimitControllerGetStateAction<RateLimitedApis> | RateLimitControllerCallApiAction<RateLimitedApis>;
|
|
39
|
+
export declare type RateLimitControllerEvents<RateLimitedApis extends RateLimitedApiMap> = RateLimitControllerStateChangeEvent<RateLimitedApis>;
|
|
40
|
+
export declare type RateLimitMessenger<RateLimitedApis extends RateLimitedApiMap> = RestrictedControllerMessenger<typeof name, RateLimitControllerActions<RateLimitedApis>, RateLimitControllerEvents<RateLimitedApis>, never, never>;
|
|
31
41
|
/**
|
|
32
42
|
* Controller with logic for rate-limiting API endpoints per requesting origin.
|
|
33
43
|
*/
|
|
34
|
-
export declare class RateLimitController<RateLimitedApis extends
|
|
44
|
+
export declare class RateLimitController<RateLimitedApis extends RateLimitedApiMap> extends BaseController<typeof name, RateLimitState<RateLimitedApis>, RateLimitMessenger<RateLimitedApis>> {
|
|
35
45
|
private readonly implementations;
|
|
36
46
|
private readonly rateLimitTimeout;
|
|
37
47
|
private readonly rateLimitCount;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimitController.d.ts","sourceRoot":"","sources":["../../src/RateLimitController.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { RateLimitedApi, RateLimitedApiMap, RateLimitedRequests, RateLimitControllerActions, RateLimitControllerCallApiAction, RateLimitControllerGetStateAction, RateLimitControllerEvents, RateLimitControllerStateChangeEvent, RateLimitMessenger, RateLimitState, } from './RateLimitController';
|
|
2
|
+
export { RateLimitController } from './RateLimitController';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,EACzB,mCAAmC,EACnC,kBAAkB,EAClB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/rate-limit-controller",
|
|
3
|
-
"version": "4.0.2-preview.
|
|
3
|
+
"version": "4.0.2-preview.eb2135e",
|
|
4
4
|
"description": "Contains logic for rate-limiting API endpoints by requesting origin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -15,12 +15,22 @@
|
|
|
15
15
|
"url": "https://github.com/MetaMask/core.git"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"require": "./dist/index.js",
|
|
23
|
+
"types": "./dist/types/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
18
27
|
"main": "./dist/index.js",
|
|
19
28
|
"types": "./dist/index.d.ts",
|
|
20
29
|
"files": [
|
|
21
30
|
"dist/"
|
|
22
31
|
],
|
|
23
32
|
"scripts": {
|
|
33
|
+
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
|
|
24
34
|
"build:docs": "typedoc",
|
|
25
35
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/rate-limit-controller",
|
|
26
36
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/rate-limit-controller",
|
|
@@ -32,7 +42,8 @@
|
|
|
32
42
|
},
|
|
33
43
|
"dependencies": {
|
|
34
44
|
"@metamask/base-controller": "^4.1.1",
|
|
35
|
-
"@metamask/rpc-errors": "^6.1
|
|
45
|
+
"@metamask/rpc-errors": "^6.2.1",
|
|
46
|
+
"@metamask/utils": "^8.3.0"
|
|
36
47
|
},
|
|
37
48
|
"devDependencies": {
|
|
38
49
|
"@metamask/auto-changelog": "^3.4.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RateLimitController.d.ts","sourceRoot":"","sources":["../src/RateLimitController.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|