@budibase/frontend-core 3.12.1 → 3.12.2

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.12.1",
3
+ "version": "3.12.2",
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": "ddbf7f3d2ba1a57923aff162a8bfb737f37eec20"
20
+ "gitHead": "d3c6f03610ea1c975989145b29f32930d70c7253"
21
21
  }
package/src/api/index.ts CHANGED
@@ -49,6 +49,7 @@ import { buildOAuth2Endpoints } from "./oauth2"
49
49
  import { buildAgentEndpoints } from "./agents"
50
50
  import { buildFeatureFlagEndpoints } from "./features"
51
51
  import { buildNavigationEndpoints } from "./navigation"
52
+ import { buildWorkspaceAppEndpoints } from "./workspaceApps"
52
53
 
53
54
  export type { APIClient } from "./types"
54
55
 
@@ -298,5 +299,6 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
298
299
  rowActions: buildRowActionEndpoints(API),
299
300
  oauth2: buildOAuth2Endpoints(API),
300
301
  navigation: buildNavigationEndpoints(API),
302
+ workspaceApp: buildWorkspaceAppEndpoints(API),
301
303
  }
302
304
  }
@@ -18,10 +18,11 @@ export const buildScreenEndpoints = (API: BaseAPIClient): ScreenEndpoints => ({
18
18
  * @param screen the screen to save
19
19
  */
20
20
  saveScreen: async screen => {
21
- return await API.post({
21
+ const result = await API.post<SaveScreenRequest, SaveScreenResponse>({
22
22
  url: "/api/screens",
23
23
  body: screen,
24
24
  })
25
+ return result
25
26
  },
26
27
 
27
28
  /**
package/src/api/types.ts CHANGED
@@ -36,6 +36,7 @@ import { ViewEndpoints } from "./views"
36
36
  import { ViewV2Endpoints } from "./viewsV2"
37
37
  import { AgentEndpoints } from "./agents"
38
38
  import { NavigationEndpoints } from "./navigation"
39
+ import { WorkspaceAppEndpoints } from "./workspaceApps"
39
40
 
40
41
  export enum HTTPMethod {
41
42
  POST = "POST",
@@ -143,4 +144,5 @@ export type APIClient = BaseAPIClient &
143
144
  viewV2: ViewV2Endpoints
144
145
  oauth2: OAuth2Endpoints
145
146
  navigation: NavigationEndpoints
147
+ workspaceApp: WorkspaceAppEndpoints
146
148
  }
@@ -0,0 +1,47 @@
1
+ import {
2
+ FetchWorkspaceAppResponse,
3
+ InsertWorkspaceAppRequest,
4
+ InsertWorkspaceAppResponse,
5
+ UpdateWorkspaceAppRequest,
6
+ UpdateWorkspaceAppResponse,
7
+ } from "@budibase/types"
8
+ import { BaseAPIClient } from "./types"
9
+
10
+ export interface WorkspaceAppEndpoints {
11
+ fetch: () => Promise<FetchWorkspaceAppResponse>
12
+ create: (
13
+ workspaceApp: InsertWorkspaceAppRequest
14
+ ) => Promise<InsertWorkspaceAppResponse>
15
+ update: (
16
+ workspaceApp: UpdateWorkspaceAppRequest
17
+ ) => Promise<UpdateWorkspaceAppResponse>
18
+ delete: (id: string, rev: string) => Promise<void>
19
+ }
20
+
21
+ export const buildWorkspaceAppEndpoints = (
22
+ API: BaseAPIClient
23
+ ): WorkspaceAppEndpoints => ({
24
+ fetch: async () => {
25
+ return await API.get({
26
+ url: "/api/workspaceApp",
27
+ })
28
+ },
29
+ create: async workspaceApp => {
30
+ return await API.post({
31
+ url: "/api/workspaceApp",
32
+ body: workspaceApp,
33
+ })
34
+ },
35
+ update: async workspaceApp => {
36
+ return await API.put({
37
+ url: `/api/workspaceApp/${workspaceApp._id}`,
38
+ body: workspaceApp,
39
+ })
40
+ },
41
+
42
+ delete: async (id, rev) => {
43
+ return await API.delete({
44
+ url: `/api/workspaceApp/${id}/${rev}`,
45
+ })
46
+ },
47
+ })