@limetech/lime-crm-building-blocks 1.101.0 → 1.102.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  3. package/dist/cjs/lime-query-validation-6be10fa7.js +558 -0
  4. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +4 -514
  5. package/dist/cjs/{limebb-lime-query-filter-builder_4.cjs.entry.js → limebb-lime-query-filter-builder_3.cjs.entry.js} +1 -243
  6. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +1 -1
  7. package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +2 -2
  8. package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +2 -2
  9. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +242 -0
  10. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +322 -0
  11. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  12. package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
  13. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  14. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
  15. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  16. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  17. package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
  18. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/collection/collection-manifest.json +3 -2
  21. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
  22. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +1 -1
  23. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
  24. package/dist/collection/components/lime-query-builder/lime-query-builder.js +1 -1
  25. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css +91 -0
  26. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +355 -0
  27. package/dist/collection/components/lime-query-builder/lime-query-validation.js +40 -0
  28. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
  29. package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +2 -2
  30. package/dist/collection/components/lime-query-builder/{response-format-editor.css → response-format/response-format-editor.css} +1 -1
  31. package/dist/collection/components/lime-query-builder/{response-format-editor.js → response-format/response-format-editor.js} +5 -5
  32. package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +92 -0
  33. package/dist/collection/components/lime-query-builder/{response-format-item.css → response-format/response-format-item.css} +1 -1
  34. package/dist/collection/components/lime-query-builder/{response-format-item.js → response-format/response-format-item.js} +6 -6
  35. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  36. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  37. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  38. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  39. package/dist/collection/components/summary-popover/summary-popover.js +3 -3
  40. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  41. package/dist/collection/components/text-editor/text-editor.js +1 -1
  42. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  43. package/dist/components/lime-query-filter-comparison.js +1 -1
  44. package/dist/components/lime-query-filter-expression.js +2 -2
  45. package/dist/components/lime-query-validation.js +555 -0
  46. package/dist/components/limebb-lime-query-builder.js +14 -524
  47. package/dist/components/limebb-lime-query-response-format-builder.d.ts +11 -0
  48. package/dist/components/limebb-lime-query-response-format-builder.js +283 -0
  49. package/dist/components/limebb-lime-query-response-format-editor.d.ts +11 -0
  50. package/dist/components/{limebb-response-format-editor.js → limebb-lime-query-response-format-editor.js} +2 -2
  51. package/dist/components/limebb-lime-query-response-format-item.d.ts +11 -0
  52. package/dist/components/{limebb-response-format-item.js → limebb-lime-query-response-format-item.js} +2 -2
  53. package/dist/components/limebb-locale-picker.js +1 -1
  54. package/dist/components/limebb-mention-group-counter.js +2 -2
  55. package/dist/components/limebb-percentage-visualizer.js +2 -2
  56. package/dist/components/limebb-text-editor.js +1 -1
  57. package/dist/components/limebb-trend-indicator.js +1 -1
  58. package/dist/components/limetype-field.js +1 -1
  59. package/dist/components/live-docs-info.js +2 -2
  60. package/dist/components/notification-item.js +1 -1
  61. package/dist/components/order-by-item.js +2 -2
  62. package/dist/components/response-format-editor.js +11 -11
  63. package/dist/components/response-format-item.js +9 -9
  64. package/dist/components/summary-popover.js +3 -3
  65. package/dist/esm/lime-crm-building-blocks.js +1 -1
  66. package/dist/esm/lime-query-validation-573223a5.js +555 -0
  67. package/dist/esm/limebb-lime-query-builder.entry.js +4 -514
  68. package/dist/esm/{limebb-lime-query-filter-builder_4.entry.js → limebb-lime-query-filter-builder_3.entry.js} +2 -243
  69. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +1 -1
  70. package/dist/esm/limebb-lime-query-filter-group_3.entry.js +2 -2
  71. package/dist/esm/limebb-lime-query-order-by-item.entry.js +2 -2
  72. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +238 -0
  73. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +317 -0
  74. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  75. package/dist/esm/limebb-locale-picker.entry.js +1 -1
  76. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  77. package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
  78. package/dist/esm/limebb-notification-item.entry.js +1 -1
  79. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  80. package/dist/esm/limebb-text-editor.entry.js +1 -1
  81. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  84. package/dist/lime-crm-building-blocks/{p-5cf4898d.entry.js → p-0de79b7f.entry.js} +1 -1
  85. package/dist/lime-crm-building-blocks/{p-8c2fb1c9.entry.js → p-0f7135ff.entry.js} +1 -1
  86. package/dist/lime-crm-building-blocks/{p-6aa216ec.entry.js → p-186e9f1a.entry.js} +1 -1
  87. package/dist/lime-crm-building-blocks/p-289ce8b9.entry.js +1 -0
  88. package/dist/lime-crm-building-blocks/p-3351395b.entry.js +1 -0
  89. package/dist/lime-crm-building-blocks/p-33e6d0ec.entry.js +1 -0
  90. package/dist/lime-crm-building-blocks/{p-a1ee8990.entry.js → p-3d1be1c9.entry.js} +1 -1
  91. package/dist/lime-crm-building-blocks/{p-92dfc5f8.entry.js → p-577d8909.entry.js} +1 -1
  92. package/dist/lime-crm-building-blocks/{p-ccf34631.entry.js → p-6579412e.entry.js} +1 -1
  93. package/dist/lime-crm-building-blocks/{p-d84874dc.entry.js → p-6f6fed59.entry.js} +1 -1
  94. package/dist/lime-crm-building-blocks/{p-0cd036ed.entry.js → p-7e5528f6.entry.js} +1 -1
  95. package/dist/lime-crm-building-blocks/{p-8601eab5.entry.js → p-a9ac501f.entry.js} +1 -1
  96. package/dist/lime-crm-building-blocks/p-be845252.entry.js +1 -0
  97. package/dist/lime-crm-building-blocks/{p-2725671e.entry.js → p-cb338753.entry.js} +1 -1
  98. package/dist/lime-crm-building-blocks/{p-425eaba2.entry.js → p-d0721b22.entry.js} +1 -1
  99. package/dist/lime-crm-building-blocks/p-fa2da6bc.js +1 -0
  100. package/dist/types/components/lime-query-builder/lime-query-response-format-builder.d.ts +102 -0
  101. package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +13 -0
  102. package/dist/types/components/lime-query-builder/{response-format-editor.d.ts → response-format/response-format-editor.d.ts} +2 -2
  103. package/dist/types/components/lime-query-builder/response-format/response-format-helpers.d.ts +42 -0
  104. package/dist/types/components/lime-query-builder/{response-format-item.d.ts → response-format/response-format-item.d.ts} +2 -2
  105. package/dist/types/components.d.ts +394 -222
  106. package/package.json +1 -1
  107. package/dist/cjs/limebb-response-format-item.cjs.entry.js +0 -80
  108. package/dist/components/limebb-response-format-editor.d.ts +0 -11
  109. package/dist/components/limebb-response-format-item.d.ts +0 -11
  110. package/dist/esm/limebb-response-format-item.entry.js +0 -76
  111. package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +0 -1
  112. package/dist/lime-crm-building-blocks/p-67c174d0.entry.js +0 -1
  113. package/dist/lime-crm-building-blocks/p-f9efca1d.entry.js +0 -1
