@flashbacktech/flashbackclient 0.0.95 → 0.0.97
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 +4 -0
- package/dist/api/client.d.ts +3 -1
- package/dist/api/client.js +23 -0
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +3 -1
- package/dist/api/interfaces.d.ts +3 -1
- package/dist/api/types/stats.d.ts +33 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,10 @@ TypeScript/JavaScript client for:
|
|
|
12
12
|
npm install @flashbacktech/flashbackclient
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
For comprehensive API documentation, examples, and usage instructions, see the [Documentation](./docs/index.md).
|
|
18
|
+
|
|
15
19
|
## Usage
|
|
16
20
|
|
|
17
21
|
### Client Library
|
package/dist/api/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, StorageUnit, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse, UpdateUnitRequest, UpdateUnitResponse, ActionResponse, UpdateRepoRequest, UpdateRepoResponse, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateUnitRequest, ValidateUnitResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse, StorageUnitStatusResponse, GetUnitNodeStatsResponse, GetUnitNodeStatsRequest } from './types/storage';
|
|
2
2
|
import { IApiClient, ProviderType } from './interfaces';
|
|
3
3
|
import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse } from './types/auth';
|
|
4
|
-
import { StatsQueryParams, StatsResponse } from './types/stats';
|
|
4
|
+
import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams } from './types/stats';
|
|
5
5
|
interface ErrorResponse {
|
|
6
6
|
message?: string;
|
|
7
7
|
[key: string]: any;
|
|
@@ -63,5 +63,7 @@ export declare class ApiClient implements IApiClient {
|
|
|
63
63
|
private validateDateRange;
|
|
64
64
|
getDailyStats: (params: StatsQueryParams) => Promise<StatsResponse>;
|
|
65
65
|
getMinuteStats: (params: StatsQueryParams) => Promise<StatsResponse>;
|
|
66
|
+
getNodeStatsMinute: (params?: NodeStatsQueryParams) => Promise<NodeStatsMinuteResponse>;
|
|
67
|
+
getNodeStatsDaily: (params?: NodeStatsQueryParams) => Promise<NodeStatsDailyResponse>;
|
|
66
68
|
}
|
|
67
69
|
export {};
|
package/dist/api/client.js
CHANGED
|
@@ -248,6 +248,29 @@ class ApiClient {
|
|
|
248
248
|
queryParams.append('unitId', params.unitId.join(','));
|
|
249
249
|
return this.makeRequest(`stats/minute?${queryParams.toString()}`, 'GET', null);
|
|
250
250
|
};
|
|
251
|
+
this.getNodeStatsMinute = async (params) => {
|
|
252
|
+
const queryParams = new URLSearchParams();
|
|
253
|
+
if (params && params.unitId && params.unitId.length > 0) {
|
|
254
|
+
queryParams.append('unitId', params.unitId.join(','));
|
|
255
|
+
}
|
|
256
|
+
const response = await this.makeRequest(`stats/nodes/minute${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
|
|
257
|
+
// Process the response to convert lastUpdated strings to Date objects
|
|
258
|
+
const processedData = response.data.map(item => ({
|
|
259
|
+
...item,
|
|
260
|
+
lastUpdated: new Date(item.lastUpdated)
|
|
261
|
+
}));
|
|
262
|
+
return {
|
|
263
|
+
...response,
|
|
264
|
+
data: processedData
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
this.getNodeStatsDaily = async (params) => {
|
|
268
|
+
const queryParams = new URLSearchParams();
|
|
269
|
+
if (params && params.unitId && params.unitId.length > 0) {
|
|
270
|
+
queryParams.append('unitId', params.unitId.join(','));
|
|
271
|
+
}
|
|
272
|
+
return this.makeRequest(`stats/nodes/daily${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
|
|
273
|
+
};
|
|
251
274
|
this.baseURL = baseURL;
|
|
252
275
|
this.headers = {};
|
|
253
276
|
this.debug = false;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiClient, HttpError } from './client';
|
|
2
2
|
import * as ApiTypes from './types/storage';
|
|
3
3
|
import * as AuthTypes from './types/auth';
|
|
4
|
+
import * as StatsTypes from './types/stats';
|
|
4
5
|
import * as ApiInterfaces from './interfaces';
|
|
5
6
|
import * as BridgeTypes from './types/bridge';
|
|
6
|
-
export { ApiClient, ApiTypes, AuthTypes, ApiInterfaces, HttpError, BridgeTypes };
|
|
7
|
+
export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes };
|
package/dist/api/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
36
|
+
exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
37
37
|
const client_1 = require("./client");
|
|
38
38
|
Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return client_1.ApiClient; } });
|
|
39
39
|
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return client_1.HttpError; } });
|
|
@@ -41,6 +41,8 @@ const ApiTypes = __importStar(require("./types/storage"));
|
|
|
41
41
|
exports.ApiTypes = ApiTypes;
|
|
42
42
|
const AuthTypes = __importStar(require("./types/auth"));
|
|
43
43
|
exports.AuthTypes = AuthTypes;
|
|
44
|
+
const StatsTypes = __importStar(require("./types/stats"));
|
|
45
|
+
exports.StatsTypes = StatsTypes;
|
|
44
46
|
const ApiInterfaces = __importStar(require("./interfaces"));
|
|
45
47
|
exports.ApiInterfaces = ApiInterfaces;
|
|
46
48
|
const BridgeTypes = __importStar(require("./types/bridge"));
|
package/dist/api/interfaces.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StorageUnit, CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse, UpdateUnitRequest, UpdateUnitResponse, ActionResponse, UpdateRepoResponse, UpdateRepoRequest, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateUnitRequest, ValidateUnitResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse, GetUnitNodeStatsRequest, GetUnitNodeStatsResponse } from "./types/storage";
|
|
2
2
|
import { RegisterBody, LoginBody, RegisterResponse, LoginResponse, LogoutResponse, ActivateResponse, DeactivateResponse, RefreshTokenResponse, RefreshTokenErrorResponse } from "./types/auth";
|
|
3
|
-
import { StatsQueryParams, StatsResponse } from "./types/stats";
|
|
3
|
+
import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams } from "./types/stats";
|
|
4
4
|
export declare enum ProviderType {
|
|
5
5
|
GOOGLE = "GOOGLE",
|
|
6
6
|
GITHUB = "GITHUB",
|
|
@@ -34,4 +34,6 @@ export interface IApiClient {
|
|
|
34
34
|
userDeactivate(): Promise<DeactivateResponse>;
|
|
35
35
|
getDailyStats(params: StatsQueryParams): Promise<StatsResponse>;
|
|
36
36
|
getMinuteStats(params: StatsQueryParams): Promise<StatsResponse>;
|
|
37
|
+
getNodeStatsMinute(params?: NodeStatsQueryParams): Promise<NodeStatsMinuteResponse>;
|
|
38
|
+
getNodeStatsDaily(params?: NodeStatsQueryParams): Promise<NodeStatsDailyResponse>;
|
|
37
39
|
}
|
|
@@ -18,3 +18,36 @@ export interface StatsData {
|
|
|
18
18
|
size_change: bigint;
|
|
19
19
|
latency_ms: number;
|
|
20
20
|
}
|
|
21
|
+
export interface NodeStatsMinuteResponse {
|
|
22
|
+
success: boolean;
|
|
23
|
+
data: NodeStatsMinuteData[];
|
|
24
|
+
message?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface NodeStatsMinuteData {
|
|
27
|
+
nodeId: string;
|
|
28
|
+
unitId: string;
|
|
29
|
+
nodeStatus: string;
|
|
30
|
+
lastUpdated: Date;
|
|
31
|
+
latency_ms: number;
|
|
32
|
+
}
|
|
33
|
+
export interface NodeStatsDailyResponse {
|
|
34
|
+
success: boolean;
|
|
35
|
+
data: NodeStatsDailyData[];
|
|
36
|
+
message?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface NodeStatsDailyData {
|
|
39
|
+
nodeId: string;
|
|
40
|
+
unitId: string;
|
|
41
|
+
day: number;
|
|
42
|
+
online: number;
|
|
43
|
+
latency_ms: number;
|
|
44
|
+
endpoint: string;
|
|
45
|
+
region: string;
|
|
46
|
+
storageType: string;
|
|
47
|
+
provider: string;
|
|
48
|
+
status: string;
|
|
49
|
+
version: string;
|
|
50
|
+
}
|
|
51
|
+
export interface NodeStatsQueryParams {
|
|
52
|
+
unitId?: string[];
|
|
53
|
+
}
|