@flashbacktech/flashbackclient 0.1.23 → 0.1.24
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 +9 -1
- package/dist/api/client.js +25 -0
- package/dist/api/types/storage.d.ts +75 -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 } 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,6 +47,14 @@ 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
|
+
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>;
|
|
50
58
|
createStorageRepo: (data: CreateRepoRequest) => Promise<CreateRepoResponse>;
|
|
51
59
|
getStorageRepos: () => Promise<GetReposResponse>;
|
|
52
60
|
updateStorageRepo: (repoId: string, data: UpdateRepoRequest) => Promise<UpdateRepoResponse>;
|
package/dist/api/client.js
CHANGED
|
@@ -174,6 +174,31 @@ class ApiClient {
|
|
|
174
174
|
this.getUnitNodeStats = async (unitId, data) => {
|
|
175
175
|
return this.makeRequest(`unit/${unitId}/stats`, 'POST', data);
|
|
176
176
|
};
|
|
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);
|
|
201
|
+
};
|
|
177
202
|
////// Repos API
|
|
178
203
|
this.createStorageRepo = async (data) => {
|
|
179
204
|
return this.makeRequest('repo', 'POST', data);
|
|
@@ -179,3 +179,78 @@ 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 extends GetUnitsResponse {
|
|
193
|
+
}
|
|
194
|
+
export interface CreateBucketResponse {
|
|
195
|
+
success: boolean;
|
|
196
|
+
bucketId: string;
|
|
197
|
+
}
|
|
198
|
+
export interface UpdateBucketResponse extends CreateBucketResponse {
|
|
199
|
+
status?: string;
|
|
200
|
+
latency_ms?: number;
|
|
201
|
+
}
|
|
202
|
+
export interface RepoBucketInfo {
|
|
203
|
+
folder: string;
|
|
204
|
+
master: boolean;
|
|
205
|
+
bucketId?: string;
|
|
206
|
+
bucket?: StorageBucket;
|
|
207
|
+
}
|
|
208
|
+
export interface CreateRepoWithBucketsRequest {
|
|
209
|
+
name: string;
|
|
210
|
+
storageType: StorageType;
|
|
211
|
+
mode: ModeType;
|
|
212
|
+
repoBuckets: RepoBucketInfo[];
|
|
213
|
+
}
|
|
214
|
+
export interface UpdateRepoWithBucketsRequest extends CreateRepoWithBucketsRequest {
|
|
215
|
+
}
|
|
216
|
+
export interface StorageRepoWithBuckets {
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
storageType: StorageType;
|
|
220
|
+
mode: ModeType;
|
|
221
|
+
buckets: RepoBucketInfo[];
|
|
222
|
+
apiKeys?: ApiKey[];
|
|
223
|
+
createdAt: string;
|
|
224
|
+
disabled?: boolean;
|
|
225
|
+
}
|
|
226
|
+
export interface ValidateRepoBucketsRequest {
|
|
227
|
+
repoId: string;
|
|
228
|
+
mode: ModeType;
|
|
229
|
+
repoBuckets: RepoBucketInfo[];
|
|
230
|
+
}
|
|
231
|
+
export interface ValidateRepoBucketsResponse {
|
|
232
|
+
success: boolean;
|
|
233
|
+
error_code?: RepoErrorCodes;
|
|
234
|
+
error_message?: string;
|
|
235
|
+
}
|
|
236
|
+
export interface StorageBucketStatusResponse {
|
|
237
|
+
bucketId: string;
|
|
238
|
+
nodeStatus: NodeStatusInfo[];
|
|
239
|
+
}
|
|
240
|
+
export interface GetBucketNodeStatsRequest {
|
|
241
|
+
day: Date;
|
|
242
|
+
}
|
|
243
|
+
export interface GetBucketNodeStatsResponse {
|
|
244
|
+
success: boolean;
|
|
245
|
+
nodeStats: BucketNodeStatsDailyInfo[];
|
|
246
|
+
}
|
|
247
|
+
export interface BucketNodeStatsDailyInfo {
|
|
248
|
+
ip: string;
|
|
249
|
+
host: string;
|
|
250
|
+
perc_uptime: number;
|
|
251
|
+
avg_latency_ms: number;
|
|
252
|
+
version: string;
|
|
253
|
+
node_status: NodeStatusType;
|
|
254
|
+
last_updated: string;
|
|
255
|
+
last_latency_ms: number;
|
|
256
|
+
}
|