@fibery/views 17.0.1 → 17.0.3

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.
Files changed (2) hide show
  1. package/lib/views.js +16 -27
  2. package/package.json +5 -5
package/lib/views.js CHANGED
@@ -1,6 +1,7 @@
1
1
  var immutableUpdate = require('immutability-helper');
2
2
  var _ = require('lodash');
3
- var expressionUtils = require('@fibery/expression-utils');
3
+ var utils = require('@fibery/expression-utils/src/utils');
4
+ var visitors = require('@fibery/expression-utils/src/visitors');
4
5
 
5
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
7
 
@@ -10,11 +11,6 @@ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
10
11
  // Return this symbol from a visitor callback to remove the node from the
11
12
  // output. Not supported in all places, add support as needed.
12
13
  const REMOVE = Symbol("remove");
13
- const {
14
- deleteExpressionsWithNotFoundFieldsVisitor,
15
- replaceIdsWithNamesVisitor: replaceIdsWithNamesVisitor$1,
16
- replaceNamesWithIdsVisitor: replaceNamesWithIdsVisitor$1
17
- } = expressionUtils.visitors;
18
14
  function visitDeleteExpressionInFilterGroup(filter, visitExpression) {
19
15
  if (filter.kind !== "group") {
20
16
  return null;
@@ -57,10 +53,10 @@ const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, quer
57
53
  return ___default["default"].pickBy({
58
54
  ...queryExpression,
59
55
  ...(whereExpression ? {
60
- "q/where": deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(whereExpression)
56
+ "q/where": visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(whereExpression)
61
57
  } : null),
62
58
  ...(orderByExpression ? {
63
- "q/order-by": deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitOrderByExpression(orderByExpression)
59
+ "q/order-by": visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitOrderByExpression(orderByExpression)
64
60
  } : null)
65
61
  });
66
62
  }
@@ -69,14 +65,14 @@ const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, quer
69
65
  const replaceNamesWithIdsInExpression = (schema, fromType, expression) => {
70
66
  if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
71
67
  const typeObject = schema.typeObjectsByName[fromType];
72
- return replaceNamesWithIdsVisitor$1(typeObject).visitExpression(expression);
68
+ return visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression);
73
69
  }
74
70
  return expression;
75
71
  };
76
72
  const replaceIdsWithNamesInExpression = (schema, fromTypeId, expression) => {
77
73
  if (schema.typeObjectsById.hasOwnProperty(fromTypeId)) {
78
74
  const typeObject = schema.typeObjectsById[fromTypeId];
79
- return replaceIdsWithNamesVisitor$1(typeObject).visitExpression(expression);
75
+ return visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression);
80
76
  }
81
77
  return expression;
82
78
  };
@@ -112,10 +108,10 @@ const replaceIdsWithNamesInQueryExpression = (schema, queryExpression) => {
112
108
  "q/from": typeObject.name
113
109
  },
114
110
  ...(whereExpression ? {
115
- "q/where": replaceIdsWithNamesVisitor$1(typeObject).visitExpression(whereExpression)
111
+ "q/where": visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(whereExpression)
116
112
  } : null),
117
113
  ...(orderByExpression ? {
118
- "q/order-by": replaceIdsWithNamesVisitor$1(typeObject).visitOrderByExpression(orderByExpression)
114
+ "q/order-by": visitors.replaceIdsWithNamesVisitor(typeObject).visitOrderByExpression(orderByExpression)
119
115
  } : null)
120
116
  };
121
117
  }
@@ -144,14 +140,14 @@ function visitFilterGroup(filter, visitExpression, type) {
144
140
  const replaceIdsWithNamesInFilter = (schema, fromType, filter) => {
145
141
  if (schema.typeObjectsById.hasOwnProperty(fromType)) {
146
142
  const typeObject = schema.typeObjectsById[fromType];
147
- return filter ? visitFilterGroup(filter, expression => replaceIdsWithNamesVisitor$1(typeObject).visitExpression(expression)) : null;
143
+ return filter ? visitFilterGroup(filter, expression => visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression)) : null;
148
144
  }
149
145
  return filter;
150
146
  };
151
147
  const replaceNamesWithIdsInFilter = (schema, fromType, filter) => {
152
148
  if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
153
149
  const typeObject = schema.typeObjectsByName[fromType];
154
- return filter ? visitFilterGroup(filter, expression => replaceNamesWithIdsVisitor$1(typeObject).visitExpression(expression)) : null;
150
+ return filter ? visitFilterGroup(filter, expression => visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression)) : null;
155
151
  }
156
152
  return filter;
157
153
  };
