@fibery/expression-utils 9.5.0 → 9.5.2

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.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getWithinOperatorCustomMatchFn = exports.getWithinOperatorCustomConvertFn = exports.getCompareOperatorForDateTime = exports.isDateTime = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const params_placeholders_1 = require("../params-placeholders");
9
- const pattern_match_ts_1 = require("./pattern-match.ts");
9
+ const pattern_match_1 = require("./pattern-match");
10
10
  const patternMatchPlaceholders_1 = require("./patternMatchPlaceholders");
11
11
  const isoDateTimeSample = "2018-05-30T07:57:45.190Z";
12
12
  const isoDateSample = "2018-05-30";
@@ -20,7 +20,7 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
20
20
  id,
21
21
  title,
22
22
  customMatch: (where, params, typeObject) => {
23
- const { matchSuccess, matches: [fieldMatch, paramMatch], } = (0, pattern_match_ts_1.doPatternMatch)(where, params, [
23
+ const { matchSuccess, matches: [fieldMatch, paramMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, [
24
24
  operator,
25
25
  patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder,
26
26
  (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => {
@@ -139,7 +139,7 @@ const getWithinRangeValue = (paramMatchValue) => {
139
139
  }
140
140
  };
141
141
  const matchWithinOperator = (pattern, where, params, typeObject) => {
142
- const { matchSuccess, matches: [firstFieldMatch, firstParamMatch, secondFieldMatch, secondParamMatch], } = (0, pattern_match_ts_1.doPatternMatch)(where, params, pattern, typeObject);
142
+ const { matchSuccess, matches: [firstFieldMatch, firstParamMatch, secondFieldMatch, secondParamMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, pattern, typeObject);
143
143
  if (matchSuccess && lodash_1.default.isEqual(firstFieldMatch.value, secondFieldMatch.value)) {
144
144
  return {
145
145
  matchSuccess,
@@ -10,7 +10,7 @@ const lodash_1 = __importDefault(require("lodash"));
10
10
  const uuid_1 = require("uuid");
11
11
  const params_placeholders_1 = require("../params-placeholders");
12
12
  const operatorUtils_1 = require("./operatorUtils");
13
- const pattern_match_ts_1 = require("./pattern-match.ts");
13
+ const pattern_match_1 = require("./pattern-match");
14
14
  const patternMatchPlaceholders_1 = require("./patternMatchPlaceholders");
15
15
  const patternToExpression_1 = require("./patternToExpression");
16
16
  const referenceIsMePattern = ["=", patternMatchPlaceholders_1.referenceExpressionPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => x === "$my-id")];
@@ -21,7 +21,7 @@ const getReferenceMeOperator = ({ id, title, pattern }) => {
21
21
  id,
22
22
  title,
23
23
  customMatch: (where, params, typeObject) => {
24
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, pattern, typeObject);
24
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, pattern, typeObject);
25
25
  if (matchSuccess) {
26
26
  return { matchSuccess, expression: matches[0].value };
27
27
  }
@@ -291,7 +291,7 @@ exports.operatorCollectionContains = {
291
291
  id: ":operator/collection-contains",
292
292
  title: "contains",
293
293
  customMatch: (where, params, typeObject) => {
294
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, collectionContainsPattern, typeObject);
294
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionContainsPattern, typeObject);
295
295
  if (matchSuccess) {
296
296
  return {
297
297
  matchSuccess,
@@ -310,7 +310,7 @@ const getOperatorCollectionMe = ({ id, title, pattern }) => ({
310
310
  id,
311
311
  title,
312
312
  customMatch: (where, params, typeObject) => {
313
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, pattern, typeObject);
313
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, pattern, typeObject);
314
314
  if (matchSuccess) {
315
315
  return { matchSuccess, expression: [...matches[0].value, "fibery/id"] };
316
316
  }
@@ -337,7 +337,7 @@ exports.operatorCollectionContainsAnyOf = {
337
337
  id: ":operator/collection-contains-any-of",
338
338
  title: "contains any of",
339
339
  customMatch: (where, params, typeObject) => {
340
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, collectionContainsAnyOfPattern, typeObject);
340
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionContainsAnyOfPattern, typeObject);
341
341
  if (matchSuccess) {
342
342
  return {
343
343
  matchSuccess,
@@ -356,7 +356,7 @@ exports.operatorCollectionDoesNotContain = {
356
356
  id: ":operator/collection-does-not-contain",
357
357
  title: "does not contain",
358
358
  customMatch: (where, params, typeObject) => {
359
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, collectionDoesNotContainPattern, typeObject);
359
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionDoesNotContainPattern, typeObject);
360
360
  if (matchSuccess) {
361
361
  return {
362
362
  matchSuccess,
@@ -380,7 +380,7 @@ exports.operatorCollectionDoesNotContainAnyOf = {
380
380
  id: ":operator/collection-does-not-contain-any-of",
381
381
  title: "contains none of",
382
382
  customMatch: (where, params, typeObject) => {
383
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, collectionDoesNotContainAnyOfPattern, typeObject);
383
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, collectionDoesNotContainAnyOfPattern, typeObject);
384
384
  if (matchSuccess) {
385
385
  return {
386
386
  matchSuccess,
@@ -412,7 +412,7 @@ exports.operatorBoolIs = {
412
412
  title: "is",
413
413
  customMatch: (where, params, typeObject) => {
414
414
  {
415
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, ["=", patternMatchPlaceholders_1.boolFieldPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => x === true || x === false)], typeObject);
415
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, ["=", patternMatchPlaceholders_1.boolFieldPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => x === true || x === false)], typeObject);
416
416
  if (matchSuccess) {
417
417
  return {
418
418
  matchSuccess,
@@ -423,7 +423,7 @@ exports.operatorBoolIs = {
423
423
  }
424
424
  {
425
425
  // This is old expression version, just for backward compatibility.
426
- const { matchSuccess, matches } = (0, pattern_match_ts_1.doPatternMatch)(where, params, [
426
+ const { matchSuccess, matches } = (0, pattern_match_1.doPatternMatch)(where, params, [
427
427
  "or",
428
428
  ["=", patternMatchPlaceholders_1.boolFieldPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => x === false)],
429
429
  ["=", patternMatchPlaceholders_1.boolFieldPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => x === null)],
@@ -509,7 +509,7 @@ exports.operatorDateTimeIs = {
509
509
  title: "is",
510
510
  customMatch: (where, params, typeObject) => {
511
511
  {
512
- const { matchSuccess, matches: [firstFieldMatch, firstParamMatch, secondFieldMatch, secondParamMatch], } = (0, pattern_match_ts_1.doPatternMatch)(where, params, [
512
+ const { matchSuccess, matches: [firstFieldMatch, firstParamMatch, secondFieldMatch, secondParamMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, [
513
513
  "and",
514
514
  [">=", patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)()],
515
515
  ["<=", patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)()],
@@ -531,7 +531,7 @@ exports.operatorDateTimeIs = {
531
531
  }
532
532
  }
533
533
  {
534
- const { matchSuccess, matches: [fieldMatch, paramMatch], } = (0, pattern_match_ts_1.doPatternMatch)(where, params, ["=", patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => lodash_1.default.isString(x) && (0, operatorUtils_1.isDateTime)(x))], typeObject);
534
+ const { matchSuccess, matches: [fieldMatch, paramMatch], } = (0, pattern_match_1.doPatternMatch)(where, params, ["=", patternMatchPlaceholders_1.dateTimeOrDateTimeRangeExpressionPlaceholder, (0, patternMatchPlaceholders_1.getParamPlaceholder)((x) => lodash_1.default.isString(x) && (0, operatorUtils_1.isDateTime)(x))], typeObject);
535
535
  if (matchSuccess) {
536
536
  return {
537
537
  matchSuccess,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/expression-utils",
3
- "version": "9.5.0",
3
+ "version": "9.5.2",
4
4
  "description": "utils for working with fibery api expressions",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -10,6 +10,14 @@
10
10
  ".": {
11
11
  "types": "./lib/index.d.ts",
12
12
  "default": "./lib/index.js"
13
+ },
14
+ "./src/visitors": {
15
+ "types": "./lib/src/visitors.d.ts",
16
+ "default": "./lib/src/visitors.js"
17
+ },
18
+ "./src/utils": {
19
+ "types": "./lib/src/utils.d.ts",
20
+ "default": "./lib/src/utils.js"
13
21
  }
14
22
  },
15
23
  "fiberyDevExports": {
@@ -39,8 +47,8 @@
39
47
  "jest-junit": "13.0.0",
40
48
  "typescript": "5.8.3",
41
49
  "@fibery/babel-preset": "7.4.0",
42
- "@fibery/eslint-config": "8.6.1",
43
- "@fibery/schema": "10.2.8"
50
+ "@fibery/schema": "10.2.8",
51
+ "@fibery/eslint-config": "8.6.1"
44
52
  },
45
53
  "peerDependencies": {
46
54
  "@fibery/schema": "10.2.8"