@flashbacktech/flashbackclient 0.1.23 → 0.1.25
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/api/client.d.ts +17 -5
- package/dist/api/client.js +36 -12
- package/dist/api/types/storage.d.ts +77 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
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, CreateBucketRequest, CreateBucketResponse, UpdateBucketRequest, UpdateBucketResponse, ValidateBucketRequest, ValidateBucketResponse, StorageBucket, GetBucketsResponse, StorageBucketStatusResponse, GetBucketNodeStatsRequest, GetBucketNodeStatsResponse, CreateRepoWithBucketsRequest, UpdateRepoWithBucketsRequest, ValidateRepoBucketsRequest, ValidateRepoBucketsResponse } from './types/storage';
|
|
2
2
|
import { IApiClient, ProviderType } from './interfaces';
|
|
3
3
|
import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse, ResetPasswordBody } from './types/auth';
|
|
4
4
|
import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams } from './types/stats';
|
|
@@ -47,12 +47,24 @@ export declare class ApiClient implements IApiClient {
|
|
|
47
47
|
getAvailableStorageUnits: () => Promise<StorageUnit[]>;
|
|
48
48
|
getStorageUnitStatus: (unitId: string) => Promise<StorageUnitStatusResponse>;
|
|
49
49
|
getUnitNodeStats: (unitId: string, data: GetUnitNodeStatsRequest) => Promise<GetUnitNodeStatsResponse>;
|
|
50
|
-
|
|
50
|
+
createStorageBucket: (data: CreateBucketRequest) => Promise<CreateBucketResponse>;
|
|
51
|
+
getStorageBuckets: () => Promise<GetBucketsResponse>;
|
|
52
|
+
validateStorageBucket: (bucketId: string, data: ValidateBucketRequest) => Promise<ValidateBucketResponse>;
|
|
53
|
+
updateStorageBucket: (bucketId: string, data: UpdateBucketRequest) => Promise<UpdateBucketResponse>;
|
|
54
|
+
deleteStorageBucket: (bucketId: string) => Promise<ActionResponse>;
|
|
55
|
+
getAvailableStorageBuckets: () => Promise<StorageBucket[]>;
|
|
56
|
+
getStorageBucketStatus: (bucketId: string) => Promise<StorageBucketStatusResponse>;
|
|
57
|
+
getBucketNodeStats: (bucketId: string, data: GetBucketNodeStatsRequest) => Promise<GetBucketNodeStatsResponse>;
|
|
58
|
+
createStorageRepo(data: CreateRepoRequest): Promise<CreateRepoResponse>;
|
|
59
|
+
createStorageRepo(data: CreateRepoWithBucketsRequest): Promise<CreateRepoResponse>;
|
|
51
60
|
getStorageRepos: () => Promise<GetReposResponse>;
|
|
52
|
-
updateStorageRepo
|
|
61
|
+
updateStorageRepo(repoId: string, data: UpdateRepoRequest): Promise<UpdateRepoResponse>;
|
|
62
|
+
updateStorageRepo(repoId: string, data: UpdateRepoWithBucketsRequest): Promise<UpdateRepoResponse>;
|
|
53
63
|
deleteStorageRepo: (repoId: string) => Promise<ActionResponse>;
|
|
54
|
-
validateNewRepoUnits
|
|
55
|
-
|
|
64
|
+
validateNewRepoUnits(data: ValidateRepoUnitsRequest): Promise<ValidateRepoUnitsResponse>;
|
|
65
|
+
validateNewRepoUnits(data: ValidateRepoBucketsRequest): Promise<ValidateRepoBucketsResponse>;
|
|
66
|
+
validateUpdateRepoUnits(data: ValidateRepoUnitsRequest): Promise<ValidateRepoUnitsResponse>;
|
|
67
|
+
validateUpdateRepoUnits(data: ValidateRepoBucketsRequest): Promise<ValidateRepoBucketsResponse>;
|
|
56
68
|
createRepoKey: (data: CreateRepoKeyRequest) => Promise<CreateRepoKeyResponse>;
|
|
57
69
|
getRepoKeys: (repoId: string) => Promise<GetRepoKeysResponse>;
|
|
58
70
|
updateRepoKey: (repoId: string, keyId: string, data: UpdateRepoKeyRequest) => Promise<UpdateRepoKeyResponse>;
|
package/dist/api/client.js
CHANGED
|
@@ -174,25 +174,37 @@ class ApiClient {
|
|
|
174
174
|
this.getUnitNodeStats = async (unitId, data) => {
|
|
175
175
|
return this.makeRequest(`unit/${unitId}/stats`, 'POST', data);
|
|
176
176
|
};
|
|
177
|
-
//////
|
|
178
|
-
this.
|
|
179
|
-
return this.makeRequest('
|
|
177
|
+
////// Buckets API (new bucket-based endpoints)
|
|
178
|
+
this.createStorageBucket = async (data) => {
|
|
179
|
+
return this.makeRequest('bucket', 'POST', data);
|
|
180
|
+
};
|
|
181
|
+
this.getStorageBuckets = async () => {
|
|
182
|
+
return this.makeRequest('bucket', 'GET', null);
|
|
183
|
+
};
|
|
184
|
+
this.validateStorageBucket = async (bucketId, data) => {
|
|
185
|
+
return this.makeRequest(`bucket/${bucketId}/validate`, 'POST', data);
|
|
186
|
+
};
|
|
187
|
+
this.updateStorageBucket = async (bucketId, data) => {
|
|
188
|
+
return this.makeRequest(`bucket/${bucketId}`, 'PUT', data);
|
|
189
|
+
};
|
|
190
|
+
this.deleteStorageBucket = async (bucketId) => {
|
|
191
|
+
return this.makeRequest(`bucket/${bucketId}`, 'DELETE', null);
|
|
192
|
+
};
|
|
193
|
+
this.getAvailableStorageBuckets = async () => {
|
|
194
|
+
return this.makeRequest('bucket/available', 'GET', null);
|
|
195
|
+
};
|
|
196
|
+
this.getStorageBucketStatus = async (bucketId) => {
|
|
197
|
+
return this.makeRequest(`bucket/${bucketId}/status`, 'GET', null);
|
|
198
|
+
};
|
|
199
|
+
this.getBucketNodeStats = async (bucketId, data) => {
|
|
200
|
+
return this.makeRequest(`bucket/${bucketId}/stats`, 'POST', data);
|
|
180
201
|
};
|
|
181
202
|
this.getStorageRepos = async () => {
|
|
182
203
|
return this.makeRequest('repo', 'GET', null);
|
|
183
204
|
};
|
|
184
|
-
this.updateStorageRepo = async (repoId, data) => {
|
|
185
|
-
return this.makeRequest(`repo/${repoId}`, 'PUT', data);
|
|
186
|
-
};
|
|
187
205
|
this.deleteStorageRepo = async (repoId) => {
|
|
188
206
|
return this.makeRequest(`repo/${repoId}`, 'DELETE', null);
|
|
189
207
|
};
|
|
190
|
-
this.validateNewRepoUnits = async (data) => {
|
|
191
|
-
return this.makeRequest('repo/validate', 'POST', data);
|
|
192
|
-
};
|
|
193
|
-
this.validateUpdateRepoUnits = async (data) => {
|
|
194
|
-
return this.makeRequest(`repo/${data.repoId}/validate`, 'POST', data);
|
|
195
|
-
};
|
|
196
208
|
////// Keys API
|
|
197
209
|
this.createRepoKey = async (data) => {
|
|
198
210
|
return this.makeRequest(`repo/${data.repoId}/apikey`, 'POST', data);
|
|
@@ -320,6 +332,18 @@ class ApiClient {
|
|
|
320
332
|
this.headers = {};
|
|
321
333
|
this.debug = false;
|
|
322
334
|
}
|
|
335
|
+
async createStorageRepo(data) {
|
|
336
|
+
return this.makeRequest('repo', 'POST', data);
|
|
337
|
+
}
|
|
338
|
+
async updateStorageRepo(repoId, data) {
|
|
339
|
+
return this.makeRequest(`repo/${repoId}`, 'PUT', data);
|
|
340
|
+
}
|
|
341
|
+
async validateNewRepoUnits(data) {
|
|
342
|
+
return this.makeRequest('repo/validate', 'POST', data);
|
|
343
|
+
}
|
|
344
|
+
async validateUpdateRepoUnits(data) {
|
|
345
|
+
return this.makeRequest(`repo/${data.repoId}/validate`, 'POST', data);
|
|
346
|
+
}
|
|
323
347
|
////// Stats API
|
|
324
348
|
validateDateRange(startDate, endDate) {
|
|
325
349
|
if (startDate && endDate) {
|
|
@@ -179,3 +179,80 @@ export declare enum RepoErrorCodes {
|
|
|
179
179
|
NORMAL_UNIT_CANNOT_EDIT_FOLDER = "NORMAL_UNIT_CANNOT_EDIT_FOLDER",
|
|
180
180
|
QUOTA_EXCEEDED = "QUOTA_EXCEEDED"
|
|
181
181
|
}
|
|
182
|
+
export interface CreateBucketRequest extends CreateUnitRequest {
|
|
183
|
+
}
|
|
184
|
+
export interface UpdateBucketRequest extends UpdateUnitRequest {
|
|
185
|
+
}
|
|
186
|
+
export interface ValidateBucketRequest extends ValidateUnitRequest {
|
|
187
|
+
}
|
|
188
|
+
export interface ValidateBucketResponse extends ValidateUnitResponse {
|
|
189
|
+
}
|
|
190
|
+
export interface StorageBucket extends StorageUnit {
|
|
191
|
+
}
|
|
192
|
+
export interface GetBucketsResponse {
|
|
193
|
+
success: boolean;
|
|
194
|
+
buckets: StorageBucket[];
|
|
195
|
+
}
|
|
196
|
+
export interface CreateBucketResponse {
|
|
197
|
+
success: boolean;
|
|
198
|
+
bucketId: string;
|
|
199
|
+
}
|
|
200
|
+
export interface UpdateBucketResponse extends CreateBucketResponse {
|
|
201
|
+
status?: string;
|
|
202
|
+
latency_ms?: number;
|
|
203
|
+
}
|
|
204
|
+
export interface RepoBucketInfo {
|
|
205
|
+
folder: string;
|
|
206
|
+
master: boolean;
|
|
207
|
+
bucketId?: string;
|
|
208
|
+
bucket?: StorageBucket;
|
|
209
|
+
}
|
|
210
|
+
export interface CreateRepoWithBucketsRequest {
|
|
211
|
+
name: string;
|
|
212
|
+
storageType: StorageType;
|
|
213
|
+
mode: ModeType;
|
|
214
|
+
repoBuckets: RepoBucketInfo[];
|
|
215
|
+
}
|
|
216
|
+
export interface UpdateRepoWithBucketsRequest extends CreateRepoWithBucketsRequest {
|
|
217
|
+
}
|
|
218
|
+
export interface StorageRepoWithBuckets {
|
|
219
|
+
id: string;
|
|
220
|
+
name: string;
|
|
221
|
+
storageType: StorageType;
|
|
222
|
+
mode: ModeType;
|
|
223
|
+
buckets: RepoBucketInfo[];
|
|
224
|
+
apiKeys?: ApiKey[];
|
|
225
|
+
createdAt: string;
|
|
226
|
+
disabled?: boolean;
|
|
227
|
+
}
|
|
228
|
+
export interface ValidateRepoBucketsRequest {
|
|
229
|
+
repoId: string;
|
|
230
|
+
mode: ModeType;
|
|
231
|
+
repoBuckets: RepoBucketInfo[];
|
|
232
|
+
}
|
|
233
|
+
export interface ValidateRepoBucketsResponse {
|
|
234
|
+
success: boolean;
|
|
235
|
+
error_code?: RepoErrorCodes;
|
|
236
|
+
error_message?: string;
|
|
237
|
+
}
|
|
238
|
+
export interface StorageBucketStatusResponse {
|
|
239
|
+
bucketId: string;
|
|
240
|
+
nodeStatus: NodeStatusInfo[];
|
|
241
|
+
}
|
|
242
|
+
export interface GetBucketNodeStatsRequest {
|
|
243
|
+
day: Date;
|
|
244
|
+
}
|
|
245
|
+
export interface GetBucketNodeStatsResponse {
|
|
246
|
+
success: boolean;
|
|
247
|
+
nodeStats: BucketNodeStatsDailyInfo[];
|
|
248
|
+
}
|
|
249
|
+
export interface BucketNodeStatsDailyInfo {
|
|
250
|
+
ip: string;
|
|
251
|
+
host: string;
|
|
252
|
+
perc_uptime: number;
|
|
253
|
+
avg_latency_ms: number;
|
|
254
|
+
version: string;
|
|
255
|
+
node_status: NodeStatusType;
|
|
256
|
+
last_updated: string;
|
|
257
|
+
last_latency_ms: number;
|
|
258
|
+
}
|