@budibase/frontend-core 3.23.48 → 3.24.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.23.48",
3
+ "version": "3.24.0",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -18,5 +18,5 @@
18
18
  "shortid": "2.2.15",
19
19
  "socket.io-client": "^4.7.5"
20
20
  },
21
- "gitHead": "0a78faa2adbb8fb3b81de2b9b00352e60178f12f"
21
+ "gitHead": "7cfa950d39730aa88a1c26c60f8094d6f0b0606d"
22
22
  }
package/src/api/agents.ts CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  import { BaseAPIClient } from "./types"
11
11
 
12
12
  export interface AgentEndpoints {
13
- fetchTools: () => Promise<ToolMetadata[]>
13
+ fetchTools: (aiconfigId?: string) => Promise<ToolMetadata[]>
14
14
  fetchAgents: () => Promise<FetchAgentsResponse>
15
15
  createAgent: (agent: CreateAgentRequest) => Promise<CreateAgentResponse>
16
16
  updateAgent: (agent: UpdateAgentRequest) => Promise<UpdateAgentResponse>
@@ -44,9 +44,12 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
44
44
  })
45
45
  },
46
46
 
47
- fetchTools: async () => {
47
+ fetchTools: async (aiconfigId?: string) => {
48
+ const query = aiconfigId
49
+ ? `?aiconfigId=${encodeURIComponent(aiconfigId)}`
50
+ : ""
48
51
  return await API.get({
49
- url: `/api/agent/tools`,
52
+ url: `/api/agent/tools${query}`,
50
53
  })
51
54
  },
52
55
  })
@@ -5,6 +5,9 @@ import {
5
5
  FetchPluginResponse,
6
6
  UploadPluginRequest,
7
7
  UploadPluginResponse,
8
+ PluginUpdateCheckResponse,
9
+ PluginUpdateApplyRequest,
10
+ PluginUpdateApplyResponse,
8
11
  } from "@budibase/types"
9
12
  import { BaseAPIClient } from "./types"
10
13
 
@@ -13,6 +16,11 @@ export interface PluginEndpoins {
13
16
  createPlugin: (data: CreatePluginRequest) => Promise<CreatePluginResponse>
14
17
  getPlugins: () => Promise<FetchPluginResponse>
15
18
  deletePlugin: (pluginId: string) => Promise<DeletePluginResponse>
19
+ checkPluginUpdates: (token?: string) => Promise<PluginUpdateCheckResponse>
20
+ applyPluginUpdates: (
21
+ data: PluginUpdateApplyRequest,
22
+ token?: string
23
+ ) => Promise<PluginUpdateApplyResponse>
16
24
  }
17
25
 
18
26
  export const buildPluginEndpoints = (API: BaseAPIClient): PluginEndpoins => ({
@@ -58,4 +66,20 @@ export const buildPluginEndpoints = (API: BaseAPIClient): PluginEndpoins => ({
58
66
  url: `/api/plugin/${encodeURIComponent(pluginId)}`,
59
67
  })
60
68
  },
69
+
70
+ checkPluginUpdates: async token => {
71
+ const url = token
72
+ ? `/api/plugin/updates?token=${encodeURIComponent(token)}`
73
+ : "/api/plugin/updates"
74
+ return await API.get({
75
+ url,
76
+ })
77
+ },
78
+
79
+ applyPluginUpdates: async (data, token) => {
80
+ return await API.post({
81
+ url: "/api/plugin/updates",
82
+ body: { ...data, token },
83
+ })
84
+ },
61
85
  })
@@ -303,7 +303,7 @@
303
303
  on:keydown={handleKeyDown}
304
304
  placeholder="Ask anything"
305
305
  disabled={loading}
306
- />
306
+ ></textarea>
307
307
  </div>
308
308
  </div>
309
309
 
@@ -6,17 +6,17 @@
6
6
  </script>
7
7
 
