@fibery/expression-utils 9.7.3 → 10.0.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.
Files changed (83) hide show
  1. package/lib/_virtual/_rolldown/runtime.js +13 -0
  2. package/lib/context-variables.d.ts +30 -0
  3. package/lib/context-variables.js +116 -0
  4. package/lib/errors.d.ts +6 -0
  5. package/lib/errors.js +16 -0
  6. package/lib/field-expression-visitor-type-aware.d.ts +25 -0
  7. package/lib/field-expression-visitor-type-aware.js +120 -0
  8. package/lib/filter-expression/index.d.ts +13 -0
  9. package/lib/filter-expression/index.js +36 -0
  10. package/lib/filter-expression/operator-utils.d.ts +15 -0
  11. package/lib/filter-expression/operator-utils.js +206 -0
  12. package/lib/filter-expression/operators.d.ts +113 -0
  13. package/lib/filter-expression/operators.js +1151 -0
  14. package/lib/filter-expression/pattern-match-placeholders.d.ts +83 -0
  15. package/lib/filter-expression/pattern-match-placeholders.js +126 -0
  16. package/lib/filter-expression/pattern-match.d.ts +21 -0
  17. package/lib/filter-expression/pattern-match.js +126 -0
  18. package/lib/filter-expression/pattern-to-expression.d.ts +17 -0
  19. package/lib/filter-expression/pattern-to-expression.js +44 -0
  20. package/lib/filter-expression/types.d.ts +33 -0
  21. package/lib/filter-expression/types.js +0 -0
  22. package/lib/index.d.ts +191 -585
  23. package/lib/index.js +15 -50
  24. package/lib/params-placeholders.d.ts +58 -0
  25. package/lib/params-placeholders.js +215 -0
  26. package/lib/tsfixme.d.ts +4 -0
  27. package/lib/tsfixme.js +0 -0
  28. package/lib/types.d.ts +65 -0
  29. package/lib/types.js +0 -0
  30. package/lib/utils.d.ts +63 -0
  31. package/lib/utils.js +302 -0
  32. package/lib/visitors.d.ts +50 -0
  33. package/lib/visitors.js +327 -0
  34. package/package.json +13 -32
  35. package/lib/index.js.map +0 -1
  36. package/lib/src/context-variables.d.ts +0 -25
  37. package/lib/src/context-variables.js +0 -148
  38. package/lib/src/context-variables.js.map +0 -1
  39. package/lib/src/errors.d.ts +0 -3
  40. package/lib/src/errors.js +0 -16
  41. package/lib/src/errors.js.map +0 -1
  42. package/lib/src/field-expression-visitor-type-aware.d.ts +0 -23
  43. package/lib/src/field-expression-visitor-type-aware.js +0 -135
  44. package/lib/src/field-expression-visitor-type-aware.js.map +0 -1
  45. package/lib/src/filter-expression/index.d.ts +0 -10
  46. package/lib/src/filter-expression/index.js +0 -49
  47. package/lib/src/filter-expression/index.js.map +0 -1
  48. package/lib/src/filter-expression/operator-utils.d.ts +0 -12
  49. package/lib/src/filter-expression/operator-utils.js +0 -200
  50. package/lib/src/filter-expression/operator-utils.js.map +0 -1
  51. package/lib/src/filter-expression/operators.d.ts +0 -108
  52. package/lib/src/filter-expression/operators.js +0 -867
  53. package/lib/src/filter-expression/operators.js.map +0 -1
  54. package/lib/src/filter-expression/pattern-match-placeholders.d.ts +0 -81
  55. package/lib/src/filter-expression/pattern-match-placeholders.js +0 -157
  56. package/lib/src/filter-expression/pattern-match-placeholders.js.map +0 -1
  57. package/lib/src/filter-expression/pattern-match.d.ts +0 -19
  58. package/lib/src/filter-expression/pattern-match.js +0 -138
  59. package/lib/src/filter-expression/pattern-match.js.map +0 -1
  60. package/lib/src/filter-expression/pattern-to-expression.d.ts +0 -15
  61. package/lib/src/filter-expression/pattern-to-expression.js +0 -47
  62. package/lib/src/filter-expression/pattern-to-expression.js.map +0 -1
  63. package/lib/src/filter-expression/types.d.ts +0 -30
  64. package/lib/src/filter-expression/types.js +0 -3
  65. package/lib/src/filter-expression/types.js.map +0 -1
  66. package/lib/src/params-placeholders.d.ts +0 -54
  67. package/lib/src/params-placeholders.js +0 -208
  68. package/lib/src/params-placeholders.js.map +0 -1
  69. package/lib/src/tsfixme.d.ts +0 -1
  70. package/lib/src/tsfixme.js +0 -3
  71. package/lib/src/tsfixme.js.map +0 -1
  72. package/lib/src/types.d.ts +0 -63
  73. package/lib/src/types.js +0 -3
  74. package/lib/src/types.js.map +0 -1
  75. package/lib/src/utils.d.ts +0 -58
  76. package/lib/src/utils.js +0 -363
  77. package/lib/src/utils.js.map +0 -1
  78. package/lib/src/visitors.d.ts +0 -44
  79. package/lib/src/visitors.js +0 -386
  80. package/lib/src/visitors.js.map +0 -1
  81. package/lib/test-data/schema-mock.d.ts +0 -756
  82. package/lib/test-data/schema-mock.js +0 -139
  83. package/lib/test-data/schema-mock.js.map +0 -1
