@limetech/lime-crm-building-blocks 1.105.1 → 1.105.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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/{lime-query-validation-82aa2855.js → lime-query-validation-6d419d03.js} +78 -16
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +2 -2
- package/dist/cjs/limebb-property-selector.cjs.entry.js +1 -1
- package/dist/cjs/{property-resolution-fb42a46b.js → property-resolution-5f798b03.js} +47 -0
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +78 -17
- package/dist/collection/components/lime-query-builder/property-resolution.js +46 -0
- package/dist/components/lime-query-validation.js +78 -16
- package/dist/components/property-selector.js +47 -1
- package/dist/esm/{lime-query-validation-9e386da8.js → lime-query-validation-237ee440.js} +78 -16
- package/dist/esm/limebb-lime-query-builder.entry.js +2 -2
- package/dist/esm/limebb-lime-query-filter-group_3.entry.js +1 -1
- package/dist/esm/limebb-lime-query-response-format-builder.entry.js +2 -2
- package/dist/esm/limebb-property-selector.entry.js +1 -1
- package/dist/esm/{property-resolution-c21a1369.js → property-resolution-e4e8dcf7.js} +47 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-ac9e81c9.entry.js → p-09ce8be4.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-11aa4103.js +1 -0
- package/dist/lime-crm-building-blocks/{p-d8696b23.entry.js → p-9c2062bc.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-b02c99d5.js +1 -0
- package/dist/lime-crm-building-blocks/{p-908dd7d5.entry.js → p-ee0e42dd.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-1421e1f8.entry.js → p-f7ea292d.entry.js} +1 -1
- package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +14 -0
- package/dist/types/components/lime-query-builder/property-resolution.d.ts +12 -0
- package/package.json +2 -2
- package/dist/lime-crm-building-blocks/p-b748c770.js +0 -1
- package/dist/lime-crm-building-blocks/p-efa5bcd4.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Z as Zt } from './index.esm.js';
|
|
2
|
-
import { g as getPropertyFromPath, a as getNormalizedProperties } from './property-selector.js';
|
|
2
|
+
import { g as getPropertyFromPath, a as getNormalizedProperties, v as validatePropertyPath } from './property-selector.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Dynamic filter values and placeholders that are valid in Lime Query
|
|
@@ -85,6 +85,46 @@ function validatePlaceholder(value, activeLimetype, limetypes) {
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Validates a filter expression key (property path).
|
|
90
|
+
* Supports both regular property paths and placeholders.
|
|
91
|
+
*
|
|
92
|
+
* @param key - Property path to validate (e.g., "name", "company.name", "%activeObject%.name")
|
|
93
|
+
* @param limetypes - All limetype definitions
|
|
94
|
+
* @param limetype - The limetype being filtered
|
|
95
|
+
* @param activeLimetype - Active limetype for placeholder resolution
|
|
96
|
+
* @returns Validation result with error message if invalid
|
|
97
|
+
*/
|
|
98
|
+
function validateFilterKey(key, limetypes, limetype, activeLimetype) {
|
|
99
|
+
// 1. Handle empty/missing keys
|
|
100
|
+
if (!key) {
|
|
101
|
+
return { valid: false, error: 'Filter key cannot be empty' };
|
|
102
|
+
}
|
|
103
|
+
// 2. Check if key is a placeholder
|
|
104
|
+
if (key.startsWith('%activeObject%')) {
|
|
105
|
+
const placeholderResult = validatePlaceholder(key, activeLimetype, limetypes);
|
|
106
|
+
if (!placeholderResult.valid) {
|
|
107
|
+
return placeholderResult;
|
|
108
|
+
}
|
|
109
|
+
// Extract property path after the placeholder and validate for hasMany/hasAndBelongsToMany
|
|
110
|
+
const propertyPath = key.replace(/^%activeObject%\.?/, '');
|
|
111
|
+
if (propertyPath && activeLimetype) {
|
|
112
|
+
const { error } = validatePropertyPath(limetypes, activeLimetype, propertyPath);
|
|
113
|
+
if (error) {
|
|
114
|
+
return { valid: false, error };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return placeholderResult;
|
|
118
|
+
}
|
|
119
|
+
// 3. Validate regular property path (including intermediate properties)
|
|
120
|
+
const { error } = validatePropertyPath(limetypes, limetype, key);
|
|
121
|
+
if (error) {
|
|
122
|
+
return { valid: false, error };
|
|
123
|
+
}
|
|
124
|
+
// validatePropertyPath always returns an error if property is undefined,
|
|
125
|
+
// so if we reach here, the property exists and is valid
|
|
126
|
+
return { valid: true };
|
|
127
|
+
}
|
|
88
128
|
/**
|
|
89
129
|
* Validate a response format against limetype schemas
|
|
90
130
|
* Throws errors for invalid property references
|
|
@@ -253,13 +293,19 @@ function validatePropertySelection(selection, limetypes, limetype, visualModeEna
|
|
|
253
293
|
* @param filter
|
|
254
294
|
* @param activeLimetype
|
|
255
295
|
* @param limetypes
|
|
296
|
+
* @param limetype
|
|
256
297
|
*/
|
|
257
|
-
function validateComparisonExpression(filter, activeLimetype, limetypes) {
|
|
298
|
+
function validateComparisonExpression(filter, activeLimetype, limetypes, limetype) {
|
|
258
299
|
// Validate operator
|
|
259
300
|
const allValidOperators = Object.values(Zt);
|
|
260
301
|
if (!allValidOperators.includes(filter.op)) {
|
|
261
302
|
throw new Error(`Unsupported filter operator: ${filter.op}`);
|
|
262
303
|
}
|
|
304
|
+
// Validate filter key
|
|
305
|
+
const keyResult = validateFilterKey(filter.key, limetypes, limetype, activeLimetype);
|
|
306
|
+
if (!keyResult.valid) {
|
|
307
|
+
throw new Error(`Invalid filter key '${filter.key}': ${keyResult.error}`);
|
|
308
|
+
}
|
|
263
309
|
// Validate placeholder
|
|
264
310
|
const result = validatePlaceholder(filter.exp, activeLimetype, limetypes);
|
|
265
311
|
if (!result.valid) {
|
|
@@ -271,9 +317,10 @@ function validateComparisonExpression(filter, activeLimetype, limetypes) {
|
|
|
271
317
|
* @param filter
|
|
272
318
|
* @param activeLimetype
|
|
273
319
|
* @param limetypes
|
|
320
|
+
* @param limetype
|
|
274
321
|
* @param visualModeEnabled
|
|
275
322
|
*/
|
|
276
|
-
function validateGroupExpression(filter, activeLimetype, limetypes, visualModeEnabled) {
|
|
323
|
+
function validateGroupExpression(filter, activeLimetype, limetypes, limetype, visualModeEnabled) {
|
|
277
324
|
// Validate operator
|
|
278
325
|
if (filter.op !== Zt.AND &&
|
|
279
326
|
filter.op !== Zt.OR &&
|
|
@@ -282,12 +329,12 @@ function validateGroupExpression(filter, activeLimetype, limetypes, visualModeEn
|
|
|
282
329
|
}
|
|
283
330
|
// Recursively validate children
|
|
284
331
|
if (filter.op === Zt.NOT) {
|
|
285
|
-
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, visualModeEnabled);
|
|
332
|
+
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
286
333
|
}
|
|
287
334
|
else if (filter.op === Zt.AND || filter.op === Zt.OR) {
|
|
288
335
|
const expressions = filter.exp;
|
|
289
336
|
for (const expr of expressions) {
|
|
290
|
-
validateFilterPlaceholders(expr, activeLimetype, limetypes, visualModeEnabled);
|
|
337
|
+
validateFilterPlaceholders(expr, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
291
338
|
}
|
|
292
339
|
}
|
|
293
340
|
}
|
|
@@ -296,37 +343,51 @@ function validateGroupExpression(filter, activeLimetype, limetypes, visualModeEn
|
|
|
296
343
|
* @param filter Filter expression to validate
|
|
297
344
|
* @param activeLimetype The limetype of the active object
|
|
298
345
|
* @param limetypes Record of all available limetypes
|
|
346
|
+
* @param limetype The limetype being filtered
|
|
299
347
|
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
300
348
|
*/
|
|
301
|
-
function validateFilterPlaceholders(filter, activeLimetype, limetypes, visualModeEnabled = true) {
|
|
349
|
+
function validateFilterPlaceholders(filter, activeLimetype, limetypes, limetype, visualModeEnabled = true) {
|
|
302
350
|
if (!filter) {
|
|
303
351
|
return;
|
|
304
352
|
}
|
|
305
353
|
if ('key' in filter) {
|
|
306
|
-
validateComparisonExpression(filter, activeLimetype, limetypes);
|
|
354
|
+
validateComparisonExpression(filter, activeLimetype, limetypes, limetype);
|
|
307
355
|
return;
|
|
308
356
|
}
|
|
309
357
|
if ('exp' in filter) {
|
|
310
|
-
validateGroupExpression(filter, activeLimetype, limetypes, visualModeEnabled);
|
|
358
|
+
validateGroupExpression(filter, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
311
359
|
}
|
|
312
360
|
}
|
|
313
361
|
/**
|
|
314
|
-
* Validate Lime Query filter and collect errors
|
|
362
|
+
* Validate Lime Query filter and collect errors and visual mode limitations
|
|
315
363
|
* @param filter The filter expression or group to validate
|
|
316
364
|
* @param activeLimetype Optional active object limetype for placeholder validation
|
|
317
365
|
* @param limetypes Record of all available limetypes
|
|
366
|
+
* @param limetype The limetype being filtered
|
|
318
367
|
* @param visualModeEnabled Whether visual mode is enabled
|
|
319
|
-
* @returns
|
|
368
|
+
* @returns Object with validation errors and visual mode limitations
|
|
320
369
|
*/
|
|
321
|
-
function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes, visualModeEnabled) {
|
|
370
|
+
function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes, limetype, visualModeEnabled) {
|
|
322
371
|
const errors = [];
|
|
372
|
+
const limitations = [];
|
|
323
373
|
try {
|
|
324
|
-
validateFilterPlaceholders(filter, activeLimetype, limetypes, visualModeEnabled);
|
|
374
|
+
validateFilterPlaceholders(filter, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
325
375
|
}
|
|
326
376
|
catch (error) {
|
|
327
|
-
|
|
377
|
+
const errorMessage = error.message;
|
|
378
|
+
// Invalid keys are BOTH spec violations AND rendering limitations:
|
|
379
|
+
// - Backend will reject them (validation error)
|
|
380
|
+
// - Visual mode can't show them in property selector (visual limitation)
|
|
381
|
+
if (errorMessage.includes('Invalid filter key') ||
|
|
382
|
+
errorMessage.includes('Cannot filter on many-relation')) {
|
|
383
|
+
errors.push(`Invalid filter: ${errorMessage}`);
|
|
384
|
+
limitations.push(errorMessage);
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
errors.push(`Invalid filter: ${errorMessage}`);
|
|
388
|
+
}
|
|
328
389
|
}
|
|
329
|
-
return errors;
|
|
390
|
+
return { errors, limitations };
|
|
330
391
|
}
|
|
331
392
|
/**
|
|
332
393
|
* Validate orderBy specification
|
|
@@ -495,8 +556,9 @@ function isLimeQuerySupported(limeQuery, limetypes, activeLimetype, visualModeEn
|
|
|
495
556
|
}
|
|
496
557
|
// Validate filter
|
|
497
558
|
if (limeQuery.filter) {
|
|
498
|
-
const
|
|
499
|
-
validationErrors.push(...
|
|
559
|
+
const { errors, limitations } = validateLimeQueryFilterInternal(limeQuery.filter, activeLimetype, limetypes, limeQuery.limetype, visualModeEnabled);
|
|
560
|
+
validationErrors.push(...errors);
|
|
561
|
+
visualModeLimitations.push(...limitations);
|
|
500
562
|
}
|
|
501
563
|
// Validate responseFormat
|
|
502
564
|
if (limeQuery.responseFormat) {
|
|
@@ -63,6 +63,52 @@ function getPropertyFromPath(limetypes, limetype, path) {
|
|
|
63
63
|
}
|
|
64
64
|
return property;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Validates a property path to ensure no intermediate properties are hasMany or hasAndBelongsToMany relations.
|
|
68
|
+
* These relation types cannot be traversed in filter expressions.
|
|
69
|
+
* @param limetypes All limetype definitions
|
|
70
|
+
* @param limetype The starting limetype
|
|
71
|
+
* @param path The property path to validate (e.g., "company.name")
|
|
72
|
+
* @returns The property at the end of the path if valid, or undefined with error if invalid
|
|
73
|
+
*/
|
|
74
|
+
function validatePropertyPath(limetypes, limetype, path) {
|
|
75
|
+
if (!path || !limetype || !limetypes) {
|
|
76
|
+
return { property: undefined };
|
|
77
|
+
}
|
|
78
|
+
const parts = path.split('.');
|
|
79
|
+
let currentType = limetypes[limetype];
|
|
80
|
+
let property;
|
|
81
|
+
for (let i = 0; i < parts.length; i++) {
|
|
82
|
+
const part = parts[i];
|
|
83
|
+
if (!currentType) {
|
|
84
|
+
return { property: undefined };
|
|
85
|
+
}
|
|
86
|
+
const normalizedProperties = getNormalizedProperties(currentType);
|
|
87
|
+
property = normalizedProperties[part];
|
|
88
|
+
if (!property) {
|
|
89
|
+
return {
|
|
90
|
+
property: undefined,
|
|
91
|
+
error: `Property '${part}' does not exist on limetype '${currentType.name}'`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// Check if this property is a hasMany/hasAndBelongsToMany relation
|
|
95
|
+
// These cannot be traversed in filter expressions
|
|
96
|
+
if (property.type === 'hasmany' ||
|
|
97
|
+
property.type === 'hasandbelongstomany') {
|
|
98
|
+
// Build the path up to this point for the error message
|
|
99
|
+
const invalidPath = parts.slice(0, i + 1).join('.');
|
|
100
|
+
return {
|
|
101
|
+
property: undefined,
|
|
102
|
+
error: `Cannot filter on many-relation '${invalidPath}'. Use a related limetype's filter instead.`,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// If this is a relation, get the related limetype for next iteration
|
|
106
|
+
if (property.relation) {
|
|
107
|
+
currentType = property.relation.getLimetype();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return { property };
|
|
111
|
+
}
|
|
66
112
|
|
|
67
113
|
const propertySelectorCss = ":host(limebb-property-selector){display:block}limel-menu{display:block;width:100%}";
|
|
68
114
|
const LimebbPropertySelectorStyle0 = propertySelectorCss;
|
|
@@ -323,4 +369,4 @@ function defineCustomElement() {
|
|
|
323
369
|
} });
|
|
324
370
|
}
|
|
325
371
|
|
|
326
|
-
export { PropertySelector as P, getNormalizedProperties as a, defineCustomElement as d, getPropertyFromPath as g };
|
|
372
|
+
export { PropertySelector as P, getNormalizedProperties as a, defineCustomElement as d, getPropertyFromPath as g, validatePropertyPath as v };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Z as Zt } from './index.esm-bb569663.js';
|
|
2
|
-
import { g as getPropertyFromPath, a as getNormalizedProperties } from './property-resolution-
|
|
2
|
+
import { g as getPropertyFromPath, a as getNormalizedProperties, v as validatePropertyPath } from './property-resolution-e4e8dcf7.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Dynamic filter values and placeholders that are valid in Lime Query
|
|
@@ -85,6 +85,46 @@ function validatePlaceholder(value, activeLimetype, limetypes) {
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Validates a filter expression key (property path).
|
|
90
|
+
* Supports both regular property paths and placeholders.
|
|
91
|
+
*
|
|
92
|
+
* @param key - Property path to validate (e.g., "name", "company.name", "%activeObject%.name")
|
|
93
|
+
* @param limetypes - All limetype definitions
|
|
94
|
+
* @param limetype - The limetype being filtered
|
|
95
|
+
* @param activeLimetype - Active limetype for placeholder resolution
|
|
96
|
+
* @returns Validation result with error message if invalid
|
|
97
|
+
*/
|
|
98
|
+
function validateFilterKey(key, limetypes, limetype, activeLimetype) {
|
|
99
|
+
// 1. Handle empty/missing keys
|
|
100
|
+
if (!key) {
|
|
101
|
+
return { valid: false, error: 'Filter key cannot be empty' };
|
|
102
|
+
}
|
|
103
|
+
// 2. Check if key is a placeholder
|
|
104
|
+
if (key.startsWith('%activeObject%')) {
|
|
105
|
+
const placeholderResult = validatePlaceholder(key, activeLimetype, limetypes);
|
|
106
|
+
if (!placeholderResult.valid) {
|
|
107
|
+
return placeholderResult;
|
|
108
|
+
}
|
|
109
|
+
// Extract property path after the placeholder and validate for hasMany/hasAndBelongsToMany
|
|
110
|
+
const propertyPath = key.replace(/^%activeObject%\.?/, '');
|
|
111
|
+
if (propertyPath && activeLimetype) {
|
|
112
|
+
const { error } = validatePropertyPath(limetypes, activeLimetype, propertyPath);
|
|
113
|
+
if (error) {
|
|
114
|
+
return { valid: false, error };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return placeholderResult;
|
|
118
|
+
}
|
|
119
|
+
// 3. Validate regular property path (including intermediate properties)
|
|
120
|
+
const { error } = validatePropertyPath(limetypes, limetype, key);
|
|
121
|
+
if (error) {
|
|
122
|
+
return { valid: false, error };
|
|
123
|
+
}
|
|
124
|
+
// validatePropertyPath always returns an error if property is undefined,
|
|
125
|
+
// so if we reach here, the property exists and is valid
|
|
126
|
+
return { valid: true };
|
|
127
|
+
}
|
|
88
128
|
/**
|
|
89
129
|
* Validate a response format against limetype schemas
|
|
90
130
|
* Throws errors for invalid property references
|
|
@@ -253,13 +293,19 @@ function validatePropertySelection(selection, limetypes, limetype, visualModeEna
|
|
|
253
293
|
* @param filter
|
|
254
294
|
* @param activeLimetype
|
|
255
295
|
* @param limetypes
|
|
296
|
+
* @param limetype
|
|
256
297
|
*/
|
|
257
|
-
function validateComparisonExpression(filter, activeLimetype, limetypes) {
|
|
298
|
+
function validateComparisonExpression(filter, activeLimetype, limetypes, limetype) {
|
|
258
299
|
// Validate operator
|
|
259
300
|
const allValidOperators = Object.values(Zt);
|
|
260
301
|
if (!allValidOperators.includes(filter.op)) {
|
|
261
302
|
throw new Error(`Unsupported filter operator: ${filter.op}`);
|
|
262
303
|
}
|
|
304
|
+
// Validate filter key
|
|
305
|
+
const keyResult = validateFilterKey(filter.key, limetypes, limetype, activeLimetype);
|
|
306
|
+
if (!keyResult.valid) {
|
|
307
|
+
throw new Error(`Invalid filter key '${filter.key}': ${keyResult.error}`);
|
|
308
|
+
}
|
|
263
309
|
// Validate placeholder
|
|
264
310
|
const result = validatePlaceholder(filter.exp, activeLimetype, limetypes);
|
|
265
311
|
if (!result.valid) {
|
|
@@ -271,9 +317,10 @@ function validateComparisonExpression(filter, activeLimetype, limetypes) {
|
|
|
271
317
|
* @param filter
|
|
272
318
|
* @param activeLimetype
|
|
273
319
|
* @param limetypes
|
|
320
|
+
* @param limetype
|
|
274
321
|
* @param visualModeEnabled
|
|
275
322
|
*/
|
|
276
|
-
function validateGroupExpression(filter, activeLimetype, limetypes, visualModeEnabled) {
|
|
323
|
+
function validateGroupExpression(filter, activeLimetype, limetypes, limetype, visualModeEnabled) {
|
|
277
324
|
// Validate operator
|
|
278
325
|
if (filter.op !== Zt.AND &&
|
|
279
326
|
filter.op !== Zt.OR &&
|
|
@@ -282,12 +329,12 @@ function validateGroupExpression(filter, activeLimetype, limetypes, visualModeEn
|
|
|
282
329
|
}
|
|
283
330
|
// Recursively validate children
|
|
284
331
|
if (filter.op === Zt.NOT) {
|
|
285
|
-
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, visualModeEnabled);
|
|
332
|
+
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
286
333
|
}
|
|
287
334
|
else if (filter.op === Zt.AND || filter.op === Zt.OR) {
|
|
288
335
|
const expressions = filter.exp;
|
|
289
336
|
for (const expr of expressions) {
|
|
290
|
-
validateFilterPlaceholders(expr, activeLimetype, limetypes, visualModeEnabled);
|
|
337
|
+
validateFilterPlaceholders(expr, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
291
338
|
}
|
|
292
339
|
}
|
|
293
340
|
}
|
|
@@ -296,37 +343,51 @@ function validateGroupExpression(filter, activeLimetype, limetypes, visualModeEn
|
|
|
296
343
|
* @param filter Filter expression to validate
|
|
297
344
|
* @param activeLimetype The limetype of the active object
|
|
298
345
|
* @param limetypes Record of all available limetypes
|
|
346
|
+
* @param limetype The limetype being filtered
|
|
299
347
|
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
300
348
|
*/
|
|
301
|
-
function validateFilterPlaceholders(filter, activeLimetype, limetypes, visualModeEnabled = true) {
|
|
349
|
+
function validateFilterPlaceholders(filter, activeLimetype, limetypes, limetype, visualModeEnabled = true) {
|
|
302
350
|
if (!filter) {
|
|
303
351
|
return;
|
|
304
352
|
}
|
|
305
353
|
if ('key' in filter) {
|
|
306
|
-
validateComparisonExpression(filter, activeLimetype, limetypes);
|
|
354
|
+
validateComparisonExpression(filter, activeLimetype, limetypes, limetype);
|
|
307
355
|
return;
|
|
308
356
|
}
|
|
309
357
|
if ('exp' in filter) {
|
|
310
|
-
validateGroupExpression(filter, activeLimetype, limetypes, visualModeEnabled);
|
|
358
|
+
validateGroupExpression(filter, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
311
359
|
}
|
|
312
360
|
}
|
|
313
361
|
/**
|
|
314
|
-
* Validate Lime Query filter and collect errors
|
|
362
|
+
* Validate Lime Query filter and collect errors and visual mode limitations
|
|
315
363
|
* @param filter The filter expression or group to validate
|
|
316
364
|
* @param activeLimetype Optional active object limetype for placeholder validation
|
|
317
365
|
* @param limetypes Record of all available limetypes
|
|
366
|
+
* @param limetype The limetype being filtered
|
|
318
367
|
* @param visualModeEnabled Whether visual mode is enabled
|
|
319
|
-
* @returns
|
|
368
|
+
* @returns Object with validation errors and visual mode limitations
|
|
320
369
|
*/
|
|
321
|
-
function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes, visualModeEnabled) {
|
|
370
|
+
function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes, limetype, visualModeEnabled) {
|
|
322
371
|
const errors = [];
|
|
372
|
+
const limitations = [];
|
|
323
373
|
try {
|
|
324
|
-
validateFilterPlaceholders(filter, activeLimetype, limetypes, visualModeEnabled);
|
|
374
|
+
validateFilterPlaceholders(filter, activeLimetype, limetypes, limetype, visualModeEnabled);
|
|
325
375
|
}
|
|
326
376
|
catch (error) {
|
|
327
|
-
|
|
377
|
+
const errorMessage = error.message;
|
|
378
|
+
// Invalid keys are BOTH spec violations AND rendering limitations:
|
|
379
|
+
// - Backend will reject them (validation error)
|
|
380
|
+
// - Visual mode can't show them in property selector (visual limitation)
|
|
381
|
+
if (errorMessage.includes('Invalid filter key') ||
|
|
382
|
+
errorMessage.includes('Cannot filter on many-relation')) {
|
|
383
|
+
errors.push(`Invalid filter: ${errorMessage}`);
|
|
384
|
+
limitations.push(errorMessage);
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
errors.push(`Invalid filter: ${errorMessage}`);
|
|
388
|
+
}
|
|
328
389
|
}
|
|
329
|
-
return errors;
|
|
390
|
+
return { errors, limitations };
|
|
330
391
|
}
|
|
331
392
|
/**
|
|
332
393
|
* Validate orderBy specification
|
|
@@ -495,8 +556,9 @@ function isLimeQuerySupported(limeQuery, limetypes, activeLimetype, visualModeEn
|
|
|
495
556
|
}
|
|
496
557
|
// Validate filter
|
|
497
558
|
if (limeQuery.filter) {
|
|
498
|
-
const
|
|
499
|
-
validationErrors.push(...
|
|
559
|
+
const { errors, limitations } = validateLimeQueryFilterInternal(limeQuery.filter, activeLimetype, limetypes, limeQuery.limetype, visualModeEnabled);
|
|
560
|
+
validationErrors.push(...errors);
|
|
561
|
+
visualModeLimitations.push(...limitations);
|
|
500
562
|
}
|
|
501
563
|
// Validate responseFormat
|
|
502
564
|
if (limeQuery.responseFormat) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-96dd111f.js';
|
|
2
2
|
import { T as Te } from './index.esm-bb569663.js';
|
|
3
|
-
import { i as isLimeQuerySupported } from './lime-query-validation-
|
|
4
|
-
import './property-resolution-
|
|
3
|
+
import { i as isLimeQuerySupported } from './lime-query-validation-237ee440.js';
|
|
4
|
+
import './property-resolution-e4e8dcf7.js';
|
|
5
5
|
|
|
6
6
|
const limeQueryBuilderCss = "*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-500));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-visual-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.visual-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-visual-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .visual-mode-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-mode .visual-mode-limitations li{margin:0.25rem 0}section.description,section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}";
|
|
7
7
|
const LimebbLimeQueryBuilderStyle0 = limeQueryBuilderCss;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-96dd111f.js';
|
|
2
2
|
import { Z as Zt, T as Te } from './index.esm-bb569663.js';
|
|
3
|
-
import { g as getPropertyFromPath } from './property-resolution-
|
|
3
|
+
import { g as getPropertyFromPath } from './property-resolution-e4e8dcf7.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Get the subheading text for a filter group based on its operator and expression count
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
|
|
2
2
|
import { T as Te } from './index.esm-bb569663.js';
|
|
3
|
-
import { v as validateResponseFormatOnly } from './lime-query-validation-
|
|
4
|
-
import './property-resolution-
|
|
3
|
+
import { v as validateResponseFormatOnly } from './lime-query-validation-237ee440.js';
|
|
4
|
+
import './property-resolution-e4e8dcf7.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Helper functions for working with ResponseFormat objects
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
|
|
2
2
|
import { T as Te, c } from './index.esm-bb569663.js';
|
|
3
|
-
import { g as getPropertyFromPath, a as getNormalizedProperties } from './property-resolution-
|
|
3
|
+
import { g as getPropertyFromPath, a as getNormalizedProperties } from './property-resolution-e4e8dcf7.js';
|
|
4
4
|
import { b as getIcon } from './limetype-c0e041f7.js';
|
|
5
5
|
|
|
6
6
|
const propertySelectorCss = ":host(limebb-property-selector){display:block}limel-menu{display:block;width:100%}";
|
|
@@ -59,5 +59,51 @@ function getPropertyFromPath(limetypes, limetype, path) {
|
|
|
59
59
|
}
|
|
60
60
|
return property;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Validates a property path to ensure no intermediate properties are hasMany or hasAndBelongsToMany relations.
|
|
64
|
+
* These relation types cannot be traversed in filter expressions.
|
|
65
|
+
* @param limetypes All limetype definitions
|
|
66
|
+
* @param limetype The starting limetype
|
|
67
|
+
* @param path The property path to validate (e.g., "company.name")
|
|
68
|
+
* @returns The property at the end of the path if valid, or undefined with error if invalid
|
|
69
|
+
*/
|
|
70
|
+
function validatePropertyPath(limetypes, limetype, path) {
|
|
71
|
+
if (!path || !limetype || !limetypes) {
|
|
72
|
+
return { property: undefined };
|
|
73
|
+
}
|
|
74
|
+
const parts = path.split('.');
|
|
75
|
+
let currentType = limetypes[limetype];
|
|
76
|
+
let property;
|
|
77
|
+
for (let i = 0; i < parts.length; i++) {
|
|
78
|
+
const part = parts[i];
|
|
79
|
+
if (!currentType) {
|
|
80
|
+
return { property: undefined };
|
|
81
|
+
}
|
|
82
|
+
const normalizedProperties = getNormalizedProperties(currentType);
|
|
83
|
+
property = normalizedProperties[part];
|
|
84
|
+
if (!property) {
|
|
85
|
+
return {
|
|
86
|
+
property: undefined,
|
|
87
|
+
error: `Property '${part}' does not exist on limetype '${currentType.name}'`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// Check if this property is a hasMany/hasAndBelongsToMany relation
|
|
91
|
+
// These cannot be traversed in filter expressions
|
|
92
|
+
if (property.type === 'hasmany' ||
|
|
93
|
+
property.type === 'hasandbelongstomany') {
|
|
94
|
+
// Build the path up to this point for the error message
|
|
95
|
+
const invalidPath = parts.slice(0, i + 1).join('.');
|
|
96
|
+
return {
|
|
97
|
+
property: undefined,
|
|
98
|
+
error: `Cannot filter on many-relation '${invalidPath}'. Use a related limetype's filter instead.`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// If this is a relation, get the related limetype for next iteration
|
|
102
|
+
if (property.relation) {
|
|
103
|
+
currentType = property.relation.getLimetype();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { property };
|
|
107
|
+
}
|
|
62
108
|
|
|
63
|
-
export { getNormalizedProperties as a, getPropertyFromPath as g };
|
|
109
|
+
export { getNormalizedProperties as a, getPropertyFromPath as g, validatePropertyPath as v };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-1421e1f8",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32],"description":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-ac9e81c9",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-28346b49",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-2673c79e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-ef042c82",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-bc18b0e7",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-3932077b",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-e9d23ef7",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-f52125a0",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-80b9d946",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513],"fileTypes":[16]}]]],["p-8c4eb49f",[[1,"limebb-live-docs-info"]]],["p-c0ec1ddf",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-fdd5600b",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-7d2188aa",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-d8696b23",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-19ff678d",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-00da9b24",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-908dd7d5",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"value":[32]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-761c7c7c",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
1
|
+
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-f7ea292d",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32],"description":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-09ce8be4",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-28346b49",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-2673c79e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-ef042c82",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-bc18b0e7",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-3932077b",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-e9d23ef7",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-f52125a0",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-80b9d946",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513],"fileTypes":[16]}]]],["p-8c4eb49f",[[1,"limebb-live-docs-info"]]],["p-c0ec1ddf",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-fdd5600b",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-7d2188aa",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-9c2062bc",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-19ff678d",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-00da9b24",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-ee0e42dd",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"value":[32]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-761c7c7c",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-1556b545.js";import{T as o}from"./p-4838284a.js";import{v as r}from"./p-
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-1556b545.js";import{T as o}from"./p-4838284a.js";import{v as r}from"./p-11aa4103.js";import"./p-b02c99d5.js";function s(e){let t;try{t=JSON.parse(e)}catch(e){throw new Error(`Invalid JSON: ${e.message}`)}if(null===t||"object"!=typeof t)throw new Error("Response format must be an object");const i=new Set(["object","aggregates"]),o=Object.keys(t),r=o.filter((e=>!i.has(e)));if(r.length>0)throw new Error(`Unexpected properties in response format: ${r.join(", ")}. Only 'object' and 'aggregates' are allowed.`);if(o.length>0&&!t.object&&!t.aggregates)throw new Error("Response format must contain at least one of: object, aggregates");return t}const l=class{constructor(i){e(this,i),this.change=t(this,"change",7),this.label="Response Format",this.helperText="",this.mode="visual",this.codeValue="",this.handleModeChange=e=>{e.stopPropagation();const t=e.detail.id;"visual"===t?this.switchToVisualMode():"code"===t&&this.switchToCode()},this.switchToVisualMode=()=>{try{const e=s(this.codeValue);if(!r(e,this.limetypes,this.limetype,this.visualModeEnabled).visualModeSupported)return;this.internalValue=e,this.mode="visual",this.change.emit(e)}catch(e){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=e=>{e.stopPropagation(),this.codeValue=e.detail;try{const e=s(this.codeValue);this.internalValue=e,this.change.emit(e)}catch(e){}},this.handleVisualModeChange=e=>{e.stopPropagation(),this.internalValue=e.detail,this.updateCodeValue(),this.change.emit(e.detail)}}get visualModeEnabled(){var e,t,i;return null!==(i=null===(t=null===(e=this.platform)||void 0===e?void 0:e.isFeatureEnabled)||void 0===t?void 0:t.call(e,"useLimeQueryBuilderGuiMode"))&&void 0!==i&&i}componentWillLoad(){this.internalValue=this.value||{object:{_id:null}},this.updateCodeValue(),this.visualModeEnabled&&this.checkVisualModeSupport().visualModeSupported||(this.mode="code")}componentWillUpdate(){this.value&&"visual"===this.mode&&(this.internalValue=this.value)}render(){const e=this.checkVisualModeSupport();return i("div",{key:"7ae23c1366da49b591c0914f49f25c179e4d6712",class:"response-format-builder"},this.label&&i("h1",{key:"0cd528a69dd1b05769c678151f0827de15d167a8",class:"builder-label"},this.label),this.helperText&&i("p",{key:"b636ca0d32b244d051e74ed538cbd11438f29cd1",class:"builder-helper-text"},this.helperText),this.visualModeEnabled&&i("div",{key:"dc7248cb27d99aa654b0f1659938c3f2933d89e0",class:"mode-controls"},this.renderModeSwitch(e)),this.visualModeEnabled&&"code"!==this.mode?i("div",{class:"visual-mode"},this.renderVisualMode()):i("div",{class:"code-mode"},this.renderCodeEditor(e)))}renderModeSwitch(e){const t=!e.visualModeSupported,o=[{id:"visual",title:"Visual"},{id:"code",title:"Code"}].map((e=>Object.assign(Object.assign({},e),{selected:e.id===this.mode})));return i("limel-button-group",{value:o,disabled:t,onChange:this.handleModeChange})}renderCodeEditor(e){return i("div",{class:"code-editor-container"},i("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!e.valid&&e.validationErrors.length>0&&i("div",{class:"validation-errors"},i("strong",null,"Invalid Response Format:"),i("ul",null,e.validationErrors.map((e=>i("li",null,e))))),this.visualModeEnabled&&e.valid&&!e.visualModeSupported&&e.visualModeLimitations.length>0&&i("div",{class:"visual-mode-limitations"},i("strong",null,"Cannot switch to visual mode:"),i("ul",null,e.visualModeLimitations.map((e=>i("li",null,e))))))}renderVisualMode(){return i("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalValue,onChange:this.handleVisualModeChange})}checkVisualModeSupport(){if(!this.limetypes)return{valid:!1,visualModeSupported:!1,validationErrors:["Limetypes not loaded"],visualModeLimitations:[]};let e;if("code"===this.mode)try{e=s(this.codeValue)}catch(e){return{valid:!1,visualModeSupported:!1,validationErrors:[e.message],visualModeLimitations:[]}}else e=this.internalValue;return r(e,this.limetypes,this.limetype,this.visualModeEnabled)}updateCodeValue(){this.codeValue=JSON.stringify(this.internalValue,null,2)}};(function(e,t,i,o){var r,s=arguments.length,l=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(s<3?r(l):s>3?r(t,i,l):r(t,i))||l);s>3&&l&&Object.defineProperty(t,i,l)})([o()],l.prototype,"limetypes",void 0),l.style=":host(limebb-lime-query-response-format-builder){display:block;width:100%}.response-format-builder{display:flex;flex-direction:column}.builder-label{color:rgb(var(--contrast-1100));font-size:1.625rem;line-height:1.25rem;font-weight:300;margin-top:1rem;margin-bottom:0.25rem}.builder-helper-text{margin-top:0px;margin-bottom:0.5rem;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-1100))}.mode-controls{display:flex;justify-content:flex-end;padding:0.5rem}.visual-mode,.code-mode{display:block}.code-editor-container{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-editor-container .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .validation-errors ul{margin:0;padding-left:1.5rem}.code-editor-container .validation-errors li{margin:0.25rem 0}.code-editor-container .visual-mode-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .visual-mode-limitations li{margin:0.25rem 0}";export{l as limebb_lime_query_response_format_builder}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Z as r}from"./p-4838284a.js";import{g as t,a as o,v as e}from"./p-b02c99d5.js";const n=new Set(["$yesterday","$now","$today","$tomorrow","$this_week","$this_month","$this_quarter","$this_year"]),i=/^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/,s=/^\$me(\.\w+)*$/;function a(r,o,e){if(function(r){return"string"==typeof r&&(n.has(r)||i.test(r)||s.test(r))}(r))return{valid:!0};if("string"!=typeof r||!r.startsWith("%activeObject%"))return{valid:!0};if(!o)return{valid:!0};const a=r.replace(/^%activeObject%\.?/,"");if(!a)return{valid:!0};try{return t(e,o,a)?{valid:!0}:{valid:!1,error:`Property path '${a}' does not exist on limetype '${o}'`}}catch(r){return{valid:!1,error:`Invalid placeholder path: ${r.message}`}}}function u(r,t,o=!0){const e=Object.keys(r),n=[];if(o){const r=e.filter((r=>r.startsWith("#")&&"#description"!==r));r.length>0&&n.push(`Property '${t}' contains # properties not supported in visual mode: ${r.join(", ")}`)}return{keys:e.filter((r=>"_alias"!==r&&!r.startsWith("#"))),visualModeLimitations:n}}function c(r,t,o,e,n,i=!0){if(""===r){if(i&&null!==t)throw new Error("Empty property name must have null value");return[]}const s=o[r];if(!s)throw new Error(`Property '${r}' does not exist on limetype '${n}'`);return s.relation?function(r,t,o,e,n=!0){if(null===t)return[];if("object"!=typeof t)throw new TypeError(`Relation property '${r}' must be null or an object`);const i=t,{keys:s,visualModeLimitations:a}=u(i,r,n);if(0===s.length)return a;const c=e.relation.getLimetype();if(!c)throw new Error(`Could not determine related limetype for property '${r}'`);const f={};for(const r of s)f[r]=i[r];const p=l(f,o,c.name,n);return[...a,...p]}(r,t,e,s,i):function(r,t,o=!0){if(null===t)return[];if("object"==typeof t){const{keys:e,visualModeLimitations:n}=u(t,r,o);if(0===e.length)return n;throw new Error(`Non-relation property '${r}' cannot have nested properties other than _alias or # properties (got: ${e.join(", ")})`)}throw new Error(`Non-relation property '${r}' must be null or an object (got ${typeof t})`)}(r,t,i)}function l(r,t,e,n=!0){const i=t[e];if(!i)throw new Error(`Unknown limetype: ${e}`);const s=o(i),a=[];for(const[o,i]of Object.entries(r)){if(o.startsWith("#"))continue;const r=c(o,i,s,t,e,n);a.push(...r)}return a}function f(t,o,n,i,s=!0){t&&("key"in t?function(t,o,n,i){if(!Object.values(r).includes(t.op))throw new Error(`Unsupported filter operator: ${t.op}`);const s=function(r,t,o,n){if(!r)return{valid:!1,error:"Filter key cannot be empty"};if(r.startsWith("%activeObject%")){const o=a(r,n,t);if(!o.valid)return o;const i=r.replace(/^%activeObject%\.?/,"");if(i&&n){const{error:r}=e(t,n,i);if(r)return{valid:!1,error:r}}return o}const{error:i}=e(t,o,r);return i?{valid:!1,error:i}:{valid:!0}}(t.key,n,i,o);if(!s.valid)throw new Error(`Invalid filter key '${t.key}': ${s.error}`);const u=a(t.exp,o,n);if(!u.valid)throw new Error(`Invalid placeholder in filter '${t.key}': ${u.error}`)}(t,o,n,i):"exp"in t&&function(t,o,e,n,i){if(t.op!==r.AND&&t.op!==r.OR&&t.op!==r.NOT)throw new Error(`Unsupported group operator: ${t.op}`);if(t.op===r.NOT)f(t.exp,o,e,n,i);else if(t.op===r.AND||t.op===r.OR){const r=t.exp;for(const t of r)f(t,o,e,n,i)}}(t,o,n,i,s))}function p(r,o,e,n){const i=[],s=function(r,t){return"object"!=typeof r||null===r?`orderBy[${t}] must be an object`:null}(r,o);if(s)return[s];const a=Object.keys(r),u=function(r,t){return 0===r.length?`orderBy[${t}] must have a property path`:r.length>1?`orderBy[${t}] must have exactly one property, got ${r.length}`:null}(a,o);if(u)return[u];const c=a[0],l=function(r,t){return"ASC"!==r&&"DESC"!==r?`orderBy[${t}]: direction must be 'ASC' or 'DESC', got '${r}'`:null}(r[c],o);l&&i.push(l);const f=function(r,o,e,n){if(!r||""===r)return null;return t(o,e,r)?null:`orderBy[${n}]: property path '${r}' does not exist on limetype '${e}'`}(c,e,n,o);return f&&i.push(f),i}function d(r,t,o,e){const n=[],i=[];try{const n=function(r,t,o,e=!0){const n=[];if(e&&r.aggregates&&n.push("responseFormat.aggregates is not yet supported in visual mode"),r.object){const i=l(r.object,t,o,e);n.push(...i)}return n}(r,t,o,e);i.push(...n)}catch(r){n.push(`Invalid responseFormat: ${r.message}`)}return{errors:n,limitations:i}}function y(r,t,o,e=!0){if(!r)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};const n=[],i=[];if(r.limetype&&!t[r.limetype]&&n.push(`Unknown limetype: ${r.limetype}`),void 0===r.offset||r.orderBy||n.push("offset requires orderBy to be specified"),r.orderBy){const o=function(r,t,o){const e=[];if(!Array.isArray(r))return e.push("orderBy must be an array"),e;if(!o||!t[o])return e;for(const[n,i]of r.entries()){const r=p(i,n,t,o);e.push(...r)}return e}(r.orderBy,t,r.limetype);n.push(...o)}if(e&&void 0!==r.offset&&i.push("offset is not yet supported in visual mode"),r.filter){const{errors:s,limitations:a}=function(r,t,o,e,n){const i=[],s=[];try{f(r,t,o,e,n)}catch(r){const t=r.message;t.includes("Invalid filter key")||t.includes("Cannot filter on many-relation")?(i.push(`Invalid filter: ${t}`),s.push(t)):i.push(`Invalid filter: ${t}`)}return{errors:i,limitations:s}}(r.filter,o,t,r.limetype,e);n.push(...s),i.push(...a)}if(r.responseFormat){const{errors:o,limitations:s}=d(r.responseFormat,t,r.limetype,e);n.push(...o),i.push(...s)}return{valid:0===n.length,visualModeSupported:0===i.length,validationErrors:n,visualModeLimitations:i}}function v(r,t,o,e=!0){const n=[],i=[];if(!t[o])return n.push(`Unknown limetype: ${o}`),{valid:!1,visualModeSupported:!1,validationErrors:n,visualModeLimitations:i};const{errors:s,limitations:a}=d(r,t,o,e);return n.push(...s),i.push(...a),{valid:0===n.length,visualModeSupported:0===i.length,validationErrors:n,visualModeLimitations:i}}export{y as i,v}
|