@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.
- package/lib/_virtual/_rolldown/runtime.js +13 -0
- package/lib/context-variables.d.ts +30 -0
- package/lib/context-variables.js +116 -0
- package/lib/errors.d.ts +6 -0
- package/lib/errors.js +16 -0
- package/lib/field-expression-visitor-type-aware.d.ts +25 -0
- package/lib/field-expression-visitor-type-aware.js +120 -0
- package/lib/filter-expression/index.d.ts +13 -0
- package/lib/filter-expression/index.js +36 -0
- package/lib/filter-expression/operator-utils.d.ts +15 -0
- package/lib/filter-expression/operator-utils.js +206 -0
- package/lib/filter-expression/operators.d.ts +113 -0
- package/lib/filter-expression/operators.js +1151 -0
- package/lib/filter-expression/pattern-match-placeholders.d.ts +83 -0
- package/lib/filter-expression/pattern-match-placeholders.js +126 -0
- package/lib/filter-expression/pattern-match.d.ts +21 -0
- package/lib/filter-expression/pattern-match.js +126 -0
- package/lib/filter-expression/pattern-to-expression.d.ts +17 -0
- package/lib/filter-expression/pattern-to-expression.js +44 -0
- package/lib/filter-expression/types.d.ts +33 -0
- package/lib/filter-expression/types.js +0 -0
- package/lib/index.d.ts +191 -585
- package/lib/index.js +15 -50
- package/lib/params-placeholders.d.ts +58 -0
- package/lib/params-placeholders.js +215 -0
- package/lib/tsfixme.d.ts +4 -0
- package/lib/tsfixme.js +0 -0
- package/lib/types.d.ts +65 -0
- package/lib/types.js +0 -0
- package/lib/utils.d.ts +63 -0
- package/lib/utils.js +302 -0
- package/lib/visitors.d.ts +50 -0
- package/lib/visitors.js +327 -0
- package/package.json +13 -32
- package/lib/index.js.map +0 -1
- package/lib/src/context-variables.d.ts +0 -25
- package/lib/src/context-variables.js +0 -148
- package/lib/src/context-variables.js.map +0 -1
- package/lib/src/errors.d.ts +0 -3
- package/lib/src/errors.js +0 -16
- package/lib/src/errors.js.map +0 -1
- package/lib/src/field-expression-visitor-type-aware.d.ts +0 -23
- package/lib/src/field-expression-visitor-type-aware.js +0 -135
- package/lib/src/field-expression-visitor-type-aware.js.map +0 -1
- package/lib/src/filter-expression/index.d.ts +0 -10
- package/lib/src/filter-expression/index.js +0 -49
- package/lib/src/filter-expression/index.js.map +0 -1
- package/lib/src/filter-expression/operator-utils.d.ts +0 -12
- package/lib/src/filter-expression/operator-utils.js +0 -200
- package/lib/src/filter-expression/operator-utils.js.map +0 -1
- package/lib/src/filter-expression/operators.d.ts +0 -108
- package/lib/src/filter-expression/operators.js +0 -867
- package/lib/src/filter-expression/operators.js.map +0 -1
- package/lib/src/filter-expression/pattern-match-placeholders.d.ts +0 -81
- package/lib/src/filter-expression/pattern-match-placeholders.js +0 -157
- package/lib/src/filter-expression/pattern-match-placeholders.js.map +0 -1
- package/lib/src/filter-expression/pattern-match.d.ts +0 -19
- package/lib/src/filter-expression/pattern-match.js +0 -138
- package/lib/src/filter-expression/pattern-match.js.map +0 -1
- package/lib/src/filter-expression/pattern-to-expression.d.ts +0 -15
- package/lib/src/filter-expression/pattern-to-expression.js +0 -47
- package/lib/src/filter-expression/pattern-to-expression.js.map +0 -1
- package/lib/src/filter-expression/types.d.ts +0 -30
- package/lib/src/filter-expression/types.js +0 -3
- package/lib/src/filter-expression/types.js.map +0 -1
- package/lib/src/params-placeholders.d.ts +0 -54
- package/lib/src/params-placeholders.js +0 -208
- package/lib/src/params-placeholders.js.map +0 -1
- package/lib/src/tsfixme.d.ts +0 -1
- package/lib/src/tsfixme.js +0 -3
- package/lib/src/tsfixme.js.map +0 -1
- package/lib/src/types.d.ts +0 -63
- package/lib/src/types.js +0 -3
- package/lib/src/types.js.map +0 -1
- package/lib/src/utils.d.ts +0 -58
- package/lib/src/utils.js +0 -363
- package/lib/src/utils.js.map +0 -1
- package/lib/src/visitors.d.ts +0 -44
- package/lib/src/visitors.js +0 -386
- package/lib/src/visitors.js.map +0 -1
- package/lib/test-data/schema-mock.d.ts +0 -756
- package/lib/test-data/schema-mock.js +0 -139
- package/lib/test-data/schema-mock.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -1,50 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.filterExpression = exports.contextVariables = exports.paramsPlaceholders = exports.visitors = exports.utils = void 0;
|
|
37
|
-
const contextVariables = __importStar(require("./src/context-variables"));
|
|
38
|
-
exports.contextVariables = contextVariables;
|
|
39
|
-
const filter_expression_1 = require("./src/filter-expression");
|
|
40
|
-
const operators = __importStar(require("./src/filter-expression/operators"));
|
|
41
|
-
const pattern_to_expression_1 = require("./src/filter-expression/pattern-to-expression");
|
|
42
|
-
const paramsPlaceholders = __importStar(require("./src/params-placeholders"));
|
|
43
|
-
exports.paramsPlaceholders = paramsPlaceholders;
|
|
44
|
-
const utils = __importStar(require("./src/utils"));
|
|
45
|
-
exports.utils = utils;
|
|
46
|
-
const visitors = __importStar(require("./src/visitors"));
|
|
47
|
-
exports.visitors = visitors;
|
|
48
|
-
const filterExpression = { findMatchedFilter: filter_expression_1.findMatchedFilter, operators, convertToExpression: pattern_to_expression_1.convertToExpression };
|
|
49
|
-
exports.filterExpression = filterExpression;
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { context_variables_exports } from "./context-variables.js";
|
|
2
|
+
import { utils_exports } from "./utils.js";
|
|
3
|
+
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
|
+
import { operators_exports } from "./filter-expression/operators.js";
|
|
7
|
+
import { visitors_exports } from "./visitors.js";
|
|
8
|
+
//#region src/index.ts
|
|
9
|
+
const filterExpression = {
|
|
10
|
+
findMatchedFilter,
|
|
11
|
+
operators: operators_exports,
|
|
12
|
+
convertToExpression
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { context_variables_exports as contextVariables, filterExpression, params_placeholders_exports as paramsPlaceholders, utils_exports as utils, visitors_exports as visitors };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Moment, unitOfTime } from "moment";
|
|
2
|
+
declare namespace params_placeholders_d_exports {
|
|
3
|
+
export { dateToDateTimeIntervalLookup, dynamicFilterParamPrefix, formulaNowDateTimeParamPlaceholder, formulaTodayDateParamPlaceholder, getFieldIdFromDynamicParam, getRelativeDateValue, getRelativeMomentDate, isDynamicFilterParam, mapDynamicParams, monthAgoDateParamPlaceholder, monthAgoEndDateTimeParamPlaceholder, monthAgoStartDateTimeParamPlaceholder, monthFromNowDateParamPlaceholder, monthFromNowEndDateTimeParamPlaceholder, monthFromNowStartDateTimeParamPlaceholder, paramsPlaceholdersLookup, 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 };
|
|
4
|
+
}
|
|
5
|
+
declare const formulaTodayDateParamPlaceholder = "$formula-today-date-placeholder";
|
|
6
|
+
declare const formulaNowDateTimeParamPlaceholder = "$formula-now-date-time-placeholder";
|
|
7
|
+
declare const todayDateParamPlaceholder = "$today-date";
|
|
8
|
+
declare const tomorrowDateParamPlaceholder = "$tomorrow-date";
|
|
9
|
+
declare const yesterdayDateParamPlaceholder = "$yesterday-date";
|
|
10
|
+
declare const weekAgoDateParamPlaceholder = "$week-ago-date";
|
|
11
|
+
declare const weekFromNowDateParamPlaceholder = "$week-from-now-date";
|
|
12
|
+
declare const monthAgoDateParamPlaceholder = "$month-ago-date";
|
|
13
|
+
declare const monthFromNowDateParamPlaceholder = "$month-from-now-date";
|
|
14
|
+
declare const yearAgoDateParamPlaceholder = "$year-ago-date";
|
|
15
|
+
declare const yearFromNowDateParamPlaceholder = "$year-from-now-date";
|
|
16
|
+
declare const todayStartDateTimeParamPlaceholder = "$today-date-time-start";
|
|
17
|
+
declare const todayEndDateTimeParamPlaceholder = "$today-date-time-end";
|
|
18
|
+
declare const tomorrowStartDateTimeParamPlaceholder = "$tomorrow-date-time-start";
|
|
19
|
+
declare const tomorrowEndDateTimeParamPlaceholder = "$tomorrow-date-time-end";
|
|
20
|
+
declare const yesterdayStartDateTimeParamPlaceholder = "$yesterday-date-time-start";
|
|
21
|
+
declare const yesterdayEndDateTimeParamPlaceholder = "$yesterday-date-time-end";
|
|
22
|
+
declare const weekAgoStartDateTimeParamPlaceholder = "$week-ago-date-time-start";
|
|
23
|
+
declare const weekAgoEndDateTimeParamPlaceholder = "$week-ago-date-time-end";
|
|
24
|
+
declare const weekFromNowStartDateTimeParamPlaceholder = "$week-from-now-date-time-start";
|
|
25
|
+
declare const weekFromNowEndDateTimeParamPlaceholder = "$week-from-now-date-time-end";
|
|
26
|
+
declare const monthAgoStartDateTimeParamPlaceholder = "$month-ago-date-time-start";
|
|
27
|
+
declare const monthAgoEndDateTimeParamPlaceholder = "$month-ago-date-time-end";
|
|
28
|
+
declare const monthFromNowStartDateTimeParamPlaceholder = "$month-from-now-date-time-start";
|
|
29
|
+
declare const monthFromNowEndDateTimeParamPlaceholder = "$month-from-now-date-time-end";
|
|
30
|
+
declare const yearAgoStartDateTimeParamPlaceholder = "$year-ago-date-time-start";
|
|
31
|
+
declare const yearAgoEndDateTimeParamPlaceholder = "$year-ago-date-time-end";
|
|
32
|
+
declare const yearFromNowStartDateTimeParamPlaceholder = "$year-from-now-date-time-start";
|
|
33
|
+
declare const yearFromNowEndDateTimeParamPlaceholder = "$year-from-now-date-time-end";
|
|
34
|
+
declare const paramsPlaceholdersLookup: Record<string, () => string>;
|
|
35
|
+
declare const dynamicFilterParamPrefix = "$dynamic_";
|
|
36
|
+
declare const isDynamicFilterParam: (paramValue: string) => boolean;
|
|
37
|
+
declare const getFieldIdFromDynamicParam: (paramValue: string) => string;
|
|
38
|
+
declare const whereParamPrefix = "$where";
|
|
39
|
+
declare const mapDynamicParams: <T extends Record<string, unknown>>(params: T | null, onDynamicParam: (value: string) => string) => T | null;
|
|
40
|
+
type RelativeDateInfo = {
|
|
41
|
+
isStartOfInterval?: boolean;
|
|
42
|
+
unitForStart?: unitOfTime.DurationConstructor;
|
|
43
|
+
amount: number;
|
|
44
|
+
unit: unitOfTime.DurationConstructor;
|
|
45
|
+
isBeforeNow: boolean;
|
|
46
|
+
isDateTime?: boolean;
|
|
47
|
+
};
|
|
48
|
+
declare const getRelativeMomentDate: ({ isStartOfInterval, unitForStart, amount, unit, isBeforeNow }: Omit<RelativeDateInfo, "isDateTime">) => Moment;
|
|
49
|
+
declare const getRelativeDateValue: ({ isStartOfInterval, unitForStart, amount, unit, isBeforeNow, isDateTime }: RelativeDateInfo) => string;
|
|
50
|
+
declare const toRelativeDatePlaceholder: ({ isStartOfInterval, unitForStart, amount, unit, isBeforeNow, isDateTime }: RelativeDateInfo) => string;
|
|
51
|
+
declare const parseRelativeDatePlaceholder: (placeholder: unknown) => RelativeDateInfo | null;
|
|
52
|
+
declare function replacePlaceholdersInParams<T extends Record<string, unknown>>(params: T | null | undefined): T | null | undefined;
|
|
53
|
+
declare const dateToDateTimeIntervalLookup: Record<string, {
|
|
54
|
+
start: string;
|
|
55
|
+
end: string;
|
|
56
|
+
}>;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { dateToDateTimeIntervalLookup, dynamicFilterParamPrefix, formulaNowDateTimeParamPlaceholder, formulaTodayDateParamPlaceholder, getFieldIdFromDynamicParam, getRelativeDateValue, getRelativeMomentDate, isDynamicFilterParam, mapDynamicParams, monthAgoDateParamPlaceholder, monthAgoEndDateTimeParamPlaceholder, monthAgoStartDateTimeParamPlaceholder, monthFromNowDateParamPlaceholder, monthFromNowEndDateTimeParamPlaceholder, monthFromNowStartDateTimeParamPlaceholder, paramsPlaceholdersLookup, params_placeholders_d_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 };
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { mapValues } from "@fibery/helpers/src/_";
|
|
3
|
+
import isString from "lodash/isString.js";
|
|
4
|
+
import moment from "moment";
|
|
5
|
+
//#region src/params-placeholders.ts
|
|
6
|
+
var params_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
dateToDateTimeIntervalLookup: () => dateToDateTimeIntervalLookup,
|
|
8
|
+
dynamicFilterParamPrefix: () => dynamicFilterParamPrefix,
|
|
9
|
+
formulaNowDateTimeParamPlaceholder: () => formulaNowDateTimeParamPlaceholder,
|
|
10
|
+
formulaTodayDateParamPlaceholder: () => formulaTodayDateParamPlaceholder,
|
|
11
|
+
getFieldIdFromDynamicParam: () => getFieldIdFromDynamicParam,
|
|
12
|
+
getRelativeDateValue: () => getRelativeDateValue,
|
|
13
|
+
getRelativeMomentDate: () => getRelativeMomentDate,
|
|
14
|
+
isDynamicFilterParam: () => isDynamicFilterParam,
|
|
15
|
+
mapDynamicParams: () => mapDynamicParams,
|
|
16
|
+
monthAgoDateParamPlaceholder: () => monthAgoDateParamPlaceholder,
|
|
17
|
+
monthAgoEndDateTimeParamPlaceholder: () => monthAgoEndDateTimeParamPlaceholder,
|
|
18
|
+
monthAgoStartDateTimeParamPlaceholder: () => monthAgoStartDateTimeParamPlaceholder,
|
|
19
|
+
monthFromNowDateParamPlaceholder: () => monthFromNowDateParamPlaceholder,
|
|
20
|
+
monthFromNowEndDateTimeParamPlaceholder: () => monthFromNowEndDateTimeParamPlaceholder,
|
|
21
|
+
monthFromNowStartDateTimeParamPlaceholder: () => monthFromNowStartDateTimeParamPlaceholder,
|
|
22
|
+
paramsPlaceholdersLookup: () => paramsPlaceholdersLookup,
|
|
23
|
+
parseRelativeDatePlaceholder: () => parseRelativeDatePlaceholder,
|
|
24
|
+
replacePlaceholdersInParams: () => replacePlaceholdersInParams,
|
|
25
|
+
toRelativeDatePlaceholder: () => toRelativeDatePlaceholder,
|
|
26
|
+
todayDateParamPlaceholder: () => todayDateParamPlaceholder,
|
|
27
|
+
todayEndDateTimeParamPlaceholder: () => todayEndDateTimeParamPlaceholder,
|
|
28
|
+
todayStartDateTimeParamPlaceholder: () => todayStartDateTimeParamPlaceholder,
|
|
29
|
+
tomorrowDateParamPlaceholder: () => tomorrowDateParamPlaceholder,
|
|
30
|
+
tomorrowEndDateTimeParamPlaceholder: () => tomorrowEndDateTimeParamPlaceholder,
|
|
31
|
+
tomorrowStartDateTimeParamPlaceholder: () => tomorrowStartDateTimeParamPlaceholder,
|
|
32
|
+
weekAgoDateParamPlaceholder: () => weekAgoDateParamPlaceholder,
|
|
33
|
+
weekAgoEndDateTimeParamPlaceholder: () => weekAgoEndDateTimeParamPlaceholder,
|
|
34
|
+
weekAgoStartDateTimeParamPlaceholder: () => weekAgoStartDateTimeParamPlaceholder,
|
|
35
|
+
weekFromNowDateParamPlaceholder: () => weekFromNowDateParamPlaceholder,
|
|
36
|
+
weekFromNowEndDateTimeParamPlaceholder: () => weekFromNowEndDateTimeParamPlaceholder,
|
|
37
|
+
weekFromNowStartDateTimeParamPlaceholder: () => weekFromNowStartDateTimeParamPlaceholder,
|
|
38
|
+
whereParamPrefix: () => whereParamPrefix,
|
|
39
|
+
yearAgoDateParamPlaceholder: () => yearAgoDateParamPlaceholder,
|
|
40
|
+
yearAgoEndDateTimeParamPlaceholder: () => yearAgoEndDateTimeParamPlaceholder,
|
|
41
|
+
yearAgoStartDateTimeParamPlaceholder: () => yearAgoStartDateTimeParamPlaceholder,
|
|
42
|
+
yearFromNowDateParamPlaceholder: () => yearFromNowDateParamPlaceholder,
|
|
43
|
+
yearFromNowEndDateTimeParamPlaceholder: () => yearFromNowEndDateTimeParamPlaceholder,
|
|
44
|
+
yearFromNowStartDateTimeParamPlaceholder: () => yearFromNowStartDateTimeParamPlaceholder,
|
|
45
|
+
yesterdayDateParamPlaceholder: () => yesterdayDateParamPlaceholder,
|
|
46
|
+
yesterdayEndDateTimeParamPlaceholder: () => yesterdayEndDateTimeParamPlaceholder,
|
|
47
|
+
yesterdayStartDateTimeParamPlaceholder: () => yesterdayStartDateTimeParamPlaceholder
|
|
48
|
+
});
|
|
49
|
+
const serializeDate = (momentDate) => {
|
|
50
|
+
return momentDate.format("YYYY-MM-DD");
|
|
51
|
+
};
|
|
52
|
+
const serializeDateTime = (momentDate) => {
|
|
53
|
+
return momentDate.toISOString();
|
|
54
|
+
};
|
|
55
|
+
const formulaTodayDateParamPlaceholder = "$formula-today-date-placeholder";
|
|
56
|
+
const formulaNowDateTimeParamPlaceholder = "$formula-now-date-time-placeholder";
|
|
57
|
+
const todayDateParamPlaceholder = "$today-date";
|
|
58
|
+
const tomorrowDateParamPlaceholder = "$tomorrow-date";
|
|
59
|
+
const yesterdayDateParamPlaceholder = "$yesterday-date";
|
|
60
|
+
const weekAgoDateParamPlaceholder = "$week-ago-date";
|
|
61
|
+
const weekFromNowDateParamPlaceholder = "$week-from-now-date";
|
|
62
|
+
const monthAgoDateParamPlaceholder = "$month-ago-date";
|
|
63
|
+
const monthFromNowDateParamPlaceholder = "$month-from-now-date";
|
|
64
|
+
const yearAgoDateParamPlaceholder = "$year-ago-date";
|
|
65
|
+
const yearFromNowDateParamPlaceholder = "$year-from-now-date";
|
|
66
|
+
const todayStartDateTimeParamPlaceholder = "$today-date-time-start";
|
|
67
|
+
const todayEndDateTimeParamPlaceholder = "$today-date-time-end";
|
|
68
|
+
const tomorrowStartDateTimeParamPlaceholder = "$tomorrow-date-time-start";
|
|
69
|
+
const tomorrowEndDateTimeParamPlaceholder = "$tomorrow-date-time-end";
|
|
70
|
+
const yesterdayStartDateTimeParamPlaceholder = "$yesterday-date-time-start";
|
|
71
|
+
const yesterdayEndDateTimeParamPlaceholder = "$yesterday-date-time-end";
|
|
72
|
+
const weekAgoStartDateTimeParamPlaceholder = "$week-ago-date-time-start";
|
|
73
|
+
const weekAgoEndDateTimeParamPlaceholder = "$week-ago-date-time-end";
|
|
74
|
+
const weekFromNowStartDateTimeParamPlaceholder = "$week-from-now-date-time-start";
|
|
75
|
+
const weekFromNowEndDateTimeParamPlaceholder = "$week-from-now-date-time-end";
|
|
76
|
+
const monthAgoStartDateTimeParamPlaceholder = "$month-ago-date-time-start";
|
|
77
|
+
const monthAgoEndDateTimeParamPlaceholder = "$month-ago-date-time-end";
|
|
78
|
+
const monthFromNowStartDateTimeParamPlaceholder = "$month-from-now-date-time-start";
|
|
79
|
+
const monthFromNowEndDateTimeParamPlaceholder = "$month-from-now-date-time-end";
|
|
80
|
+
const yearAgoStartDateTimeParamPlaceholder = "$year-ago-date-time-start";
|
|
81
|
+
const yearAgoEndDateTimeParamPlaceholder = "$year-ago-date-time-end";
|
|
82
|
+
const yearFromNowStartDateTimeParamPlaceholder = "$year-from-now-date-time-start";
|
|
83
|
+
const yearFromNowEndDateTimeParamPlaceholder = "$year-from-now-date-time-end";
|
|
84
|
+
const paramsPlaceholdersLookup = {
|
|
85
|
+
[todayDateParamPlaceholder]: () => serializeDate(moment()),
|
|
86
|
+
[formulaTodayDateParamPlaceholder]: () => serializeDate(moment()),
|
|
87
|
+
[formulaNowDateTimeParamPlaceholder]: () => serializeDateTime(moment()),
|
|
88
|
+
[tomorrowDateParamPlaceholder]: () => serializeDate(moment().add(1, "days")),
|
|
89
|
+
[yesterdayDateParamPlaceholder]: () => serializeDate(moment().subtract(1, "days")),
|
|
90
|
+
[weekAgoDateParamPlaceholder]: () => serializeDate(moment().subtract(7, "days")),
|
|
91
|
+
[weekFromNowDateParamPlaceholder]: () => serializeDate(moment().add(7, "days")),
|
|
92
|
+
[monthAgoDateParamPlaceholder]: () => serializeDate(moment().subtract(1, "months")),
|
|
93
|
+
[monthFromNowDateParamPlaceholder]: () => serializeDate(moment().add(1, "months")),
|
|
94
|
+
[yearAgoDateParamPlaceholder]: () => serializeDate(moment().subtract(1, "year")),
|
|
95
|
+
[yearFromNowDateParamPlaceholder]: () => serializeDate(moment().add(1, "year")),
|
|
96
|
+
[todayStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().startOf("day")),
|
|
97
|
+
[todayEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().endOf("day")),
|
|
98
|
+
[tomorrowStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(1, "days").startOf("day")),
|
|
99
|
+
[tomorrowEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(1, "days").endOf("day")),
|
|
100
|
+
[yesterdayStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(1, "days").startOf("day")),
|
|
101
|
+
[yesterdayEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(1, "days").endOf("day")),
|
|
102
|
+
[weekAgoStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(7, "days").startOf("day")),
|
|
103
|
+
[weekAgoEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(7, "days").endOf("day")),
|
|
104
|
+
[weekFromNowStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(7, "days").startOf("day")),
|
|
105
|
+
[weekFromNowEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(7, "days").endOf("day")),
|
|
106
|
+
[monthAgoStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(1, "months").startOf("day")),
|
|
107
|
+
[monthAgoEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(1, "months").endOf("day")),
|
|
108
|
+
[monthFromNowStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(1, "months").startOf("day")),
|
|
109
|
+
[monthFromNowEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(1, "months").endOf("day")),
|
|
110
|
+
[yearAgoStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(1, "year").startOf("day")),
|
|
111
|
+
[yearAgoEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().subtract(1, "year").endOf("day")),
|
|
112
|
+
[yearFromNowStartDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(1, "year").startOf("day")),
|
|
113
|
+
[yearFromNowEndDateTimeParamPlaceholder]: () => serializeDateTime(moment().add(1, "year").endOf("day"))
|
|
114
|
+
};
|
|
115
|
+
const dynamicFilterParamPrefix = `$dynamic_`;
|
|
116
|
+
const isDynamicFilterParam = (paramValue) => paramValue.startsWith(dynamicFilterParamPrefix);
|
|
117
|
+
const getFieldIdFromDynamicParam = (paramValue) => paramValue.substring(dynamicFilterParamPrefix.length);
|
|
118
|
+
const whereParamPrefix = "$where";
|
|
119
|
+
const mapDynamicParams = (params, onDynamicParam) => {
|
|
120
|
+
if (!params) return params;
|
|
121
|
+
return Object.fromEntries(Object.entries(params).map(([key, value]) => {
|
|
122
|
+
if (Array.isArray(value)) return [key, value.map((v) => {
|
|
123
|
+
return isString(v) && isDynamicFilterParam(v) ? onDynamicParam(v) : v;
|
|
124
|
+
})];
|
|
125
|
+
else return [key, isString(value) && isDynamicFilterParam(value) ? onDynamicParam(value) : value];
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
const relativeDatePlaceholderRegex = /\$(?:start-|end-|start-of-day-|end-of-day-)?(\d+)-(second|minute|hour|day|week|month|quarter|year)-(before-now|after-now)-(date-time|date)/;
|
|
129
|
+
const getRelativeMomentDate = ({ isStartOfInterval, unitForStart, amount, unit, isBeforeNow }) => {
|
|
130
|
+
const result = isBeforeNow ? moment().subtract(amount, unit) : moment().add(amount, unit);
|
|
131
|
+
if (isStartOfInterval === void 0) return result;
|
|
132
|
+
else return isStartOfInterval ? result.startOf(unitForStart) : result.endOf(unitForStart);
|
|
133
|
+
};
|
|
134
|
+
const getRelativeDateValue = ({ isStartOfInterval, unitForStart, amount, unit, isBeforeNow, isDateTime }) => {
|
|
135
|
+
const momentDate = getRelativeMomentDate({
|
|
136
|
+
isStartOfInterval,
|
|
137
|
+
unitForStart,
|
|
138
|
+
amount,
|
|
139
|
+
unit,
|
|
140
|
+
isBeforeNow
|
|
141
|
+
});
|
|
142
|
+
return isDateTime ? serializeDateTime(momentDate) : serializeDate(momentDate);
|
|
143
|
+
};
|
|
144
|
+
const toRelativeDatePlaceholder = ({ isStartOfInterval, unitForStart, amount, unit, isBeforeNow, isDateTime }) => {
|
|
145
|
+
return `$${isStartOfInterval === void 0 ? "" : isStartOfInterval ? `start-of-${unitForStart}-` : `end-of-${unitForStart}-`}${amount}-${unit}-${isBeforeNow ? "before-now" : "after-now"}-${isDateTime ? "date-time" : "date"}`;
|
|
146
|
+
};
|
|
147
|
+
const parseRelativeDatePlaceholder = (placeholder) => {
|
|
148
|
+
if (typeof placeholder === "string") {
|
|
149
|
+
const relativeDatePlaceholderMatch = placeholder.match(relativeDatePlaceholderRegex);
|
|
150
|
+
if (relativeDatePlaceholderMatch) {
|
|
151
|
+
const fullMatch = relativeDatePlaceholderMatch[0];
|
|
152
|
+
const isStartOfInterval = fullMatch.startsWith("$start") ? true : fullMatch.startsWith("$end") ? false : void 0;
|
|
153
|
+
const unit = relativeDatePlaceholderMatch[2];
|
|
154
|
+
return {
|
|
155
|
+
isStartOfInterval,
|
|
156
|
+
unitForStart: fullMatch.startsWith("$start-of-day") || fullMatch.startsWith("$end-of-day") ? "day" : isStartOfInterval !== void 0 ? unit : void 0,
|
|
157
|
+
amount: Number.parseInt(relativeDatePlaceholderMatch[1]),
|
|
158
|
+
unit,
|
|
159
|
+
isBeforeNow: relativeDatePlaceholderMatch[3] === "before-now",
|
|
160
|
+
isDateTime: relativeDatePlaceholderMatch[4] === "date-time"
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
};
|
|
166
|
+
function replacePlaceholdersInParams(params) {
|
|
167
|
+
if (!params) return params;
|
|
168
|
+
return mapValues(params, (value, key) => {
|
|
169
|
+
const replaceFn = paramsPlaceholdersLookup[key];
|
|
170
|
+
if (replaceFn) return replaceFn();
|
|
171
|
+
const relativeDateInfo = parseRelativeDatePlaceholder(key);
|
|
172
|
+
if (relativeDateInfo) return getRelativeDateValue(relativeDateInfo);
|
|
173
|
+
return value;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const dateToDateTimeIntervalLookup = {
|
|
177
|
+
[todayDateParamPlaceholder]: {
|
|
178
|
+
start: todayStartDateTimeParamPlaceholder,
|
|
179
|
+
end: todayEndDateTimeParamPlaceholder
|
|
180
|
+
},
|
|
181
|
+
[tomorrowDateParamPlaceholder]: {
|
|
182
|
+
start: tomorrowStartDateTimeParamPlaceholder,
|
|
183
|
+
end: tomorrowEndDateTimeParamPlaceholder
|
|
184
|
+
},
|
|
185
|
+
[yesterdayDateParamPlaceholder]: {
|
|
186
|
+
start: yesterdayStartDateTimeParamPlaceholder,
|
|
187
|
+
end: yesterdayEndDateTimeParamPlaceholder
|
|
188
|
+
},
|
|
189
|
+
[weekAgoDateParamPlaceholder]: {
|
|
190
|
+
start: weekAgoStartDateTimeParamPlaceholder,
|
|
191
|
+
end: weekAgoEndDateTimeParamPlaceholder
|
|
192
|
+
},
|
|
193
|
+
[weekFromNowDateParamPlaceholder]: {
|
|
194
|
+
start: weekFromNowStartDateTimeParamPlaceholder,
|
|
195
|
+
end: weekFromNowEndDateTimeParamPlaceholder
|
|
196
|
+
},
|
|
197
|
+
[monthAgoDateParamPlaceholder]: {
|
|
198
|
+
start: monthAgoStartDateTimeParamPlaceholder,
|
|
199
|
+
end: monthAgoEndDateTimeParamPlaceholder
|
|
200
|
+
},
|
|
201
|
+
[monthFromNowDateParamPlaceholder]: {
|
|
202
|
+
start: monthFromNowStartDateTimeParamPlaceholder,
|
|
203
|
+
end: monthFromNowEndDateTimeParamPlaceholder
|
|
204
|
+
},
|
|
205
|
+
[yearAgoDateParamPlaceholder]: {
|
|
206
|
+
start: yearAgoStartDateTimeParamPlaceholder,
|
|
207
|
+
end: yearAgoEndDateTimeParamPlaceholder
|
|
208
|
+
},
|
|
209
|
+
[yearFromNowDateParamPlaceholder]: {
|
|
210
|
+
start: yearFromNowStartDateTimeParamPlaceholder,
|
|
211
|
+
end: yearFromNowEndDateTimeParamPlaceholder
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
//#endregion
|
|
215
|
+
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/tsfixme.d.ts
ADDED
package/lib/tsfixme.js
ADDED
|
File without changes
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type MultiFieldAccess = [string, string];
|
|
3
|
+
type FieldExpression = Array<string | MultiFieldAccess>;
|
|
4
|
+
type FunctionCallExpression = [string, ...Expression[]];
|
|
5
|
+
type FromRootExpression = ["q/from-root", ...FieldExpression[]];
|
|
6
|
+
/**
|
|
7
|
+
* The full union of all expression forms.
|
|
8
|
+
*
|
|
9
|
+
* Use type guards (isFieldExpression, isFunctionCallExpression, etc.) to narrow.
|
|
10
|
+
*
|
|
11
|
+
* Note: FieldExpression, FunctionCallExpression, FromRootExpression are all subtypes
|
|
12
|
+
* of Expression[] and listed explicitly for readability. SubQuery is a separate type.
|
|
13
|
+
*/
|
|
14
|
+
type Expression = string | Expression[] | FieldExpression | FunctionCallExpression | FromRootExpression;
|
|
15
|
+
type OrderBy = Array<[Expression, string] | [Expression, string, string]>;
|
|
16
|
+
type QueryLimit = number | "q/no-limit";
|
|
17
|
+
type Select = Record<string, Expression | Record<string, Expression>>;
|
|
18
|
+
type Query = {
|
|
19
|
+
"q/from": string;
|
|
20
|
+
"q/select"?: Expression | Select;
|
|
21
|
+
"q/offset"?: number;
|
|
22
|
+
"q/order-by"?: OrderBy;
|
|
23
|
+
"q/limit"?: QueryLimit;
|
|
24
|
+
"q/where"?: Expression;
|
|
25
|
+
};
|
|
26
|
+
type SubQuery = {
|
|
27
|
+
"q/from": FieldExpression;
|
|
28
|
+
"q/select"?: Expression | Select;
|
|
29
|
+
"q/offset"?: number;
|
|
30
|
+
"q/order-by"?: OrderBy;
|
|
31
|
+
"q/limit"?: QueryLimit;
|
|
32
|
+
"q/where"?: Expression;
|
|
33
|
+
};
|
|
34
|
+
type FunctionsMeta = Record<string, {
|
|
35
|
+
overloads: {
|
|
36
|
+
"arg-types": string[];
|
|
37
|
+
"result-type": string;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
type ExpressionVisitor = {
|
|
41
|
+
visitVariableExpression?: (expression: string, visitor: ExpressionVisitor) => any;
|
|
42
|
+
visitFunctionCallExpression?: (expression: FunctionCallExpression, visitor: ExpressionVisitor) => any;
|
|
43
|
+
visitFromRootFieldExpression?: (expression: FromRootExpression, visitor: ExpressionVisitor) => any;
|
|
44
|
+
visitFieldExpression?: (expression: FieldExpression, visitor: ExpressionVisitor) => any;
|
|
45
|
+
visitOrderByExpression?: (orderByExpression: OrderBy, visitor?: ExpressionVisitor) => any;
|
|
46
|
+
visitQueryExpression?: (subQueryExpression: SubQuery, visitor: ExpressionVisitor) => any;
|
|
47
|
+
visitExpression?: (expression: Expression | OrderBy | SubQuery) => any;
|
|
48
|
+
};
|
|
49
|
+
type ExpressionVisitorWithDefault = Required<ExpressionVisitor>;
|
|
50
|
+
type FiberyIdentity = {
|
|
51
|
+
"fibery/id": string;
|
|
52
|
+
};
|
|
53
|
+
type FiberyAutocompletes = {
|
|
54
|
+
"fibery/public-id"?: string;
|
|
55
|
+
"fibery/rank"?: number;
|
|
56
|
+
__NOTHING_INTERESTING__TitleField__?: string;
|
|
57
|
+
};
|
|
58
|
+
type FiberyObject = FiberyIdentity & FiberyAutocompletes & {
|
|
59
|
+
[field: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
type FiberyObjectYOLO = FiberyIdentity & FiberyAutocompletes & {
|
|
62
|
+
[field: string]: any;
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Expression, ExpressionVisitor, ExpressionVisitorWithDefault, FiberyObject, FiberyObjectYOLO, FieldExpression, FromRootExpression, FunctionCallExpression, FunctionsMeta, MultiFieldAccess, OrderBy, Query, QueryLimit, Select, SubQuery };
|
package/lib/types.js
ADDED
|
File without changes
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Expression, ExpressionVisitor, ExpressionVisitorWithDefault, FieldExpression, FromRootExpression, FunctionCallExpression, MultiFieldAccess, OrderBy, SubQuery } from "./types.js";
|
|
2
|
+
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
3
|
+
declare namespace utils_d_exports {
|
|
4
|
+
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, textTypes };
|
|
5
|
+
}
|
|
6
|
+
declare const assertIsValidExpression: (expression: Expression) => void;
|
|
7
|
+
declare const textTypes: string[];
|
|
8
|
+
declare const dateTypes: string[];
|
|
9
|
+
declare const dateRangeTypes: string[];
|
|
10
|
+
declare const convertableDateTypes: string[];
|
|
11
|
+
declare const numberTypes: string[];
|
|
12
|
+
declare const dateRangeFunctions: Set<string>;
|
|
13
|
+
declare const firstLastFunctions: Set<string>;
|
|
14
|
+
declare const logicalOperators: Set<string>;
|
|
15
|
+
declare const relationalOperators: Set<string>;
|
|
16
|
+
declare const mathOperators: Set<string>;
|
|
17
|
+
declare const isDateType: (type: string) => type is "fibery/date" | "fibery/date-range";
|
|
18
|
+
declare const isDateTimeType: (type: string) => type is "fibery/date-time" | "fibery/date-time-range";
|
|
19
|
+
declare const isSingleDateType: (type: string) => type is "fibery/date" | "fibery/date-time";
|
|
20
|
+
declare const isRangeType: (type: string) => type is "fibery/date-range" | "fibery/date-time-range";
|
|
21
|
+
declare const isFunctionCallExpression: (expression: Expression | OrderBy | SubQuery) => expression is FunctionCallExpression;
|
|
22
|
+
declare const fromRootKeyword = "q/from-root";
|
|
23
|
+
declare const isFromRootFieldExpression: (expression: Expression | OrderBy | SubQuery) => expression is FromRootExpression;
|
|
24
|
+
declare const isDateRangeFunctionExpression: (expression: Expression) => boolean;
|
|
25
|
+
declare const isCollectionFunctionExpression: (expression: Expression) => boolean;
|
|
26
|
+
declare const isAccessFunctionExpression: (expression: Expression) => boolean;
|
|
27
|
+
declare const isBinaryExpression: (expression: Expression) => boolean;
|
|
28
|
+
declare const isNaryExpression: (expression: Expression) => boolean;
|
|
29
|
+
declare const isVariableExpression: (expression: Expression | OrderBy | SubQuery | null) => expression is string;
|
|
30
|
+
declare const isMultiFieldAccess: (expression: Expression | string) => expression is MultiFieldAccess;
|
|
31
|
+
declare const isMultiFieldExpression: (expression: Expression | OrderBy | SubQuery) => expression is FieldExpression;
|
|
32
|
+
declare const isFieldExpression: (expression: Expression | OrderBy | SubQuery) => expression is FieldExpression;
|
|
33
|
+
declare const isQueryExpression: (expression: Expression | OrderBy | SubQuery | null) => expression is SubQuery;
|
|
34
|
+
declare const getFieldObjectsByFieldExpression: ({ typeObject, expression }: {
|
|
35
|
+
typeObject: TypeObject;
|
|
36
|
+
expression: FieldExpression;
|
|
37
|
+
}) => FieldObject[];
|
|
38
|
+
declare const getFieldObjectsByFieldExpressionInIdsTerms: ({ typeObject, expression }: {
|
|
39
|
+
typeObject: TypeObject;
|
|
40
|
+
expression: FieldExpression;
|
|
41
|
+
}) => FieldObject[];
|
|
42
|
+
declare const isFieldExpressionValid: ({ typeObject, expression }: {
|
|
43
|
+
typeObject: TypeObject;
|
|
44
|
+
expression: FieldExpression;
|
|
45
|
+
}) => boolean;
|
|
46
|
+
declare const isFieldExpressionValidInIdsTerms: ({ typeObject, expression }: {
|
|
47
|
+
typeObject: TypeObject;
|
|
48
|
+
expression: FieldExpression;
|
|
49
|
+
}) => boolean;
|
|
50
|
+
declare const getFieldObjectByFieldExpression: (x: {
|
|
51
|
+
typeObject: TypeObject;
|
|
52
|
+
expression: FieldExpression;
|
|
53
|
+
}) => FieldObject;
|
|
54
|
+
declare const getFieldObjects: (expression: Expression, typeObject: TypeObject) => FieldObject[];
|
|
55
|
+
/** @deprecated
|
|
56
|
+
* This method checks few expression forms, that we do not generate on frontend anymore(field-access shortcut, direct value as parameter).
|
|
57
|
+
* I'm afraid to replace it with implementation based on visitor everywhere, as visitors don't allow such expression forms and I don't want to extend visitor with those forms.
|
|
58
|
+
* If you need this method in new places, consider implementing same logic on visitors and use it.
|
|
59
|
+
**/
|
|
60
|
+
declare const extractFieldExpressions: (expression: Expression) => FieldExpression[];
|
|
61
|
+
declare const createExpressionVisitor: (visitor: ExpressionVisitor) => ExpressionVisitorWithDefault;
|
|
62
|
+
//#endregion
|
|
63
|
+
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, textTypes, utils_d_exports };
|