@nemigo/server 2.0.0 → 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 CHANGED
@@ -25,7 +25,7 @@ export class JWT {
25
25
  return null;
26
26
  return jwt.verify(token, this.ctx.signature);
27
27
  }
28
- catch (_) {
28
+ catch {
29
29
  return null;
30
30
  }
31
31
  }
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 (err) {
21
- return this.panic?.onhas?.(err) ?? false;
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 (err) {
31
- return this.panic?.onget?.(err);
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
- return await this.panic?.onset?.(new Error(`Redis SET returned: ${result}`));
39
+ if (result !== "OK") {
40
+ // noinspection ExceptionCaughtLocallyJS
41
+ throw new Error(`Redis SET returned: ${result}`);
42
+ }
41
43
  }
42
44
  catch (error) {
43
- return this.panic?.onset?.(error);
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 (err) {
53
- return this.panic?.ondelete?.(err) ?? false;
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.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",
12
- "check": "tsc --noemit",
13
- "eslint": "eslint ./",
14
- "eslint:fix": "eslint --fix ./",
15
- "lint": "biome lint",
16
- "lint:fix": "biome lint --fix --unsafe",
17
- "lint:fix:unsafe": "biome lint --fix --unsafe",
18
- "format": "biome check --write --linter-enabled=false"
11
+ "build": "bunx --bun svelte-package && bunx --bun rimraf .svelte-kit",
12
+ "check": "bunx --bun tsc --noemit",
13
+ "eslint": "bunx --bun eslint ./",
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,17 +26,18 @@
28
26
  }
29
27
  },
30
28
  "peerDependencies": {
31
- "@nemigo/helpers": ">=2.0.0",
32
- "@nemigo/storage": ">=2.0.0"
29
+ "@nemigo/helpers": ">=2.2.0",
30
+ "@nemigo/storage": ">=2.2.0",
31
+ "@redis/client": ">=5.10.0"
33
32
  },
34
33
  "dependencies": {
35
- "@redis/client": "5.9.0",
36
34
  "@types/jsonwebtoken": "9.0.10",
37
35
  "jsonwebtoken": "9.0.2"
38
36
  },
39
37
  "devDependencies": {
40
- "@nemigo/configs": "2.0.0",
41
- "@nemigo/helpers": "2.0.0",
42
- "@nemigo/storage": "2.0.0"
38
+ "@redis/client": "5.10.0",
39
+ "@nemigo/configs": "2.2.0",
40
+ "@nemigo/helpers": "2.2.0",
41
+ "@nemigo/storage": "2.2.0"
43
42
  }
44
43
  }