@fibery/expression-utils 9.6.0 → 9.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/src/context-variables.d.ts +5 -6
- package/lib/src/context-variables.js +33 -14
- package/lib/src/context-variables.js.map +1 -1
- package/lib/src/fieldExpressionVisitorTypeAware.js +6 -5
- package/lib/src/fieldExpressionVisitorTypeAware.js.map +1 -1
- package/lib/src/filter-expression/index.js.map +1 -1
- package/lib/src/filter-expression/operator-utils.d.ts +6 -1
- package/lib/src/filter-expression/operator-utils.js +19 -8
- package/lib/src/filter-expression/operator-utils.js.map +1 -1
- package/lib/src/filter-expression/operators.d.ts +0 -1
- package/lib/src/filter-expression/operators.js +26 -20
- package/lib/src/filter-expression/operators.js.map +1 -1
- package/lib/src/filter-expression/pattern-match.js +14 -11
- package/lib/src/filter-expression/pattern-match.js.map +1 -1
- package/lib/src/filter-expression/patternMatchPlaceholders.js +8 -6
- package/lib/src/filter-expression/patternMatchPlaceholders.js.map +1 -1
- package/lib/src/filter-expression/patternToExpression.js +1 -5
- package/lib/src/filter-expression/patternToExpression.js.map +1 -1
- package/lib/src/params-placeholders.d.ts +1 -1
- package/lib/src/params-placeholders.js +6 -5
- package/lib/src/params-placeholders.js.map +1 -1
- package/lib/src/types.d.ts +16 -2
- package/lib/src/utils.d.ts +7 -8
- package/lib/src/utils.js +21 -23
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visitors.js +7 -5
- package/lib/src/visitors.js.map +1 -1
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -20,3 +20,4 @@ declare const filterExpression: {
|
|
|
20
20
|
export { utils, visitors, paramsPlaceholders, contextVariables, filterExpression };
|
|
21
21
|
export type { Expression, OrderBy, Query, Select, SubQuery, ExpressionVisitor, ExpressionVisitorWithDefault, } from "./src/types";
|
|
22
22
|
export type { Operator, ExpressionToFilterBy } from "./src/filter-expression/types";
|
|
23
|
+
export type { ContextVariable } from "./src/context-variables";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Schema, TypeObject } from "@fibery/schema";
|
|
2
|
-
type ContextVariable = {
|
|
3
|
-
|
|
2
|
+
export type ContextVariable = {
|
|
3
|
+
description: string;
|
|
4
4
|
id: string;
|
|
5
5
|
title: string;
|
|
6
|
+
typeObject: TypeObject;
|
|
6
7
|
isCollection: boolean;
|
|
7
|
-
description: string;
|
|
8
8
|
};
|
|
9
9
|
export declare const triggeredEntityContextVariableId = "triggeredEntity";
|
|
10
10
|
export declare const previousTriggeredEntityContextVariableId = "previousTriggeredEntity";
|
|
11
11
|
export declare const currentUserContextVariableId = "currentUser";
|
|
12
12
|
export declare const triggeredCollectionItemContextVariableId = "triggered-collection-item";
|
|
13
|
-
export declare const getAutomationButtonContextVariables: (typeId: string,
|
|
13
|
+
export declare const getAutomationButtonContextVariables: (typeId: string, fiberySchema: Schema) => Array<ContextVariable>;
|
|
14
14
|
export declare const getTriggerCollectionFieldObject: (typeId: string, collectionFieldId: string, fiberySchema: Schema) => import("@fibery/schema").FieldObject | undefined;
|
|
15
15
|
export declare const getAutomationTriggersContextVariables: (triggers: Array<{
|
|
16
16
|
trigger: string;
|
|
17
17
|
args: Record<string, unknown>;
|
|
18
|
-
}>, typeId: string, fiberySchema: Schema) => Array<ContextVariable>;
|
|
18
|
+
}>, typeId: string, fiberySchema: Schema, allowPreviousContextVariable?: boolean) => Array<ContextVariable>;
|
|
19
19
|
export declare const getEntityQueryVariables: (schema: Schema) => {
|
|
20
20
|
typeObject: TypeObject;
|
|
21
21
|
id: string;
|
|
@@ -23,4 +23,3 @@ export declare const getEntityQueryVariables: (schema: Schema) => {
|
|
|
23
23
|
isCollection: boolean;
|
|
24
24
|
description: string;
|
|
25
25
|
}[];
|
|
26
|
-
export {};
|
|
@@ -4,12 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getEntityQueryVariables = exports.getAutomationTriggersContextVariables = exports.getTriggerCollectionFieldObject = exports.getAutomationButtonContextVariables = exports.triggeredCollectionItemContextVariableId = exports.currentUserContextVariableId = exports.previousTriggeredEntityContextVariableId = exports.triggeredEntityContextVariableId = void 0;
|
|
7
|
-
const
|
|
7
|
+
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
8
|
+
const groupBy_1 = __importDefault(require("lodash/groupBy"));
|
|
9
|
+
const uniqBy_1 = __importDefault(require("lodash/uniqBy"));
|
|
8
10
|
exports.triggeredEntityContextVariableId = "triggeredEntity";
|
|
9
11
|
exports.previousTriggeredEntityContextVariableId = "previousTriggeredEntity";
|
|
10
12
|
exports.currentUserContextVariableId = "currentUser";
|
|
11
13
|
exports.triggeredCollectionItemContextVariableId = "triggered-collection-item";
|
|
12
|
-
const getAutomationButtonContextVariables = (typeId,
|
|
14
|
+
const getAutomationButtonContextVariables = (typeId, fiberySchema) => {
|
|
13
15
|
if (!fiberySchema) {
|
|
14
16
|
return [];
|
|
15
17
|
}
|
|
@@ -17,14 +19,14 @@ const getAutomationButtonContextVariables = (typeId, typeName, fiberySchema) =>
|
|
|
17
19
|
const typeObject = fiberySchema.typeObjectsById[typeId];
|
|
18
20
|
return [
|
|
19
21
|
{
|
|
20
|
-
id:
|
|
22
|
+
id: exports.triggeredEntityContextVariableId,
|
|
21
23
|
title: `Step 1 ${typeObject.singularTitle}`,
|
|
22
24
|
typeObject,
|
|
23
25
|
isCollection: false,
|
|
24
26
|
description: `The ${typeObject.singularTitle} for which the Button was clicked`,
|
|
25
27
|
},
|
|
26
28
|
{
|
|
27
|
-
id:
|
|
29
|
+
id: exports.currentUserContextVariableId,
|
|
28
30
|
title: `User who clicked Button`,
|
|
29
31
|
typeObject: userTypeObject,
|
|
30
32
|
isCollection: false,
|
|
@@ -46,21 +48,21 @@ const getTriggerCollectionFieldObject = (typeId, collectionFieldId, fiberySchema
|
|
|
46
48
|
return fiberySchema.typeObjectsById[typeId].fieldObjectsById[collectionFieldId];
|
|
47
49
|
};
|
|
48
50
|
exports.getTriggerCollectionFieldObject = getTriggerCollectionFieldObject;
|
|
49
|
-
const getTriggerContextVariables = (trigger, typeId, fiberySchema) => {
|
|
51
|
+
const getTriggerContextVariables = (trigger, typeId, fiberySchema, allowPreviousContextVariable = false) => {
|
|
50
52
|
if (!fiberySchema) {
|
|
51
53
|
return [];
|
|
52
54
|
}
|
|
53
55
|
const typeObject = fiberySchema.typeObjectsById[typeId];
|
|
54
56
|
const userTypeObject = fiberySchema.typeObjectsByName["fibery/user"];
|
|
55
57
|
const triggeredEntityVar = {
|
|
56
|
-
id:
|
|
58
|
+
id: exports.triggeredEntityContextVariableId,
|
|
57
59
|
title: `Step 1 ${typeObject.singularTitle}`,
|
|
58
60
|
typeObject,
|
|
59
61
|
isCollection: false,
|
|
60
62
|
description: `The ${typeObject.singularTitle} from step 1 of this Automation Rule`,
|
|
61
63
|
};
|
|
62
64
|
const currentUserVar = {
|
|
63
|
-
id:
|
|
65
|
+
id: exports.currentUserContextVariableId,
|
|
64
66
|
title: `User who triggered Rule`,
|
|
65
67
|
typeObject: userTypeObject,
|
|
66
68
|
isCollection: false,
|
|
@@ -73,8 +75,9 @@ const getTriggerContextVariables = (trigger, typeId, fiberySchema) => {
|
|
|
73
75
|
return typeObject.syncSource !== null ? [triggeredEntityVar] : [triggeredEntityVar, currentUserVar];
|
|
74
76
|
}
|
|
75
77
|
else if (trigger.trigger === "updated") {
|
|
78
|
+
const result = [triggeredEntityVar];
|
|
76
79
|
const disableCurrentUserVar = trigger.args.updatedField &&
|
|
77
|
-
|
|
80
|
+
Array.isArray(trigger.args.updatedField) &&
|
|
78
81
|
trigger.args.updatedField.some((fieldId) => {
|
|
79
82
|
if (!Object.hasOwn(typeObject.fieldObjectsById, fieldId)) {
|
|
80
83
|
return false;
|
|
@@ -82,7 +85,23 @@ const getTriggerContextVariables = (trigger, typeId, fiberySchema) => {
|
|
|
82
85
|
const fieldObject = typeObject.fieldObjectsById[fieldId];
|
|
83
86
|
return fieldObject?.isReadOnly || fieldObject?.type === "Collaboration~Documents/Document";
|
|
84
87
|
});
|
|
85
|
-
|
|
88
|
+
if (!disableCurrentUserVar) {
|
|
89
|
+
result.push(currentUserVar);
|
|
90
|
+
}
|
|
91
|
+
if (allowPreviousContextVariable &&
|
|
92
|
+
trigger.args.updatedField &&
|
|
93
|
+
Array.isArray(trigger.args.updatedField) &&
|
|
94
|
+
trigger.args.updatedField.length === 1) {
|
|
95
|
+
const previousTriggeredEntityContextVariable = {
|
|
96
|
+
id: exports.previousTriggeredEntityContextVariableId,
|
|
97
|
+
title: `Step 1 ${typeObject.singularTitle} (Previous)`,
|
|
98
|
+
typeObject,
|
|
99
|
+
isCollection: false,
|
|
100
|
+
description: `The previous value of ${typeObject.singularTitle} from step 1 of this Automation Rule`,
|
|
101
|
+
};
|
|
102
|
+
result.push(previousTriggeredEntityContextVariable);
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
86
105
|
}
|
|
87
106
|
else if (trigger.trigger === "collection-item-added" || trigger.trigger === "collection-item-removed") {
|
|
88
107
|
const collectionItemFieldObject = (0, exports.getTriggerCollectionFieldObject)(typeId, trigger.args.changedCollectionField, fiberySchema);
|
|
@@ -104,16 +123,16 @@ const getTriggerContextVariables = (trigger, typeId, fiberySchema) => {
|
|
|
104
123
|
return [];
|
|
105
124
|
}
|
|
106
125
|
};
|
|
107
|
-
const getAutomationTriggersContextVariables = (triggers, typeId, fiberySchema) => {
|
|
126
|
+
const getAutomationTriggersContextVariables = (triggers, typeId, fiberySchema, allowPreviousContextVariable = false) => {
|
|
108
127
|
const triggerContextVars = triggers.flatMap((trigger) => {
|
|
109
|
-
return getTriggerContextVariables(trigger, typeId, fiberySchema);
|
|
128
|
+
return getTriggerContextVariables(trigger, typeId, fiberySchema, allowPreviousContextVariable);
|
|
110
129
|
});
|
|
111
|
-
return
|
|
130
|
+
return (0, uniqBy_1.default)(triggerContextVars, (variable) => `${variable.id}_${variable.typeObject.id}`);
|
|
112
131
|
};
|
|
113
132
|
exports.getAutomationTriggersContextVariables = getAutomationTriggersContextVariables;
|
|
114
133
|
const getEntityQueryVariables = (schema) => {
|
|
115
|
-
const grouped =
|
|
116
|
-
return
|
|
134
|
+
const grouped = (0, groupBy_1.default)(schema.typeObjects.filter((x) => x.isDomain), (typeObject) => typeObject.pluralTitle);
|
|
135
|
+
return (0, flatten_1.default)(Object.values(grouped).map((group) => {
|
|
117
136
|
return group.map((typeObject) => ({
|
|
118
137
|
typeObject,
|
|
119
138
|
id: `entityQuery_${typeObject.id}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-variables.js","sourceRoot":"","sources":["../../src/context-variables.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"context-variables.js","sourceRoot":"","sources":["../../src/context-variables.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAqC;AACrC,6DAAqC;AACrC,2DAAmC;AAWtB,QAAA,gCAAgC,GAAG,iBAAiB,CAAC;AACrD,QAAA,wCAAwC,GAAG,yBAAyB,CAAC;AACrE,QAAA,4BAA4B,GAAG,aAAa,CAAC;AAC7C,QAAA,wCAAwC,GAAG,2BAA2B,CAAC;AAE7E,MAAM,mCAAmC,GAAG,CAAC,MAAc,EAAE,YAAoB,EAA0B,EAAE;IAClH,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,cAAc,GAAG,YAAY,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,YAAY,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACxD,OAAO;QACL;YACE,EAAE,EAAE,wCAAgC;YACpC,KAAK,EAAE,UAAU,UAAU,CAAC,aAAa,EAAE;YAC3C,UAAU;YACV,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,OAAO,UAAU,CAAC,aAAa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,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW;YAC7G,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,sBAAsB,UAAU,CAAC,KAAK,YAAY;SAChE,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,uBAAuB,2BAiBlC"}
|
|
@@ -4,10 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fieldAccessVisitorTypeAware = void 0;
|
|
7
|
-
const
|
|
7
|
+
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
8
|
+
const mapValues_1 = __importDefault(require("lodash/mapValues"));
|
|
8
9
|
const utils_1 = require("./utils");
|
|
9
10
|
const visitFieldExpression = ({ expression: fieldExpression, typeObject: initialTypeObject, onField, onFieldNotFound }) => fieldExpression.reduce(({ typeObject, expression }, fieldAccess) => {
|
|
10
|
-
if (typeObject && (0, utils_1.isMultiFieldAccess)(fieldAccess) && typeObject.fieldObjectsById
|
|
11
|
+
if (typeObject && (0, utils_1.isMultiFieldAccess)(fieldAccess) && Object.hasOwn(typeObject.fieldObjectsById, fieldAccess[0])) {
|
|
11
12
|
const typeId = fieldAccess[1];
|
|
12
13
|
const fieldObject = typeObject.fieldObjectsById[fieldAccess[0]];
|
|
13
14
|
const nextTypeObject = fieldObject.multiRelatedFieldObjects.find((f) => f.holderTypeObject.id === typeId)?.holderTypeObject;
|
|
@@ -39,7 +40,7 @@ const visitFieldExpression = ({ expression: fieldExpression, typeObject: initial
|
|
|
39
40
|
expression,
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
|
-
else if (typeObject && typeObject.fieldObjectsById
|
|
43
|
+
else if (typeObject && Object.hasOwn(typeObject.fieldObjectsById, fieldAccess)) {
|
|
43
44
|
const fieldObject = typeObject.fieldObjectsById[fieldAccess];
|
|
44
45
|
const onFieldResult = onField({
|
|
45
46
|
fieldAccess,
|
|
@@ -111,8 +112,8 @@ const fieldAccessVisitorTypeAwareInternal = ({ typeObject, rootTypeObject, onFie
|
|
|
111
112
|
...subQueryExpression,
|
|
112
113
|
...{
|
|
113
114
|
"q/from": fromVisitResult.expression,
|
|
114
|
-
"q/select":
|
|
115
|
-
?
|
|
115
|
+
"q/select": (0, isPlainObject_1.default)(selectExpression)
|
|
116
|
+
? (0, mapValues_1.default)(selectExpression, (val) => subQueryVisitor.visitExpression(val))
|
|
116
117
|
: subQueryVisitor.visitExpression(selectExpression),
|
|
117
118
|
},
|
|
118
119
|
...(whereExpression ? { "q/where": subQueryVisitor.visitExpression(whereExpression) } : null),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldExpressionVisitorTypeAware.js","sourceRoot":"","sources":["../../src/fieldExpressionVisitorTypeAware.js"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"fieldExpressionVisitorTypeAware.js","sourceRoot":"","sources":["../../src/fieldExpressionVisitorTypeAware.js"],"names":[],"mappings":";;;;;;AAAA,yEAAiD;AACjD,iEAAyC;AACzC,mCAAoE;AAEpE,MAAM,oBAAoB,GAAG,CAAC,EAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,EAAC,EAAE,EAAE,CACtH,eAAe,CAAC,MAAM,CACpB,CAAC,EAAC,UAAU,EAAE,UAAU,EAAC,EAAE,WAAW,EAAE,EAAE;IACxC,IAAI,UAAU,IAAI,IAAA,0BAAkB,EAAC,WAAW,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChH,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,WAAW,GAAG,UAAU,CAAC,gBAAgB,CAAC,WAAW,C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C,UAAU,EACV,OAAO,GAAG,cAAc,EACxB,eAAe,GAAG,sBAAsB,GACzC,EAAE,EAAE;IACH,OAAO,mCAAmC,CAAC,EAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAC,CAAC,CAAC;AACjH,CAAC,CAAC;AANW,QAAA,2BAA2B,+BAMtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/filter-expression/index.ts"],"names":[],"mappings":";;;AAGA,mDAA+C;AAE/C,+BAAkC;AAClC,sCAA8C;AAEvC,MAAM,iBAAiB,GAAG,CAC/B,gBAA4B,EAC5B,MAAgB,EAChB,SAA0B,EAC1B,MAAqB,EACrB,IAAY,EACZ,EAAE;IACF,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,EAAE,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAElD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;YAC/E,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;gBAC7B,OAAO;oBACL,QAAQ;oBACR,KAAK,EAAE,WAAW,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/filter-expression/index.ts"],"names":[],"mappings":";;;AAGA,mDAA+C;AAE/C,+BAAkC;AAClC,sCAA8C;AAEvC,MAAM,iBAAiB,GAAG,CAC/B,gBAA4B,EAC5B,MAAgB,EAChB,SAA0B,EAC1B,MAAqB,EACrB,IAAY,EACZ,EAAE;IACF,I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;oBACjC,MAAM,IAAI,4BAAmB,CAAC,uDAAuD,CAAC,CAAC;gBACzF,CAAC;gBAED,OAAO;oBACL,QAAQ;oBACR,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK;oBAC/C,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK;oBACtC,IAAI;oBACJ,EAAE,EAAE,IAAA,SAAM,GAAE;iBACb,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAhDW,QAAA,iBAAiB,qBAgD5B"}
|
|
@@ -2,6 +2,11 @@ import { CustomMatchFn, Operator } from "./types";
|
|
|
2
2
|
import { $TSFixMe } from "../tsfixme";
|
|
3
3
|
import { Expression } from "../types";
|
|
4
4
|
export declare const isDateTime: (dateString: string) => boolean;
|
|
5
|
+
export declare const NO_VALUE: undefined;
|
|
6
|
+
export declare const isNoValue: (value: unknown) => boolean;
|
|
5
7
|
export declare const getCompareOperatorForDateTime: (id: string, title: string, operator: string, compareByStartInterval: boolean) => Operator;
|
|
6
|
-
export declare const getWithinOperatorCustomConvertFn: (leftPartExcluded: boolean) => (
|
|
8
|
+
export declare const getWithinOperatorCustomConvertFn: (leftPartExcluded: boolean) => (expression: Expression, value: {
|
|
9
|
+
withinRangeStart: unknown;
|
|
10
|
+
withinRangeEnd: unknown;
|
|
11
|
+
} | null, getNextParamName: () => string) => $TSFixMe;
|
|
7
12
|
export declare const getWithinOperatorCustomMatchFn: (fieldPlaceholder: $TSFixMe, leftPartExcluded: boolean) => CustomMatchFn;
|
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getWithinOperatorCustomMatchFn = exports.getWithinOperatorCustomConvertFn = exports.getCompareOperatorForDateTime = exports.isDateTime = void 0;
|
|
7
|
-
const
|
|
6
|
+
exports.getWithinOperatorCustomMatchFn = exports.getWithinOperatorCustomConvertFn = exports.getCompareOperatorForDateTime = exports.isNoValue = exports.NO_VALUE = exports.isDateTime = void 0;
|
|
7
|
+
const findKey_1 = __importDefault(require("lodash/findKey"));
|
|
8
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
9
|
+
const isString_1 = __importDefault(require("lodash/isString"));
|
|
8
10
|
const params_placeholders_1 = require("../params-placeholders");
|
|
9
11
|
const pattern_match_1 = require("./pattern-match");
|
|
10
12
|
const patternMatchPlaceholders_1 = require("./patternMatchPlaceholders");
|
|
@@ -16,6 +18,14 @@ const isoDateSample = "2018-05-30";
|
|
|
16
18
|
// and later moment.js parses date string as date-time
|
|
17
19
|
const isDateTime = (dateString) => dateString.length === isoDateTimeSample.length || dateString.length === isoDateSample.length;
|
|
18
20
|
exports.isDateTime = isDateTime;
|
|
21
|
+
exports.NO_VALUE = undefined;
|
|
22
|
+
const isNoValue = (value) => {
|
|
23
|
+
if (typeof value === "object" && value !== null && "withinRangeStart" in value && "withinRangeEnd" in value) {
|
|
24
|
+
return value.withinRangeStart === exports.NO_VALUE && value.withinRangeEnd === exports.NO_VALUE;
|
|
25
|
+
}
|
|
26
|
+
return value === exports.NO_VALUE;
|
|
27
|
+
};
|
|
28
|
+
exports.isNoValue = isNoValue;
|
|
19
29
|
const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterval) => ({
|
|
20
30
|
id,
|
|
21
31
|
title,
|
|
@@ -25,8 +35,9 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
|
|
|
25
35
|
patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder,
|
|
26
36
|
(0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => {
|
|
27
37
|
return (Boolean(params_placeholders_1.paramsPlaceholdersLookup[x]) ||
|
|
28
|
-
(
|
|
29
|
-
Boolean((0, params_placeholders_1.parseRelativeDatePlaceholder)(x))
|
|
38
|
+
((0, isString_1.default)(x) && (0, exports.isDateTime)(x)) ||
|
|
39
|
+
Boolean((0, params_placeholders_1.parseRelativeDatePlaceholder)(x)) ||
|
|
40
|
+
(0, exports.isNoValue)(x));
|
|
30
41
|
}),
|
|
31
42
|
], typeObject);
|
|
32
43
|
if (matchSuccess) {
|
|
@@ -41,7 +52,7 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
|
|
|
41
52
|
};
|
|
42
53
|
}
|
|
43
54
|
else if (params_placeholders_1.paramsPlaceholdersLookup[paramValue]) {
|
|
44
|
-
const value =
|
|
55
|
+
const value = (0, findKey_1.default)(params_placeholders_1.dateToDateTimeIntervalLookup, (val) => compareByStartInterval ? val.start === paramValue : val.end === paramValue);
|
|
45
56
|
return {
|
|
46
57
|
matchSuccess,
|
|
47
58
|
expression: fieldMatch.value,
|
|
@@ -104,11 +115,11 @@ const getWithinRangeParam = ({ withinRangeValue, getNextParamName, }) => {
|
|
|
104
115
|
const getWithinOperatorCustomConvertFn = (leftPartExcluded) => {
|
|
105
116
|
return (expression, value, getNextParamName) => {
|
|
106
117
|
const { key: startParamKey, value: startParamValue } = getWithinRangeParam({
|
|
107
|
-
withinRangeValue: value
|
|
118
|
+
withinRangeValue: value?.withinRangeStart,
|
|
108
119
|
getNextParamName,
|
|
109
120
|
});
|
|
110
121
|
const { key: endParamKey, value: endParamValue } = getWithinRangeParam({
|
|
111
|
-
withinRangeValue: value
|
|
122
|
+
withinRangeValue: value?.withinRangeEnd,
|
|
112
123
|
getNextParamName,
|
|
113
124
|
});
|
|
114
125
|
return {
|
|
@@ -152,7 +163,7 @@ const matchWithinOperator = (pattern, where, params, typeObject) => {
|
|
|
152
163
|
if (matchSuccess) {
|
|
153
164
|
const firstFieldValue = firstFieldMatch.value;
|
|
154
165
|
const secondFieldValue = secondFieldMatch.value;
|
|
155
|
-
if (
|
|
166
|
+
if ((0, isEqual_1.default)(firstFieldValue, secondFieldValue)) {
|
|
156
167
|
return {
|
|
157
168
|
matchSuccess,
|
|
158
169
|
expression: firstFieldValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-utils.js","sourceRoot":"","sources":["../../../src/filter-expression/operator-utils.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"operator-utils.js","sourceRoot":"","sources":["../../../src/filter-expression/operator-utils.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAqC;AACrC,6DAAqC;AACrC,+DAAuC;AACvC,gEAmBgC;AAChC,mDAA+C;AAC/C,yEAA6G;AAM7G,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AACrD,MAAM,aAAa,GAAG,YAAY,CAAC;AACnC,oEAAoE;AACpE,0FAA0F;AAC1F,8EAA8E;AAC9E,sDAAsD;AAC/C,MAAM,UAAU,GAAG,CAAC,UAAkB,EAAW,EAAE,CACxD,UAAU,CAAC,MAAM,KAAK,iBAAiB,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,KAAK,aAAa,CAAC,MAAM,CAAC;AADlF,QAAA,UAAU,cACwE;AAElF,QAAA,QAAQ,GAAG,SAAS,CAAC;AAE3B,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,EAAE;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,kBAAkB,IAAI,KAAK,IAAI,gBAAgB,IAAI,KAAK,EAAE,CAAC;QAC5G,OAAO,KAAK,CAAC,gBAAgB,KAAK,gBAAQ,IAAI,KAAK,CAAC,cAAc,KAAK,gBAAQ,CAAC;IAClF,CAAC;IACD,OAAO,KAAK,KAAK,gBAAQ,CAAC;AAC5B,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB;AAEK,MAAM,6BAA6B,GAAG,CAC3C,EAAU,EACV,KAAa,EACb,QAAgB,EAChB,sBAA+B,EACrB,EAAE,CAAC,CAAC;IACd,EAAE;IACF,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,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC7C,iHAAiH;YACjH,iIAAiI;YACjI,OAAO,mBAAmB,CACxB;gBACE,KAAK;gBACL,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAA,8CAAmB,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;gBAChE,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAA,8CAAmB,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;aACjE,EACD,KAAK,EACL,MAAM,EACN,UAAU,CACX,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC,CAAC;AA/BW,QAAA,8BAA8B,kCA+BzC"}
|
|
@@ -2,7 +2,6 @@ import { Operator } from "./types";
|
|
|
2
2
|
import { Expression } from "../types";
|
|
3
3
|
export declare const operatorReferenceIsMe: Operator;
|
|
4
4
|
export declare const operatorReferenceIsNotMe: Operator;
|
|
5
|
-
export declare const NOT_SET: undefined;
|
|
6
5
|
export declare const operatorReferenceIs: Operator;
|
|
7
6
|
export declare const operatorReferenceIsAnyOf: Operator;
|
|
8
7
|
export declare const operatorReferenceIsNot: Operator;
|
|
@@ -3,10 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.operatorDateIsNotEmptyV2 = exports.operatorDateIsNotEmptyV1 = exports.operatorDateIsEmptyV2 = exports.operatorDateIsEmptyV1 = exports.operatorDateIs = 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.operatorLessThanOrEqual = exports.operatorGreaterThanOrEqual = exports.operatorLessThan = exports.operatorGreaterThan = exports.operatorNumberDoesNotEqual = exports.operatorTextEndsWith = exports.operatorTextStartsWith = exports.operatorTextDoesNotContain = exports.operatorTextContains = exports.operatorTextIsNot = exports.operatorTextExactlyIs = exports.operatorTextIs = exports.operatorUserRoleIsAnyOf = exports.operatorNumberEquals = exports.operatorReferenceIsNotEmpty = exports.operatorReferenceIsEmpty = exports.operatorReferenceIsNoneOf = exports.operatorReferenceIsNot = exports.operatorReferenceIsAnyOf = exports.operatorReferenceIs = exports.
|
|
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 =
|
|
6
|
+
exports.operatorDateIsWithin = exports.operatorDateIsNotEmptyV2 = exports.operatorDateIsNotEmptyV1 = exports.operatorDateIsEmptyV2 = exports.operatorDateIsEmptyV1 = exports.operatorDateIs = 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.operatorLessThanOrEqual = exports.operatorGreaterThanOrEqual = exports.operatorLessThan = exports.operatorGreaterThan = exports.operatorNumberDoesNotEqual = exports.operatorTextEndsWith = exports.operatorTextStartsWith = exports.operatorTextDoesNotContain = exports.operatorTextContains = exports.operatorTextIsNot = exports.operatorTextExactlyIs = exports.operatorTextIs = exports.operatorUserRoleIsAnyOf = exports.operatorNumberEquals = 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 = void 0;
|
|
8
8
|
/* eslint-disable max-lines */
|
|
9
|
-
const
|
|
9
|
+
const findKey_1 = __importDefault(require("lodash/findKey"));
|
|
10
|
+
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
11
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
12
|
+
const isString_1 = __importDefault(require("lodash/isString"));
|
|
13
|
+
const last_1 = __importDefault(require("lodash/last"));
|
|
14
|
+
const mapValues_1 = __importDefault(require("lodash/mapValues"));
|
|
15
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
10
16
|
const uuid_1 = require("uuid");
|
|
11
17
|
const params_placeholders_1 = require("../params-placeholders");
|
|
12
18
|
const operator_utils_1 = require("./operator-utils");
|
|
@@ -50,11 +56,7 @@ function isValidReferenceUUID(val) {
|
|
|
50
56
|
// non-existing UUID for case when one type has enum type but another type does not
|
|
51
57
|
// temporary disable bcz fix opens up another bugs like unable to create entity with pre-set filters and so on
|
|
52
58
|
// return isUUID.anyNonNil(val) || val === "11111111-1111-1111-1111-111111111111";
|
|
53
|
-
return (0, uuid_1.validate)(val) || (
|
|
54
|
-
}
|
|
55
|
-
exports.NOT_SET = undefined;
|
|
56
|
-
function isNotSet(value) {
|
|
57
|
-
return value === exports.NOT_SET;
|
|
59
|
+
return (0, uuid_1.validate)(val) || ((0, isString_1.default)(val) && (0, params_placeholders_1.isDynamicFilterParam)(val));
|
|
58
60
|
}
|
|
59
61
|
exports.operatorReferenceIs = {
|
|
60
62
|
id: ":operator/reference-is",
|
|
@@ -62,7 +64,7 @@ exports.operatorReferenceIs = {
|
|
|
62
64
|
pattern: [
|
|
63
65
|
"=",
|
|
64
66
|
patternMatchPlaceholders_1.referenceExpressionPlaceholder,
|
|
65
|
-
(0, patternMatchPlaceholders_1.getParamPlaceholder)((val) => isValidReferenceUUID(val) ||
|
|
67
|
+
(0, patternMatchPlaceholders_1.getParamPlaceholder)((val) => isValidReferenceUUID(val) || (0, operator_utils_1.isNoValue)(val)),
|
|
66
68
|
],
|
|
67
69
|
type: ":operator-type/binary",
|
|
68
70
|
};
|
|
@@ -78,7 +80,7 @@ exports.operatorReferenceIsNot = {
|
|
|
78
80
|
pattern: [
|
|
79
81
|
"!=",
|
|
80
82
|
patternMatchPlaceholders_1.referenceExpressionPlaceholder,
|
|
81
|
-
(0, patternMatchPlaceholders_1.getParamPlaceholder)((val) => isValidReferenceUUID(val) ||
|
|
83
|
+
(0, patternMatchPlaceholders_1.getParamPlaceholder)((val) => isValidReferenceUUID(val) || (0, operator_utils_1.isNoValue)(val)),
|
|
82
84
|
],
|
|
83
85
|
type: ":operator-type/binary",
|
|
84
86
|
};
|
|
@@ -112,7 +114,7 @@ exports.operatorUserRoleIsAnyOf = {
|
|
|
112
114
|
pattern: [
|
|
113
115
|
"q/in",
|
|
114
116
|
patternMatchPlaceholders_1.textFieldPlaceholder,
|
|
115
|
-
(0, patternMatchPlaceholders_1.getParamPlaceholder)((x) =>
|
|
117
|
+
(0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => (Array.isArray(x) && x.every((item) => (0, isString_1.default)(item))) || (0, operator_utils_1.isNoValue)(x)),
|
|
116
118
|
],
|
|
117
119
|
type: ":operator-type/binary",
|
|
118
120
|
};
|
|
@@ -280,7 +282,7 @@ const getCollectionContainsAnyOfPattern = (comparisonOperator) => [
|
|
|
280
282
|
"q/where": [
|
|
281
283
|
"q/in",
|
|
282
284
|
["fibery/id"],
|
|
283
|
-
(0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => (
|
|
285
|
+
(0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => (Array.isArray(x) && x.every((item) => isValidReferenceUUID(item))) || (0, operator_utils_1.isNoValue)(x)),
|
|
284
286
|
],
|
|
285
287
|
"q/limit": "q/no-limit",
|
|
286
288
|
},
|
|
@@ -288,7 +290,7 @@ const getCollectionContainsAnyOfPattern = (comparisonOperator) => [
|
|
|
288
290
|
];
|
|
289
291
|
const collectionContainsAnyOfPattern = getCollectionContainsAnyOfPattern(">");
|
|
290
292
|
const collectionDoesNotContainAnyOfPattern = getCollectionContainsAnyOfPattern("=");
|
|
291
|
-
const collectionContainsPattern = getCollectionContainsPattern((x) => isValidReferenceUUID(x) ||
|
|
293
|
+
const collectionContainsPattern = getCollectionContainsPattern((x) => isValidReferenceUUID(x) || (0, operator_utils_1.isNoValue)(x));
|
|
292
294
|
const collectionContainsMePattern = getCollectionContainsPattern((x) => x === "$my-id");
|
|
293
295
|
const getCollectionDoesNotContainPattern = (paramMatchFn) => [
|
|
294
296
|
"=",
|
|
@@ -300,7 +302,7 @@ const getCollectionDoesNotContainPattern = (paramMatchFn) => [
|
|
|
300
302
|
},
|
|
301
303
|
(0, patternMatchPlaceholders_1.getConstantPlaceholder)(0),
|
|
302
304
|
];
|
|
303
|
-
const collectionDoesNotContainPattern = getCollectionDoesNotContainPattern((x) => isValidReferenceUUID(x) ||
|
|
305
|
+
const collectionDoesNotContainPattern = getCollectionDoesNotContainPattern((x) => isValidReferenceUUID(x) || (0, operator_utils_1.isNoValue)(x));
|
|
304
306
|
const collectionDoesNotContainMePattern = getCollectionDoesNotContainPattern((x) => x === "$my-id");
|
|
305
307
|
exports.operatorCollectionContains = {
|
|
306
308
|
id: ":operator/collection-contains",
|
|
@@ -345,7 +347,7 @@ exports.operatorCollectionContainsMe = getOperatorCollectionMe({
|
|
|
345
347
|
pattern: collectionContainsMePattern,
|
|
346
348
|
});
|
|
347
349
|
const withoutLastIdAccess = (expression) => {
|
|
348
|
-
if (
|
|
350
|
+
if ((0, last_1.default)(expression) !== "fibery/id") {
|
|
349
351
|
throw new Error("not supported");
|
|
350
352
|
}
|
|
351
353
|
return expression.slice(0, -1);
|
|
@@ -536,11 +538,11 @@ exports.operatorDateTimeIs = {
|
|
|
536
538
|
[">=", patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)()],
|
|
537
539
|
["<=", patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)()],
|
|
538
540
|
], typeObject);
|
|
539
|
-
if (matchSuccess &&
|
|
541
|
+
if (matchSuccess && (0, isEqual_1.default)(firstFieldMatch.value, secondFieldMatch.value)) {
|
|
540
542
|
const firstParamValue = firstParamMatch.value;
|
|
541
543
|
const secondParamValue = secondParamMatch.value;
|
|
542
544
|
if (params_placeholders_1.paramsPlaceholdersLookup[firstParamValue] && params_placeholders_1.paramsPlaceholdersLookup[secondParamValue]) {
|
|
543
|
-
const value =
|
|
545
|
+
const value = (0, findKey_1.default)(params_placeholders_1.dateToDateTimeIntervalLookup, (val) => val.start === firstParamValue && val.end === secondParamValue);
|
|
544
546
|
return {
|
|
545
547
|
matchSuccess,
|
|
546
548
|
expression: firstFieldMatch.value,
|
|
@@ -563,7 +565,11 @@ exports.operatorDateTimeIs = {
|
|
|
563
565
|
}
|
|
564
566
|
}
|
|
565
567
|
{
|
|
566
|
-
const { matchSuccess, matches: [fieldMatch, paramMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, [
|
|
568
|
+
const { matchSuccess, matches: [fieldMatch, paramMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, [
|
|
569
|
+
"=",
|
|
570
|
+
patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder,
|
|
571
|
+
(0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => ((0, isString_1.default)(x) && (0, operator_utils_1.isDateTime)(x)) || (0, operator_utils_1.isNoValue)(x)),
|
|
572
|
+
], typeObject);
|
|
567
573
|
if (matchSuccess) {
|
|
568
574
|
return {
|
|
569
575
|
matchSuccess,
|
|
@@ -725,7 +731,7 @@ exports.operatorsGroupsWithoutMe = {
|
|
|
725
731
|
],
|
|
726
732
|
":filter-type/user-role": [exports.operatorUserRoleIsAnyOf],
|
|
727
733
|
};
|
|
728
|
-
exports.operatorsGroups =
|
|
734
|
+
exports.operatorsGroups = (0, mapValues_1.default)(exports.operatorsGroupsWithoutMe, (value, key) => {
|
|
729
735
|
if (key === ":filter-type/user-reference") {
|
|
730
736
|
return [exports.operatorReferenceIsMe, exports.operatorReferenceIsNotMe].concat(value);
|
|
731
737
|
}
|
|
@@ -736,7 +742,7 @@ exports.operatorsGroups = lodash_1.default.mapValues(exports.operatorsGroupsWith
|
|
|
736
742
|
return value;
|
|
737
743
|
}
|
|
738
744
|
});
|
|
739
|
-
exports.operators =
|
|
745
|
+
exports.operators = (0, uniq_1.default)((0, flatten_1.default)(Object.values(exports.operatorsGroups))).concat([
|
|
740
746
|
// these operators are used only for backward compatibility. You can't select them on UI.
|
|
741
747
|
// https://the.fibery.io/SoftDev/User~Story/Empty-operator-in-Filters-on-view-should-work-the-same-way-as-IsEmpty-in-formulas-1972
|
|
742
748
|
exports.operatorTextIsEmptyV1,
|