@flashbacktech/flashbackclient 0.1.94 → 0.2.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,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, CreateBucketRequest, CreateBucketResponse, UpdateBucketRequest, UpdateBucketResponse, ValidateBucketRequest, ValidateBucketResponse, StorageBucket, GetBucketsResponse, StorageBucketStatusResponse, GetBucketNodeStatsRequest, GetBucketNodeStatsResponse, CreateRepoWithBucketsRequest, UpdateRepoWithBucketsRequest, ValidateRepoBucketsRequest, ValidateRepoBucketsResponse } from './types/storage';
1
+ import { CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetReposResponse, GetRepoKeysResponse, ActionResponse, UpdateRepoRequest, UpdateRepoResponse, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse, 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, Web3RegisterBody } from './types/auth';
4
4
  import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams, BucketStatsResponse, StatsQueryWithBucketParams, NodeStatsQueryWithBucketParams, NodeStatsDailyQueryWithBucketParams } from './types/stats';
@@ -13,6 +13,7 @@ import { DeleteSettingsRequest, GetSettingsResponse, PartialUpdateSettingsReques
13
13
  import { UpdateUserRoleResponse, UserRoleResponse } from './types/roles';
14
14
  import { UserProfileResponse } from './types/roles';
15
15
  import { CreateOrgUserRequest, CreateOrgUserResponse, DeleteOrgUserResponse, GetOrganizationResponse, ListOrgUsersResponse, OrgUserResponse, UpdateOrganizationBody, UpdateOrganizationResponse, UpdateOrgUserRequest, UpdateOrgUserResponse } from './types/organization';
16
+ import { SystemEventQueryRequest, SystemEventQueryResponse } from './types/systemEvent';
16
17
  interface ErrorResponse {
17
18
  message?: string;
18
19
  [key: string]: any;
@@ -60,16 +61,8 @@ export declare class ApiClient implements IApiClient {
60
61
  revokeToken: (tokenId: string) => Promise<{
61
62
  success: boolean;
62
63
  }>;
63
- createStorageUnit: (data: CreateUnitRequest) => Promise<CreateUnitResponse>;
64
- getStorageUnits: () => Promise<GetUnitsResponse>;
65
- validateStorageUnit: (unitId: string, data: ValidateUnitRequest) => Promise<ValidateUnitResponse>;
66
- updateStorageUnit: (unitId: string, data: UpdateUnitRequest) => Promise<UpdateUnitResponse>;
67
- deleteStorageUnit: (unitId: string) => Promise<ActionResponse>;
68
- getAvailableStorageUnits: () => Promise<StorageUnit[]>;
69
- getStorageUnitStatus: (unitId: string) => Promise<StorageUnitStatusResponse>;
70
- getUnitNodeStats: (unitId: string, data: GetUnitNodeStatsRequest) => Promise<GetUnitNodeStatsResponse>;
71
64
  createStorageBucket: (data: CreateBucketRequest) => Promise<CreateBucketResponse>;
72
- getStorageBuckets: () => Promise<GetBucketsResponse>;
65
+ getStorageBuckets: (workspaceId?: string) => Promise<GetBucketsResponse>;
73
66
  validateStorageBucket: (bucketId: string, data: ValidateBucketRequest) => Promise<ValidateBucketResponse>;
74
67
  updateStorageBucket: (bucketId: string, data: UpdateBucketRequest) => Promise<UpdateBucketResponse>;
75
68
  deleteStorageBucket: (bucketId: string) => Promise<ActionResponse>;
@@ -78,7 +71,7 @@ export declare class ApiClient implements IApiClient {
78
71
  getBucketNodeStats: (bucketId: string, data: GetBucketNodeStatsRequest) => Promise<GetBucketNodeStatsResponse>;
79
72
  createStorageRepo(data: CreateRepoRequest): Promise<CreateRepoResponse>;
80
73
  createStorageRepo(data: CreateRepoWithBucketsRequest): Promise<CreateRepoResponse>;
81
- getStorageRepos: () => Promise<GetReposResponse>;
74
+ getStorageRepos: (workspaceId?: string) => Promise<GetReposResponse>;
82
75
  updateStorageRepo(repoId: string, data: UpdateRepoRequest): Promise<UpdateRepoResponse>;
83
76
  updateStorageRepo(repoId: string, data: UpdateRepoWithBucketsRequest): Promise<UpdateRepoResponse>;
84
77
  deleteStorageRepo: (repoId: string) => Promise<ActionResponse>;
@@ -211,5 +204,6 @@ export declare class ApiClient implements IApiClient {
211
204
  }>;
212
205
  nodeRegister: (data: RegisterRequest) => Promise<RegisterResponse>;
213
206
  nodeUnregister: (data: RegisterRequest) => Promise<RegisterResponse>;
207
+ getSystemEvents: (data: SystemEventQueryRequest) => Promise<SystemEventQueryResponse>;
214
208
  }
215
209
  export {};
@@ -162,37 +162,12 @@ class ApiClient {
162
162
  this.revokeToken = async (tokenId) => {
163
163
  return this.makeRequest(`token/${tokenId}`, 'DELETE', null);
164
164
  };
165
- ////// Units API
166
- this.createStorageUnit = async (data) => {
167
- return this.makeRequest('unit', 'POST', data);
168
- };
169
- this.getStorageUnits = async () => {
170
- return this.makeRequest('unit', 'GET', null);
171
- };
172
- this.validateStorageUnit = async (unitId, data) => {
173
- return this.makeRequest(`unit/${unitId}/validate`, 'POST', data);
174
- };
175
- this.updateStorageUnit = async (unitId, data) => {
176
- return this.makeRequest(`unit/${unitId}`, 'PUT', data);
177
- };
178
- this.deleteStorageUnit = async (unitId) => {
179
- return this.makeRequest(`unit/${unitId}`, 'DELETE', null);
180
- };
181
- this.getAvailableStorageUnits = async () => {
182
- return this.makeRequest('unit/available', 'GET', null);
183
- };
184
- this.getStorageUnitStatus = async (unitId) => {
185
- return this.makeRequest(`unit/${unitId}/status`, 'GET', null);
186
- };
187
- this.getUnitNodeStats = async (unitId, data) => {
188
- return this.makeRequest(`unit/${unitId}/stats`, 'POST', data);
189
- };
190
165
  ////// Buckets API (new bucket-based endpoints)
191
166
  this.createStorageBucket = async (data) => {
192
167
  return this.makeRequest('bucket', 'POST', data);
193
168
  };
194
- this.getStorageBuckets = async () => {
195
- return this.makeRequest('bucket', 'GET', null);
169
+ this.getStorageBuckets = async (workspaceId) => {
170
+ return this.makeRequest('bucket?', 'GET', null);
196
171
  };
197
172
  this.validateStorageBucket = async (bucketId, data) => {
198
173
  return this.makeRequest(`bucket/${bucketId}/validate`, 'POST', data);
@@ -212,8 +187,8 @@ class ApiClient {
212
187
  this.getBucketNodeStats = async (bucketId, data) => {
213
188
  return this.makeRequest(`bucket/${bucketId}/stats`, 'POST', data);
214
189
  };
215
- this.getStorageRepos = async () => {
216
- return this.makeRequest('repo', 'GET', null);
190
+ this.getStorageRepos = async (workspaceId) => {
191
+ return this.makeRequest('repo?workspaceId=' + workspaceId, 'GET', null);
217
192
  };
218
193
  this.deleteStorageRepo = async (repoId) => {
219
194
  return this.makeRequest(`repo/${repoId}`, 'DELETE', null);
@@ -496,6 +471,10 @@ class ApiClient {
496
471
  this.nodeUnregister = async (data) => {
497
472
  return this.makeRequest('unregister', 'POST', data);
498
473
  };
474
+ // System Event API calls
475
+ this.getSystemEvents = async (data) => {
476
+ return this.makeRequest('systemevent', 'POST', data);
477
+ };
499
478
  this.baseURL = baseURL;
500
479
  this.headers = {};
501
480
  this.debug = false;
@@ -14,4 +14,5 @@ import * as RolesTypes from './types/roles';
14
14
  import * as WorkspaceTypes from './types/workspace';
15
15
  import * as OrganizationTypes from './types/organization';
16
16
  import * as NodeRegistrationTypes from './types/noderegistration';
17
- export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes };
17
+ import * as SystemEventTypes from './types/systemEvent';
18
+ export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes };
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.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
36
+ exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = 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; } });
@@ -67,3 +67,5 @@ const OrganizationTypes = __importStar(require("./types/organization"));
67
67
  exports.OrganizationTypes = OrganizationTypes;
68
68
  const NodeRegistrationTypes = __importStar(require("./types/noderegistration"));
69
69
  exports.NodeRegistrationTypes = NodeRegistrationTypes;
70
+ const SystemEventTypes = __importStar(require("./types/systemEvent"));
71
+ exports.SystemEventTypes = SystemEventTypes;
@@ -1,4 +1,4 @@
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';
1
+ import { CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetReposResponse, GetRepoKeysResponse, ActionResponse, UpdateRepoResponse, UpdateRepoRequest, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse, GetBucketsResponse, CreateBucketRequest, CreateBucketResponse, UpdateBucketRequest, UpdateBucketResponse, ValidateBucketRequest, ValidateBucketResponse } from './types/storage';
2
2
  import { RegisterBody, LoginBody, RegisterResponse, LoginResponse, LogoutResponse, ActivateResponse, DeactivateResponse, RefreshTokenResponse, RefreshTokenErrorResponse } from './types/auth';
3
3
  import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams } from './types/stats';
4
4
  import { BuySubscriptionRequest, BuySubscriptionResponse, GetSubscriptionsResponse, MySubscriptionResponse, PaymentsListResponse, PaymentsQueryParams, CancelSubscriptionResponse } from './types/subscriptions';
@@ -10,15 +10,13 @@ export declare enum ProviderType {
10
10
  }
11
11
  export interface IApiClient {
12
12
  authenticate(token: string, provider: ProviderType): Promise<any>;
13
- createStorageUnit(data: CreateUnitRequest): Promise<CreateUnitResponse>;
14
- getStorageUnits(): Promise<GetUnitsResponse>;
15
- updateStorageUnit(unitId: string, data: UpdateUnitRequest): Promise<UpdateUnitResponse>;
16
- deleteStorageUnit(unitId: string): Promise<ActionResponse>;
17
- validateStorageUnit(unitId: string, data: ValidateUnitRequest): Promise<ValidateUnitResponse>;
18
- getAvailableStorageUnits(): Promise<StorageUnit[]>;
19
- getUnitNodeStats(unitId: string, data: GetUnitNodeStatsRequest): Promise<GetUnitNodeStatsResponse>;
13
+ getStorageBuckets(workspaceId?: string): Promise<GetBucketsResponse>;
14
+ createStorageBucket(data: CreateBucketRequest): Promise<CreateBucketResponse>;
15
+ updateStorageBucket(bucketId: string, data: UpdateBucketRequest): Promise<UpdateBucketResponse>;
16
+ deleteStorageBucket(bucketId: string): Promise<ActionResponse>;
17
+ validateStorageBucket(bucketId: string, data: ValidateBucketRequest): Promise<ValidateBucketResponse>;
20
18
  createStorageRepo(data: CreateRepoRequest): Promise<CreateRepoResponse>;
21
- getStorageRepos(): Promise<GetReposResponse>;
19
+ getStorageRepos(workspaceId?: string): Promise<GetReposResponse>;
22
20
  updateStorageRepo(repoId: string, data: UpdateRepoRequest): Promise<UpdateRepoResponse>;
23
21
  deleteStorageRepo(repoId: string): Promise<ActionResponse>;
24
22
  createRepoKey(data: CreateRepoKeyRequest): Promise<CreateRepoKeyResponse>;
@@ -225,6 +225,7 @@ export interface StorageRepoWithBuckets {
225
225
  name: string;
226
226
  storageType: StorageType;
227
227
  mode: ModeType;
228
+ workspaceId: string;
228
229
  buckets: RepoBucketInfo[];
229
230
  apiKeys?: ApiKey[];
230
231
  createdAt: string;
@@ -0,0 +1,58 @@
1
+ export interface SystemEventQueryRequest {
2
+ from_timestamp?: string;
3
+ to_timestamp?: string;
4
+ contextId?: string;
5
+ context?: number;
6
+ event?: number;
7
+ userId?: string;
8
+ workspaceId?: string;
9
+ skip: number;
10
+ take: number;
11
+ }
12
+ export interface SystemEventResponse {
13
+ id: number;
14
+ timestamp: string;
15
+ contextId: string;
16
+ context: string;
17
+ event: string;
18
+ orgId: string;
19
+ userId: string;
20
+ workspaceId: string | null;
21
+ jsonData: string | null;
22
+ }
23
+ export interface SystemEventQueryResponse {
24
+ events: SystemEventResponse[];
25
+ total: number;
26
+ skip: number;
27
+ take: number;
28
+ }
29
+ export declare class ContextTypeHelper {
30
+ static readonly contextTypes: readonly ["workspace", "bucket", "repo", "user", "org", "workspaceuser", "apikey", "usersettings", "orgsettings", "flashbacknode", "orgkey"];
31
+ /**
32
+ * Convert context text to 0-based index
33
+ */
34
+ static toIndex(context: typeof ContextTypeHelper.contextTypes[number]): number;
35
+ /**
36
+ * Convert 0-based index to context text
37
+ */
38
+ static fromIndex(index: number): typeof ContextTypeHelper.contextTypes[number];
39
+ /**
40
+ * Get all valid context types
41
+ */
42
+ static getAllTypes(): readonly string[];
43
+ }
44
+ export declare class EventTypeHelper {
45
+ static readonly eventTypes: readonly ["created", "updated", "deleted"];
46
+ /**
47
+ * Convert event text to 0-based index
48
+ */
49
+ static toIndex(event: typeof EventTypeHelper.eventTypes[number]): number;
50
+ /**
51
+ * Convert 0-based index to event text
52
+ */
53
+ static fromIndex(index: number): typeof EventTypeHelper.eventTypes[number];
54
+ /**
55
+ * Get all valid event types
56
+ */
57
+ static getAllTypes(): readonly string[];
58
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventTypeHelper = exports.ContextTypeHelper = void 0;
4
+ // Helper class for context type translation
5
+ class ContextTypeHelper {
6
+ /**
7
+ * Convert context text to 0-based index
8
+ */
9
+ static toIndex(context) {
10
+ const index = this.contextTypes.indexOf(context);
11
+ if (index === -1) {
12
+ throw new Error(`Invalid context type: ${context}`);
13
+ }
14
+ return index;
15
+ }
16
+ /**
17
+ * Convert 0-based index to context text
18
+ */
19
+ static fromIndex(index) {
20
+ if (index < 0 || index >= this.contextTypes.length) {
21
+ throw new Error(`Invalid context index: ${index}. Must be between 0 and ${this.contextTypes.length - 1}`);
22
+ }
23
+ return this.contextTypes[index];
24
+ }
25
+ /**
26
+ * Get all valid context types
27
+ */
28
+ static getAllTypes() {
29
+ return this.contextTypes;
30
+ }
31
+ }
32
+ exports.ContextTypeHelper = ContextTypeHelper;
33
+ ContextTypeHelper.contextTypes = [
34
+ 'workspace',
35
+ 'bucket',
36
+ 'repo',
37
+ 'user',
38
+ 'org',
39
+ 'workspaceuser',
40
+ 'apikey',
41
+ 'usersettings',
42
+ 'orgsettings',
43
+ 'flashbacknode',
44
+ 'orgkey'
45
+ ];
46
+ // Helper class for event type translation
47
+ class EventTypeHelper {
48
+ /**
49
+ * Convert event text to 0-based index
50
+ */
51
+ static toIndex(event) {
52
+ const index = this.eventTypes.indexOf(event);
53
+ if (index === -1) {
54
+ throw new Error(`Invalid event type: ${event}`);
55
+ }
56
+ return index;
57
+ }
58
+ /**
59
+ * Convert 0-based index to event text
60
+ */
61
+ static fromIndex(index) {
62
+ if (index < 0 || index >= this.eventTypes.length) {
63
+ throw new Error(`Invalid event index: ${index}. Must be between 0 and ${this.eventTypes.length - 1}`);
64
+ }
65
+ return this.eventTypes[index];
66
+ }
67
+ /**
68
+ * Get all valid event types
69
+ */
70
+ static getAllTypes() {
71
+ return this.eventTypes;
72
+ }
73
+ }
74
+ exports.EventTypeHelper = EventTypeHelper;
75
+ EventTypeHelper.eventTypes = [
76
+ 'created',
77
+ 'updated',
78
+ 'deleted'
79
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.94",
3
+ "version": "0.2.1",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"