@budibase/frontend-core 2.3.18-alpha.14 → 2.3.18-alpha.15

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,14 +1,14 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.3.18-alpha.14",
3
+ "version": "2.3.18-alpha.15",
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.3.18-alpha.14",
9
+ "@budibase/bbui": "2.3.18-alpha.15",
10
10
  "lodash": "^4.17.21",
11
11
  "svelte": "^3.46.2"
12
12
  },
13
- "gitHead": "6303105b71c3ef85e5bc8a89a7fd763cf55179e4"
13
+ "gitHead": "78287e11da6973374962afac59b35c598a54efc3"
14
14
  }
@@ -0,0 +1,63 @@
1
+ const buildOpts = ({
2
+ bookmark,
3
+ userIds,
4
+ appIds,
5
+ startDate,
6
+ endDate,
7
+ fullSearch,
8
+ events,
9
+ }) => {
10
+ const opts = {}
11
+
12
+ if (bookmark) {
13
+ opts.bookmark = bookmark
14
+ }
15
+
16
+ if (startDate && endDate) {
17
+ opts.startDate = startDate
18
+ opts.endDate = endDate
19
+ } else if (startDate && !endDate) {
20
+ opts.startDate = startDate
21
+ }
22
+
23
+ if (fullSearch) {
24
+ opts.fullSearch = fullSearch
25
+ }
26
+
27
+ if (events.length) {
28
+ opts.events = events
29
+ }
30
+
31
+ if (userIds.length) {
32
+ opts.userIds = userIds
33
+ }
34
+
35
+ if (appIds.length) {
36
+ opts.appIds = appIds
37
+ }
38
+
39
+ return opts
40
+ }
41
+
42
+ export const buildAuditLogsEndpoints = API => ({
43
+ /**
44
+ * Gets a list of users in the current tenant.
45
+ */
46
+ searchAuditLogs: async opts => {
47
+ return await API.post({
48
+ url: `/api/global/auditlogs/search`,
49
+ body: buildOpts(opts),
50
+ })
51
+ },
52
+
53
+ getEventDefinitions: async () => {
54
+ return await API.get({
55
+ url: `/api/global/auditlogs/definitions`,
56
+ })
57
+ },
58
+
59
+ getDownloadUrl: opts => {
60
+ const query = encodeURIComponent(JSON.stringify(opts))
61
+ return `/api/global/auditlogs/download?query=${query}`
62
+ },
63
+ })
package/src/api/index.js CHANGED
@@ -28,6 +28,8 @@ import { buildPluginEndpoints } from "./plugins"
28
28
  import { buildBackupsEndpoints } from "./backups"
29
29
  import { buildEnvironmentVariableEndpoints } from "./environmentVariables"
30
30
  import { buildEventEndpoints } from "./events"
31
+ import { buildAuditLogsEndpoints } from "./auditLogs"
32
+
31
33
  const defaultAPIClientConfig = {
32
34
  /**
33
35
  * Certain definitions can't change at runtime for client apps, such as the
@@ -250,5 +252,6 @@ export const createAPIClient = config => {
250
252
  ...buildBackupsEndpoints(API),
251
253
  ...buildEnvironmentVariableEndpoints(API),
252
254
  ...buildEventEndpoints(API),
255
+ ...buildAuditLogsEndpoints(API),
253
256
  }
254
257
  }
package/src/constants.js CHANGED
@@ -115,6 +115,7 @@ export const Features = {
115
115
  USER_GROUPS: "userGroups",
116
116
  BACKUPS: "appBackups",
117
117
  ENVIRONMENT_VARIABLES: "environmentVariables",
118
+ AUDIT_LOGS: "auditLogs",
118
119
  ENFORCEABLE_SSO: "enforceableSSO",
119
120
  }
120
121