@frontegg/rest-api 6.0.1-alpha.4 → 7.28.0-alpha.0

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.
Files changed (218) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +30 -0
  3. package/ContextHolder/index.d.ts +160 -0
  4. package/ContextHolder/index.js +278 -0
  5. package/ContextHolder/package.json +6 -0
  6. package/FetchClient.d.ts +42 -0
  7. package/FetchClient.js +260 -0
  8. package/account-settings/index.d.ts +21 -7
  9. package/account-settings/index.js +25 -6
  10. package/account-settings/interfaces.d.ts +9 -2
  11. package/applications/index.d.ts +51 -0
  12. package/applications/index.js +55 -0
  13. package/applications/interfaces.d.ts +49 -0
  14. package/applications/interfaces.js +5 -0
  15. package/applications/package.json +6 -0
  16. package/audits/index.d.ts +27 -15
  17. package/audits/index.js +29 -16
  18. package/audits/interfaces.d.ts +3 -2
  19. package/auth/constants.d.ts +5 -0
  20. package/auth/constants.js +5 -0
  21. package/auth/enums.d.ts +8 -1
  22. package/auth/enums.js +9 -4
  23. package/auth/index.d.ts +833 -428
  24. package/auth/index.js +768 -385
  25. package/auth/interfaces.d.ts +341 -39
  26. package/auth/interfaces.js +19 -9
  27. package/auth/secutiry-poilicy/index.d.ts +60 -41
  28. package/auth/secutiry-poilicy/index.js +99 -45
  29. package/auth/secutiry-poilicy/interfaces.d.ts +62 -2
  30. package/auth/secutiry-poilicy/interfaces.js +5 -1
  31. package/auth/utils.d.ts +10 -0
  32. package/auth/utils.js +35 -0
  33. package/connectivity/index.d.ts +126 -27
  34. package/connectivity/index.js +120 -114
  35. package/constants.d.ts +115 -0
  36. package/constants.js +122 -5
  37. package/directory/index.d.ts +32 -0
  38. package/directory/index.js +30 -0
  39. package/directory/interfaces.d.ts +30 -0
  40. package/directory/interfaces.js +7 -0
  41. package/directory/package.json +6 -0
  42. package/entitlements/index.d.ts +15 -0
  43. package/entitlements/index.js +20 -0
  44. package/entitlements/interfaces.d.ts +13 -0
  45. package/entitlements/interfaces.js +11 -0
  46. package/entitlements/package.json +6 -0
  47. package/error.js +0 -2
  48. package/feature-flags/index.d.ts +18 -0
  49. package/feature-flags/index.js +44 -0
  50. package/feature-flags/interfaces.d.ts +5 -0
  51. package/feature-flags/interfaces.js +1 -0
  52. package/feature-flags/package.json +6 -0
  53. package/groups/enums.d.ts +9 -0
  54. package/groups/enums.js +11 -0
  55. package/groups/index.d.ts +73 -0
  56. package/groups/index.js +62 -0
  57. package/groups/interfaces.d.ts +64 -0
  58. package/groups/interfaces.js +1 -0
  59. package/groups/package.json +6 -0
  60. package/impersonate/index.d.ts +17 -0
  61. package/impersonate/index.js +23 -0
  62. package/impersonate/interfaces.d.ts +12 -0
  63. package/impersonate/interfaces.js +1 -0
  64. package/impersonate/package.json +6 -0
  65. package/index.d.ts +148 -53
  66. package/index.js +103 -31
  67. package/interfaces.d.ts +82 -1
  68. package/interfaces.js +28 -1
  69. package/jwt.js +19 -20
  70. package/metadata/index.d.ts +68 -5
  71. package/metadata/index.js +53 -23
  72. package/metadata/interfaces.d.ts +10 -2
  73. package/node/BaseApiClient.js +37 -0
  74. package/node/ContextHolder/index.js +286 -0
  75. package/node/FetchClient.js +268 -0
  76. package/node/account-settings/index.js +26 -11
  77. package/node/applications/index.js +62 -0
  78. package/node/applications/interfaces.js +12 -0
  79. package/node/audits/index.js +32 -27
  80. package/node/auth/constants.js +13 -0
  81. package/node/auth/enums.js +11 -5
  82. package/node/auth/index.js +807 -644
  83. package/node/auth/interfaces.js +27 -13
  84. package/node/auth/secutiry-poilicy/index.js +100 -66
  85. package/node/auth/secutiry-poilicy/interfaces.js +8 -1
  86. package/node/auth/utils.js +44 -0
  87. package/node/connectivity/index.js +123 -197
  88. package/node/constants.js +124 -6
  89. package/node/directory/index.js +37 -0
  90. package/node/directory/interfaces.js +14 -0
  91. package/node/entitlements/index.js +27 -0
  92. package/node/entitlements/interfaces.js +18 -0
  93. package/node/error.js +0 -4
  94. package/node/feature-flags/index.js +54 -0
  95. package/node/feature-flags/interfaces.js +5 -0
  96. package/node/groups/enums.js +19 -0
  97. package/node/groups/index.js +70 -0
  98. package/node/groups/interfaces.js +5 -0
  99. package/node/impersonate/index.js +29 -0
  100. package/node/impersonate/interfaces.js +5 -0
  101. package/node/index.js +324 -94
  102. package/node/interfaces.js +34 -1
  103. package/node/jwt.js +19 -25
  104. package/node/metadata/index.js +57 -38
  105. package/node/notifications/index.js +34 -31
  106. package/node/reports/index.js +79 -83
  107. package/node/roles/index.js +55 -60
  108. package/node/roles/interfaces.js +9 -1
  109. package/node/routers.js +52 -6
  110. package/node/security-center/index.js +26 -0
  111. package/node/security-center/interfaces.js +74 -0
  112. package/node/sub-tenants/index.js +82 -29
  113. package/node/sub-tenants/interfaces.js +9 -1
  114. package/node/subscriptions/enums.js +13 -9
  115. package/node/subscriptions/index.js +64 -109
  116. package/node/subscriptions/interfaces.js +0 -2
  117. package/node/subscriptions/invoices.js +20 -21
  118. package/node/subscriptions/managedSubscriptions.js +28 -33
  119. package/node/subscriptions/paymentMethods.js +23 -27
  120. package/node/subscriptions/paymentProviders.js +11 -8
  121. package/node/subscriptions/plans.js +13 -12
  122. package/node/subscriptions/providers/stripe/index.js +22 -27
  123. package/node/subscriptions/subscriptions.js +28 -33
  124. package/node/subscriptions/summaries.js +11 -8
  125. package/node/subscriptions/tenantConfiguration.js +13 -12
  126. package/node/subscriptions/vendorPublicConfigurations.js +17 -0
  127. package/node/teams/index.js +108 -121
  128. package/node/teams/interfaces.js +8 -1
  129. package/node/tenants/index.js +63 -21
  130. package/node/tenants/interfaces.js +18 -1
  131. package/node/user-phone-numbers/index.js +38 -0
  132. package/node/user-phone-numbers/interfaces.js +5 -0
  133. package/node/users/index.js +64 -0
  134. package/node/users/interfaces.js +27 -0
  135. package/node/velo/index.js +75 -0
  136. package/node/velo/interfaces.js +5 -0
  137. package/node/vendor/index.js +16 -8
  138. package/notifications/index.d.ts +22 -16
  139. package/notifications/index.js +33 -22
  140. package/package.json +4 -2
  141. package/reports/index.d.ts +50 -44
  142. package/reports/index.js +77 -68
  143. package/reports/interfaces.d.ts +2 -2
  144. package/roles/index.d.ts +45 -34
  145. package/roles/index.js +52 -41
  146. package/roles/interfaces.d.ts +25 -9
  147. package/roles/interfaces.js +6 -1
  148. package/routers.d.ts +6 -1
  149. package/routers.js +45 -2
  150. package/security-center/index.d.ts +15 -0
  151. package/security-center/index.js +19 -0
  152. package/security-center/interfaces.d.ts +115 -0
  153. package/security-center/interfaces.js +63 -0
  154. package/security-center/package.json +6 -0
  155. package/sub-tenants/index.d.ts +57 -8
  156. package/sub-tenants/index.js +84 -19
  157. package/sub-tenants/interfaces.d.ts +68 -10
  158. package/sub-tenants/interfaces.js +6 -1
  159. package/subscriptions/enums.d.ts +7 -0
  160. package/subscriptions/enums.js +10 -8
  161. package/subscriptions/index.d.ts +55 -9
  162. package/subscriptions/index.js +56 -9
  163. package/subscriptions/interfaces.d.ts +7 -3
  164. package/subscriptions/interfaces.js +1 -1
  165. package/subscriptions/invoices.d.ts +16 -13
  166. package/subscriptions/invoices.js +19 -14
  167. package/subscriptions/managedSubscriptions.d.ts +18 -15
  168. package/subscriptions/managedSubscriptions.js +27 -22
  169. package/subscriptions/paymentMethods.d.ts +16 -13
  170. package/subscriptions/paymentMethods.js +22 -18
  171. package/subscriptions/paymentProviders.d.ts +8 -5
  172. package/subscriptions/paymentProviders.js +9 -4
  173. package/subscriptions/plans.d.ts +11 -8
  174. package/subscriptions/plans.js +11 -6
  175. package/subscriptions/providers/stripe/index.d.ts +24 -21
  176. package/subscriptions/providers/stripe/index.js +21 -16
  177. package/subscriptions/subscriptions.d.ts +24 -21
  178. package/subscriptions/subscriptions.js +27 -22
  179. package/subscriptions/summaries.d.ts +7 -4
  180. package/subscriptions/summaries.js +8 -3
  181. package/subscriptions/tenantConfiguration.d.ts +6 -3
  182. package/subscriptions/tenantConfiguration.js +12 -7
  183. package/subscriptions/vendorPublicConfigurations.d.ts +5 -0
  184. package/subscriptions/vendorPublicConfigurations.js +10 -0
  185. package/teams/index.d.ts +38 -115
  186. package/teams/index.js +105 -79
  187. package/teams/interfaces.d.ts +47 -42
  188. package/teams/interfaces.js +5 -1
  189. package/tenants/index.d.ts +25 -26
  190. package/tenants/index.js +61 -12
  191. package/tenants/interfaces.d.ts +85 -0
  192. package/tenants/interfaces.js +14 -1
  193. package/user-phone-numbers/index.d.ts +32 -0
  194. package/user-phone-numbers/index.js +31 -0
  195. package/user-phone-numbers/interfaces.d.ts +32 -0
  196. package/user-phone-numbers/interfaces.js +1 -0
  197. package/user-phone-numbers/package.json +6 -0
  198. package/users/index.d.ts +24 -0
  199. package/users/index.js +55 -0
  200. package/users/interfaces.d.ts +144 -0
  201. package/users/interfaces.js +18 -0
  202. package/users/package.json +6 -0
  203. package/velo/index.d.ts +46 -0
  204. package/velo/index.js +68 -0
  205. package/velo/interfaces.d.ts +108 -0
  206. package/velo/interfaces.js +1 -0
  207. package/velo/package.json +6 -0
  208. package/vendor/index.d.ts +12 -6
  209. package/vendor/index.js +15 -4
  210. package/ContextHolder.d.ts +0 -29
  211. package/ContextHolder.js +0 -80
  212. package/fetch.d.ts +0 -19
  213. package/fetch.js +0 -203
  214. package/node/ContextHolder.js +0 -90
  215. package/node/fetch.js +0 -234
  216. package/node/subscriptions/providers/index.js +0 -18
  217. package/subscriptions/providers/index.d.ts +0 -1
  218. package/subscriptions/providers/index.js +0 -1
