@budibase/frontend-core 3.18.14 → 3.19.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "3.18.14",
3
+ "version": "3.19.0",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -17,5 +17,5 @@
17
17
  "shortid": "2.2.15",
18
18
  "socket.io-client": "^4.7.5"
19
19
  },
20
- "gitHead": "da28258ca1bcc8260d29f82069545761429eeea7"
20
+ "gitHead": "72863c719173848d3128cbef9556a0af09708c20"
21
21
  }
package/src/api/groups.ts CHANGED
@@ -19,8 +19,6 @@ export interface GroupEndpoints {
19
19
  removeUsersFromGroup: (groupId: string, userIds: string[]) => Promise<void>
20
20
  addAppsToGroup: (groupId: string, appArray: object[]) => Promise<void>
21
21
  removeAppsFromGroup: (groupId: string, appArray: object[]) => Promise<void>
22
- addGroupAppBuilder: (groupId: string, appId: string) => Promise<void>
23
- removeGroupAppBuilder: (groupId: string, appId: string) => Promise<void>
24
22
  bulkAddUsersFromCsv: (
25
23
  groupId: string,
26
24
  csvContent: string
@@ -172,28 +170,6 @@ export const buildGroupsEndpoints = (API: BaseAPIClient): GroupEndpoints => {
172
170
  )
173
171
  },
174
172
 
175
- /**
176
- * Add app builder to group
177
- * @param groupId The group to update
178
- * @param appId The app id where the builder will be added
179
- */
180
- addGroupAppBuilder: async (groupId, appId) => {
181
- return await API.post({
182
- url: `/api/global/groups/${groupId}/app/${appId}/builder`,
183
- })
184
- },
185
-
186
- /**
187
- * Remove app builder from group
188
- * @param groupId The group to update
189
- * @param appId The app id where the builder will be removed
190
- */
191
- removeGroupAppBuilder: async (groupId, appId) => {
192
- return await API.delete({
193
- url: `/api/global/groups/${groupId}/app/${appId}/builder`,
194
- })
195
- },
196
-
197
173
  /**
198
174
  * Bulk add users to group from CSV content
199
175
  * @param groupId The group to update
@@ -55,7 +55,7 @@ export const buildPluginEndpoints = (API: BaseAPIClient): PluginEndpoins => ({
55
55
  */
56
56
  deletePlugin: async pluginId => {
57
57
  return await API.delete({
58
- url: `/api/plugin/${pluginId}`,
58
+ url: `/api/plugin/${encodeURIComponent(pluginId)}`,
59
59
  })
60
60
  },
61
61
  })
package/src/api/user.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  DeleteInviteUsersRequest,
13
13
  DeleteInviteUsersResponse,
14
14
  DeleteUserResponse,
15
+ EditUserPermissionsResponse,
15
16
  FetchUsersResponse,
16
17
  FindUserResponse,
17
18
  GetUserInvitesResponse,
@@ -22,7 +23,6 @@ import {
22
23
  SearchUsersRequest,
23
24
  SearchUsersResponse,
24
25
  UnsavedUser,
25
- UpdateInviteRequest,
26
26
  UpdateInviteResponse,
27
27
  UpdateSelfMetadataRequest,
28
28
  UpdateSelfMetadataResponse,
@@ -59,17 +59,20 @@ export interface UserEndpoints {
59
59
  users: UnsavedUser[],
60
60
  groups: any[]
61
61
  ) => Promise<BulkUserCreated | undefined>
62
- updateUserInvite: (
62
+ addWorkspaceIdToInvite: (
63
63
  code: string,
64
- data: UpdateInviteRequest
64
+ role: string
65
65
  ) => Promise<UpdateInviteResponse>
66
-
67
- // Missing request or response types
68
- addAppBuilder: (userId: string, appId: string) => Promise<{ message: string }>
69
- removeAppBuilder: (
66
+ removeWorkspaceIdFromInvite: (code: string) => Promise<UpdateInviteResponse>
67
+ addUserToWorkspace: (
68
+ userId: string,
69
+ role: string,
70
+ rev: string
71
+ ) => Promise<SaveUserResponse>
72
+ removeUserFromWorkspace: (
70
73
  userId: string,
71
- appId: string
72
- ) => Promise<{ message: string }>
74
+ rev: string
75
+ ) => Promise<SaveUserResponse>
73
76
  }
74
77
 
75
78
  export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({
@@ -188,14 +191,31 @@ export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({
188
191
  })
189
192
  },
190
193
 
191
- /**
192
- * Accepts a user invite as a body and will update the associated app roles.
193
- * for an existing invite
194
- */
195
- updateUserInvite: async (code, data) => {
196
- return await API.post<UpdateInviteRequest, UpdateInviteResponse>({
197
- url: `/api/global/users/invite/update/${code}`,
198
- body: data,
194
+ addWorkspaceIdToInvite: async (code, role) => {
195
+ return await API.post<void, UpdateInviteResponse>({
196
+ url: `/api/global/users/invite/${code}/${role}`,
197
+ })
198
+ },
199
+ removeWorkspaceIdFromInvite: async code => {
200
+ return await API.delete<void, UpdateInviteResponse>({
201
+ url: `/api/global/users/invite/${code}`,
202
+ })
203
+ },
204
+
205
+ addUserToWorkspace: async (userId, role, rev) => {
206
+ return await API.post<EditUserPermissionsResponse, SaveUserResponse>({
207
+ url: `/api/global/users/${userId}/permission/${role}`,
208
+ body: {
209
+ _rev: rev,
210
+ },
211
+ })
212
+ },
213
+ removeUserFromWorkspace: async (userId, rev) => {
214
+ return await API.delete<EditUserPermissionsResponse, SaveUserResponse>({
215
+ url: `/api/global/users/${userId}/permission`,
216
+ body: {
217
+ _rev: rev,
218
+ },
199
219
  })
200
220
  },
201
221
 
@@ -259,28 +279,6 @@ export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({
259
279
  return res.userCount
260
280
  },
261
281
 
262
- /**
263
- * Adds a per app builder to the selected app
264
- * @param userId The id of the user to add as a builder
265
- * @param appId the applications id
266
- */
267
- addAppBuilder: async (userId, appId) => {
268
- return await API.post({
269
- url: `/api/global/users/${userId}/app/${appId}/builder`,
270
- })
271
- },
272
-
273
- /**
274
- * Removes a per app builder to the selected app
275
- * @param userId The id of the user to remove as a builder
276
- * @param appId the applications id
277
- */
278
- removeAppBuilder: async (userId, appId) => {
279
- return await API.delete({
280
- url: `/api/global/users/${userId}/app/${appId}/builder`,
281
- })
282
- },
283
-
284
282
  /**
285
283
  * Gets the account holder of the current tenant
286
284
  */
@@ -3,7 +3,7 @@
3
3
  import { helpers } from "@budibase/shared-core"
4
4
  import type { User } from "@budibase/types"
5
5
 
6
- export let user: User
6
+ export let user: User | undefined
7
7
  export let size: "XS" | "S" | "M" = "S"
8
8
  export let tooltipPosition: TooltipPosition = TooltipPosition.Top
9
9
  export let showTooltip: boolean = true