8
8
  <div class:sideNav id="clientAppSkeletonLoader" class="skeleton">
9
- <div class="animation" class:noAnimation />
9
+ <div class="animation" class:noAnimation></div>
10
10
 
11
11
  {#if !hideDevTools}
12
- <div class="devTools" />
12
+ <div class="devTools"></div>
13
13
  {/if}
14
14
  <div class="main">
15
- <div class="nav" />
15
+ <div class="nav"></div>
16
16
  <div class="body">
17
- <div class="bodyVerticalPadding" />
17
+ <div class="bodyVerticalPadding"></div>
18
18
  <div class="bodyHorizontal">
19
- <div class="bodyHorizontalPadding" />
19
+ <div class="bodyHorizontalPadding"></div>
20
20
  <svg
21
21
  class="svg"
22
22
  xmlns="http://www.w3.org/2000/svg"
@@ -42,13 +42,13 @@
42
42
  mask="url(#mask)"
43
43
  />
44
44
  </svg>
45
- <div class="bodyHorizontalPadding" />
45
+ <div class="bodyHorizontalPadding"></div>
46
46
  </div>
47
- <div class="bodyVerticalPadding" />
47
+ <div class="bodyVerticalPadding"></div>
48
48
  </div>
49
49
  </div>
50
50
  {#if !hideFooter}
51
- <div class="footer" />
51
+ <div class="footer"></div>
52
52
  {/if}
53
53
  </div>
54
54
 
@@ -57,7 +57,7 @@
57
57
  on:wheel|stopPropagation
58
58
  spellcheck="false"
59
59
  use:clickOutside={close}
60
- />
60
+ ></textarea>
61
61
  </GridPopover>
62
62
  {/if}
63
63
 
@@ -12,7 +12,12 @@
12
12
  export let schema
13
13
  export let maximum
14
14
 
15
- const { API, notifications, props, datasource } = getContext("grid")
15
+ const {
16
+ API,
17
+ notifications,
18
+ props: gridProps,
19
+ datasource,
20
+ } = getContext("grid")
16
21
  const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
17
22
 
18
23
  let isOpen = false
@@ -89,7 +94,7 @@
89
94
  {#each value || [] as attachment}
90
95
  {#if isImage(attachment.extension)}
91
96
  <img
92
- class:light={!$props?.darkMode &&
97
+ class:light={!$gridProps?.darkMode &&
93
98
  schema.type === FieldType.SIGNATURE_SINGLE}
94
99
  src={attachment.url}
95
100
  alt={attachment.extension}
@@ -111,7 +116,7 @@
111
116
  on:change={e => onChange(e.detail)}
112
117
  maximum={maximum || schema.constraints?.length?.maximum}
113
118
  {processFiles}
114
- handleFileTooLarge={$props.isCloud ? handleFileTooLarge : null}
119
+ handleFileTooLarge={$gridProps.isCloud ? handleFileTooLarge : null}
115
120
  />
116
121
  </div>
117
122
  </GridPopover>
@@ -74,7 +74,7 @@
74
74
  on:wheel|stopPropagation
75
75
  spellcheck="false"
76
76
  use:clickOutside={close}
77
- />
77
+ ></textarea>
78
78
  </GridPopover>
79
79
  {/if}
80
80
 
@@ -11,7 +11,12 @@
11
11
  export let readonly = false
12
12
  export let api
13
13
 
14
- const { API, notifications, props, datasource } = getContext("grid")
14
+ const {
15
+ API,
16
+ notifications,
17
+ props: gridProps,
18
+ datasource,
19
+ } = getContext("grid")
15
20
 
16
21
  let isOpen = false
17
22
  let modal
@@ -73,7 +78,7 @@
73
78
  <!-- svelte-ignore a11y-click-events-have-key-events -->
74
79
  <div
75
80
  class="signature-cell"
76
- class:light={!$props?.darkMode}
81
+ class:light={!$gridProps?.darkMode}
77
82
  class:editable
78
83
  bind:this={anchor}
79
84
  on:click={editable ? open : null}
@@ -88,7 +93,7 @@
88
93
  onConfirm={saveSignature}
89
94
  title={schema?.name}
90
95
  {value}
91
- darkMode={$props.darkMode}
96
+ darkMode={$gridProps.darkMode}
92
97
  bind:this={modal}
93
98
  />
94
99
 
@@ -98,7 +103,7 @@
98
103
  {#if value?.key}
99
104
  <div class="signature-wrap">
100
105
  <CoreSignature
101
- darkMode={$props.darkMode}
106
+ darkMode={$gridProps.darkMode}
102
107
  editable={false}
103
108
  {value}
104
109
  on:change={saveSignature}
@@ -8,7 +8,7 @@
8
8
  const {
9
9
  renderedRows,
10
10
  hoveredRowId,
11
- props,
11
+ props: gridProps,
12
12
  width,
13
13
  rows,
14
14
  focusedRow,
@@ -26,7 +26,7 @@
26
26
 
27
27
  let container
28
28
 
29
- $: buttons = getButtons($props)
29
+ $: buttons = getButtons($gridProps)
30
30
  $: columnsWidth = $scrollableColumns.reduce(
31
31
  (total, col) => (total += col.width),
32
32
  0
@@ -116,11 +116,11 @@
116
116
  class="buttons"
117
117
  class:offset={$showVScrollbar && $showHScrollbar}
118
118
  >
119
- {#if $props.buttonsCollapsed}
119
+ {#if $gridProps.buttonsCollapsed}
120
120
  {#if rowButtons.length > 0}
121
121
  <CollapsedButtonGroup
122
122
  buttons={makeCollapsedButtons(rowButtons, row)}
123
- text={$props.buttonsCollapsedText || "Action"}
123
+ text={$gridProps.buttonsCollapsedText || "Action"}
124
124
  align="right"
125
125
  offset={5}
126
126
  size="S"
@@ -128,7 +128,7 @@
128
128
  on:mouseenter={() => ($hoveredRowId = row._id)}
129
129
  />
130
130
  {:else}
131
- <div class="button-placeholder-collapsed" />
131
+ <div class="button-placeholder-collapsed"></div>
132
132
  {/if}
133
133
  {:else}
134
134
  {#each rowButtons as button}
@@ -143,13 +143,13 @@
143
143
  on:click={() => handleClick(button, row)}
144
144
  >
145
145
  {#if button.icon}
146
- <i class="{button.icon} S" />
146
+ <i class="{button.icon} S"></i>
147
147
  {/if}
148
148
  {button.text || "Button"}
149
149
  </Button>
150
150
  {/each}
151
151
  {#if rowButtons.length === 0}
152
- <div class="button-placeholder" />
152
+ <div class="button-placeholder"></div>
153
153
  {/if}
154
154
  {/if}
155
155
  </div>
@@ -14,7 +14,7 @@
14
14
  dispatch,
15
15
  isDragging,
16
16
  config,
17
- props,
17
+ props: gridProps,
18
18
  } = getContext("grid")
19
19
 
20
20
  let body
@@ -66,7 +66,7 @@
66
66
  </div>
67
67
  {/if}
68
68
  </GridScrollWrapper>
69
- {#if $props.buttons?.length}
69
+ {#if $gridProps.buttons?.length}
70
70
  <ButtonColumn />
71
71
  {/if}
72
72
  </div>
@@ -23,7 +23,7 @@
23
23
  isSelectingCells,
24
24
  selectedCellMap,
25
25
  selectedCellCount,
26
- props,
26
+ props: gridProps,
27
27
  buttonColumnWidth,
28
28
  } = getContext("grid")
29
29
 
@@ -32,7 +32,7 @@
32
32
  $hoveredRowId === row._id && (!$selectedCellCount || !$isSelectingCells)
33
33
  $: rowFocused = $focusedRow?._id === row._id
34
34
  $: reorderSource = $reorder.sourceColumn
35
- $: hasButtons = $props?.buttons?.length > 0
35
+ $: hasButtons = $gridProps?.buttons?.length > 0
36
36
  $: needsButtonSpacer = hasButtons && $buttonColumnWidth > 0
37
37
  </script>
38
38
 
@@ -188,14 +188,17 @@
188
188
  class:floating={offset > 0}
189
189
  style="--offset:{offset}px; --sticky-width:{width}px;"
190
190
  >
191
- <div class="underlay sticky" transition:fade|local={{ duration: 130 }} />
192
- <div class="underlay" transition:fade|local={{ duration: 130 }} />
191
+ <div
192
+ class="underlay sticky"
193
+ transition:fade|local={{ duration: 130 }}
194
+ ></div>
195
+ <div class="underlay" transition:fade|local={{ duration: 130 }}></div>
193
196
  <div class="sticky-column" transition:fade|local={{ duration: 130 }}>
194
197
  <div class="row">
195
198
  <GutterCell expandable on:expand={addViaModal} rowHovered>
196
199
  <Icon name="plus" color="var(--spectrum-global-color-gray-500)" />
197
200
  {#if isAdding}
198
- <div in:fade={{ duration: 130 }} class="loading-overlay" />
201
+ <div in:fade={{ duration: 130 }} class="loading-overlay"></div>
199
202
  {/if}
200
203
  </GutterCell>
201
204
  {#if $displayColumn}
@@ -214,7 +217,7 @@
214
217
  <div class="readonly-overlay">Can't edit auto column</div>
215
218
  {/if}
216
219
  {#if isAdding}
217
- <div in:fade={{ duration: 130 }} class="loading-overlay" />
220
+ <div in:fade={{ duration: 130 }} class="loading-overlay"></div>
218
221
  {/if}
219
222
  </DataCell>
220
223
  {/if}
@@ -240,7 +243,7 @@
240
243
  <div class="readonly-overlay">Can't edit auto column</div>
241
244
  {/if}
242
245
  {#if isAdding}
243
- <div in:fade={{ duration: 130 }} class="loading-overlay" />
246
+ <div in:fade={{ duration: 130 }} class="loading-overlay"></div>
244
247
  {/if}
245
248
  </DataCell>
246
249
  {/each}
@@ -65,7 +65,7 @@
65
65
  }
66
66
  </script>
67
67
 
68
- <div bind:this={anchor} {style} class="menu-anchor" />
68
+ <div bind:this={anchor} {style} class="menu-anchor"></div>
69
69
 
70
70
  {#if $menu.visible}
71
71
  {#key style}
@@ -1,4 +1,4 @@
1
- <div class="grid-popover-container" />
1
+ <div class="grid-popover-container"></div>
2
2
 
3
3
  <style>
4
4
  .grid-popover-container {
@@ -35,7 +35,7 @@
35
35
  {#if visible}
36
36
  <div class="reorder-wrapper">
37
37
  <GridScrollWrapper scrollVertically>
38
- <div class="reorder-overlay" {style} />
38
+ <div class="reorder-overlay" {style}></div>
39
39
  </GridScrollWrapper>
40
40
  </div>
41
41
  {/if}
@@ -24,7 +24,7 @@
24
24
  on:dblclick={() => resize.actions.resetSize(column)}
25
25
  style={getStyle(column, $scrollLeft)}
26
26
  >
27
- <div class="resize-indicator" />
27
+ <div class="resize-indicator"></div>
28
28
  </div>
29
29
  {/each}
30
30
  {/if}
@@ -123,7 +123,7 @@
123
123
  on:mousedown={startVDragging}
124
124
  on:touchstart={startVDragging}
125
125
  class:dragging={isDraggingV}
126
- />
126
+ ></div>
127
127
  {/if}
128
128
  {#if $showHScrollbar}
129
129
  <!-- svelte-ignore a11y-no-static-element-interactions -->
@@ -133,7 +133,7 @@
133
133
  on:mousedown={startHDragging}
134
134
  on:touchstart={startHDragging}
135
135
  class:dragging={isDraggingH}
136
- />
136
+ ></div>
137
137
  {/if}
138
138
 
139
139
  <style>
@@ -1,5 +1,5 @@
1
1
  import { writable, derived, get, Writable, Readable } from "svelte/store"
2
- import { DataFetch, fetchData } from "../../../fetch"
2
+ import { DataFetch, DataFetchDefinition, fetchData } from "../../../fetch"
3
3
  import { NewRowID, RowPageSize } from "../lib/constants"
4
4
  import {
5
5
  generateRowID,
@@ -252,7 +252,18 @@ export const createActions = (context: StoreContext): RowActionStore => {
252
252
  })
253
253
 
254
254
  // Subscribe to changes of this fetch model
255
- unsubscribe = newFetch.subscribe(async $fetch => {
255
+ type GridFetchSnapshot = {
256
+ rows: Row[]
257
+ loading: boolean
258
+ loaded: boolean
259
+ resetKey: string
260
+ hasNextPage: boolean
261
+ error: { message: string; status: number; url: string } | null
262
+ definition?: DataFetchDefinition | null
263
+ }
264
+
265
+ const fetchStore = newFetch as unknown as Readable<GridFetchSnapshot>
266
+ unsubscribe = fetchStore.subscribe(async $fetch => {
256
267
  if ($fetch.error) {
257
268
  // Present a helpful error to the user
258
269
  let message = "An unknown error occurred"
@@ -481,7 +492,7 @@ export const createActions = (context: StoreContext): RowActionStore => {
481
492
  })
482
493
 
483
494
  // Create rows
484
- let saved = []
495
+ let saved: UIRow[] = []
485
496
  let failed = 0
486
497
  for (let i = 0; i < count; i++) {
487
498
  try {
@@ -700,7 +711,7 @@ export const createActions = (context: StoreContext): RowActionStore => {
700
711
 
701
712
  // Update rows
702
713
  const $columnLookupMap = get(columnLookupMap)
703
- let updated = []
714
+ let updated: UIRow[] = []
704
715
  let failed = 0
705
716
  for (let i = 0; i < count; i++) {
706
717
  const rowId = rowIds[i]
@@ -779,7 +790,7 @@ export const createActions = (context: StoreContext): RowActionStore => {
779
790
  if (resetRows) {
780
791
  rowCacheMap = {}
781
792
  }
782
- let rowsToAppend = []
793
+ let rowsToAppend: Row[] = []
783
794
  let newRow
784
795
  const $hasBudibaseIdentifiers = get(hasBudibaseIdentifiers)
785
796
  for (let i = 0; i < newRows.length; i++) {
@@ -11,9 +11,13 @@ export default class JSONArrayFetch extends FieldFetch<JSONArrayFieldDatasource>
11
11
  try {
12
12
  const { fieldName } = datasource
13
13
  const table = await this.API.fetchTableDefinition(datasource.tableId)
14
+
15
+ // For Postgres JSON columns, the schema may be directly available on the field
16
+ // Otherwise, fall back to fetching the schema
14
17
  const schema =
15
- table.schema[fieldName].schema ??
18
+ table.schema?.[fieldName]?.schema ??
16
19
  getJSONArrayDatasourceSchema(table.schema, datasource)
20
+
17
21
  return { schema }
18
22
  } catch (error) {
19
23
  return null
package/svelte.config.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
2
2
 
3
3
  const config = {
4
- preprocess: vitePreprocess(),
4
+ preprocess: vitePreprocess({ script: true }),
5
5
  }
6
6
 
7
7
  export default config
File without changes