@nemigo/server 2.0.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jwt.js +1 -1
- package/dist/redis.js +11 -9
- package/package.json +11 -13
package/dist/jwt.js
CHANGED
package/dist/redis.js
CHANGED
|
@@ -17,8 +17,8 @@ export class RedisStorage {
|
|
|
17
17
|
const result = await this.client.exists(this.__toKey(name, prefix));
|
|
18
18
|
return result === 1;
|
|
19
19
|
}
|
|
20
|
-
catch (
|
|
21
|
-
return this.panic?.onhas?.(
|
|
20
|
+
catch (error) {
|
|
21
|
+
return this.panic?.onhas?.(error) ?? false;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
async get(name, prefix) {
|
|
@@ -27,8 +27,8 @@ export class RedisStorage {
|
|
|
27
27
|
if (cached)
|
|
28
28
|
return JSON.parse(cached);
|
|
29
29
|
}
|
|
30
|
-
catch (
|
|
31
|
-
return this.panic?.onget?.(
|
|
30
|
+
catch (error) {
|
|
31
|
+
return this.panic?.onget?.(error);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
async set(name, value, options = {}) {
|
|
@@ -36,11 +36,13 @@ export class RedisStorage {
|
|
|
36
36
|
const key = this.__toKey(name, options.prefix);
|
|
37
37
|
const ttl_seconds = options.ttl_seconds === null ? undefined : (options.ttl_seconds ?? options.ttl_seconds);
|
|
38
38
|
const result = await this.client.set(key, JSON.stringify(value), { EX: ttl_seconds });
|
|
39
|
-
if (result !== "OK")
|
|
40
|
-
|
|
39
|
+
if (result !== "OK") {
|
|
40
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
41
|
+
throw new Error(`Redis SET returned: ${result}`);
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
44
|
catch (error) {
|
|
43
|
-
|
|
45
|
+
await this.panic?.onset?.(error);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
async delete(name, prefix) {
|
|
@@ -49,8 +51,8 @@ export class RedisStorage {
|
|
|
49
51
|
// DEL возвращает количество удаленных ключей
|
|
50
52
|
return result > 0;
|
|
51
53
|
}
|
|
52
|
-
catch (
|
|
53
|
-
return this.panic?.ondelete?.(
|
|
54
|
+
catch (error) {
|
|
55
|
+
return this.panic?.ondelete?.(error) ?? false;
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nemigo/server",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vlad Logvin",
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "svelte-package && rimraf .svelte-kit",
|
|
11
|
+
"build": "bunx --bun svelte-package && bunx --bun rimraf .svelte-kit",
|
|
12
12
|
"check": "bunx --bun tsc --noemit",
|
|
13
13
|
"eslint": "bunx --bun eslint ./",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"lint:fix:unsafe": "biome lint --fix --unsafe",
|
|
18
|
-
"format": "biome check --write --linter-enabled=false"
|
|
14
|
+
"oxlint": "bunx --bun oxlint --config .././../oxlintrc.jsonc --ignore-path ../configs/.eslint.ignore ./",
|
|
15
|
+
"bilint": "bunx --bun biome lint",
|
|
16
|
+
"format": "bunx --bun biome check --write --linter-enabled=false"
|
|
19
17
|
},
|
|
20
18
|
"exports": {
|
|
21
19
|
"./jwt": {
|
|
@@ -28,9 +26,9 @@
|
|
|
28
26
|
}
|
|
29
27
|
},
|
|
30
28
|
"peerDependencies": {
|
|
31
|
-
"@nemigo/helpers": ">=2.
|
|
32
|
-
"@nemigo/storage": ">=2.
|
|
33
|
-
"@redis/client": ">=5.
|
|
29
|
+
"@nemigo/helpers": ">=2.2.0",
|
|
30
|
+
"@nemigo/storage": ">=2.2.0",
|
|
31
|
+
"@redis/client": ">=5.10.0"
|
|
34
32
|
},
|
|
35
33
|
"dependencies": {
|
|
36
34
|
"@types/jsonwebtoken": "9.0.10",
|
|
@@ -38,8 +36,8 @@
|
|
|
38
36
|
},
|
|
39
37
|
"devDependencies": {
|
|
40
38
|
"@redis/client": "5.10.0",
|
|
41
|
-
"@nemigo/configs": "2.
|
|
42
|
-
"@nemigo/helpers": "2.0
|
|
43
|
-
"@nemigo/storage": "2.0
|
|
39
|
+
"@nemigo/configs": "2.2.0",
|
|
40
|
+
"@nemigo/helpers": "2.2.0",
|
|
41
|
+
"@nemigo/storage": "2.2.0"
|
|
44
42
|
}
|
|
45
43
|
}
|