@flashbacktech/flashbackclient 0.1.86 → 0.1.88

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,10 +6,12 @@ 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';
12
13
  import { UserProfileResponse } from './types/roles';
14
+ import { CreateOrgUserRequest, CreateOrgUserResponse, DeleteOrgUserResponse, GetOrganizationResponse, ListOrgUsersResponse, OrgUserResponse, UpdateOrganizationBody, UpdateOrganizationResponse, UpdateOrgUserRequest, UpdateOrgUserResponse } from './types/organization';
13
15
  interface ErrorResponse {
14
16
  message?: string;
15
17
  [key: string]: any;
@@ -167,5 +169,27 @@ export declare class ApiClient implements IApiClient {
167
169
  getUserProfile: () => Promise<UserProfileResponse>;
168
170
  getUserById: (userId: string) => Promise<UserRoleResponse>;
169
171
  updateUserRole: (userId: string, orgRole: number) => Promise<UpdateUserRoleResponse>;
172
+ createWorkspace: (request: WorkspaceTypes.CreateWorkspaceRequest) => Promise<WorkspaceTypes.CreateWorkspaceResponse>;
173
+ getWorkspaces: () => Promise<WorkspaceTypes.GetWorkspacesResponse>;
174
+ getWorkspace: (id: string) => Promise<WorkspaceTypes.GetWorkspaceResponse>;
175
+ updateWorkspace: (id: string, request: WorkspaceTypes.UpdateWorkspaceRequest) => Promise<WorkspaceTypes.UpdateWorkspaceResponse>;
176
+ deleteWorkspace: (id: string) => Promise<WorkspaceTypes.DeleteWorkspaceResponse>;
177
+ addUserToWorkspace: (workspaceId: string, request: WorkspaceTypes.AddUserToWorkspaceRequest) => Promise<WorkspaceTypes.AddUserToWorkspaceResponse>;
178
+ updateWorkspaceUserRole: (workspaceId: string, userId: string, request: WorkspaceTypes.UpdateUserRoleRequest) => Promise<WorkspaceTypes.UpdateUserRoleResponse>;
179
+ removeUserFromWorkspace: (workspaceId: string, userId: string) => Promise<WorkspaceTypes.RemoveUserFromWorkspaceResponse>;
180
+ getOrganizationUsers: () => Promise<ListOrgUsersResponse>;
181
+ createOrganizationUser: (request: CreateOrgUserRequest) => Promise<CreateOrgUserResponse>;
182
+ getOrganizationUser: (userId: string) => Promise<OrgUserResponse | {
183
+ success: false;
184
+ message: string;
185
+ }>;
186
+ updateOrganizationUser: (userId: string, request: UpdateOrgUserRequest) => Promise<UpdateOrgUserResponse>;
187
+ deleteOrganizationUser: (userId: string) => Promise<DeleteOrgUserResponse>;
188
+ activateOrganizationUser: (userId: string) => Promise<{
189
+ success: boolean;
190
+ message: string;
191
+ }>;
192
+ getOrganization: (orgId: string) => Promise<GetOrganizationResponse>;
193
+ updateOrganization: (orgId: string, request: UpdateOrganizationBody) => Promise<UpdateOrganizationResponse>;
170
194
  }
171
195
  export {};
@@ -417,6 +417,57 @@ class ApiClient {
417
417
  this.updateUserRole = async (userId, orgRole) => {
418
418
  return this.makeRequest(`user/${userId}/role`, 'PUT', { orgRole });
419
419
  };
420
+ ////// Workspace Management API
421
+ this.createWorkspace = async (request) => {
422
+ return this.makeRequest('workspace', 'POST', request);
423
+ };
424
+ this.getWorkspaces = async () => {
425
+ return this.makeRequest('workspace', 'GET', null);
426
+ };
427
+ this.getWorkspace = async (id) => {
428
+ return this.makeRequest(`workspace/${id}`, 'GET', null);
429
+ };
430
+ this.updateWorkspace = async (id, request) => {
431
+ return this.makeRequest(`workspace/${id}`, 'PUT', request);
432
+ };
433
+ this.deleteWorkspace = async (id) => {
434
+ return this.makeRequest(`workspace/${id}`, 'DELETE', null);
435
+ };
436
+ ////// Workspace User Management API
437
+ this.addUserToWorkspace = async (workspaceId, request) => {
438
+ return this.makeRequest(`workspace/${workspaceId}/users`, 'POST', request);
439
+ };
440
+ this.updateWorkspaceUserRole = async (workspaceId, userId, request) => {
441
+ return this.makeRequest(`workspace/${workspaceId}/users/${userId}`, 'PUT', request);
442
+ };
443
+ this.removeUserFromWorkspace = async (workspaceId, userId) => {
444
+ return this.makeRequest(`workspace/${workspaceId}/users/${userId}`, 'DELETE', null);
445
+ };
446
+ // Organization Users Management
447
+ this.getOrganizationUsers = async () => {
448
+ return this.makeRequest('organization/users', 'GET', null);
449
+ };
450
+ this.createOrganizationUser = async (request) => {
451
+ return this.makeRequest('organization/users', 'POST', request);
452
+ };
453
+ this.getOrganizationUser = async (userId) => {
454
+ return this.makeRequest(`organization/users/${userId}`, 'GET', null);
455
+ };
456
+ this.updateOrganizationUser = async (userId, request) => {
457
+ return this.makeRequest(`organization/users/${userId}`, 'PUT', request);
458
+ };
459
+ this.deleteOrganizationUser = async (userId) => {
460
+ return this.makeRequest(`organization/users/${userId}`, 'DELETE', null);
461
+ };
462
+ this.activateOrganizationUser = async (userId) => {
463
+ return this.makeRequest(`organization/users/${userId}/activate`, 'POST', null);
464
+ };
465
+ this.getOrganization = async (orgId) => {
466
+ return this.makeRequest(`organization/${orgId}`, 'GET', null);
467
+ };
468
+ this.updateOrganization = async (orgId, request) => {
469
+ return this.makeRequest(`organization/${orgId}`, 'PUT', request);
470
+ };
420
471
  this.baseURL = baseURL;
421
472
  this.headers = {};
422
473
  this.debug = false;
@@ -11,4 +11,6 @@ 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
+ import * as OrganizationTypes from './types/organization';
16
+ export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes };
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.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; } });
@@ -61,3 +61,7 @@ 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;
66
+ const OrganizationTypes = __importStar(require("./types/organization"));
67
+ exports.OrganizationTypes = OrganizationTypes;
@@ -77,6 +77,7 @@ export interface RegisterResponse {
77
77
  email: string;
78
78
  name: string;
79
79
  orgId?: string;
80
+ orgRole?: number;
80
81
  };
