@budibase/frontend-core 2.0.30-alpha.13 → 2.0.30-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.0.30-alpha.13",
3
+ "version": "2.0.30-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.0.30-alpha.13",
9
+ "@budibase/bbui": "2.0.30-alpha.15",
10
10
  "lodash": "^4.17.21",
11
11
  "svelte": "^3.46.2"
12
12
  },
13
- "gitHead": "e8486a69c86fcdfa34ce6db319d005e665ff8649"
13
+ "gitHead": "83d5f70937fc66baa53782da968a06f71ff54d19"
14
14
  }
@@ -0,0 +1,50 @@
1
+ export const buildBackupsEndpoints = API => ({
2
+ /**
3
+ * Gets a list of users in the current tenant.
4
+ */
5
+ searchBackups: async ({ appId, trigger, type, page, startDate, endDate }) => {
6
+ const opts = {}
7
+ if (page) {
8
+ opts.page = page
9
+ }
10
+ if (trigger && type) {
11
+ opts.trigger = trigger.toLowerCase()
12
+ opts.type = type.toLowerCase()
13
+ }
14
+ if (startDate && endDate) {
15
+ opts.startDate = startDate
16
+ opts.endDate = endDate
17
+ }
18
+ return await API.post({
19
+ url: `/api/apps/${appId}/backups/search`,
20
+ body: opts,
21
+ })
22
+ },
23
+
24
+ createManualBackup: async ({ appId, name }) => {
25
+ return await API.post({
26
+ url: `/api/apps/${appId}/backups`,
27
+ body: { name },
28
+ })
29
+ },
30
+
31
+ deleteBackup: async ({ appId, backupId }) => {
32
+ return await API.delete({
33
+ url: `/api/apps/${appId}/backups/${backupId}`,
34
+ })
35
+ },
36
+
37
+ updateBackup: async ({ appId, backupId, name }) => {
38
+ return await API.patch({
39
+ url: `/api/apps/${appId}/backups/${backupId}`,
40
+ body: { name },
41
+ })
42
+ },
43
+
44
+ restoreBackup: async ({ appId, backupId, name }) => {
45
+ return await API.post({
46
+ url: `/api/apps/${appId}/backups/${backupId}/import`,
47
+ body: { name },
48
+ })
49
+ },
50
+ })
package/src/api/index.js CHANGED
@@ -25,6 +25,7 @@ import { buildViewEndpoints } from "./views"
25
25
  import { buildLicensingEndpoints } from "./licensing"
26
26
  import { buildGroupsEndpoints } from "./groups"
27
27
  import { buildPluginEndpoints } from "./plugins"
28
+ import { buildBackupsEndpoints } from "./backups"
28
29
 
29
30
  const defaultAPIClientConfig = {
30
31
  /**
@@ -245,5 +246,6 @@ export const createAPIClient = config => {
245
246
  ...buildLicensingEndpoints(API),
246
247
  ...buildGroupsEndpoints(API),
247
248
  ...buildPluginEndpoints(API),
249
+ ...buildBackupsEndpoints(API),
248
250
  }
249
251
  }
package/src/constants.js CHANGED
@@ -113,6 +113,7 @@ export const ApiVersion = "1"
113
113
 
114
114
  export const Features = {
115
115
  USER_GROUPS: "userGroups",
116
+ BACKUPS: "appBackups",
116
117
  }
117
118
 
118
119
  // Role IDs