@budibase/frontend-core 1.0.212-alpha.4 → 1.0.212-alpha.7

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.0.212-alpha.4",
3
+ "version": "1.0.212-alpha.7",
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.0.212-alpha.4",
9
+ "@budibase/bbui": "^1.0.212-alpha.7",
10
10
  "lodash": "^4.17.21",
11
11
  "svelte": "^3.46.2"
12
12
  },
13
- "gitHead": "03cdf3688a0c34a7303a83d81b24e03b8589ce54"
13
+ "gitHead": "548b2c1a9fa92fb4e9bef9f3cef05bb9097af701"
14
14
  }
package/src/api/other.js CHANGED
@@ -60,7 +60,7 @@ export const buildOtherEndpoints = API => ({
60
60
  */
61
61
  checkBetaAccess: async email => {
62
62
  return await API.get({
63
- url: `${process.env.FEATURE_PREVIEW_URL}/api/beta/access?email=${email}`,
63
+ url: `/api/beta/access?email=${email}`,
64
64
  external: true,
65
65
  })
66
66
  },
package/src/constants.js CHANGED
@@ -42,6 +42,10 @@ export const OperatorOptions = {
42
42
  value: "notEqual",
43
43
  label: "Does Not Contain",
44
44
  },
45
+ In: {
46
+ value: "oneOf",
47
+ label: "Is in",
48
+ },
45
49
  }
46
50
 
47
51
  // Cookie names
@@ -14,6 +14,7 @@ export const getValidOperatorsForType = type => {
14
14
  Op.Like,
15
15
  Op.Empty,
16
16
  Op.NotEmpty,
17
+ Op.In,
17
18
  ]
18
19
  const numOps = [
19
20
  Op.Equals,
@@ -22,6 +23,7 @@ export const getValidOperatorsForType = type => {
22
23
  Op.LessThan,
23
24
  Op.Empty,
24
25
  Op.NotEmpty,
26
+ Op.In,
25
27
  ]
26
28
  if (type === "string") {
27
29
  return stringOps
@@ -91,6 +93,7 @@ export const buildLuceneQuery = filter => {
91
93
  notEmpty: {},
92
94
  contains: {},
93
95
  notContains: {},
96
+ oneOf: {},
94
97
  }
95
98
  if (Array.isArray(filter)) {
96
99
  filter.forEach(expression => {
@@ -99,8 +102,12 @@ export const buildLuceneQuery = filter => {
99
102
  if (type === "datetime" && value) {
100
103
  value = new Date(value).toISOString()
101
104
  }
102
- if (type === "number") {
103
- value = parseFloat(value)
105
+ if (type === "number" && !Array.isArray(value)) {
106
+ if (operator === "oneOf") {
107
+ value = value.split(",").map(item => parseFloat(item))
108
+ } else {
109
+ value = parseFloat(value)
110
+ }
104
111
  }
105
112
  if (type === "boolean") {
106
113
  value = `${value}`?.toLowerCase() === "true"
@@ -139,7 +146,6 @@ export const buildLuceneQuery = filter => {
139
146
  }
140
147
  })
141
148
  }
142
-
143
149
  return query
144
150
  }
145
151
 
@@ -211,6 +217,17 @@ export const runLuceneQuery = (docs, query) => {
211
217
  return docValue == null || docValue === ""
212
218
  })
213
219
 
220
+ // Process an includes match (fails if the value is not included)
221
+ const oneOf = match("oneOf", (docValue, testValue) => {
222
+ if (typeof testValue === "string") {
223
+ testValue = testValue.split(",")
224
+ if (typeof docValue === "number") {
225
+ testValue = testValue.map(item => parseFloat(item))
226
+ }
227
+ }
228
+ return !testValue?.includes(docValue)
229
+ })
230
+
214
231
  // Match a document against all criteria
215
232
  const docMatch = doc => {
216
233
  return (
@@ -220,7 +237,8 @@ export const runLuceneQuery = (docs, query) => {
220
237
  equalMatch(doc) &&
221
238
  notEqualMatch(doc) &&
222
239
  emptyMatch(doc) &&
223
- notEmptyMatch(doc)
240
+ notEmptyMatch(doc) &&
241
+ oneOf(doc)
224
242
  )
225
243
  }
226
244