@budibase/frontend-core 3.40.1 → 3.41.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.40.1",
3
+ "version": "3.41.1",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -23,5 +23,5 @@
23
23
  "devDependencies": {
24
24
  "vitest": "^4.1.0"
25
25
  },
26
- "gitHead": "8866a9829af7fee80c1468d060c1d1749414a7cc"
26
+ "gitHead": "fc94728bc509937e374c5d38f47f8858a1f405c9"
27
27
  }
@@ -18,7 +18,8 @@ export interface MSTeamsChannel {
18
18
 
19
19
  export interface ChatLinksEndpoints {
20
20
  fetchChatIdentityLinks: (
21
- provider?: ChatIdentityLinkProvider
21
+ provider?: ChatIdentityLinkProvider,
22
+ agentId?: string
22
23
  ) => Promise<ChatIdentityLink[]>
23
24
  fetchSlackChannels: (agentId: string) => Promise<SlackChannel[]>
24
25
  fetchMSTeamsChannels: (agentId: string) => Promise<MSTeamsChannel[]>
@@ -27,10 +28,12 @@ export interface ChatLinksEndpoints {
27
28
  export const buildChatLinksEndpoints = (
28
29
  API: BaseAPIClient
29
30
  ): ChatLinksEndpoints => ({
30
- fetchChatIdentityLinks: async provider => {
31
- const query = provider
32
- ? `?${new URLSearchParams({ provider }).toString()}`
33
- : ""
31
+ fetchChatIdentityLinks: async (provider, agentId) => {
32
+ const params = new URLSearchParams({
33
+ ...(provider ? { provider } : {}),
34
+ ...(agentId ? { agentId } : {}),
35
+ }).toString()
36
+ const query = params ? `?${params}` : ""
34
37
  return await API.get({ url: `/api/chat-links${query}` })
35
38
  },
36
39
  fetchSlackChannels: async agentId => {
package/src/api/index.ts CHANGED
@@ -13,7 +13,7 @@ import { Header } from "@budibase/shared-core"
13
13
  import { ApiVersion } from "../constants"
14
14
  import { buildAnalyticsEndpoints } from "./analytics"
15
15
  import { buildAIEndpoints } from "./ai"
16
- import { buildAppEndpoints } from "./app"
16
+ import { buildAppEndpoints } from "./workspace"
17
17
  import { buildAttachmentEndpoints } from "./attachments"
18
18
  import { buildAuthEndpoints } from "./auth"
19
19
  import { buildAutomationEndpoints } from "./automations"
package/src/api/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AIEndpoints } from "./ai"
2
2
  import { AnalyticsEndpoints } from "./analytics"
3
- import { AppEndpoints } from "./app"
3
+ import { AppEndpoints } from "./workspace"
4
4
  import { AttachmentEndpoints } from "./attachments"
5
5
  import { AuditLogEndpoints } from "./auditLogs"
6
6
  import { AuthEndpoints } from "./auth"
@@ -27,31 +27,35 @@ import {
27
27
  import { BaseAPIClient } from "./types"
28
28
 
29
29
  export interface AppEndpoints {
30
- fetchAppPackage: (appId: string) => Promise<FetchAppPackageResponse>
30
+ fetchAppPackage: (workspaceId: string) => Promise<FetchAppPackageResponse>
31
31
  saveAppMetadata: (
32
- appId: string,
32
+ workspaceId: string,
33
33
  metadata: UpdateWorkspaceRequest
34
34
  ) => Promise<UpdateWorkspaceResponse>
35
- unpublishApp: (appId: string) => Promise<UnpublishWorkspaceResponse>
35
+ unpublishApp: (workspaceId: string) => Promise<UnpublishWorkspaceResponse>
36
36
  publishAppChanges: (
37
- appId: string,
37
+ workspaceId: string,
38
38
  opts?: PublishWorkspaceRequest
39
39
  ) => Promise<PublishWorkspaceResponse>
40
- revertAppChanges: (appId: string) => Promise<RevertWorkspaceResponse>
41
- updateAppClientVersion: (appId: string) => Promise<UpdateAppClientResponse>
42
- revertAppClientVersion: (appId: string) => Promise<RevertAppClientResponse>
43
- releaseAppLock: (appId: string) => Promise<ClearDevLockResponse>
40
+ revertAppChanges: (workspaceId: string) => Promise<RevertWorkspaceResponse>
41
+ updateAppClientVersion: (
42
+ workspaceId: string
43
+ ) => Promise<UpdateAppClientResponse>
44
+ revertAppClientVersion: (
45
+ workspaceId: string
46
+ ) => Promise<RevertAppClientResponse>
47
+ releaseAppLock: (workspaceId: string) => Promise<ClearDevLockResponse>
44
48
  getAppDeployments: () => Promise<FetchDeploymentResponse>
45
49
  createApp: (
46
- app: CreateWorkspaceRequest | FormData
50
+ workspace: CreateWorkspaceRequest | FormData
47
51
  ) => Promise<CreateWorkspaceResponse>
48
- deleteApp: (appId: string) => Promise<DeleteWorkspaceResponse>
52
+ deleteApp: (workspaceId: string) => Promise<DeleteWorkspaceResponse>
49
53
  duplicateApp: (
50
- appId: string,
51
- app: DuplicateWorkspaceRequest
54
+ workspaceId: string,
55
+ workspace: DuplicateWorkspaceRequest
52
56
  ) => Promise<DuplicateWorkspaceResponse>
53
57
  updateAppFromExport: (
54
- appId: string,
58
+ workspaceId: string,
55
59
  body: ImportToUpdateWorkspaceRequest,
56
60
  appExport: File
57
61
  ) => Promise<ImportToUpdateWorkspaceResponse>
@@ -60,7 +64,9 @@ export interface AppEndpoints {
60
64
  fetchComponentLibDefinitions: (
61
65
  workspaceId: string
62
66
  ) => Promise<FetchAppDefinitionResponse>
63
- addSampleData: (appId: string) => Promise<AddWorkspaceSampleDataResponse>
67
+ addSampleData: (
68
+ workspaceId: string
69
+ ) => Promise<AddWorkspaceSampleDataResponse>
64
70
  getPublishedApps: () => Promise<FetchPublishedAppsResponse["apps"]>
65
71
 
66
72
  // Missing request or response types
@@ -69,69 +75,69 @@ export interface AppEndpoints {
69
75
 
70
76
  export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
71
77
  /**
72
- * Fetches screen definition for an app.
73
- * @param appId the ID of the app to fetch from
78
+ * Fetches screen definition for a workspace.
79
+ * @param workspaceId the ID of the workspace to fetch from
74
80
  */
75
- fetchAppPackage: async appId => {
81
+ fetchAppPackage: async workspaceId => {
76
82
  return await API.get({
77
- url: `/api/applications/${appId}/appPackage`,
83
+ url: `/api/applications/${workspaceId}/appPackage`,
78
84
  })
79
85
  },
80
86
 
81
87
  /**
82
- * Saves and patches metadata about an app.
83
- * @param appId the ID of the app to update
84
- * @param metadata the app metadata to save
88
+ * Saves and patches metadata about a workspace.
89
+ * @param workspaceId the ID of the workspace to update
90
+ * @param metadata the workspace metadata to save
85
91
  */
86
- saveAppMetadata: async (appId, metadata) => {
92
+ saveAppMetadata: async (workspaceId, metadata) => {
87
93
  return await API.put({
88
- url: `/api/applications/${appId}`,
94
+ url: `/api/applications/${workspaceId}`,
89
95
  body: metadata,
90
96
  })
91
97
  },
92
98
 
93
99
  /**
94
- * Publishes the current app.
100
+ * Publishes the current workspace.
95
101
  */
96
- publishAppChanges: async (appId, opts) => {
102
+ publishAppChanges: async (workspaceId, opts) => {
97
103
  return await API.post({
98
- url: `/api/applications/${appId}/publish`,
104
+ url: `/api/applications/${workspaceId}/publish`,
99
105
  body: opts,
100
106
  })
101
107
  },
102
108
 
103
109
  /**
104
- * Reverts an app to a previous version.
105
- * @param appId the app ID to revert
110
+ * Reverts a workspace to a previous version.
111
+ * @param workspaceId the workspace ID to revert
106
112
  */
107
- revertAppChanges: async appId => {
113
+ revertAppChanges: async workspaceId => {
108
114
  return await API.post({
109
- url: `/api/dev/${appId}/revert`,
115
+ url: `/api/dev/${workspaceId}/revert`,
110
116
  })
111
117
  },
112
118
 
113
119
  /**
114
- * Updates an app's version of the client library.
115
- * @param appId the app ID to update
120
+ * Updates a workspace's version of the client library.
121
+ * @param workspaceId the workspace ID to update
116
122
  */
117
- updateAppClientVersion: async appId => {
123
+ updateAppClientVersion: async workspaceId => {
118
124
  return await API.post({
119
- url: `/api/applications/${appId}/client/update`,
125
+ url: `/api/applications/${workspaceId}/client/update`,
120
126
  })
121
127
  },
122
128
 
123
129
  /**
124
- * Reverts an app's version of the client library to the previous version.
125
- * @param appId the app ID to revert
130
+ * Reverts a workspace's client library to the previous version.
131
+ * @param workspaceId the workspace ID to revert
126
132
  */
127
- revertAppClientVersion: async appId => {
133
+ revertAppClientVersion: async workspaceId => {
128
134
  return await API.post({
129
- url: `/api/applications/${appId}/client/revert`,
135
+ url: `/api/applications/${workspaceId}/client/revert`,
130
136
  })
131
137
  },
132
138
 
133
139
  /**
134
- * Gets a list of app deployments.
140
+ * Gets a list of workspace deployments.
135
141
  */
136
142
  getAppDeployments: async () => {
137
143
  return await API.get({
@@ -140,44 +146,44 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
140
146
  },
141
147
 
142
148
  /**
143
- * Creates an app.
144
- * @param app the app to create
149
+ * Creates a workspace.
150
+ * @param workspace the workspace to create
145
151
  */
146
- createApp: async app => {
147
- if (app instanceof FormData) {
152
+ createApp: async workspace => {
153
+ if (workspace instanceof FormData) {
148
154
  return await API.post({
149
155
  url: "/api/applications",
150
- body: app,
156
+ body: workspace,
151
157
  json: false,
152
158
  })
153
159
  }
154
160
 
155
161
  return await API.post({
156
162
  url: "/api/applications",
157
- body: app,
163
+ body: workspace,
158
164
  })
159
165
  },
160
166
 
161
167
  /**
162
- * Duplicate an existing app
163
- * @param app the app to dupe
168
+ * Duplicate an existing workspace
169
+ * @param workspace the workspace to duplicate
164
170
  */
165
- duplicateApp: async (appId, app) => {
171
+ duplicateApp: async (workspaceId, workspace) => {
166
172
  return await API.post({
167
- url: `/api/applications/${appId}/duplicate`,
168
- body: app,
173
+ url: `/api/applications/${workspaceId}/duplicate`,
174
+ body: workspace,
169
175
  })
170
176
  },
171
177
 
172
178
  /**
173
- * Update an application using an export - the body
179
+ * Update a workspace using an export - the body
174
180
  * should be of type FormData, with a "file" and a "password" if encrypted.
175
- * @param appId The ID of the app to update - this will always be
181
+ * @param workspaceId The ID of the workspace to update - this will always be
176
182
  * converted to development ID.
177
183
  * @param body a FormData body with a file and password.
178
184
  */
179
- updateAppFromExport: async (appId, body, appExport) => {
180
- const devId = sdk.applications.getDevAppID(appId)
185
+ updateAppFromExport: async (workspaceId, body, appExport) => {
186
+ const devId = sdk.workspaces.getDevWorkspaceID(workspaceId)
181
187
  const formData = new FormData()
182
188
  formData.append("appExport", appExport)
183
189
  for (const [key, field] of Object.entries(body)) {
@@ -203,32 +209,32 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
203
209
  },
204
210
 
205
211
  /**
206
- * Unpublishes a published app.
207
- * @param appId the production ID of the app to unpublish
212
+ * Unpublishes a published workspace.
213
+ * @param workspaceId the production ID of the workspace to unpublish
208
214
  */
209
- unpublishApp: async appId => {
215
+ unpublishApp: async workspaceId => {
210
216
  return await API.post({
211
- url: `/api/applications/${appId}/unpublish`,
217
+ url: `/api/applications/${workspaceId}/unpublish`,
212
218
  })
213
219
  },
214
220
 
215
221
  /**
216
- * Deletes a dev app.
217
- * @param appId the dev app ID to delete
222
+ * Deletes a development workspace.
223
+ * @param workspaceId the development workspace ID to delete
218
224
  */
219
- deleteApp: async appId => {
225
+ deleteApp: async workspaceId => {
220
226
  return await API.delete({
221
- url: `/api/applications/${appId}`,
227
+ url: `/api/applications/${workspaceId}`,
222
228
  })
223
229
  },
224
230
 
225
231
  /**
226
- * Releases the lock on a dev app.
227
- * @param appId the dev app ID to unlock
232
+ * Releases the lock on a development workspace.
233
+ * @param workspaceId the development workspace ID to unlock
228
234
  */
229
- releaseAppLock: async appId => {
235
+ releaseAppLock: async workspaceId => {
230
236
  return await API.delete({
231
- url: `/api/dev/${appId}/lock`,
237
+ url: `/api/dev/${workspaceId}/lock`,
232
238
  })
233
239
  },
234
240
 
@@ -242,7 +248,7 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
242
248
  },
243
249
 
244
250
  /**
245
- * Gets a list of apps.
251
+ * Gets a list of workspaces.
246
252
  */
247
253
  getApps: async () => {
248
254
  return await API.get({
@@ -253,21 +259,21 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
253
259
  /**
254
260
  * Fetches the definitions for component library components. This includes
255
261
  * their props and other metadata from components.json.
256
- * @param appId ID of the currently running app
262
+ * @param workspaceId ID of the currently running app
257
263
  */
258
- fetchComponentLibDefinitions: async appId => {
264
+ fetchComponentLibDefinitions: async workspaceId => {
259
265
  return await API.get({
260
- url: `/api/${appId}/components/definitions`,
266
+ url: `/api/${workspaceId}/components/definitions`,
261
267
  })
262
268
  },
263
269
 
264
270
  /**
265
- * Adds sample data to an app
266
- * @param appId the app ID
271
+ * Adds sample data to a workspace
272
+ * @param workspaceId the app ID
267
273
  */
268
- addSampleData: async appId => {
274
+ addSampleData: async workspaceId => {
269
275
  return await API.post({
270
- url: `/api/applications/${appId}/sample`,
276
+ url: `/api/applications/${workspaceId}/sample`,
271
277
  })
272
278
  },
273
279
 
@@ -93,6 +93,11 @@
93
93
  }
94
94
  }
95
95
 
96
+ // Only a genuinely-raised escalation gets the approval card
97
+ const isRaisedEscalation = (output: unknown) =>
98
+ (output as { status?: string } | undefined)?.status ===
99
+ EscalateToolResultStatus.PENDING_APPROVAL
100
+
96
101
  // The escalate part's input/output are loosely typed by the AI SDK, so the
97
102
  // casts live here rather than cluttering the template.
98
103
  const escalationCardProps = (part: { input?: unknown; output?: unknown }) => {
@@ -777,7 +782,7 @@
777
782
  {#each message.parts ?? [] as part, partIndex}
778
783
  {#if isTextUIPart(part)}
779
784
  <MarkdownViewer value={part.text} />
780
- {:else if isToolUIPart(part) && getToolName(part) === ESCALATE_TOOL_NAME}
785
+ {:else if isToolUIPart(part) && getToolName(part) === ESCALATE_TOOL_NAME && isRaisedEscalation(part.output)}
781
786
  {@const card = escalationCardProps(part)}
782
787
  <EscalationCard
783
788
  title={card.title}
@@ -1,9 +0,0 @@
1
- <script>
2
- import { getContext } from "svelte"
3
-
4
- const { rows } = getContext("grid")
5
- </script>
6
-
7
- <div>
8
- {$rows.length} row{$rows.length === 1 ? "" : "s"}
9
- </div>
@@ -1,96 +0,0 @@
1
- <script lang="ts">
2
- export let size = "64px"
3
- export let animate: boolean = false
4
- </script>
5
-
6
- <svg
7
- viewBox="0 0 150 150"
8
- width={size}
9
- fill="none"
10
- xmlns="http://www.w3.org/2000/svg"
11
- >
12
- <g id="bbai">
13
- <g id="Group 48096461">
14
- {#if animate}
15
- <animateTransform
16
- attributeName="transform"
17
- attributeType="XML"
18
- type="rotate"
19
- from="0 75 75"
20
- to="360 75 75"
21
- dur="2.5s"
22
- repeatCount="indefinite"
23
- calcMode="spline"
24
- keyTimes="0;1"
25
- keySplines="0.3 0 0.5 1"
26
- />
27
- {/if}
28
- <path
29
- id="Vector"
30
- d="M22.3457 95.0839L51.9032 124.642C53.199 125.937 55.2988 125.937 56.5946 124.642L69.4653 111.771C70.6236 110.612 71.171 108.976 70.9436 107.352L67.4872 82.9246C67.2334 81.1475 65.8371 79.7512 64.0626 79.4999L39.6354 76.0436C38.0143 75.8135 36.3774 76.3609 35.2164 77.5218L22.3457 90.3926C21.0499 91.6884 21.0499 93.7881 22.3457 95.0839Z"
31
- fill="url(#paint0_linear_605_124)"
32
- />
33
- <path
34
- id="Vector_2"
35
- d="M92.0381 124.643L121.596 95.0851C122.891 93.7893 122.891 91.6895 121.596 90.3937L108.725 77.5229C107.567 76.3647 105.93 75.8172 104.306 76.0447L79.8787 79.501C78.1016 79.7549 76.7053 81.1512 76.454 82.9257L72.9977 107.353C72.7676 108.974 73.315 110.611 74.4759 111.772L87.3467 124.643C88.6425 125.938 90.7422 125.938 92.0381 124.643Z"
36
- fill="url(#paint1_linear_605_124)"
37
- />
38
- <path
39
- id="Vector_3"
40
- d="M121.654 54.92L92.0968 25.3624C90.801 24.0666 88.7012 24.0666 87.4054 25.3624L74.5347 38.2332C73.3764 39.3915 72.829 41.0284 73.0564 42.6521L76.5128 67.0793C76.7666 68.8565 78.1629 70.2527 79.9374 70.504L104.365 73.9603C105.986 74.1904 107.623 73.643 108.784 72.4821L121.654 59.6113C122.95 58.3155 122.95 56.2158 121.654 54.92Z"
41
- fill="url(#paint2_linear_605_124)"
42
- />
43
- <path
44
- id="Vector_4"
45
- d="M51.9619 25.3613L22.4044 54.9188C21.1086 56.2146 21.1086 58.3144 22.4044 59.6102L35.2752 72.481C36.4334 73.6393 38.0704 74.1867 39.6941 73.9592L64.1213 70.5029C65.8984 70.249 67.2947 68.8527 67.546 67.0782L71.0023 42.651C71.2324 41.0299 70.685 39.393 69.5241 38.2321L56.6533 25.3613C55.3575 24.0655 53.2578 24.0655 51.9619 25.3613Z"
46
- fill="url(#paint3_linear_605_124)"
47
- />
48
- </g>
49
- </g>
50
- <defs>
51
- <linearGradient
52
- id="paint0_linear_605_124"
53
- x1="52.1505"
54
- y1="121.517"
55
- x2="68.292"
56
- y2="84.222"
57
- gradientUnits="userSpaceOnUse"
58
- >
59
- <stop stop-color="#6E56FF" />
60
- <stop offset="1" stop-color="#9F8FFF" />
61
- </linearGradient>
62
- <linearGradient
63
- id="paint1_linear_605_124"
64
- x1="118.471"
65
- y1="94.8378"
66
- x2="81.1761"
67
- y2="78.6963"
68
- gradientUnits="userSpaceOnUse"
69
- >
70
- <stop stop-color="#6E56FF" />
71
- <stop offset="1" stop-color="#9F8FFF" />
72
- </linearGradient>
73
- <linearGradient
74
- id="paint2_linear_605_124"
75
- x1="91.8495"
76
- y1="28.4869"
77
- x2="75.708"
78
- y2="65.7819"
79
- gradientUnits="userSpaceOnUse"
80
- >
81
- <stop stop-color="#6E56FF" />
82
- <stop offset="1" stop-color="#9F8FFF" />
83
- </linearGradient>
84
- <linearGradient
85
- id="paint3_linear_605_124"
86
- x1="25.5289"
87
- y1="55.1661"
88
- x2="62.8239"
89
- y2="71.3076"
90
- gradientUnits="userSpaceOnUse"
91
- >
92
- <stop stop-color="#6E56FF" />
93
- <stop offset="1" stop-color="#9F8FFF" />
94
- </linearGradient>
95
- </defs>
96
- </svg>