@budibase/frontend-core 2.8.6-alpha.4 → 2.8.6-alpha.6

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,17 +1,17 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.8.6-alpha.4",
3
+ "version": "2.8.6-alpha.6",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
7
7
  "svelte": "src/index.js",
8
8
  "dependencies": {
9
- "@budibase/bbui": "2.8.6-alpha.4",
10
- "@budibase/shared-core": "2.8.6-alpha.4",
9
+ "@budibase/bbui": "2.8.6-alpha.6",
10
+ "@budibase/shared-core": "2.8.6-alpha.6",
11
11
  "dayjs": "^1.11.7",
12
12
  "lodash": "^4.17.21",
13
13
  "socket.io-client": "^4.6.1",
14
14
  "svelte": "^3.46.2"
15
15
  },
16
- "gitHead": "d348614b71d7fdfcdc865805a79b9dc5d836f7d4"
16
+ "gitHead": "19c9a9dadf41ed82e52b1adadcf2ac5698ced432"
17
17
  }
package/src/api/index.js CHANGED
@@ -30,6 +30,7 @@ import { buildBackupsEndpoints } from "./backups"
30
30
  import { buildEnvironmentVariableEndpoints } from "./environmentVariables"
31
31
  import { buildEventEndpoints } from "./events"
32
32
  import { buildAuditLogsEndpoints } from "./auditLogs"
33
+ import { buildLogsEndpoints } from "./logs"
33
34
 
34
35
  /**
35
36
  * Random identifier to uniquely identify a session in a tab. This is
@@ -277,5 +278,6 @@ export const createAPIClient = config => {
277
278
  ...buildEnvironmentVariableEndpoints(API),
278
279
  ...buildEventEndpoints(API),
279
280
  ...buildAuditLogsEndpoints(API),
281
+ ...buildLogsEndpoints(API),
280
282
  }
281
283
  }
@@ -0,0 +1,14 @@
1
+ export const buildLogsEndpoints = API => ({
2
+ /**
3
+ * Gets a stream for the system logs.
4
+ */
5
+ getSystemLogs: async () => {
6
+ return await API.get({
7
+ url: "/api/system/logs",
8
+ json: false,
9
+ parseResponse: async response => {
10
+ return response
11
+ },
12
+ })
13
+ },
14
+ })
@@ -11,3 +11,26 @@ export function downloadText(filename, text) {
11
11
 
12
12
  URL.revokeObjectURL(url)
13
13
  }
14
+
15
+ export async function downloadStream(streamResponse) {
16
+ const blob = await streamResponse.blob()
17
+
18
+ const contentDisposition = streamResponse.headers.get("Content-Disposition")
19
+
20
+ const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(
21
+ contentDisposition
22
+ )
23
+
24
+ const filename = matches[1].replace(/['"]/g, "")
25
+
26
+ const resBlob = new Blob([blob])
27
+
28
+ const blobUrl = URL.createObjectURL(resBlob)
29
+
30
+ const link = document.createElement("a")
31
+ link.href = blobUrl
32
+ link.download = filename
33
+ link.click()
34
+
35
+ URL.revokeObjectURL(blobUrl)
36
+ }
@@ -5,4 +5,4 @@ export * as RoleUtils from "./roles"
5
5
  export * as Utils from "./utils"
6
6
  export { memo, derivedMemo } from "./memo"
7
7
  export { createWebsocket } from "./websocket"
8
- export { downloadText } from "./download"
8
+ export * from "./download"