81
82
  error_code?: string;
82
83
  message?: string;
@@ -0,0 +1,89 @@
1
+ import { OrgRoles } from "./roles";
2
+ export interface CreateOrgUserRequest {
3
+ email: string;
4
+ password: string;
5
+ firstName: string;
6
+ lastName: string;
7
+ orgRole?: number;
8
+ }
9
+ export interface UpdateOrgUserRequest {
10
+ name?: string;
11
+ lastName?: string;
12
+ orgRole?: number;
13
+ }
14
+ export interface OrgUserResponse {
15
+ id: string;
16
+ email: string;
17
+ name: string;
18
+ lastName: string;
19
+ orgId: string | null;
20
+ orgRole: number | null;
21
+ validated: boolean;
22
+ deletedAt: Date | null;
23
+ orgRoleDescription: string;
24
+ orgRoles: OrgRoles[];
25
+ }
26
+ export interface ListOrgUsersResponse {
27
+ success: boolean;
28
+ data: OrgUserResponse[];
29
+ total: number;
30
+ }
31
+ export interface CreateOrgUserResponse {
32
+ success: boolean;
33
+ data: OrgUserResponse;
34
+ message: string;
35
+ }
36
+ export interface UpdateOrgUserResponse {
37
+ success: boolean;
38
+ data: OrgUserResponse;
39
+ message: string;
40
+ }
41
+ export interface DeleteOrgUserResponse {
42
+ success: boolean;
43
+ message: string;
44
+ }
45
+ export interface OrganizationData {
46
+ id: string;
47
+ name: string;
48
+ domain: string;
49
+ address1?: string | null;
50
+ address2?: string | null;
51
+ city?: string | null;
52
+ zipcode?: string | null;
53
+ phone?: string | null;
54
+ state?: string | null;
55
+ country?: string | null;
56
+ deletedAt?: Date | null;
57
+ reposDisabled: boolean;
58
+ website?: string | null;
59
+ is_business: boolean;
60
+ mfaEnforced: boolean;
61
+ }
62
+ export interface GetOrganizationParams {
63
+ orgId: string;
64
+ }
65
+ export interface GetOrganizationResponse {
66
+ success: boolean;
67
+ data: OrganizationData | null;
68
+ message?: string;
69
+ }
70
+ export interface UpdateOrganizationParams {
71
+ orgId: string;
72
+ }
73
+ export interface UpdateOrganizationBody {
74
+ name?: string;
75
+ address1?: string;
76
+ address2?: string;
77
+ city?: string;
78
+ zipcode?: string;
79
+ phone?: string;
80
+ state?: string;
81
+ country?: string;
82
+ is_business?: boolean;
83
+ mfaEnforced?: boolean;
84
+ }
85
+ export interface UpdateOrganizationResponse {
86
+ success: boolean;
87
+ data: OrganizationData | null;
88
+ message: string;
89
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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.86",
3
+ "version": "0.1.88",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"