@novasamatech/host-container 0.6.6-1 → 0.6.6
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/createContainer.js +2 -2
- package/dist/rateLimiter.js +8 -10
- package/package.json +5 -4
package/dist/createContainer.js
CHANGED
|
@@ -104,10 +104,10 @@ export function createContainer(provider) {
|
|
|
104
104
|
},
|
|
105
105
|
handleLocalStorageClear(handler) {
|
|
106
106
|
init();
|
|
107
|
-
return transport.handleRequest('host_local_storage_clear', async (
|
|
107
|
+
return transport.handleRequest('host_local_storage_clear', async (message) => {
|
|
108
108
|
const version = 'v1';
|
|
109
109
|
const error = new StorageErr.Unknown({ reason: UNSUPPORTED_MESSAGE_FORMAT_ERROR });
|
|
110
|
-
return guardVersion(
|
|
110
|
+
return guardVersion(message, version, error)
|
|
111
111
|
.asyncMap(async (params) => handler(params, { ok: (okAsync), err: (errAsync) }))
|
|
112
112
|
.andThen(r => r.map(r => enumValue(version, resultOk(r))))
|
|
113
113
|
.orElse(r => ok(enumValue(version, resultErr(r))))
|
package/dist/rateLimiter.js
CHANGED
|
@@ -89,15 +89,15 @@ function createDropStrategy(config) {
|
|
|
89
89
|
remainingTokens: config.maxRequestsPerInterval,
|
|
90
90
|
lastRefillTimestamp: Date.now(),
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
function refillTokens() {
|
|
93
93
|
const now = Date.now();
|
|
94
94
|
const elapsed = now - state.lastRefillTimestamp;
|
|
95
95
|
if (elapsed >= config.intervalMs) {
|
|
96
96
|
state.remainingTokens = config.maxRequestsPerInterval;
|
|
97
97
|
state.lastRefillTimestamp = now;
|
|
98
98
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
99
|
+
}
|
|
100
|
+
function schedule(execute) {
|
|
101
101
|
refillTokens();
|
|
102
102
|
if (state.remainingTokens > 0) {
|
|
103
103
|
state.remainingTokens -= 1;
|
|
@@ -113,13 +113,11 @@ function createDropStrategy(config) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
return Promise.reject(config.onDrop?.() ?? new GenericError({ reason: RATE_LIMITED_MESSAGE }));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
};
|
|
116
|
+
}
|
|
117
|
+
function destroy() {
|
|
118
|
+
/* no-op: drop strategy has no timers or queue */
|
|
119
|
+
}
|
|
120
|
+
return { schedule, destroy };
|
|
123
121
|
}
|
|
124
122
|
export function createRateLimiter(config) {
|
|
125
123
|
if (config.strategy === 'queue') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/host-container",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.6
|
|
4
|
+
"version": "0.6.6",
|
|
5
5
|
"description": "Host container for hosting and managing products within the Polkadot ecosystem.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
"./package.json": "./package.json",
|
|
17
17
|
".": {
|
|
18
|
+
"#/source": "./src/index.ts",
|
|
18
19
|
"types": "./dist/index.d.ts",
|
|
19
20
|
"default": "./dist/index.js"
|
|
20
21
|
}
|
|
@@ -26,11 +27,11 @@
|
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@polkadot-api/utils": "^0.2.0",
|
|
28
29
|
"@polkadot-api/json-rpc-provider": "^0.0.4",
|
|
29
|
-
"@novasamatech/host-api": "0.6.6
|
|
30
|
-
"nanoid": "5.1.
|
|
30
|
+
"@novasamatech/host-api": "0.6.6",
|
|
31
|
+
"nanoid": "5.1.7"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"electron": "^
|
|
34
|
+
"electron": "^41.0.2"
|
|
34
35
|
},
|
|
35
36
|
"publishConfig": {
|
|
36
37
|
"access": "public"
|