@budibase/frontend-core 1.3.13 → 1.3.15-alpha.1

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": "1.3.13",
3
+ "version": "1.3.15-alpha.1",
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": "^1.3.13",
9
+ "@budibase/bbui": "1.3.15-alpha.1",
10
10
  "lodash": "^4.17.21",
11
11
  "svelte": "^3.46.2"
12
12
  },
13
- "gitHead": "272a2ec7c7f2fabf74153fc8573ce6745134cdde"
13
+ "gitHead": "a92a8ed882cde62db5903d495112e202173defc7"
14
14
  }
package/src/api/index.js CHANGED
@@ -24,6 +24,7 @@ import { buildSelfEndpoints } from "./self"
24
24
  import { buildViewEndpoints } from "./views"
25
25
  import { buildLicensingEndpoints } from "./licensing"
26
26
  import { buildGroupsEndpoints } from "./groups"
27
+ import { buildPluginEndpoints } from "./plugins"
27
28
 
28
29
  const defaultAPIClientConfig = {
29
30
  /**
@@ -243,5 +244,6 @@ export const createAPIClient = config => {
243
244
  ...buildSelfEndpoints(API),
244
245
  ...buildLicensingEndpoints(API),
245
246
  ...buildGroupsEndpoints(API),
247
+ ...buildPluginEndpoints(API),
246
248
  }
247
249
  }
@@ -0,0 +1,44 @@
1
+ export const buildPluginEndpoints = API => ({
2
+ /**
3
+ * Uploads a plugin tarball bundle
4
+ * @param data the plugin tarball bundle to upload
5
+ */
6
+ uploadPlugin: async data => {
7
+ return await API.post({
8
+ url: `/api/plugin/upload`,
9
+ body: data,
10
+ json: false,
11
+ })
12
+ },
13
+
14
+ /**
15
+ * Creates a plugin from URL, Github or NPM
16
+ */
17
+ createPlugin: async data => {
18
+ return await API.post({
19
+ url: `/api/plugin`,
20
+ body: data,
21
+ })
22
+ },
23
+
24
+ /**
25
+ * Gets a list of all plugins
26
+ */
27
+ getPlugins: async () => {
28
+ return await API.get({
29
+ url: "/api/plugin",
30
+ })
31
+ },
32
+
33
+ /**
34
+ * Deletes a plugin.
35
+ * @param pluginId the ID of the plugin to delete
36
+ *
37
+ * * @param pluginId the revision of the plugin to delete
38
+ */
39
+ deletePlugin: async pluginId => {
40
+ return await API.delete({
41
+ url: `/api/plugin/${pluginId}`,
42
+ })
43
+ },
44
+ })
@@ -80,6 +80,19 @@ const cleanupQuery = query => {
80
80
  return query
81
81
  }
82
82
 
83
+ /**
84
+ * Removes a numeric prefix on field names designed to give fields uniqueness
85
+ */
86
+ const removeKeyNumbering = key => {
87
+ if (typeof key === "string" && key.match(/\d[0-9]*:/g) != null) {
88
+ const parts = key.split(":")
89
+ parts.shift()
90
+ return parts.join(":")
91
+ } else {
92
+ return key
93
+ }
94
+ }
95
+
83
96
  /**
84
97
  * Builds a lucene JSON query from the filter structure generated in the builder
85
98
  * @param filter the builder filter structure
@@ -194,7 +207,7 @@ export const runLuceneQuery = (docs, query) => {
194
207
  const filters = Object.entries(query[type] || {})
195
208
  for (let i = 0; i < filters.length; i++) {
196
209
  const [key, testValue] = filters[i]
197
- const docValue = Helpers.deepGet(doc, key)
210
+ const docValue = Helpers.deepGet(doc, removeKeyNumbering(key))
198
211
  if (failFn(docValue, testValue)) {
199
212
  return false
200
213
  }