@nexusm/sdk 5.0.0 → 5.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/dist/index.d.mts +144 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -727,6 +727,30 @@ var HttpClient = class {
|
|
|
727
727
|
this.cache.invalidate(path.split("/").filter(Boolean)[0] ?? path);
|
|
728
728
|
return result;
|
|
729
729
|
}
|
|
730
|
+
/**
|
|
731
|
+
* Send a GET request and return the raw response body as a string.
|
|
732
|
+
*
|
|
733
|
+
* Intended for file-download endpoints (e.g. `GET /dashboard/export`) that
|
|
734
|
+
* return `text/csv` or `application/json` as a raw file stream rather than a
|
|
735
|
+
* JSON-parsed object. The retry and auth interceptors still apply; the
|
|
736
|
+
* response cache is intentionally bypassed (export payloads are not cacheable
|
|
737
|
+
* at the SDK layer).
|
|
738
|
+
*
|
|
739
|
+
* @param path - URL path relative to the base URL (e.g. `/dashboard/export`).
|
|
740
|
+
* @param params - Optional query parameters.
|
|
741
|
+
* @param signal - Optional {@link AbortSignal} to cancel the request.
|
|
742
|
+
* @returns The raw response body as a string.
|
|
743
|
+
*/
|
|
744
|
+
async getText(path, params, signal) {
|
|
745
|
+
return this.retry.execute(async () => {
|
|
746
|
+
const response = await this.axios.get(path, {
|
|
747
|
+
params,
|
|
748
|
+
signal,
|
|
749
|
+
responseType: "text"
|
|
750
|
+
});
|
|
751
|
+
return response.data;
|
|
752
|
+
});
|
|
753
|
+
}
|
|
730
754
|
/**
|
|
731
755
|
* Send a DELETE request.
|
|
732
756
|
*
|
|
@@ -1343,6 +1367,35 @@ var ErrorService = class extends BaseService {
|
|
|
1343
1367
|
}
|
|
1344
1368
|
};
|
|
1345
1369
|
|
|
1370
|
+
// src/services/dashboard.ts
|
|
1371
|
+
var DashboardService = class extends BaseService {
|
|
1372
|
+
/**
|
|
1373
|
+
* Export a dashboard dataset as raw file content.
|
|
1374
|
+
*
|
|
1375
|
+
* Sends `GET /dashboard/export` with the given query parameters and returns
|
|
1376
|
+
* the raw response body as a string. The string is exactly the file the
|
|
1377
|
+
* server would send for a browser download:
|
|
1378
|
+
* - `format: 'csv'` (default) → comma-separated text
|
|
1379
|
+
* - `format: 'json'` → JSON text (not parsed into an object)
|
|
1380
|
+
*
|
|
1381
|
+
* @param params - Dataset selection and format options.
|
|
1382
|
+
* @param options - Optional request options (e.g. AbortSignal).
|
|
1383
|
+
* @returns Raw file body string.
|
|
1384
|
+
*
|
|
1385
|
+
* @throws {ApiError} HTTP 401 — missing or invalid API key.
|
|
1386
|
+
* @throws {ApiError} HTTP 403 — `target_tenant_id` requires admin scope.
|
|
1387
|
+
* @throws {ApiError} HTTP 422 — `dataset` is not one of the six whitelisted values.
|
|
1388
|
+
*/
|
|
1389
|
+
async export(params, options) {
|
|
1390
|
+
const query = { dataset: params.dataset };
|
|
1391
|
+
if (params.format !== void 0) query["format"] = params.format;
|
|
1392
|
+
if (params.target_tenant_id !== void 0) {
|
|
1393
|
+
query["target_tenant_id"] = params.target_tenant_id;
|
|
1394
|
+
}
|
|
1395
|
+
return this.http.getText("/dashboard/export", query, options?.signal);
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1346
1399
|
// src/client.ts
|
|
1347
1400
|
var NexusClient = class {
|
|
1348
1401
|
/**
|
|
@@ -1364,6 +1417,7 @@ var NexusClient = class {
|
|
|
1364
1417
|
this.tenants = new TenantService(this.http);
|
|
1365
1418
|
this.feedback = new FeedbackService(this.http);
|
|
1366
1419
|
this.errors = new ErrorService(this.http);
|
|
1420
|
+
this.dashboard = new DashboardService(this.http);
|
|
1367
1421
|
if (resolved.autoErrorReport) {
|
|
1368
1422
|
this.http.onApiError = (statusCode, method, url, detail) => {
|
|
1369
1423
|
this.errors.submit({
|