@flashbacktech/flashbackclient 0.0.98 → 0.1.1

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.
@@ -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, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse } from './types/stats';
4
+ import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams } from './types/stats';
5
5
  interface ErrorResponse {
6
6
  message?: string;
7
7
  [key: string]: any;
@@ -63,8 +63,8 @@ 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
+ getNodeStatsMinute: (params: NodeStatsQueryParams) => Promise<NodeStatsMinuteResponse>;
67
+ getNodeStatsDaily: (params: NodeStatsDailyQueryParams) => Promise<NodeStatsDailyResponse>;
68
68
  getRepoStats: (params?: {
69
69
  repoId?: string[];
70
70
  }) => Promise<RepoStatsResponse>;
@@ -252,7 +252,7 @@ class ApiClient {
252
252
  };
253
253
  this.getNodeStatsMinute = async (params) => {
254
254
  const queryParams = new URLSearchParams();
255
- if (params && params.unitId && params.unitId.length > 0) {
255
+ if (params.unitId.length > 0) {
256
256
  queryParams.append('unitId', params.unitId.join(','));
257
257
  }
258
258
  const response = await this.makeRequest(`stats/nodes/minute?${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
@@ -268,9 +268,15 @@ class ApiClient {
268
268
  };
269
269
  this.getNodeStatsDaily = async (params) => {
270
270
  const queryParams = new URLSearchParams();
271
- if (params && params.unitId && params.unitId.length > 0) {
271
+ if (params.unitId.length > 0) {
272
272
  queryParams.append('unitId', params.unitId.join(','));
273
273
  }
274
+ if (params.startDate) {
275
+ queryParams.append('startDate', params.startDate.toISOString());
276
+ }
277
+ if (params.endDate) {
278
+ queryParams.append('endDate', params.endDate.toISOString());
279
+ }
274
280
  return this.makeRequest(`stats/nodes/daily${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
275
281
  };
276
282
  this.getRepoStats = async (params) => {
@@ -49,7 +49,12 @@ export interface NodeStatsDailyData {
49
49
  version: string;
50
50
  }
51
51
  export interface NodeStatsQueryParams {
52
- unitId?: string[];
52
+ unitId: string[];
53
+ }
54
+ export interface NodeStatsDailyQueryParams {
55
+ unitId: string[];
56
+ startDate?: Date;
57
+ endDate?: Date;
53
58
  }
54
59
  export interface RepoStatsResponse {
55
60
  success: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.0.98",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"