@mmmnt/feat-adapter-redis 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +25 -2
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +389 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Moment
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mmmnt/feat-adapter-redis
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Redis service adapter for Feat (SPEC-ADPRDS-001): a snapshot diff of the namespace's keys, state by key or namespace
|
|
4
|
+
scan, seeding, reset, and the instrument's credential and CA read from files.
|
|
5
|
+
|
|
6
|
+
```json
|
|
7
|
+
{
|
|
8
|
+
"services": {
|
|
9
|
+
"cache": {
|
|
10
|
+
"adapter": "@mmmnt/feat-adapter-redis",
|
|
11
|
+
"options": {
|
|
12
|
+
"urlFile": "secrets/redis.url",
|
|
13
|
+
"auth": { "user": "default", "passwordFile": "secrets/redis.password" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Options: `url` | `urlEnv` | `urlFile` (redis:// or rediss://, never with credentials in it); `auth` either
|
|
21
|
+
`{ username?, password }` (environment-variable names) or `{ user, passwordFile }` (`default` for a requirepass server);
|
|
22
|
+
`tlsCAFile` (PEM, rediss:// only).
|
|
23
|
+
|
|
24
|
+
The system under test writes every key under the namespace prefix `<namespace>:`. Records:
|
|
25
|
+
`{ type: INSERT | MODIFY | REMOVE, key: <without the prefix>, payload: { kind, value } }`, kinds string, set, hash,
|
|
26
|
+
list, zset. Seeds: `{ type: <kind>, values: { key, value } }`. The fault catalog is empty. See DESIGN.md.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { FeatServiceAdapter } from "@mmmnt/feat-types";
|
|
2
|
+
export type RedisAdapterErrorCode = "NAMESPACE_INVALID" | "REDIS_UNREACHABLE" | "KIND_UNSUPPORTED" | "SEED_INVALID" | "FAULT_UNSUPPORTED" | "OPTIONS_INVALID" | "CREDENTIAL_FILE_UNREADABLE";
|
|
3
|
+
export declare class RedisAdapterError extends Error {
|
|
4
|
+
readonly code: RedisAdapterErrorCode;
|
|
5
|
+
readonly detail: string;
|
|
6
|
+
constructor(code: RedisAdapterErrorCode, detail: string);
|
|
7
|
+
}
|
|
8
|
+
/** The instrument's credentials as environment-variable names. */
|
|
9
|
+
export interface RedisAuthFromEnv {
|
|
10
|
+
/** Name of the environment variable holding the ACL user name; omit for the `default` user. */
|
|
11
|
+
username?: string;
|
|
12
|
+
/** Name of the environment variable holding the password. */
|
|
13
|
+
password: string;
|
|
14
|
+
}
|
|
15
|
+
/** The instrument's credentials with the password in a file. */
|
|
16
|
+
export interface RedisAuthFromFile {
|
|
17
|
+
/** The ACL user name itself (not a secret); `default` for a `requirepass` server. */
|
|
18
|
+
user: string;
|
|
19
|
+
/** Path of a file whose content is the password; a relative path is resolved against the working directory. */
|
|
20
|
+
passwordFile: string;
|
|
21
|
+
}
|
|
22
|
+
export interface RedisOptions {
|
|
23
|
+
/** redis:// or rediss:// (TLS). No credentials in it: give them in `auth`. */
|
|
24
|
+
url?: string;
|
|
25
|
+
/** Name of the environment variable holding the URL. */
|
|
26
|
+
urlEnv?: string;
|
|
27
|
+
/** Path of a file whose content is the URL; relative to the working directory. */
|
|
28
|
+
urlFile?: string;
|
|
29
|
+
/** The instrument's credentials: environment-variable names, or a password file. Never both forms. Omit for a server without auth. */
|
|
30
|
+
auth?: RedisAuthFromEnv | RedisAuthFromFile;
|
|
31
|
+
/** Path of a PEM file of the CA the server's certificate is verified against; only with a rediss:// URL. */
|
|
32
|
+
tlsCAFile?: string;
|
|
33
|
+
}
|
|
34
|
+
/** What one key holds, as JSON: the Redis type and its value in a canonical order. */
|
|
35
|
+
export type KeyState = {
|
|
36
|
+
kind: "string";
|
|
37
|
+
value: string;
|
|
38
|
+
} | {
|
|
39
|
+
kind: "set";
|
|
40
|
+
value: string[];
|
|
41
|
+
} | {
|
|
42
|
+
kind: "hash";
|
|
43
|
+
value: Record<string, string>;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "list";
|
|
46
|
+
value: string[];
|
|
47
|
+
} | {
|
|
48
|
+
kind: "zset";
|
|
49
|
+
value: {
|
|
50
|
+
member: string;
|
|
51
|
+
score: number;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
export declare function createAdapter(config: Record<string, unknown>): FeatServiceAdapter;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAIV,kBAAkB,EAGnB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,qBAAqB,GAC7B,mBAAmB,GACnB,mBAAmB,GACnB,kBAAkB,GAClB,cAAc,GACd,mBAAmB,GACnB,iBAAiB,GACjB,4BAA4B,CAAC;AAEjC,qBAAa,iBAAkB,SAAQ,KAAK;IAExC,QAAQ,CAAC,IAAI,EAAE,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM;gBADd,IAAI,EAAE,qBAAqB,EAC3B,MAAM,EAAE,MAAM;CAK1B;AAED,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sIAAsI;IACtI,IAAI,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IAC5C,4GAA4G;IAC5G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAQD,sFAAsF;AACtF,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC;AAqXjE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAEjF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
// @mmmnt/feat-adapter-redis (SPEC-ADPRDS-001) — Redis as a Feat service.
|
|
2
|
+
//
|
|
3
|
+
// Redis has no change feed a client can read back for a window (keyspace notifications are fire-and-forget pub/sub and
|
|
4
|
+
// carry no values), so the capture window is a SNAPSHOT of the namespace's keys taken at start and compared at
|
|
5
|
+
// peek/stop, as the Neo4j adapter does. The namespace is a key prefix, `<namespace>:`, that every key the system writes
|
|
6
|
+
// carries; the adapter reports keys with the prefix removed.
|
|
7
|
+
//
|
|
8
|
+
// The instrument's connection takes its credential and its CA from files the options name by path (the rule
|
|
9
|
+
// SPEC-ADPKUR-005 and SPEC-ADPNEO-003 set): a credential is never required to sit in an environment variable.
|
|
10
|
+
import { readFileSync, statSync } from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { createClient } from "redis";
|
|
13
|
+
export class RedisAdapterError extends Error {
|
|
14
|
+
code;
|
|
15
|
+
detail;
|
|
16
|
+
constructor(code, detail) {
|
|
17
|
+
super(`${code}: ${detail}`);
|
|
18
|
+
this.code = code;
|
|
19
|
+
this.detail = detail;
|
|
20
|
+
this.name = "RedisAdapterError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const NAMESPACE_PATTERN = /^s[0-9a-f]{12}$/;
|
|
24
|
+
const SCAN_COUNT = "1000";
|
|
25
|
+
const KINDS = ["string", "set", "hash", "list", "zset"];
|
|
26
|
+
const byKey = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
27
|
+
function stable(v) {
|
|
28
|
+
return JSON.stringify(v, (_k, x) => x !== null && typeof x === "object" && !Array.isArray(x)
|
|
29
|
+
? Object.fromEntries(Object.entries(x).sort(([a], [b]) => byKey(a, b)))
|
|
30
|
+
: x);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A file the options name by path. Relative to the working directory; exactly one trailing LF or CRLF is removed and
|
|
34
|
+
* nothing else. The refusal's detail names the option, the path and the cause, never the content.
|
|
35
|
+
*/
|
|
36
|
+
function readCredentialFile(option, file, keepContent = false) {
|
|
37
|
+
const at = path.resolve(process.cwd(), file);
|
|
38
|
+
const refuse = (cause) => new RedisAdapterError("CREDENTIAL_FILE_UNREADABLE", `options.${option} names ${at}, which ${cause}`);
|
|
39
|
+
let content;
|
|
40
|
+
try {
|
|
41
|
+
if (statSync(at).isDirectory())
|
|
42
|
+
throw refuse("is a directory");
|
|
43
|
+
content = readFileSync(at, "utf8");
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
if (e instanceof RedisAdapterError)
|
|
47
|
+
throw e;
|
|
48
|
+
const code = typeof e === "object" && e !== null && "code" in e ? String(e.code) : "";
|
|
49
|
+
if (code === "ENOENT")
|
|
50
|
+
throw refuse("is missing");
|
|
51
|
+
if (code === "EISDIR")
|
|
52
|
+
throw refuse("is a directory");
|
|
53
|
+
throw refuse(`cannot be read (${code || "unknown error"})`);
|
|
54
|
+
}
|
|
55
|
+
if (keepContent) {
|
|
56
|
+
if (content.trim() === "")
|
|
57
|
+
throw refuse("is empty");
|
|
58
|
+
return content;
|
|
59
|
+
}
|
|
60
|
+
const value = content.endsWith("\r\n") ? content.slice(0, -2) : content.endsWith("\n") ? content.slice(0, -1) : content;
|
|
61
|
+
if (value === "")
|
|
62
|
+
throw refuse("is empty");
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
/** A URL without any credentials in it, for a message. */
|
|
66
|
+
function redact(url) {
|
|
67
|
+
return url.replace(/\/\/[^@/]*@/, "//");
|
|
68
|
+
}
|
|
69
|
+
/** A hash reply as an object with its fields sorted: RESP2 answers [field, value, ...], RESP3 a map (an object or a Map). */
|
|
70
|
+
function pairs(reply) {
|
|
71
|
+
let out;
|
|
72
|
+
if (Array.isArray(reply)) {
|
|
73
|
+
out = [];
|
|
74
|
+
for (let i = 0; i + 1 < reply.length; i += 2)
|
|
75
|
+
out.push([String(reply[i]), String(reply[i + 1])]);
|
|
76
|
+
}
|
|
77
|
+
else if (reply instanceof Map) {
|
|
78
|
+
out = [...reply].map(([k, v]) => [String(k), String(v)]);
|
|
79
|
+
}
|
|
80
|
+
else if (reply !== null && typeof reply === "object") {
|
|
81
|
+
out = Object.entries(reply).map(([k, v]) => [k, String(v)]);
|
|
82
|
+
}
|
|
83
|
+
else
|
|
84
|
+
out = [];
|
|
85
|
+
return Object.fromEntries(out.sort(([a], [b]) => byKey(a, b)));
|
|
86
|
+
}
|
|
87
|
+
/** A ZRANGE WITHSCORES reply in score order: RESP2 answers [member, score, ...], RESP3 [[member, score], ...]. */
|
|
88
|
+
function scored(reply) {
|
|
89
|
+
const items = Array.isArray(reply) ? reply : [];
|
|
90
|
+
if (items.every((x) => Array.isArray(x)))
|
|
91
|
+
return items.map((x) => ({ member: String(x[0]), score: Number(x[1]) }));
|
|
92
|
+
const out = [];
|
|
93
|
+
for (let i = 0; i + 1 < items.length; i += 2)
|
|
94
|
+
out.push({ member: String(items[i]), score: Number(items[i + 1]) });
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
class RedisAdapter {
|
|
98
|
+
observes = { diff: "snapshot", state: true };
|
|
99
|
+
/** No fault Redis can arm for one namespace alone: a fault is FAULT_UNSUPPORTED (the catalog is empty). */
|
|
100
|
+
faults = {};
|
|
101
|
+
namespace;
|
|
102
|
+
options;
|
|
103
|
+
client;
|
|
104
|
+
baseline;
|
|
105
|
+
/** How the last read() found its records: "KeyedLookup" or "NamespaceScan". */
|
|
106
|
+
lastReadVia = null;
|
|
107
|
+
constructor(config) {
|
|
108
|
+
const ns = config.namespace;
|
|
109
|
+
if (typeof ns !== "string" || !NAMESPACE_PATTERN.test(ns)) {
|
|
110
|
+
throw new RedisAdapterError("NAMESPACE_INVALID", `'${String(ns)}' does not match ${NAMESPACE_PATTERN.source}, the pattern the runner derives`);
|
|
111
|
+
}
|
|
112
|
+
this.namespace = ns;
|
|
113
|
+
this.options = config.options ?? {};
|
|
114
|
+
}
|
|
115
|
+
reportedNamespace() {
|
|
116
|
+
return this.namespace;
|
|
117
|
+
}
|
|
118
|
+
get prefix() {
|
|
119
|
+
return `${this.namespace}:`;
|
|
120
|
+
}
|
|
121
|
+
// ── the instrument connection ─────────────────────────────────────────────
|
|
122
|
+
resolved;
|
|
123
|
+
/** One URL source when a file is named, one form of `auth`, a CA only with TLS; no file is read here. */
|
|
124
|
+
optionsRule() {
|
|
125
|
+
const o = this.options;
|
|
126
|
+
const sources = ["url", "urlEnv", "urlFile"].filter((k) => o[k] !== undefined);
|
|
127
|
+
if (o.urlFile !== undefined && sources.length > 1) {
|
|
128
|
+
return new RedisAdapterError("OPTIONS_INVALID", `the options name more than one url source: ${sources.join(", ")}; give exactly one with urlFile`);
|
|
129
|
+
}
|
|
130
|
+
const a = o.auth;
|
|
131
|
+
if (a !== undefined) {
|
|
132
|
+
const env = a.username !== undefined || a.password !== undefined;
|
|
133
|
+
const file = a.user !== undefined || a.passwordFile !== undefined;
|
|
134
|
+
if (env && file) {
|
|
135
|
+
return new RedisAdapterError("OPTIONS_INVALID", "options.auth mixes the variable names (username, password) with user and passwordFile; use one form");
|
|
136
|
+
}
|
|
137
|
+
if (!env && !file)
|
|
138
|
+
return new RedisAdapterError("OPTIONS_INVALID", "options.auth names neither a password variable nor a passwordFile");
|
|
139
|
+
if (env && a.password === undefined)
|
|
140
|
+
return new RedisAdapterError("OPTIONS_INVALID", "options.auth with a username variable needs a password variable");
|
|
141
|
+
// founder ruling 2026-11-15 ("Require a user"): the file form always names its user, as SPEC-ADPNEO-003's does
|
|
142
|
+
if (file && (a.user === undefined || a.passwordFile === undefined)) {
|
|
143
|
+
return new RedisAdapterError("OPTIONS_INVALID", "options.auth with a passwordFile needs both user and passwordFile (a requirepass server's user is `default`)");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
resolve() {
|
|
149
|
+
if (this.resolved !== undefined)
|
|
150
|
+
return this.resolved;
|
|
151
|
+
const refusal = this.optionsRule();
|
|
152
|
+
if (refusal !== undefined)
|
|
153
|
+
throw refusal;
|
|
154
|
+
const o = this.options;
|
|
155
|
+
const url = o.urlFile !== undefined ? readCredentialFile("urlFile", o.urlFile) : (o.url ?? (o.urlEnv !== undefined ? process.env[o.urlEnv] : undefined));
|
|
156
|
+
if (url === undefined || url === "") {
|
|
157
|
+
throw new RedisAdapterError("OPTIONS_INVALID", "the redis service has no url (or urlEnv naming a set variable, or urlFile)");
|
|
158
|
+
}
|
|
159
|
+
if (!/^rediss?:\/\//.test(url))
|
|
160
|
+
throw new RedisAdapterError("OPTIONS_INVALID", `the url ${redact(url)} is not redis:// or rediss://`);
|
|
161
|
+
if (/\/\/[^@/]*@/.test(url))
|
|
162
|
+
throw new RedisAdapterError("OPTIONS_INVALID", "the url carries credentials; give them in options.auth");
|
|
163
|
+
const tls = url.startsWith("rediss://");
|
|
164
|
+
if (o.tlsCAFile !== undefined && !tls)
|
|
165
|
+
throw new RedisAdapterError("OPTIONS_INVALID", "options.tlsCAFile needs a rediss:// url");
|
|
166
|
+
const ca = o.tlsCAFile !== undefined ? readCredentialFile("tlsCAFile", o.tlsCAFile, true) : undefined;
|
|
167
|
+
let username;
|
|
168
|
+
let password;
|
|
169
|
+
const auth = o.auth;
|
|
170
|
+
if (auth !== undefined && "passwordFile" in auth) {
|
|
171
|
+
username = auth.user;
|
|
172
|
+
password = readCredentialFile("auth.passwordFile", auth.passwordFile);
|
|
173
|
+
}
|
|
174
|
+
else if (auth !== undefined) {
|
|
175
|
+
const env = auth;
|
|
176
|
+
password = process.env[env.password];
|
|
177
|
+
username = env.username !== undefined ? process.env[env.username] : undefined;
|
|
178
|
+
if (password === undefined || (env.username !== undefined && username === undefined)) {
|
|
179
|
+
throw new RedisAdapterError("OPTIONS_INVALID", `options.auth names variables that are not set (${[env.username, env.password].filter(Boolean).join(", ")})`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
this.resolved = { url, username, password, ca };
|
|
183
|
+
return this.resolved;
|
|
184
|
+
}
|
|
185
|
+
db() {
|
|
186
|
+
if (this.client === undefined) {
|
|
187
|
+
const { url, username, password, ca } = this.resolve();
|
|
188
|
+
const socket = url.startsWith("rediss://") ? { tls: true, ...(ca !== undefined ? { ca } : {}), connectTimeout: 10_000, reconnectStrategy: false } : { connectTimeout: 10_000, reconnectStrategy: false };
|
|
189
|
+
this.client = createClient({
|
|
190
|
+
url,
|
|
191
|
+
...(username !== undefined ? { username } : {}),
|
|
192
|
+
...(password !== undefined ? { password } : {}),
|
|
193
|
+
socket,
|
|
194
|
+
});
|
|
195
|
+
this.client.on("error", () => { });
|
|
196
|
+
}
|
|
197
|
+
return this.client;
|
|
198
|
+
}
|
|
199
|
+
async cmd(args) {
|
|
200
|
+
return this.db().sendCommand(args);
|
|
201
|
+
}
|
|
202
|
+
async setup() {
|
|
203
|
+
const { url } = this.resolve();
|
|
204
|
+
try {
|
|
205
|
+
await this.db().connect();
|
|
206
|
+
await this.cmd(["PING"]);
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
await this.closeClient();
|
|
210
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
211
|
+
throw new RedisAdapterError("REDIS_UNREACHABLE", `the server at ${redact(url)} did not answer: ${message}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async closeClient() {
|
|
215
|
+
const c = this.client;
|
|
216
|
+
this.client = undefined;
|
|
217
|
+
if (c !== undefined && c.isOpen)
|
|
218
|
+
await c.quit().catch(() => { });
|
|
219
|
+
}
|
|
220
|
+
async teardown() {
|
|
221
|
+
this.baseline = undefined;
|
|
222
|
+
await this.closeClient();
|
|
223
|
+
}
|
|
224
|
+
// ── the snapshot ──────────────────────────────────────────────────────────
|
|
225
|
+
async keys() {
|
|
226
|
+
const out = [];
|
|
227
|
+
let cursor = "0";
|
|
228
|
+
do {
|
|
229
|
+
const [next, batch] = (await this.cmd(["SCAN", cursor, "MATCH", `${this.prefix}*`, "COUNT", SCAN_COUNT]));
|
|
230
|
+
cursor = next;
|
|
231
|
+
out.push(...batch);
|
|
232
|
+
} while (cursor !== "0");
|
|
233
|
+
return [...new Set(out)].sort(byKey);
|
|
234
|
+
}
|
|
235
|
+
/** The state of one key, or undefined when it no longer exists. */
|
|
236
|
+
async state(full) {
|
|
237
|
+
const kind = String(await this.cmd(["TYPE", full]));
|
|
238
|
+
switch (kind) {
|
|
239
|
+
case "none":
|
|
240
|
+
return undefined;
|
|
241
|
+
case "string":
|
|
242
|
+
return { kind, value: String(await this.cmd(["GET", full])) };
|
|
243
|
+
case "set":
|
|
244
|
+
return { kind, value: (await this.cmd(["SMEMBERS", full])).sort(byKey) };
|
|
245
|
+
case "hash":
|
|
246
|
+
return { kind, value: pairs(await this.cmd(["HGETALL", full])) };
|
|
247
|
+
case "list":
|
|
248
|
+
return { kind, value: (await this.cmd(["LRANGE", full, "0", "-1"])) };
|
|
249
|
+
case "zset":
|
|
250
|
+
return { kind, value: scored(await this.cmd(["ZRANGE", full, "0", "-1", "WITHSCORES"])) };
|
|
251
|
+
default:
|
|
252
|
+
throw new RedisAdapterError("KIND_UNSUPPORTED", `the key ${full.slice(this.prefix.length)} of the namespace holds a ${kind}; the adapter reads ${KINDS.join(", ")}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
async snapshot() {
|
|
256
|
+
const out = new Map();
|
|
257
|
+
for (const full of await this.keys()) {
|
|
258
|
+
const s = await this.state(full);
|
|
259
|
+
if (s !== undefined)
|
|
260
|
+
out.set(full.slice(this.prefix.length), s);
|
|
261
|
+
}
|
|
262
|
+
return out;
|
|
263
|
+
}
|
|
264
|
+
record(type, key, s, timestamp) {
|
|
265
|
+
return { type, key, payload: { kind: s.kind, value: s.value }, timestamp };
|
|
266
|
+
}
|
|
267
|
+
diff(before, after) {
|
|
268
|
+
const timestamp = Date.now();
|
|
269
|
+
const out = [];
|
|
270
|
+
for (const key of [...new Set([...before.keys(), ...after.keys()])].sort(byKey)) {
|
|
271
|
+
const was = before.get(key);
|
|
272
|
+
const is = after.get(key);
|
|
273
|
+
if (was === undefined && is !== undefined)
|
|
274
|
+
out.push(this.record("INSERT", key, is, timestamp));
|
|
275
|
+
else if (was !== undefined && is === undefined)
|
|
276
|
+
out.push(this.record("REMOVE", key, was, timestamp));
|
|
277
|
+
else if (was !== undefined && is !== undefined && stable(was) !== stable(is))
|
|
278
|
+
out.push(this.record("MODIFY", key, is, timestamp));
|
|
279
|
+
}
|
|
280
|
+
return out;
|
|
281
|
+
}
|
|
282
|
+
// ── the window ────────────────────────────────────────────────────────────
|
|
283
|
+
async startCapture() {
|
|
284
|
+
this.baseline = await this.snapshot();
|
|
285
|
+
}
|
|
286
|
+
async peekCapture() {
|
|
287
|
+
if (this.baseline === undefined)
|
|
288
|
+
return [];
|
|
289
|
+
return this.diff(this.baseline, await this.snapshot());
|
|
290
|
+
}
|
|
291
|
+
async stopCapture() {
|
|
292
|
+
if (this.baseline === undefined)
|
|
293
|
+
return [];
|
|
294
|
+
const records = this.diff(this.baseline, await this.snapshot());
|
|
295
|
+
this.baseline = undefined;
|
|
296
|
+
return records;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* True with a window open: Redis runs one command at a time and a command the system has had answered is applied
|
|
300
|
+
* before any later command, the instrument's included. False with no window open.
|
|
301
|
+
*/
|
|
302
|
+
async settle() {
|
|
303
|
+
return this.baseline !== undefined;
|
|
304
|
+
}
|
|
305
|
+
// ── state ─────────────────────────────────────────────────────────────────
|
|
306
|
+
async read(query) {
|
|
307
|
+
const timestamp = Date.now();
|
|
308
|
+
const named = query.expect?.map((e) => (typeof e.key?.key === "string" ? e.key.key : undefined));
|
|
309
|
+
if (named !== undefined && named.length > 0 && named.every((k) => k !== undefined)) {
|
|
310
|
+
this.lastReadVia = "KeyedLookup";
|
|
311
|
+
const out = [];
|
|
312
|
+
for (const key of named) {
|
|
313
|
+
const s = await this.state(`${this.prefix}${key}`);
|
|
314
|
+
if (s !== undefined)
|
|
315
|
+
out.push(this.record(s.kind, key, s, timestamp));
|
|
316
|
+
}
|
|
317
|
+
return out;
|
|
318
|
+
}
|
|
319
|
+
this.lastReadVia = "NamespaceScan";
|
|
320
|
+
return [...(await this.snapshot())].map(([k, s]) => this.record(s.kind, k, s, timestamp));
|
|
321
|
+
}
|
|
322
|
+
/** SeedRecord { type: one of the kinds, values: { key, value } }, written under the namespace before the window. */
|
|
323
|
+
async seed(records) {
|
|
324
|
+
const commands = [];
|
|
325
|
+
for (const r of records) {
|
|
326
|
+
const key = r.values.key;
|
|
327
|
+
const value = r.values.value;
|
|
328
|
+
if (typeof key !== "string" || key === "")
|
|
329
|
+
throw new RedisAdapterError("SEED_INVALID", `a ${r.type} seed needs values.key, a non-empty string`);
|
|
330
|
+
const full = `${this.prefix}${key}`;
|
|
331
|
+
const strings = (v) => Array.isArray(v) && v.length > 0 && v.every((x) => typeof x === "string");
|
|
332
|
+
switch (r.type) {
|
|
333
|
+
case "string":
|
|
334
|
+
if (typeof value !== "string")
|
|
335
|
+
throw new RedisAdapterError("SEED_INVALID", `the string seed ${key} needs values.value, a string`);
|
|
336
|
+
commands.push(["SET", full, value]);
|
|
337
|
+
break;
|
|
338
|
+
case "set":
|
|
339
|
+
if (!strings(value))
|
|
340
|
+
throw new RedisAdapterError("SEED_INVALID", `the set seed ${key} needs values.value, a non-empty array of strings`);
|
|
341
|
+
commands.push(["SADD", full, ...value]);
|
|
342
|
+
break;
|
|
343
|
+
case "list":
|
|
344
|
+
if (!strings(value))
|
|
345
|
+
throw new RedisAdapterError("SEED_INVALID", `the list seed ${key} needs values.value, a non-empty array of strings`);
|
|
346
|
+
commands.push(["RPUSH", full, ...value]);
|
|
347
|
+
break;
|
|
348
|
+
case "hash": {
|
|
349
|
+
const entries = value !== null && typeof value === "object" && !Array.isArray(value) ? Object.entries(value) : [];
|
|
350
|
+
if (entries.length === 0 || entries.some(([, v]) => typeof v !== "string")) {
|
|
351
|
+
throw new RedisAdapterError("SEED_INVALID", `the hash seed ${key} needs values.value, an object of string fields`);
|
|
352
|
+
}
|
|
353
|
+
commands.push(["HSET", full, ...entries.flatMap(([f, v]) => [f, v])]);
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
case "zset": {
|
|
357
|
+
const members = Array.isArray(value) ? value : [];
|
|
358
|
+
const ok = members.length > 0 && members.every((m) => m !== null && typeof m === "object" && typeof m.member === "string" && typeof m.score === "number");
|
|
359
|
+
if (!ok)
|
|
360
|
+
throw new RedisAdapterError("SEED_INVALID", `the zset seed ${key} needs values.value, a non-empty array of { member, score }`);
|
|
361
|
+
commands.push(["ZADD", full, ...members.flatMap((m) => [String(m.score), m.member])]);
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
default:
|
|
365
|
+
throw new RedisAdapterError("SEED_INVALID", `the seed type '${r.type}' is not one of ${KINDS.join(", ")}`);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (commands.length === 0)
|
|
369
|
+
return;
|
|
370
|
+
const multi = this.db().multi();
|
|
371
|
+
for (const c of commands)
|
|
372
|
+
multi.addCommand(c);
|
|
373
|
+
await multi.exec();
|
|
374
|
+
}
|
|
375
|
+
// ── faults ────────────────────────────────────────────────────────────────
|
|
376
|
+
async fault(arm) {
|
|
377
|
+
throw new RedisAdapterError("FAULT_UNSUPPORTED", `the fault '${arm.operation}.${arm.fault}' is not in the catalog (it is empty)`);
|
|
378
|
+
}
|
|
379
|
+
async reset() {
|
|
380
|
+
const keys = await this.keys();
|
|
381
|
+
for (let i = 0; i < keys.length; i += 500)
|
|
382
|
+
await this.cmd(["UNLINK", ...keys.slice(i, i + 500)]);
|
|
383
|
+
this.baseline = undefined;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
export function createAdapter(config) {
|
|
387
|
+
return new RedisAdapter(config);
|
|
388
|
+
}
|
|
389
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,uHAAuH;AACvH,+GAA+G;AAC/G,wHAAwH;AACxH,6DAA6D;AAC7D,EAAE;AACF,4GAA4G;AAC5G,8GAA8G;AAE9G,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAmBrC,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAE/B;IACA;IAFX,YACW,IAA2B,EAC3B,MAAc;QAEvB,KAAK,CAAC,GAAG,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;QAHnB,SAAI,GAAJ,IAAI,CAAuB;QAC3B,WAAM,GAAN,MAAM,CAAQ;QAGvB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AA+CD,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,M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nt/feat-adapter-redis",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Redis service adapter for Feat: a snapshot diff of the namespace's keys, state by key or namespace scan, and credentials and a CA read from files",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"redis": "6.3.1",
|
|
13
|
+
"@mmmnt/feat-types": "^0.5.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@peculiar/x509": "3.1.0",
|
|
17
|
+
"reflect-metadata": "0.2.2",
|
|
18
|
+
"typescript": "^5.8.0",
|
|
19
|
+
"vitest": "^3.2.0",
|
|
20
|
+
"@mmmnt/feat-adapter-kit": "^0.1.7",
|
|
21
|
+
"@mmmnt/feat-runtime": "^0.5.0"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=20"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/mmmnt/feature.git",
|
|
30
|
+
"directory": "adapters/redis"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/mmmnt/feature#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/mmmnt/feature/issues"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
42
|
+
"test": "vitest run --exclude '**/observe.test.ts' --passWithNoTests"
|
|
43
|
+
}
|
|
6
44
|
}
|