@@ -169,10 +165,10 @@ const replaceNamesWithIdsInQueryExpression = (schema, queryExpression) => {
169
165
  "q/from": typeObject.id
170
166
  },
171
167
  ...(whereExpression ? {
172
- "q/where": replaceNamesWithIdsVisitor$1(typeObject).visitExpression(whereExpression)
168
+ "q/where": visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(whereExpression)
173
169
  } : null),
174
170
  ...(orderByExpression ? {
175
- "q/order-by": replaceNamesWithIdsVisitor$1(typeObject).visitOrderByExpression(orderByExpression)
171
+ "q/order-by": visitors.replaceNamesWithIdsVisitor(typeObject).visitOrderByExpression(orderByExpression)
176
172
  } : null)
177
173
  };
178
174
  }
@@ -181,7 +177,7 @@ const replaceNamesWithIdsInQueryExpression = (schema, queryExpression) => {
181
177
  const deleteExpressionWithNotFoundFieldsOrTypesInExpression = (schema, fromType, expression) => {
182
178
  if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
183
179
  const typeObject = schema.typeObjectsByName[fromType];
184
- return deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(expression);
180
+ return visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(expression);
185
181
  }
186
182
  return null;
187
183
  };
@@ -393,9 +389,6 @@ const enableHideWhenEmptyForCheckedEditableUnit = unit => {
393
389
  return unit;
394
390
  };
395
391
 
396
- const {
397
- isFieldExpression
398
- } = expressionUtils.utils;
399
392
  const visitQueryExpressionHolder = (queryHolder, visitor) => {
400
393
  if (queryHolder) {
401
394
  const {
@@ -460,7 +453,7 @@ const visitAxis$1 = (axis, visitor) => {
460
453
  }
461
454
  return axis;
462
455
  };
463
- const isAxisFieldExpression = expression => isFieldExpression(expression) && expression.length === 1;
456
+ const isAxisFieldExpression = expression => utils.isFieldExpression(expression) && expression.length === 1;
464
457
  const ensureAxisAndItemExpressionInvariant$1 = view => {
465
458
  const actions = [];
466
459
  const x = ___default["default"].get(view, ["fibery/meta", "x"]);
@@ -1061,10 +1054,6 @@ const enableHideWhenEmptyForCheckedUnits$1 = view => {
1061
1054
  });
1062
1055
  };
1063
1056
 
1064
- const {
1065
- replaceIdsWithNamesVisitor,
1066
- replaceNamesWithIdsVisitor
1067
- } = expressionUtils.visitors;
1068
1057
  const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["default"](smartFolder, {
1069
1058
  "fibery/meta": {
1070
1059
  items: {
@@ -1197,7 +1186,7 @@ const replaceIdsWithNamesInGroupByExpression = (schema, groupByExpression, fromT
1197
1186
  if (schema.typeObjectsById.hasOwnProperty(fromType)) {
1198
1187
  const typeObject = schema.typeObjectsById[fromType];
1199
1188
  return [index, {
1200
- expression: replaceIdsWithNamesVisitor(typeObject).visitExpression(expression)
1189
+ expression: visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression)
1201
1190
  }];
1202
1191
  } else {
1203
1192
  return [index, {
@@ -1216,7 +1205,7 @@ const replaceNamesWithIdsInGroupByExpression = (schema, groupByExpression, fromT
1216
1205
  if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
1217
1206
  const typeObject = schema.typeObjectsByName[fromType];
1218
1207
  return [index, {
1219
- expression: replaceNamesWithIdsVisitor(typeObject).visitExpression(expression)
1208
+ expression: visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression)
1220
1209
  }];
1221
1210
  } else {
1222
1211
  return [index, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/views",
3
- "version": "17.0.1",
3
+ "version": "17.0.3",
4
4
  "description": "Operations on view objects",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Fibery",
@@ -19,12 +19,12 @@
19
19
  "lodash": "4.17.21",
20
20
  "microbundle": "0.15.1",
21
21
  "@fibery/babel-preset": "7.4.0",
22
- "@fibery/expression-utils": "9.5.1",
23
- "@fibery/eslint-config": "8.6.1",
24
- "@fibery/schema": "10.2.8"
22
+ "@fibery/schema": "10.2.8",
23
+ "@fibery/expression-utils": "9.5.3",
24
+ "@fibery/eslint-config": "8.6.1"
25
25
  },
26
26
  "peerDependencies": {
27
- "@fibery/expression-utils": "^9.5.1",
27
+ "@fibery/expression-utils": "^9.5.3",
28
28
  "@fibery/schema": "^10.2.8",
29
29
  "immutability-helper": "^2.4.0",
30
30
  "lodash": "^4.17.21"