@@ -0,0 +1,31 @@
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class PhoneNumbersApi extends BaseApiClient {
4
+ constructor(appName) {
5
+ super(appName);
6
+ this.getUserPhoneNumbers = async queryParams => {
7
+ return this.get(`${urls.identity.phoneNumbers.v1}`, queryParams);
8
+ };
9
+ this.createPhoneNumber = async body => {
10
+ return this.post(`${urls.identity.phoneNumbers.v1}`, body);
11
+ };
12
+ this.deletePhoneNumber = async phoneId => {
13
+ return this.delete(`${urls.identity.phoneNumbers.v1}/${phoneId}`);
14
+ };
15
+ this.preVerifyPhoneNumber = async body => {
16
+ return this.post(`${urls.identity.phoneNumbers.v1}/preverify`, body);
17
+ };
18
+ this.verifyPhoneNumber = async body => {
19
+ return this.post(`${urls.identity.phoneNumbers.v1}/verify`, body);
20
+ };
21
+ this.verifyDeletePhoneNumber = async (phoneId, body) => {
22
+ return this.post(`${urls.identity.phoneNumbers.v1}/${phoneId}/delete/verify`, body);
23
+ };
24
+ }
25
+
26
+ /**
27
+ * Get phone numbers of user
28
+ */
29
+ }
30
+
31
+ export default new PhoneNumbersApi('default');
@@ -0,0 +1,32 @@
1
+ export interface IGetPhoneNumbersQueryParams {
2
+ _limit?: number;
3
+ _offset?: number;
4
+ }
5
+ export type IPhoneNumber = {
6
+ id: string;
7
+ phoneNumber: string;
8
+ verified: boolean;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ };
12
+ export type IUpdatePhoneNumber = {
13
+ phoneNumber: string;
14
+ verify?: boolean;
15
+ };
16
+ export interface IPreVerifyPhoneNumber {
17
+ phoneNumber: string;
18
+ }
19
+ export interface IVerifyPhoneNumber {
20
+ otcToken: string;
21
+ code: string;
22
+ }
23
+ export interface ICreatePhoneNumberResponse {
24
+ otcToken?: string;
25
+ }
26
+ export interface IPreVerifyPhoneNumberResponse {
27
+ otcToken: string;
28
+ }
29
+ export interface IDeletePhoneNumberResponse {
30
+ phoneId: string;
31
+ otcToken: string;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/user-phone-numbers/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,24 @@
1
+ import { GetCurrentUserTenantsResponse, GetUserGroupsParams, GetUserGroupsResponse, GetUserJwtRequestDto, GetUserJwtResponseDto, GetUserRolesResponse, GetUsersRolesParams, IGetUsersV2Response, ISearchUserQueryParamsV2, ISearchUserQueryParamsV3, IUnlockMeRequest, IUpdateUserDto, IUserProfile, IUsersV3Data } from './interfaces';
2
+ import { FronteggPaginationWrapper, UserJwtOptions } from '../interfaces';
3
+ import { BaseApiClient } from '../BaseApiClient';
4
+ export declare class UsersApi extends BaseApiClient {
5
+ constructor(appName: string);
6
+ GetUserJwt: (body: GetUserJwtRequestDto) => Promise<GetUserJwtResponseDto>;
7
+ getUsersV2: (queryParams: ISearchUserQueryParamsV2, options?: UserJwtOptions) => Promise<FronteggPaginationWrapper<IGetUsersV2Response>>;
8
+ getUsersV3: (queryParams: ISearchUserQueryParamsV3, options?: UserJwtOptions) => Promise<FronteggPaginationWrapper<IUsersV3Data>>;
9
+ getUsersRoles: (queryParams: GetUsersRolesParams, options?: UserJwtOptions) => Promise<GetUserRolesResponse[]>;
10
+ getUsersGroups: (queryParams: GetUserGroupsParams, options?: UserJwtOptions) => Promise<GetUserGroupsResponse[]>;
11
+ /**
12
+ * get user tenant and user tenants by user active tenant
13
+ */
14
+ getCurrentUserTenantsV3: (options?: UserJwtOptions) => Promise<GetCurrentUserTenantsResponse>;
15
+ /**
16
+ * get user tenant and user tenants by context tenant
17
+ */
18
+ getCurrentUserTenantsV1: (options?: UserJwtOptions) => Promise<GetCurrentUserTenantsResponse>;
19
+ sendResetBreachedPasswordEmails: () => Promise<void>;
20
+ updateUserProfileV2: (body: Partial<IUpdateUserDto>) => Promise<IUserProfile>;
21
+ unlockMe: (body: IUnlockMeRequest) => Promise<void>;
22
+ }
23
+ declare const _default: UsersApi;
24
+ export default _default;
package/users/index.js ADDED
@@ -0,0 +1,55 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { urls } from '../constants';
3
+ import { BaseApiClient } from '../BaseApiClient';
4
+ export class UsersApi extends BaseApiClient {
5
+ constructor(appName) {
6
+ super(appName);
7
+ this.GetUserJwt = async body => {
8
+ return this.post(`${urls.identity.users.v3}/me/token`, body);
9
+ };
10
+ this.getUsersV2 = async (queryParams, options) => {
11
+ return this.get(urls.identity.users.v2, queryParams, {
12
+ headers: this.extractHeadersFromOptions(options)
13
+ });
14
+ };
15
+ this.getUsersV3 = async (queryParams, options) => {
16
+ return this.get(urls.identity.users.v3, queryParams, {
17
+ headers: this.extractHeadersFromOptions(options)
18
+ });
19
+ };
20
+ this.getUsersRoles = async (queryParams, options) => {
21
+ return this.get(urls.identity.users.roles.v3, _extends({}, queryParams, {
22
+ ids: queryParams.ids.join(',')
23
+ }), {
24
+ headers: this.extractHeadersFromOptions(options)
25
+ });
26
+ };
27
+ this.getUsersGroups = async (queryParams, options) => {
28
+ return this.get(urls.identity.users.groups.v3, _extends({}, queryParams, {
29
+ ids: queryParams.ids.join(',')
30
+ }), {
31
+ headers: this.extractHeadersFromOptions(options)
32
+ });
33
+ };
34
+ this.getCurrentUserTenantsV3 = async options => {
35
+ return this.get(urls.identity.users.tenants.me.v3, undefined, {
36
+ headers: this.extractHeadersFromOptions(options)
37
+ });
38
+ };
39
+ this.getCurrentUserTenantsV1 = async options => {
40
+ return this.get(urls.identity.users.tenants.me.v1, undefined, {
41
+ headers: this.extractHeadersFromOptions(options)
42
+ });
43
+ };
44
+ this.sendResetBreachedPasswordEmails = async () => {
45
+ return this.post(urls.identity.users.passwords.resetBreachedPasswords.v1);
46
+ };
47
+ this.updateUserProfileV2 = async body => {
48
+ return this.put(`${urls.identity.users.v2}/me`, body);
49
+ };
50
+ this.unlockMe = async body => {
51
+ return this.post(`${urls.identity.users.v3}/me/unlock`, body);
52
+ };
53
+ }
54
+ }
55
+ export default new UsersApi('default');
@@ -0,0 +1,144 @@
1
+ import { PaginationOrderEnum } from '../interfaces';
2
+ import { ITenantsResponse } from '../tenants/interfaces';
3
+ import { IRole } from '../roles/interfaces';
4
+ import { ITeamUserPermission, UserManagedByEnum } from '../teams/interfaces';
5
+ import { IGroupResponse } from '../groups/interfaces';
6
+ import { UserEntitlementsContext as UserEntitlementsResponseV2 } from '@frontegg/entitlements-javascript-commons';
7
+ export declare enum SortByEnum {
8
+ createdAt = "createdAt",
9
+ name = "name",
10
+ email = "email",
11
+ id = "id",
12
+ verified = "verified",
13
+ isLocked = "isLocked",
14
+ provider = "provider",
15
+ tenantId = "tenantId"
16
+ }
17
+ export interface GetUserJwtRequestDto {
18
+ tenantId: string;
19
+ }
20
+ export interface GetUserJwtResponseDto {
21
+ accessToken: string;
22
+ expires: string;
23
+ expiresIn: number;
24
+ }
25
+ export interface IGetUserQueryParams {
26
+ _limit?: number;
27
+ _offset?: number;
28
+ ids?: string;
29
+ _sortBy?: SortByEnum;
30
+ _order?: PaginationOrderEnum;
31
+ }
32
+ export interface ISearchUserQueryParamsV2 extends IGetUserQueryParams {
33
+ _filter?: string;
34
+ metadata?: string;
35
+ _includeSubTenants?: boolean;
36
+ }
37
+ export interface ISearchUserQueryParamsV3 extends IGetUserQueryParams {
38
+ _email?: string;
39
+ _tenantId?: string;
40
+ _includeSubTenants?: boolean;
41
+ _preset?: GetUsersFilterPreset;
42
+ _maxInactiveSeconds?: number;
43
+ }
44
+ export interface IUserTenantData {
45
+ tenantId: string;
46
+ roles: IRole[];
47
+ }
48
+ export interface IBaseUserData {
49
+ id: string;
50
+ email: string;
51
+ name: string;
52
+ /**
53
+ * @deprecated
54
+ * use profilePictureUrl instead
55
+ */
56
+ profileImage?: string;
57
+ profilePictureUrl?: string | null;
58
+ }
59
+ export interface IBaseGetUserResponse extends IBaseUserData {
60
+ sub: string;
61
+ verified: boolean;
62
+ mfaEnrolled: boolean;
63
+ mfaBypass?: boolean;
64
+ phoneNumber?: string;
65
+ provider?: string;
66
+ tenantId: string;
67
+ tenantIds: string[];
68
+ activatedForTenant?: boolean;
69
+ isLocked?: boolean;
70
+ tenants: IUserTenantData[];
71
+ managedBy?: UserManagedByEnum;
72
+ invisible?: true;
73
+ superUser?: true;
74
+ metadata: string;
75
+ createdAt?: Date;
76
+ lastLogin?: Date;
77
+ subAccountAccessAllowed?: boolean;
78
+ temporaryExpirationDate?: Date;
79
+ isDisabled?: boolean;
80
+ entitlements?: UserEntitlementsResponseV2;
81
+ }
82
+ export type IUserProfile = IGetUsersV2Response;
83
+ export interface IGetUsersV2Response extends IBaseGetUserResponse {
84
+ roles: IRole[];
85
+ /**
86
+ * @deprecated
87
+ * use roles instead
88
+ */
89
+ rolesIds?: string[];
90
+ permissions: ITeamUserPermission[];
91
+ groups?: Pick<IGroupResponse, 'id' | 'roles'>[];
92
+ }
93
+ export interface IGetUserAuthorizationResponse {
94
+ permissions: ITeamUserPermission[];
95
+ roles: IRole[];
96
+ }
97
+ export type IUsersV3Data = IBaseGetUserResponse;
98
+ export declare enum GetUsersFilterPreset {
99
+ MFA_UNENROLLED = "mfa-unenrolled",
100
+ BREACHED_PASSWORDS = "breached-passwords",
101
+ INACTIVE = "inactive"
102
+ }
103
+ export interface GetUsersRolesParams {
104
+ ids: string[];
105
+ }
106
+ export interface GetUserRolesResponse {
107
+ vendorId: string;
108
+ tenantId: string;
109
+ userId: string;
110
+ roleIds: string[];
111
+ }
112
+ export interface GetUserGroupsParams {
113
+ ids: string[];
114
+ }
115
+ export interface GetUserGroupsResponse {
116
+ vendorId: string;
117
+ tenantId: string;
118
+ userId: string;
119
+ groupIds: string[];
120
+ }
121
+ export interface GetCurrentUserTenantsResponse {
122
+ tenants: ITenantsResponse[];
123
+ activeTenant: ITenantsResponse;
124
+ }
125
+ export interface IUpdateUserDto {
126
+ userAgent: string;
127
+ ipAddress: string;
128
+ name?: string;
129
+ phoneNumber?: string;
130
+ profilePictureUrl?: string | null;
131
+ metadata?: string;
132
+ sourceMetadata?: SourceMetadata;
133
+ provider?: typeof providersArray[number];
134
+ managedBy?: UserManagedByEnum;
135
+ }
136
+ export interface SourceMetadata {
137
+ source: 'SCIM';
138
+ sourceVersion: number;
139
+ sourceId: string;
140
+ }
141
+ export declare const providersArray: string[];
142
+ export interface IUnlockMeRequest {
143
+ token: string;
144
+ }
@@ -0,0 +1,18 @@
1
+ export let SortByEnum;
2
+ (function (SortByEnum) {
3
+ SortByEnum["createdAt"] = "createdAt";
4
+ SortByEnum["name"] = "name";
5
+ SortByEnum["email"] = "email";
6
+ SortByEnum["id"] = "id";
7
+ SortByEnum["verified"] = "verified";
8
+ SortByEnum["isLocked"] = "isLocked";
9
+ SortByEnum["provider"] = "provider";
10
+ SortByEnum["tenantId"] = "tenantId";
11
+ })(SortByEnum || (SortByEnum = {}));
12
+ export let GetUsersFilterPreset;
13
+ (function (GetUsersFilterPreset) {
14
+ GetUsersFilterPreset["MFA_UNENROLLED"] = "mfa-unenrolled";
15
+ GetUsersFilterPreset["BREACHED_PASSWORDS"] = "breached-passwords";
16
+ GetUsersFilterPreset["INACTIVE"] = "inactive";
17
+ })(GetUsersFilterPreset || (GetUsersFilterPreset = {}));
18
+ export const providersArray = ['local', 'saml', 'google', 'github', 'facebook', 'microsoft', 'scim2', 'slack'];
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/users/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,46 @@
1
+ import { IGetVeloConversationPayload, IGetVeloConversationResourcePayload, ISendVeloConversationApiResponsePayload, ISendVeloConversationMessagePayload, IVeloAgentConfigResponse, IVeloConversationResource, IVeloConversationsResponse, IVeloMessageStream } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class VeloApi extends BaseApiClient {
4
+ constructor(appName: string);
5
+ /**
6
+ * Get Velo agents config
7
+ * @returns {Promise<IVeloAgentConfigResponse[]>}
8
+ */
9
+ getAgentsConfig: () => Promise<{
10
+ agents: IVeloAgentConfigResponse[];
11
+ }>;
12
+ /**
13
+ * Get Velo conversations list
14
+ * @returns {Promise<IVeloConversationsResponse[]>}
15
+ */
16
+ getConversations: () => Promise<{
17
+ conversations: IVeloConversationsResponse[];
18
+ }>;
19
+ /**
20
+ * Get Velo conversation by id
21
+ * @returns {Promise<IVeloConversationsResponse>}
22
+ */
23
+ getConversationById: (payload: IGetVeloConversationPayload) => Promise<IVeloConversationsResponse>;
24
+ /**
25
+ * Create a new conversation and send the prompt message
26
+ * @returns {Promise<IVeloMessageStream>}
27
+ */
28
+ createConversation: (payload: Omit<ISendVeloConversationMessagePayload, "conversationId">) => Promise<IVeloMessageStream>;
29
+ /**
30
+ * Send a new conversation message
31
+ * @returns {Promise<IVeloMessageStream>}
32
+ */
33
+ sendMessage: (payload: ISendVeloConversationMessagePayload) => Promise<IVeloMessageStream>;
34
+ /**
35
+ * Send an api response conversation message
36
+ * @returns {Promise<IVeloMessageStream>}
37
+ */
38
+ sendApiResponse: (payload: ISendVeloConversationApiResponsePayload) => Promise<IVeloMessageStream>;
39
+ /**
40
+ * Send an api response conversation message
41
+ * @returns {Promise<IVeloMessageStream>}
42
+ */
43
+ getConversationResource: (payload: IGetVeloConversationResourcePayload) => Promise<IVeloConversationResource>;
44
+ }
45
+ declare const _default: VeloApi;
46
+ export default _default;
package/velo/index.js ADDED
@@ -0,0 +1,68 @@
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ const VeloDebugHeaders = {
4
+ 'x-frontegg-api-key': 'my-frontegg-api-key',
5
+ 'frontegg-vendor-id': '04ae2174-d8d9-4a90-8bab-2548e210a508',
6
+ 'frontegg-tenant-id': '02e6ab6f-8b25-48e4-b06d-2c53745ce213',
7
+ 'frontegg-user-id': 'e5c397a1-7120-4753-9216-e5d7f35d1f2d'
8
+ };
9
+ export class VeloApi extends BaseApiClient {
10
+ constructor(appName) {
11
+ super(appName);
12
+ this.getAgentsConfig = async () => {
13
+ return this.get(`${urls.velo.v1}/config`, undefined, {
14
+ headers: VeloDebugHeaders
15
+ });
16
+ };
17
+ this.getConversations = async () => {
18
+ return this.get(`${urls.velo.v1}/conversations`, undefined, {
19
+ headers: VeloDebugHeaders
20
+ });
21
+ };
22
+ this.getConversationById = async payload => {
23
+ return this.get(`${urls.velo.v1}/conversation/${payload.id}`, undefined, {
24
+ headers: VeloDebugHeaders
25
+ });
26
+ };
27
+ this.createConversation = async payload => {
28
+ return this.post(`${urls.velo.v1}/conversations`, {
29
+ message: payload.message,
30
+ stream: payload.stream
31
+ }, {
32
+ responseType: payload.stream === false ? 'json' : 'stream',
33
+ headers: VeloDebugHeaders
34
+ });
35
+ };
36
+ this.sendMessage = async payload => {
37
+ return this.post(`${urls.velo.v1}/conversation/${payload.conversationId}/messages`, {
38
+ message: payload.message,
39
+ stream: payload.stream
40
+ }, {
41
+ responseType: payload.stream === false ? 'json' : 'stream',
42
+ headers: VeloDebugHeaders
43
+ });
44
+ };
45
+ this.sendApiResponse = async payload => {
46
+ return this.post(`${urls.velo.v1}/conversation/${payload.conversationId}/response/${payload.callId}`, {
47
+ data: payload.data,
48
+ status: payload.status,
49
+ stream: payload.stream
50
+ }, {
51
+ responseType: payload.stream === false ? 'json' : 'stream',
52
+ headers: VeloDebugHeaders
53
+ });
54
+ };
55
+ this.getConversationResource = async payload => {
56
+ return this.get(`${urls.velo.v1}/conversation/${payload.conversationId}/resource/${payload.resourceId}`, undefined, {
57
+ headers: VeloDebugHeaders
58
+ });
59
+ };
60
+ }
61
+
62
+ /**
63
+ * Get Velo agents config
64
+ * @returns {Promise<IVeloAgentConfigResponse[]>}
65
+ */
66
+ }
67
+
68
+ export default new VeloApi('default');
@@ -0,0 +1,108 @@
1
+ export interface IVeloApiCallMessage {
2
+ /**
3
+ * The role of the messages author, in this case `tool`.
4
+ */
5
+ role: 'tool';
6
+ /**
7
+ * The id of the tool call.
8
+ */
9
+ tool_call_id: string;
10
+ /**
11
+ * The url to call in the API.
12
+ */
13
+ url: string;
14
+ /**
15
+ * The method to use in the API call.
16
+ */
17
+ method: string;
18
+ /**
19
+ * The body of the API call.
20
+ */
21
+ body: Record<string, string>;
22
+ /**
23
+ * The message to display while the API call is loading.
24
+ */
25
+ loadingMessage: string;
26
+ }
27
+ export interface IVeloUserMessage {
28
+ /**
29
+ * The role of the messages author, in this case `user`.
30
+ */
31
+ role: 'user';
32
+ /**
33
+ * The contents of the user message.
34
+ */
35
+ content: string;
36
+ /**
37
+ * An optional name for the participant. Provides the model information to
38
+ * differentiate between participants of the same role.
39
+ */
40
+ name?: string;
41
+ }
42
+ export interface IVeloAssistantMessage {
43
+ /**
44
+ * The contents of the user message.
45
+ */
46
+ content: string;
47
+ /**
48
+ * The role of the messages author, in this case `user`.
49
+ */
50
+ role: 'user';
51
+ /**
52
+ * An optional name for the participant. Provides the model information to
53
+ * differentiate between participants of the same role.
54
+ */
55
+ name?: string;
56
+ }
57
+ export type IVeloConversationMessageResponse = IVeloApiCallMessage | IVeloUserMessage | IVeloAssistantMessage;
58
+ export interface IGetVeloConversationPayload {
59
+ id: string;
60
+ }
61
+ export interface IVeloConversationsResponse {
62
+ id: string;
63
+ title: string;
64
+ messages: IVeloConversationMessageResponse[];
65
+ createdAt: string;
66
+ updatedAt: string;
67
+ }
68
+ type Localized<T> = {
69
+ en: T;
70
+ [key: string]: T;
71
+ };
72
+ interface IModelQuickActionsResponse {
73
+ icon: string;
74
+ title: Localized<string>;
75
+ prompt: string;
76
+ }
77
+ export interface IVeloAgentConfigResponse {
78
+ id: string;
79
+ agentName: string;
80
+ version: number;
81
+ whatCanDo: Localized<string[]>;
82
+ quickActions: IModelQuickActionsResponse[];
83
+ createdAt: string;
84
+ updatedAt: string;
85
+ }
86
+ export interface ISendVeloConversationMessagePayload {
87
+ conversationId: string;
88
+ message: string;
89
+ stream?: boolean;
90
+ }
91
+ export type IVeloMessageStream = ReadableStream<Uint8Array>;
92
+ export interface ISendVeloConversationApiResponsePayload {
93
+ conversationId: string;
94
+ callId: string;
95
+ data: string;
96
+ status: number;
97
+ stream?: boolean;
98
+ }
99
+ export interface IGetVeloConversationResourcePayload {
100
+ conversationId: string;
101
+ resourceId: string;
102
+ }
103
+ export interface IVeloConversationResource {
104
+ id: string;
105
+ type: string;
106
+ content: string;
107
+ }
108
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/velo/index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/vendor/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
- import { IVendorPublicInfoResponse } from "./interfaces";
2
- /**
3
- * provide vendor public info by providing the vendor context.
4
- * @return IVendorPublicInfoResponse
5
- */
6
- export declare function getVendorPublicInfo(): Promise<IVendorPublicInfoResponse>;
1
+ import { IVendorPublicInfoResponse } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class VendorApi extends BaseApiClient {
4
+ constructor(appName: string);
5
+ /**
6
+ * Provide vendor public info by providing the vendor context.
7
+ * @returns {Promise<IVendorPublicInfoResponse>}
8
+ */
9
+ getVendorPublicInfo: () => Promise<IVendorPublicInfoResponse>;
10
+ }
11
+ declare const _default: VendorApi;
12
+ export default _default;
package/vendor/index.js CHANGED
@@ -1,6 +1,17 @@
1
- import { Get } from '../fetch';
2
1
  import { urls } from '../constants';
3
- export async function getVendorPublicInfo() {
4
- return Get(`${urls.vendor}/public`);
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class VendorApi extends BaseApiClient {
4
+ constructor(appName) {
5
+ super(appName);
6
+ this.getVendorPublicInfo = async () => {
7
+ return this.get(`${urls.vendor}/public`);
8
+ };
9
+ }
10
+
11
+ /**
12
+ * Provide vendor public info by providing the vendor context.
13
+ * @returns {Promise<IVendorPublicInfoResponse>}
14
+ */
5
15
  }
6
- ;
16
+
17
+ export default new VendorApi('default');
@@ -1,29 +0,0 @@
1
- import { IUserProfile } from './teams/interfaces';
2
- import { ContextOptions, RedirectOptions } from './interfaces';
3
- export declare class ContextHolder {
4
- private static instance;
5
- private context;
6
- private accessToken;
7
- private user;
8
- private onRedirectTo;
9
- private logout;
10
- private constructor();
11
- static getInstance(): ContextHolder;
12
- static setContext(context: ContextOptions): void;
13
- static setAccessToken(accessToken: string | null): void;
14
- static setUser(user: IUserProfile | null): void;
15
- static setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void): void;
16
- static setLogout(logout: (callback?: () => void) => void, logoutUrl: string): void;
17
- static getContext(): ContextOptions;
18
- static getAccessToken(): string | null;
19
- static getUser(): IUserProfile | null;
20
- static onRedirectTo(path: string, opts?: RedirectOptions): void;
21
- static logout(callback?: () => void): void;
22
- }
23
- export declare const FronteggContext: {
24
- getContext: () => ContextOptions;
25
- getAccessToken: () => string | null;
26
- getUser: () => IUserProfile | null;
27
- onRedirectTo: (path: string, opts: RedirectOptions) => void;
28
- logout: (callback?: (() => void) | undefined) => void;
29
- };