@fibery/expression-utils 17.0.4 → 17.0.6
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/_virtual/_rolldown/runtime.js +1 -2
- package/lib/context-variables.d.ts +0 -1
- package/lib/context-variables.js +1 -2
- package/lib/errors.d.ts +1 -3
- package/lib/errors.js +1 -2
- package/lib/field-expression-visitor-type-aware.d.ts +1 -3
- package/lib/field-expression-visitor-type-aware.js +1 -2
- package/lib/filter-expression/index.d.ts +1 -3
- package/lib/filter-expression/index.js +1 -2
- package/lib/filter-expression/operator-utils.d.ts +1 -3
- package/lib/filter-expression/operator-utils.js +3 -4
- package/lib/filter-expression/operators.d.ts +17 -2
- package/lib/filter-expression/operators.js +31 -7
- package/lib/filter-expression/pattern-match-placeholders.d.ts +5 -3
- package/lib/filter-expression/pattern-match-placeholders.js +3 -3
- package/lib/filter-expression/pattern-match.d.ts +1 -3
- package/lib/filter-expression/pattern-match.js +1 -2
- package/lib/filter-expression/pattern-to-expression.d.ts +1 -3
- package/lib/filter-expression/pattern-to-expression.js +1 -2
- package/lib/filter-expression/types.d.ts +1 -3
- package/lib/index.d.ts +2 -4
- package/lib/index.js +4 -5
- package/lib/params-placeholders.d.ts +0 -1
- package/lib/params-placeholders.js +1 -2
- package/lib/select.test-d.d.ts +1 -3
- package/lib/select.test-d.js +1 -2
- package/lib/types.d.ts +0 -2
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +1 -2
- package/lib/visitors.d.ts +1 -2
- package/lib/visitors.js +4 -5
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __exportAll = (all, no_symbols) => {
|
|
4
4
|
let target = {};
|
|
@@ -9,5 +9,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
9
9
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
10
|
return target;
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { __exportAll };
|
package/lib/context-variables.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import flatten from "lodash/flatten.js";
|
|
3
3
|
import groupBy from "lodash/groupBy.js";
|
|
4
4
|
import uniqBy from "lodash/uniqBy.js";
|
|
5
|
-
|
|
5
|
+
// src/context-variables.ts
|
|
6
6
|
var context_variables_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
currentUserContextVariableId: () => currentUserContextVariableId,
|
|
8
8
|
getAutomationButtonContextVariables: () => getAutomationButtonContextVariables,
|
|
@@ -111,5 +111,4 @@ const getEntityQueryVariables = (schema) => {
|
|
|
111
111
|
}));
|
|
112
112
|
}));
|
|
113
113
|
};
|
|
114
|
-
//#endregion
|
|
115
114
|
export { context_variables_exports, currentUserContextVariableId, getAutomationButtonContextVariables, getAutomationTriggersContextVariables, getEntityQueryVariables, getTriggerCollectionFieldObject, previousTriggeredEntityContextVariableId, triggeredCollectionItemContextVariableId, triggeredEntityContextVariableId };
|
package/lib/errors.d.ts
CHANGED
package/lib/errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/errors.ts
|
|
2
2
|
const stringify = (x) => {
|
|
3
3
|
if (x === void 0) return "undefined";
|
|
4
4
|
return JSON.stringify(x);
|
|
@@ -12,5 +12,4 @@ var NotImplementedError = class extends Error {
|
|
|
12
12
|
].filter((x) => x !== void 0).join(" "));
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { NotImplementedError };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ExpressionVisitor, FieldExpression as FieldExpression$1, MultiFieldAccess } from "./types.js";
|
|
2
2
|
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
3
|
-
//#region src/field-expression-visitor-type-aware.d.ts
|
|
4
3
|
type FieldAccess = string | MultiFieldAccess;
|
|
5
4
|
type OnFieldResult = {
|
|
6
5
|
typeObject: TypeObject;
|
|
@@ -20,5 +19,4 @@ export declare const fieldAccessVisitorTypeAware: ({ typeObject, onField, onFiel
|
|
|
20
19
|
typeObject: TypeObject;
|
|
21
20
|
onField?: OnField;
|
|
22
21
|
onFieldNotFound?: OnFieldNotFound;
|
|
23
|
-
}) => Required<ExpressionVisitor>;
|
|
24
|
-
//#endregion
|
|
22
|
+
}) => Required<ExpressionVisitor>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createExpressionVisitor, isMultiFieldAccess } from "./utils.js";
|
|
2
2
|
import { mapValues } from "@fibery/helpers/src/object";
|
|
3
3
|
import isPlainObject from "lodash/isPlainObject.js";
|
|
4
|
-
|
|
4
|
+
// src/field-expression-visitor-type-aware.ts
|
|
5
5
|
const visitFieldExpression = ({ expression: fieldExpression, typeObject: initialTypeObject, onField, onFieldNotFound }) => fieldExpression.reduce(({ typeObject, expression }, fieldAccess) => {
|
|
6
6
|
const fieldObject = typeObject ? typeObject.getFieldObjectById(isMultiFieldAccess(fieldAccess) ? fieldAccess[0] : fieldAccess) : void 0;
|
|
7
7
|
if (fieldObject && isMultiFieldAccess(fieldAccess)) {
|
|
@@ -115,5 +115,4 @@ const fieldAccessVisitorTypeAware = ({ typeObject, onField = defaultOnField, onF
|
|
|
115
115
|
onFieldNotFound
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
|
-
//#endregion
|
|
119
118
|
export { fieldAccessVisitorTypeAware };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ExpressionArgument as ExpressionArgument$1 } from "../types.js";
|
|
2
2
|
import { Operator } from "./types.js";
|
|
3
3
|
import { Schema } from "@fibery/schema";
|
|
4
|
-
//#region src/filter-expression/index.d.ts
|
|
5
4
|
export declare const findMatchedFilter: (filterExpression: ExpressionArgument$1, params: Record<string, unknown>, operators: Array<Operator>, schema: Schema | null, type: string) => {
|
|
6
5
|
operator: Operator;
|
|
7
6
|
value: unknown;
|
|
8
7
|
expression: import("@fibery/schema").Expression;
|
|
9
8
|
type: string;
|
|
10
9
|
id: string;
|
|
11
|
-
} | null;
|
|
12
|
-
//#endregion
|
|
10
|
+
} | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NotImplementedError } from "../errors.js";
|
|
2
2
|
import { doPatternMatch, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
3
3
|
import { v4 } from "uuid";
|
|
4
|
-
|
|
4
|
+
// src/filter-expression/index.ts
|
|
5
5
|
const findMatchedFilter = (filterExpression, params, operators, schema, type) => {
|
|
6
6
|
const typeObject = schema?.getTypeObjectByName(type);
|
|
7
7
|
if (!typeObject) return null;
|
|
@@ -33,5 +33,4 @@ const findMatchedFilter = (filterExpression, params, operators, schema, type) =>
|
|
|
33
33
|
}
|
|
34
34
|
return null;
|
|
35
35
|
};
|
|
36
|
-
//#endregion
|
|
37
36
|
export { findMatchedFilter };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Expression } from "../types.js";
|
|
2
2
|
import { ConvertResult, CustomMatchFn, ExpressionPlaceholder, Operator } from "./types.js";
|
|
3
|
-
//#region src/filter-expression/operator-utils.d.ts
|
|
4
3
|
export declare const isDateTime: (dateString: string) => boolean;
|
|
5
4
|
export declare const NO_VALUE: undefined;
|
|
6
5
|
export declare const isNoValue: (value: unknown) => boolean;
|
|
7
6
|
export declare const getCompareOperatorForDateTime: (id: string, title: string, operator: string, compareByStartInterval: boolean, isNegative: boolean) => Operator;
|
|
8
7
|
export declare const getWithinOperatorCustomConvertFn: (leftPartExcluded: boolean) => (expression: Expression, value: unknown, getNextParamName: () => string) => ConvertResult;
|
|
9
|
-
export declare const getWithinOperatorCustomMatchFn: (fieldPlaceholder: ExpressionPlaceholder, leftPartExcluded: boolean) => CustomMatchFn;
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare const getWithinOperatorCustomMatchFn: (fieldPlaceholder: ExpressionPlaceholder, leftPartExcluded: boolean) => CustomMatchFn;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { doPatternMatch, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
2
1
|
import { dateToDateTimeIntervalLookup, monthAgoDateParamPlaceholder, monthAgoStartDateTimeParamPlaceholder, monthFromNowDateParamPlaceholder, monthFromNowEndDateTimeParamPlaceholder, paramsPlaceholdersLookup, parseRelativeDatePlaceholder, toRelativeDatePlaceholder, todayDateParamPlaceholder, todayEndDateTimeParamPlaceholder, weekAgoDateParamPlaceholder, weekAgoStartDateTimeParamPlaceholder, weekFromNowDateParamPlaceholder, weekFromNowEndDateTimeParamPlaceholder, yearAgoDateParamPlaceholder, yearAgoStartDateTimeParamPlaceholder, yearFromNowDateParamPlaceholder, yearFromNowEndDateTimeParamPlaceholder } from "../params-placeholders.js";
|
|
3
2
|
import { dateTimeOrDateTimeRangeExpressionPlaceholder, getParamPlaceholder } from "./pattern-match-placeholders.js";
|
|
3
|
+
import { doPatternMatch, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
4
4
|
import { isObjectLike } from "@fibery/helpers/src/object";
|
|
5
5
|
import isString from "lodash/isString.js";
|
|
6
6
|
import { deepEqual } from "@fibery/helpers/src/equal";
|
|
7
7
|
import findKey from "lodash/findKey.js";
|
|
8
|
-
|
|
8
|
+
// src/filter-expression/operator-utils.ts
|
|
9
9
|
const isDateTime = (dateString) => dateString.length === 24 || dateString.length === 10;
|
|
10
10
|
const NO_VALUE = void 0;
|
|
11
11
|
const isNoValue = (value) => {
|
|
@@ -53,7 +53,7 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
|
|
|
53
53
|
},
|
|
54
54
|
customConvertToWhereExpression: (expression, value, getNextParamName) => {
|
|
55
55
|
const dateTimePlaceholders = typeof value === "string" ? dateToDateTimeIntervalLookup[value] : void 0;
|
|
56
|
-
let relativeDateInfo
|
|
56
|
+
let relativeDateInfo;
|
|
57
57
|
if (dateTimePlaceholders) {
|
|
58
58
|
const { start, end } = dateTimePlaceholders;
|
|
59
59
|
const intervalParamName = compareByStartInterval ? start : end;
|
|
@@ -205,5 +205,4 @@ const getWithinOperatorCustomMatchFn = (fieldPlaceholder, leftPartExcluded) => {
|
|
|
205
205
|
return match;
|
|
206
206
|
};
|
|
207
207
|
};
|
|
208
|
-
//#endregion
|
|
209
208
|
export { NO_VALUE, getCompareOperatorForDateTime, getWithinOperatorCustomConvertFn, getWithinOperatorCustomMatchFn, isDateTime, isNoValue };
|
|
@@ -2,7 +2,7 @@ import { Expression as Expression$1, ExpressionArgument as ExpressionArgument$1
|
|
|
2
2
|
import { Operator } from "./types.js";
|
|
3
3
|
import { TypeObject } from "@fibery/schema";
|
|
4
4
|
declare namespace operators_d_exports {
|
|
5
|
-
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, withoutLastIdAccess };
|
|
5
|
+
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, operatorJsonIsEmpty, operatorJsonIsNotEmpty, 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, withoutLastIdAccess };
|
|
6
6
|
}
|
|
7
7
|
export declare const operatorReferenceIsMe: Operator;
|
|
8
8
|
export declare const operatorReferenceIsNotMe: Operator;
|
|
@@ -56,6 +56,8 @@ export declare const operatorLocationContains: Operator;
|
|
|
56
56
|
export declare const operatorLocationDoesNotContain: Operator;
|
|
57
57
|
export declare const operatorLocationIsEmpty: Operator;
|
|
58
58
|
export declare const operatorLocationIsNotEmpty: Operator;
|
|
59
|
+
export declare const operatorJsonIsEmpty: Operator;
|
|
60
|
+
export declare const operatorJsonIsNotEmpty: Operator;
|
|
59
61
|
export declare const operatorCollectionContains: Operator;
|
|
60
62
|
export declare const operatorCollectionContainsMe: Operator;
|
|
61
63
|
export declare const withoutLastIdAccess: (expression: Expression$1) => Expression$1;
|
|
@@ -112,6 +114,7 @@ export declare const operatorsGroupsWithoutMe: {
|
|
|
112
114
|
":filter-type/location": Operator[];
|
|
113
115
|
":filter-type/user-role": Operator[];
|
|
114
116
|
":filter-type/collection-count": Operator[];
|
|
117
|
+
":filter-type/json": Operator[];
|
|
115
118
|
};
|
|
116
119
|
export declare const operatorsGroups: {
|
|
117
120
|
":filter-type/comment-reference-collection": (Operator | {
|
|
@@ -335,6 +338,19 @@ export declare const operatorsGroups: {
|
|
|
335
338
|
type: string;
|
|
336
339
|
isNegative: false;
|
|
337
340
|
})[];
|
|
341
|
+
":filter-type/json": (Operator | {
|
|
342
|
+
id: string;
|
|
343
|
+
title: string;
|
|
344
|
+
pattern: (string | {
|
|
345
|
+
id: ":expression-pattern/expression-placeholder";
|
|
346
|
+
matchFn: (expression: ExpressionArgument$1, typeObject: TypeObject) => boolean;
|
|
347
|
+
} | {
|
|
348
|
+
id: ":expression-pattern/param-placeholder";
|
|
349
|
+
matchFn: (_x: unknown) => boolean;
|
|
350
|
+
})[];
|
|
351
|
+
type: string;
|
|
352
|
+
isNegative: false;
|
|
353
|
+
})[];
|
|
338
354
|
};
|
|
339
355
|
export declare const operators: (Operator | {
|
|
340
356
|
id: string;
|
|
@@ -350,5 +366,4 @@ export declare const operators: (Operator | {
|
|
|
350
366
|
isNegative: false;
|
|
351
367
|
})[];
|
|
352
368
|
export declare const hiddenValidOperators: Operator[];
|
|
353
|
-
//#endregion
|
|
354
369
|
export { operators_d_exports };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { doPatternMatch, getExpressionArrayMatchValue, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
3
2
|
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
3
|
import { getCompareOperatorForDateTime, getWithinOperatorCustomConvertFn, getWithinOperatorCustomMatchFn, isDateTime, isNoValue } from "./operator-utils.js";
|
|
4
|
+
import { anyDateExpressionPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, jsonFieldPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, textFieldPlaceholder } from "./pattern-match-placeholders.js";
|
|
5
|
+
import { doPatternMatch, getExpressionArrayMatchValue, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
6
6
|
import { convertToExpression } from "./pattern-to-expression.js";
|
|
7
7
|
import flatten from "lodash/flatten.js";
|
|
8
8
|
import { mapValues } from "@fibery/helpers/src/object";
|
|
@@ -12,7 +12,7 @@ import { deepEqual } from "@fibery/helpers/src/equal";
|
|
|
12
12
|
import { isUuid } from "@fibery/helpers/src/id";
|
|
13
13
|
import findKey from "lodash/findKey.js";
|
|
14
14
|
import uniq from "lodash/uniq.js";
|
|
15
|
-
|
|
15
|
+
// src/filter-expression/operators.ts
|
|
16
16
|
var operators_exports = /* @__PURE__ */ __exportAll({
|
|
17
17
|
hiddenValidOperators: () => hiddenValidOperators,
|
|
18
18
|
operatorBoolIs: () => operatorBoolIs,
|
|
@@ -48,6 +48,8 @@ var operators_exports = /* @__PURE__ */ __exportAll({
|
|
|
48
48
|
operatorDateTimeIsWithin: () => operatorDateTimeIsWithin,
|
|
49
49
|
operatorGreaterThan: () => operatorGreaterThan,
|
|
50
50
|
operatorGreaterThanOrEqual: () => operatorGreaterThanOrEqual,
|
|
51
|
+
operatorJsonIsEmpty: () => operatorJsonIsEmpty,
|
|
52
|
+
operatorJsonIsNotEmpty: () => operatorJsonIsNotEmpty,
|
|
51
53
|
operatorLessThan: () => operatorLessThan,
|
|
52
54
|
operatorLessThanOrEqual: () => operatorLessThanOrEqual,
|
|
53
55
|
operatorLocationContains: () => operatorLocationContains,
|
|
@@ -547,6 +549,28 @@ const operatorLocationIsNotEmpty = {
|
|
|
547
549
|
type: ":operator-type/unary",
|
|
548
550
|
isNegative: true
|
|
549
551
|
};
|
|
552
|
+
const operatorJsonIsEmpty = {
|
|
553
|
+
id: ":operator/json-is-empty",
|
|
554
|
+
title: "is empty",
|
|
555
|
+
pattern: [
|
|
556
|
+
"=",
|
|
557
|
+
jsonFieldPlaceholder,
|
|
558
|
+
getConstantPlaceholder(null)
|
|
559
|
+
],
|
|
560
|
+
type: ":operator-type/unary",
|
|
561
|
+
isNegative: false
|
|
562
|
+
};
|
|
563
|
+
const operatorJsonIsNotEmpty = {
|
|
564
|
+
id: ":operator/json-is-not-empty",
|
|
565
|
+
title: "is not empty",
|
|
566
|
+
pattern: [
|
|
567
|
+
"!=",
|
|
568
|
+
jsonFieldPlaceholder,
|
|
569
|
+
getConstantPlaceholder(null)
|
|
570
|
+
],
|
|
571
|
+
type: ":operator-type/unary",
|
|
572
|
+
isNegative: true
|
|
573
|
+
};
|
|
550
574
|
const getCollectionContainsPattern = (paramMatchFn) => {
|
|
551
575
|
return [
|
|
552
576
|
">",
|
|
@@ -948,7 +972,7 @@ const operatorDateTimeIs = {
|
|
|
948
972
|
},
|
|
949
973
|
customConvertToWhereExpression: (expression, value, getNextParamName) => {
|
|
950
974
|
const dateTimePlaceholders = typeof value === "string" ? dateToDateTimeIntervalLookup[value] : void 0;
|
|
951
|
-
let relativeDateInfo
|
|
975
|
+
let relativeDateInfo;
|
|
952
976
|
if (dateTimePlaceholders) {
|
|
953
977
|
const { start, end } = dateTimePlaceholders;
|
|
954
978
|
return {
|
|
@@ -1134,7 +1158,8 @@ const operatorsGroupsWithoutMe = {
|
|
|
1134
1158
|
operatorCollectionCountLessThan,
|
|
1135
1159
|
operatorCollectionCountGreaterThanOrEqual,
|
|
1136
1160
|
operatorCollectionCountLessThanOrEqual
|
|
1137
|
-
]
|
|
1161
|
+
],
|
|
1162
|
+
":filter-type/json": [operatorJsonIsEmpty, operatorJsonIsNotEmpty]
|
|
1138
1163
|
};
|
|
1139
1164
|
const operatorsGroups = mapValues(operatorsGroupsWithoutMe, (value, key) => {
|
|
1140
1165
|
if (key === ":filter-type/user-reference") return [operatorReferenceIsMe, operatorReferenceIsNotMe].concat(value);
|
|
@@ -1151,5 +1176,4 @@ const operators = uniq(flatten(Object.values(operatorsGroups))).concat([
|
|
|
1151
1176
|
operatorTextExactlyIs
|
|
1152
1177
|
]);
|
|
1153
1178
|
const hiddenValidOperators = [operatorTextExactlyIs];
|
|
1154
|
-
|
|
1155
|
-
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 };
|
|
1179
|
+
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, operatorJsonIsEmpty, operatorJsonIsNotEmpty, 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 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ExpressionArgument as ExpressionArgument$1 } from "../types.js";
|
|
2
2
|
import { TypeObject } from "@fibery/schema";
|
|
3
|
-
//#region src/filter-expression/pattern-match-placeholders.d.ts
|
|
4
3
|
type MatchFn = (expression: ExpressionArgument$1, typeObject: TypeObject) => boolean;
|
|
5
4
|
export declare const anyExpressionPlaceholder: {
|
|
6
5
|
id: ":expression-pattern/expression-placeholder";
|
|
@@ -38,6 +37,10 @@ export declare const locationFieldPlaceholder: {
|
|
|
38
37
|
id: ":expression-pattern/expression-placeholder";
|
|
39
38
|
matchFn: MatchFn;
|
|
40
39
|
};
|
|
40
|
+
export declare const jsonFieldPlaceholder: {
|
|
41
|
+
id: ":expression-pattern/expression-placeholder";
|
|
42
|
+
matchFn: MatchFn;
|
|
43
|
+
};
|
|
41
44
|
export declare const referenceCollectionFieldPlaceholder: {
|
|
42
45
|
id: ":expression-pattern/expression-placeholder";
|
|
43
46
|
matchFn: MatchFn;
|
|
@@ -78,5 +81,4 @@ export declare const getConstantPlaceholder: (value: unknown) => {
|
|
|
78
81
|
export declare const referenceTitleOrRankExpressionPlaceholder: {
|
|
79
82
|
id: ":expression-pattern/expression-placeholder";
|
|
80
83
|
matchFn: (expression: ExpressionArgument$1, typeObject: TypeObject) => boolean;
|
|
81
|
-
};
|
|
82
|
-
//#endregion
|
|
84
|
+
};
|
|
@@ -3,7 +3,7 @@ import isString from "lodash/isString.js";
|
|
|
3
3
|
import last from "lodash/last.js";
|
|
4
4
|
import { previousTriggeredEntityContextVariableId } from "@fibery/expression-utils/src/context-variables";
|
|
5
5
|
import drop from "lodash/drop.js";
|
|
6
|
-
|
|
6
|
+
// src/filter-expression/pattern-match-placeholders.ts
|
|
7
7
|
const getFieldPlaceholder = (fieldObjectMatchFn) => {
|
|
8
8
|
const matchFn = (expression, typeObject) => {
|
|
9
9
|
if (isString(expression)) {
|
|
@@ -82,6 +82,7 @@ const dateTimeFieldPlaceholder = getFieldPlaceholder((fieldObject) => {
|
|
|
82
82
|
});
|
|
83
83
|
const boolFieldPlaceholder = getFieldPlaceholder((fieldObject) => fieldObject.type === "fibery/bool");
|
|
84
84
|
const locationFieldPlaceholder = getFieldPlaceholder((fieldObject) => fieldObject.type === "fibery/location");
|
|
85
|
+
const jsonFieldPlaceholder = getFieldPlaceholder((fieldObject) => fieldObject.type === "fibery/json");
|
|
85
86
|
const referenceCollectionFieldPlaceholder = getFieldPlaceholder((fieldObject) => {
|
|
86
87
|
return !fieldObject.typeObject.isPrimitive && fieldObject.isCollection;
|
|
87
88
|
});
|
|
@@ -125,5 +126,4 @@ const referenceTitleOrRankExpressionPlaceholder = {
|
|
|
125
126
|
return !fieldObjects[0].typeObject.isPrimitive && !fieldObjects[0].isCollection && (fieldObjects[1].isTitle || fieldObjects[1] === fieldObjects[1].holderTypeObject.rankFieldObject);
|
|
126
127
|
}
|
|
127
128
|
};
|
|
128
|
-
|
|
129
|
-
export { anyDateExpressionPlaceholder, anyExpressionPlaceholder, basicFieldPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateFieldPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeFieldPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, idFieldPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, referenceTitleOrRankExpressionPlaceholder, textFieldPlaceholder };
|
|
129
|
+
export { anyDateExpressionPlaceholder, anyExpressionPlaceholder, basicFieldPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateFieldPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeFieldPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, idFieldPlaceholder, jsonFieldPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, referenceTitleOrRankExpressionPlaceholder, textFieldPlaceholder };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Expression as Expression$1, ExpressionArgument as ExpressionArgument$1 } from "../types.js";
|
|
2
2
|
import { PatternNode } from "./types.js";
|
|
3
3
|
import { TypeObject } from "@fibery/schema";
|
|
4
|
-
//#region src/filter-expression/pattern-match.d.ts
|
|
5
4
|
export type ParamPatternMatch = {
|
|
6
5
|
matchType: ":expression-match-type/param";
|
|
7
6
|
value: unknown;
|
|
@@ -18,5 +17,4 @@ export type PatternMatchResult = {
|
|
|
18
17
|
matchSuccess: boolean;
|
|
19
18
|
matches: PatternMatch[];
|
|
20
19
|
};
|
|
21
|
-
export declare const doPatternMatch: (expression: unknown, params: Record<string, unknown>, pattern: PatternNode, typeObject: TypeObject) => PatternMatchResult;
|
|
22
|
-
//#endregion
|
|
20
|
+
export declare const doPatternMatch: (expression: unknown, params: Record<string, unknown>, pattern: PatternNode, typeObject: TypeObject) => PatternMatchResult;
|
|
@@ -2,7 +2,7 @@ import { getFieldObjectByFieldExpression, isFieldExpressionValid, isVariableExpr
|
|
|
2
2
|
import { isObjectLike } from "@fibery/helpers/src/object";
|
|
3
3
|
import isPlainObject from "lodash/isPlainObject.js";
|
|
4
4
|
import isString from "lodash/isString.js";
|
|
5
|
-
|
|
5
|
+
// src/filter-expression/pattern-match.ts
|
|
6
6
|
const isPlaceholderNode = (node) => {
|
|
7
7
|
if (typeof node !== "object" || node === null || Array.isArray(node)) return false;
|
|
8
8
|
const { id, matchFn } = node;
|
|
@@ -112,5 +112,4 @@ const doPatternMatch = (expression, params, pattern, typeObject) => {
|
|
|
112
112
|
matches
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
|
-
//#endregion
|
|
116
115
|
export { doPatternMatch, getExpressionArrayMatchValue, isExpressionPatternMatch, isParamPatternMatch };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { Expression } from "../types.js";
|
|
2
2
|
import { ConvertResult, PatternNode } from "./types.js";
|
|
3
|
-
|
|
4
|
-
export declare const convertToExpression: (pattern: PatternNode[], filterExpression: Expression, value: unknown, getNextParamName: () => string) => ConvertResult;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare const convertToExpression: (pattern: PatternNode[], filterExpression: Expression, value: unknown, getNextParamName: () => string) => ConvertResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { paramsPlaceholdersLookup, parseRelativeDatePlaceholder } from "../params-placeholders.js";
|
|
2
|
-
|
|
2
|
+
// src/filter-expression/pattern-to-expression.ts
|
|
3
3
|
const isPlaceholderNode = (node) => {
|
|
4
4
|
if (typeof node !== "object" || node === null || Array.isArray(node)) return false;
|
|
5
5
|
const { id, matchFn } = node;
|
|
@@ -38,5 +38,4 @@ const convertToExpression = (pattern, filterExpression, value, getNextParamName)
|
|
|
38
38
|
params
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
//#endregion
|
|
42
41
|
export { convertToExpression };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Expression as Expression$1, ExpressionArgument as ExpressionArgument$1, QueryLimit } from "../types.js";
|
|
2
2
|
import { TypeObject } from "@fibery/schema";
|
|
3
|
-
//#region src/filter-expression/types.d.ts
|
|
4
3
|
export type CustomMatchResult = {
|
|
5
4
|
matchSuccess: false;
|
|
6
5
|
} | {
|
|
@@ -51,5 +50,4 @@ export type ExpressionToFilterBy = {
|
|
|
51
50
|
type: string;
|
|
52
51
|
}>;
|
|
53
52
|
calculateRelationFieldExpressions?: () => ExpressionToFilterBy[];
|
|
54
|
-
};
|
|
55
|
-
//#endregion
|
|
53
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { ContextVariable, context_variables_d_exports } from "./context-variables.js";
|
|
2
|
-
import { Expression, ExpressionArgument, ExpressionVisitor, ExpressionVisitorWithDefault, FieldExpression, FromRootExpression, FunctionCallExpression, MultiFieldAccess, NormalizedProjection, NormalizedSelect, OrderBy, Query, Select, SubQuery } from "./types.js";
|
|
3
|
-
import { ExpressionToFilterBy, Operator } from "./filter-expression/types.js";
|
|
4
2
|
import { findMatchedFilter } from "./filter-expression/index.js";
|
|
5
3
|
import { operators_d_exports } from "./filter-expression/operators.js";
|
|
6
4
|
import { convertToExpression } from "./filter-expression/pattern-to-expression.js";
|
|
7
5
|
import { params_placeholders_d_exports } from "./params-placeholders.js";
|
|
8
6
|
import { utils_d_exports } from "./utils.js";
|
|
9
7
|
import { visitors_d_exports } from "./visitors.js";
|
|
10
|
-
|
|
8
|
+
import { Expression, ExpressionArgument, ExpressionVisitor, ExpressionVisitorWithDefault, FieldExpression, FromRootExpression, FunctionCallExpression, MultiFieldAccess, NormalizedProjection, NormalizedSelect, OrderBy, Query, Select, SubQuery } from "./types.js";
|
|
9
|
+
import { ExpressionToFilterBy, Operator } from "./filter-expression/types.js";
|
|
11
10
|
declare const filterExpression: {
|
|
12
11
|
findMatchedFilter: typeof findMatchedFilter;
|
|
13
12
|
operators: typeof operators_d_exports;
|
|
14
13
|
convertToExpression: typeof convertToExpression;
|
|
15
14
|
};
|
|
16
|
-
//#endregion
|
|
17
15
|
export { type ContextVariable, type Expression, type ExpressionArgument, type ExpressionToFilterBy, type ExpressionVisitor, type ExpressionVisitorWithDefault, type FieldExpression, type FromRootExpression, type FunctionCallExpression, type MultiFieldAccess, type NormalizedProjection, type NormalizedSelect, type Operator, type OrderBy, type Query, type Select, type SubQuery, context_variables_d_exports as contextVariables, filterExpression, params_placeholders_d_exports as paramsPlaceholders, utils_d_exports as utils, visitors_d_exports as visitors };
|
package/lib/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { context_variables_exports } from "./context-variables.js";
|
|
2
|
-
import { utils_exports } from "./utils.js";
|
|
3
2
|
import { findMatchedFilter } from "./filter-expression/index.js";
|
|
4
|
-
import { params_placeholders_exports } from "./params-placeholders.js";
|
|
5
|
-
import { convertToExpression } from "./filter-expression/pattern-to-expression.js";
|
|
6
3
|
import { operators_exports } from "./filter-expression/operators.js";
|
|
4
|
+
import { convertToExpression } from "./filter-expression/pattern-to-expression.js";
|
|
5
|
+
import { params_placeholders_exports } from "./params-placeholders.js";
|
|
6
|
+
import { utils_exports } from "./utils.js";
|
|
7
7
|
import { visitors_exports } from "./visitors.js";
|
|
8
|
-
|
|
8
|
+
// src/index.ts
|
|
9
9
|
const filterExpression = {
|
|
10
10
|
findMatchedFilter,
|
|
11
11
|
operators: operators_exports,
|
|
12
12
|
convertToExpression
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { context_variables_exports as contextVariables, filterExpression, params_placeholders_exports as paramsPlaceholders, utils_exports as utils, visitors_exports as visitors };
|
|
@@ -2,7 +2,7 @@ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { mapValues } from "@fibery/helpers/src/object";
|
|
3
3
|
import isString from "lodash/isString.js";
|
|
4
4
|
import moment from "moment";
|
|
5
|
-
|
|
5
|
+
// src/params-placeholders.ts
|
|
6
6
|
var params_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
dateToDateTimeIntervalLookup: () => dateToDateTimeIntervalLookup,
|
|
8
8
|
dynamicFilterParamPrefix: () => dynamicFilterParamPrefix,
|
|
@@ -211,5 +211,4 @@ const dateToDateTimeIntervalLookup = {
|
|
|
211
211
|
end: yearFromNowEndDateTimeParamPlaceholder
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
|
-
//#endregion
|
|
215
214
|
export { dateToDateTimeIntervalLookup, dynamicFilterParamPrefix, formulaNowDateTimeParamPlaceholder, formulaTodayDateParamPlaceholder, getFieldIdFromDynamicParam, getRelativeDateValue, getRelativeMomentDate, isDynamicFilterParam, mapDynamicParams, monthAgoDateParamPlaceholder, monthAgoEndDateTimeParamPlaceholder, monthAgoStartDateTimeParamPlaceholder, monthFromNowDateParamPlaceholder, monthFromNowEndDateTimeParamPlaceholder, monthFromNowStartDateTimeParamPlaceholder, paramsPlaceholdersLookup, params_placeholders_exports, parseRelativeDatePlaceholder, replacePlaceholdersInParams, toRelativeDatePlaceholder, todayDateParamPlaceholder, todayEndDateTimeParamPlaceholder, todayStartDateTimeParamPlaceholder, tomorrowDateParamPlaceholder, tomorrowEndDateTimeParamPlaceholder, tomorrowStartDateTimeParamPlaceholder, weekAgoDateParamPlaceholder, weekAgoEndDateTimeParamPlaceholder, weekAgoStartDateTimeParamPlaceholder, weekFromNowDateParamPlaceholder, weekFromNowEndDateTimeParamPlaceholder, weekFromNowStartDateTimeParamPlaceholder, whereParamPrefix, yearAgoDateParamPlaceholder, yearAgoEndDateTimeParamPlaceholder, yearAgoStartDateTimeParamPlaceholder, yearFromNowDateParamPlaceholder, yearFromNowEndDateTimeParamPlaceholder, yearFromNowStartDateTimeParamPlaceholder, yesterdayDateParamPlaceholder, yesterdayEndDateTimeParamPlaceholder, yesterdayStartDateTimeParamPlaceholder };
|
package/lib/select.test-d.d.ts
CHANGED
package/lib/select.test-d.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/select.test-d.ts
|
|
2
2
|
const nestedProjection = { tasks: {
|
|
3
3
|
"q/from": ["tasks"],
|
|
4
4
|
"q/limit": 10,
|
|
@@ -11,5 +11,4 @@ const nestedProjection = { tasks: {
|
|
|
11
11
|
} }
|
|
12
12
|
} };
|
|
13
13
|
const invalidProjection = { invalid: true };
|
|
14
|
-
//#endregion
|
|
15
14
|
export { invalidProjection, nestedProjection };
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EntityId, Expression, Expression as Expression$1, ExpressionArgument, ExpressionArgument as ExpressionArgument$1, FieldExpression, FieldExpression as FieldExpression$1, FromRootExpression, FromRootExpression as FromRootExpression$1, FunctionCallExpression, FunctionCallExpression as FunctionCallExpression$1, MultiFieldAccess, OrderBy, OrderBy as OrderBy$1, PublicId, Query, QueryLimit, Select, Select as Select$1, SubQuery, SubQuery as SubQuery$1 } from "@fibery/schema";
|
|
2
|
-
//#region src/types.d.ts
|
|
3
2
|
declare const projected: unique symbol;
|
|
4
3
|
export type Projection<T extends object = FiberyObject> = Select$1 & {
|
|
5
4
|
readonly [projected]?: T;
|
|
@@ -38,5 +37,4 @@ type FiberyAutocompletes = {
|
|
|
38
37
|
export type FiberyObject = FiberyIdentity & FiberyAutocompletes & {
|
|
39
38
|
[field: string]: unknown;
|
|
40
39
|
};
|
|
41
|
-
//#endregion
|
|
42
40
|
export type { Expression, ExpressionArgument, FieldExpression, FromRootExpression, FunctionCallExpression, MultiFieldAccess, OrderBy, Query, QueryLimit, Select, SubQuery };
|
package/lib/utils.d.ts
CHANGED
|
@@ -74,5 +74,4 @@ export declare const getFieldObjects: (expression: Expression$1, typeObject: Typ
|
|
|
74
74
|
**/
|
|
75
75
|
export declare const extractFieldExpressions: (expression: Expression$1 | SubQuery$1) => FieldExpression$1[];
|
|
76
76
|
export declare const createExpressionVisitor: (visitor: ExpressionVisitor) => ExpressionVisitorWithDefault;
|
|
77
|
-
//#endregion
|
|
78
77
|
export { utils_d_exports };
|
package/lib/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ import isPlainObject from "lodash/isPlainObject.js";
|
|
|
6
6
|
import { assert } from "@fibery/helpers/utils/trace";
|
|
7
7
|
import isString from "lodash/isString.js";
|
|
8
8
|
import last from "lodash/last.js";
|
|
9
|
-
|
|
9
|
+
// src/utils.ts
|
|
10
10
|
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
11
11
|
assertIsValidExpression: () => assertIsValidExpression,
|
|
12
12
|
convertableDateTypes: () => convertableDateTypes,
|
|
@@ -333,5 +333,4 @@ const createExpressionVisitor = (visitor) => {
|
|
|
333
333
|
};
|
|
334
334
|
return visitorWithDefault;
|
|
335
335
|
};
|
|
336
|
-
//#endregion
|
|
337
336
|
export { assertIsValidExpression, convertableDateTypes, createExpressionVisitor, dateRangeFunctions, dateRangeTypes, dateTypes, extractFieldExpressions, firstLastFunctions, fromRootKeyword, getFieldObjectByFieldExpression, getFieldObjects, getFieldObjectsByFieldExpression, getFieldObjectsByFieldExpressionInIdsTerms, isAccessFunctionExpression, isBinaryExpression, isCollectionFunctionExpression, isDateRangeFunctionExpression, isDateTimeType, isDateType, isFieldExpression, isFieldExpressionValid, isFieldExpressionValidInIdsTerms, isFromRootFieldExpression, isFunctionCallExpression, isMultiFieldAccess, isMultiFieldExpression, isNaryExpression, isQueryExpression, isRangeType, isSingleDateType, isVariableExpression, logicalOperators, mathOperators, numberTypes, relationalOperators, resolveFieldObjectByFieldExpression, resolveFieldObjectsByFieldExpression, resolveFieldObjectsByFieldExpressionInIdsTerms, textTypes, utils_exports };
|
package/lib/visitors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Expression as Expression$1, ExpressionVisitor, FieldExpression as FieldExpression$1, MultiFieldAccess } from "./types.js";
|
|
2
1
|
import { fieldAccessVisitorTypeAware } from "./field-expression-visitor-type-aware.js";
|
|
2
|
+
import { Expression as Expression$1, ExpressionVisitor, FieldExpression as FieldExpression$1, MultiFieldAccess } from "./types.js";
|
|
3
3
|
import { FieldId, TypeObject } from "@fibery/schema";
|
|
4
4
|
declare namespace visitors_d_exports {
|
|
5
5
|
export { UNKNOWN_EXPRESSION_TYPE, deleteExpressionsWithNotFoundFieldsVisitor, deleteExpressionsWithParamsVisitor, expressionContainsAggregation, fieldAccessVisitorTypeAware, getExpressionType, getReferencedParamNames, replaceIdsWithNamesVisitor, replaceNamesWithIdsVisitor };
|
|
@@ -46,5 +46,4 @@ export declare const getExpressionType: ({ expression, typeObject, functionsMeta
|
|
|
46
46
|
};
|
|
47
47
|
returnRefTypeInsteadOfId?: boolean;
|
|
48
48
|
}) => string | null;
|
|
49
|
-
//#endregion
|
|
50
49
|
export { fieldAccessVisitorTypeAware, visitors_d_exports };
|
package/lib/visitors.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { createExpressionVisitor, firstLastFunctions, isCollectionFunctionExpression, isMultiFieldAccess, logicalOperators } from "./utils.js";
|
|
3
2
|
import { fieldAccessVisitorTypeAware } from "./field-expression-visitor-type-aware.js";
|
|
3
|
+
import { createExpressionVisitor, firstLastFunctions, isCollectionFunctionExpression, isMultiFieldAccess, logicalOperators } from "./utils.js";
|
|
4
4
|
import { mapValues } from "@fibery/helpers/src/object";
|
|
5
5
|
import isPlainObject from "lodash/isPlainObject.js";
|
|
6
6
|
import pickBy from "lodash/pickBy.js";
|
|
7
|
-
|
|
7
|
+
// src/visitors.ts
|
|
8
8
|
var visitors_exports = /* @__PURE__ */ __exportAll({
|
|
9
9
|
UNKNOWN_EXPRESSION_TYPE: () => UNKNOWN_EXPRESSION_TYPE,
|
|
10
10
|
deleteExpressionsWithNotFoundFieldsVisitor: () => deleteExpressionsWithNotFoundFieldsVisitor,
|
|
@@ -244,10 +244,10 @@ const UNKNOWN_EXPRESSION_TYPE = "unknown";
|
|
|
244
244
|
const getExpressionTypeInternal = ({ expression, typeObject, functionsMeta = {}, onFieldNotFound, returnRefTypeInsteadOfId }) => {
|
|
245
245
|
let result = null;
|
|
246
246
|
createExpressionVisitor({
|
|
247
|
-
visitVariableExpression
|
|
247
|
+
visitVariableExpression() {
|
|
248
248
|
result = UNKNOWN_EXPRESSION_TYPE;
|
|
249
249
|
},
|
|
250
|
-
visitFunctionCallExpression
|
|
250
|
+
visitFunctionCallExpression([fnName, ...args]) {
|
|
251
251
|
const fnMeta = functionsMeta[fnName];
|
|
252
252
|
if (!fnMeta) throw new Error(`Function meta for "${fnName}" was not provided`);
|
|
253
253
|
const argTypes = args.map((arg) => getExpressionTypeInternal({
|
|
@@ -320,5 +320,4 @@ const getExpressionType = ({ expression, typeObject, functionsMeta = {}, onField
|
|
|
320
320
|
returnRefTypeInsteadOfId
|
|
321
321
|
});
|
|
322
322
|
};
|
|
323
|
-
//#endregion
|
|
324
323
|
export { UNKNOWN_EXPRESSION_TYPE, deleteExpressionsWithNotFoundFieldsVisitor, deleteExpressionsWithParamsVisitor, expressionContainsAggregation, fieldAccessVisitorTypeAware, getExpressionType, getReferencedParamNames, replaceIdsWithNamesVisitor, replaceNamesWithIdsVisitor, visitors_exports };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/expression-utils",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.6",
|
|
4
4
|
"description": "utils for working with fibery api expressions",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"files": [
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@fibery/helpers": "
|
|
28
|
+
"@fibery/helpers": "7.1.0",
|
|
29
29
|
"lodash": "4.18.1",
|
|
30
30
|
"moment": "2.31.0",
|
|
31
31
|
"uuid": "11.1.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@fibery/schema": "13.1.
|
|
34
|
+
"@fibery/schema": "13.1.6"
|
|
35
35
|
}
|
|
36
36
|
}
|