@owlmeans/redis 0.1.18-rc.0 → 0.1.18-rc.10
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/README.md +24 -6
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/redis/SKILL.md +25 -5
- package/build/service.d.ts.map +1 -1
- package/build/service.js +1 -16
- package/build/service.js.map +1 -1
- package/build/utils/cluster.d.ts.map +1 -1
- package/build/utils/cluster.js.map +1 -1
- package/build/utils/config.d.ts.map +1 -1
- package/build/utils/instance.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/service.ts +1 -22
- package/tests/context.ts +29 -9
- package/tests/query.spec.ts +111 -0
- package/tests/resource.spec.ts +23 -11
- package/build/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -24,16 +24,20 @@ import { appendRedis, DEFAULT_ALIAS } from '@owlmeans/redis'
|
|
|
24
24
|
appendRedis<C, T>(context)
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Config (`config.json`)
|
|
27
|
+
Config (`config.json`) — `dbs` is a list, and `schema` becomes the key prefix every resource on
|
|
28
|
+
this connection namespaces itself under:
|
|
28
29
|
|
|
29
30
|
```json
|
|
30
31
|
{
|
|
31
|
-
"dbs":
|
|
32
|
-
|
|
32
|
+
"dbs": [
|
|
33
|
+
{
|
|
34
|
+
"service": "redis",
|
|
35
|
+
"alias": "redis",
|
|
33
36
|
"host": "localhost",
|
|
34
|
-
"port": 6379
|
|
37
|
+
"port": 6379,
|
|
38
|
+
"schema": "app"
|
|
35
39
|
}
|
|
36
|
-
|
|
40
|
+
]
|
|
37
41
|
}
|
|
38
42
|
```
|
|
39
43
|
|
|
@@ -49,7 +53,21 @@ Registers the Redis service in the context.
|
|
|
49
53
|
|
|
50
54
|
### `RedisMeta`
|
|
51
55
|
|
|
52
|
-
Extends `RedisOptions` (ioredis) — all ioredis connection options are supported in config.
|
|
56
|
+
Extends `RedisOptions` (ioredis) — all ioredis connection options are supported in config. Set
|
|
57
|
+
the database index with `dbIndex` (it accepts a string, so it can come from a file-mounted config
|
|
58
|
+
value) rather than ioredis' own `db`.
|
|
59
|
+
|
|
60
|
+
## Server Requirements
|
|
61
|
+
|
|
62
|
+
- Redis **6.2 or newer** — `@owlmeans/redis-resource` deletes with `GETDEL`.
|
|
63
|
+
- `notify-keyspace-events` enabled if any resource uses `watch`; keyspace events are emitted on
|
|
64
|
+
**db 0**, so deployments sharing an instance isolate on the key prefix, not on `dbIndex`.
|
|
65
|
+
|
|
66
|
+
## Tests
|
|
67
|
+
|
|
68
|
+
`tests/` holds the integration specs for the `@owlmeans/redis-resource` contract — this is the
|
|
69
|
+
package that supplies the connection it runs against. Gated on `REDIS_URL` (see `/.env.example`):
|
|
70
|
+
`bun test ./tests`.
|
|
53
71
|
|
|
54
72
|
## Related Packages
|
|
55
73
|
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/redis",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.10",
|
|
5
|
+
"generatedAt": "2026-09-01T16:28:56.997Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/redis
|
|
9
9
|
|
|
10
10
|
**Layer:** Infra
|
|
11
|
-
**Install:** `"@owlmeans/redis": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/redis": "^0.1.18-rc.10"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
@@ -21,13 +21,33 @@ user-invocable: false
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
import { makeRedisService } from '@owlmeans/redis'
|
|
25
|
-
context.registerService(makeRedisService())
|
|
24
|
+
import { appendRedis, makeRedisService } from '@owlmeans/redis'
|
|
25
|
+
context.registerService(makeRedisService()) // or appendRedis(context)
|
|
26
26
|
|
|
27
|
-
// Connection settings via cfg.
|
|
27
|
+
// Connection settings via cfg.dbs — a LIST of DbConfig entries
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
`cfg.dbs[].schema` is the key prefix; every resource on the connection namespaces itself as
|
|
31
|
+
`<schema>-<resource alias>:<id>`. Choose the database index with `meta.dbIndex` (a string is
|
|
32
|
+
accepted, so it can come from a file-mounted config value), never ioredis' own `db`.
|
|
33
|
+
|
|
34
|
+
## Server Requirements
|
|
35
|
+
|
|
36
|
+
- Redis **6.2 or newer** — `@owlmeans/redis-resource` deletes with `GETDEL`, which is the whole
|
|
37
|
+
reason `delete`/`take` hand back the record they removed without a preceding read.
|
|
38
|
+
- `notify-keyspace-events` enabled if any resource uses `watch`. Keyspace events are emitted on
|
|
39
|
+
**db 0**, so deployments sharing one instance isolate on the key prefix, not on `dbIndex`.
|
|
40
|
+
- **A single server for anything answering criteria.** A resource answers `list`/`count`/`purge`
|
|
41
|
+
and `load(where)` by walking its own prefix with `SCAN`, which reaches one server — so in a
|
|
42
|
+
clustered deployment those calls see a fraction of the keyspace. Keep clustered resources on the
|
|
43
|
+
by-id operations, or put the data in mongo or postgres.
|
|
44
|
+
|
|
45
|
+
## Tests
|
|
46
|
+
|
|
47
|
+
This package's `tests/` hold the integration specs for the `@owlmeans/redis-resource` contract —
|
|
48
|
+
it supplies the connection they run against. Gated on `REDIS_URL` (see `/.env.example`).
|
|
49
|
+
|
|
30
50
|
## Depends On
|
|
31
51
|
|
|
32
|
-
- `@owlmeans/server-context`, `@owlmeans/resource`
|
|
52
|
+
- `@owlmeans/server-context`, `@owlmeans/resource`, `@owlmeans/redis-resource`
|
|
33
53
|
- `ioredis` (runtime)
|
package/build/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,0BAA0B,CAAA;AAIpF,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG3E,KAAK,MAAM,GAAG,YAAY,CAAA;AAC1B,UAAU,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;CAAI;AAEzE,eAAO,MAAM,gBAAgB,GAAI,QAAO,MAAsB,KAAG,cAoDhE,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC7E,SAAS,CAAC,EAAE,QAAO,MAAsB,KACxC,CAMF,CAAA"}
|
package/build/service.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ALIAS } from './consts.js';
|
|
2
2
|
import { createDbService } from '@owlmeans/resource';
|
|
3
|
-
import { assertContext
|
|
3
|
+
import { assertContext } from '@owlmeans/context';
|
|
4
4
|
import { createClient } from './utils/index.js';
|
|
5
5
|
export const makeRedisService = (alias = DEFAULT_ALIAS) => {
|
|
6
6
|
const location = `redis:${alias}`;
|
|
@@ -20,15 +20,6 @@ export const makeRedisService = (alias = DEFAULT_ALIAS) => {
|
|
|
20
20
|
if (service.clients[configAlias] != null) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
if (service.layers == null) {
|
|
24
|
-
service.layers = [Layer.Global];
|
|
25
|
-
}
|
|
26
|
-
if (config.serviceSensitive && service.layers.includes(Layer.Service)) {
|
|
27
|
-
service.layers.push(Layer.Service);
|
|
28
|
-
}
|
|
29
|
-
if (config.entitySensitive && service.layers.includes(Layer.Entity)) {
|
|
30
|
-
service.layers.push(Layer.Entity);
|
|
31
|
-
}
|
|
32
23
|
let client = await createClient(config);
|
|
33
24
|
// we need to check all hosts for replication consistancy
|
|
34
25
|
if (service.clients[configAlias] != null) {
|
|
@@ -38,12 +29,6 @@ export const makeRedisService = (alias = DEFAULT_ALIAS) => {
|
|
|
38
29
|
client.quit();
|
|
39
30
|
});
|
|
40
31
|
service.clients[configAlias] = client;
|
|
41
|
-
},
|
|
42
|
-
reinitializeContext: (context) => {
|
|
43
|
-
const _service = makeRedisService(alias);
|
|
44
|
-
_service.ctx = context;
|
|
45
|
-
_service.layers = service.layers;
|
|
46
|
-
return _service;
|
|
47
32
|
}
|
|
48
33
|
}, service => async () => {
|
|
49
34
|
const context = assertContext(service.ctx, location);
|
package/build/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAK/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAgB,aAAa,EAAkB,EAAE;IAChF,MAAM,QAAQ,GAAG,SAAS,KAAK,EAAE,CAAA;IAEjC,MAAM,OAAO,GAAmB,eAAe,CAC7C,KAAK,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QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;YACpG,MAAM,IAAI,CAAA;YACV,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACtC,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;QAErB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAAU,EAAE,QAAgB,aAAa,EACtC,EAAE;IACL,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAEvC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAEhC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../src/utils/cluster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAIjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../src/utils/cluster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAIjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,aAAa,GAAU,QAAQ,QAAQ,CAAC,SAAS,CAAC,KAAG,OAAO,CAAC,OAAO,CAu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CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC/B,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;YAC9B,MAAM;YACN,KAAK;YACL,KAAK,EAAE,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAClD,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACvF,CAAC,CAAC,CAAC,IAAI;SACT,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAoB5C,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAoB5C,eAAO,MAAM,yBAAyB,GAAI,QAAQ,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,MAAM,KAAG,YAWtF,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,QAAQ,QAAQ,CAAC,SAAS,CAAC,KAAG;IAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAiBvH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/utils/instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAK3D,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/utils/instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAK3D,eAAO,MAAM,YAAY,GAAU,QAAQ,QAAQ,KAAG,OAAO,CAAC,WAAW,CASxE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/redis",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@owlmeans/dep-config": "workspace:*",
|
|
26
|
-
"@owlmeans/test-integration": "^0.1.18-rc.
|
|
27
|
-
"@types/bun": "^1.
|
|
26
|
+
"@owlmeans/test-integration": "^0.1.18-rc.7",
|
|
27
|
+
"@types/bun": "^1.4.0",
|
|
28
28
|
"@types/node": "^26.1.0",
|
|
29
29
|
"nodemon": "^3.1.14",
|
|
30
30
|
"typescript": "^7.0.2"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@noble/hashes": "^1.5.0",
|
|
34
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
35
|
-
"@owlmeans/redis-resource": "^0.1.18-rc.
|
|
36
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
37
|
-
"@owlmeans/server-context": "^0.1.18-rc.
|
|
34
|
+
"@owlmeans/context": "^0.1.18-rc.7",
|
|
35
|
+
"@owlmeans/redis-resource": "^0.1.18-rc.10",
|
|
36
|
+
"@owlmeans/resource": "^0.1.18-rc.8",
|
|
37
|
+
"@owlmeans/server-context": "^0.1.18-rc.10",
|
|
38
38
|
"@scure/base": "^2.3.0",
|
|
39
39
|
"ioredis": "^5.4.1"
|
|
40
40
|
},
|
package/src/service.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { RedisDbService, RedisClient, RedisDb } from '@owlmeans/redis-resource'
|
|
2
2
|
import { DEFAULT_ALIAS } from './consts.js'
|
|
3
3
|
import { createDbService } from '@owlmeans/resource'
|
|
4
|
-
import { assertContext
|
|
5
|
-
import type { BasicContext } from '@owlmeans/context'
|
|
4
|
+
import { assertContext } from '@owlmeans/context'
|
|
6
5
|
import type { ServerContext, ServerConfig } from '@owlmeans/server-context'
|
|
7
6
|
import { createClient } from './utils/index.js'
|
|
8
7
|
|
|
@@ -34,16 +33,6 @@ export const makeRedisService = (alias: string = DEFAULT_ALIAS): RedisDbService
|
|
|
34
33
|
return
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
if (service.layers == null) {
|
|
38
|
-
service.layers = [Layer.Global]
|
|
39
|
-
}
|
|
40
|
-
if (config.serviceSensitive && service.layers.includes(Layer.Service)) {
|
|
41
|
-
service.layers.push(Layer.Service)
|
|
42
|
-
}
|
|
43
|
-
if (config.entitySensitive && service.layers.includes(Layer.Entity)) {
|
|
44
|
-
service.layers.push(Layer.Entity)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
36
|
let client = await createClient(config)
|
|
48
37
|
|
|
49
38
|
// we need to check all hosts for replication consistancy
|
|
@@ -57,16 +46,6 @@ export const makeRedisService = (alias: string = DEFAULT_ALIAS): RedisDbService
|
|
|
57
46
|
})
|
|
58
47
|
|
|
59
48
|
service.clients[configAlias] = client
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
reinitializeContext: <T>(context: BasicContext<ServerConfig>) => {
|
|
63
|
-
const _service = makeRedisService(alias)
|
|
64
|
-
|
|
65
|
-
_service.ctx = context
|
|
66
|
-
|
|
67
|
-
_service.layers = service.layers
|
|
68
|
-
|
|
69
|
-
return _service as T
|
|
70
49
|
}
|
|
71
50
|
}, service => async () => {
|
|
72
51
|
const context = assertContext<Config, Context>(service.ctx as Context, location)
|
package/tests/context.ts
CHANGED
|
@@ -28,11 +28,15 @@ export interface RedisSuite {
|
|
|
28
28
|
* One key prefix per suite, dropped by that suite's own `afterAll` — Bun runs every spec
|
|
29
29
|
* file of a package in one process, so a process-global cleanup queue would let the first
|
|
30
30
|
* file to finish flush the keys of the files still to come.
|
|
31
|
+
*
|
|
32
|
+
* A spec that walks the namespace — `list`, `count`, `purge` — boots under its own resource
|
|
33
|
+
* alias, because a resource's keys are namespaced by `<schema>-<alias>` and the walk sees every
|
|
34
|
+
* key of the alias it belongs to, including the ones an earlier test in the same file left.
|
|
31
35
|
*/
|
|
32
36
|
export const makeSuite = (label: string): RedisSuite => {
|
|
33
37
|
const base = process.env.REDIS_TEST_KEY_PREFIX ?? 'omt'
|
|
34
38
|
const prefix = randomNamespace(`${base}_${label}`)
|
|
35
|
-
const
|
|
39
|
+
const resources: Array<RedisResource<TestRecord>> = []
|
|
36
40
|
|
|
37
41
|
const boot = async (alias = 'test-records'): Promise<{
|
|
38
42
|
context: ServerContext<ServerConfig>
|
|
@@ -58,26 +62,42 @@ export const makeSuite = (label: string): RedisSuite => {
|
|
|
58
62
|
|
|
59
63
|
context.configure()
|
|
60
64
|
await context.init()
|
|
61
|
-
|
|
65
|
+
const booted = context.resource<RedisResource<TestRecord>>(alias)
|
|
66
|
+
resources.push(booted)
|
|
62
67
|
|
|
63
|
-
return { context, resource:
|
|
68
|
+
return { context, resource: booted }
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Every key the suite wrote, matched as `<prefix>*` rather than `<prefix>:*`: a resource
|
|
73
|
+
* namespaces its keys as `<schema>-<alias>:<id>`, so the schema is followed by a dash, not
|
|
74
|
+
* by the separator. SCAN for the same reason the resource uses it — KEYS blocks the server.
|
|
75
|
+
*/
|
|
66
76
|
const teardown = async (): Promise<void> => {
|
|
67
77
|
if (gate.skip) {
|
|
68
78
|
return
|
|
69
79
|
}
|
|
70
|
-
for (const
|
|
71
|
-
const resource = context.resource<RedisResource<TestRecord>>('test-records')
|
|
80
|
+
for (const resource of resources) {
|
|
72
81
|
const client = resource.db?.client
|
|
73
82
|
if (client == null) continue
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
try {
|
|
84
|
+
const keys: string[] = []
|
|
85
|
+
let cursor = '0'
|
|
86
|
+
do {
|
|
87
|
+
const [next, batch] = await client.scan(cursor, 'MATCH', `${prefix}*`, 'COUNT', 500)
|
|
88
|
+
cursor = next
|
|
89
|
+
keys.push(...batch)
|
|
90
|
+
} while (cursor !== '0')
|
|
91
|
+
if (keys.length > 0) {
|
|
92
|
+
await client.del(keys)
|
|
93
|
+
}
|
|
94
|
+
} catch {
|
|
95
|
+
// A connection already gone takes its keys' cleanup with it — the prefix is unique
|
|
96
|
+
// per run, so anything left behind never collides with another suite.
|
|
77
97
|
}
|
|
78
98
|
await client.quit().catch(() => undefined)
|
|
79
99
|
}
|
|
80
|
-
|
|
100
|
+
resources.length = 0
|
|
81
101
|
}
|
|
82
102
|
|
|
83
103
|
return { prefix, boot, teardown }
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { afterAll, describe, expect, test } from 'bun:test'
|
|
2
|
+
import { gate, makeSuite } from './context.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The criteria surface.
|
|
6
|
+
*
|
|
7
|
+
* Redis has no index, so anything that is not a bare id is a SCAN of the resource's own namespace
|
|
8
|
+
* evaluated in memory. These assert what that walk owes the caller: criteria reads, an unpaged
|
|
9
|
+
* default, the window that was actually asked for, a total that always counts every match, and a
|
|
10
|
+
* purge that refuses to empty the namespace on an unset filter.
|
|
11
|
+
*/
|
|
12
|
+
describe('@owlmeans/redis — resource queries', () => {
|
|
13
|
+
if (gate.skip) {
|
|
14
|
+
test.skip(gate.reason ?? 'redis gate closed', () => { })
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const suite = makeSuite('query')
|
|
19
|
+
|
|
20
|
+
afterAll(async () => {
|
|
21
|
+
await suite.teardown()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
/** `rec-0` … `rec-<count-1>`, alternating `even` / `odd`, in a namespace of their own. */
|
|
25
|
+
const seed = async (alias: string, count: number) => {
|
|
26
|
+
const { resource } = await suite.boot(alias)
|
|
27
|
+
for (let index = 0; index < count; index++) {
|
|
28
|
+
await resource.create({ id: `rec-${index}`, value: index % 2 === 0 ? 'even' : 'odd' })
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return resource
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
test('load takes criteria, not only an id', async () => {
|
|
35
|
+
const resource = await seed('q-load', 0)
|
|
36
|
+
await resource.create({ id: 'one', value: 'needle' })
|
|
37
|
+
await resource.create({ id: 'two', value: 'hay' })
|
|
38
|
+
|
|
39
|
+
expect(await resource.load({ value: 'needle' })).toMatchObject({ id: 'one' })
|
|
40
|
+
expect(await resource.load({ value: 'absent' })).toBeNull()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('get throws when nothing matches the criteria', async () => {
|
|
44
|
+
const resource = await seed('q-get', 0)
|
|
45
|
+
|
|
46
|
+
await expect(resource.get({ value: 'absent' })).rejects.toThrow()
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('list returns every match when no size is asked for', async () => {
|
|
50
|
+
const resource = await seed('q-unpaged', 5)
|
|
51
|
+
|
|
52
|
+
const result = await resource.list()
|
|
53
|
+
|
|
54
|
+
expect(result.items).toHaveLength(5)
|
|
55
|
+
expect(result.total).toBe(5)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('list returns the page it was asked for, not the list minus that page', async () => {
|
|
59
|
+
const resource = await seed('q-paged', 5)
|
|
60
|
+
|
|
61
|
+
const result = await resource.list({}, { page: 1, size: 2, sort: ['id'] })
|
|
62
|
+
|
|
63
|
+
expect(result.items.map(item => item.id)).toEqual(['rec-2', 'rec-3'])
|
|
64
|
+
expect(result.total).toBe(5)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('a page without a size is a caller error', async () => {
|
|
68
|
+
const resource = await seed('q-page-only', 1)
|
|
69
|
+
|
|
70
|
+
await expect(resource.list({}, { page: 1 })).rejects.toThrow()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('count answers the match count', async () => {
|
|
74
|
+
const resource = await seed('q-count', 5)
|
|
75
|
+
|
|
76
|
+
expect(await resource.count()).toBe(5)
|
|
77
|
+
expect(await resource.count({ value: 'even' })).toBe(3)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
test('purge deletes every match and refuses empty criteria', async () => {
|
|
81
|
+
const resource = await seed('q-purge', 5)
|
|
82
|
+
|
|
83
|
+
expect(await resource.purge({ value: 'odd' })).toBe(2)
|
|
84
|
+
expect(await resource.count()).toBe(3)
|
|
85
|
+
await expect(resource.purge({})).rejects.toThrow()
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('update replaces the record rather than merging into it', async () => {
|
|
89
|
+
const resource = await seed('q-update', 0)
|
|
90
|
+
await resource.create({ id: 'replaced', value: 'before' })
|
|
91
|
+
|
|
92
|
+
await resource.update({ id: 'replaced' })
|
|
93
|
+
|
|
94
|
+
expect(await resource.load('replaced')).toEqual({ id: 'replaced' })
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
test('update throws for an id that was never created', async () => {
|
|
98
|
+
const resource = await seed('q-missing', 0)
|
|
99
|
+
|
|
100
|
+
await expect(resource.update({ id: 'never-created' })).rejects.toThrow()
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('save creates a record that carries no id', async () => {
|
|
104
|
+
const resource = await seed('q-save', 0)
|
|
105
|
+
|
|
106
|
+
const saved = await resource.save({ value: 'fresh' })
|
|
107
|
+
|
|
108
|
+
expect(typeof saved.id).toBe('string')
|
|
109
|
+
expect(await resource.load(saved.id)).toMatchObject({ value: 'fresh' })
|
|
110
|
+
})
|
|
111
|
+
})
|
package/tests/resource.spec.ts
CHANGED
|
@@ -2,13 +2,12 @@ import { afterAll, describe, expect, test } from 'bun:test'
|
|
|
2
2
|
import { gate, makeSuite } from './context.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* `delete`
|
|
5
|
+
* `delete` / `take` coverage.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `issueChallenge` upserts by deleting first — and left consumed codes alive in the store.
|
|
7
|
+
* Both drop the key with GETDEL and hand back what was under it; they differ only in what an
|
|
8
|
+
* absent id means — `delete` answers `null`, `take` throws. The by-id form carries the whole
|
|
9
|
+
* contract: a `delete(id)` that returns without touching redis leaves consumed OTP codes alive
|
|
10
|
+
* in the store and turns the next `create` under that id into `RecordExists`.
|
|
12
11
|
*/
|
|
13
12
|
describe('@owlmeans/redis — resource delete', () => {
|
|
14
13
|
if (gate.skip) {
|
|
@@ -22,7 +21,7 @@ describe('@owlmeans/redis — resource delete', () => {
|
|
|
22
21
|
await suite.teardown()
|
|
23
22
|
})
|
|
24
23
|
|
|
25
|
-
test('removes the record when called by id
|
|
24
|
+
test('removes the record when called by id', async () => {
|
|
26
25
|
const { resource } = await suite.boot()
|
|
27
26
|
await resource.create({ id: 'by-id', value: 'first' })
|
|
28
27
|
|
|
@@ -46,11 +45,24 @@ describe('@owlmeans/redis — resource delete', () => {
|
|
|
46
45
|
expect((await resource.load('otp'))?.value).toBe('second-code')
|
|
47
46
|
})
|
|
48
47
|
|
|
49
|
-
test('
|
|
48
|
+
test('take hands back the record it removed', async () => {
|
|
50
49
|
const { resource } = await suite.boot()
|
|
51
|
-
|
|
50
|
+
await resource.create({ id: 'taken', value: 'once' })
|
|
52
51
|
|
|
53
|
-
expect(await resource.
|
|
54
|
-
expect(await resource.load('
|
|
52
|
+
expect(await resource.take('taken')).toMatchObject({ value: 'once' })
|
|
53
|
+
expect(await resource.load('taken')).toBeNull()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('take throws for an id that is not there', async () => {
|
|
57
|
+
const { resource } = await suite.boot()
|
|
58
|
+
|
|
59
|
+
await expect(resource.take('never-taken')).rejects.toThrow()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('create refuses an id that is already taken', async () => {
|
|
63
|
+
const { resource } = await suite.boot()
|
|
64
|
+
await resource.create({ id: 'occupied', value: 'first' })
|
|
65
|
+
|
|
66
|
+
await expect(resource.create({ id: 'occupied', value: 'second' })).rejects.toThrow()
|
|
55
67
|
})
|
|
56
68
|
})
|
package/build/.gitkeep
DELETED
|
File without changes
|