node-redfish 1.0.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 +201 -0
- package/README.md +138 -0
- package/dist/client.d.ts +125 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.integration.test.d.ts +2 -0
- package/dist/client.integration.test.d.ts.map +1 -0
- package/dist/client.test.d.ts +2 -0
- package/dist/client.test.d.ts.map +1 -0
- package/dist/errors.d.ts +33 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.cjs +346 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +342 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types.d.ts +200 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +76 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let undici = require("undici");
|
|
3
|
+
//#region src/errors.ts
|
|
4
|
+
/** Thrown for any non-2xx response from a Redfish service. */
|
|
5
|
+
var RedfishError = class extends Error {
|
|
6
|
+
url;
|
|
7
|
+
status;
|
|
8
|
+
statusText;
|
|
9
|
+
body;
|
|
10
|
+
constructor(message, options) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "RedfishError";
|
|
13
|
+
this.url = options.url;
|
|
14
|
+
this.status = options.status;
|
|
15
|
+
this.statusText = options.statusText;
|
|
16
|
+
this.body = options.body;
|
|
17
|
+
}
|
|
18
|
+
/** Extracted `@Message.ExtendedInfo` entries, if the service returned an extended-info error body. */
|
|
19
|
+
get extendedInfo() {
|
|
20
|
+
if (this.body && typeof this.body === "object") return this.body.error?.["@Message.ExtendedInfo"] ?? [];
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/** Thrown when a request exceeds the configured timeout. */
|
|
25
|
+
var RedfishTimeoutError = class extends Error {
|
|
26
|
+
url;
|
|
27
|
+
timeoutMs;
|
|
28
|
+
constructor(url, timeoutMs) {
|
|
29
|
+
super(`Request to ${url} timed out after ${timeoutMs}ms`);
|
|
30
|
+
this.name = "RedfishTimeoutError";
|
|
31
|
+
this.url = url;
|
|
32
|
+
this.timeoutMs = timeoutMs;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/** Thrown when a resource does not expose an action the client was asked to invoke. */
|
|
36
|
+
var RedfishActionNotSupportedError = class extends Error {
|
|
37
|
+
action;
|
|
38
|
+
resourceId;
|
|
39
|
+
constructor(action, resourceId) {
|
|
40
|
+
super(`Resource "${resourceId}" does not support action "${action}"`);
|
|
41
|
+
this.name = "RedfishActionNotSupportedError";
|
|
42
|
+
this.action = action;
|
|
43
|
+
this.resourceId = resourceId;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/client.ts
|
|
48
|
+
var DEFAULT_SERVICE_PATH = "/redfish/v1";
|
|
49
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
50
|
+
/**
|
|
51
|
+
* Client for querying and managing Redfish-compliant BMCs.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const client = new RedfishClient({
|
|
56
|
+
* baseUrl: 'https://10.0.0.5',
|
|
57
|
+
* auth: { type: 'session', username: 'admin', password: 'secret' },
|
|
58
|
+
* insecure: true,
|
|
59
|
+
* });
|
|
60
|
+
* await client.connect();
|
|
61
|
+
* const systems = await client.getSystems();
|
|
62
|
+
* await client.resetSystem(systems[0].Id!, 'GracefulRestart');
|
|
63
|
+
* await client.disconnect();
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
var RedfishClient = class {
|
|
67
|
+
baseUrl;
|
|
68
|
+
servicePath;
|
|
69
|
+
auth;
|
|
70
|
+
timeoutMs;
|
|
71
|
+
fetchImpl;
|
|
72
|
+
dispatcher;
|
|
73
|
+
token;
|
|
74
|
+
sessionLocation;
|
|
75
|
+
constructor(options) {
|
|
76
|
+
if (!options.baseUrl) throw new TypeError("RedfishClient requires a `baseUrl`");
|
|
77
|
+
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
78
|
+
this.servicePath = normalizeServicePath(options.servicePath ?? DEFAULT_SERVICE_PATH);
|
|
79
|
+
this.auth = options.auth ?? { type: "none" };
|
|
80
|
+
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
81
|
+
this.fetchImpl = options.fetch ?? fetch;
|
|
82
|
+
this.dispatcher = options.insecure ? new undici.Agent({ connect: { rejectUnauthorized: false } }) : void 0;
|
|
83
|
+
if (this.auth.type === "token") this.token = this.auth.token;
|
|
84
|
+
}
|
|
85
|
+
/** Whether the client currently holds a session token (from `connect()` or `type: 'token'` auth). */
|
|
86
|
+
get isAuthenticated() {
|
|
87
|
+
return Boolean(this.token) || this.auth.type === "basic";
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Establishes a session for `{ type: 'session' }` auth by creating a
|
|
91
|
+
* Redfish session and capturing the `X-Auth-Token`. No-op for other auth
|
|
92
|
+
* types.
|
|
93
|
+
*/
|
|
94
|
+
async connect() {
|
|
95
|
+
if (this.auth.type !== "session") return;
|
|
96
|
+
const url = this.resolve(`${this.servicePath}/SessionService/Sessions`);
|
|
97
|
+
const response = await this.rawFetch(url, {
|
|
98
|
+
method: "POST",
|
|
99
|
+
headers: {
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
Accept: "application/json"
|
|
102
|
+
},
|
|
103
|
+
body: JSON.stringify({
|
|
104
|
+
UserName: this.auth.username,
|
|
105
|
+
Password: this.auth.password
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
if (!response.ok) await throwRedfishError(response);
|
|
109
|
+
const token = response.headers.get("x-auth-token");
|
|
110
|
+
if (!token) throw new RedfishError("Session creation succeeded but no X-Auth-Token header was returned", {
|
|
111
|
+
url,
|
|
112
|
+
status: response.status,
|
|
113
|
+
statusText: response.statusText
|
|
114
|
+
});
|
|
115
|
+
this.token = token;
|
|
116
|
+
this.sessionLocation = response.headers.get("location") ?? void 0;
|
|
117
|
+
await response.text().catch(() => void 0);
|
|
118
|
+
}
|
|
119
|
+
/** Deletes the active session, if one was established via `connect()`. */
|
|
120
|
+
async disconnect() {
|
|
121
|
+
if (!this.sessionLocation) {
|
|
122
|
+
this.token = this.auth.type === "token" ? this.auth.token : void 0;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const url = this.resolve(this.sessionLocation);
|
|
126
|
+
await this.rawFetch(url, {
|
|
127
|
+
method: "DELETE",
|
|
128
|
+
headers: this.authHeaders()
|
|
129
|
+
}).catch(() => void 0);
|
|
130
|
+
this.sessionLocation = void 0;
|
|
131
|
+
this.token = this.auth.type === "token" ? this.auth.token : void 0;
|
|
132
|
+
}
|
|
133
|
+
/** Fetches the service root document (`/redfish/v1/`). */
|
|
134
|
+
getServiceRoot() {
|
|
135
|
+
return this.get(this.servicePath);
|
|
136
|
+
}
|
|
137
|
+
getSystems() {
|
|
138
|
+
return this.getExpandedCollection("Systems");
|
|
139
|
+
}
|
|
140
|
+
getSystemIds() {
|
|
141
|
+
return this.getCollectionIds("Systems");
|
|
142
|
+
}
|
|
143
|
+
getSystem(id) {
|
|
144
|
+
return this.get(`${this.servicePath}/Systems/${id}`);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Invokes `#ComputerSystem.Reset` on the given system. The action target
|
|
148
|
+
* is read from the system's `Actions` block so vendor-specific paths are
|
|
149
|
+
* respected; falls back to the standard path if absent.
|
|
150
|
+
*/
|
|
151
|
+
async resetSystem(id, resetType) {
|
|
152
|
+
const action = (await this.getSystem(id)).Actions?.["#ComputerSystem.Reset"];
|
|
153
|
+
await this.invokeAction(action, "#ComputerSystem.Reset", { ResetType: resetType }, id);
|
|
154
|
+
}
|
|
155
|
+
getChassisCollection() {
|
|
156
|
+
return this.getExpandedCollection("Chassis");
|
|
157
|
+
}
|
|
158
|
+
getChassisIds() {
|
|
159
|
+
return this.getCollectionIds("Chassis");
|
|
160
|
+
}
|
|
161
|
+
getChassis(id) {
|
|
162
|
+
return this.get(`${this.servicePath}/Chassis/${id}`);
|
|
163
|
+
}
|
|
164
|
+
async getPower(chassisId) {
|
|
165
|
+
const path = (await this.getChassis(chassisId)).Power?.["@odata.id"] ?? `${this.servicePath}/Chassis/${chassisId}/Power`;
|
|
166
|
+
return this.get(path);
|
|
167
|
+
}
|
|
168
|
+
async getThermal(chassisId) {
|
|
169
|
+
const path = (await this.getChassis(chassisId)).Thermal?.["@odata.id"] ?? `${this.servicePath}/Chassis/${chassisId}/Thermal`;
|
|
170
|
+
return this.get(path);
|
|
171
|
+
}
|
|
172
|
+
getManagers() {
|
|
173
|
+
return this.getExpandedCollection("Managers");
|
|
174
|
+
}
|
|
175
|
+
getManagerIds() {
|
|
176
|
+
return this.getCollectionIds("Managers");
|
|
177
|
+
}
|
|
178
|
+
getManager(id) {
|
|
179
|
+
return this.get(`${this.servicePath}/Managers/${id}`);
|
|
180
|
+
}
|
|
181
|
+
async resetManager(id, resetType) {
|
|
182
|
+
const action = (await this.getManager(id)).Actions?.["#Manager.Reset"];
|
|
183
|
+
await this.invokeAction(action, "#Manager.Reset", { ResetType: resetType }, id);
|
|
184
|
+
}
|
|
185
|
+
getSessions() {
|
|
186
|
+
return this.getExpandedCollection("SessionService/Sessions");
|
|
187
|
+
}
|
|
188
|
+
async get(path) {
|
|
189
|
+
const { data } = await this.request(path, { method: "GET" });
|
|
190
|
+
return data;
|
|
191
|
+
}
|
|
192
|
+
/** PATCH a resource. Pass `etag` to send `If-Match` (recommended by the Redfish spec for PATCH). */
|
|
193
|
+
async patch(path, body, etag) {
|
|
194
|
+
const { data } = await this.request(path, {
|
|
195
|
+
method: "PATCH",
|
|
196
|
+
body,
|
|
197
|
+
etag
|
|
198
|
+
});
|
|
199
|
+
return data;
|
|
200
|
+
}
|
|
201
|
+
/** PUT a full resource replacement. Rarely used by Redfish services compared to PATCH. */
|
|
202
|
+
async put(path, body, etag) {
|
|
203
|
+
const { data } = await this.request(path, {
|
|
204
|
+
method: "PUT",
|
|
205
|
+
body,
|
|
206
|
+
etag
|
|
207
|
+
});
|
|
208
|
+
return data;
|
|
209
|
+
}
|
|
210
|
+
async post(path, body) {
|
|
211
|
+
const { data } = await this.request(path, {
|
|
212
|
+
method: "POST",
|
|
213
|
+
body
|
|
214
|
+
});
|
|
215
|
+
return data;
|
|
216
|
+
}
|
|
217
|
+
async delete(path) {
|
|
218
|
+
const { data } = await this.request(path, { method: "DELETE" });
|
|
219
|
+
return data;
|
|
220
|
+
}
|
|
221
|
+
/** Fetches a Redfish collection resource (the `Members` array of `@odata.id` links), unexpanded. */
|
|
222
|
+
getCollection(path) {
|
|
223
|
+
return this.get(this.withinService(path));
|
|
224
|
+
}
|
|
225
|
+
/** Fetches a collection and resolves every member to its full resource body. */
|
|
226
|
+
async getExpandedCollection(path) {
|
|
227
|
+
const collection = await this.getCollection(this.withinService(path));
|
|
228
|
+
return Promise.all(collection.Members.map((member) => this.get(member["@odata.id"])));
|
|
229
|
+
}
|
|
230
|
+
async getCollectionIds(path) {
|
|
231
|
+
return (await this.getCollection(this.withinService(path))).Members.map((member) => idFromODataId(member["@odata.id"]));
|
|
232
|
+
}
|
|
233
|
+
async invokeAction(action, actionName, body, resourceId) {
|
|
234
|
+
if (!action?.target) throw new RedfishActionNotSupportedError(actionName, resourceId);
|
|
235
|
+
await this.request(action.target, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
body
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
withinService(path) {
|
|
241
|
+
if (path.startsWith("http://") || path.startsWith("https://") || path.startsWith("/")) return path;
|
|
242
|
+
return `${this.servicePath}/${path}`;
|
|
243
|
+
}
|
|
244
|
+
resolve(path) {
|
|
245
|
+
if (path.startsWith("http://") || path.startsWith("https://")) return path;
|
|
246
|
+
return `${this.baseUrl}${path.startsWith("/") ? path : `/${path}`}`;
|
|
247
|
+
}
|
|
248
|
+
authHeaders() {
|
|
249
|
+
if (this.token) return { "X-Auth-Token": this.token };
|
|
250
|
+
if (this.auth.type === "basic") return { Authorization: `Basic ${base64Encode(`${this.auth.username}:${this.auth.password}`)}` };
|
|
251
|
+
return {};
|
|
252
|
+
}
|
|
253
|
+
async request(path, options) {
|
|
254
|
+
const url = this.resolve(this.withinService(path));
|
|
255
|
+
const headers = {
|
|
256
|
+
Accept: "application/json",
|
|
257
|
+
...this.authHeaders(),
|
|
258
|
+
...options.headers
|
|
259
|
+
};
|
|
260
|
+
if (options.body !== void 0) headers["Content-Type"] = "application/json";
|
|
261
|
+
if (options.etag) headers["If-Match"] = options.etag;
|
|
262
|
+
const response = await this.rawFetch(url, {
|
|
263
|
+
method: options.method ?? "GET",
|
|
264
|
+
headers,
|
|
265
|
+
body: options.body !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
266
|
+
signal: options.signal
|
|
267
|
+
});
|
|
268
|
+
if (!response.ok) await throwRedfishError(response);
|
|
269
|
+
const etag = response.headers.get("etag") ?? void 0;
|
|
270
|
+
if (response.status === 204) return {
|
|
271
|
+
data: void 0,
|
|
272
|
+
status: response.status,
|
|
273
|
+
etag
|
|
274
|
+
};
|
|
275
|
+
const text = await response.text();
|
|
276
|
+
return {
|
|
277
|
+
data: text.length > 0 ? JSON.parse(text) : void 0,
|
|
278
|
+
status: response.status,
|
|
279
|
+
etag
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
async rawFetch(url, init) {
|
|
283
|
+
const controller = new AbortController();
|
|
284
|
+
const signals = init.signal ? [init.signal, controller.signal] : [controller.signal];
|
|
285
|
+
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
286
|
+
try {
|
|
287
|
+
return await this.fetchImpl(url, {
|
|
288
|
+
method: init.method,
|
|
289
|
+
headers: init.headers,
|
|
290
|
+
body: init.body,
|
|
291
|
+
signal: combineSignals(signals),
|
|
292
|
+
...this.dispatcher ? { dispatcher: this.dispatcher } : {}
|
|
293
|
+
});
|
|
294
|
+
} catch (error) {
|
|
295
|
+
if (controller.signal.aborted) throw new RedfishTimeoutError(url, this.timeoutMs);
|
|
296
|
+
throw error;
|
|
297
|
+
} finally {
|
|
298
|
+
clearTimeout(timeout);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
function normalizeServicePath(path) {
|
|
303
|
+
const trimmed = path.replace(/\/+$/, "");
|
|
304
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
305
|
+
}
|
|
306
|
+
function idFromODataId(odataId) {
|
|
307
|
+
const segments = odataId.replace(/\/+$/, "").split("/");
|
|
308
|
+
return segments[segments.length - 1] ?? odataId;
|
|
309
|
+
}
|
|
310
|
+
function base64Encode(value) {
|
|
311
|
+
if (typeof Buffer !== "undefined") return Buffer.from(value, "utf-8").toString("base64");
|
|
312
|
+
return btoa(value);
|
|
313
|
+
}
|
|
314
|
+
function combineSignals(signals) {
|
|
315
|
+
if (signals.length === 1) return signals[0];
|
|
316
|
+
if (typeof AbortSignal.any === "function") return AbortSignal.any(signals);
|
|
317
|
+
const controller = new AbortController();
|
|
318
|
+
for (const signal of signals) {
|
|
319
|
+
if (signal.aborted) {
|
|
320
|
+
controller.abort();
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
signal.addEventListener("abort", () => controller.abort(), { once: true });
|
|
324
|
+
}
|
|
325
|
+
return controller.signal;
|
|
326
|
+
}
|
|
327
|
+
async function throwRedfishError(response) {
|
|
328
|
+
const text = await response.text().catch(() => "");
|
|
329
|
+
let body = text;
|
|
330
|
+
try {
|
|
331
|
+
body = text ? JSON.parse(text) : text;
|
|
332
|
+
} catch {}
|
|
333
|
+
throw new RedfishError(typeof body === "object" && body.error?.message || `Redfish request failed: ${response.status} ${response.statusText}`, {
|
|
334
|
+
url: response.url,
|
|
335
|
+
status: response.status,
|
|
336
|
+
statusText: response.statusText,
|
|
337
|
+
body
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
exports.RedfishActionNotSupportedError = RedfishActionNotSupportedError;
|
|
342
|
+
exports.RedfishClient = RedfishClient;
|
|
343
|
+
exports.RedfishError = RedfishError;
|
|
344
|
+
exports.RedfishTimeoutError = RedfishTimeoutError;
|
|
345
|
+
|
|
346
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/errors.ts","../src/client.ts"],"sourcesContent":["import type { RedfishErrorPayload } from './types.js';\n\n/** Thrown for any non-2xx response from a Redfish service. */\nexport class RedfishError extends Error {\n readonly url: string;\n readonly status: number;\n readonly statusText: string;\n readonly body?: RedfishErrorPayload | string;\n\n constructor(message: string, options: { url: string; status: number; statusText: string; body?: RedfishErrorPayload | string }) {\n super(message);\n this.name = 'RedfishError';\n this.url = options.url;\n this.status = options.status;\n this.statusText = options.statusText;\n this.body = options.body;\n }\n\n /** Extracted `@Message.ExtendedInfo` entries, if the service returned an extended-info error body. */\n get extendedInfo(): Array<{ MessageId?: string; Message?: string; Severity?: string }> {\n if (this.body && typeof this.body === 'object') {\n return this.body.error?.['@Message.ExtendedInfo'] ?? [];\n }\n return [];\n }\n}\n\n/** Thrown when a request exceeds the configured timeout. */\nexport class RedfishTimeoutError extends Error {\n readonly url: string;\n readonly timeoutMs: number;\n\n constructor(url: string, timeoutMs: number) {\n super(`Request to ${url} timed out after ${timeoutMs}ms`);\n this.name = 'RedfishTimeoutError';\n this.url = url;\n this.timeoutMs = timeoutMs;\n }\n}\n\n/** Thrown when a resource does not expose an action the client was asked to invoke. */\nexport class RedfishActionNotSupportedError extends Error {\n readonly action: string;\n readonly resourceId: string;\n\n constructor(action: string, resourceId: string) {\n super(`Resource \"${resourceId}\" does not support action \"${action}\"`);\n this.name = 'RedfishActionNotSupportedError';\n this.action = action;\n this.resourceId = resourceId;\n }\n}\n","import { Agent } from 'undici';\nimport { RedfishActionNotSupportedError, RedfishError, RedfishTimeoutError } from './errors.js';\nimport type {\n Chassis,\n ComputerSystem,\n Manager,\n Power,\n RedfishAction,\n RedfishCollection,\n RedfishErrorPayload,\n ResetType,\n ServiceRoot,\n Session,\n Thermal,\n} from './types.js';\n\nexport interface RedfishAuthBasic {\n type: 'basic';\n username: string;\n password: string;\n}\n\nexport interface RedfishAuthSession {\n type: 'session';\n username: string;\n password: string;\n}\n\nexport interface RedfishAuthToken {\n type: 'token';\n token: string;\n}\n\nexport interface RedfishAuthNone {\n type: 'none';\n}\n\nexport type RedfishAuth = RedfishAuthBasic | RedfishAuthSession | RedfishAuthToken | RedfishAuthNone;\n\nexport interface RedfishClientOptions {\n /** Base URL of the BMC, e.g. `https://10.0.0.5` */\n baseUrl: string;\n /** Authentication strategy. Defaults to `{ type: 'none' }`. */\n auth?: RedfishAuth;\n /**\n * Skip TLS certificate verification. Most BMCs ship a self-signed\n * certificate, so this is commonly needed. Defaults to `false`.\n */\n insecure?: boolean;\n /** Root service path. Defaults to `/redfish/v1`. */\n servicePath?: string;\n /** Per-request timeout in milliseconds. Defaults to 15000. */\n timeoutMs?: number;\n /** Override the fetch implementation (mainly for testing). */\n fetch?: typeof fetch;\n}\n\nexport interface RedfishResponse<T> {\n data: T;\n status: number;\n etag?: string;\n}\n\nexport interface RequestOptions {\n method?: string;\n body?: unknown;\n etag?: string;\n headers?: Record<string, string>;\n signal?: AbortSignal;\n}\n\nconst DEFAULT_SERVICE_PATH = '/redfish/v1';\nconst DEFAULT_TIMEOUT_MS = 15_000;\n\n/**\n * Client for querying and managing Redfish-compliant BMCs.\n *\n * @example\n * ```ts\n * const client = new RedfishClient({\n * baseUrl: 'https://10.0.0.5',\n * auth: { type: 'session', username: 'admin', password: 'secret' },\n * insecure: true,\n * });\n * await client.connect();\n * const systems = await client.getSystems();\n * await client.resetSystem(systems[0].Id!, 'GracefulRestart');\n * await client.disconnect();\n * ```\n */\nexport class RedfishClient {\n private readonly baseUrl: string;\n private readonly servicePath: string;\n private readonly auth: RedfishAuth;\n private readonly timeoutMs: number;\n private readonly fetchImpl: typeof fetch;\n private readonly dispatcher: Agent | undefined;\n\n private token: string | undefined;\n private sessionLocation: string | undefined;\n\n constructor(options: RedfishClientOptions) {\n if (!options.baseUrl) {\n throw new TypeError('RedfishClient requires a `baseUrl`');\n }\n this.baseUrl = options.baseUrl.replace(/\\/+$/, '');\n this.servicePath = normalizeServicePath(options.servicePath ?? DEFAULT_SERVICE_PATH);\n this.auth = options.auth ?? { type: 'none' };\n this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.fetchImpl = options.fetch ?? fetch;\n this.dispatcher = options.insecure ? new Agent({ connect: { rejectUnauthorized: false } }) : undefined;\n\n if (this.auth.type === 'token') {\n this.token = this.auth.token;\n }\n }\n\n /** Whether the client currently holds a session token (from `connect()` or `type: 'token'` auth). */\n get isAuthenticated(): boolean {\n return Boolean(this.token) || this.auth.type === 'basic';\n }\n\n /**\n * Establishes a session for `{ type: 'session' }` auth by creating a\n * Redfish session and capturing the `X-Auth-Token`. No-op for other auth\n * types.\n */\n async connect(): Promise<void> {\n if (this.auth.type !== 'session') {\n return;\n }\n const url = this.resolve(`${this.servicePath}/SessionService/Sessions`);\n const response = await this.rawFetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', Accept: 'application/json' },\n body: JSON.stringify({ UserName: this.auth.username, Password: this.auth.password }),\n });\n if (!response.ok) {\n await throwRedfishError(response);\n }\n const token = response.headers.get('x-auth-token');\n if (!token) {\n throw new RedfishError('Session creation succeeded but no X-Auth-Token header was returned', {\n url,\n status: response.status,\n statusText: response.statusText,\n });\n }\n this.token = token;\n this.sessionLocation = response.headers.get('location') ?? undefined;\n // Drain the body so the connection can be reused.\n await response.text().catch(() => undefined);\n }\n\n /** Deletes the active session, if one was established via `connect()`. */\n async disconnect(): Promise<void> {\n if (!this.sessionLocation) {\n this.token = this.auth.type === 'token' ? this.auth.token : undefined;\n return;\n }\n const url = this.resolve(this.sessionLocation);\n await this.rawFetch(url, { method: 'DELETE', headers: this.authHeaders() }).catch(() => undefined);\n this.sessionLocation = undefined;\n this.token = this.auth.type === 'token' ? this.auth.token : undefined;\n }\n\n /** Fetches the service root document (`/redfish/v1/`). */\n getServiceRoot(): Promise<ServiceRoot> {\n return this.get<ServiceRoot>(this.servicePath);\n }\n\n // ---------------------------------------------------------------------\n // Systems\n // ---------------------------------------------------------------------\n\n getSystems(): Promise<ComputerSystem[]> {\n return this.getExpandedCollection<ComputerSystem>('Systems');\n }\n\n getSystemIds(): Promise<string[]> {\n return this.getCollectionIds('Systems');\n }\n\n getSystem(id: string): Promise<ComputerSystem> {\n return this.get<ComputerSystem>(`${this.servicePath}/Systems/${id}`);\n }\n\n /**\n * Invokes `#ComputerSystem.Reset` on the given system. The action target\n * is read from the system's `Actions` block so vendor-specific paths are\n * respected; falls back to the standard path if absent.\n */\n async resetSystem(id: string, resetType: ResetType): Promise<void> {\n const system = await this.getSystem(id);\n const action = system.Actions?.['#ComputerSystem.Reset'];\n await this.invokeAction(action, '#ComputerSystem.Reset', { ResetType: resetType }, id);\n }\n\n // ---------------------------------------------------------------------\n // Chassis\n // ---------------------------------------------------------------------\n\n getChassisCollection(): Promise<Chassis[]> {\n return this.getExpandedCollection<Chassis>('Chassis');\n }\n\n getChassisIds(): Promise<string[]> {\n return this.getCollectionIds('Chassis');\n }\n\n getChassis(id: string): Promise<Chassis> {\n return this.get<Chassis>(`${this.servicePath}/Chassis/${id}`);\n }\n\n async getPower(chassisId: string): Promise<Power> {\n const chassis = await this.getChassis(chassisId);\n const path = chassis.Power?.['@odata.id'] ?? `${this.servicePath}/Chassis/${chassisId}/Power`;\n return this.get<Power>(path);\n }\n\n async getThermal(chassisId: string): Promise<Thermal> {\n const chassis = await this.getChassis(chassisId);\n const path = chassis.Thermal?.['@odata.id'] ?? `${this.servicePath}/Chassis/${chassisId}/Thermal`;\n return this.get<Thermal>(path);\n }\n\n // ---------------------------------------------------------------------\n // Managers\n // ---------------------------------------------------------------------\n\n getManagers(): Promise<Manager[]> {\n return this.getExpandedCollection<Manager>('Managers');\n }\n\n getManagerIds(): Promise<string[]> {\n return this.getCollectionIds('Managers');\n }\n\n getManager(id: string): Promise<Manager> {\n return this.get<Manager>(`${this.servicePath}/Managers/${id}`);\n }\n\n async resetManager(id: string, resetType: ResetType): Promise<void> {\n const manager = await this.getManager(id);\n const action = manager.Actions?.['#Manager.Reset'];\n await this.invokeAction(action, '#Manager.Reset', { ResetType: resetType }, id);\n }\n\n // ---------------------------------------------------------------------\n // Sessions\n // ---------------------------------------------------------------------\n\n getSessions(): Promise<Session[]> {\n return this.getExpandedCollection<Session>('SessionService/Sessions');\n }\n\n // ---------------------------------------------------------------------\n // Generic request helpers\n // ---------------------------------------------------------------------\n\n async get<T>(path: string): Promise<T> {\n const { data } = await this.request<T>(path, { method: 'GET' });\n return data;\n }\n\n /** PATCH a resource. Pass `etag` to send `If-Match` (recommended by the Redfish spec for PATCH). */\n async patch<T>(path: string, body: unknown, etag?: string): Promise<T> {\n const { data } = await this.request<T>(path, { method: 'PATCH', body, etag });\n return data;\n }\n\n /** PUT a full resource replacement. Rarely used by Redfish services compared to PATCH. */\n async put<T>(path: string, body: unknown, etag?: string): Promise<T> {\n const { data } = await this.request<T>(path, { method: 'PUT', body, etag });\n return data;\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const { data } = await this.request<T>(path, { method: 'POST', body });\n return data;\n }\n\n async delete<T = void>(path: string): Promise<T> {\n const { data } = await this.request<T>(path, { method: 'DELETE' });\n return data;\n }\n\n /** Fetches a Redfish collection resource (the `Members` array of `@odata.id` links), unexpanded. */\n getCollection(path: string): Promise<RedfishCollection> {\n return this.get<RedfishCollection>(this.withinService(path));\n }\n\n /** Fetches a collection and resolves every member to its full resource body. */\n async getExpandedCollection<T>(path: string): Promise<T[]> {\n const collection = await this.getCollection(this.withinService(path));\n return Promise.all(collection.Members.map((member) => this.get<T>(member['@odata.id'])));\n }\n\n private async getCollectionIds(path: string): Promise<string[]> {\n const collection = await this.getCollection(this.withinService(path));\n return collection.Members.map((member) => idFromODataId(member['@odata.id']));\n }\n\n private async invokeAction(\n action: RedfishAction | undefined,\n actionName: string,\n body: unknown,\n resourceId: string,\n ): Promise<void> {\n if (!action?.target) {\n throw new RedfishActionNotSupportedError(actionName, resourceId);\n }\n await this.request(action.target, { method: 'POST', body });\n }\n\n private withinService(path: string): string {\n if (path.startsWith('http://') || path.startsWith('https://') || path.startsWith('/')) {\n return path;\n }\n return `${this.servicePath}/${path}`;\n }\n\n private resolve(path: string): string {\n if (path.startsWith('http://') || path.startsWith('https://')) {\n return path;\n }\n return `${this.baseUrl}${path.startsWith('/') ? path : `/${path}`}`;\n }\n\n private authHeaders(): Record<string, string> {\n if (this.token) {\n return { 'X-Auth-Token': this.token };\n }\n if (this.auth.type === 'basic') {\n const encoded = base64Encode(`${this.auth.username}:${this.auth.password}`);\n return { Authorization: `Basic ${encoded}` };\n }\n return {};\n }\n\n private async request<T>(path: string, options: RequestOptions): Promise<RedfishResponse<T>> {\n const url = this.resolve(this.withinService(path));\n const headers: Record<string, string> = {\n Accept: 'application/json',\n ...this.authHeaders(),\n ...options.headers,\n };\n if (options.body !== undefined) {\n headers['Content-Type'] = 'application/json';\n }\n if (options.etag) {\n headers['If-Match'] = options.etag;\n }\n\n const response = await this.rawFetch(url, {\n method: options.method ?? 'GET',\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal: options.signal,\n });\n\n if (!response.ok) {\n await throwRedfishError(response);\n }\n\n const etag = response.headers.get('etag') ?? undefined;\n if (response.status === 204) {\n return { data: undefined as T, status: response.status, etag };\n }\n const text = await response.text();\n const data = text.length > 0 ? (JSON.parse(text) as T) : (undefined as T);\n return { data, status: response.status, etag };\n }\n\n private async rawFetch(url: string, init: { method: string; headers?: Record<string, string>; body?: string; signal?: AbortSignal }): Promise<Response> {\n const controller = new AbortController();\n const signals = init.signal ? [init.signal, controller.signal] : [controller.signal];\n const timeout = setTimeout(() => controller.abort(), this.timeoutMs);\n try {\n return await this.fetchImpl(url, {\n method: init.method,\n headers: init.headers,\n body: init.body,\n signal: combineSignals(signals),\n // `dispatcher` is an undici-specific extension used to control TLS\n // verification; not part of the standard fetch types.\n ...(this.dispatcher ? { dispatcher: this.dispatcher } : {}),\n } as RequestInit);\n } catch (error) {\n if (controller.signal.aborted) {\n throw new RedfishTimeoutError(url, this.timeoutMs);\n }\n throw error;\n } finally {\n clearTimeout(timeout);\n }\n }\n}\n\nfunction normalizeServicePath(path: string): string {\n const trimmed = path.replace(/\\/+$/, '');\n return trimmed.startsWith('/') ? trimmed : `/${trimmed}`;\n}\n\nfunction idFromODataId(odataId: string): string {\n const segments = odataId.replace(/\\/+$/, '').split('/');\n return segments[segments.length - 1] ?? odataId;\n}\n\nfunction base64Encode(value: string): string {\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(value, 'utf-8').toString('base64');\n }\n // Browser / edge runtime fallback.\n return btoa(value);\n}\n\nfunction combineSignals(signals: AbortSignal[]): AbortSignal {\n if (signals.length === 1) {\n return signals[0] as AbortSignal;\n }\n if (typeof AbortSignal.any === 'function') {\n return AbortSignal.any(signals);\n }\n const controller = new AbortController();\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort();\n break;\n }\n signal.addEventListener('abort', () => controller.abort(), { once: true });\n }\n return controller.signal;\n}\n\nasync function throwRedfishError(response: Response): Promise<never> {\n const text = await response.text().catch(() => '');\n let body: RedfishErrorPayload | string = text;\n try {\n body = text ? (JSON.parse(text) as RedfishErrorPayload) : text;\n } catch {\n // leave body as raw text\n }\n const message =\n (typeof body === 'object' && body.error?.message) || `Redfish request failed: ${response.status} ${response.statusText}`;\n throw new RedfishError(message, {\n url: response.url,\n status: response.status,\n statusText: response.statusText,\n body,\n });\n}\n"],"mappings":";;;;AAGA,IAAa,eAAb,cAAkC,MAAM;CACtC;CACA;CACA;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;CAEhC,MAAM,aAAa,IAAI,gBAAgB;CACvC,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,OAAO,SAAS;GAClB,WAAW,MAAM;GACjB;EACF;EACA,OAAO,iBAAiB,eAAe,WAAW,MAAM,GAAG,EAAE,MAAM,KAAK,CAAC;CAC3E;CACA,OAAO,WAAW;AACpB;AAEA,eAAe,kBAAkB,UAAoC;CACnE,MAAM,OAAO,MAAM,SAAS,KAAK,CAAC,CAAC,YAAY,EAAE;CACjD,IAAI,OAAqC;CACzC,IAAI;EACF,OAAO,OAAQ,KAAK,MAAM,IAAI,IAA4B;CAC5D,QAAQ,CAER;CAGA,MAAM,IAAI,aADP,OAAO,SAAS,YAAY,KAAK,OAAO,WAAY,2BAA2B,SAAS,OAAO,GAAG,SAAS,cAC9E;EAC9B,KAAK,SAAS;EACd,QAAQ,SAAS;EACjB,YAAY,SAAS;EACrB;CACF,CAAC;AACH"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { RedfishClient } from './client.js';
|
|
2
|
+
export type { RedfishAuth, RedfishAuthBasic, RedfishAuthNone, RedfishAuthSession, RedfishAuthToken, RedfishClientOptions, RedfishResponse, RequestOptions, } from './client.js';
|
|
3
|
+
export { RedfishActionNotSupportedError, RedfishError, RedfishTimeoutError } from './errors.js';
|
|
4
|
+
export type { Boot, Chassis, ComputerSystem, Fan, Manager, ODataId, ODataResource, Power, PowerControl, PowerState, PowerSupply, RedfishAction, RedfishCollection, RedfishErrorPayload, ResetType, ServiceRoot, ServiceRootActions, Session, SessionService, Status, Temperature, Thermal, } from './types.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChG,YAAY,EACV,IAAI,EACJ,OAAO,EACP,cAAc,EACd,GAAG,EACH,OAAO,EACP,OAAO,EACP,aAAa,EACb,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,cAAc,EACd,MAAM,EACN,WAAW,EACX,OAAO,GACR,MAAM,YAAY,CAAC"}
|