@budibase/frontend-core 3.42.0 → 3.43.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": "v3.
|
|
3
|
+
"version": "v3.43.0",
|
|
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": "
|
|
26
|
+
"gitHead": "221c199a898fffd9c8803d5327cc3089cc02b7f3"
|
|
27
27
|
}
|
package/src/api/index.ts
CHANGED
|
@@ -58,6 +58,7 @@ import { buildFeatureFlagEndpoints } from "./features"
|
|
|
58
58
|
import { buildNavigationEndpoints } from "./navigation"
|
|
59
59
|
import { buildWorkspaceAppEndpoints } from "./workspaceApps"
|
|
60
60
|
import { buildResourceEndpoints } from "./resource"
|
|
61
|
+
import { buildRestTemplateEndpoints } from "./restTemplates"
|
|
61
62
|
import { buildDeploymentEndpoints } from "./deploy"
|
|
62
63
|
import { buildWorkspaceFavouriteEndpoints } from "./workspaceFavourites"
|
|
63
64
|
import { buildWorkspaceHomeEndpoints } from "./workspaceHome"
|
|
@@ -309,6 +310,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
309
310
|
...buildScreenEndpoints(API),
|
|
310
311
|
...buildTableEndpoints(API),
|
|
311
312
|
...buildTemplateEndpoints(API),
|
|
313
|
+
...buildRestTemplateEndpoints(API),
|
|
312
314
|
...buildUserEndpoints(API),
|
|
313
315
|
...buildViewEndpoints(API),
|
|
314
316
|
...buildSelfEndpoints(API),
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CustomRestTemplateId,
|
|
3
|
+
DeleteCustomRestTemplateResponse,
|
|
4
|
+
FetchCustomRestTemplatesResponse,
|
|
5
|
+
UpdateCustomRestTemplateResponse,
|
|
6
|
+
UploadCustomRestTemplateResponse,
|
|
7
|
+
} from "@budibase/types"
|
|
8
|
+
import type { BaseAPIClient } from "./types"
|
|
9
|
+
|
|
10
|
+
interface UploadCustomRestTemplateParams {
|
|
11
|
+
name: string
|
|
12
|
+
description: string
|
|
13
|
+
file: File
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface UpdateCustomRestTemplateParams {
|
|
17
|
+
restTemplateId: CustomRestTemplateId
|
|
18
|
+
name: string
|
|
19
|
+
description: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface RestTemplateEndpoints {
|
|
23
|
+
getCustomRestTemplates: () => Promise<FetchCustomRestTemplatesResponse>
|
|
24
|
+
uploadCustomRestTemplate: (
|
|
25
|
+
params: UploadCustomRestTemplateParams
|
|
26
|
+
) => Promise<UploadCustomRestTemplateResponse>
|
|
27
|
+
updateCustomRestTemplate: (
|
|
28
|
+
params: UpdateCustomRestTemplateParams
|
|
29
|
+
) => Promise<UpdateCustomRestTemplateResponse>
|
|
30
|
+
deleteCustomRestTemplate: (
|
|
31
|
+
restTemplateId: CustomRestTemplateId
|
|
32
|
+
) => Promise<DeleteCustomRestTemplateResponse>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const buildRestTemplateEndpoints = (
|
|
36
|
+
API: BaseAPIClient
|
|
37
|
+
): RestTemplateEndpoints => ({
|
|
38
|
+
getCustomRestTemplates: async () => {
|
|
39
|
+
return await API.get({
|
|
40
|
+
url: "/api/rest-templates",
|
|
41
|
+
})
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
uploadCustomRestTemplate: async ({ name, description, file }) => {
|
|
45
|
+
const body = new FormData()
|
|
46
|
+
body.append("name", name)
|
|
47
|
+
body.append("description", description)
|
|
48
|
+
body.append("file", file)
|
|
49
|
+
|
|
50
|
+
return await API.post<FormData, UploadCustomRestTemplateResponse>({
|
|
51
|
+
url: "/api/rest-templates",
|
|
52
|
+
body,
|
|
53
|
+
json: false,
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
updateCustomRestTemplate: async ({ restTemplateId, name, description }) => {
|
|
58
|
+
const body = new FormData()
|
|
59
|
+
body.append("name", name)
|
|
60
|
+
body.append("description", description)
|
|
61
|
+
|
|
62
|
+
return await API.put<FormData, UpdateCustomRestTemplateResponse>({
|
|
63
|
+
url: `/api/rest-templates/${encodeURIComponent(restTemplateId)}`,
|
|
64
|
+
body,
|
|
65
|
+
json: false,
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
deleteCustomRestTemplate: async restTemplateId => {
|
|
70
|
+
return await API.delete({
|
|
71
|
+
url: `/api/rest-templates/${encodeURIComponent(restTemplateId)}`,
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
})
|
package/src/api/types.ts
CHANGED
|
@@ -45,6 +45,7 @@ import { EscalationEndpoints } from "./escalations"
|
|
|
45
45
|
import { NavigationEndpoints } from "./navigation"
|
|
46
46
|
import { WorkspaceAppEndpoints } from "./workspaceApps"
|
|
47
47
|
import { ResourceEndpoints } from "./resource"
|
|
48
|
+
import { RestTemplateEndpoints } from "./restTemplates"
|
|
48
49
|
import { DeploymentEndpoints } from "./deploy"
|
|
49
50
|
import { WorkspaceFavouriteEndpoints } from "./workspaceFavourites"
|
|
50
51
|
import { WorkspaceHomeEndpoints } from "./workspaceHome"
|
|
@@ -159,6 +160,7 @@ export type APIClient = BaseAPIClient &
|
|
|
159
160
|
SelfEndpoints &
|
|
160
161
|
TableEndpoints &
|
|
161
162
|
TemplateEndpoints &
|
|
163
|
+
RestTemplateEndpoints &
|
|
162
164
|
UserEndpoints &
|
|
163
165
|
FeatureFlagEndpoints &
|
|
164
166
|
ViewEndpoints & {
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
accepted: boolean
|
|
59
59
|
) => Promise<EscalationRespondResult | undefined>
|
|
60
60
|
isAgentPreviewChat?: boolean
|
|
61
|
+
previewRoleId?: string
|
|
61
62
|
readOnly?: boolean
|
|
62
63
|
readOnlyReason?: "disabled" | "deleted" | "offline"
|
|
63
64
|
promptHistory?: string[]
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
showInlineApproval = false,
|
|
77
78
|
onResolve,
|
|
78
79
|
isAgentPreviewChat = false,
|
|
80
|
+
previewRoleId,
|
|
79
81
|
readOnly = false,
|
|
80
82
|
readOnlyReason,
|
|
81
83
|
promptHistory = [],
|
|
@@ -331,6 +333,7 @@
|
|
|
331
333
|
agentId: chat?.agentId,
|
|
332
334
|
transient: !persistConversation,
|
|
333
335
|
isPreview: isAgentPreviewChat,
|
|
336
|
+
previewRoleId: isAgentPreviewChat ? previewRoleId : undefined,
|
|
334
337
|
sessionId: stableSessionId,
|
|
335
338
|
title: chat?.title,
|
|
336
339
|
messages,
|