@@ -1,517 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
2
- import { Z as Zt, T as Te } from './index.esm-bb569663.js';
3
- import { g as getPropertyFromPath, a as getNormalizedProperties } from './property-resolution-c21a1369.js';
4
-
5
- /**
6
- * Dynamic filter values and placeholders that are valid in Lime Query
7
- */
8
- const VALID_DYNAMIC_VALUES = new Set([
9
- // Temporal
10
- '$yesterday',
11
- '$now',
12
- '$today',
13
- '$tomorrow',
14
- // Ranges
15
- '$this_week',
16
- '$this_month',
17
- '$this_quarter',
18
- '$this_year',
19
- ]);
20
- /**
21
- * Pattern for relative date functions: $previous_day(x), $next_month(x), etc.
22
- */
23
- const RELATIVE_DATE_PATTERN = /^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/;
24
- /**
25
- * Pattern for user context variables: $me, $me.office.name, etc.
26
- */
27
- const USER_CONTEXT_PATTERN = /^\$me(\.\w+)*$/;
28
- /**
29
- * Check if a value is a valid dynamic value or placeholder
30
- * @param value
31
- */
32
- function isValidDynamicValue(value) {
33
- if (typeof value !== 'string') {
34
- return false;
35
- }
36
- return (VALID_DYNAMIC_VALUES.has(value) ||
37
- RELATIVE_DATE_PATTERN.test(value) ||
38
- USER_CONTEXT_PATTERN.test(value));
39
- }
40
- /**
41
- * Validate a placeholder value
42
- * @param value The value to check (might be a placeholder)
43
- * @param activeLimetype The limetype of the active object
44
- * @param limetypes Record of all available limetypes
45
- * @returns Validation result with error message if invalid
46
- */
47
- function validatePlaceholder(value, activeLimetype, limetypes) {
48
- // Check if it's a valid dynamic value ($today, $me, etc.)
49
- if (isValidDynamicValue(value)) {
50
- return { valid: true };
51
- }
52
- // Not a placeholder, no validation needed
53
- if (typeof value !== 'string' || !value.startsWith('%activeObject%')) {
54
- return { valid: true };
55
- }
56
- // Placeholder used but no active limetype specified
57
- // This is always valid - activeLimetype is optional and only used for validation
58
- if (!activeLimetype) {
59
- return { valid: true };
60
- }
61
- // Extract property path from placeholder
62
- const propertyPath = value.replace(/^%activeObject%\.?/, '');
63
- // %activeObject% without property path is valid (references the ID)
64
- if (!propertyPath) {
65
- return { valid: true };
66
- }
67
- // Validate the property path exists on the active limetype
68
- try {
69
- const property = getPropertyFromPath(limetypes, activeLimetype, propertyPath);
70
- if (!property) {
71
- return {
72
- valid: false,
73
- error: `Property path '${propertyPath}' does not exist on limetype '${activeLimetype}'`,
74
- };
75
- }
76
- // Path validation is already done by getPropertyFromPath
77
- // If we can traverse the path successfully, it means all intermediate
78
- // properties are valid single relations (belongsTo/hasOne).
79
- // hasMany relations cannot be traversed in paths.
80
- return { valid: true };
81
- }
82
- catch (error) {
83
- return {
84
- valid: false,
85
- error: `Invalid placeholder path: ${error.message}`,
86
- };
87
- }
88
- }
89
- /**
90
- * Validate a response format against limetype schemas
91
- * Throws errors for invalid property references
92
- * Returns GUI limitations for features not yet supported in GUI
93
- * @param responseFormat
94
- * @param limetypes Record of all available limetypes
95
- * @param limetype The root limetype for this query
96
- * @param guiModeEnabled Whether GUI mode is enabled
97
- * @returns GUI limitations found (if any)
98
- */
99
- function validateResponseFormat(responseFormat, limetypes, limetype, guiModeEnabled = true) {
100
- const guiLimitations = [];
101
- // Check for GUI-unsupported features
102
- if (guiModeEnabled && responseFormat.aggregates) {
103
- guiLimitations.push('responseFormat.aggregates is not yet supported in GUI mode');
104
- }
105
- // Validate object properties (throws on invalid properties)
106
- if (responseFormat.object) {
107
- const objectLimitations = validatePropertySelection(responseFormat.object, limetypes, limetype, guiModeEnabled);
108
- guiLimitations.push(...objectLimitations);
109
- }
110
- return guiLimitations;
111
- }
112
- /**
113
- * Extract non-metadata keys from a property value object
114
- * Filters out _alias and all # properties (which are treated as comments)
115
- * @param propValue Property value object
116
- * @param propName Property name (for error messages)
117
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
118
- * @returns Object with non-metadata keys and any GUI limitations found
119
- */
120
- function extractNonMetadataKeys(propValue, propName, guiModeEnabled = true) {
121
- const keys = Object.keys(propValue);
122
- const guiLimitations = [];
123
- // Check for # properties other than #description (GUI limitation)
124
- if (guiModeEnabled) {
125
- const unsupportedHashProps = keys.filter((k) => k.startsWith('#') && k !== '#description');
126
- if (unsupportedHashProps.length > 0) {
127
- guiLimitations.push(`Property '${propName}' contains # properties not supported in GUI: ${unsupportedHashProps.join(', ')}`);
128
- }
129
- }
130
- // Filter out _alias and all # properties (they are metadata/comments)
131
- const nonMetadataKeys = keys.filter((k) => k !== '_alias' && !k.startsWith('#'));
132
- return { keys: nonMetadataKeys, guiLimitations };
133
- }
134
- /**
135
- * Validate a relation property value
136
- * @param propName Property name
137
- * @param propValue Property value
138
- * @param limetypes Record of all available limetypes
139
- * @param property
140
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
141
- * @returns GUI limitations found (if any)
142
- */
143
- function validateRelationProperty(propName, propValue, limetypes, property, guiModeEnabled = true) {
144
- // null is valid - just return the relation ID
145
- if (propValue === null) {
146
- return [];
147
- }
148
- if (typeof propValue !== 'object') {
149
- throw new TypeError(`Relation property '${propName}' must be null or an object`);
150
- }
151
- const propValueObj = propValue;
152
- const { keys: otherKeys, guiLimitations } = extractNonMetadataKeys(propValueObj, propName, guiModeEnabled);
153
- // If it's just {} or { _alias: "...", "#...": "..." }, that's valid
154
- if (otherKeys.length === 0) {
155
- return guiLimitations;
156
- }
157
- // Otherwise, validate nested properties
158
- const relatedLimetype = property.relation.getLimetype();
159
- if (!relatedLimetype) {
160
- throw new Error(`Could not determine related limetype for property '${propName}'`);
161
- }
162
- // Build a clean PropertySelection without metadata for recursive validation
163
- const cleanSelection = {};
164
- for (const key of otherKeys) {
165
- cleanSelection[key] = propValueObj[key];
166
- }
167
- const nestedLimitations = validatePropertySelection(cleanSelection, limetypes, relatedLimetype.name, guiModeEnabled);
168
- return [...guiLimitations, ...nestedLimitations];
169
- }
170
- /**
171
- * Validate a non-relation property value
172
- * @param propName Property name
173
- * @param propValue Property value
174
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
175
- * @returns GUI limitations found (if any)
176
- */
177
- function validateNonRelationProperty(propName, propValue, guiModeEnabled = true) {
178
- // null is valid
179
- if (propValue === null) {
180
- return [];
181
- }
182
- // Allow empty object {} or object with only metadata (_alias, #...)
183
- if (typeof propValue === 'object') {
184
- const { keys: nonMetadataKeys, guiLimitations } = extractNonMetadataKeys(propValue, propName, guiModeEnabled);
185
- if (nonMetadataKeys.length === 0) {
186
- // {} or { _alias: "...", "#...": "..." } is valid
187
- return guiLimitations;
188
- }
189
- throw new Error(`Non-relation property '${propName}' cannot have nested properties other than _alias or # properties (got: ${nonMetadataKeys.join(', ')})`);
190
- }
191
- throw new Error(`Non-relation property '${propName}' must be null or an object (got ${typeof propValue})`);
192
- }
193
- /**
194
- * Validate a single property entry
195
- * @param propName Property name
196
- * @param propValue Property value
197
- * @param normalizedProperties Normalized properties of the limetype
198
- * @param limetypes Record of all available limetypes
199
- * @param limetype Current limetype name
200
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
201
- * @returns GUI limitations found (if any)
202
- */
203
- function validateSinglePropertyEntry(propName, propValue, normalizedProperties, limetypes, limetype, guiModeEnabled = true) {
204
- // Allow empty string (editing state in GUI)
205
- if (propName === '') {
206
- // Only validate empty property name in GUI mode
207
- if (guiModeEnabled && propValue !== null) {
208
- throw new Error('Empty property name must have null value');
209
- }
210
- return [];
211
- }
212
- // Validate property exists on limetype
213
- const property = normalizedProperties[propName];
214
- if (!property) {
215
- throw new Error(`Property '${propName}' does not exist on limetype '${limetype}'`);
216
- }
217
- // Validate value based on property type
218
- if (property.relation) {
219
- return validateRelationProperty(propName, propValue, limetypes, property, guiModeEnabled);
220
- }
221
- else {
222
- return validateNonRelationProperty(propName, propValue, guiModeEnabled);
223
- }
224
- }
225
- /**
226
- * Validate a property selection object against a limetype schema
227
- * Recursively validates nested property selections for relations
228
- * @param selection
229
- * @param limetypes Record of all available limetypes
230
- * @param limetype The limetype for this level of the selection
231
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
232
- * @returns GUI limitations found (if any)
233
- */
234
- function validatePropertySelection(selection, limetypes, limetype, guiModeEnabled = true) {
235
- const limetypeObj = limetypes[limetype];
236
- if (!limetypeObj) {
237
- throw new Error(`Unknown limetype: ${limetype}`);
238
- }
239
- const normalizedProperties = getNormalizedProperties(limetypeObj);
240
- const allGuiLimitations = [];
241
- for (const [propName, propValue] of Object.entries(selection)) {
242
- // Skip # properties (comments/metadata that backend accepts via unknown=INCLUDE)
243
- // Note: _alias only appears inside property value objects, not at this level
244
- if (propName.startsWith('#')) {
245
- continue;
246
- }
247
- const limitations = validateSinglePropertyEntry(propName, propValue, normalizedProperties, limetypes, limetype, guiModeEnabled);
248
- allGuiLimitations.push(...limitations);
249
- }
250
- return allGuiLimitations;
251
- }
252
- /**
253
- * Validate a comparison expression (has 'key' property)
254
- * @param filter
255
- * @param activeLimetype
256
- * @param limetypes
257
- */
258
- function validateComparisonExpression(filter, activeLimetype, limetypes) {
259
- // Validate operator
260
- const allValidOperators = Object.values(Zt);
261
- if (!allValidOperators.includes(filter.op)) {
262
- throw new Error(`Unsupported filter operator: ${filter.op}`);
263
- }
264
- // Validate placeholder
265
- const result = validatePlaceholder(filter.exp, activeLimetype, limetypes);
266
- if (!result.valid) {
267
- throw new Error(`Invalid placeholder in filter '${filter.key}': ${result.error}`);
268
- }
269
- }
270
- /**
271
- * Validate a group expression (AND/OR/NOT)
272
- * @param filter
273
- * @param activeLimetype
274
- * @param limetypes
275
- * @param guiModeEnabled
276
- */
277
- function validateGroupExpression(filter, activeLimetype, limetypes, guiModeEnabled) {
278
- // Validate operator
279
- if (filter.op !== Zt.AND &&
280
- filter.op !== Zt.OR &&
281
- filter.op !== Zt.NOT) {
282
- throw new Error(`Unsupported group operator: ${filter.op}`);
283
- }
284
- // Recursively validate children
285
- if (filter.op === Zt.NOT) {
286
- validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, guiModeEnabled);
287
- }
288
- else if (filter.op === Zt.AND || filter.op === Zt.OR) {
289
- const expressions = filter.exp;
290
- for (const expr of expressions) {
291
- validateFilterPlaceholders(expr, activeLimetype, limetypes, guiModeEnabled);
292
- }
293
- }
294
- }
295
- /**
296
- * Validate placeholders in a filter expression
297
- * @param filter Filter expression to validate
298
- * @param activeLimetype The limetype of the active object
299
- * @param limetypes Record of all available limetypes
300
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
301
- */
302
- function validateFilterPlaceholders(filter, activeLimetype, limetypes, guiModeEnabled = true) {
303
- if (!filter) {
304
- return;
305
- }
306
- if ('key' in filter) {
307
- validateComparisonExpression(filter, activeLimetype, limetypes);
308
- return;
309
- }
310
- if ('exp' in filter) {
311
- validateGroupExpression(filter, activeLimetype, limetypes, guiModeEnabled);
312
- }
313
- }
314
- /**
315
- * Validate Lime Query filter and collect errors
316
- * @param filter The filter expression or group to validate
317
- * @param activeLimetype Optional active object limetype for placeholder validation
318
- * @param limetypes Record of all available limetypes
319
- * @param guiModeEnabled Whether GUI mode is enabled
320
- * @returns Array of validation error messages
321
- */
322
- function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes, guiModeEnabled) {
323
- const errors = [];
324
- try {
325
- validateFilterPlaceholders(filter, activeLimetype, limetypes, guiModeEnabled);
326
- }
327
- catch (error) {
328
- errors.push(`Invalid filter: ${error.message}`);
329
- }
330
- return errors;
331
- }
332
- /**
333
- * Validate orderBy specification
334
- * @param orderBy Array of orderBy items to validate
335
- * @param limetypes Record of all available limetypes
336
- * @param limetype The limetype for this Lime Query
337
- * @returns Array of validation error messages
338
- */
339
- function validateOrderBy(orderBy, limetypes, limetype) {
340
- const errors = [];
341
- if (!Array.isArray(orderBy)) {
342
- errors.push('orderBy must be an array');
343
- return errors;
344
- }
345
- if (!limetype || !limetypes[limetype]) {
346
- // Can't validate property paths without limetype
347
- return errors;
348
- }
349
- for (const [index, item] of orderBy.entries()) {
350
- const itemErrors = validateOrderByItem(item, index, limetypes, limetype);
351
- errors.push(...itemErrors);
352
- }
353
- return errors;
354
- }
355
- /**
356
- * Validate a single orderBy item
357
- * @param item The orderBy item to validate
358
- * @param index The index of the item in the array (for error messages)
359
- * @param limetypes Record of all available limetypes
360
- * @param limetype The limetype for this Lime Query
361
- * @returns Array of validation error messages for this item
362
- */
363
- function validateOrderByItem(item, index, limetypes, limetype) {
364
- const errors = [];
365
- const objectError = validateOrderByItemIsObject(item, index);
366
- if (objectError) {
367
- return [objectError];
368
- }
369
- const keys = Object.keys(item);
370
- const keyError = validateOrderByItemHasSingleKey(keys, index);
371
- if (keyError) {
372
- return [keyError];
373
- }
374
- const propertyPath = keys[0];
375
- const direction = item[propertyPath];
376
- const directionError = validateOrderByDirection(direction, index);
377
- if (directionError) {
378
- errors.push(directionError);
379
- }
380
- const pathError = validateOrderByPropertyPath(propertyPath, limetypes, limetype, index);
381
- if (pathError) {
382
- errors.push(pathError);
383
- }
384
- return errors;
385
- }
386
- /**
387
- * Validate that the orderBy item is an object
388
- * @param item
389
- * @param index
390
- */
391
- function validateOrderByItemIsObject(item, index) {
392
- if (typeof item !== 'object' || item === null) {
393
- return `orderBy[${index}] must be an object`;
394
- }
395
- return null;
396
- }
397
- /**
398
- * Validate that the orderBy item has exactly one property key
399
- * @param keys
400
- * @param index
401
- */
402
- function validateOrderByItemHasSingleKey(keys, index) {
403
- if (keys.length === 0) {
404
- return `orderBy[${index}] must have a property path`;
405
- }
406
- if (keys.length > 1) {
407
- return `orderBy[${index}] must have exactly one property, got ${keys.length}`;
408
- }
409
- return null;
410
- }
411
- /**
412
- * Validate that the sort direction is either ASC or DESC
413
- * @param direction
414
- * @param index
415
- */
416
- function validateOrderByDirection(direction, index) {
417
- if (direction !== 'ASC' && direction !== 'DESC') {
418
- return `orderBy[${index}]: direction must be 'ASC' or 'DESC', got '${direction}'`;
419
- }
420
- return null;
421
- }
422
- /**
423
- * Validate that the property path exists on the limetype
424
- * @param propertyPath
425
- * @param limetypes
426
- * @param limetype
427
- * @param index
428
- */
429
- function validateOrderByPropertyPath(propertyPath, limetypes, limetype, index) {
430
- if (!propertyPath || propertyPath === '') {
431
- return null;
432
- }
433
- const property = getPropertyFromPath(limetypes, limetype, propertyPath);
434
- if (!property) {
435
- return `orderBy[${index}]: property path '${propertyPath}' does not exist on limetype '${limetype}'`;
436
- }
437
- return null;
438
- }
439
- /**
440
- * Validate Lime Query response format and collect errors/limitations
441
- * @param responseFormat The response format to validate
442
- * @param limetypes Record of all available limetypes
443
- * @param limetype The limetype for this Lime Query
444
- * @param guiModeEnabled Whether GUI mode is enabled
445
- * @returns Object with validation errors and GUI limitations
446
- */
447
- function validateLimeQueryResponseFormatInternal(responseFormat, limetypes, limetype, guiModeEnabled) {
448
- const errors = [];
449
- const limitations = [];
450
- try {
451
- const formatLimitations = validateResponseFormat(responseFormat, limetypes, limetype, guiModeEnabled);
452
- limitations.push(...formatLimitations);
453
- }
454
- catch (error) {
455
- errors.push(`Invalid responseFormat: ${error.message}`);
456
- }
457
- return { errors, limitations };
458
- }
459
- /**
460
- * Validate a Lime Query
461
- * Returns validation result with separate arrays for validity errors and GUI limitations
462
- * @param limeQuery The Lime Query to validate
463
- * @param limetypes Record of all available limetypes
464
- * @param activeLimetype Optional active object limetype for placeholder validation
465
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
466
- * @returns LimeQueryValidationResult with validity status and any errors/limitations
467
- */
468
- function isLimeQuerySupported(limeQuery, limetypes, activeLimetype, guiModeEnabled = true) {
469
- // Handle empty/undefined Lime Query
470
- if (!limeQuery) {
471
- return {
472
- valid: true,
473
- guiSupported: true,
474
- validationErrors: [],
475
- guiLimitations: [],
476
- };
477
- }
478
- const validationErrors = [];
479
- const guiLimitations = [];
480
- // Validate limetype exists
481
- if (limeQuery.limetype && !limetypes[limeQuery.limetype]) {
482
- validationErrors.push(`Unknown limetype: ${limeQuery.limetype}`);
483
- }
484
- // Check for offset without orderBy (Lime Query requirement)
485
- if (limeQuery.offset !== undefined && !limeQuery.orderBy) {
486
- validationErrors.push('offset requires orderBy to be specified');
487
- }
488
- // Validate orderBy
489
- if (limeQuery.orderBy) {
490
- const orderByErrors = validateOrderBy(limeQuery.orderBy, limetypes, limeQuery.limetype);
491
- validationErrors.push(...orderByErrors);
492
- }
493
- // Check for GUI-unsupported top-level properties
494
- if (guiModeEnabled && limeQuery.offset !== undefined) {
495
- guiLimitations.push('offset is not yet supported in GUI mode');
496
- }
497
- // Validate filter
498
- if (limeQuery.filter) {
499
- const filterErrors = validateLimeQueryFilterInternal(limeQuery.filter, activeLimetype, limetypes, guiModeEnabled);
500
- validationErrors.push(...filterErrors);
501
- }
502
- // Validate responseFormat
503
- if (limeQuery.responseFormat) {
504
- const { errors, limitations } = validateLimeQueryResponseFormatInternal(limeQuery.responseFormat, limetypes, limeQuery.limetype, guiModeEnabled);
505
- validationErrors.push(...errors);
506
- guiLimitations.push(...limitations);
507
- }
508
- return {
509
- valid: validationErrors.length === 0,
510
- guiSupported: guiLimitations.length === 0,
511
- validationErrors,
512
- guiLimitations,
513
- };
514
- }
2
+ import { T as Te } from './index.esm-bb569663.js';
3
+ import { i as isLimeQuerySupported } from './lime-query-validation-573223a5.js';
4
+ import './property-resolution-c21a1369.js';
515
5
 
