@budibase/frontend-core 3.19.2 → 3.20.1

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.19.2",
3
+ "version": "3.20.1",
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": "6d89c268f83c9702e183b1372e6db79ed1e48e9d"
20
+ "gitHead": "3e59ab10d5d14b2a7843a4f637163aba471cfa72"
21
21
  }
package/src/api/agents.ts CHANGED
@@ -9,12 +9,14 @@ import {
9
9
  LLMStreamChunk,
10
10
  } from "@budibase/types"
11
11
 
12
+ import { Header } from "@budibase/shared-core"
12
13
  import { BaseAPIClient } from "./types"
13
14
 
14
15
  export interface AgentEndpoints {
15
16
  agentChat: (chat: AgentChat) => Promise<ChatAgentResponse>
16
17
  agentChatStream: (
17
18
  chat: AgentChat,
19
+ workspaceId: string,
18
20
  onChunk: (chunk: LLMStreamChunk) => void,
19
21
  onError?: (error: Error) => void
20
22
  ) => Promise<void>
@@ -39,7 +41,7 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
39
41
  })
40
42
  },
41
43
 
42
- agentChatStream: async (chat, onChunk, onError) => {
44
+ agentChatStream: async (chat, workspaceId, onChunk, onError) => {
43
45
  const body: ChatAgentRequest = chat
44
46
 
45
47
  try {
@@ -49,6 +51,7 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
49
51
  headers: {
50
52
  "Content-Type": "application/json",
51
53
  Accept: "application/json",
54
+ [Header.APP_ID]: workspaceId,
52
55
  },
53
56
  body: JSON.stringify(body),
54
57
  credentials: "same-origin",
package/src/api/app.ts CHANGED
@@ -52,7 +52,8 @@ export interface AppEndpoints {
52
52
  ) => Promise<DuplicateWorkspaceResponse>
53
53
  updateAppFromExport: (
54
54
  appId: string,
55
- body: ImportToUpdateWorkspaceRequest
55
+ body: ImportToUpdateWorkspaceRequest,
56
+ appExport: File
56
57
  ) => Promise<ImportToUpdateWorkspaceResponse>
57
58
  fetchSystemDebugInfo: () => Promise<GetDiagnosticsResponse>
58
59
  getApps: () => Promise<FetchWorkspacesResponse>
@@ -175,11 +176,16 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
175
176
  * converted to development ID.
176
177
  * @param body a FormData body with a file and password.
177
178
  */
178
- updateAppFromExport: async (appId, body) => {
179
+ updateAppFromExport: async (appId, body, appExport) => {
179
180
  const devId = sdk.applications.getDevAppID(appId)
181
+ const formData = new FormData()
182
+ formData.append("appExport", appExport)
183
+ for (const [key, field] of Object.entries(body)) {
184
+ formData.append(key, field)
185
+ }
180
186
  return await API.post({
181
187
  url: `/api/applications/${devId}/import`,
182
- body,
188
+ body: formData,
183
189
  json: false,
184
190
  })
185
191
  },