@fibery/views 1.0.2 → 1.1.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.
- package/lib/views.js +1007 -0
- package/package.json +6 -7
- package/lib/index.js +0 -1
package/lib/views.js
ADDED
|
@@ -0,0 +1,1007 @@
|
|
|
1
|
+
var utils = require('@fibery/expression-utils/utils');
|
|
2
|
+
var immutableUpdate = require('immutability-helper');
|
|
3
|
+
var _ = require('lodash');
|
|
4
|
+
var visitors = require('@fibery/expression-utils/visitors');
|
|
5
|
+
|
|
6
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
|
+
|
|
8
|
+
var immutableUpdate__default = /*#__PURE__*/_interopDefaultLegacy(immutableUpdate);
|
|
9
|
+
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
10
|
+
|
|
11
|
+
function _extends() {
|
|
12
|
+
_extends = Object.assign || function (target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i];
|
|
15
|
+
|
|
16
|
+
for (var key in source) {
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
18
|
+
target[key] = source[key];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return target;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return _extends.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const fixViewUnit = (schema, fromType, unit) => {
|
|
30
|
+
const {
|
|
31
|
+
type,
|
|
32
|
+
expression
|
|
33
|
+
} = unit;
|
|
34
|
+
|
|
35
|
+
if (type === "date") {
|
|
36
|
+
const [field] = expression;
|
|
37
|
+
|
|
38
|
+
if (schema.typeObjectsByName[fromType].fieldObjectsByName[field].type === "fibery/date-time") {
|
|
39
|
+
return _extends({}, unit, {
|
|
40
|
+
type: "date-time"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (type === "date-range") {
|
|
46
|
+
const [field] = expression;
|
|
47
|
+
|
|
48
|
+
if (schema.typeObjectsByName[fromType].fieldObjectsByName[field].type === "fibery/date-time-range") {
|
|
49
|
+
return _extends({}, unit, {
|
|
50
|
+
type: "date-time-range"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return unit;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, queryExpression) => {
|
|
59
|
+
const {
|
|
60
|
+
"q/from": fromExpression,
|
|
61
|
+
"q/where": whereExpression,
|
|
62
|
+
"q/order-by": orderByExpression
|
|
63
|
+
} = queryExpression;
|
|
64
|
+
|
|
65
|
+
if (schema.typeObjectsByName.hasOwnProperty(fromExpression)) {
|
|
66
|
+
const typeObject = schema.typeObjectsByName[fromExpression];
|
|
67
|
+
return ___default["default"].pickBy(_extends({}, queryExpression, whereExpression ? {
|
|
68
|
+
"q/where": visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(whereExpression)
|
|
69
|
+
} : null, orderByExpression ? {
|
|
70
|
+
"q/order-by": visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitOrderByExpression(orderByExpression)
|
|
71
|
+
} : null));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null;
|
|
75
|
+
};
|
|
76
|
+
const replaceNamesWithIdsInExpression = (schema, fromType, expression) => {
|
|
77
|
+
if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
|
|
78
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
79
|
+
return visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return expression;
|
|
83
|
+
};
|
|
84
|
+
const replaceIdsWithNamesInExpression = (schema, fromTypeId, expression) => {
|
|
85
|
+
if (schema.typeObjectsById.hasOwnProperty(fromTypeId)) {
|
|
86
|
+
const typeObject = schema.typeObjectsById[fromTypeId];
|
|
87
|
+
return visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return expression;
|
|
91
|
+
};
|
|
92
|
+
const visitViewUnit = (fromType, unit, visitor) => {
|
|
93
|
+
const {
|
|
94
|
+
expression
|
|
95
|
+
} = unit;
|
|
96
|
+
|
|
97
|
+
if (expression) {
|
|
98
|
+
return _extends({}, unit, {
|
|
99
|
+
expression: visitor.visitExpression(fromType, expression)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return unit;
|
|
104
|
+
};
|
|
105
|
+
const replaceIdsWithNamesInQueryExpression = (schema, queryExpression) => {
|
|
106
|
+
const {
|
|
107
|
+
"q/from": fromExpression,
|
|
108
|
+
"q/where": whereExpression,
|
|
109
|
+
"q/order-by": orderByExpression
|
|
110
|
+
} = queryExpression;
|
|
111
|
+
|
|
112
|
+
if (schema.typeObjectsById.hasOwnProperty(fromExpression)) {
|
|
113
|
+
const typeObject = schema.typeObjectsById[fromExpression];
|
|
114
|
+
return _extends({}, queryExpression, {
|
|
115
|
+
"q/from": typeObject.name
|
|
116
|
+
}, whereExpression ? {
|
|
117
|
+
"q/where": visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(whereExpression)
|
|
118
|
+
} : null, orderByExpression ? {
|
|
119
|
+
"q/order-by": visitors.replaceIdsWithNamesVisitor(typeObject).visitOrderByExpression(orderByExpression)
|
|
120
|
+
} : null);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return queryExpression;
|
|
124
|
+
};
|
|
125
|
+
const replaceNamesWithIdsInQueryExpression = (schema, queryExpression) => {
|
|
126
|
+
const {
|
|
127
|
+
"q/from": fromExpression,
|
|
128
|
+
"q/where": whereExpression,
|
|
129
|
+
"q/order-by": orderByExpression
|
|
130
|
+
} = queryExpression;
|
|
131
|
+
|
|
132
|
+
if (schema.typeObjectsByName.hasOwnProperty(fromExpression)) {
|
|
133
|
+
const typeObject = schema.typeObjectsByName[fromExpression];
|
|
134
|
+
return _extends({}, queryExpression, {
|
|
135
|
+
"q/from": typeObject.id
|
|
136
|
+
}, whereExpression ? {
|
|
137
|
+
"q/where": visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(whereExpression)
|
|
138
|
+
} : null, orderByExpression ? {
|
|
139
|
+
"q/order-by": visitors.replaceNamesWithIdsVisitor(typeObject).visitOrderByExpression(orderByExpression)
|
|
140
|
+
} : null);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return queryExpression;
|
|
144
|
+
};
|
|
145
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInExpression = (schema, fromType, expression) => {
|
|
146
|
+
if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
|
|
147
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
148
|
+
return visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(expression);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return null;
|
|
152
|
+
};
|
|
153
|
+
const isUnitExpressionValid = unit => {
|
|
154
|
+
if (unit.hasOwnProperty("expression")) {
|
|
155
|
+
const {
|
|
156
|
+
expression
|
|
157
|
+
} = unit;
|
|
158
|
+
return expression !== null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return true;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const visitQueryExpressionHolder = (queryHolder, visitor) => {
|
|
165
|
+
if (queryHolder) {
|
|
166
|
+
const {
|
|
167
|
+
query
|
|
168
|
+
} = queryHolder;
|
|
169
|
+
|
|
170
|
+
if (query) {
|
|
171
|
+
const queryNew = visitor.visitQueryExpression(query);
|
|
172
|
+
return queryNew ? _extends({}, queryHolder, {
|
|
173
|
+
query: queryNew
|
|
174
|
+
}) : null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return queryHolder;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return queryHolder;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const visitAxisUnits = (axis, fromType, visitor) => {
|
|
184
|
+
return fromType ? immutableUpdate__default["default"](axis, {
|
|
185
|
+
contextExpression: {
|
|
186
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
187
|
+
},
|
|
188
|
+
units: {
|
|
189
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
190
|
+
}
|
|
191
|
+
}) : axis;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const visitAxis$1 = (axis, visitor) => {
|
|
195
|
+
if (axis && axis.hasOwnProperty("query")) {
|
|
196
|
+
const fromType = ___default["default"].get(axis, ["query", "q/from"]);
|
|
197
|
+
|
|
198
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(axis, visitor);
|
|
199
|
+
|
|
200
|
+
if (axisWithVisitedQuery) {
|
|
201
|
+
return visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return axisWithVisitedQuery;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (axis && axis.hasOwnProperty("enums")) {
|
|
208
|
+
const axisNew = immutableUpdate__default["default"](axis, {
|
|
209
|
+
enums: {
|
|
210
|
+
$apply: enums => visitor.visitEnums(enums)
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const {
|
|
214
|
+
enums
|
|
215
|
+
} = axisNew;
|
|
216
|
+
return enums ? axisNew : null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return axis;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const ensureAxisAndItemExpressionInvariant$1 = view => {
|
|
223
|
+
const actions = [];
|
|
224
|
+
|
|
225
|
+
const x = ___default["default"].get(view, ["fibery/meta", "x"]);
|
|
226
|
+
|
|
227
|
+
const y = ___default["default"].get(view, ["fibery/meta", "y"]);
|
|
228
|
+
|
|
229
|
+
const items = ___default["default"].get(view, ["fibery/meta", "items"]);
|
|
230
|
+
|
|
231
|
+
if (x === null) {
|
|
232
|
+
const resetActions = items.map(item => () => item.xExpression = null);
|
|
233
|
+
actions.push(...resetActions);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (x !== null && ___default["default"].some(items, ({
|
|
237
|
+
xExpression
|
|
238
|
+
}) => xExpression === null)) {
|
|
239
|
+
const resetActions = items.map(item => () => item.xExpression = null);
|
|
240
|
+
actions.push(...resetActions);
|
|
241
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (y === null) {
|
|
245
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
246
|
+
actions.push(...resetActions);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (y !== null && ___default["default"].some(items, ({
|
|
250
|
+
yExpression
|
|
251
|
+
}) => yExpression === null)) {
|
|
252
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
253
|
+
actions.push(...resetActions);
|
|
254
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (x !== null && ___default["default"].isEmpty(items)) {
|
|
258
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (y !== null && ___default["default"].isEmpty(items)) {
|
|
262
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (x !== null && ___default["default"].some(items, ({
|
|
266
|
+
xExpression
|
|
267
|
+
}) => !utils.isAxisFieldExpression(xExpression))) {
|
|
268
|
+
const resetActions = items.map(item => () => item.xExpression = null);
|
|
269
|
+
actions.push(...resetActions);
|
|
270
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (y !== null && ___default["default"].some(items, ({
|
|
274
|
+
yExpression
|
|
275
|
+
}) => !utils.isAxisFieldExpression(yExpression))) {
|
|
276
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
277
|
+
actions.push(...resetActions);
|
|
278
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
actions.forEach(action => action());
|
|
282
|
+
return view;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const visitView$4 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
286
|
+
"fibery/meta": {
|
|
287
|
+
x: {
|
|
288
|
+
$apply: x => visitAxis$1(x, visitor)
|
|
289
|
+
},
|
|
290
|
+
y: {
|
|
291
|
+
$apply: y => visitAxis$1(y, visitor)
|
|
292
|
+
},
|
|
293
|
+
items: {
|
|
294
|
+
$apply: items => items.map(item => {
|
|
295
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
296
|
+
|
|
297
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
298
|
+
xExpression: {
|
|
299
|
+
$apply: xExpression => xExpression ? visitor.visitExpression(fromType, xExpression) : xExpression
|
|
300
|
+
},
|
|
301
|
+
yExpression: {
|
|
302
|
+
$apply: yExpression => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression
|
|
303
|
+
},
|
|
304
|
+
contextExpression: {
|
|
305
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
306
|
+
},
|
|
307
|
+
query: {
|
|
308
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
309
|
+
},
|
|
310
|
+
units: {
|
|
311
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
312
|
+
},
|
|
313
|
+
colorCoding: {
|
|
314
|
+
$apply: colorCodings => {
|
|
315
|
+
return colorCodings ? colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
316
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
317
|
+
})).filter(colorCoding => colorCoding.expression !== null) : undefined;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}) : item;
|
|
321
|
+
}).filter(item => {
|
|
322
|
+
const {
|
|
323
|
+
query
|
|
324
|
+
} = item;
|
|
325
|
+
return query ? item : null;
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
const replaceNamesWithIdsViewVisitor = schema => {
|
|
332
|
+
const visitor = {
|
|
333
|
+
visitQueryExpression: queryExpression => replaceNamesWithIdsInQueryExpression(schema, queryExpression),
|
|
334
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
335
|
+
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
336
|
+
if (schema.typeObjectsByName.hasOwnProperty(type)) {
|
|
337
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
338
|
+
|
|
339
|
+
const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
|
|
340
|
+
|
|
341
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
342
|
+
result[typeObject.id] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
343
|
+
} else {
|
|
344
|
+
result[type] = queryHolder;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return result;
|
|
348
|
+
}, {})
|
|
349
|
+
};
|
|
350
|
+
return visitor;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const replaceIdsWithNamesViewVisitor = schema => {
|
|
354
|
+
const visitor = {
|
|
355
|
+
visitQueryExpression: queryExpression => replaceIdsWithNamesInQueryExpression(schema, queryExpression),
|
|
356
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
357
|
+
visitEnums: enums => ___default["default"].entries(enums).reduce((result, [typeId, queryHolder]) => {
|
|
358
|
+
if (schema.typeObjectsById.hasOwnProperty(typeId)) {
|
|
359
|
+
const typeObject = schema.typeObjectsById[typeId];
|
|
360
|
+
|
|
361
|
+
const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
|
|
362
|
+
|
|
363
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
364
|
+
result[typeObject.name] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
365
|
+
} else {
|
|
366
|
+
result[typeId] = queryHolder;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return result;
|
|
370
|
+
}, {})
|
|
371
|
+
};
|
|
372
|
+
return visitor;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const deleteExpressionWithNotFoundFieldsOrTypesViewVisitor = schema => {
|
|
376
|
+
const visitor = {
|
|
377
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
378
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression),
|
|
379
|
+
visitEnums: enums => {
|
|
380
|
+
const enumsNew = ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
|
|
381
|
+
if (schema.typeObjectsByName.hasOwnProperty(type)) {
|
|
382
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
383
|
+
const queryHolderResult = visitQueryExpressionHolder(queryHolder, visitor);
|
|
384
|
+
|
|
385
|
+
if (queryHolderResult) {
|
|
386
|
+
result[typeObject.name] = queryHolderResult;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return result;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return result;
|
|
393
|
+
}, {});
|
|
394
|
+
|
|
395
|
+
return ___default["default"].isEmpty(enumsNew) ? null : enumsNew;
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
return visitor;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const fixUserSelectedUnitsViewVisitor = schema => {
|
|
402
|
+
return {
|
|
403
|
+
visitQueryExpression: queryExpression => queryExpression,
|
|
404
|
+
visitExpression: (fromType, expression) => expression,
|
|
405
|
+
visitEnums: enums => enums,
|
|
406
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
const replaceIdsWithNamesInBoardView = (schema, view) => visitView$4(view, replaceIdsWithNamesViewVisitor(schema));
|
|
411
|
+
const replaceNamesWithIdsInBoardView = (schema, view) => visitView$4(view, replaceNamesWithIdsViewVisitor(schema));
|
|
412
|
+
const deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView = (schema, view, ensureAxisInvariant = true) => {
|
|
413
|
+
const viewNew = visitView$4(view, deleteExpressionWithNotFoundFieldsOrTypesViewVisitor(schema));
|
|
414
|
+
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant$1(viewNew) : viewNew;
|
|
415
|
+
};
|
|
416
|
+
const fixUserSelectedUnitsInBoardView = (schema, view) => {
|
|
417
|
+
return visitView$4(view, fixUserSelectedUnitsViewVisitor(schema));
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const visitView$3 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
421
|
+
"fibery/meta": {
|
|
422
|
+
items: {
|
|
423
|
+
$apply: items => items.map(item => {
|
|
424
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
425
|
+
|
|
426
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
427
|
+
startExpression: {
|
|
428
|
+
$apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
|
|
429
|
+
},
|
|
430
|
+
endExpression: {
|
|
431
|
+
$apply: endExpression => endExpression ? visitor.visitExpression(fromType, endExpression) : endExpression
|
|
432
|
+
},
|
|
433
|
+
contextExpression: {
|
|
434
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
435
|
+
},
|
|
436
|
+
query: {
|
|
437
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
438
|
+
},
|
|
439
|
+
units: {
|
|
440
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
441
|
+
},
|
|
442
|
+
colorCoding: {
|
|
443
|
+
$apply: colorCodings => {
|
|
444
|
+
return colorCodings && colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
445
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
446
|
+
})).filter(colorCoding => colorCoding.expression !== null);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}) : item;
|
|
450
|
+
}).filter(item => {
|
|
451
|
+
const {
|
|
452
|
+
query
|
|
453
|
+
} = item;
|
|
454
|
+
return query ? item : null;
|
|
455
|
+
})
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
const replaceNamesWithIdsInCalendarView = (schema, view) => {
|
|
461
|
+
return visitView$3(view, {
|
|
462
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
463
|
+
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
const replaceIdsWithNamesInCalendarView = (schema, view) => {
|
|
467
|
+
return visitView$3(view, {
|
|
468
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
469
|
+
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
470
|
+
});
|
|
471
|
+
};
|
|
472
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = (schema, view) => visitView$3(view, {
|
|
473
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
474
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
475
|
+
});
|
|
476
|
+
const fixUserSelectedUnitsInCalendarView = (schema, view) => {
|
|
477
|
+
return visitView$3(view, {
|
|
478
|
+
visitExpression: (fromType, expression) => expression,
|
|
479
|
+
visitQueryExpression: query => query,
|
|
480
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
const visitView$2 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
485
|
+
"fibery/meta": {
|
|
486
|
+
items: {
|
|
487
|
+
$apply: items => items.map(item => {
|
|
488
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
489
|
+
|
|
490
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
491
|
+
postExpression: {
|
|
492
|
+
$apply: postExpression => postExpression ? visitor.visitExpression(fromType, postExpression) : postExpression
|
|
493
|
+
},
|
|
494
|
+
contextExpression: {
|
|
495
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
496
|
+
},
|
|
497
|
+
query: {
|
|
498
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
499
|
+
},
|
|
500
|
+
units: {
|
|
501
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
502
|
+
},
|
|
503
|
+
colorCoding: {
|
|
504
|
+
$apply: colorCodings => {
|
|
505
|
+
return colorCodings && colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
506
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
507
|
+
})).filter(colorCoding => colorCoding.expression !== null);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}) : item;
|
|
511
|
+
}).filter(item => {
|
|
512
|
+
const {
|
|
513
|
+
query
|
|
514
|
+
} = item;
|
|
515
|
+
return query ? item : null;
|
|
516
|
+
})
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
const replaceNamesWithIdsInFeedView = (schema, view) => {
|
|
522
|
+
return visitView$2(view, {
|
|
523
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
524
|
+
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
const replaceIdsWithNamesInFeedView = (schema, view) => {
|
|
528
|
+
return visitView$2(view, {
|
|
529
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
530
|
+
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
531
|
+
});
|
|
532
|
+
};
|
|
533
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInFeedView = (schema, view) => visitView$2(view, {
|
|
534
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
535
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
536
|
+
});
|
|
537
|
+
const fixUserSelectedUnitsInFeedView = (schema, view) => {
|
|
538
|
+
return visitView$2(view, {
|
|
539
|
+
visitExpression: (fromType, expression) => expression,
|
|
540
|
+
visitQueryExpression: query => query,
|
|
541
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["default"](smartFolder, {
|
|
546
|
+
"fibery/meta": {
|
|
547
|
+
items: {
|
|
548
|
+
$apply: items => {
|
|
549
|
+
const isOldSmartFolder = !items.every(item => item.hasOwnProperty("groupBy"));
|
|
550
|
+
let removedItems = [];
|
|
551
|
+
return items.map((item, index) => {
|
|
552
|
+
if (isOldSmartFolder) {
|
|
553
|
+
return item;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
557
|
+
|
|
558
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
559
|
+
groupBy: {
|
|
560
|
+
$apply: groupBy => {
|
|
561
|
+
const removedItemsBeforeCurrent = removedItems.filter(n => n < index);
|
|
562
|
+
return groupBy ? visitor.visitGroupByExpression(groupBy, fromType, removedItemsBeforeCurrent.length) : null;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}) : item;
|
|
566
|
+
}).map((item, index) => {
|
|
567
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
568
|
+
|
|
569
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
570
|
+
query: {
|
|
571
|
+
$apply: query => {
|
|
572
|
+
const visitedQuery = visitor.visitQueryExpression(query);
|
|
573
|
+
|
|
574
|
+
if (!visitedQuery) {
|
|
575
|
+
removedItems.push(index);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
return query ? visitedQuery : null;
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
units: {
|
|
582
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)) : undefined
|
|
583
|
+
},
|
|
584
|
+
contextExpression: {
|
|
585
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
586
|
+
},
|
|
587
|
+
colorCoding: {
|
|
588
|
+
$apply: colorCodings => {
|
|
589
|
+
return colorCodings ? colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
590
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
591
|
+
})).filter(colorCoding => colorCoding.expression !== null) : undefined;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}) : item;
|
|
595
|
+
}).filter(item => {
|
|
596
|
+
const {
|
|
597
|
+
query
|
|
598
|
+
} = item;
|
|
599
|
+
return query ? item : null;
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression = (schema, groupByExpression, fromType, removedItems) => {
|
|
607
|
+
if (!groupByExpression) {
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const [[index, {
|
|
612
|
+
expression
|
|
613
|
+
}]] = Object.entries(groupByExpression);
|
|
614
|
+
const visitedExpression = deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression);
|
|
615
|
+
|
|
616
|
+
if (visitedExpression) {
|
|
617
|
+
return {
|
|
618
|
+
[`${parseInt(index) - removedItems}`]: {
|
|
619
|
+
expression: visitedExpression
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
return null;
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
const replaceIdsWithNamesInGroupByExpression = (schema, groupByExpression, fromType) => {
|
|
628
|
+
if (!groupByExpression) {
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const [[index, {
|
|
633
|
+
expression
|
|
634
|
+
}]] = Object.entries(groupByExpression);
|
|
635
|
+
|
|
636
|
+
if (schema.typeObjectsById.hasOwnProperty(fromType)) {
|
|
637
|
+
const typeObject = schema.typeObjectsById[fromType];
|
|
638
|
+
return {
|
|
639
|
+
[index]: {
|
|
640
|
+
expression: visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression)
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
return null;
|
|
646
|
+
};
|
|
647
|
+
const replaceNamesWithIdsInGroupByExpression = (schema, groupByExpression, fromType) => {
|
|
648
|
+
if (!groupByExpression) {
|
|
649
|
+
return null;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
const [[index, {
|
|
653
|
+
expression
|
|
654
|
+
}]] = Object.entries(groupByExpression);
|
|
655
|
+
|
|
656
|
+
if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
|
|
657
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
658
|
+
return {
|
|
659
|
+
[index]: {
|
|
660
|
+
expression: visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression)
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return null;
|
|
666
|
+
};
|
|
667
|
+
const replaceNamesWithIdsInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
|
|
668
|
+
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
669
|
+
visitGroupByExpression: (groupBy, fromType) => replaceNamesWithIdsInGroupByExpression(schema, groupBy, fromType),
|
|
670
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression)
|
|
671
|
+
});
|
|
672
|
+
const replaceIdsWithNamesInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
|
|
673
|
+
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
674
|
+
visitGroupByExpression: (groupBy, fromType) => replaceIdsWithNamesInGroupByExpression(schema, groupBy, fromType),
|
|
675
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression)
|
|
676
|
+
});
|
|
677
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
|
|
678
|
+
visitQueryExpression: query => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, query),
|
|
679
|
+
visitGroupByExpression: (groupBy, fromType, removedItems) => deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression(schema, groupBy, fromType, removedItems),
|
|
680
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
const visitView$1 = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
684
|
+
"fibery/meta": {
|
|
685
|
+
items: {
|
|
686
|
+
$apply: items => items.map(item => {
|
|
687
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
688
|
+
|
|
689
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
690
|
+
query: {
|
|
691
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
692
|
+
},
|
|
693
|
+
contextExpression: {
|
|
694
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
695
|
+
},
|
|
696
|
+
units: {
|
|
697
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
698
|
+
},
|
|
699
|
+
colorCoding: {
|
|
700
|
+
$apply: colorCodings => {
|
|
701
|
+
return colorCodings && colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
702
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
703
|
+
})).filter(colorCoding => colorCoding.expression !== null);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}) : item;
|
|
707
|
+
}).filter(item => {
|
|
708
|
+
const {
|
|
709
|
+
query
|
|
710
|
+
} = item;
|
|
711
|
+
return query ? item : null;
|
|
712
|
+
})
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
const replaceNamesWithIdsInTableView = (schema, view) => visitView$1(view, {
|
|
718
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
719
|
+
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
720
|
+
});
|
|
721
|
+
const replaceIdsWithNamesInTableView = (schema, view) => visitView$1(view, {
|
|
722
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
723
|
+
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
724
|
+
});
|
|
725
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInTableView = (schema, view) => visitView$1(view, {
|
|
726
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
727
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
728
|
+
});
|
|
729
|
+
const fixUserSelectedUnitsInTableView = (schema, view) => visitView$1(view, {
|
|
730
|
+
visitExpression: (fromType, expression) => expression,
|
|
731
|
+
visitQueryExpression: query => query,
|
|
732
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
const visitAxis = (axis, visitor) => {
|
|
736
|
+
if (!axis) {
|
|
737
|
+
return axis;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
const fromType = ___default["default"].get(axis, ["query", "q/from"]);
|
|
741
|
+
|
|
742
|
+
const firstOrNull = x => ___default["default"].first(x) || null;
|
|
743
|
+
|
|
744
|
+
const axisResult = _extends({}, axis, {
|
|
745
|
+
query: axis.query && visitor.visitQueryExpression(axis.query),
|
|
746
|
+
contextExpression: axis.contextExpression && visitor.visitExpression(fromType, axis.contextExpression),
|
|
747
|
+
units: axis.units && axis.units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)),
|
|
748
|
+
groupByExpression: axis.groupByExpression && firstOrNull(visitor.visitExpression(fromType, [axis.groupByExpression]))
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
if (!axisResult.query) {
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
if (!axisResult.units) {
|
|
756
|
+
delete axisResult.units;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
return axisResult;
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
|
|
763
|
+
"fibery/meta": {
|
|
764
|
+
y: {
|
|
765
|
+
$apply: y => visitAxis(y, visitor)
|
|
766
|
+
},
|
|
767
|
+
items: {
|
|
768
|
+
$apply: items => items.map(item => {
|
|
769
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
770
|
+
|
|
771
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
772
|
+
yExpression: {
|
|
773
|
+
$apply: yExpression => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression
|
|
774
|
+
},
|
|
775
|
+
startExpression: {
|
|
776
|
+
$apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
|
|
777
|
+
},
|
|
778
|
+
endExpression: {
|
|
779
|
+
$apply: endExpression => endExpression ? visitor.visitExpression(fromType, endExpression) : endExpression
|
|
780
|
+
},
|
|
781
|
+
contextExpression: {
|
|
782
|
+
$apply: contextExpression => contextExpression ? visitor.visitExpression(fromType, contextExpression) : contextExpression
|
|
783
|
+
},
|
|
784
|
+
query: {
|
|
785
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
786
|
+
},
|
|
787
|
+
units: {
|
|
788
|
+
$apply: units => units ? units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map(unit => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit) : unit) : undefined
|
|
789
|
+
},
|
|
790
|
+
colorCoding: {
|
|
791
|
+
$apply: colorCodings => {
|
|
792
|
+
return colorCodings && colorCodings.map(colorCoding => _extends({}, colorCoding, {
|
|
793
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
794
|
+
})).filter(colorCoding => colorCoding.expression !== null);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}) : item;
|
|
798
|
+
}).filter(item => {
|
|
799
|
+
const {
|
|
800
|
+
query
|
|
801
|
+
} = item;
|
|
802
|
+
return query ? item : null;
|
|
803
|
+
})
|
|
804
|
+
},
|
|
805
|
+
milestones: {
|
|
806
|
+
$apply: milestones => {
|
|
807
|
+
if (!milestones) {
|
|
808
|
+
return milestones;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
return milestones.map(item => {
|
|
812
|
+
const fromType = ___default["default"].get(item, ["query", "q/from"]);
|
|
813
|
+
|
|
814
|
+
return fromType ? immutableUpdate__default["default"](item, {
|
|
815
|
+
dateExpression: {
|
|
816
|
+
$apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
|
|
817
|
+
},
|
|
818
|
+
query: {
|
|
819
|
+
$apply: query => query ? visitor.visitQueryExpression(query) : null
|
|
820
|
+
}
|
|
821
|
+
}) : item;
|
|
822
|
+
}).filter(item => {
|
|
823
|
+
const {
|
|
824
|
+
query
|
|
825
|
+
} = item;
|
|
826
|
+
return query ? item : null;
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
const replaceNamesWithIdsInTimelineView = (schema, view) => {
|
|
834
|
+
return visitView(view, {
|
|
835
|
+
visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
836
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression)
|
|
837
|
+
});
|
|
838
|
+
};
|
|
839
|
+
const replaceIdsWithNamesInTimelineView = (schema, view) => {
|
|
840
|
+
return visitView(view, {
|
|
841
|
+
visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
842
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression)
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
const ensureAxisAndItemExpressionInvariant = view => {
|
|
847
|
+
const actions = [];
|
|
848
|
+
|
|
849
|
+
const y = ___default["default"].get(view, ["fibery/meta", "y"]);
|
|
850
|
+
|
|
851
|
+
const yQuery = ___default["default"].get(view, ["fibery/meta", "y", "query"]);
|
|
852
|
+
|
|
853
|
+
const yGroupByExpression = ___default["default"].get(view, ["fibery/meta", "y", "groupByExpression"]);
|
|
854
|
+
|
|
855
|
+
const items = ___default["default"].get(view, ["fibery/meta", "items"]);
|
|
856
|
+
|
|
857
|
+
if (yQuery === null && yGroupByExpression !== null) {
|
|
858
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y", "groupByExpression"], null));
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
if (y === null) {
|
|
862
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
863
|
+
actions.push(...resetActions);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
if (y !== null && ___default["default"].some(items, ({
|
|
867
|
+
yExpression
|
|
868
|
+
}) => yExpression === null)) {
|
|
869
|
+
const resetActions = items.map(item => () => item.yExpression = null);
|
|
870
|
+
actions.push(...resetActions);
|
|
871
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
if (y !== null && ___default["default"].isEmpty(items)) {
|
|
875
|
+
actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
actions.forEach(action => action());
|
|
879
|
+
return view;
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view, ensureAxisInvariant = true) => {
|
|
883
|
+
const viewNew = visitView(view, {
|
|
884
|
+
visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
885
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
886
|
+
});
|
|
887
|
+
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant(viewNew) : viewNew;
|
|
888
|
+
};
|
|
889
|
+
const fixUserSelectedUnitsInTimelineView = (schema, view) => {
|
|
890
|
+
return visitView(view, {
|
|
891
|
+
visitQueryExpression: query => query,
|
|
892
|
+
visitExpression: (fromType, expression) => expression,
|
|
893
|
+
visitViewUnit: (fromType, unit) => fixViewUnit(schema, fromType, unit)
|
|
894
|
+
});
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInView = (schema, view, ensureAxisInvariant = true) => {
|
|
898
|
+
switch (view["fibery/type"]) {
|
|
899
|
+
case "board":
|
|
900
|
+
return deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView(schema, view, ensureAxisInvariant);
|
|
901
|
+
|
|
902
|
+
case "list":
|
|
903
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder(schema, view);
|
|
904
|
+
|
|
905
|
+
case "timeline":
|
|
906
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInTimelineView(schema, view, ensureAxisInvariant);
|
|
907
|
+
|
|
908
|
+
case "calendar":
|
|
909
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInCalendarView(schema, view);
|
|
910
|
+
|
|
911
|
+
case "table":
|
|
912
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInTableView(schema, view);
|
|
913
|
+
|
|
914
|
+
case "feed":
|
|
915
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInFeedView(schema, view);
|
|
916
|
+
|
|
917
|
+
default:
|
|
918
|
+
return view;
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
const fixUserSelectedUnits = (schema, view) => {
|
|
922
|
+
switch (view["fibery/type"]) {
|
|
923
|
+
case "board":
|
|
924
|
+
return fixUserSelectedUnitsInBoardView(schema, view);
|
|
925
|
+
|
|
926
|
+
case "table":
|
|
927
|
+
return fixUserSelectedUnitsInTableView(schema, view);
|
|
928
|
+
|
|
929
|
+
case "timeline":
|
|
930
|
+
return fixUserSelectedUnitsInTimelineView(schema, view);
|
|
931
|
+
|
|
932
|
+
case "calendar":
|
|
933
|
+
return fixUserSelectedUnitsInCalendarView(schema, view);
|
|
934
|
+
|
|
935
|
+
case "feed":
|
|
936
|
+
return fixUserSelectedUnitsInFeedView(schema, view);
|
|
937
|
+
|
|
938
|
+
default:
|
|
939
|
+
return view;
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
const replaceNamesWithIdsInView = (schema, view) => {
|
|
943
|
+
switch (view["fibery/type"]) {
|
|
944
|
+
case "board":
|
|
945
|
+
return replaceNamesWithIdsInBoardView(schema, view);
|
|
946
|
+
|
|
947
|
+
case "list":
|
|
948
|
+
return replaceNamesWithIdsInSmartFolder(schema, view);
|
|
949
|
+
|
|
950
|
+
case "table":
|
|
951
|
+
return replaceNamesWithIdsInTableView(schema, view);
|
|
952
|
+
|
|
953
|
+
case "timeline":
|
|
954
|
+
return replaceNamesWithIdsInTimelineView(schema, view);
|
|
955
|
+
|
|
956
|
+
case "calendar":
|
|
957
|
+
return replaceNamesWithIdsInCalendarView(schema, view);
|
|
958
|
+
|
|
959
|
+
case "feed":
|
|
960
|
+
return replaceNamesWithIdsInFeedView(schema, view);
|
|
961
|
+
|
|
962
|
+
default:
|
|
963
|
+
return view;
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
const replaceIdsWithNamesInView = (schema, view) => {
|
|
967
|
+
switch (view["fibery/type"]) {
|
|
968
|
+
case "board":
|
|
969
|
+
return replaceIdsWithNamesInBoardView(schema, view);
|
|
970
|
+
|
|
971
|
+
case "list":
|
|
972
|
+
return replaceIdsWithNamesInSmartFolder(schema, view);
|
|
973
|
+
|
|
974
|
+
case "table":
|
|
975
|
+
return replaceIdsWithNamesInTableView(schema, view);
|
|
976
|
+
|
|
977
|
+
case "timeline":
|
|
978
|
+
return replaceIdsWithNamesInTimelineView(schema, view);
|
|
979
|
+
|
|
980
|
+
case "calendar":
|
|
981
|
+
return replaceIdsWithNamesInCalendarView(schema, view);
|
|
982
|
+
|
|
983
|
+
case "feed":
|
|
984
|
+
return replaceIdsWithNamesInFeedView(schema, view);
|
|
985
|
+
|
|
986
|
+
default:
|
|
987
|
+
return view;
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
const getViewCardTypes = ({
|
|
991
|
+
"fibery/meta": {
|
|
992
|
+
items
|
|
993
|
+
}
|
|
994
|
+
}) => items.map(({
|
|
995
|
+
query: {
|
|
996
|
+
"q/from": type
|
|
997
|
+
}
|
|
998
|
+
}) => type);
|
|
999
|
+
|
|
1000
|
+
exports.deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder;
|
|
1001
|
+
exports.deleteExpressionWithNotFoundFieldsOrTypesInView = deleteExpressionWithNotFoundFieldsOrTypesInView;
|
|
1002
|
+
exports.fixUserSelectedUnits = fixUserSelectedUnits;
|
|
1003
|
+
exports.getViewCardTypes = getViewCardTypes;
|
|
1004
|
+
exports.replaceIdsWithNamesInSmartFolder = replaceIdsWithNamesInSmartFolder;
|
|
1005
|
+
exports.replaceIdsWithNamesInView = replaceIdsWithNamesInView;
|
|
1006
|
+
exports.replaceNamesWithIdsInSmartFolder = replaceNamesWithIdsInSmartFolder;
|
|
1007
|
+
exports.replaceNamesWithIdsInView = replaceNamesWithIdsInView;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/views",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Operations on view objects",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Fibery",
|
|
7
|
-
"main": "./lib/
|
|
7
|
+
"main": "./lib/views.js",
|
|
8
8
|
"browser": "./index.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"/lib"
|
|
@@ -18,17 +18,16 @@
|
|
|
18
18
|
"babel-preset-fibery": "7.2.0",
|
|
19
19
|
"eslint-config-fibery": "7.0.0",
|
|
20
20
|
"jest": "27.0.6",
|
|
21
|
-
"
|
|
22
|
-
"webpack-cli": "4.7.2"
|
|
21
|
+
"microbundle": "0.14.1"
|
|
23
22
|
},
|
|
24
23
|
"peerDependencies": {
|
|
25
|
-
"@fibery/expression-utils": "^1.
|
|
26
|
-
"fibery-schema": "^7.0.
|
|
24
|
+
"@fibery/expression-utils": "^1.1.4",
|
|
25
|
+
"fibery-schema": "^7.0.6",
|
|
27
26
|
"immutability-helper": "^2.4.0",
|
|
28
27
|
"lodash": "^4.17.21"
|
|
29
28
|
},
|
|
30
29
|
"scripts": {
|
|
31
|
-
"build": "
|
|
30
|
+
"build": "rm -rf lib && microbundle index.js -o lib -f cjs --no-compress --target node --sourcemap false",
|
|
32
31
|
"test": "node scripts/test.js",
|
|
33
32
|
"lint": "eslint ."
|
|
34
33
|
},
|
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e={n:s=>{var r=s&&s.__esModule?()=>s.default:()=>s;return e.d(r,{a:r}),r},d:(s,r)=>{for(var i in r)e.o(r,i)&&!e.o(s,i)&&Object.defineProperty(s,i,{enumerable:!0,get:r[i]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};e.r(s),e.d(s,{deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder:()=>B,deleteExpressionWithNotFoundFieldsOrTypesInView:()=>W,getViewCardTypes:()=>S,replaceIdsWithNamesInSmartFolder:()=>g,replaceIdsWithNamesInView:()=>V,replaceNamesWithIdsInSmartFolder:()=>$,replaceNamesWithIdsInView:()=>F});const r=require("immutability-helper");var i=e.n(r);const t=require("lodash");var n=e.n(t);const p=require("@fibery/expression-utils"),{deleteExpressionsWithNotFoundFieldsVisitor:o,replaceIdsWithNamesVisitor:u,replaceNamesWithIdsVisitor:l}=p.visitors,y=(e,s)=>{const{"q/from":r,"q/where":i,"q/order-by":t}=s;if(e.typeObjectsByName.hasOwnProperty(r)){const p=e.typeObjectsByName[r];return n().pickBy({...s,...i?{"q/where":o(p).visitExpression(i)}:null,...t?{"q/order-by":o(p).visitOrderByExpression(t)}:null})}return null},a=(e,s,r)=>{if(e.typeObjectsByName.hasOwnProperty(s)){const i=e.typeObjectsByName[s];return l(i).visitExpression(r)}return r},x=(e,s,r)=>{if(e.typeObjectsById.hasOwnProperty(s)){const i=e.typeObjectsById[s];return u(i).visitExpression(r)}return r},c=(e,s,r)=>{const{expression:i}=s;return i?{...s,expression:r.visitExpression(e,i)}:s},m=(e,s)=>{const{"q/from":r,"q/where":i,"q/order-by":t}=s;if(e.typeObjectsById.hasOwnProperty(r)){const n=e.typeObjectsById[r];return{...s,"q/from":n.name,...i?{"q/where":u(n).visitExpression(i)}:null,...t?{"q/order-by":u(n).visitOrderByExpression(t)}:null}}return s},E=(e,s)=>{const{"q/from":r,"q/where":i,"q/order-by":t}=s;if(e.typeObjectsByName.hasOwnProperty(r)){const n=e.typeObjectsByName[r];return{...s,"q/from":n.id,...i?{"q/where":l(n).visitExpression(i)}:null,...t?{"q/order-by":l(n).visitOrderByExpression(t)}:null}}return s},f=(e,s,r)=>{if(e.typeObjectsByName.hasOwnProperty(s)){const i=e.typeObjectsByName[s];return o(i).visitExpression(r)}return null},v=e=>{if(e.hasOwnProperty("expression")){const{expression:s}=e;return null!==s}return!0},d=(e,s)=>i()(e,{"fibery/meta":{items:{$apply:e=>e.map((e=>{const r=n().get(e,["query","q/from"]);return r?i()(e,{query:{$apply:e=>e?s.visitQueryExpression(e):null},contextExpression:{$apply:e=>e?s.visitExpression(r,e):e},units:{$apply:e=>e?e.map((e=>c(r,e,s))).filter((e=>v(e))):null},colorCoding:{$apply:e=>e&&e.map((e=>({...e,expression:s.visitExpression(r,e.expression)}))).filter((e=>null!==e.expression))}}):e})).filter((e=>{const{query:s}=e;return s?e:null}))}}}),b=(e,s)=>i()(e,{"fibery/meta":{items:{$apply:e=>e.map((e=>{const r=n().get(e,["query","q/from"]);return r?i()(e,{startExpression:{$apply:e=>e?s.visitExpression(r,e):e},endExpression:{$apply:e=>e?s.visitExpression(r,e):e},contextExpression:{$apply:e=>e?s.visitExpression(r,e):e},query:{$apply:e=>e?s.visitQueryExpression(e):null},units:{$apply:e=>e?e.map((e=>c(r,e,s))).filter((e=>v(e))):null},colorCoding:{$apply:e=>e&&e.map((e=>({...e,expression:s.visitExpression(r,e.expression)}))).filter((e=>null!==e.expression))}}):e})).filter((e=>{const{query:s}=e;return s?e:null}))}}}),{replaceIdsWithNamesVisitor:q,replaceNamesWithIdsVisitor:h}=p.visitors,O=(e,s)=>i()(e,{"fibery/meta":{items:{$apply:e=>{const r=!e.every((e=>e.hasOwnProperty("groupBy")));let t=[];return e.map(((e,p)=>{if(r)return e;const o=n().get(e,["query","q/from"]);return o?i()(e,{groupBy:{$apply:e=>{const r=t.filter((e=>e<p));return e?s.visitGroupByExpression(e,o,r.length):null}}}):e})).map(((e,r)=>{const p=n().get(e,["query","q/from"]);return p?i()(e,{query:{$apply:e=>{const i=s.visitQueryExpression(e);return i||t.push(r),e?i:null}},units:{$apply:e=>e?e.map((e=>c(p,e,s))).filter((e=>v(e))):void 0},contextExpression:{$apply:e=>e?s.visitExpression(p,e):e},colorCoding:{$apply:e=>e?e.map((e=>({...e,expression:s.visitExpression(p,e.expression)}))).filter((e=>null!==e.expression)):void 0}}):e})).filter((e=>{const{query:s}=e;return s?e:null}))}}}}),$=(e,s)=>O(s,{visitQueryExpression:s=>E(e,s),visitGroupByExpression:(s,r)=>((e,s,r)=>{if(!s)return null;const[[i,{expression:t}]]=Object.entries(s);if(e.typeObjectsByName.hasOwnProperty(r)){const s=e.typeObjectsByName[r];return{[i]:{expression:h(s).visitExpression(t)}}}return null})(e,s,r),visitExpression:(s,r)=>a(e,s,r)}),g=(e,s)=>O(s,{visitQueryExpression:s=>m(e,s),visitGroupByExpression:(s,r)=>((e,s,r)=>{if(!s)return null;const[[i,{expression:t}]]=Object.entries(s);if(e.typeObjectsById.hasOwnProperty(r)){const s=e.typeObjectsById[r];return{[i]:{expression:q(s).visitExpression(t)}}}return null})(e,s,r),visitExpression:(s,r)=>x(e,s,r)}),B=(e,s)=>O(s,{visitQueryExpression:s=>y(e,s),visitGroupByExpression:(s,r,i)=>((e,s,r,i)=>{if(!s)return null;const[[t,{expression:n}]]=Object.entries(s),p=f(e,r,n);return p?{[""+(parseInt(t)-i)]:{expression:p}}:null})(e,s,r,i),visitExpression:(s,r)=>f(e,s,r)}),j=(e,s)=>i()(e,{"fibery/meta":{y:{$apply:e=>((e,s)=>{if(!e)return e;const r=n().get(e,["query","q/from"]),i={...e,query:e.query&&s.visitQueryExpression(e.query),contextExpression:e.contextExpression&&s.visitExpression(r,e.contextExpression),units:e.units&&e.units.map((e=>c(r,e,s))).filter((e=>v(e))),groupByExpression:e.groupByExpression&&(t=s.visitExpression(r,[e.groupByExpression]),n().first(t)||null)};var t;return i.query?(i.units||delete i.units,i):null})(e,s)},items:{$apply:e=>e.map((e=>{const r=n().get(e,["query","q/from"]);return r?i()(e,{yExpression:{$apply:e=>e?s.visitExpression(r,e):e},startExpression:{$apply:e=>e?s.visitExpression(r,e):e},endExpression:{$apply:e=>e?s.visitExpression(r,e):e},contextExpression:{$apply:e=>e?s.visitExpression(r,e):e},query:{$apply:e=>e?s.visitQueryExpression(e):null},units:{$apply:e=>e?e.map((e=>c(r,e,s))).filter((e=>v(e))):null},colorCoding:{$apply:e=>e&&e.map((e=>({...e,expression:s.visitExpression(r,e.expression)}))).filter((e=>null!==e.expression))}}):e})).filter((e=>{const{query:s}=e;return s?e:null}))},milestones:{$apply:e=>e?e.map((e=>{const r=n().get(e,["query","q/from"]);return r?i()(e,{dateExpression:{$apply:e=>e?s.visitExpression(r,e):e},query:{$apply:e=>e?s.visitQueryExpression(e):null}}):e})).filter((e=>{const{query:s}=e;return s?e:null})):e}}}),{isAxisFieldExpression:w}=p.utils,N=(e,s)=>{if(e){const{query:r}=e;if(r){const i=s.visitQueryExpression(r);return i?{...e,query:i}:null}return e}return e},I=(e,s,r)=>s?i()(e,{contextExpression:{$apply:e=>e?r.visitExpression(s,e):e},units:{$apply:e=>e?e.map((e=>c(s,e,r))).filter((e=>v(e))):void 0}}):e,Q=(e,s)=>{if(e&&e.hasOwnProperty("query")){const r=n().get(e,["query","q/from"]),i=N(e,s);return i?I(i,r,s):i}if(e&&e.hasOwnProperty("enums")){const r=i()(e,{enums:{$apply:e=>s.visitEnums(e)}}),{enums:t}=r;return t?r:null}return e},P=(e,s)=>i()(e,{"fibery/meta":{x:{$apply:e=>Q(e,s)},y:{$apply:e=>Q(e,s)},items:{$apply:e=>e.map((e=>{const r=n().get(e,["query","q/from"]);return r?i()(e,{xExpression:{$apply:e=>e?s.visitExpression(r,e):e},yExpression:{$apply:e=>e?s.visitExpression(r,e):e},contextExpression:{$apply:e=>e?s.visitExpression(r,e):e},query:{$apply:e=>e?s.visitQueryExpression(e):null},units:{$apply:e=>e?e.map((e=>c(r,e,s))).filter((e=>v(e))):null},colorCoding:{$apply:e=>e?e.map((e=>({...e,expression:s.visitExpression(r,e.expression)}))).filter((e=>null!==e.expression)):void 0}}):e})).filter((e=>{const{query:s}=e;return s?e:null}))}}}),W=(e,s)=>{switch(s["fibery/type"]){case"board":return((e,s)=>(e=>{const s=[],r=n().get(e,["fibery/meta","x"]),i=n().get(e,["fibery/meta","y"]),t=n().get(e,["fibery/meta","items"]);if(null===r){const e=t.map((e=>()=>e.xExpression=null));s.push(...e)}if(null!==r&&n().some(t,(({xExpression:e})=>null===e))){const r=t.map((e=>()=>e.xExpression=null));s.push(...r),s.push((()=>n().set(e,["fibery/meta","x"],null)))}if(null===i){const e=t.map((e=>()=>e.yExpression=null));s.push(...e)}if(null!==i&&n().some(t,(({yExpression:e})=>null===e))){const r=t.map((e=>()=>e.yExpression=null));s.push(...r),s.push((()=>n().set(e,["fibery/meta","y"],null)))}if(null!==r&&n().isEmpty(t)&&s.push((()=>n().set(e,["fibery/meta","x"],null))),null!==i&&n().isEmpty(t)&&s.push((()=>n().set(e,["fibery/meta","y"],null))),null!==r&&n().some(t,(({xExpression:e})=>!w(e)))){const r=t.map((e=>()=>e.xExpression=null));s.push(...r),s.push((()=>n().set(e,["fibery/meta","x"],null)))}if(null!==i&&n().some(t,(({yExpression:e})=>!w(e)))){const r=t.map((e=>()=>e.yExpression=null));s.push(...r),s.push((()=>n().set(e,["fibery/meta","y"],null)))}return s.forEach((e=>e())),e})(P(s,(e=>{const s={visitQueryExpression:s=>y(e,s),visitExpression:(s,r)=>f(e,s,r),visitEnums:r=>{const i=n().entries(r).reduce(((r,[i,t])=>{if(e.typeObjectsByName.hasOwnProperty(i)){const n=e.typeObjectsByName[i],p=N(t,s);return p&&(r[n.name]=p),r}return r}),{});return n().isEmpty(i)?null:i}};return s})(e))))(e,s);case"list":return B(e,s);case"timeline":return((e,s)=>(e=>{const s=[],r=n().get(e,["fibery/meta","y"]),i=n().get(e,["fibery/meta","y","query"]),t=n().get(e,["fibery/meta","y","groupByExpression"]),p=n().get(e,["fibery/meta","items"]);if(null===i&&null!==t&&s.push((()=>n().set(e,["fibery/meta","y","groupByExpression"],null))),null===r){const e=p.map((e=>()=>e.yExpression=null));s.push(...e)}if(null!==r&&n().some(p,(({yExpression:e})=>null===e))){const r=p.map((e=>()=>e.yExpression=null));s.push(...r),s.push((()=>n().set(e,["fibery/meta","y"],null)))}return null!==r&&n().isEmpty(p)&&s.push((()=>n().set(e,["fibery/meta","y"],null))),s.forEach((e=>e())),e})(j(s,{visitQueryExpression:s=>y(e,s),visitExpression:(s,r)=>f(e,s,r)})))(e,s);case"calendar":return((e,s)=>b(s,{visitQueryExpression:s=>y(e,s),visitExpression:(s,r)=>f(e,s,r)}))(e,s);case"table":return((e,s)=>d(s,{visitQueryExpression:s=>y(e,s),visitExpression:(s,r)=>f(e,s,r)}))(e,s);default:return s}},F=(e,s)=>{switch(s["fibery/type"]){case"board":return((e,s)=>P(s,(e=>{const s={visitQueryExpression:s=>E(e,s),visitExpression:(s,r)=>a(e,s,r),visitEnums:r=>n().entries(r).reduce(((r,[i,t])=>{if(e.typeObjectsByName.hasOwnProperty(i)){const p=e.typeObjectsByName[i],o=n().get(t,["query","q/from"]),u=N(t,s);r[p.id]=I(u,o,s)}else r[i]=t;return r}),{})};return s})(e)))(e,s);case"list":return $(e,s);case"table":return((e,s)=>d(s,{visitExpression:(s,r)=>a(e,s,r),visitQueryExpression:s=>E(e,s)}))(e,s);case"timeline":return((e,s)=>j(s,{visitQueryExpression:s=>E(e,s),visitExpression:(s,r)=>a(e,s,r)}))(e,s);case"calendar":return((e,s)=>b(s,{visitExpression:(s,r)=>a(e,s,r),visitQueryExpression:s=>E(e,s)}))(e,s);default:return s}},V=(e,s)=>{switch(s["fibery/type"]){case"board":return((e,s)=>P(s,(e=>{const s={visitQueryExpression:s=>m(e,s),visitExpression:(s,r)=>x(e,s,r),visitEnums:r=>n().entries(r).reduce(((r,[i,t])=>{if(e.typeObjectsById.hasOwnProperty(i)){const p=e.typeObjectsById[i],o=n().get(t,["query","q/from"]),u=N(t,s);r[p.name]=I(u,o,s)}else r[i]=t;return r}),{})};return s})(e)))(e,s);case"list":return g(e,s);case"table":return((e,s)=>d(s,{visitExpression:(s,r)=>x(e,s,r),visitQueryExpression:s=>m(e,s)}))(e,s);case"timeline":return((e,s)=>j(s,{visitQueryExpression:s=>m(e,s),visitExpression:(s,r)=>x(e,s,r)}))(e,s);case"calendar":return((e,s)=>b(s,{visitExpression:(s,r)=>x(e,s,r),visitQueryExpression:s=>m(e,s)}))(e,s);default:return s}},S=({"fibery/meta":{items:e}})=>e.map((({query:{"q/from":e}})=>e));module.exports=s})();
|