@budibase/frontend-core 3.2.32 → 3.2.33

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.2.32",
3
+ "version": "3.2.33",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -20,5 +20,5 @@
20
20
  "devDependencies": {
21
21
  "svelte-check": "^4.1.0"
22
22
  },
23
- "gitHead": "d5c6dc1a97a7852a8368966a12bdec475efc47c3"
23
+ "gitHead": "01b66a3805fd2720d5937b1d9cef62f997c1e15b"
24
24
  }
package/src/api/groups.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { SearchUserGroupResponse, UserGroup } from "@budibase/types"
1
+ import {
2
+ SearchGroupResponse,
3
+ SearchUserGroupResponse,
4
+ UserGroup,
5
+ } from "@budibase/types"
2
6
  import { BaseAPIClient } from "./types"
3
7
 
4
8
  export interface GroupEndpoints {
@@ -64,9 +68,10 @@ export const buildGroupsEndpoints = (API: BaseAPIClient): GroupEndpoints => {
64
68
  * Gets all the user groups
65
69
  */
66
70
  getGroups: async () => {
67
- return await API.get({
71
+ const res = await API.get<SearchGroupResponse>({
68
72
  url: "/api/global/groups",
69
73
  })
74
+ return res.data
70
75
  },
71
76
 
72
77
  /**
@@ -1,12 +1,18 @@
1
- import { io } from "socket.io-client"
1
+ import { io, Socket } from "socket.io-client"
2
2
  import { SocketEvent, SocketSessionTTL } from "@budibase/shared-core"
3
3
  import { APISessionID } from "../api"
4
4
 
5
5
  const DefaultOptions = {
6
6
  heartbeat: true,
7
7
  }
8
+ export interface ExtendedSocket extends Socket {
9
+ onOther: (event: string, callback: (data: any) => void) => void
10
+ }
8
11
 
9
- export const createWebsocket = (path, options = DefaultOptions) => {
12
+ export const createWebsocket = (
13
+ path: string,
14
+ options = DefaultOptions
15
+ ): ExtendedSocket => {
10
16
  if (!path) {
11
17
  throw "A websocket path must be provided"
12
18
  }
@@ -32,10 +38,10 @@ export const createWebsocket = (path, options = DefaultOptions) => {
32
38
  // Disable polling and rely on websocket only, as HTTP transport
33
39
  // will only work with sticky sessions which we don't have
34
40
  transports: ["websocket"],
35
- })
41
+ }) as ExtendedSocket
36
42
 
37
43
  // Set up a heartbeat that's half of the session TTL
38
- let interval
44
+ let interval: NodeJS.Timeout | undefined
39
45
  if (heartbeat) {
40
46
  interval = setInterval(() => {
41
47
  socket.emit(SocketEvent.Heartbeat)
@@ -48,7 +54,7 @@ export const createWebsocket = (path, options = DefaultOptions) => {
48
54
 
49
55
  // Helper utility to ignore events that were triggered due to API
50
56
  // changes made by us
51
- socket.onOther = (event, callback) => {
57
+ socket.onOther = (event: string, callback: (data: any) => void) => {
52
58
  socket.on(event, data => {
53
59
  if (data?.apiSessionId !== APISessionID) {
54
60
  callback(data)