@flashbacktech/flashbackclient 0.1.85 → 0.1.87

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.
@@ -6,6 +6,7 @@ import { NodeInfo } from './types/bridge';
6
6
  import { QuotaResponse } from './types/quota';
7
7
  import { DeviceListResponse, DeviceDetailsResponse, SessionListResponse, TrustDeviceRequest, TrustDeviceResponse, UntrustDeviceResponse, RemoveDeviceResponse, RevokeSessionResponse, RevokeAllSessionsResponse, SessionHeartbeatResponse, DeviceInfo } from './types/device';
8
8
  import { BuySubscriptionRequest, BuySubscriptionResponse, GetSubscriptionsResponse, MySubscriptionResponse, PaymentsListResponse, PaymentsQueryParams, CancelSubscriptionResponse } from './types/subscriptions';
9
+ import { WorkspaceTypes } from '.';
9
10
  import { MFAMethodsResponse, MFASetupRequest, MFASetupResponse, MFAStatusResponse, MFAVerificationSetupRequest, MFAVerificationSetupResponse, MFAEnableRequest, MFAEnableResponse, MFADisableResponse, MFAPrimaryRequest, MFAPrimaryResponse, MFAResetResponse, MFAOrganizationEnforceRequest, MFAOrganizationEnforceResponse, MagicLinkActivationRequest, MagicLinkActivationResponse, MagicLinkSendResponse, PasskeyAuthOptionsResult, PasskeyCompleteRegistrationRequest, PasskeyCompleteRegistrationResponse, MFAVerificationRequest, MFAVerificationLoginResponse } from './types/mfa';
10
11
  import { DeleteSettingsRequest, GetSettingsResponse, PartialUpdateSettingsRequest, UpdateSettingsRequest } from './types/settings';
11
12
  import { UpdateUserRoleResponse, UserRoleResponse } from './types/roles';
@@ -167,5 +168,13 @@ export declare class ApiClient implements IApiClient {
167
168
  getUserProfile: () => Promise<UserProfileResponse>;
168
169
  getUserById: (userId: string) => Promise<UserRoleResponse>;
169
170
  updateUserRole: (userId: string, orgRole: number) => Promise<UpdateUserRoleResponse>;
171
+ createWorkspace: (request: WorkspaceTypes.CreateWorkspaceRequest) => Promise<WorkspaceTypes.CreateWorkspaceResponse>;
172
+ getWorkspaces: () => Promise<WorkspaceTypes.GetWorkspacesResponse>;
173
+ getWorkspace: (id: string) => Promise<WorkspaceTypes.GetWorkspaceResponse>;
174
+ updateWorkspace: (id: string, request: WorkspaceTypes.UpdateWorkspaceRequest) => Promise<WorkspaceTypes.UpdateWorkspaceResponse>;
175
+ deleteWorkspace: (id: string) => Promise<WorkspaceTypes.DeleteWorkspaceResponse>;
176
+ addUserToWorkspace: (workspaceId: string, request: WorkspaceTypes.AddUserToWorkspaceRequest) => Promise<WorkspaceTypes.AddUserToWorkspaceResponse>;
177
+ updateWorkspaceUserRole: (workspaceId: string, userId: string, request: WorkspaceTypes.UpdateUserRoleRequest) => Promise<WorkspaceTypes.UpdateUserRoleResponse>;
178
+ removeUserFromWorkspace: (workspaceId: string, userId: string) => Promise<WorkspaceTypes.RemoveUserFromWorkspaceResponse>;
170
179
  }
171
180
  export {};
@@ -417,6 +417,33 @@ class ApiClient {
417
417
  this.updateUserRole = async (userId, orgRole) => {
418
418
  return this.makeRequest(`user/${userId}/role`, 'PUT', { orgRole });
419
419
  };
420
+ // Workspaces APIs
421
+ ////// Workspace Management API
422
+ this.createWorkspace = async (request) => {
423
+ return this.makeRequest('workspace', 'POST', request);
424
+ };
425
+ this.getWorkspaces = async () => {
426
+ return this.makeRequest('workspace', 'GET', null);
427
+ };
428
+ this.getWorkspace = async (id) => {
429
+ return this.makeRequest(`workspace/${id}`, 'GET', null);
430
+ };
431
+ this.updateWorkspace = async (id, request) => {
432
+ return this.makeRequest(`workspace/${id}`, 'PUT', request);
433
+ };
434
+ this.deleteWorkspace = async (id) => {
435
+ return this.makeRequest(`workspace/${id}`, 'DELETE', null);
436
+ };
437
+ ////// Workspace User Management API
438
+ this.addUserToWorkspace = async (workspaceId, request) => {
439
+ return this.makeRequest(`workspace/${workspaceId}/users`, 'POST', request);
440
+ };
441
+ this.updateWorkspaceUserRole = async (workspaceId, userId, request) => {
442
+ return this.makeRequest(`workspace/${workspaceId}/users/${userId}`, 'PUT', request);
443
+ };
444
+ this.removeUserFromWorkspace = async (workspaceId, userId) => {
445
+ return this.makeRequest(`workspace/${workspaceId}/users/${userId}`, 'DELETE', null);
446
+ };
420
447
  this.baseURL = baseURL;
421
448
  this.headers = {};
422
449
  this.debug = false;
@@ -11,4 +11,5 @@ import * as DeviceTypes from './types/device';
11
11
  import * as MFATypes from './types/mfa';
12
12
  import * as SettingsTypes from './types/settings';
13
13
  import * as RolesTypes from './types/roles';
14
- export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes };
14
+ import * as WorkspaceTypes from './types/workspace';
15
+ export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes };
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.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.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; } });
@@ -61,3 +61,5 @@ const SettingsTypes = __importStar(require("./types/settings"));
61
61
  exports.SettingsTypes = SettingsTypes;