516
6
  const limeQueryBuilderCss = ":host(limebb-lime-lime-query-builder){display:block;width:100%}.lime-query-builder{display:flex;flex-direction:column;gap:2rem}.mode-controls{display:flex;align-items:center;gap:0.5rem;padding:0.5rem}.mode-switch{display:flex;align-items:center;gap:0.5rem}.mode-switch limel-button{min-width:5rem}.mode-switch limel-helper-text{margin-left:1rem;color:rgb(var(--color-red-default))}.gui-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 .gui-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 .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .gui-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .gui-limitations li{margin:0.25rem 0}.lime-query-builder-label{margin:0;font-size:1.5rem;font-weight:600;color:rgb(var(--contrast-1100))}.limetype-section{display:flex;flex-direction:column}.filter-section,.query-options-section{display:flex;flex-direction:column;gap:1rem}.section-label{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}.query-options-controls{display:flex;flex-direction:column;gap:1rem}@media (max-width: 768px){.lime-query-builder{gap:1.5rem}}";
517
7
  const LimebbLimeQueryBuilderStyle0 = limeQueryBuilderCss;
@@ -749,7 +239,7 @@ const LimeQueryBuilder = class {
749
239
  if (!this.limetype) {
750
240
  return;
751
241
  }
752
- return (h("div", { class: "response-format-section" }, h("limebb-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalResponseFormat, onChange: this.handleResponseFormatChange })));
242
+ return (h("div", { class: "response-format-section" }, h("limebb-lime-query-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalResponseFormat, onChange: this.handleResponseFormatChange })));
753
243
  }
754
244
  renderFilterSection() {
755
245
  if (!this.limetype) {