@aooth/auth 0.1.45 → 0.1.46
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/redis.d.cts +21 -4
- package/dist/redis.d.mts +21 -4
- package/package.json +3 -2
package/dist/redis.d.cts
CHANGED
|
@@ -32,15 +32,32 @@ import { t as RateLimitStore } from "./store-N9daSmHS.cjs";
|
|
|
32
32
|
* }
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* Structural compatibility with `ioredis` hinges on two things, both load-
|
|
36
|
+
* bearing — a real `import('ioredis').Redis` is assignable to `RedisLike`
|
|
37
|
+
* with no cast (see `__test__/ioredis-compat.spec.ts`, which guards it):
|
|
38
|
+
*
|
|
39
|
+
* 1. Every member is declared as a **method shorthand**, not a
|
|
40
|
+
* property-style arrow. Method signatures are checked bivariantly in
|
|
41
|
+
* their parameters, so ioredis's overloaded, `Callback`-taking commands
|
|
42
|
+
* match; property-style arrows are contravariant and never would.
|
|
43
|
+
* 2. `set`'s `mode`/`ttlMs` are a **required pair** (not independently
|
|
44
|
+
* optional). ioredis exposes the ms-TTL form as one overload,
|
|
45
|
+
* `set(key, value, "PX", ms, cb?)`, with `"PX"` and `ms` required
|
|
46
|
+
* together — a `mode?`/`ttlMs?` shape matches *no* single ioredis
|
|
47
|
+
* overload (it collides with the `set(key, value, cb?)` overload
|
|
48
|
+
* instead), which is exactly what broke structural assignment before.
|
|
49
|
+
* Every adapter call site already passes all four arguments.
|
|
50
|
+
*
|
|
51
|
+
* Return types are chosen as a supertype of what real clients resolve, so an
|
|
52
|
+
* ioredis client stays assignable while the types remain useful to callers:
|
|
53
|
+
* - `set` returns `string | null` (ioredis resolves `"OK"`)
|
|
37
54
|
* - `del` / `pexpire` / `exists` / `incr` / `sadd` / `srem` return `number`
|
|
38
55
|
* - `get` returns `string | null`
|
|
39
56
|
* - `smembers` returns `string[]`
|
|
40
57
|
*/
|
|
41
58
|
interface RedisLike {
|
|
42
|
-
/** `SET key value
|
|
43
|
-
set(key: string, value: string, mode
|
|
59
|
+
/** `SET key value PX ms` — `mode`/`ttlMs` are a required pair (see above). */
|
|
60
|
+
set(key: string, value: string, mode: "PX", ttlMs: number): Promise<string | null>;
|
|
44
61
|
get(key: string): Promise<string | null>;
|
|
45
62
|
del(...keys: string[]): Promise<number>;
|
|
46
63
|
exists(key: string): Promise<number>;
|
package/dist/redis.d.mts
CHANGED
|
@@ -32,15 +32,32 @@ import { t as RateLimitStore } from "./store-jFgby4bK.mjs";
|
|
|
32
32
|
* }
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* Structural compatibility with `ioredis` hinges on two things, both load-
|
|
36
|
+
* bearing — a real `import('ioredis').Redis` is assignable to `RedisLike`
|
|
37
|
+
* with no cast (see `__test__/ioredis-compat.spec.ts`, which guards it):
|
|
38
|
+
*
|
|
39
|
+
* 1. Every member is declared as a **method shorthand**, not a
|
|
40
|
+
* property-style arrow. Method signatures are checked bivariantly in
|
|
41
|
+
* their parameters, so ioredis's overloaded, `Callback`-taking commands
|
|
42
|
+
* match; property-style arrows are contravariant and never would.
|
|
43
|
+
* 2. `set`'s `mode`/`ttlMs` are a **required pair** (not independently
|
|
44
|
+
* optional). ioredis exposes the ms-TTL form as one overload,
|
|
45
|
+
* `set(key, value, "PX", ms, cb?)`, with `"PX"` and `ms` required
|
|
46
|
+
* together — a `mode?`/`ttlMs?` shape matches *no* single ioredis
|
|
47
|
+
* overload (it collides with the `set(key, value, cb?)` overload
|
|
48
|
+
* instead), which is exactly what broke structural assignment before.
|
|
49
|
+
* Every adapter call site already passes all four arguments.
|
|
50
|
+
*
|
|
51
|
+
* Return types are chosen as a supertype of what real clients resolve, so an
|
|
52
|
+
* ioredis client stays assignable while the types remain useful to callers:
|
|
53
|
+
* - `set` returns `string | null` (ioredis resolves `"OK"`)
|
|
37
54
|
* - `del` / `pexpire` / `exists` / `incr` / `sadd` / `srem` return `number`
|
|
38
55
|
* - `get` returns `string | null`
|
|
39
56
|
* - `smembers` returns `string[]`
|
|
40
57
|
*/
|
|
41
58
|
interface RedisLike {
|
|
42
|
-
/** `SET key value
|
|
43
|
-
set(key: string, value: string, mode
|
|
59
|
+
/** `SET key value PX ms` — `mode`/`ttlMs` are a required pair (see above). */
|
|
60
|
+
set(key: string, value: string, mode: "PX", ttlMs: number): Promise<string | null>;
|
|
44
61
|
get(key: string): Promise<string | null>;
|
|
45
62
|
del(...keys: string[]): Promise<number>;
|
|
46
63
|
exists(key: string): Promise<number>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aooth/auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"description": "Auth method layer for aoothjs (sessions, tokens, password reset, MFA primitives)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aoothjs",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"jose": "^6.2.3",
|
|
107
|
-
"@aooth/user": "0.1.
|
|
107
|
+
"@aooth/user": "0.1.46"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@atscript/core": "^0.1.81",
|
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"@atscript/typescript": "^0.1.81",
|
|
115
115
|
"@types/better-sqlite3": "^7.6.13",
|
|
116
116
|
"better-sqlite3": "^12.6.2",
|
|
117
|
+
"ioredis": "^5.11.1",
|
|
117
118
|
"unplugin-atscript": "^0.1.81"
|
|
118
119
|
},
|
|
119
120
|
"peerDependencies": {
|