@@ -1,867 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.operatorBoolIs = exports.operatorCollectionIsNotEmpty = exports.operatorCollectionIsEmpty = exports.operatorCollectionDoesNotContainAnyOf = exports.operatorCollectionDoesNotContainMe = exports.operatorCollectionDoesNotContain = exports.operatorCollectionContainsAnyOf = exports.withoutLastIdAccess = exports.operatorCollectionContainsMe = exports.operatorCollectionContains = exports.operatorLocationIsNotEmpty = exports.operatorLocationIsEmpty = exports.operatorLocationDoesNotContain = exports.operatorLocationContains = exports.operatorTextIsNotEmptyV2 = exports.operatorTextIsNotEmptyV1 = exports.operatorTextIsEmptyV2 = exports.operatorTextIsEmptyV1 = exports.operatorNumberIsNotEmptyV2 = exports.operatorNumberIsNotEmptyV1 = exports.operatorNumberIsEmptyV2 = exports.operatorNumberIsEmptyV1 = exports.operatorCollectionCountLessThanOrEqual = exports.operatorCollectionCountGreaterThanOrEqual = exports.operatorCollectionCountLessThan = exports.operatorCollectionCountGreaterThan = exports.operatorCollectionCountDoesNotEqual = exports.operatorCollectionCountEquals = exports.operatorLessThanOrEqual = exports.operatorGreaterThanOrEqual = exports.operatorLessThan = exports.operatorGreaterThan = exports.operatorNumberDoesNotEqual = exports.operatorNumberEquals = exports.operatorTextEndsWith = exports.operatorTextStartsWith = exports.operatorTextDoesNotContain = exports.operatorTextContains = exports.operatorTextIsNot = exports.operatorTextExactlyIs = exports.operatorTextIs = exports.operatorUserRoleIsAnyOf = exports.operatorReferenceIsNotEmpty = exports.operatorReferenceIsEmpty = exports.operatorReferenceIsNoneOf = exports.operatorReferenceIsNot = exports.operatorReferenceIsAnyOf = exports.operatorReferenceIs = exports.operatorReferenceIsNotMe = exports.operatorReferenceIsMe = void 0;
7
- exports.hiddenValidOperators = exports.operators = exports.operatorsGroups = exports.operatorsGroupsWithoutMe = exports.operatorDateTimeIsOnOrAfter = exports.operatorDateTimeIsOnOrBefore = exports.operatorDateTimeIsAfter = exports.operatorDateTimeIsBefore = exports.operatorDateTimeIsWithin = exports.operatorDateTimeIs = exports.operatorDateIsOnOrAfter = exports.operatorDateIsAfter = exports.operatorDateIsOnOrBefore = exports.operatorDateIsBefore = exports.operatorDateIsWithin = exports.operatorDateIsNotEmptyV2 = exports.operatorDateIsNotEmptyV1 = exports.operatorDateIsEmptyV2 = exports.operatorDateIsEmptyV1 = exports.operatorDateIs = void 0;
8
- const _1 = require("@fibery/helpers/src/_");
9
- /* eslint-disable max-lines */
10
- const findKey_1 = __importDefault(require("lodash/findKey"));
11
- const flatten_1 = __importDefault(require("lodash/flatten"));
12
- const isEqual_1 = __importDefault(require("lodash/isEqual"));
13
- const isString_1 = __importDefault(require("lodash/isString"));
14
- const last_1 = __importDefault(require("lodash/last"));
15
- const uniq_1 = __importDefault(require("lodash/uniq"));
16
- const uuid_1 = require("uuid");
17
- const params_placeholders_1 = require("../params-placeholders");
18
- const operator_utils_1 = require("./operator-utils");
19
- const pattern_match_1 = require("./pattern-match");
20
- const pattern_match_placeholders_1 = require("./pattern-match-placeholders");
21
- const pattern_to_expression_1 = require("./pattern-to-expression");
22
- const referenceIsMePattern = ["=", pattern_match_placeholders_1.referenceExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x === "$my-id")];
23
- const referenceIsNotMePattern = ["!=", pattern_match_placeholders_1.referenceExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x === "$my-id")];
24
- const getReferenceMeOperator = ({ id, title, pattern, isNegative, }) => {
25
- return {
26
- type: ":operator-type/unary",
27
- id,
28
- title,
29
- customMatch: (where, params, typeObject) => {
30
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, pattern, typeObject);
31
- if (matchSuccess) {
32
- return {
33
- matchSuccess,
34
- expression: matches[0].value,
35
- };
36
- }
37
- return { matchSuccess: false };
38
- },
39
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
40
- return (0, pattern_to_expression_1.convertToExpression)(pattern, expression, "$my-id", getNextParamName);
41
- },
42
- isNegative,
43
- };
44
- };
45
- exports.operatorReferenceIsMe = getReferenceMeOperator({
46
- id: ":operator/reference-is-me",
47
- title: "is Me",
48
- pattern: referenceIsMePattern,
49
- isNegative: false,
50
- });
51
- exports.operatorReferenceIsNotMe = getReferenceMeOperator({
52
- id: ":operator/reference-is-not-me",
53
- title: "is not Me",
54
- pattern: referenceIsNotMePattern,
55
- isNegative: true,
56
- });
57
- function isValidReferenceUUID(val) {
58
- // nil UUID should be accepted because "11111111-1111-1111-1111-111111111111" is used as
59
- // non-existing UUID for case when one type has enum type but another type does not
60
- // temporary disable bcz fix opens up another bugs like unable to create entity with pre-set filters and so on
61
- // return isUUID.anyNonNil(val) || val === "11111111-1111-1111-1111-111111111111";
62
- return (0, uuid_1.validate)(val) || ((0, isString_1.default)(val) && (0, params_placeholders_1.isDynamicFilterParam)(val));
63
- }
64
- exports.operatorReferenceIs = {
65
- id: ":operator/reference-is",
66
- title: "is",
67
- pattern: [
68
- "=",
69
- pattern_match_placeholders_1.referenceExpressionPlaceholder,
70
- (0, pattern_match_placeholders_1.getParamPlaceholder)((val) => isValidReferenceUUID(val) || (0, operator_utils_1.isNoValue)(val)),
71
- ],
72
- type: ":operator-type/binary",
73
- isNegative: false,
74
- };
75
- exports.operatorReferenceIsAnyOf = {
76
- id: ":operator/reference-is-any-of",
77
- title: "is any of",
78
- pattern: ["q/in", pattern_match_placeholders_1.referenceExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((val) => val !== null)],
79
- type: ":operator-type/binary",
80
- isNegative: false,
81
- };
82
- exports.operatorReferenceIsNot = {
83
- id: ":operator/reference-is-not",
84
- title: "is not",
85
- pattern: [
86
- "!=",
87
- pattern_match_placeholders_1.referenceExpressionPlaceholder,
88
- (0, pattern_match_placeholders_1.getParamPlaceholder)((val) => isValidReferenceUUID(val) || (0, operator_utils_1.isNoValue)(val)),
89
- ],
90
- type: ":operator-type/binary",
91
- isNegative: true,
92
- };
93
- exports.operatorReferenceIsNoneOf = {
94
- id: ":operator/reference-is-none-of",
95
- title: "is none of",
96
- pattern: ["q/not-in", pattern_match_placeholders_1.referenceExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((val) => val !== null)],
97
- type: ":operator-type/binary",
98
- isNegative: true,
99
- };
100
- exports.operatorReferenceIsEmpty = {
101
- id: ":operator/reference-is-empty",
102
- title: "is empty",
103
- pattern: ["=", pattern_match_placeholders_1.referenceExpressionPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
104
- type: ":operator-type/unary",
105
- isNegative: false,
106
- };
107
- exports.operatorReferenceIsNotEmpty = {
108
- id: ":operator/reference-is-not-empty",
109
- title: "is not empty",
110
- pattern: ["!=", pattern_match_placeholders_1.referenceExpressionPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
111
- type: ":operator-type/unary",
112
- isNegative: true,
113
- };
114
- exports.operatorUserRoleIsAnyOf = {
115
- id: ":operator/user-role-is-any-of",
116
- title: "is any of",
117
- pattern: [
118
- "q/in",
119
- pattern_match_placeholders_1.textFieldPlaceholder,
120
- (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => (Array.isArray(x) && x.every((item) => (0, isString_1.default)(item))) || (0, operator_utils_1.isNoValue)(x)),
121
- ],
122
- type: ":operator-type/binary",
123
- isNegative: false,
124
- };
125
- exports.operatorTextIs = {
126
- id: ":operator/string-equals",
127
- title: "is",
128
- pattern: ["q/equals-ignoring-case?", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
129
- type: ":operator-type/binary",
130
- isNegative: false,
131
- };
132
- exports.operatorTextExactlyIs = {
133
- id: ":operator/string-equals-exact",
134
- title: "=",
135
- pattern: ["=", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
136
- type: ":operator-type/binary",
137
- isNegative: false,
138
- };
139
- exports.operatorTextIsNot = {
140
- id: ":operator/string-not-equals",
141
- title: "is not",
142
- pattern: ["q/not-equals-ignoring-case?", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
143
- type: ":operator-type/binary",
144
- isNegative: true,
145
- };
146
- exports.operatorTextContains = {
147
- id: ":operator/string-contains",
148
- title: "contains",
149
- pattern: ["q/contains", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
150
- type: ":operator-type/binary",
151
- isNegative: false,
152
- };
153
- exports.operatorTextDoesNotContain = {
154
- id: ":operator/string-does-not-contain",
155
- title: "does not contain",
156
- pattern: ["q/not-contains", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
157
- type: ":operator-type/binary",
158
- isNegative: true,
159
- };
160
- exports.operatorTextStartsWith = {
161
- id: ":operator/string-starts-with",
162
- title: "starts with",
163
- pattern: ["q/starts-with-ignoring-case?", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
164
- type: ":operator-type/binary",
165
- isNegative: false,
166
- };
167
- exports.operatorTextEndsWith = {
168
- id: ":operator/string-ends-with",
169
- title: "ends with",
170
- pattern: ["q/ends-with-ignoring-case?", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
171
- type: ":operator-type/binary",
172
- isNegative: false,
173
- };
174
- exports.operatorNumberEquals = {
175
- id: ":operator/equals",
176
- title: "=",
177
- pattern: ["=", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x !== null)],
178
- type: ":operator-type/binary",
179
- isNegative: false,
180
- };
181
- exports.operatorNumberDoesNotEqual = {
182
- id: ":operator/does-not-equal",
183
- title: "≠",
184
- pattern: ["!=", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x !== null)],
185
- type: ":operator-type/binary",
186
- isNegative: true,
187
- };
188
- exports.operatorGreaterThan = {
189
- id: ":operator/greater-than",
190
- title: ">",
191
- pattern: [">", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
192
- type: ":operator-type/binary",
193
- isNegative: false,
194
- };
195
- exports.operatorLessThan = {
196
- id: ":operator/less-than",
197
- title: "<",
198
- pattern: ["<", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
199
- type: ":operator-type/binary",
200
- isNegative: false,
201
- };
202
- exports.operatorGreaterThanOrEqual = {
203
- id: ":operator/greater-than-or-equal",
204
- title: "≥",
205
- pattern: [">=", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
206
- type: ":operator-type/binary",
207
- isNegative: false,
208
- };
209
- exports.operatorLessThanOrEqual = {
210
- id: ":operator/less-than-or-equal",
211
- title: "≤",
212
- pattern: ["<=", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
213
- type: ":operator-type/binary",
214
- isNegative: false,
215
- };
216
- exports.operatorCollectionCountEquals = {
217
- id: ":operator/collection-count-equals",
218
- title: "=",
219
- pattern: ["=", pattern_match_placeholders_1.collectionCountExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x !== null)],
220
- type: ":operator-type/binary",
221
- isNegative: false,
222
- };
223
- exports.operatorCollectionCountDoesNotEqual = {
224
- id: ":operator/collection-count-does-not-equal",
225
- title: "≠",
226
- pattern: ["!=", pattern_match_placeholders_1.collectionCountExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x !== null)],
227
- type: ":operator-type/binary",
228
- isNegative: true,
229
- };
230
- exports.operatorCollectionCountGreaterThan = {
231
- id: ":operator/collection-count-greater-than",
232
- title: ">",
233
- pattern: [">", pattern_match_placeholders_1.collectionCountExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
234
- type: ":operator-type/binary",
235
- isNegative: false,
236
- };
237
- exports.operatorCollectionCountLessThan = {
238
- id: ":operator/collection-count-less-than",
239
- title: "<",
240
- pattern: ["<", pattern_match_placeholders_1.collectionCountExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
241
- type: ":operator-type/binary",
242
- isNegative: false,
243
- };
244
- exports.operatorCollectionCountGreaterThanOrEqual = {
245
- id: ":operator/collection-count-greater-than-or-equal",
246
- title: "≥",
247
- pattern: [">=", pattern_match_placeholders_1.collectionCountExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
248
- type: ":operator-type/binary",
249
- isNegative: false,
250
- };
251
- exports.operatorCollectionCountLessThanOrEqual = {
252
- id: ":operator/collection-count-less-than-or-equal",
253
- title: "≤",
254
- pattern: ["<=", pattern_match_placeholders_1.collectionCountExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
255
- type: ":operator-type/binary",
256
- isNegative: false,
257
- };
258
- exports.operatorNumberIsEmptyV1 = {
259
- id: ":operator/number-is-empty",
260
- title: "is empty",
261
- pattern: ["=", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
262
- type: ":operator-type/unary",
263
- isNegative: false,
264
- };
265
- exports.operatorNumberIsEmptyV2 = {
266
- id: ":operator/number-is-empty",
267
- title: "is empty",
268
- pattern: ["=", ["q/null?", pattern_match_placeholders_1.numberFieldPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(true)],
269
- type: ":operator-type/unary",
270
- isNegative: false,
271
- };
272
- exports.operatorNumberIsNotEmptyV1 = {
273
- id: ":operator/number-is-not-empty",
274
- title: "is not empty",
275
- pattern: ["!=", pattern_match_placeholders_1.numberFieldPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
276
- type: ":operator-type/unary",
277
- isNegative: true,
278
- };
279
- exports.operatorNumberIsNotEmptyV2 = {
280
- id: ":operator/number-is-not-empty",
281
- title: "is not empty",
282
- pattern: ["=", ["q/null?", pattern_match_placeholders_1.numberFieldPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(false)],
283
- type: ":operator-type/unary",
284
- isNegative: true,
285
- };
286
- exports.operatorTextIsEmptyV1 = {
287
- id: ":operator/text-is-empty",
288
- title: "is empty",
289
- pattern: ["=", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
290
- type: ":operator-type/unary",
291
- isNegative: false,
292
- };
293
- exports.operatorTextIsEmptyV2 = {
294
- id: ":operator/text-is-empty",
295
- title: "is empty",
296
- pattern: ["=", ["q/null-or-empty?", pattern_match_placeholders_1.textFieldPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(true)],
297
- type: ":operator-type/unary",
298
- isNegative: false,
299
- };
300
- exports.operatorTextIsNotEmptyV1 = {
301
- id: ":operator/text-is-not-empty",
302
- title: "is not empty",
303
- pattern: ["!=", pattern_match_placeholders_1.textFieldPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
304
- type: ":operator-type/unary",
305
- isNegative: true,
306
- };
307
- exports.operatorTextIsNotEmptyV2 = {
308
- id: ":operator/text-is-not-empty",
309
- title: "is not empty",
310
- pattern: ["=", ["q/null-or-empty?", pattern_match_placeholders_1.textFieldPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(false)],
311
- type: ":operator-type/unary",
312
- isNegative: true,
313
- };
314
- exports.operatorLocationContains = {
315
- id: ":operator/location-contains",
316
- title: "contains",
317
- pattern: ["q/contains", ["q/address", pattern_match_placeholders_1.locationFieldPlaceholder], (0, pattern_match_placeholders_1.getParamPlaceholder)()],
318
- type: ":operator-type/binary",
319
- isNegative: false,
320
- };
321
- exports.operatorLocationDoesNotContain = {
322
- id: ":operator/location-does-not-contain",
323
- title: "does not contain",
324
- pattern: ["q/not-contains", ["q/address", pattern_match_placeholders_1.locationFieldPlaceholder], (0, pattern_match_placeholders_1.getParamPlaceholder)()],
325
- type: ":operator-type/binary",
326
- isNegative: true,
327
- };
328
- exports.operatorLocationIsEmpty = {
329
- id: ":operator/location-is-empty",
330
- title: "is empty",
331
- pattern: ["=", pattern_match_placeholders_1.locationFieldPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
332
- type: ":operator-type/unary",
333
- isNegative: false,
334
- };
335
- exports.operatorLocationIsNotEmpty = {
336
- id: ":operator/location-is-not-empty",
337
- title: "is not empty",
338
- pattern: ["!=", pattern_match_placeholders_1.locationFieldPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
339
- type: ":operator-type/unary",
340
- isNegative: true,
341
- };
342
- const getCollectionContainsPattern = (paramMatchFn) => {
343
- return [
344
- ">",
345
- {
346
- "q/from": pattern_match_placeholders_1.referenceCollectionFieldPlaceholder,
347
- "q/select": ["q/count", ["fibery/id"]],
348
- "q/where": ["=", ["fibery/id"], (0, pattern_match_placeholders_1.getParamPlaceholder)(paramMatchFn)],
349
- "q/limit": "q/no-limit",
350
- },
351
- (0, pattern_match_placeholders_1.getConstantPlaceholder)(0),
352
- ];
353
- };
354
- const getCollectionContainsAnyOfPattern = (comparisonOperator) => [
355
- comparisonOperator,
356
- {
357
- "q/from": pattern_match_placeholders_1.referenceCollectionFieldPlaceholder,
358
- "q/select": ["q/count", ["fibery/id"]],
359
- "q/where": [
360
- "q/in",
361
- ["fibery/id"],
362
- (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => (Array.isArray(x) && x.every((item) => isValidReferenceUUID(item))) || (0, operator_utils_1.isNoValue)(x)),
363
- ],
364
- "q/limit": "q/no-limit",
365
- },
366
- (0, pattern_match_placeholders_1.getConstantPlaceholder)(0),
367
- ];
368
- const collectionContainsAnyOfPattern = getCollectionContainsAnyOfPattern(">");
369
- const collectionDoesNotContainAnyOfPattern = getCollectionContainsAnyOfPattern("=");
370
- const collectionContainsPattern = getCollectionContainsPattern((x) => isValidReferenceUUID(x) || (0, operator_utils_1.isNoValue)(x));
371
- const collectionContainsMePattern = getCollectionContainsPattern((x) => x === "$my-id");
372
- const getCollectionDoesNotContainPattern = (paramMatchFn) => [
373
- "=",
374
- {
375
- "q/from": pattern_match_placeholders_1.referenceCollectionFieldPlaceholder,
376
- "q/select": ["q/count", ["fibery/id"]],
377
- "q/where": ["=", ["fibery/id"], (0, pattern_match_placeholders_1.getParamPlaceholder)(paramMatchFn)],
378
- "q/limit": "q/no-limit",
379
- },
380
- (0, pattern_match_placeholders_1.getConstantPlaceholder)(0),
381
- ];
382
- const collectionDoesNotContainPattern = getCollectionDoesNotContainPattern((x) => isValidReferenceUUID(x) || (0, operator_utils_1.isNoValue)(x));
383
- const collectionDoesNotContainMePattern = getCollectionDoesNotContainPattern((x) => x === "$my-id");
384
- exports.operatorCollectionContains = {
385
- id: ":operator/collection-contains",
386
- title: "contains",
387
- customMatch: (where, params, typeObject) => {
388
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionContainsPattern, typeObject);
389
- if (matchSuccess) {
390
- return {
391
- matchSuccess,
392
- expression: [...matches[0].value, "fibery/id"],
393
- value: matches[1].value,
394
- };
395
- }
396
- return { matchSuccess: false };
397
- },
398
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
399
- return (0, pattern_to_expression_1.convertToExpression)(collectionContainsPattern, (0, exports.withoutLastIdAccess)(expression), value, getNextParamName);
400
- },
401
- type: ":operator-type/binary",
402
- isNegative: false,
403
- };
404
- const getOperatorCollectionMe = ({ id, title, pattern, isNegative, }) => ({
405
- id,
406
- title,
407
- customMatch: (where, params, typeObject) => {
408
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, pattern, typeObject);
409
- if (matchSuccess) {
410
- return {
411
- matchSuccess,
412
- expression: [...matches[0].value, "fibery/id"],
413
- };
414
- }
415
- return { matchSuccess: false };
416
- },
417
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
418
- return (0, pattern_to_expression_1.convertToExpression)(pattern, (0, exports.withoutLastIdAccess)(expression), "$my-id", getNextParamName);
419
- },
420
- type: ":operator-type/unary",
421
- isNegative,
422
- });
423
- exports.operatorCollectionContainsMe = getOperatorCollectionMe({
424
- id: ":operator/collection-contains-me",
425
- title: "contains Me",
426
- pattern: collectionContainsMePattern,
427
- isNegative: false,
428
- });
429
- const withoutLastIdAccess = (expression) => {
430
- const arr = expression;
431
- if ((0, last_1.default)(arr) !== "fibery/id") {
432
- throw new Error("not supported");
433
- }
434
- return arr.slice(0, -1);
435
- };
436
- exports.withoutLastIdAccess = withoutLastIdAccess;
437
- exports.operatorCollectionContainsAnyOf = {
438
- id: ":operator/collection-contains-any-of",
439
- title: "contains any of",
440
- customMatch: (where, params, typeObject) => {
441
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionContainsAnyOfPattern, typeObject);
442
- if (matchSuccess) {
443
- return {
444
- matchSuccess,
445
- expression: [...matches[0].value, "fibery/id"],
446
- value: matches[1].value,
447
- };
448
- }
449
- return { matchSuccess: false };
450
- },
451
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
452
- return (0, pattern_to_expression_1.convertToExpression)(collectionContainsAnyOfPattern, (0, exports.withoutLastIdAccess)(expression), value, getNextParamName);
453
- },
454
- type: ":operator-type/binary",
455
- isNegative: false,
456
- };
457
- exports.operatorCollectionDoesNotContain = {
458
- id: ":operator/collection-does-not-contain",
459
- title: "does not contain",
460
- customMatch: (where, params, typeObject) => {
461
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionDoesNotContainPattern, typeObject);
462
- if (matchSuccess) {
463
- return {
464
- matchSuccess,
465
- expression: [...matches[0].value, "fibery/id"],
466
- value: matches[1].value,
467
- };
468
- }
469
- return { matchSuccess: false };
470
- },
471
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
472
- return (0, pattern_to_expression_1.convertToExpression)(collectionDoesNotContainPattern, (0, exports.withoutLastIdAccess)(expression), value, getNextParamName);
473
- },
474
- type: ":operator-type/binary",
475
- isNegative: true,
476
- };
477
- exports.operatorCollectionDoesNotContainMe = getOperatorCollectionMe({
478
- id: ":operator/collection-does-not-contain-me",
479
- title: "does not contain Me",
480
- pattern: collectionDoesNotContainMePattern,
481
- isNegative: true,
482
- });
483
- exports.operatorCollectionDoesNotContainAnyOf = {
484
- id: ":operator/collection-does-not-contain-any-of",
485
- title: "contains none of",
486
- customMatch: (where, params, typeObject) => {
487
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionDoesNotContainAnyOfPattern, typeObject);
488
- if (matchSuccess) {
489
- return {
490
- matchSuccess,
491
- expression: [...matches[0].value, "fibery/id"],
492
- value: matches[1].value,
493
- };
494
- }
495
- return { matchSuccess: false };
496
- },
497
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
498
- return (0, pattern_to_expression_1.convertToExpression)(collectionDoesNotContainAnyOfPattern, (0, exports.withoutLastIdAccess)(expression), value, getNextParamName);
499
- },
500
- type: ":operator-type/binary",
501
- isNegative: true,
502
- };
503
- exports.operatorCollectionIsEmpty = {
504
- id: ":operator/is-collection-empty",
505
- title: "is empty",
506
- pattern: ["=", ["q/count", pattern_match_placeholders_1.referenceCollectionExpressionPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(0)],
507
- type: ":operator-type/unary",
508
- isNegative: false,
509
- };
510
- exports.operatorCollectionIsNotEmpty = {
511
- id: ":operator/is-collection-not-empty",
512
- title: "is not empty",
513
- pattern: [">", ["q/count", pattern_match_placeholders_1.referenceCollectionExpressionPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(0)],
514
- type: ":operator-type/unary",
515
- isNegative: true,
516
- };
517
- exports.operatorBoolIs = {
518
- id: ":operator/bool-is",
519
- title: "is",
520
- customMatch: (where, params, typeObject) => {
521
- {
522
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, ["=", pattern_match_placeholders_1.boolFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x === true || x === false)], typeObject);
523
- if (matchSuccess) {
524
- return {
525
- matchSuccess,
526
- expression: matches[0].value,
527
- value: matches[1].value,
528
- };
529
- }
530
- }
531
- {
532
- // This is old expression version, just for backward compatibility.
533
- const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, [
534
- "or",
535
- ["=", pattern_match_placeholders_1.boolFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x === false)],
536
- ["=", pattern_match_placeholders_1.boolFieldPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x === null)],
537
- ], typeObject);
538
- if (matchSuccess) {
539
- return {
540
- matchSuccess,
541
- expression: matches[0].value,
542
- value: false,
543
- };
544
- }
545
- return { matchSuccess: false };
546
- }
547
- },
548
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
549
- const paramName = getNextParamName();
550
- return {
551
- expression: ["=", expression, paramName],
552
- params: { [paramName]: value || false },
553
- };
554
- },
555
- type: ":operator-type/binary",
556
- isNegative: false,
557
- };
558
- exports.operatorDateIs = {
559
- id: ":operator/date-is",
560
- title: "is",
561
- pattern: ["=", pattern_match_placeholders_1.dateOrDateRangeExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => x !== null)],
562
- type: ":operator-type/binary",
563
- isNegative: false,
564
- };
565
- exports.operatorDateIsEmptyV1 = {
566
- id: ":operator/date-is-empty",
567
- title: "is empty",
568
- pattern: ["=", pattern_match_placeholders_1.anyDateExpressionPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
569
- type: ":operator-type/unary",
570
- isNegative: false,
571
- };
572
- exports.operatorDateIsEmptyV2 = {
573
- id: ":operator/date-is-empty",
574
- title: "is empty",
575
- pattern: ["=", ["q/null?", pattern_match_placeholders_1.anyDateExpressionPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(true)],
576
- type: ":operator-type/unary",
577
- isNegative: false,
578
- };
579
- exports.operatorDateIsNotEmptyV1 = {
580
- id: ":operator/date-is-not-empty",
581
- title: "is not empty",
582
- pattern: ["!=", pattern_match_placeholders_1.anyDateExpressionPlaceholder, (0, pattern_match_placeholders_1.getConstantPlaceholder)(null)],
583
- type: ":operator-type/unary",
584
- isNegative: true,
585
- };
586
- exports.operatorDateIsNotEmptyV2 = {
587
- id: ":operator/date-is-not-empty",
588
- title: "is not empty",
589
- pattern: ["=", ["q/null?", pattern_match_placeholders_1.anyDateExpressionPlaceholder], (0, pattern_match_placeholders_1.getConstantPlaceholder)(false)],
590
- type: ":operator-type/unary",
591
- isNegative: true,
592
- };
593
- exports.operatorDateIsWithin = {
594
- id: ":operator/date-is-within",
595
- title: "is within",
596
- customMatch: (0, operator_utils_1.getWithinOperatorCustomMatchFn)(pattern_match_placeholders_1.dateOrDateRangeExpressionPlaceholder, false),
597
- customConvertToWhereExpression: (0, operator_utils_1.getWithinOperatorCustomConvertFn)(false),
598
- type: ":operator-type/binary",
599
- isNegative: false,
600
- };
601
- exports.operatorDateIsBefore = {
602
- id: ":operator/date-is-before",
603
- title: "is earlier than",
604
- pattern: ["<", pattern_match_placeholders_1.dateOrDateRangeExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
605
- type: ":operator-type/binary",
606
- isNegative: false,
607
- };
608
- exports.operatorDateIsOnOrBefore = {
609
- id: ":operator/date-is-on-or-before",
610
- title: "is on or earlier than",
611
- pattern: ["<=", pattern_match_placeholders_1.dateOrDateRangeExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
612
- type: ":operator-type/binary",
613
- isNegative: false,
614
- };
615
- exports.operatorDateIsAfter = {
616
- id: ":operator/date-is-after",
617
- title: "is later than",
618
- pattern: [">", pattern_match_placeholders_1.dateOrDateRangeExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
619
- type: ":operator-type/binary",
620
- isNegative: false,
621
- };
622
- exports.operatorDateIsOnOrAfter = {
623
- id: ":operator/date-is-on-or-after",
624
- title: "is on or later than",
625
- pattern: [">=", pattern_match_placeholders_1.dateOrDateRangeExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
626
- type: ":operator-type/binary",
627
- isNegative: false,
628
- };
629
- exports.operatorDateTimeIs = {
630
- id: ":operator/date-time-is",
631
- title: "is",
632
- customMatch: (where, params, typeObject) => {
633
- {
634
- const { matchSuccess, matches: [firstFieldMatch, firstParamMatch, secondFieldMatch, secondParamMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, [
635
- "and",
636
- [">=", pattern_match_placeholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
637
- ["<=", pattern_match_placeholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, pattern_match_placeholders_1.getParamPlaceholder)()],
638
- ], typeObject);
639
- if (matchSuccess && (0, isEqual_1.default)(firstFieldMatch.value, secondFieldMatch.value)) {
640
- const firstParamValue = firstParamMatch.value;
641
- const secondParamValue = secondParamMatch.value;
642
- if (params_placeholders_1.paramsPlaceholdersLookup[firstParamValue] && params_placeholders_1.paramsPlaceholdersLookup[secondParamValue]) {
643
- const value = (0, findKey_1.default)(params_placeholders_1.dateToDateTimeIntervalLookup, (val) => val.start === firstParamValue && val.end === secondParamValue);
644
- return {
645
- matchSuccess,
646
- expression: firstFieldMatch.value,
647
- value,
648
- };
649
- }
650
- const firstParamRelativeDateInfo = (0, params_placeholders_1.parseRelativeDatePlaceholder)(firstParamValue);
651
- const secondParamRelativeDateInfo = (0, params_placeholders_1.parseRelativeDatePlaceholder)(secondParamValue);
652
- if (firstParamRelativeDateInfo && secondParamRelativeDateInfo) {
653
- const value = (0, params_placeholders_1.toRelativeDatePlaceholder)({
654
- ...firstParamRelativeDateInfo,
655
- isStartOfInterval: undefined,
656
- });
657
- return {
658
- matchSuccess,
659
- expression: firstFieldMatch.value,
660
- value,
661
- };
662
- }
663
- }
664
- }
665
- {
666
- const { matchSuccess, matches: [fieldMatch, paramMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, [
667
- "=",
668
- pattern_match_placeholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder,
669
- (0, pattern_match_placeholders_1.getParamPlaceholder)((x) => ((0, isString_1.default)(x) && (0, operator_utils_1.isDateTime)(x)) || (0, operator_utils_1.isNoValue)(x)),
670
- ], typeObject);
671
- if (matchSuccess) {
672
- return {
673
- matchSuccess,
674
- expression: fieldMatch.value,
675
- value: paramMatch.value,
676
- };
677
- }
678
- }
679
- return { matchSuccess: false };
680
- },
681
- customConvertToWhereExpression: (expression, value, getNextParamName) => {
682
- const dateTimePlaceholders = params_placeholders_1.dateToDateTimeIntervalLookup[value];
683
- let relativeDateInfo = null;
684
- if (dateTimePlaceholders) {
685
- const { start, end } = dateTimePlaceholders;
686
- return {
687
- expression: ["and", [">=", expression, start], ["<=", expression, end]],
688
- params: { [start]: start, [end]: end },
689
- };
690
- }
691
- else if ((relativeDateInfo = (0, params_placeholders_1.parseRelativeDatePlaceholder)(value))) {
692
- const startRelativePlaceholder = (0, params_placeholders_1.toRelativeDatePlaceholder)({
693
- ...relativeDateInfo,
694
- isStartOfInterval: true,
695
- unitForStart: "day",
696
- });
697
- const endRelativePlaceholder = (0, params_placeholders_1.toRelativeDatePlaceholder)({
698
- ...relativeDateInfo,
699
- isStartOfInterval: false,
700
- unitForStart: "day",
701
- });
702
- return {
703
- expression: ["and", [">=", expression, startRelativePlaceholder], ["<=", expression, endRelativePlaceholder]],
704
- params: {
705
- [startRelativePlaceholder]: startRelativePlaceholder,
706
- [endRelativePlaceholder]: endRelativePlaceholder,
707
- },
708
- };
709
- }
710
- else {
711
- const dateParamName = getNextParamName();
712
- return {
713
- expression: ["=", expression, dateParamName],
714
- params: { [dateParamName]: value },
715
- };
716
- }
717
- },
718
- type: ":operator-type/binary",
719
- isNegative: false,
720
- };
721
- exports.operatorDateTimeIsWithin = {
722
- id: ":operator/date-time-is-within",
723
- title: "is within",
724
- customMatch: (0, operator_utils_1.getWithinOperatorCustomMatchFn)(pattern_match_placeholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, true),
725
- customConvertToWhereExpression: (0, operator_utils_1.getWithinOperatorCustomConvertFn)(true),
726
- type: ":operator-type/binary",
727
- isNegative: false,
728
- };
729
- exports.operatorDateTimeIsBefore = (0, operator_utils_1.getCompareOperatorForDateTime)(":operator/date-time-is-before", "is earlier than", "<", true, false);
730
- exports.operatorDateTimeIsAfter = (0, operator_utils_1.getCompareOperatorForDateTime)(":operator/date-time-is-after", "is later than", ">", false, false);
731
- exports.operatorDateTimeIsOnOrBefore = (0, operator_utils_1.getCompareOperatorForDateTime)(":operator/date-time-is-on-or-before", "is on or earlier than", "<=", false, false);
732
- exports.operatorDateTimeIsOnOrAfter = (0, operator_utils_1.getCompareOperatorForDateTime)(":operator/date-time-is-on-or-after", "is on or later than", ">=", true, false);
733
- exports.operatorsGroupsWithoutMe = {
734
- ":filter-type/comment-reference-collection": [exports.operatorCollectionIsEmpty, exports.operatorCollectionIsNotEmpty],
735
- ":filter-type/file-reference": [exports.operatorReferenceIsEmpty, exports.operatorReferenceIsNotEmpty],
736
- ":filter-type/file-reference-collection": [exports.operatorCollectionIsEmpty, exports.operatorCollectionIsNotEmpty],
737
- ":filter-type/reference": [
738
- exports.operatorReferenceIsAnyOf,
739
- exports.operatorReferenceIsNoneOf,
740
- exports.operatorReferenceIs,
741
- exports.operatorReferenceIsNot,
742
- exports.operatorReferenceIsEmpty,
743
- exports.operatorReferenceIsNotEmpty,
744
- ],
745
- ":filter-type/user-reference": [
746
- exports.operatorReferenceIsAnyOf,
747
- exports.operatorReferenceIsNoneOf,
748
- exports.operatorReferenceIs,
749
- exports.operatorReferenceIsNot,
750
- exports.operatorReferenceIsEmpty,
751
- exports.operatorReferenceIsNotEmpty,
752
- ],
753
- ":filter-type/single-select": [
754
- exports.operatorReferenceIsAnyOf,
755
- exports.operatorReferenceIsNoneOf,
756
- exports.operatorReferenceIs,
757
- exports.operatorReferenceIsNot,
758
- exports.operatorReferenceIsEmpty,
759
- exports.operatorReferenceIsNotEmpty,
760
- ],
761
- ":filter-type/multi-select": [
762
- exports.operatorCollectionContainsAnyOf,
763
- exports.operatorCollectionDoesNotContainAnyOf,
764
- exports.operatorCollectionContains,
765
- exports.operatorCollectionDoesNotContain,
766
- exports.operatorCollectionIsEmpty,
767
- exports.operatorCollectionIsNotEmpty,
768
- ],
769
- ":filter-type/reference-collection": [
770
- exports.operatorCollectionContainsAnyOf,
771
- exports.operatorCollectionDoesNotContainAnyOf,
772
- exports.operatorCollectionContains,
773
- exports.operatorCollectionDoesNotContain,
774
- exports.operatorCollectionIsEmpty,
775
- exports.operatorCollectionIsNotEmpty,
776
- ],
777
- ":filter-type/user-reference-collection": [
778
- exports.operatorCollectionContainsAnyOf,
779
- exports.operatorCollectionDoesNotContainAnyOf,
780
- exports.operatorCollectionContains,
781
- exports.operatorCollectionDoesNotContain,
782
- exports.operatorCollectionIsEmpty,
783
- exports.operatorCollectionIsNotEmpty,
784
- ],
785
- ":filter-type/text": [
786
- exports.operatorTextContains,
787
- exports.operatorTextDoesNotContain,
788
- exports.operatorTextIs,
789
- exports.operatorTextIsNot,
790
- exports.operatorTextStartsWith,
791
- exports.operatorTextEndsWith,
792
- exports.operatorTextIsEmptyV2,
793
- exports.operatorTextIsNotEmptyV2,
794
- ],
795
- ":filter-type/number": [
796
- exports.operatorNumberEquals,
797
- exports.operatorNumberDoesNotEqual,
798
- exports.operatorGreaterThan,
799
- exports.operatorLessThan,
800
- exports.operatorGreaterThanOrEqual,
801
- exports.operatorLessThanOrEqual,
802
- exports.operatorNumberIsEmptyV2,
803
- exports.operatorNumberIsNotEmptyV2,
804
- ],
805
- ":filter-type/bool": [exports.operatorBoolIs],
806
- ":filter-type/date": [
807
- exports.operatorDateIs,
808
- exports.operatorDateIsWithin,
809
- exports.operatorDateIsBefore,
810
- exports.operatorDateIsAfter,
811
- exports.operatorDateIsOnOrBefore,
812
- exports.operatorDateIsOnOrAfter,
813
- exports.operatorDateIsEmptyV2,
814
- exports.operatorDateIsNotEmptyV2,
815
- ],
816
- ":filter-type/date-time": [
817
- exports.operatorDateTimeIs,
818
- exports.operatorDateTimeIsWithin,
819
- exports.operatorDateTimeIsBefore,
820
- exports.operatorDateTimeIsAfter,
821
- exports.operatorDateTimeIsOnOrBefore,
822
- exports.operatorDateTimeIsOnOrAfter,
823
- exports.operatorDateIsEmptyV2,
824
- exports.operatorDateIsNotEmptyV2,
825
- ],
826
- ":filter-type/location": [
827
- exports.operatorLocationContains,
828
- exports.operatorLocationDoesNotContain,
829
- exports.operatorLocationIsEmpty,
830
- exports.operatorLocationIsNotEmpty,
831
- ],
832
- ":filter-type/user-role": [exports.operatorUserRoleIsAnyOf],
833
- ":filter-type/collection-count": [
834
- exports.operatorCollectionCountEquals,
835
- exports.operatorCollectionCountDoesNotEqual,
836
- exports.operatorCollectionCountGreaterThan,
837
- exports.operatorCollectionCountLessThan,
838
- exports.operatorCollectionCountGreaterThanOrEqual,
839
- exports.operatorCollectionCountLessThanOrEqual,
840
- ],
841
- };
842
- exports.operatorsGroups = (0, _1.mapValues)(exports.operatorsGroupsWithoutMe, (value, key) => {
843
- if (key === ":filter-type/user-reference") {
844
- return [exports.operatorReferenceIsMe, exports.operatorReferenceIsNotMe].concat(value);
845
- }
846
- else if (key === ":filter-type/user-reference-collection") {
847
- return [exports.operatorCollectionContainsMe, exports.operatorCollectionDoesNotContainMe].concat(value);
848
- }
849
- else {
850
- return value;
851
- }
852
- });
853
- exports.operators = (0, uniq_1.default)((0, flatten_1.default)(Object.values(exports.operatorsGroups))).concat([
854
- // these operators are used only for backward compatibility. You can't select them on UI.
855
- // https://the.fibery.io/SoftDev/User~Story/Empty-operator-in-Filters-on-view-should-work-the-same-way-as-IsEmpty-in-formulas-1972
856
- exports.operatorTextIsEmptyV1,
857
- exports.operatorTextIsNotEmptyV1,
858
- exports.operatorDateIsEmptyV1,
859
- exports.operatorDateIsNotEmptyV1,
860
- exports.operatorNumberIsEmptyV1,
861
- exports.operatorNumberIsNotEmptyV1,
862
- // needed for unique value deduplication view
863
- // https://the.fibery.io/favorites/Product_Management/feature/6495
864
- exports.operatorTextExactlyIs,
865
- ]);
866
- exports.hiddenValidOperators = [exports.operatorTextExactlyIs];
867
- //# sourceMappingURL=operators.js.map