@budibase/frontend-core 3.16.0 → 3.17.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.16.0",
3
+ "version": "3.17.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": "d20f1f44d10db8eb79d7b7e47c670f3fce502547"
20
+ "gitHead": "1724cc3c4736c2c48e98aa490b47b2b6c28c05aa"
21
21
  }
package/src/api/index.ts CHANGED
@@ -52,6 +52,7 @@ import { buildNavigationEndpoints } from "./navigation"
52
52
  import { buildWorkspaceAppEndpoints } from "./workspaceApps"
53
53
  import { buildResourceEndpoints } from "./resource"
54
54
  import { buildDeploymentEndpoints } from "./deploy"
55
+ import { buildWorkspaceFavouriteEndpoints } from "./workspaceFavourites"
55
56
  import { buildRecaptchaEndpoints } from "./recaptcha"
56
57
 
57
58
  export type { APIClient } from "./types"
@@ -304,6 +305,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
304
305
  oauth2: buildOAuth2Endpoints(API),
305
306
  navigation: buildNavigationEndpoints(API),
306
307
  workspaceApp: buildWorkspaceAppEndpoints(API),
308
+ workspace: buildWorkspaceFavouriteEndpoints(API),
307
309
  resource: buildResourceEndpoints(API),
308
310
  recaptcha: buildRecaptchaEndpoints(API),
309
311
  }
package/src/api/types.ts CHANGED
@@ -39,6 +39,7 @@ import { NavigationEndpoints } from "./navigation"
39
39
  import { WorkspaceAppEndpoints } from "./workspaceApps"
40
40
  import { ResourceEndpoints } from "./resource"
41
41
  import { DeploymentEndpoints } from "./deploy"
42
+ import { WorkspaceFavouriteEndpoints } from "./workspaceFavourites"
42
43
  import { RecaptchaEndpoints } from "./recaptcha"
43
44
 
44
45
  export enum HTTPMethod {
@@ -149,6 +150,7 @@ export type APIClient = BaseAPIClient &
149
150
  oauth2: OAuth2Endpoints
150
151
  navigation: NavigationEndpoints
151
152
  workspaceApp: WorkspaceAppEndpoints
153
+ workspace: WorkspaceFavouriteEndpoints
152
154
  deployment: DeploymentEndpoints
153
155
  recaptcha: RecaptchaEndpoints
154
156
  }
@@ -0,0 +1,36 @@
1
+ import {
2
+ WorkspaceFavouriteResponse,
3
+ AddWorkspaceFavouriteResponse,
4
+ AddWorkspaceFavouriteRequest,
5
+ } from "@budibase/types"
6
+ import { BaseAPIClient } from "./types"
7
+
8
+ export interface WorkspaceFavouriteEndpoints {
9
+ fetch: () => Promise<WorkspaceFavouriteResponse>
10
+ create: (
11
+ favourite: AddWorkspaceFavouriteRequest
12
+ ) => Promise<AddWorkspaceFavouriteResponse>
13
+ delete: (id: string, rev: string) => Promise<void>
14
+ }
15
+
16
+ // Add a workspace.favourite qualifier?
17
+ export const buildWorkspaceFavouriteEndpoints = (
18
+ API: BaseAPIClient
19
+ ): WorkspaceFavouriteEndpoints => ({
20
+ fetch: async () => {
21
+ return await API.get({
22
+ url: "/api/workspace/favourites",
23
+ })
24
+ },
25
+ create: async favourite => {
26
+ return await API.post({
27
+ url: "/api/workspace/favourites",
28
+ body: favourite,
29
+ })
30
+ },
31
+ delete: async (id, rev) => {
32
+ return await API.delete({
33
+ url: `/api/workspace/favourites/${id}/${rev}`,
34
+ })
35
+ },
36
+ })