1 | "use strict";
|
2 | var __assign = (this && this.__assign) || function () {
|
3 | __assign = Object.assign || function(t) {
|
4 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5 | s = arguments[i];
|
6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7 | t[p] = s[p];
|
8 | }
|
9 | return t;
|
10 | };
|
11 | return __assign.apply(this, arguments);
|
12 | };
|
13 | var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
14 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
15 | if (ar || !(i in from)) {
|
16 | if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
17 | ar[i] = from[i];
|
18 | }
|
19 | }
|
20 | return to.concat(ar || Array.prototype.slice.call(from));
|
21 | };
|
22 | Object.defineProperty(exports, "__esModule", { value: true });
|
23 | exports.filterFunctionV4 = exports.filterFunction = void 0;
|
24 | var filter_function_1 = require("../odata-common/filter/filter-function");
|
25 | var collection_filter_function_1 = require("../odata-common/filter/collection-filter-function");
|
26 | var date_filter_function_1 = require("./filter/date-filter-function");
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | function filterFunction(functionName, returnType) {
|
35 | var parameters = [];
|
36 | for (var _i = 2; _i < arguments.length; _i++) {
|
37 | parameters[_i - 2] = arguments[_i];
|
38 | }
|
39 | if (returnType === 'datetimeoffset') {
|
40 | return new date_filter_function_1.DateFilterFunction(functionName, parameters);
|
41 | }
|
42 | if (isCollectionReturnType(returnType)) {
|
43 | var edmType = returnTypeMapping[returnType.replace('[]', '')];
|
44 | if (edmType) {
|
45 | return new collection_filter_function_1.CollectionFilterFunction(functionName, parameters, edmType);
|
46 | }
|
47 | throw new Error("Cannot create filter function for unknown return type ".concat(returnType, "."));
|
48 | }
|
49 | return filter_function_1.createFilterFunction.apply(void 0, __spreadArray([functionName, returnType], parameters, false));
|
50 | }
|
51 | exports.filterFunction = filterFunction;
|
52 | exports.filterFunctionV4 = filterFunction;
|
53 | function isCollectionReturnType(returnType) {
|
54 | return returnType.endsWith('[]');
|
55 | }
|
56 | var returnTypeMapping = __assign({ datetimeoffset: 'Edm.DateTimeOffset', boolean: 'Edm.Boolean', string: 'Edm.String' }, filter_function_1.numberReturnTypeMapping);
|
57 |
|
\ | No newline at end of file |