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

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