62
62
  const RolesTypes = __importStar(require("./types/roles"));
63
63
  exports.RolesTypes = RolesTypes;
64
+ const WorkspaceTypes = __importStar(require("./types/workspace"));
65
+ exports.WorkspaceTypes = WorkspaceTypes;
@@ -216,6 +216,7 @@ export interface CreateRepoWithBucketsRequest {
216
216
  storageType: StorageType;
217
217
  mode: ModeType;
218
218
  repoBuckets: RepoBucketInfo[];
219
+ workspaceId: string;
219
220
  }
220
221
  export interface UpdateRepoWithBucketsRequest extends CreateRepoWithBucketsRequest {
221
222
  }
@@ -0,0 +1,86 @@
1
+ export declare enum AccessType {
2
+ READ = "READ",
3
+ WRITE = "WRITE",
4
+ ADMIN = "ADMIN"
5
+ }
6
+ export interface Workspace {
7
+ id: string;
8
+ name: string;
9
+ orgId: string;
10
+ deletedAt?: Date | null;
11
+ default?: boolean;
12
+ }
13
+ export interface WorkspaceUser {
14
+ userId: string;
15
+ role: AccessType;
16
+ user: {
17
+ id: string;
18
+ name: string;
19
+ lastName: string;
20
+ email: string;
21
+ orgRole: number | null;
22
+ };
23
+ }
24
+ export interface CreateWorkspaceRequest {
25
+ name: string;
26
+ }
27
+ export interface CreateWorkspaceResponse {
28
+ success: boolean;
29
+ workspace: {
30
+ id: string;
31
+ name: string;
32
+ orgId: string;
33
+ };
34
+ }
35
+ export interface GetWorkspacesResponse {
36
+ success: boolean;
37
+ workspaces: Array<{
38
+ id: string;
39
+ name: string;
40
+ orgId: string;
41
+ users: WorkspaceUser[];
42
+ }>;
43
+ }
44
+ export interface GetWorkspaceResponse {
45
+ success: boolean;
46
+ workspace: {
47
+ id: string;
48
+ name: string;
49
+ orgId: string;
50
+ users: WorkspaceUser[];
51
+ };
52
+ }
53
+ export interface UpdateWorkspaceRequest {
54
+ name?: string;
55
+ }
56
+ export interface UpdateWorkspaceResponse {
57
+ success: boolean;
58
+ workspace: {
59
+ id: string;
60
+ name: string;
61
+ orgId: string;
62
+ };
63
+ }
64
+ export interface DeleteWorkspaceResponse {
65
+ success: boolean;
66
+ }
67
+ export interface AddUserToWorkspaceRequest {
68
+ userId: string;
69
+ role: AccessType;
70
+ }
71
+ export interface AddUserToWorkspaceResponse {
72
+ success: boolean;
73
+ }
74
+ export interface UpdateUserRoleRequest {
75
+ role: AccessType;
76
+ }
77
+ export interface UpdateUserRoleResponse {
78
+ success: boolean;
79
+ }
80
+ export interface RemoveUserFromWorkspaceResponse {
81
+ success: boolean;
82
+ }
83
+ export interface WorkspaceErrorResponse {
84
+ success: false;
85
+ message: string;
86
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccessType = void 0;
4
+ var AccessType;
5
+ (function (AccessType) {
6
+ AccessType["READ"] = "READ";
7
+ AccessType["WRITE"] = "WRITE";
8
+ AccessType["ADMIN"] = "ADMIN";
9
+ })(AccessType || (exports.AccessType = AccessType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.85",
3
+ "version": "0.1.87",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"