@metamask-previews/rate-limit-controller 6.0.0-preview-9edcf0e0 → 6.0.0-preview-cf09c0a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RateLimitController.cjs +112 -0
- package/dist/RateLimitController.cjs.map +1 -0
- package/dist/{types/RateLimitController.d.ts → RateLimitController.d.cts} +3 -3
- package/dist/RateLimitController.d.cts.map +1 -0
- package/dist/RateLimitController.d.mts +97 -0
- package/dist/RateLimitController.d.mts.map +1 -0
- package/dist/RateLimitController.mjs +106 -5
- package/dist/RateLimitController.mjs.map +1 -1
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{types/index.d.ts → index.d.cts} +3 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -7
- package/dist/RateLimitController.js +0 -7
- package/dist/RateLimitController.js.map +0 -1
- package/dist/chunk-S5DUNUFB.js +0 -119
- package/dist/chunk-S5DUNUFB.js.map +0 -1
- package/dist/chunk-ZXHKQHU4.mjs +0 -119
- package/dist/chunk-ZXHKQHU4.mjs.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/RateLimitController.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RateLimitController = void 0;
|
|
4
|
+
const base_controller_1 = require("@metamask/base-controller");
|
|
5
|
+
const rpc_errors_1 = require("@metamask/rpc-errors");
|
|
6
|
+
const utils_1 = require("@metamask/utils");
|
|
7
|
+
const name = 'RateLimitController';
|
|
8
|
+
const metadata = {
|
|
9
|
+
requests: { persist: false, anonymous: false },
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Controller with logic for rate-limiting API endpoints per requesting origin.
|
|
13
|
+
*/
|
|
14
|
+
class RateLimitController extends base_controller_1.BaseController {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a RateLimitController instance.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Constructor options.
|
|
19
|
+
* @param options.messenger - A reference to the messaging system.
|
|
20
|
+
* @param options.state - Initial state to set on this controller.
|
|
21
|
+
* @param options.implementations - Mapping from API type to API implementation.
|
|
22
|
+
* @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
23
|
+
* @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
24
|
+
*/
|
|
25
|
+
constructor({ rateLimitTimeout = 5000, rateLimitCount = 1, messenger, state, implementations, }) {
|
|
26
|
+
const defaultState = {
|
|
27
|
+
requests: (0, utils_1.getKnownPropertyNames)(implementations).reduce((acc, key) => ({ ...acc, [key]: {} }), {}),
|
|
28
|
+
};
|
|
29
|
+
super({
|
|
30
|
+
name,
|
|
31
|
+
metadata,
|
|
32
|
+
messenger,
|
|
33
|
+
state: { ...defaultState, ...state },
|
|
34
|
+
});
|
|
35
|
+
this.implementations = implementations;
|
|
36
|
+
this.rateLimitTimeout = rateLimitTimeout;
|
|
37
|
+
this.rateLimitCount = rateLimitCount;
|
|
38
|
+
this.messagingSystem.registerActionHandler(`${name}:call`, (origin, type, ...args) => this.call(origin, type, ...args));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Calls an API if the requesting origin is not rate-limited.
|
|
42
|
+
*
|
|
43
|
+
* @param origin - The requesting origin.
|
|
44
|
+
* @param type - The type of API call to make.
|
|
45
|
+
* @param args - Arguments for the API call.
|
|
46
|
+
*/
|
|
47
|
+
async call(origin, type, ...args) {
|
|
48
|
+
if (this.isRateLimited(type, origin)) {
|
|
49
|
+
throw rpc_errors_1.rpcErrors.limitExceeded({
|
|
50
|
+
message: `"${type.toString()}" is currently rate-limited. Please try again later.`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
this.recordRequest(type, origin);
|
|
54
|
+
const implementation = this.implementations[type].method;
|
|
55
|
+
if (!implementation) {
|
|
56
|
+
throw new Error('Invalid api type');
|
|
57
|
+
}
|
|
58
|
+
return implementation(...args);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks whether an origin is rate limited for the a specific API.
|
|
62
|
+
*
|
|
63
|
+
* @param api - The API the origin is trying to access.
|
|
64
|
+
* @param origin - The origin trying to access the API.
|
|
65
|
+
* @returns `true` if rate-limited, and `false` otherwise.
|
|
66
|
+
*/
|
|
67
|
+
isRateLimited(api, origin) {
|
|
68
|
+
const rateLimitCount = this.implementations[api].rateLimitCount ?? this.rateLimitCount;
|
|
69
|
+
return this.state.requests[api][origin] >= rateLimitCount;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Records that an origin has made a request to call an API, for rate-limiting purposes.
|
|
73
|
+
*
|
|
74
|
+
* @param api - The API the origin is trying to access.
|
|
75
|
+
* @param origin - The origin trying to access the API.
|
|
76
|
+
*/
|
|
77
|
+
recordRequest(api, origin) {
|
|
78
|
+
const rateLimitTimeout = this.implementations[api].rateLimitTimeout ?? this.rateLimitTimeout;
|
|
79
|
+
const previous = this.state.requests[api][origin] ?? 0;
|
|
80
|
+
this.update((state) => {
|
|
81
|
+
if (previous === 0) {
|
|
82
|
+
setTimeout(() => this.resetRequestCount(api, origin), rateLimitTimeout);
|
|
83
|
+
}
|
|
84
|
+
Object.assign(state, {
|
|
85
|
+
requests: {
|
|
86
|
+
...state.requests,
|
|
87
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
89
|
+
[api]: { [origin]: previous + 1 },
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
96
|
+
*
|
|
97
|
+
* @param api - The API in question.
|
|
98
|
+
* @param origin - The origin in question.
|
|
99
|
+
*/
|
|
100
|
+
resetRequestCount(api, origin) {
|
|
101
|
+
this.update((state) => {
|
|
102
|
+
Object.assign(state, {
|
|
103
|
+
requests: {
|
|
104
|
+
...state.requests,
|
|
105
|
+
[api]: { [origin]: 0 },
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.RateLimitController = RateLimitController;
|
|
112
|
+
//# sourceMappingURL=RateLimitController.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimitController.cjs","sourceRoot":"","sources":["../src/RateLimitController.ts"],"names":[],"mappings":";;;AAMA,+DAA2D;AAC3D,qDAAiD;AACjD,2CAAwD;AAmCxD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAoCnC,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAa,mBAEX,SAAQ,gCAIT;IAOC;;;;;;;;;OASG;IACH,YAAY,EACV,gBAAgB,GAAG,IAAI,EACvB,cAAc,GAAG,CAAC,EAClB,SAAS,EACT,KAAK,EACL,eAAe,GAOhB;QACC,MAAM,YAAY,GAAG;YACnB,QAAQ,EAAE,IAAA,6BAAqB,EAAC,eAAe,CAAC,CAAC,MAAM,CAErD,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAW,CAAC;SACtD,CAAC;QACF,KAAK,CAAC;YACJ,IAAI;YACJ,QAAQ;YACR,SAAS;YACT,KAAK,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,EAAE;SACrC,CA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QAC9D,MAAM,gBAAgB,GACpB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC;QACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,IAAI,QAAQ,KAAK,CAAC,EAAE;gBAClB,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB,CAAC,CAAC;aACzE;YACD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;gBACnB,QAAQ,EAAE;oBACR,GAAI,KAAK,CAAC,QAAiD;oBAC3D,gFAAgF;oBAChF,qEAAqE;oBACrE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,CAAC,EAAE;iBAClC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,GAA0B,EAAE,MAAc;QAClE,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;gBACnB,QAAQ,EAAE;oBACR,GAAI,KAAK,CAAC,QAAiD;oBAC3D,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;iBACvB;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjJD,kDAiJC","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 as (\n ...args: Parameters<RateLimitedApis[ApiType]['method']>\n ) => ReturnType<RateLimitedApis[ApiType]['method']>;\n\n if (!implementation) {\n throw new Error('Invalid api type');\n }\n\n return implementation(...args);\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 // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ActionConstraint, RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from
|
|
2
|
-
import { BaseController } from
|
|
1
|
+
import type { ActionConstraint, RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
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.
|
|
@@ -94,4 +94,4 @@ export declare class RateLimitController<RateLimitedApis extends RateLimitedApiM
|
|
|
94
94
|
private resetRequestCount;
|
|
95
95
|
}
|
|
96
96
|
export {};
|
|
97
|
-
//# sourceMappingURL=RateLimitController.d.
|
|
97
|
+
//# sourceMappingURL=RateLimitController.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimitController.d.cts","sourceRoot":"","sources":["../src/RateLimitController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAI3D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,eAAe,SAAS,iBAAiB,IACvE,MAAM,CAAC,MAAM,eAAe,EAAE,MAAM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C,CACpC;IACC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;IAEjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAElC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAEhC;;;;;;;;;OASG;gBACS,EACV,gBAAuB,EACvB,cAAkB,EAClB,SAAS,EACT,KAAK,EACL,eAAe,GAChB,EAAE;QACD,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAC/C,KAAK,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;QACjD,eAAe,EAAE,eAAe,CAAC;KAClC;IA0BD;;;;;;OAMG;IACG,IAAI,CAAC,OAAO,SAAS,MAAM,eAAe,EAC9C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,GAAG,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,GACtD,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAmB1D;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAMrB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAmBrB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CAU1B"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ActionConstraint, RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
2
|
+
import { BaseController } from "@metamask/base-controller";
|
|
3
|
+
/**
|
|
4
|
+
* A rate-limited API endpoint.
|
|
5
|
+
* @property method - The method that is rate-limited.
|
|
6
|
+
* @property rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
7
|
+
* @property rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
8
|
+
*/
|
|
9
|
+
export type RateLimitedApi = {
|
|
10
|
+
method: ActionConstraint['handler'];
|
|
11
|
+
rateLimitTimeout?: number;
|
|
12
|
+
rateLimitCount?: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A map of rate-limited API types to APIs.
|
|
16
|
+
*/
|
|
17
|
+
export 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 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 type RateLimitState<RateLimitedApis extends RateLimitedApiMap> = {
|
|
29
|
+
requests: RateLimitedRequests<RateLimitedApis>;
|
|
30
|
+
};
|
|
31
|
+
declare const name = "RateLimitController";
|
|
32
|
+
export type RateLimitControllerStateChangeEvent<RateLimitedApis extends RateLimitedApiMap> = ControllerStateChangeEvent<typeof name, RateLimitState<RateLimitedApis>>;
|
|
33
|
+
export type RateLimitControllerGetStateAction<RateLimitedApis extends RateLimitedApiMap> = ControllerGetStateAction<typeof name, RateLimitState<RateLimitedApis>>;
|
|
34
|
+
export type RateLimitControllerCallApiAction<RateLimitedApis extends RateLimitedApiMap> = {
|
|
35
|
+
type: `${typeof name}:call`;
|
|
36
|
+
handler: RateLimitController<RateLimitedApis>['call'];
|
|
37
|
+
};
|
|
38
|
+
export type RateLimitControllerActions<RateLimitedApis extends RateLimitedApiMap> = RateLimitControllerGetStateAction<RateLimitedApis> | RateLimitControllerCallApiAction<RateLimitedApis>;
|
|
39
|
+
export type RateLimitControllerEvents<RateLimitedApis extends RateLimitedApiMap> = RateLimitControllerStateChangeEvent<RateLimitedApis>;
|
|
40
|
+
export type RateLimitMessenger<RateLimitedApis extends RateLimitedApiMap> = RestrictedControllerMessenger<typeof name, RateLimitControllerActions<RateLimitedApis>, RateLimitControllerEvents<RateLimitedApis>, never, never>;
|
|
41
|
+
/**
|
|
42
|
+
* Controller with logic for rate-limiting API endpoints per requesting origin.
|
|
43
|
+
*/
|
|
44
|
+
export declare class RateLimitController<RateLimitedApis extends RateLimitedApiMap> extends BaseController<typeof name, RateLimitState<RateLimitedApis>, RateLimitMessenger<RateLimitedApis>> {
|
|
45
|
+
private readonly implementations;
|
|
46
|
+
private readonly rateLimitTimeout;
|
|
47
|
+
private readonly rateLimitCount;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a RateLimitController instance.
|
|
50
|
+
*
|
|
51
|
+
* @param options - Constructor options.
|
|
52
|
+
* @param options.messenger - A reference to the messaging system.
|
|
53
|
+
* @param options.state - Initial state to set on this controller.
|
|
54
|
+
* @param options.implementations - Mapping from API type to API implementation.
|
|
55
|
+
* @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
56
|
+
* @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
57
|
+
*/
|
|
58
|
+
constructor({ rateLimitTimeout, rateLimitCount, messenger, state, implementations, }: {
|
|
59
|
+
rateLimitTimeout?: number;
|
|
60
|
+
rateLimitCount?: number;
|
|
61
|
+
messenger: RateLimitMessenger<RateLimitedApis>;
|
|
62
|
+
state?: Partial<RateLimitState<RateLimitedApis>>;
|
|
63
|
+
implementations: RateLimitedApis;
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Calls an API if the requesting origin is not rate-limited.
|
|
67
|
+
*
|
|
68
|
+
* @param origin - The requesting origin.
|
|
69
|
+
* @param type - The type of API call to make.
|
|
70
|
+
* @param args - Arguments for the API call.
|
|
71
|
+
*/
|
|
72
|
+
call<ApiType extends keyof RateLimitedApis>(origin: string, type: ApiType, ...args: Parameters<RateLimitedApis[ApiType]['method']>): Promise<ReturnType<RateLimitedApis[ApiType]['method']>>;
|
|
73
|
+
/**
|
|
74
|
+
* Checks whether an origin is rate limited for the a specific API.
|
|
75
|
+
*
|
|
76
|
+
* @param api - The API the origin is trying to access.
|
|
77
|
+
* @param origin - The origin trying to access the API.
|
|
78
|
+
* @returns `true` if rate-limited, and `false` otherwise.
|
|
79
|
+
*/
|
|
80
|
+
private isRateLimited;
|
|
81
|
+
/**
|
|
82
|
+
* Records that an origin has made a request to call an API, for rate-limiting purposes.
|
|
83
|
+
*
|
|
84
|
+
* @param api - The API the origin is trying to access.
|
|
85
|
+
* @param origin - The origin trying to access the API.
|
|
86
|
+
*/
|
|
87
|
+
private recordRequest;
|
|
88
|
+
/**
|
|
89
|
+
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
90
|
+
*
|
|
91
|
+
* @param api - The API in question.
|
|
92
|
+
* @param origin - The origin in question.
|
|
93
|
+
*/
|
|
94
|
+
private resetRequestCount;
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=RateLimitController.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimitController.d.mts","sourceRoot":"","sources":["../src/RateLimitController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAI3D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;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} from "@metamask/rpc-errors";
|
|
3
|
+
import { getKnownPropertyNames } from "@metamask/utils";
|
|
4
|
+
const name = 'RateLimitController';
|
|
5
|
+
const metadata = {
|
|
6
|
+
requests: { persist: false, anonymous: false },
|
|
6
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Controller with logic for rate-limiting API endpoints per requesting origin.
|
|
10
|
+
*/
|
|
11
|
+
export class RateLimitController extends BaseController {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a RateLimitController instance.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Constructor options.
|
|
16
|
+
* @param options.messenger - A reference to the messaging system.
|
|
17
|
+
* @param options.state - Initial state to set on this controller.
|
|
18
|
+
* @param options.implementations - Mapping from API type to API implementation.
|
|
19
|
+
* @param options.rateLimitTimeout - The time window in which the rate limit is applied (in ms).
|
|
20
|
+
* @param options.rateLimitCount - The amount of calls an origin can make in the rate limit time window.
|
|
21
|
+
*/
|
|
22
|
+
constructor({ rateLimitTimeout = 5000, rateLimitCount = 1, messenger, state, implementations, }) {
|
|
23
|
+
const defaultState = {
|
|
24
|
+
requests: getKnownPropertyNames(implementations).reduce((acc, key) => ({ ...acc, [key]: {} }), {}),
|
|
25
|
+
};
|
|
26
|
+
super({
|
|
27
|
+
name,
|
|
28
|
+
metadata,
|
|
29
|
+
messenger,
|
|
30
|
+
state: { ...defaultState, ...state },
|
|
31
|
+
});
|
|
32
|
+
this.implementations = implementations;
|
|
33
|
+
this.rateLimitTimeout = rateLimitTimeout;
|
|
34
|
+
this.rateLimitCount = rateLimitCount;
|
|
35
|
+
this.messagingSystem.registerActionHandler(`${name}:call`, (origin, type, ...args) => this.call(origin, type, ...args));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Calls an API if the requesting origin is not rate-limited.
|
|
39
|
+
*
|
|
40
|
+
* @param origin - The requesting origin.
|
|
41
|
+
* @param type - The type of API call to make.
|
|
42
|
+
* @param args - Arguments for the API call.
|
|
43
|
+
*/
|
|
44
|
+
async call(origin, type, ...args) {
|
|
45
|
+
if (this.isRateLimited(type, origin)) {
|
|
46
|
+
throw rpcErrors.limitExceeded({
|
|
47
|
+
message: `"${type.toString()}" is currently rate-limited. Please try again later.`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
this.recordRequest(type, origin);
|
|
51
|
+
const implementation = this.implementations[type].method;
|
|
52
|
+
if (!implementation) {
|
|
53
|
+
throw new Error('Invalid api type');
|
|
54
|
+
}
|
|
55
|
+
return implementation(...args);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Checks whether an origin is rate limited for the a specific API.
|
|
59
|
+
*
|
|
60
|
+
* @param api - The API the origin is trying to access.
|
|
61
|
+
* @param origin - The origin trying to access the API.
|
|
62
|
+
* @returns `true` if rate-limited, and `false` otherwise.
|
|
63
|
+
*/
|
|
64
|
+
isRateLimited(api, origin) {
|
|
65
|
+
const rateLimitCount = this.implementations[api].rateLimitCount ?? this.rateLimitCount;
|
|
66
|
+
return this.state.requests[api][origin] >= rateLimitCount;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Records that an origin has made a request to call an API, for rate-limiting purposes.
|
|
70
|
+
*
|
|
71
|
+
* @param api - The API the origin is trying to access.
|
|
72
|
+
* @param origin - The origin trying to access the API.
|
|
73
|
+
*/
|
|
74
|
+
recordRequest(api, origin) {
|
|
75
|
+
const rateLimitTimeout = this.implementations[api].rateLimitTimeout ?? this.rateLimitTimeout;
|
|
76
|
+
const previous = this.state.requests[api][origin] ?? 0;
|
|
77
|
+
this.update((state) => {
|
|
78
|
+
if (previous === 0) {
|
|
79
|
+
setTimeout(() => this.resetRequestCount(api, origin), rateLimitTimeout);
|
|
80
|
+
}
|
|
81
|
+
Object.assign(state, {
|
|
82
|
+
requests: {
|
|
83
|
+
...state.requests,
|
|
84
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
86
|
+
[api]: { [origin]: previous + 1 },
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
93
|
+
*
|
|
94
|
+
* @param api - The API in question.
|
|
95
|
+
* @param origin - The origin in question.
|
|
96
|
+
*/
|
|
97
|
+
resetRequestCount(api, origin) {
|
|
98
|
+
this.update((state) => {
|
|
99
|
+
Object.assign(state, {
|
|
100
|
+
requests: {
|
|
101
|
+
...state.requests,
|
|
102
|
+
[api]: { [origin]: 0 },
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
7
108
|
//# sourceMappingURL=RateLimitController.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"file":"RateLimitController.mjs","sourceRoot":"","sources":["../src/RateLimitController.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,EAAE,SAAS,EAAE,6BAA6B;AACjD,OAAO,EAAE,qBAAqB,EAAE,wBAAwB;AAmCxD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAoCnC,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,mBAEX,SAAQ,cAIT;IAOC;;;;;;;;;OASG;IACH,YAAY,EACV,gBAAgB,GAAG,IAAI,EACvB,cAAc,GAAG,CAAC,EAClB,SAAS,EACT,KAAK,EACL,eAAe,GAOhB;QACC,MAAM,YAAY,GAAG;YACnB,QAAQ,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC,MAAM,CAErD,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAA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IACL,CAAC;CACF","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 as (\n ...args: Parameters<RateLimitedApis[ApiType]['method']>\n ) => ReturnType<RateLimitedApis[ApiType]['method']>;\n\n if (!implementation) {\n throw new Error('Invalid api type');\n }\n\n return implementation(...args);\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 // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\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"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RateLimitController = void 0;
|
|
4
|
+
var RateLimitController_1 = require("./RateLimitController.cjs");
|
|
5
|
+
Object.defineProperty(exports, "RateLimitController", { enumerable: true, get: function () { return RateLimitController_1.RateLimitController; } });
|
|
6
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAYA,iEAA4D;AAAnD,0HAAA,mBAAmB,OAAA","sourcesContent":["export type {\n RateLimitedApi,\n RateLimitedApiMap,\n RateLimitedRequests,\n RateLimitControllerActions,\n RateLimitControllerCallApiAction,\n RateLimitControllerGetStateAction,\n RateLimitControllerEvents,\n RateLimitControllerStateChangeEvent,\n RateLimitMessenger,\n RateLimitState,\n} from './RateLimitController';\nexport { RateLimitController } from './RateLimitController';\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { RateLimitedApi, RateLimitedApiMap, RateLimitedRequests, RateLimitControllerActions, RateLimitControllerCallApiAction, RateLimitControllerGetStateAction, RateLimitControllerEvents, RateLimitControllerStateChangeEvent, RateLimitMessenger, RateLimitState, } from
|
|
2
|
-
export { RateLimitController } from
|
|
3
|
-
//# sourceMappingURL=index.d.
|
|
1
|
+
export type { RateLimitedApi, RateLimitedApiMap, RateLimitedRequests, RateLimitControllerActions, RateLimitControllerCallApiAction, RateLimitControllerGetStateAction, RateLimitControllerEvents, RateLimitControllerStateChangeEvent, RateLimitMessenger, RateLimitState, } from "./RateLimitController.cjs";
|
|
2
|
+
export { RateLimitController } from "./RateLimitController.cjs";
|
|
3
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","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,kCAA8B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,kCAA8B"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { RateLimitedApi, RateLimitedApiMap, RateLimitedRequests, RateLimitControllerActions, RateLimitControllerCallApiAction, RateLimitControllerGetStateAction, RateLimitControllerEvents, RateLimitControllerStateChangeEvent, RateLimitMessenger, RateLimitState, } from "./RateLimitController.mjs";
|
|
2
|
+
export { RateLimitController } from "./RateLimitController.mjs";
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","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,kCAA8B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,kCAA8B"}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,kCAA8B","sourcesContent":["export type {\n RateLimitedApi,\n RateLimitedApiMap,\n RateLimitedRequests,\n RateLimitControllerActions,\n RateLimitControllerCallApiAction,\n RateLimitControllerGetStateAction,\n RateLimitControllerEvents,\n RateLimitControllerStateChangeEvent,\n RateLimitMessenger,\n RateLimitState,\n} from './RateLimitController';\nexport { RateLimitController } from './RateLimitController';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/rate-limit-controller",
|
|
3
|
-
"version": "6.0.0-preview-
|
|
3
|
+
"version": "6.0.0-preview-cf09c0a",
|
|
4
4
|
"description": "Contains logic for rate-limiting API endpoints by requesting origin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -18,19 +18,24 @@
|
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
|
-
"import":
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.mts",
|
|
23
|
+
"default": "./dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/index.d.cts",
|
|
27
|
+
"default": "./dist/index.cjs"
|
|
28
|
+
}
|
|
24
29
|
},
|
|
25
30
|
"./package.json": "./package.json"
|
|
26
31
|
},
|
|
27
|
-
"main": "./dist/index.
|
|
28
|
-
"types": "./dist/
|
|
32
|
+
"main": "./dist/index.cjs",
|
|
33
|
+
"types": "./dist/index.d.cts",
|
|
29
34
|
"files": [
|
|
30
35
|
"dist/"
|
|
31
36
|
],
|
|
32
37
|
"scripts": {
|
|
33
|
-
"build": "
|
|
38
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
34
39
|
"build:docs": "typedoc",
|
|
35
40
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/rate-limit-controller",
|
|
36
41
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/rate-limit-controller",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-S5DUNUFB.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
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
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
93
|
-
[api]: { [origin]: previous + 1 }
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
100
|
-
*
|
|
101
|
-
* @param api - The API in question.
|
|
102
|
-
* @param origin - The origin in question.
|
|
103
|
-
*/
|
|
104
|
-
resetRequestCount(api, origin) {
|
|
105
|
-
this.update((state) => {
|
|
106
|
-
Object.assign(state, {
|
|
107
|
-
requests: {
|
|
108
|
-
...state.requests,
|
|
109
|
-
[api]: { [origin]: 0 }
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
exports.RateLimitController = RateLimitController;
|
|
119
|
-
//# sourceMappingURL=chunk-S5DUNUFB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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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AAA,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;AAAA;AAAA,UAGV,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 as (\n ...args: Parameters<RateLimitedApis[ApiType]['method']>\n ) => ReturnType<RateLimitedApis[ApiType]['method']>;\n\n if (!implementation) {\n throw new Error('Invalid api type');\n }\n\n return implementation(...args);\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 // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\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"]}
|
package/dist/chunk-ZXHKQHU4.mjs
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
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
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
93
|
-
[api]: { [origin]: previous + 1 }
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Resets the request count for a given origin and API combination, for rate-limiting purposes.
|
|
100
|
-
*
|
|
101
|
-
* @param api - The API in question.
|
|
102
|
-
* @param origin - The origin in question.
|
|
103
|
-
*/
|
|
104
|
-
resetRequestCount(api, origin) {
|
|
105
|
-
this.update((state) => {
|
|
106
|
-
Object.assign(state, {
|
|
107
|
-
requests: {
|
|
108
|
-
...state.requests,
|
|
109
|
-
[api]: { [origin]: 0 }
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export {
|
|
117
|
-
RateLimitController
|
|
118
|
-
};
|
|
119
|
-
//# sourceMappingURL=chunk-ZXHKQHU4.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 as (\n ...args: Parameters<RateLimitedApis[ApiType]['method']>\n ) => ReturnType<RateLimitedApis[ApiType]['method']>;\n\n if (!implementation) {\n throw new Error('Invalid api type');\n }\n\n return implementation(...args);\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 // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\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,IACn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AK,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;AAAA;AAAA,UAGV,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
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
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.date.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.es2019.intl.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","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../types/eth-ens-namehash.d.ts","../../../types/ethereum-ens-network-map.d.ts","../../../types/ethjs-query.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","../../../node_modules/@metamask/superstruct/dist/error.d.cts","../../../node_modules/@metamask/superstruct/dist/utils.d.cts","../../../node_modules/@metamask/superstruct/dist/struct.d.cts","../../../node_modules/@metamask/superstruct/dist/structs/coercions.d.cts","../../../node_modules/@metamask/superstruct/dist/structs/refinements.d.cts","../../../node_modules/@metamask/superstruct/dist/structs/types.d.cts","../../../node_modules/@metamask/superstruct/dist/structs/utilities.d.cts","../../../node_modules/@metamask/superstruct/dist/index.d.cts","../../../node_modules/@metamask/utils/dist/assert.d.cts","../../../node_modules/@metamask/utils/dist/base64.d.cts","../../../node_modules/@metamask/utils/dist/hex.d.cts","../../../node_modules/@metamask/utils/dist/bytes.d.cts","../../../node_modules/@metamask/utils/dist/caip-types.d.cts","../../../node_modules/@metamask/utils/dist/checksum.d.cts","../../../node_modules/@metamask/utils/dist/coercers.d.cts","../../../node_modules/@metamask/utils/dist/collections.d.cts","../../../node_modules/@metamask/utils/dist/encryption-types.d.cts","../../../node_modules/@metamask/utils/dist/errors.d.cts","../../../node_modules/@metamask/utils/dist/json.d.cts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/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/keyring.d.cts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/logging.d.cts","../../../node_modules/@metamask/utils/dist/misc.d.cts","../../../node_modules/@metamask/utils/dist/number.d.cts","../../../node_modules/@metamask/utils/dist/opaque.d.cts","../../../node_modules/@metamask/utils/dist/promise.d.cts","../../../node_modules/@metamask/utils/dist/time.d.cts","../../../node_modules/@metamask/utils/dist/transaction-types.d.cts","../../../node_modules/@metamask/utils/dist/versions.d.cts","../../../node_modules/@metamask/utils/dist/index.d.cts","../../../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/BaseControllerV1.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":"2ac9cdcfb8f8875c18d14ec5796a8b029c426f73ad6dc3ffb580c228b58d1c44","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","impliedFormat":1},{"version":"9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"0075fa5ceda385bcdf3488e37786b5a33be730e8bc4aa3cf1e78c63891752ce8","affectsGlobalScope":true,"impliedFormat":1},{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true,"impliedFormat":1},{"version":"09226e53d1cfda217317074a97724da3e71e2c545e18774484b61562afc53cd2","affectsGlobalScope":true,"impliedFormat":1},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b41361862022eb72fcc8a7f34680ac842aca802cf4bc1f915e8c620c9ce4331","affectsGlobalScope":true,"impliedFormat":1},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true,"impliedFormat":1},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true,"impliedFormat":1},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true,"impliedFormat":1},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true,"impliedFormat":1},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true,"impliedFormat":1},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true,"impliedFormat":1},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true,"impliedFormat":1},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true,"impliedFormat":1},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true,"impliedFormat":1},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true,"impliedFormat":1},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true,"impliedFormat":1},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true,"impliedFormat":1},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true,"impliedFormat":1},{"version":"f35a831e4f0fe3b3697f4a0fe0e3caa7624c92b78afbecaf142c0f93abfaf379","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"70bbfaec021ac4a0c805374225b55d70887f987df8b8dd7711d79464bb7b4385","impliedFormat":1},{"version":"869089d60b67219f63e6aca810284c89bae1b384b5cbc7ce64e53d82ad223ed5","impliedFormat":1},{"version":"fe8f00e1ffe6c8069f2568844debb342a661980c30e52b132f002b93f66de47e","impliedFormat":1},{"version":"f31113ac9492fdd6e78bf6151b338c92e5b1837be426ef4aa0648ce82d13b518","affectsGlobalScope":true,"impliedFormat":1},{"version":"62a0875a0397b35a2364f1d401c0ce17975dfa4d47bf6844de858ae04da349f9","impliedFormat":1},{"version":"ee7491d0318d1fafcba97d5b72b450eb52671570f7a4ecd9e8898d40eaae9472","impliedFormat":1},{"version":"e3e7d217d89b380c1f34395eadc9289542851b0f0a64007dfe1fb7cf7423d24e","impliedFormat":1},{"version":"fd79909e93b4d50fd0ed9f3d39ddf8ba0653290bac25c295aac49f6befbd081b","impliedFormat":1},{"version":"345a9cc2945406f53051cd0e9b51f82e1e53929848eab046fdda91ee8aa7da31","impliedFormat":1},{"version":"9debe2de883da37a914e5e784a7be54c201b8f1d783822ad6f443ff409a5ea21","impliedFormat":1},{"version":"dee5d5c5440cda1f3668f11809a5503c30db0476ad117dd450f7ba5a45300e8f","impliedFormat":1},{"version":"f5e396c1424c391078c866d6f84afe0b4d2f7f85a160b9c756cd63b5b1775d93","impliedFormat":1},{"version":"5caa6f4fff16066d377d4e254f6c34c16540da3809cd66cd626a303bc33c419f","impliedFormat":1},{"version":"730d055528bdf12c8524870bb33d237991be9084c57634e56e5d8075f6605e02","impliedFormat":1},{"version":"c26b7050e19f8f555605db02f6cfae645ec7928d2dd6f428790e01a163795f97","impliedFormat":1},{"version":"df877ab086035627f1d36150d33204d3d7d097b67a41b8d31f621afd32b618ba","impliedFormat":1},{"version":"30a340292b28c797f55fe80ccab953d6ff310165a5c871717a0ff7ba474b05c6","impliedFormat":1},{"version":"d2e0607a2ea008ec9f4cf46954e8e21c94bd42373bdb780ed8f27d8deab90907","impliedFormat":1},{"version":"8a6e0aeb87d2ec01563a82b20f98e0a740d81d8e600286fb378b39c1cf0905b4","impliedFormat":1},{"version":"d645973bd03c1b0b0d2817ffcfc6346c7e6ce94df7cf6a46087d27a347eb6f73","impliedFormat":1},{"version":"17ae0674c777ae1c8f912c247b0195604494b417d8da457ac6dfec8907a180c1","impliedFormat":1},{"version":"4cb8668d4cdad969d15718ffed6a75a68ffa026b3d4208a37a5842dc3f8aee9f","impliedFormat":1},{"version":"8e775a861341ec44847ac043ab2b60edc18dafc6b895acbb5f5628b465c61f62","impliedFormat":1},{"version":"69896bb78fcf1307b0f592839c8f1a7f6977bc4d55ec1fb2db046c8c7c0c25ae","impliedFormat":1},{"version":"c8ef51808d56e538840e26043483eab15df31026cf2b3fd47a279b0eec01fa69","impliedFormat":1},{"version":"11f688c9704ffff4c6dd7b9892d379b5f36f4e7408833168fe491181e5e049fe","impliedFormat":1},{"version":"05f81de0826c2631a7fce8bdbce6a79773ab397a122670c19564c8246b43a45a","impliedFormat":1},{"version":"70dbd132cafd25ff48f589e4adc467eefe258f640a651b3846fe9218e0ee2fe3","impliedFormat":1},{"version":"457b8e22ca4672e962ec7b55ab0cc5d68cfcdd8cf4ffba250df9e6c1eb0540a5","impliedFormat":1},{"version":"30e81e0d15a6cca02397e1aa517166e03ce0a28f0e6d53e25440ef22b31f64ab","impliedFormat":1},{"version":"d85503a3b889c475f2a56348c44d7c2aba42e5a7587fa06bbc46ccdd4258bd94","impliedFormat":1},{"version":"3442bd24d7d746b3a79f2bc44d8456f58ea4d841dbf6eced8c41607e980287c0","impliedFormat":1},{"version":"57540a291cb6fbd3b75616d3db9cf2b27a5f6b96733774ccac542432b86b8daa","impliedFormat":1},{"version":"3e0d35597ff6c5142082e60814fa39c8a2077a58d8a6a262e619afb5f855f6ba","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"056097110efd16869ec118cedb44ecbac9a019576eee808d61304ca6d5cb2cbe","affectsGlobalScope":true,"impliedFormat":1},{"version":"f51b4042a3ac86f1f707500a9768f88d0b0c1fc3f3e45a73333283dea720cdc6","impliedFormat":1},{"version":"4e77922a2627fe9a0cc6c96adddc7cc5b3c0666b2581b812582380714cd4492a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3dca3e952c8df3d5f78c55e53b6bb735bebf323ec6bae656c503e892cd4eb78d","impliedFormat":1},{"version":"661a11d16ad2e3543a77c53bcd4017ee9a450f47ab7def3ab493a86eae4d550c","impliedFormat":1},{"version":"8cdc646cec7819581ef343b83855b1bfe4fe674f2c84f4fb8dc90d82fb56bd3a","affectsGlobalScope":true,"impliedFormat":1},{"version":"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb","impliedFormat":1},{"version":"a847ac812e3f49e72601b1462faa1f80984b3e606190f548f4dfe9f0c8ef35cf","impliedFormat":1},{"version":"6c39d4dbdb372b364442854e42d8c473e2ec67badb226745af17ed5ac41ce6f5","impliedFormat":1},{"version":"7693b90b3075deaccafd5efb467bf9f2b747a3075be888652ef73e64396d8628","impliedFormat":1},{"version":"1bcc1e650cb04a29b65ef9227290792476ea416b5c342ce025417727618ecf6f","impliedFormat":1},{"version":"988b518a683e0203d1a4aa56dce733814299e0869d87da5899b098baa08fb40f","impliedFormat":1},{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4a3399b36463f19d8b5654caee162eb9def18c1ba3f735ba3c06413ab0b72a5","impliedFormat":1},{"version":"f7f13beb30daef3fabb51734f79aa39a876569b528364871ef91a5e01b9733d2","affectsGlobalScope":true,"impliedFormat":1},{"version":"171d02c5040b15102025d9e6357cc884e36c232a7e491c6be6259d85e9ac8437","impliedFormat":1},{"version":"addacad25729b8ba7c3f8cdd74a3afa191dbdd46e4efcc7b7db2ec4f8f0b9f71","impliedFormat":1},{"version":"aaa36a3ede6e754b88ad45ac785de8563f1808937e4a133f13fe36e22dac0593","impliedFormat":1},{"version":"bb6d313b87960df2630a8dd9119751723e3600038e5ca123ccaf9a15f47e9eaa","impliedFormat":1},{"version":"7e4217814fc7349400fa44f24d53f0932b6b0b70b21ea9024225f634afa998a1","impliedFormat":1},{"version":"43ec77c369473e92e2ecebf0554a0fdaa9c256644a6070f28228dfcceec77351","impliedFormat":1},{"version":"2dc06aeb1e2a47b03dfbe68952956fc9b82afed9a921424f91b9ba00e1d3205a","affectsGlobalScope":true,"impliedFormat":1},{"version":"d2388edcfda2b2f9a9762b196387b95e0b688f6c3e21ff8a86c6a7518f8ce0a8","impliedFormat":1},{"version":"4be60abb12ee8573738f06e47e3fe99436669d4b3546f0ae7a9a59b93fba3951","impliedFormat":1},{"version":"dd67d2b5e4e8a182a38de8e69fb736945eaa4588e0909c14e01a14bd3cc1fd1e","impliedFormat":1},{"version":"c161a5c9072c8807a3369d940ab0b9d2d98ed406c080afa6063ebc7ee20eb44d","affectsGlobalScope":true,"impliedFormat":1},{"version":"0d09f4b48899d342b5d6cd846f95f969a401933b0dcd375a8a7e45832328bb86","affectsGlobalScope":true,"impliedFormat":1},{"version":"cc6ef5733d4ea6d2e06310a32dffd2c16418b467c5033d49cecc4f3a25de7497","impliedFormat":1},{"version":"94768454c3348b6ebe48e45fbad8c92e2bb7af4a35243edbe2b90823d0bd7f9a","impliedFormat":1},{"version":"0be79b3ff0f16b6c2f9bc8c4cc7097ea417d8d67f8267f7e1eec8e32b548c2ff","impliedFormat":1},{"version":"88e485c93a1443952cb336167d49b82c33f6c0ca598608c943dc44f724f13e72","impliedFormat":1},{"version":"1ad9ae9e496d80dfb5cd49c7958aca4d48647599f2599d2ca1c67a72c23c7899","impliedFormat":1},{"version":"269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","impliedFormat":1},{"version":"6e191fea1db6e9e4fa828259cf489e820ec9170effff57fb081a2f3295db4722","impliedFormat":1},{"version":"aed943465fbce1efe49ee16b5ea409050f15cd8eaf116f6fadb64ef0772e7d95","impliedFormat":1},{"version":"70d08483a67bf7050dbedace398ef3fee9f436fcd60517c97c4c1e22e3c6f3e8","impliedFormat":1},{"version":"f71188f97c9f7d309798ec02a56dd3bf50a4e4d079b3480f275ac13719953898","impliedFormat":1},{"version":"e933de8143e1d12dd51d89b398760fd5a9081896be366dad88a922d0b29f3c69","affectsGlobalScope":true,"impliedFormat":1},{"version":"4e228e78c1e9b0a75c70588d59288f63a6258e8b1fe4a67b0c53fe03461421d9","impliedFormat":1},{"version":"c92436ab2b0f306458fefa7121f81edd53c9b4bb3bb92d8b1cf6c9a2355e944b","impliedFormat":1},{"version":"8e1f7c597c91a204847ea79b8f225ebe2e817278959b41afaabc5a297dfe802b","impliedFormat":1},{"version":"875c46cfd441e361416221859dc40617936fbbbe77c4b842b66b6a1fd74f2368","impliedFormat":1},{"version":"a05e2d784c9be7051c4ac87a407c66d2106e23490c18c038bbd0712bde7602fd","affectsGlobalScope":true,"impliedFormat":1},{"version":"9f045c02a95c50d245e35aae2c070ac0a804f13c7a810f49f4b296361da133a7","affectsGlobalScope":true,"impliedFormat":1},{"version":"cf434b5c04792f62d6f4bdd5e2c8673f36e638e910333c172614d5def9b17f98","impliedFormat":1},{"version":"1d65d4798df9c2df008884035c41d3e67731f29db5ecb64cd7378797c7c53a2f","impliedFormat":1},{"version":"0faee6b555890a1cb106e2adc5d3ffd89545b1da894d474e9d436596d654998f","impliedFormat":1},{"version":"129f54f0e0b0dbf88d6578d627c54bd8599ecbdd9743b6788320d26e49fc5485","impliedFormat":1},{"version":"867f95abf1df444aab146b19847391fc2f922a55f6a970a27ed8226766cee29f","impliedFormat":1},{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true,"impliedFormat":1},{"version":"b0297b09e607bec9698cac7cf55463d6731406efb1161ee4d448293b47397c84","impliedFormat":1},{"version":"f9623ef5cecfa8ae05c1a3bb8cf81c0c723ec124e46f71e3104ef665fe74ad10","impliedFormat":1},{"version":"809a57de65ca328f47f4639ba1a8a4348af2c9f91a060e77bdd3dd92dd71b492","impliedFormat":1},{"version":"4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","impliedFormat":1},{"version":"016990463a717488f46aeba06125b987d0d7c77dc09d27d47ea2760f1af7f4da","impliedFormat":1},{"version":"692c448209a6699a345b5318ae2fc0612ee95c52812f0abf81dc902260ce572f","impliedFormat":1},{"version":"6ba92d2209defae5551c58f024665ad2fd965f03dd80e17b1bb1cee57ebd706a","impliedFormat":1},{"version":"d50fc26add4a7d835a29482544e4605558f3706fe14e191b1009ce70f76dadf0","impliedFormat":1},{"version":"39eb436d0226a590cc35f84b7bffae0fd613e2c4c83124be83969726df8cf269","impliedFormat":1},{"version":"e7dbb1423e552557b09a125be1c6772c94c169677146e3eaee95e6d1fc6851c8","impliedFormat":1},{"version":"aa184f01f3f0b540bddf441dc658bd472a59d519da188a2f048acb365e8ca77a","impliedFormat":1},{"version":"49798c9e2d9624bbc01cdf8371171b64a4eead49fef2853b69fe1bc2e7c75207","impliedFormat":1},{"version":"c7fb2b8c48f3a20faad1673b23366f24992afaf7d3854190e51d72e0dcad5bc8","impliedFormat":1},{"version":"c0a48e69d2a824fcf1fdd6ec59604e280c56998ac7a7e3a8514823db1de68cdd","impliedFormat":1},{"version":"4e78c87355f7e4fd9524d7582a14bf72771aeee33acb73a848de8bf2e44d8831","impliedFormat":1},{"version":"ff00f23ec0c6c986df2778657ef18073548634b31757bd496902cd00c183ae96","impliedFormat":1},{"version":"6c3351c0361b6fa16a3379508e2c4114cba7ad6d6bfcc0d5b2fb9f02aa2f83c4","impliedFormat":1},{"version":"69071e42231f3b87f71b076904875bdef914f01c3017eb6a39a33694e437b5e0","impliedFormat":1},{"version":"dee490d4ee8b309fcba02b3c49ab263b4a40946c1cd29e7b12e08b48c70cd9a2","impliedFormat":1},{"version":"7ddda341b1ad729e8da34de6378d9d1b3f64a7bef3a4a8fcdf4261c9a9c68ccb","impliedFormat":1},{"version":"174f185e6b6399ea73366bff1e454c5e54bef9b0804a57bef7f5009d1f21b9ad","impliedFormat":1},{"version":"e0d39ecd8a0627a45b9fece85425d5d048e2d0cf23d4c444d9594147605ca4bf","impliedFormat":1},{"version":"10b3b799f9675ebe2785104b5ac69a898accc5d32f86cda152fa646a2c3cdfc2","impliedFormat":1},{"version":"41ca098760de99ca2cc5de79e73e0b837e2661767e5772a983bc535ba4d86690","impliedFormat":1},{"version":"f78570ffe02941be6f7ad1b8a54642a1d6069d16cdbbb75bfe1cdf81610f0c69","impliedFormat":1},{"version":"c0a90b05dc7d2a78b2f90c9e2b1d464887ee23a71799acba659b0359785d07de","impliedFormat":1},{"version":"0557cef4f85111361244bad1e684ce9cadb326e582f78ad70d31c93ddb0d99f3","impliedFormat":1},{"version":"bf5413a1e4c9a2127b83ff92b52f9b3f344f91841ffb95a8a78eec6059730caf","impliedFormat":1},{"version":"c7d64c42ea284a34e9aa757537f7a37d79b07a04d409b1bea51f5a8ddda45e25","impliedFormat":1},{"version":"68cc8d6fcc2f270d7108f02f3ebc59480a54615be3e09a47e14527f349e9d53e","impliedFormat":1},{"version":"3eb11dbf3489064a47a2e1cf9d261b1f100ef0b3b50ffca6c44dd99d6dd81ac1","impliedFormat":1},{"version":"04e90044c2e8fd4b0938a4d3f9d8e1efee7fd77ced068e4e6f0eea1102735e40","impliedFormat":1},{"version":"4ff91243ea4afd0a59dfe0704d069bcb4e23b413ba821667669102fe3ca78c78","impliedFormat":1},{"version":"b16327ee01357bc4b698d8d464e0050585d17357420f2b4d184c96abf6373990","impliedFormat":1},{"version":"e247271d2e5f60a37056511587b7c3df27f9abcf0a5ea95ed8cee786cef48478","impliedFormat":1},{"version":"01dfb59624113bd88e1059623cecd7943c845b09c4394acea0aa439786d13edb","impliedFormat":1},{"version":"fe81fb714ee64eb7219b1cabad2fcad57bbd38f9474a583d718c8eb82b6241e0","impliedFormat":1},{"version":"9bdfb026298a0a75c054478fdd19b0de4b1bf7dfbfff84781b0f1da25d81c6b4","impliedFormat":1},{"version":"3c332d20a736ef5b8e760ac9100f4fdd0022534d51e4f0f29d40eea9c15ecd86","impliedFormat":1},{"version":"6c1a41c6039219da236aba5ca487585e9e98958c885023f1d39c066b48949734","impliedFormat":1},{"version":"3f425f99f8dbc920370d86c5b7ebff7b2a710fd991b012559d35f9e4adee1661","impliedFormat":1},{"version":"1ad191863b99a80efa56eab1a724da76641fa0a31333dbdb1dca4e6bd182309a","impliedFormat":1},{"version":"2270cf0bacf7d694e3047c8fa13873b7025e6ddfa0f7b63acee44c1e9927bcc0","impliedFormat":1},{"version":"8ffc8385762a724b7eebfa8317152bfba4512168d6d906f1a9698a9a6038b47b","impliedFormat":1},{"version":"cfff1509be4fd735a305637de296711313d8660644b766c4e6b603baf7149b12","impliedFormat":1},{"version":"4535531d0b0bba5cfb0917f13f9d4a50cea4239895de55c02b0f6bc3f3eb646d","impliedFormat":1},{"version":"797ed7a333103aa45a7cebfaf9a04454b59a22a7faf2e9f5a743d9ee44cd8024","impliedFormat":1},{"version":"3cb7cceea4cf68d02e5eba1f412ef0706ba60fbefd8a9c5f3a839bfa35857967","impliedFormat":1},{"version":"3042247c61fa9d67ff654424d9864e2dc7b9ff080540b960cbcdba18002a375a","impliedFormat":1},{"version":"3e0b0c20c7c314d9278c0b6b08b8d84f4552fb4acbb641ddc33deb35dc54f723","impliedFormat":1},{"version":"2d3b3589a50def08e636031988f1344d7c26f1b6bbf3b0e0078922a6770d9bb1","impliedFormat":1},{"version":"92e8887e25fd27cacf0bd6b84d388536ff843d46e2eee88a1659369a19bf6453","impliedFormat":1},{"version":"08f2ee0e58420657f003cb53c801e3bbb08de2d0a3f4cb77ea8cf6f3675f3722","impliedFormat":1},{"version":"2ab874598ce7f5b3f693ce4e2de5647944845c50396b147f8a5f7c7d06dc0bc7","impliedFormat":1},{"version":"fc02a0675473c0fe3f528753abb9328a04122f4204856202b26c1ebaa35fb9e5","impliedFormat":1},{"version":"110afe66c4206c0a14e9777d421db05c1b77fbe1736c4bcde21cb98daa147116","impliedFormat":1},{"version":"a623ad0abc212091a2307c131f1c7711f5d38e3f8c1ddb1c3bc9c0eec212d213","impliedFormat":1},{"version":"39dbe5db5a67ad38a2a2dc840ca8158cc83cbc29e7cb4c3936099b1ae24889cf","impliedFormat":1},{"version":"bbf6b7a072488c5c4a68499e9e0c1af81ca51f51484d4b04961e2df855362675","impliedFormat":1},{"version":"e6e0f28c0149a76f6aa35f2640ac4ff9badfd08cb49475972e8a8c0dd109c1c0","impliedFormat":1},{"version":"a3c3378cb2e8113142c571eb3558e3639adab4d3fa7e5120b5dba770ae49c296","impliedFormat":1},{"version":"765d50f37d1ce20a5cb820cdb96b86a9e5f877a16f328beb4a1c446a6fc66736","impliedFormat":1},{"version":"a71638033db837b7bc9695de4956d73d6d43bf81ebe54e2596e70e1d6f2e6b3e","impliedFormat":1},{"version":"3c0ba2cea279d2ae0e050d4bf7d54ea4f653f2853ee337baf30e1e8ef166e2a2","impliedFormat":1},{"version":"e48c5852c61e2aa531513506b62d7eeb02d7cb4558d0ab1a98a667184c9e90e1","impliedFormat":1},{"version":"feaba0e6e474920bc61fc9026a6f8d0f9b4f1db73e79de68c849da87fe42b351","impliedFormat":1},{"version":"d779bc8387565e8f13d81a329ec3c3ea6696b20c7441b6804bc5c4f030cc0aca","impliedFormat":1},{"version":"737b100d2421e22bc571ef5ad34d0f68fef1a4f0c7c6a4cf8c8ba921626fe839","signature":"0b7398d9489c6255468250510476a9de2d7c6cd98edd8b9f74fa8ab5ea3acd4d","impliedFormat":1},{"version":"6889a9fa5a1cda3eff8fb21d030b2eb3e2078d21813840e8c3737b583b7b7fac","signature":"2760c52da7d0ed79057fdfc52dd1b9ea9f608cab9972555e034ca60b6a015806","impliedFormat":1},{"version":"e74998d5cefc2f29d583c10b99c1478fb810f1e46fbb06535bfb0bbba3c84aa5","impliedFormat":1},{"version":"2c8e55457aaf4902941dfdba4061935922e8ee6e120539c9801cd7b400fae050","impliedFormat":1},{"version":"43d058146b002d075f5d0033a6870321048297f1658eb0db559ba028383803a6","impliedFormat":1},{"version":"670a76db379b27c8ff42f1ba927828a22862e2ab0b0908e38b671f0e912cc5ed","impliedFormat":1},{"version":"9e0cf651e8e2c5b9bebbabdff2f7c6f8cedd91b1d9afcc0a854cdff053a88f1b","impliedFormat":1},{"version":"069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","impliedFormat":1},{"version":"8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","impliedFormat":1},{"version":"8c95f96ccd4be0674944077aec1e4f2cccd515ca06d4327562dd017250e7d3fc","impliedFormat":1},{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true,"impliedFormat":1},{"version":"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","impliedFormat":1},{"version":"f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","impliedFormat":1},{"version":"dd0c1b380ba3437adedef134b2e48869449b1db0b07b2a229069309ce7b9dd39","impliedFormat":1},{"version":"afe73051ff6a03a9565cbd8ebb0e956ee3df5e913ad5c1ded64218aabfa3dcb5","impliedFormat":1},{"version":"035a5df183489c2e22f3cf59fc1ed2b043d27f357eecc0eb8d8e840059d44245","impliedFormat":1},{"version":"a4809f4d92317535e6b22b01019437030077a76fec1d93b9881c9ed4738fcc54","impliedFormat":1},{"version":"5f53fa0bd22096d2a78533f94e02c899143b8f0f9891a46965294ee8b91a9434","impliedFormat":1},{"version":"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","impliedFormat":1},{"version":"d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","impliedFormat":1},{"version":"462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","impliedFormat":1},{"version":"5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","impliedFormat":1},{"version":"7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","impliedFormat":1},{"version":"dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","impliedFormat":1},{"version":"1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","impliedFormat":1},{"version":"8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","impliedFormat":1},{"version":"7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73","impliedFormat":1},{"version":"ccfd8774cd9b929f63ff7dcf657977eb0652e3547f1fcac1b3a1dc5db22d4d58","affectsGlobalScope":true,"impliedFormat":1},{"version":"d92dc90fecd2552db74d8dc3c6fb4db9145b2aa0efe2c127236ba035969068d4","impliedFormat":1},{"version":"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","impliedFormat":1},{"version":"ff81bffa4ecfceae2e86b5920c3fcb250b66b1d6ed72944dffdf58123be2481b","impliedFormat":1},{"version":"458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","impliedFormat":1},{"version":"da2b6356b84a40111aaecb18304ea4e4fcb43d70efb1c13ca7d7a906445ee0d3","impliedFormat":1},{"version":"187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","impliedFormat":1},{"version":"aa2c18a1b5a086bbcaae10a4efba409cc95ba7287d8cf8f2591b53704fea3dea","impliedFormat":1},{"version":"6f294731b495c65ecf46a5694f0082954b961cf05463bea823f8014098eaffa0","impliedFormat":1},{"version":"0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","impliedFormat":1},{"version":"00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","impliedFormat":1},{"version":"bdf0ed7d9ebae6175a5d1b4ec4065d07f8099379370a804b1faff05004dc387d","impliedFormat":1},{"version":"3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","impliedFormat":1},{"version":"b03afe4bec768ae333582915146f48b161e567a81b5ebc31c4d78af089770ac9","impliedFormat":1},{"version":"df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9","impliedFormat":1},{"version":"4f6a12044ee6f458db11964153830abbc499e73d065c51c329ec97407f4b13dd","impliedFormat":1},{"version":"8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","impliedFormat":1},{"version":"916be7d770b0ae0406be9486ac12eb9825f21514961dd050594c4b250617d5a8","impliedFormat":1},{"version":"254d9fb8c872d73d34594be8a200fd7311dbfa10a4116bfc465fba408052f2b3","impliedFormat":1},{"version":"d88a5e779faf033be3d52142a04fbe1cb96009868e3bbdd296b2bc6c59e06c0e","impliedFormat":1},{"version":"2ccea88888048bbfcacbc9531a5596ea48a3e7dcd0a25f531a81bb717903ba4f","impliedFormat":1},{"version":"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","impliedFormat":1},{"version":"f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","impliedFormat":1},{"version":"d8f7109e14f20eb735225a62fd3f8366da1a8349e90331cdad57f4b04caf6c5a","impliedFormat":1},{"version":"cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","impliedFormat":1},{"version":"9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","impliedFormat":1},{"version":"c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","impliedFormat":1},{"version":"8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","impliedFormat":1},{"version":"86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","impliedFormat":1},{"version":"42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","impliedFormat":1},{"version":"ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","impliedFormat":1},{"version":"83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","impliedFormat":1},{"version":"1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","impliedFormat":1},{"version":"0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","impliedFormat":1},{"version":"cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","impliedFormat":1},{"version":"c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","impliedFormat":1},{"version":"f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","impliedFormat":1},{"version":"0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","impliedFormat":1},{"version":"7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","impliedFormat":1},{"version":"bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","impliedFormat":1},{"version":"52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","impliedFormat":1},{"version":"770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","impliedFormat":1},{"version":"d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","impliedFormat":1},{"version":"799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","impliedFormat":1},{"version":"2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","impliedFormat":1},{"version":"9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","impliedFormat":1},{"version":"397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","impliedFormat":1},{"version":"a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","impliedFormat":1},{"version":"a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","impliedFormat":1},{"version":"c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","impliedFormat":1},{"version":"4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","impliedFormat":1},{"version":"f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","impliedFormat":1},{"version":"cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","impliedFormat":1},{"version":"b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","impliedFormat":1},{"version":"c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","impliedFormat":1},{"version":"14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","impliedFormat":1},{"version":"a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","impliedFormat":1},{"version":"f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","impliedFormat":1},{"version":"3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","impliedFormat":1},{"version":"662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","impliedFormat":1},{"version":"c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","impliedFormat":1},{"version":"2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","impliedFormat":1},{"version":"34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","impliedFormat":1},{"version":"7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","impliedFormat":1},{"version":"7d2a0ba1297be385a89b5515b88cd31b4a1eeef5236f710166dc1b36b1741e1b","impliedFormat":1},{"version":"9d92b037978bb9525bc4b673ebddd443277542e010c0aef019c03a170ccdaa73","impliedFormat":1},{"version":"ab82804a14454734010dcdcd43f564ff7b0389bee4c5692eec76ff5b30d4cf66","impliedFormat":1},{"version":"fab58e600970e66547644a44bc9918e3223aa2cbd9e8763cec004b2cfb48827e","impliedFormat":1},{"version":"bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","impliedFormat":1},{"version":"ae271d475b632ce7b03fea6d9cf6da72439e57a109672671cbc79f54e1386938","impliedFormat":1}],"root":[[46,59],198,199],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"module":100,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7},"fileIdsList":[[200],[95,131,132,133,148],[132,133,149,150],[131,132],[131,148,151,154],[131,151,154,155],[152,153,154,156,157],[131,154],[131,148,151,152,153,156],[131,139],[131],[95,131],[83,131],[135,136,137,138,139,140,141,142,143,144,145,146,147],[131,137,138],[131,137,139],[170,193],[193,194],[193,194,195,196],[170],[60,61,62,63,64,65,66],[60,61],[62],[61,62],[60,62],[67],[70],[67,70],[68,69,70,71,72,73,74,75,76,77,78,159,162,163,164,165,166,167,168,169],[67,68],[70,76,78,158],[161],[70,71],[67,165],[200,201,202,203,204],[200,202],[160],[208,209,210],[96,131],[213],[214],[225],[219,224],[228,230,231,232,233,234,235,236,237,238,239,240],[228,229,231,232,233,234,235,236,237,238,239,240],[229,230,231,232,233,234,235,236,237,238,239,240],[228,229,230,232,233,234,235,236,237,238,239,240],[228,229,230,231,233,234,235,236,237,238,239,240],[228,229,230,231,232,234,235,236,237,238,239,240],[228,229,230,231,232,233,235,236,237,238,239,240],[228,229,230,231,232,233,234,236,237,238,239,240],[228,229,230,231,232,233,234,235,237,238,239,240],[228,229,230,231,232,233,234,235,236,238,239,240],[228,229,230,231,232,233,234,235,236,237,239,240],[228,229,230,231,232,233,234,235,236,237,238,240],[228,229,230,231,232,233,234,235,236,237,238,239],[79],[82],[83,88,115],[84,95,96,103,112,123],[84,85,95,103],[86,124],[87,88,96,104],[88,112,120],[89,91,95,103],[90],[91,92],[95],[94,95],[82,95],[95,96,97,112,123],[95,96,97,112],[95,98,103,112,123],[95,96,98,99,103,112,120,123],[98,100,112,120,123],[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,126,127,128,129,130],[95,101],[102,123,128],[91,95,103,112],[104],[105],[82,106],[107,122,128],[108],[109],[95,110],[110,111,124,126],[83,95,112,113,114],[83,112,114],[112,113],[115],[116],[95,118,119],[118,119],[88,103,112,120],[121],[103,122],[83,98,109,123],[88,124],[112,125],[126],[127],[83,88,95,97,106,112,123,126,128],[112,129],[131,246],[249,288],[249,273,288],[288],[249],[249,274,288],[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,282,283,284,285,286,287],[274,288],[289],[293],[182],[182,183,184,185,186],[171,172,173,174,175,176,177,178,179,180,181],[217,220],[217,220,221,222],[219],[216,223],[218],[170,190],[170,187,188,189,191],[188],[189],[188,189,190,191],[170,192,197],[198],[192]],"referencedMap":[[202,1],[149,2],[151,3],[133,4],[155,5],[156,6],[152,6],[158,7],[153,6],[157,8],[154,9],[140,10],[137,11],[144,12],[138,10],[135,13],[148,14],[142,11],[139,15],[141,16],[194,17],[195,18],[197,19],[193,20],[67,21],[62,22],[63,23],[64,23],[65,24],[66,24],[61,25],[68,26],[69,26],[71,27],[72,26],[73,26],[74,28],[70,26],[170,29],[78,30],[159,31],[162,32],[164,27],[168,33],[169,34],[205,35],[201,1],[203,36],[204,1],[206,11],[161,37],[211,38],[212,39],[214,40],[215,41],[226,42],[225,43],[229,44],[230,45],[228,46],[231,47],[232,48],[233,49],[234,50],[235,51],[236,52],[237,53],[238,54],[239,55],[240,56],[79,57],[80,57],[82,58],[83,59],[84,60],[85,61],[86,62],[87,63],[88,64],[89,65],[90,66],[91,67],[92,67],[93,68],[94,69],[95,70],[96,71],[97,72],[98,73],[99,74],[100,75],[131,76],[101,77],[102,78],[103,79],[104,80],[105,81],[106,82],[107,83],[108,84],[109,85],[110,86],[111,87],[112,88],[114,89],[113,90],[115,91],[116,92],[118,93],[119,94],[120,95],[121,96],[122,97],[123,98],[124,99],[125,100],[126,101],[127,102],[128,103],[129,104],[243,11],[247,105],[248,11],[273,106],[274,107],[249,108],[252,108],[271,106],[272,106],[262,106],[261,109],[259,106],[254,106],[267,106],[265,106],[269,106],[253,106],[266,106],[270,106],[255,106],[256,106],[268,106],[250,106],[257,106],[258,106],[260,106],[264,106],[275,110],[263,106],[251,106],[288,111],[282,110],[284,112],[283,110],[276,110],[277,110],[279,110],[281,110],[285,112],[286,112],[278,112],[280,112],[290,113],[294,114],[178,115],[180,115],[179,115],[177,115],[187,116],[182,117],[173,115],[174,115],[175,115],[176,115],[221,118],[223,119],[222,118],[220,120],[224,121],[219,122],[191,123],[190,124],[189,125],[188,126],[192,127],[198,128],[199,129]],"exportedModulesMap":[[202,1],[149,2],[151,3],[133,4],[155,5],[156,6],[152,6],[158,7],[153,6],[157,8],[154,9],[140,10],[137,11],[144,12],[138,10],[135,13],[148,14],[142,11],[139,15],[141,16],[194,17],[195,18],[197,19],[193,20],[67,21],[62,22],[63,23],[64,23],[65,24],[66,24],[61,25],[68,26],[69,26],[71,27],[72,26],[73,26],[74,28],[70,26],[170,29],[78,30],[159,31],[162,32],[164,27],[168,33],[169,34],[205,35],[201,1],[203,36],[204,1],[206,11],[161,37],[211,38],[212,39],[214,40],[215,41],[226,42],[225,43],[229,44],[230,45],[228,46],[231,47],[232,48],[233,49],[234,50],[235,51],[236,52],[237,53],[238,54],[239,55],[240,56],[79,57],[80,57],[82,58],[83,59],[84,60],[85,61],[86,62],[87,63],[88,64],[89,65],[90,66],[91,67],[92,67],[93,68],[94,69],[95,70],[96,71],[97,72],[98,73],[99,74],[100,75],[131,76],[101,77],[102,78],[103,79],[104,80],[105,81],[106,82],[107,83],[108,84],[109,85],[110,86],[111,87],[112,88],[114,89],[113,90],[115,91],[116,92],[118,93],[119,94],[120,95],[121,96],[122,97],[123,98],[124,99],[125,100],[126,101],[127,102],[128,103],[129,104],[243,11],[247,105],[248,11],[273,106],[274,107],[249,108],[252,108],[271,106],[272,106],[262,106],[261,109],[259,106],[254,106],[267,106],[265,106],[269,106],[253,106],[266,106],[270,106],[255,106],[256,106],[268,106],[250,106],[257,106],[258,106],[260,106],[264,106],[275,110],[263,106],[251,106],[288,111],[282,110],[284,112],[283,110],[276,110],[277,110],[279,110],[281,110],[285,112],[286,112],[278,112],[280,112],[290,113],[294,114],[178,115],[180,115],[179,115],[177,115],[187,116],[182,117],[173,115],[174,115],[175,115],[176,115],[221,118],[223,119],[222,118],[220,120],[224,121],[219,122],[191,123],[190,124],[189,125],[188,126],[192,127],[198,130],[199,129]],"semanticDiagnosticsPerFile":[202,200,149,132,151,133,150,155,156,152,158,153,157,154,140,137,144,138,135,143,148,145,146,147,142,139,136,141,194,196,195,197,193,60,67,62,63,64,65,66,61,68,69,71,72,73,74,75,76,77,70,170,78,159,162,163,164,165,166,167,168,169,205,201,203,204,206,161,207,208,211,209,212,213,214,215,226,225,210,227,229,230,228,231,232,233,234,235,236,237,238,239,240,241,160,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,81,130,98,99,100,131,101,102,103,104,105,106,107,108,109,110,111,112,114,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,242,243,244,245,247,246,248,273,274,249,252,271,272,262,261,259,254,267,265,269,253,266,270,255,256,268,250,257,258,260,264,275,263,251,288,287,282,284,283,276,277,279,281,285,286,278,280,290,289,291,292,293,294,134,216,181,178,180,179,177,187,182,186,183,185,184,173,174,175,171,172,176,217,221,223,222,220,224,219,218,44,45,8,10,9,2,11,12,13,14,15,16,17,18,3,4,19,23,20,21,22,24,25,26,5,27,28,29,30,6,34,31,32,33,35,7,36,41,42,37,38,39,40,1,43,191,190,189,188,192,198,199,51,52,53,54,55,56,46,57,58,59,47,48,49,50],"latestChangedDtsFile":"./types/index.d.ts"},"version":"5.2.2"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RateLimitController.d.ts","sourceRoot":"","sources":["../../src/RateLimitController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,eAAe,SAAS,iBAAiB,IACvE,MAAM,CAAC,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,eAAe,SAAS,iBAAiB,IAAI;IACtE,QAAQ,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CAChD,CAAC;AAEF,QAAA,MAAM,IAAI,wBAAwB,CAAC;AAEnC,MAAM,MAAM,mCAAmC,CAC7C,eAAe,SAAS,iBAAiB,IACvC,0BAA0B,CAAC,OAAO,IAAI,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC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