@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
@@ -0,0 +1,1151 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { doPatternMatch } from "./pattern-match.js";
3
+ import { dateToDateTimeIntervalLookup, isDynamicFilterParam, paramsPlaceholdersLookup, parseRelativeDatePlaceholder, toRelativeDatePlaceholder } from "../params-placeholders.js";
4
+ import { anyDateExpressionPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, textFieldPlaceholder } from "./pattern-match-placeholders.js";
5
+ import { getCompareOperatorForDateTime, getWithinOperatorCustomConvertFn, getWithinOperatorCustomMatchFn, isDateTime, isNoValue } from "./operator-utils.js";
6
+ import { convertToExpression } from "./pattern-to-expression.js";
7
+ import flatten from "lodash/flatten.js";
8
+ import { mapValues } from "@fibery/helpers/src/_";
9
+ import isString from "lodash/isString.js";
10
+ import last from "lodash/last.js";
11
+ import { validate } from "uuid";
12
+ import findKey from "lodash/findKey.js";
13
+ import isEqual from "lodash/isEqual.js";
14
+ import uniq from "lodash/uniq.js";
15
+ //#region src/filter-expression/operators.ts
16
+ var operators_exports = /* @__PURE__ */ __exportAll({
17
+ hiddenValidOperators: () => hiddenValidOperators,
18
+ operatorBoolIs: () => operatorBoolIs,
19
+ operatorCollectionContains: () => operatorCollectionContains,
20
+ operatorCollectionContainsAnyOf: () => operatorCollectionContainsAnyOf,
21
+ operatorCollectionContainsMe: () => operatorCollectionContainsMe,
22
+ operatorCollectionCountDoesNotEqual: () => operatorCollectionCountDoesNotEqual,
23
+ operatorCollectionCountEquals: () => operatorCollectionCountEquals,
24
+ operatorCollectionCountGreaterThan: () => operatorCollectionCountGreaterThan,
25
+ operatorCollectionCountGreaterThanOrEqual: () => operatorCollectionCountGreaterThanOrEqual,
26
+ operatorCollectionCountLessThan: () => operatorCollectionCountLessThan,
27
+ operatorCollectionCountLessThanOrEqual: () => operatorCollectionCountLessThanOrEqual,
28
+ operatorCollectionDoesNotContain: () => operatorCollectionDoesNotContain,
29
+ operatorCollectionDoesNotContainAnyOf: () => operatorCollectionDoesNotContainAnyOf,
30
+ operatorCollectionDoesNotContainMe: () => operatorCollectionDoesNotContainMe,
31
+ operatorCollectionIsEmpty: () => operatorCollectionIsEmpty,
32
+ operatorCollectionIsNotEmpty: () => operatorCollectionIsNotEmpty,
33
+ operatorDateIs: () => operatorDateIs,
34
+ operatorDateIsAfter: () => operatorDateIsAfter,
35
+ operatorDateIsBefore: () => operatorDateIsBefore,
36
+ operatorDateIsEmptyV1: () => operatorDateIsEmptyV1,
37
+ operatorDateIsEmptyV2: () => operatorDateIsEmptyV2,
38
+ operatorDateIsNotEmptyV1: () => operatorDateIsNotEmptyV1,
39
+ operatorDateIsNotEmptyV2: () => operatorDateIsNotEmptyV2,
40
+ operatorDateIsOnOrAfter: () => operatorDateIsOnOrAfter,
41
+ operatorDateIsOnOrBefore: () => operatorDateIsOnOrBefore,
42
+ operatorDateIsWithin: () => operatorDateIsWithin,
43
+ operatorDateTimeIs: () => operatorDateTimeIs,
44
+ operatorDateTimeIsAfter: () => operatorDateTimeIsAfter,
45
+ operatorDateTimeIsBefore: () => operatorDateTimeIsBefore,
46
+ operatorDateTimeIsOnOrAfter: () => operatorDateTimeIsOnOrAfter,
47
+ operatorDateTimeIsOnOrBefore: () => operatorDateTimeIsOnOrBefore,
48
+ operatorDateTimeIsWithin: () => operatorDateTimeIsWithin,
49
+ operatorGreaterThan: () => operatorGreaterThan,
50
+ operatorGreaterThanOrEqual: () => operatorGreaterThanOrEqual,
51
+ operatorLessThan: () => operatorLessThan,
52
+ operatorLessThanOrEqual: () => operatorLessThanOrEqual,
53
+ operatorLocationContains: () => operatorLocationContains,
54
+ operatorLocationDoesNotContain: () => operatorLocationDoesNotContain,
55
+ operatorLocationIsEmpty: () => operatorLocationIsEmpty,
56
+ operatorLocationIsNotEmpty: () => operatorLocationIsNotEmpty,
57
+ operatorNumberDoesNotEqual: () => operatorNumberDoesNotEqual,
58
+ operatorNumberEquals: () => operatorNumberEquals,
59
+ operatorNumberIsEmptyV1: () => operatorNumberIsEmptyV1,
60
+ operatorNumberIsEmptyV2: () => operatorNumberIsEmptyV2,
61
+ operatorNumberIsNotEmptyV1: () => operatorNumberIsNotEmptyV1,
62
+ operatorNumberIsNotEmptyV2: () => operatorNumberIsNotEmptyV2,
63
+ operatorReferenceIs: () => operatorReferenceIs,
64
+ operatorReferenceIsAnyOf: () => operatorReferenceIsAnyOf,
65
+ operatorReferenceIsEmpty: () => operatorReferenceIsEmpty,
66
+ operatorReferenceIsMe: () => operatorReferenceIsMe,
67
+ operatorReferenceIsNoneOf: () => operatorReferenceIsNoneOf,
68
+ operatorReferenceIsNot: () => operatorReferenceIsNot,
69
+ operatorReferenceIsNotEmpty: () => operatorReferenceIsNotEmpty,
70
+ operatorReferenceIsNotMe: () => operatorReferenceIsNotMe,
71
+ operatorTextContains: () => operatorTextContains,
72
+ operatorTextDoesNotContain: () => operatorTextDoesNotContain,
73
+ operatorTextEndsWith: () => operatorTextEndsWith,
74
+ operatorTextExactlyIs: () => operatorTextExactlyIs,
75
+ operatorTextIs: () => operatorTextIs,
76
+ operatorTextIsEmptyV1: () => operatorTextIsEmptyV1,
77
+ operatorTextIsEmptyV2: () => operatorTextIsEmptyV2,
78
+ operatorTextIsNot: () => operatorTextIsNot,
79
+ operatorTextIsNotEmptyV1: () => operatorTextIsNotEmptyV1,
80
+ operatorTextIsNotEmptyV2: () => operatorTextIsNotEmptyV2,
81
+ operatorTextStartsWith: () => operatorTextStartsWith,
82
+ operatorUserRoleIsAnyOf: () => operatorUserRoleIsAnyOf,
83
+ operators: () => operators,
84
+ operatorsGroups: () => operatorsGroups,
85
+ operatorsGroupsWithoutMe: () => operatorsGroupsWithoutMe,
86
+ withoutLastIdAccess: () => withoutLastIdAccess
87
+ });
88
+ const referenceIsMePattern = [
89
+ "=",
90
+ referenceExpressionPlaceholder,
91
+ getParamPlaceholder((x) => x === "$my-id")
92
+ ];
93
+ const referenceIsNotMePattern = [
94
+ "!=",
95
+ referenceExpressionPlaceholder,
96
+ getParamPlaceholder((x) => x === "$my-id")
97
+ ];
98
+ const getReferenceMeOperator = ({ id, title, pattern, isNegative }) => {
99
+ return {
100
+ type: ":operator-type/unary",
101
+ id,
102
+ title,
103
+ customMatch: (where, params, typeObject) => {
104
+ const { matchSuccess, matches } = doPatternMatch(where, params, pattern, typeObject);
105
+ if (matchSuccess) return {
106
+ matchSuccess,
107
+ expression: matches[0].value
108
+ };
109
+ return { matchSuccess: false };
110
+ },
111
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
112
+ return convertToExpression(pattern, expression, "$my-id", getNextParamName);
113
+ },
114
+ isNegative
115
+ };
116
+ };
117
+ const operatorReferenceIsMe = getReferenceMeOperator({
118
+ id: ":operator/reference-is-me",
119
+ title: "is Me",
120
+ pattern: referenceIsMePattern,
121
+ isNegative: false
122
+ });
123
+ const operatorReferenceIsNotMe = getReferenceMeOperator({
124
+ id: ":operator/reference-is-not-me",
125
+ title: "is not Me",
126
+ pattern: referenceIsNotMePattern,
127
+ isNegative: true
128
+ });
129
+ function isValidReferenceUUID(val) {
130
+ return validate(val) || isString(val) && isDynamicFilterParam(val);
131
+ }
132
+ const operatorReferenceIs = {
133
+ id: ":operator/reference-is",
134
+ title: "is",
135
+ pattern: [
136
+ "=",
137
+ referenceExpressionPlaceholder,
138
+ getParamPlaceholder((val) => isValidReferenceUUID(val) || isNoValue(val))
139
+ ],
140
+ type: ":operator-type/binary",
141
+ isNegative: false
142
+ };
143
+ const operatorReferenceIsAnyOf = {
144
+ id: ":operator/reference-is-any-of",
145
+ title: "is any of",
146
+ pattern: [
147
+ "q/in",
148
+ referenceExpressionPlaceholder,
149
+ getParamPlaceholder((val) => val !== null)
150
+ ],
151
+ type: ":operator-type/binary",
152
+ isNegative: false
153
+ };
154
+ const operatorReferenceIsNot = {
155
+ id: ":operator/reference-is-not",
156
+ title: "is not",
157
+ pattern: [
158
+ "!=",
159
+ referenceExpressionPlaceholder,
160
+ getParamPlaceholder((val) => isValidReferenceUUID(val) || isNoValue(val))
161
+ ],
162
+ type: ":operator-type/binary",
163
+ isNegative: true
164
+ };
165
+ const operatorReferenceIsNoneOf = {
166
+ id: ":operator/reference-is-none-of",
167
+ title: "is none of",
168
+ pattern: [
169
+ "q/not-in",
170
+ referenceExpressionPlaceholder,
171
+ getParamPlaceholder((val) => val !== null)
172
+ ],
173
+ type: ":operator-type/binary",
174
+ isNegative: true
175
+ };
176
+ const operatorReferenceIsEmpty = {
177
+ id: ":operator/reference-is-empty",
178
+ title: "is empty",
179
+ pattern: [
180
+ "=",
181
+ referenceExpressionPlaceholder,
182
+ getConstantPlaceholder(null)
183
+ ],
184
+ type: ":operator-type/unary",
185
+ isNegative: false
186
+ };
187
+ const operatorReferenceIsNotEmpty = {
188
+ id: ":operator/reference-is-not-empty",
189
+ title: "is not empty",
190
+ pattern: [
191
+ "!=",
192
+ referenceExpressionPlaceholder,
193
+ getConstantPlaceholder(null)
194
+ ],
195
+ type: ":operator-type/unary",
196
+ isNegative: true
197
+ };
198
+ const operatorUserRoleIsAnyOf = {
199
+ id: ":operator/user-role-is-any-of",
200
+ title: "is any of",
201
+ pattern: [
202
+ "q/in",
203
+ textFieldPlaceholder,
204
+ getParamPlaceholder((x) => Array.isArray(x) && x.every((item) => isString(item)) || isNoValue(x))
205
+ ],
206
+ type: ":operator-type/binary",
207
+ isNegative: false
208
+ };
209
+ const operatorTextIs = {
210
+ id: ":operator/string-equals",
211
+ title: "is",
212
+ pattern: [
213
+ "q/equals-ignoring-case?",
214
+ textFieldPlaceholder,
215
+ getParamPlaceholder()
216
+ ],
217
+ type: ":operator-type/binary",
218
+ isNegative: false
219
+ };
220
+ const operatorTextExactlyIs = {
221
+ id: ":operator/string-equals-exact",
222
+ title: "=",
223
+ pattern: [
224
+ "=",
225
+ textFieldPlaceholder,
226
+ getParamPlaceholder()
227
+ ],
228
+ type: ":operator-type/binary",
229
+ isNegative: false
230
+ };
231
+ const operatorTextIsNot = {
232
+ id: ":operator/string-not-equals",
233
+ title: "is not",
234
+ pattern: [
235
+ "q/not-equals-ignoring-case?",
236
+ textFieldPlaceholder,
237
+ getParamPlaceholder()
238
+ ],
239
+ type: ":operator-type/binary",
240
+ isNegative: true
241
+ };
242
+ const operatorTextContains = {
243
+ id: ":operator/string-contains",
244
+ title: "contains",
245
+ pattern: [
246
+ "q/contains",
247
+ textFieldPlaceholder,
248
+ getParamPlaceholder()
249
+ ],
250
+ type: ":operator-type/binary",
251
+ isNegative: false
252
+ };
253
+ const operatorTextDoesNotContain = {
254
+ id: ":operator/string-does-not-contain",
255
+ title: "does not contain",
256
+ pattern: [
257
+ "q/not-contains",
258
+ textFieldPlaceholder,
259
+ getParamPlaceholder()
260
+ ],
261
+ type: ":operator-type/binary",
262
+ isNegative: true
263
+ };
264
+ const operatorTextStartsWith = {
265
+ id: ":operator/string-starts-with",
266
+ title: "starts with",
267
+ pattern: [
268
+ "q/starts-with-ignoring-case?",
269
+ textFieldPlaceholder,
270
+ getParamPlaceholder()
271
+ ],
272
+ type: ":operator-type/binary",
273
+ isNegative: false
274
+ };
275
+ const operatorTextEndsWith = {
276
+ id: ":operator/string-ends-with",
277
+ title: "ends with",
278
+ pattern: [
279
+ "q/ends-with-ignoring-case?",
280
+ textFieldPlaceholder,
281
+ getParamPlaceholder()
282
+ ],
283
+ type: ":operator-type/binary",
284
+ isNegative: false
285
+ };
286
+ const operatorNumberEquals = {
287
+ id: ":operator/equals",
288
+ title: "=",
289
+ pattern: [
290
+ "=",
291
+ numberFieldPlaceholder,
292
+ getParamPlaceholder((x) => x !== null)
293
+ ],
294
+ type: ":operator-type/binary",
295
+ isNegative: false
296
+ };
297
+ const operatorNumberDoesNotEqual = {
298
+ id: ":operator/does-not-equal",
299
+ title: "≠",
300
+ pattern: [
301
+ "!=",
302
+ numberFieldPlaceholder,
303
+ getParamPlaceholder((x) => x !== null)
304
+ ],
305
+ type: ":operator-type/binary",
306
+ isNegative: true
307
+ };
308
+ const operatorGreaterThan = {
309
+ id: ":operator/greater-than",
310
+ title: ">",
311
+ pattern: [
312
+ ">",
313
+ numberFieldPlaceholder,
314
+ getParamPlaceholder()
315
+ ],
316
+ type: ":operator-type/binary",
317
+ isNegative: false
318
+ };
319
+ const operatorLessThan = {
320
+ id: ":operator/less-than",
321
+ title: "<",
322
+ pattern: [
323
+ "<",
324
+ numberFieldPlaceholder,
325
+ getParamPlaceholder()
326
+ ],
327
+ type: ":operator-type/binary",
328
+ isNegative: false
329
+ };
330
+ const operatorGreaterThanOrEqual = {
331
+ id: ":operator/greater-than-or-equal",
332
+ title: "≥",
333
+ pattern: [
334
+ ">=",
335
+ numberFieldPlaceholder,
336
+ getParamPlaceholder()
337
+ ],
338
+ type: ":operator-type/binary",
339
+ isNegative: false
340
+ };
341
+ const operatorLessThanOrEqual = {
342
+ id: ":operator/less-than-or-equal",
343
+ title: "≤",
344
+ pattern: [
345
+ "<=",
346
+ numberFieldPlaceholder,
347
+ getParamPlaceholder()
348
+ ],
349
+ type: ":operator-type/binary",
350
+ isNegative: false
351
+ };
352
+ const operatorCollectionCountEquals = {
353
+ id: ":operator/collection-count-equals",
354
+ title: "=",
355
+ pattern: [
356
+ "=",
357
+ collectionCountExpressionPlaceholder,
358
+ getParamPlaceholder((x) => x !== null)
359
+ ],
360
+ type: ":operator-type/binary",
361
+ isNegative: false
362
+ };
363
+ const operatorCollectionCountDoesNotEqual = {
364
+ id: ":operator/collection-count-does-not-equal",
365
+ title: "≠",
366
+ pattern: [
367
+ "!=",
368
+ collectionCountExpressionPlaceholder,
369
+ getParamPlaceholder((x) => x !== null)
370
+ ],
371
+ type: ":operator-type/binary",
372
+ isNegative: true
373
+ };
374
+ const operatorCollectionCountGreaterThan = {
375
+ id: ":operator/collection-count-greater-than",
376
+ title: ">",
377
+ pattern: [
378
+ ">",
379
+ collectionCountExpressionPlaceholder,
380
+ getParamPlaceholder()
381
+ ],
382
+ type: ":operator-type/binary",
383
+ isNegative: false
384
+ };
385
+ const operatorCollectionCountLessThan = {
386
+ id: ":operator/collection-count-less-than",
387
+ title: "<",
388
+ pattern: [
389
+ "<",
390
+ collectionCountExpressionPlaceholder,
391
+ getParamPlaceholder()
392
+ ],
393
+ type: ":operator-type/binary",
394
+ isNegative: false
395
+ };
396
+ const operatorCollectionCountGreaterThanOrEqual = {
397
+ id: ":operator/collection-count-greater-than-or-equal",
398
+ title: "≥",
399
+ pattern: [
400
+ ">=",
401
+ collectionCountExpressionPlaceholder,
402
+ getParamPlaceholder()
403
+ ],
404
+ type: ":operator-type/binary",
405
+ isNegative: false
406
+ };
407
+ const operatorCollectionCountLessThanOrEqual = {
408
+ id: ":operator/collection-count-less-than-or-equal",
409
+ title: "≤",
410
+ pattern: [
411
+ "<=",
412
+ collectionCountExpressionPlaceholder,
413
+ getParamPlaceholder()
414
+ ],
415
+ type: ":operator-type/binary",
416
+ isNegative: false
417
+ };
418
+ const operatorNumberIsEmptyV1 = {
419
+ id: ":operator/number-is-empty",
420
+ title: "is empty",
421
+ pattern: [
422
+ "=",
423
+ numberFieldPlaceholder,
424
+ getConstantPlaceholder(null)
425
+ ],
426
+ type: ":operator-type/unary",
427
+ isNegative: false
428
+ };
429
+ const operatorNumberIsEmptyV2 = {
430
+ id: ":operator/number-is-empty",
431
+ title: "is empty",
432
+ pattern: [
433
+ "=",
434
+ ["q/null?", numberFieldPlaceholder],
435
+ getConstantPlaceholder(true)
436
+ ],
437
+ type: ":operator-type/unary",
438
+ isNegative: false
439
+ };
440
+ const operatorNumberIsNotEmptyV1 = {
441
+ id: ":operator/number-is-not-empty",
442
+ title: "is not empty",
443
+ pattern: [
444
+ "!=",
445
+ numberFieldPlaceholder,
446
+ getConstantPlaceholder(null)
447
+ ],
448
+ type: ":operator-type/unary",
449
+ isNegative: true
450
+ };
451
+ const operatorNumberIsNotEmptyV2 = {
452
+ id: ":operator/number-is-not-empty",
453
+ title: "is not empty",
454
+ pattern: [
455
+ "=",
456
+ ["q/null?", numberFieldPlaceholder],
457
+ getConstantPlaceholder(false)
458
+ ],
459
+ type: ":operator-type/unary",
460
+ isNegative: true
461
+ };
462
+ const operatorTextIsEmptyV1 = {
463
+ id: ":operator/text-is-empty",
464
+ title: "is empty",
465
+ pattern: [
466
+ "=",
467
+ textFieldPlaceholder,
468
+ getConstantPlaceholder(null)
469
+ ],
470
+ type: ":operator-type/unary",
471
+ isNegative: false
472
+ };
473
+ const operatorTextIsEmptyV2 = {
474
+ id: ":operator/text-is-empty",
475
+ title: "is empty",
476
+ pattern: [
477
+ "=",
478
+ ["q/null-or-empty?", textFieldPlaceholder],
479
+ getConstantPlaceholder(true)
480
+ ],
481
+ type: ":operator-type/unary",
482
+ isNegative: false
483
+ };
484
+ const operatorTextIsNotEmptyV1 = {
485
+ id: ":operator/text-is-not-empty",
486
+ title: "is not empty",
487
+ pattern: [
488
+ "!=",
489
+ textFieldPlaceholder,
490
+ getConstantPlaceholder(null)
491
+ ],
492
+ type: ":operator-type/unary",
493
+ isNegative: true
494
+ };
495
+ const operatorTextIsNotEmptyV2 = {
496
+ id: ":operator/text-is-not-empty",
497
+ title: "is not empty",
498
+ pattern: [
499
+ "=",
500
+ ["q/null-or-empty?", textFieldPlaceholder],
501
+ getConstantPlaceholder(false)
502
+ ],
503
+ type: ":operator-type/unary",
504
+ isNegative: true
505
+ };
506
+ const operatorLocationContains = {
507
+ id: ":operator/location-contains",
508
+ title: "contains",
509
+ pattern: [
510
+ "q/contains",
511
+ ["q/address", locationFieldPlaceholder],
512
+ getParamPlaceholder()
513
+ ],
514
+ type: ":operator-type/binary",
515
+ isNegative: false
516
+ };
517
+ const operatorLocationDoesNotContain = {
518
+ id: ":operator/location-does-not-contain",
519
+ title: "does not contain",
520
+ pattern: [
521
+ "q/not-contains",
522
+ ["q/address", locationFieldPlaceholder],
523
+ getParamPlaceholder()
524
+ ],
525
+ type: ":operator-type/binary",
526
+ isNegative: true
527
+ };
528
+ const operatorLocationIsEmpty = {
529
+ id: ":operator/location-is-empty",
530
+ title: "is empty",
531
+ pattern: [
532
+ "=",
533
+ locationFieldPlaceholder,
534
+ getConstantPlaceholder(null)
535
+ ],
536
+ type: ":operator-type/unary",
537
+ isNegative: false
538
+ };
539
+ const operatorLocationIsNotEmpty = {
540
+ id: ":operator/location-is-not-empty",
541
+ title: "is not empty",
542
+ pattern: [
543
+ "!=",
544
+ locationFieldPlaceholder,
545
+ getConstantPlaceholder(null)
546
+ ],
547
+ type: ":operator-type/unary",
548
+ isNegative: true
549
+ };
550
+ const getCollectionContainsPattern = (paramMatchFn) => {
551
+ return [
552
+ ">",
553
+ {
554
+ "q/from": referenceCollectionFieldPlaceholder,
555
+ "q/select": ["q/count", ["fibery/id"]],
556
+ "q/where": [
557
+ "=",
558
+ ["fibery/id"],
559
+ getParamPlaceholder(paramMatchFn)
560
+ ],
561
+ "q/limit": "q/no-limit"
562
+ },
563
+ getConstantPlaceholder(0)
564
+ ];
565
+ };
566
+ const getCollectionContainsAnyOfPattern = (comparisonOperator) => [
567
+ comparisonOperator,
568
+ {
569
+ "q/from": referenceCollectionFieldPlaceholder,
570
+ "q/select": ["q/count", ["fibery/id"]],
571
+ "q/where": [
572
+ "q/in",
573
+ ["fibery/id"],
574
+ getParamPlaceholder((x) => Array.isArray(x) && x.every((item) => isValidReferenceUUID(item)) || isNoValue(x))
575
+ ],
576
+ "q/limit": "q/no-limit"
577
+ },
578
+ getConstantPlaceholder(0)
579
+ ];
580
+ const collectionContainsAnyOfPattern = getCollectionContainsAnyOfPattern(">");
581
+ const collectionDoesNotContainAnyOfPattern = getCollectionContainsAnyOfPattern("=");
582
+ const collectionContainsPattern = getCollectionContainsPattern((x) => isValidReferenceUUID(x) || isNoValue(x));
583
+ const collectionContainsMePattern = getCollectionContainsPattern((x) => x === "$my-id");
584
+ const getCollectionDoesNotContainPattern = (paramMatchFn) => [
585
+ "=",
586
+ {
587
+ "q/from": referenceCollectionFieldPlaceholder,
588
+ "q/select": ["q/count", ["fibery/id"]],
589
+ "q/where": [
590
+ "=",
591
+ ["fibery/id"],
592
+ getParamPlaceholder(paramMatchFn)
593
+ ],
594
+ "q/limit": "q/no-limit"
595
+ },
596
+ getConstantPlaceholder(0)
597
+ ];
598
+ const collectionDoesNotContainPattern = getCollectionDoesNotContainPattern((x) => isValidReferenceUUID(x) || isNoValue(x));
599
+ const collectionDoesNotContainMePattern = getCollectionDoesNotContainPattern((x) => x === "$my-id");
600
+ const operatorCollectionContains = {
601
+ id: ":operator/collection-contains",
602
+ title: "contains",
603
+ customMatch: (where, params, typeObject) => {
604
+ const { matchSuccess, matches } = doPatternMatch(where, params, collectionContainsPattern, typeObject);
605
+ if (matchSuccess) return {
606
+ matchSuccess,
607
+ expression: [...matches[0].value, "fibery/id"],
608
+ value: matches[1].value
609
+ };
610
+ return { matchSuccess: false };
611
+ },
612
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
613
+ return convertToExpression(collectionContainsPattern, withoutLastIdAccess(expression), value, getNextParamName);
614
+ },
615
+ type: ":operator-type/binary",
616
+ isNegative: false
617
+ };
618
+ const getOperatorCollectionMe = ({ id, title, pattern, isNegative }) => ({
619
+ id,
620
+ title,
621
+ customMatch: (where, params, typeObject) => {
622
+ const { matchSuccess, matches } = doPatternMatch(where, params, pattern, typeObject);
623
+ if (matchSuccess) return {
624
+ matchSuccess,
625
+ expression: [...matches[0].value, "fibery/id"]
626
+ };
627
+ return { matchSuccess: false };
628
+ },
629
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
630
+ return convertToExpression(pattern, withoutLastIdAccess(expression), "$my-id", getNextParamName);
631
+ },
632
+ type: ":operator-type/unary",
633
+ isNegative
634
+ });
635
+ const operatorCollectionContainsMe = getOperatorCollectionMe({
636
+ id: ":operator/collection-contains-me",
637
+ title: "contains Me",
638
+ pattern: collectionContainsMePattern,
639
+ isNegative: false
640
+ });
641
+ const withoutLastIdAccess = (expression) => {
642
+ const arr = expression;
643
+ if (last(arr) !== "fibery/id") throw new Error("not supported");
644
+ return arr.slice(0, -1);
645
+ };
646
+ const operatorCollectionContainsAnyOf = {
647
+ id: ":operator/collection-contains-any-of",
648
+ title: "contains any of",
649
+ customMatch: (where, params, typeObject) => {
650
+ const { matchSuccess, matches } = doPatternMatch(where, params, collectionContainsAnyOfPattern, typeObject);
651
+ if (matchSuccess) return {
652
+ matchSuccess,
653
+ expression: [...matches[0].value, "fibery/id"],
654
+ value: matches[1].value
655
+ };
656
+ return { matchSuccess: false };
657
+ },
658
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
659
+ return convertToExpression(collectionContainsAnyOfPattern, withoutLastIdAccess(expression), value, getNextParamName);
660
+ },
661
+ type: ":operator-type/binary",
662
+ isNegative: false
663
+ };
664
+ const operatorCollectionDoesNotContain = {
665
+ id: ":operator/collection-does-not-contain",
666
+ title: "does not contain",
667
+ customMatch: (where, params, typeObject) => {
668
+ const { matchSuccess, matches } = doPatternMatch(where, params, collectionDoesNotContainPattern, typeObject);
669
+ if (matchSuccess) return {
670
+ matchSuccess,
671
+ expression: [...matches[0].value, "fibery/id"],
672
+ value: matches[1].value
673
+ };
674
+ return { matchSuccess: false };
675
+ },
676
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
677
+ return convertToExpression(collectionDoesNotContainPattern, withoutLastIdAccess(expression), value, getNextParamName);
678
+ },
679
+ type: ":operator-type/binary",
680
+ isNegative: true
681
+ };
682
+ const operatorCollectionDoesNotContainMe = getOperatorCollectionMe({
683
+ id: ":operator/collection-does-not-contain-me",
684
+ title: "does not contain Me",
685
+ pattern: collectionDoesNotContainMePattern,
686
+ isNegative: true
687
+ });
688
+ const operatorCollectionDoesNotContainAnyOf = {
689
+ id: ":operator/collection-does-not-contain-any-of",
690
+ title: "contains none of",
691
+ customMatch: (where, params, typeObject) => {
692
+ const { matchSuccess, matches } = doPatternMatch(where, params, collectionDoesNotContainAnyOfPattern, typeObject);
693
+ if (matchSuccess) return {
694
+ matchSuccess,
695
+ expression: [...matches[0].value, "fibery/id"],
696
+ value: matches[1].value
697
+ };
698
+ return { matchSuccess: false };
699
+ },
700
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
701
+ return convertToExpression(collectionDoesNotContainAnyOfPattern, withoutLastIdAccess(expression), value, getNextParamName);
702
+ },
703
+ type: ":operator-type/binary",
704
+ isNegative: true
705
+ };
706
+ const operatorCollectionIsEmpty = {
707
+ id: ":operator/is-collection-empty",
708
+ title: "is empty",
709
+ pattern: [
710
+ "=",
711
+ ["q/count", referenceCollectionExpressionPlaceholder],
712
+ getConstantPlaceholder(0)
713
+ ],
714
+ type: ":operator-type/unary",
715
+ isNegative: false
716
+ };
717
+ const operatorCollectionIsNotEmpty = {
718
+ id: ":operator/is-collection-not-empty",
719
+ title: "is not empty",
720
+ pattern: [
721
+ ">",
722
+ ["q/count", referenceCollectionExpressionPlaceholder],
723
+ getConstantPlaceholder(0)
724
+ ],
725
+ type: ":operator-type/unary",
726
+ isNegative: true
727
+ };
728
+ const operatorBoolIs = {
729
+ id: ":operator/bool-is",
730
+ title: "is",
731
+ customMatch: (where, params, typeObject) => {
732
+ {
733
+ const { matchSuccess, matches } = doPatternMatch(where, params, [
734
+ "=",
735
+ boolFieldPlaceholder,
736
+ getParamPlaceholder((x) => x === true || x === false)
737
+ ], typeObject);
738
+ if (matchSuccess) return {
739
+ matchSuccess,
740
+ expression: matches[0].value,
741
+ value: matches[1].value
742
+ };
743
+ }
744
+ {
745
+ const { matchSuccess, matches } = doPatternMatch(where, params, [
746
+ "or",
747
+ [
748
+ "=",
749
+ boolFieldPlaceholder,
750
+ getParamPlaceholder((x) => x === false)
751
+ ],
752
+ [
753
+ "=",
754
+ boolFieldPlaceholder,
755
+ getParamPlaceholder((x) => x === null)
756
+ ]
757
+ ], typeObject);
758
+ if (matchSuccess) return {
759
+ matchSuccess,
760
+ expression: matches[0].value,
761
+ value: false
762
+ };
763
+ return { matchSuccess: false };
764
+ }
765
+ },
766
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
767
+ const paramName = getNextParamName();
768
+ return {
769
+ expression: [
770
+ "=",
771
+ expression,
772
+ paramName
773
+ ],
774
+ params: { [paramName]: value || false }
775
+ };
776
+ },
777
+ type: ":operator-type/binary",
778
+ isNegative: false
779
+ };
780
+ const operatorDateIs = {
781
+ id: ":operator/date-is",
782
+ title: "is",
783
+ pattern: [
784
+ "=",
785
+ dateOrDateRangeExpressionPlaceholder,
786
+ getParamPlaceholder((x) => x !== null)
787
+ ],
788
+ type: ":operator-type/binary",
789
+ isNegative: false
790
+ };
791
+ const operatorDateIsEmptyV1 = {
792
+ id: ":operator/date-is-empty",
793
+ title: "is empty",
794
+ pattern: [
795
+ "=",
796
+ anyDateExpressionPlaceholder,
797
+ getConstantPlaceholder(null)
798
+ ],
799
+ type: ":operator-type/unary",
800
+ isNegative: false
801
+ };
802
+ const operatorDateIsEmptyV2 = {
803
+ id: ":operator/date-is-empty",
804
+ title: "is empty",
805
+ pattern: [
806
+ "=",
807
+ ["q/null?", anyDateExpressionPlaceholder],
808
+ getConstantPlaceholder(true)
809
+ ],
810
+ type: ":operator-type/unary",
811
+ isNegative: false
812
+ };
813
+ const operatorDateIsNotEmptyV1 = {
814
+ id: ":operator/date-is-not-empty",
815
+ title: "is not empty",
816
+ pattern: [
817
+ "!=",
818
+ anyDateExpressionPlaceholder,
819
+ getConstantPlaceholder(null)
820
+ ],
821
+ type: ":operator-type/unary",
822
+ isNegative: true
823
+ };
824
+ const operatorDateIsNotEmptyV2 = {
825
+ id: ":operator/date-is-not-empty",
826
+ title: "is not empty",
827
+ pattern: [
828
+ "=",
829
+ ["q/null?", anyDateExpressionPlaceholder],
830
+ getConstantPlaceholder(false)
831
+ ],
832
+ type: ":operator-type/unary",
833
+ isNegative: true
834
+ };
835
+ const operatorDateIsWithin = {
836
+ id: ":operator/date-is-within",
837
+ title: "is within",
838
+ customMatch: getWithinOperatorCustomMatchFn(dateOrDateRangeExpressionPlaceholder, false),
839
+ customConvertToWhereExpression: getWithinOperatorCustomConvertFn(false),
840
+ type: ":operator-type/binary",
841
+ isNegative: false
842
+ };
843
+ const operatorDateIsBefore = {
844
+ id: ":operator/date-is-before",
845
+ title: "is earlier than",
846
+ pattern: [
847
+ "<",
848
+ dateOrDateRangeExpressionPlaceholder,
849
+ getParamPlaceholder()
850
+ ],
851
+ type: ":operator-type/binary",
852
+ isNegative: false
853
+ };
854
+ const operatorDateIsOnOrBefore = {
855
+ id: ":operator/date-is-on-or-before",
856
+ title: "is on or earlier than",
857
+ pattern: [
858
+ "<=",
859
+ dateOrDateRangeExpressionPlaceholder,
860
+ getParamPlaceholder()
861
+ ],
862
+ type: ":operator-type/binary",
863
+ isNegative: false
864
+ };
865
+ const operatorDateIsAfter = {
866
+ id: ":operator/date-is-after",
867
+ title: "is later than",
868
+ pattern: [
869
+ ">",
870
+ dateOrDateRangeExpressionPlaceholder,
871
+ getParamPlaceholder()
872
+ ],
873
+ type: ":operator-type/binary",
874
+ isNegative: false
875
+ };
876
+ const operatorDateIsOnOrAfter = {
877
+ id: ":operator/date-is-on-or-after",
878
+ title: "is on or later than",
879
+ pattern: [
880
+ ">=",
881
+ dateOrDateRangeExpressionPlaceholder,
882
+ getParamPlaceholder()
883
+ ],
884
+ type: ":operator-type/binary",
885
+ isNegative: false
886
+ };
887
+ const operatorDateTimeIs = {
888
+ id: ":operator/date-time-is",
889
+ title: "is",
890
+ customMatch: (where, params, typeObject) => {
891
+ {
892
+ const { matchSuccess, matches: [firstFieldMatch, firstParamMatch, secondFieldMatch, secondParamMatch] } = doPatternMatch(where, params, [
893
+ "and",
894
+ [
895
+ ">=",
896
+ dateTimeOrDateTimeRangeExpressionPlaceholder,
897
+ getParamPlaceholder()
898
+ ],
899
+ [
900
+ "<=",
901
+ dateTimeOrDateTimeRangeExpressionPlaceholder,
902
+ getParamPlaceholder()
903
+ ]
904
+ ], typeObject);
905
+ if (matchSuccess && isEqual(firstFieldMatch.value, secondFieldMatch.value)) {
906
+ const firstParamValue = firstParamMatch.value;
907
+ const secondParamValue = secondParamMatch.value;
908
+ if (paramsPlaceholdersLookup[firstParamValue] && paramsPlaceholdersLookup[secondParamValue]) {
909
+ const value = findKey(dateToDateTimeIntervalLookup, (val) => val.start === firstParamValue && val.end === secondParamValue);
910
+ return {
911
+ matchSuccess,
912
+ expression: firstFieldMatch.value,
913
+ value
914
+ };
915
+ }
916
+ const firstParamRelativeDateInfo = parseRelativeDatePlaceholder(firstParamValue);
917
+ const secondParamRelativeDateInfo = parseRelativeDatePlaceholder(secondParamValue);
918
+ if (firstParamRelativeDateInfo && secondParamRelativeDateInfo) {
919
+ const value = toRelativeDatePlaceholder({
920
+ ...firstParamRelativeDateInfo,
921
+ isStartOfInterval: void 0
922
+ });
923
+ return {
924
+ matchSuccess,
925
+ expression: firstFieldMatch.value,
926
+ value
927
+ };
928
+ }
929
+ }
930
+ }
931
+ {
932
+ const { matchSuccess, matches: [fieldMatch, paramMatch] } = doPatternMatch(where, params, [
933
+ "=",
934
+ dateTimeOrDateTimeRangeExpressionPlaceholder,
935
+ getParamPlaceholder((x) => isString(x) && isDateTime(x) || isNoValue(x))
936
+ ], typeObject);
937
+ if (matchSuccess) return {
938
+ matchSuccess,
939
+ expression: fieldMatch.value,
940
+ value: paramMatch.value
941
+ };
942
+ }
943
+ return { matchSuccess: false };
944
+ },
945
+ customConvertToWhereExpression: (expression, value, getNextParamName) => {
946
+ const dateTimePlaceholders = dateToDateTimeIntervalLookup[value];
947
+ let relativeDateInfo = null;
948
+ if (dateTimePlaceholders) {
949
+ const { start, end } = dateTimePlaceholders;
950
+ return {
951
+ expression: [
952
+ "and",
953
+ [
954
+ ">=",
955
+ expression,
956
+ start
957
+ ],
958
+ [
959
+ "<=",
960
+ expression,
961
+ end
962
+ ]
963
+ ],
964
+ params: {
965
+ [start]: start,
966
+ [end]: end
967
+ }
968
+ };
969
+ } else if (relativeDateInfo = parseRelativeDatePlaceholder(value)) {
970
+ const startRelativePlaceholder = toRelativeDatePlaceholder({
971
+ ...relativeDateInfo,
972
+ isStartOfInterval: true,
973
+ unitForStart: "day"
974
+ });
975
+ const endRelativePlaceholder = toRelativeDatePlaceholder({
976
+ ...relativeDateInfo,
977
+ isStartOfInterval: false,
978
+ unitForStart: "day"
979
+ });
980
+ return {
981
+ expression: [
982
+ "and",
983
+ [
984
+ ">=",
985
+ expression,
986
+ startRelativePlaceholder
987
+ ],
988
+ [
989
+ "<=",
990
+ expression,
991
+ endRelativePlaceholder
992
+ ]
993
+ ],
994
+ params: {
995
+ [startRelativePlaceholder]: startRelativePlaceholder,
996
+ [endRelativePlaceholder]: endRelativePlaceholder
997
+ }
998
+ };
999
+ } else {
1000
+ const dateParamName = getNextParamName();
1001
+ return {
1002
+ expression: [
1003
+ "=",
1004
+ expression,
1005
+ dateParamName
1006
+ ],
1007
+ params: { [dateParamName]: value }
1008
+ };
1009
+ }
1010
+ },
1011
+ type: ":operator-type/binary",
1012
+ isNegative: false
1013
+ };
1014
+ const operatorDateTimeIsWithin = {
1015
+ id: ":operator/date-time-is-within",
1016
+ title: "is within",
1017
+ customMatch: getWithinOperatorCustomMatchFn(dateTimeOrDateTimeRangeExpressionPlaceholder, true),
1018
+ customConvertToWhereExpression: getWithinOperatorCustomConvertFn(true),
1019
+ type: ":operator-type/binary",
1020
+ isNegative: false
1021
+ };
1022
+ const operatorDateTimeIsBefore = getCompareOperatorForDateTime(":operator/date-time-is-before", "is earlier than", "<", true, false);
1023
+ const operatorDateTimeIsAfter = getCompareOperatorForDateTime(":operator/date-time-is-after", "is later than", ">", false, false);
1024
+ const operatorDateTimeIsOnOrBefore = getCompareOperatorForDateTime(":operator/date-time-is-on-or-before", "is on or earlier than", "<=", false, false);
1025
+ const operatorDateTimeIsOnOrAfter = getCompareOperatorForDateTime(":operator/date-time-is-on-or-after", "is on or later than", ">=", true, false);
1026
+ const operatorsGroupsWithoutMe = {
1027
+ ":filter-type/comment-reference-collection": [operatorCollectionIsEmpty, operatorCollectionIsNotEmpty],
1028
+ ":filter-type/file-reference": [operatorReferenceIsEmpty, operatorReferenceIsNotEmpty],
1029
+ ":filter-type/file-reference-collection": [operatorCollectionIsEmpty, operatorCollectionIsNotEmpty],
1030
+ ":filter-type/reference": [
1031
+ operatorReferenceIsAnyOf,
1032
+ operatorReferenceIsNoneOf,
1033
+ operatorReferenceIs,
1034
+ operatorReferenceIsNot,
1035
+ operatorReferenceIsEmpty,
1036
+ operatorReferenceIsNotEmpty
1037
+ ],
1038
+ ":filter-type/user-reference": [
1039
+ operatorReferenceIsAnyOf,
1040
+ operatorReferenceIsNoneOf,
1041
+ operatorReferenceIs,
1042
+ operatorReferenceIsNot,
1043
+ operatorReferenceIsEmpty,
1044
+ operatorReferenceIsNotEmpty
1045
+ ],
1046
+ ":filter-type/single-select": [
1047
+ operatorReferenceIsAnyOf,
1048
+ operatorReferenceIsNoneOf,
1049
+ operatorReferenceIs,
1050
+ operatorReferenceIsNot,
1051
+ operatorReferenceIsEmpty,
1052
+ operatorReferenceIsNotEmpty
1053
+ ],
1054
+ ":filter-type/multi-select": [
1055
+ operatorCollectionContainsAnyOf,
1056
+ operatorCollectionDoesNotContainAnyOf,
1057
+ operatorCollectionContains,
1058
+ operatorCollectionDoesNotContain,
1059
+ operatorCollectionIsEmpty,
1060
+ operatorCollectionIsNotEmpty
1061
+ ],
1062
+ ":filter-type/reference-collection": [
1063
+ operatorCollectionContainsAnyOf,
1064
+ operatorCollectionDoesNotContainAnyOf,
1065
+ operatorCollectionContains,
1066
+ operatorCollectionDoesNotContain,
1067
+ operatorCollectionIsEmpty,
1068
+ operatorCollectionIsNotEmpty
1069
+ ],
1070
+ ":filter-type/user-reference-collection": [
1071
+ operatorCollectionContainsAnyOf,
1072
+ operatorCollectionDoesNotContainAnyOf,
1073
+ operatorCollectionContains,
1074
+ operatorCollectionDoesNotContain,
1075
+ operatorCollectionIsEmpty,
1076
+ operatorCollectionIsNotEmpty
1077
+ ],
1078
+ ":filter-type/text": [
1079
+ operatorTextContains,
1080
+ operatorTextDoesNotContain,
1081
+ operatorTextIs,
1082
+ operatorTextIsNot,
1083
+ operatorTextStartsWith,
1084
+ operatorTextEndsWith,
1085
+ operatorTextIsEmptyV2,
1086
+ operatorTextIsNotEmptyV2
1087
+ ],
1088
+ ":filter-type/number": [
1089
+ operatorNumberEquals,
1090
+ operatorNumberDoesNotEqual,
1091
+ operatorGreaterThan,
1092
+ operatorLessThan,
1093
+ operatorGreaterThanOrEqual,
1094
+ operatorLessThanOrEqual,
1095
+ operatorNumberIsEmptyV2,
1096
+ operatorNumberIsNotEmptyV2
1097
+ ],
1098
+ ":filter-type/bool": [operatorBoolIs],
1099
+ ":filter-type/date": [
1100
+ operatorDateIs,
1101
+ operatorDateIsWithin,
1102
+ operatorDateIsBefore,
1103
+ operatorDateIsAfter,
1104
+ operatorDateIsOnOrBefore,
1105
+ operatorDateIsOnOrAfter,
1106
+ operatorDateIsEmptyV2,
1107
+ operatorDateIsNotEmptyV2
1108
+ ],
1109
+ ":filter-type/date-time": [
1110
+ operatorDateTimeIs,
1111
+ operatorDateTimeIsWithin,
1112
+ operatorDateTimeIsBefore,
1113
+ operatorDateTimeIsAfter,
1114
+ operatorDateTimeIsOnOrBefore,
1115
+ operatorDateTimeIsOnOrAfter,
1116
+ operatorDateIsEmptyV2,
1117
+ operatorDateIsNotEmptyV2
1118
+ ],
1119
+ ":filter-type/location": [
1120
+ operatorLocationContains,
1121
+ operatorLocationDoesNotContain,
1122
+ operatorLocationIsEmpty,
1123
+ operatorLocationIsNotEmpty
1124
+ ],
1125
+ ":filter-type/user-role": [operatorUserRoleIsAnyOf],
1126
+ ":filter-type/collection-count": [
1127
+ operatorCollectionCountEquals,
1128
+ operatorCollectionCountDoesNotEqual,
1129
+ operatorCollectionCountGreaterThan,
1130
+ operatorCollectionCountLessThan,
1131
+ operatorCollectionCountGreaterThanOrEqual,
1132
+ operatorCollectionCountLessThanOrEqual
1133
+ ]
1134
+ };
1135
+ const operatorsGroups = mapValues(operatorsGroupsWithoutMe, (value, key) => {
1136
+ if (key === ":filter-type/user-reference") return [operatorReferenceIsMe, operatorReferenceIsNotMe].concat(value);
1137
+ else if (key === ":filter-type/user-reference-collection") return [operatorCollectionContainsMe, operatorCollectionDoesNotContainMe].concat(value);
1138
+ else return value;
1139
+ });
1140
+ const operators = uniq(flatten(Object.values(operatorsGroups))).concat([
1141
+ operatorTextIsEmptyV1,
1142
+ operatorTextIsNotEmptyV1,
1143
+ operatorDateIsEmptyV1,
1144
+ operatorDateIsNotEmptyV1,
1145
+ operatorNumberIsEmptyV1,
1146
+ operatorNumberIsNotEmptyV1,
1147
+ operatorTextExactlyIs
1148
+ ]);
1149
+ const hiddenValidOperators = [operatorTextExactlyIs];
1150
+ //#endregion
1151
+ export { hiddenValidOperators, operatorBoolIs, operatorCollectionContains, operatorCollectionContainsAnyOf, operatorCollectionContainsMe, operatorCollectionCountDoesNotEqual, operatorCollectionCountEquals, operatorCollectionCountGreaterThan, operatorCollectionCountGreaterThanOrEqual, operatorCollectionCountLessThan, operatorCollectionCountLessThanOrEqual, operatorCollectionDoesNotContain, operatorCollectionDoesNotContainAnyOf, operatorCollectionDoesNotContainMe, operatorCollectionIsEmpty, operatorCollectionIsNotEmpty, operatorDateIs, operatorDateIsAfter, operatorDateIsBefore, operatorDateIsEmptyV1, operatorDateIsEmptyV2, operatorDateIsNotEmptyV1, operatorDateIsNotEmptyV2, operatorDateIsOnOrAfter, operatorDateIsOnOrBefore, operatorDateIsWithin, operatorDateTimeIs, operatorDateTimeIsAfter, operatorDateTimeIsBefore, operatorDateTimeIsOnOrAfter, operatorDateTimeIsOnOrBefore, operatorDateTimeIsWithin, operatorGreaterThan, operatorGreaterThanOrEqual, operatorLessThan, operatorLessThanOrEqual, operatorLocationContains, operatorLocationDoesNotContain, operatorLocationIsEmpty, operatorLocationIsNotEmpty, operatorNumberDoesNotEqual, operatorNumberEquals, operatorNumberIsEmptyV1, operatorNumberIsEmptyV2, operatorNumberIsNotEmptyV1, operatorNumberIsNotEmptyV2, operatorReferenceIs, operatorReferenceIsAnyOf, operatorReferenceIsEmpty, operatorReferenceIsMe, operatorReferenceIsNoneOf, operatorReferenceIsNot, operatorReferenceIsNotEmpty, operatorReferenceIsNotMe, operatorTextContains, operatorTextDoesNotContain, operatorTextEndsWith, operatorTextExactlyIs, operatorTextIs, operatorTextIsEmptyV1, operatorTextIsEmptyV2, operatorTextIsNot, operatorTextIsNotEmptyV1, operatorTextIsNotEmptyV2, operatorTextStartsWith, operatorUserRoleIsAnyOf, operators, operatorsGroups, operatorsGroupsWithoutMe, operators_exports, withoutLastIdAccess };