@karmaniverous/jeeves-watcher 0.9.1 → 0.9.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/dist/cli/jeeves-watcher/index.js +29 -8
- package/dist/index.js +29 -8
- package/package.json +1 -1
|
@@ -2785,6 +2785,16 @@ function isFacetable(prop) {
|
|
|
2785
2785
|
return false;
|
|
2786
2786
|
return prop.uiHint !== undefined || prop.enum !== undefined;
|
|
2787
2787
|
}
|
|
2788
|
+
/** uiHint types that represent enumerated value selection. */
|
|
2789
|
+
const ENUMERATED_HINTS = new Set(['dropdown', 'tags', 'select', 'multiselect']);
|
|
2790
|
+
/**
|
|
2791
|
+
* Check whether a uiHint type supports value enumeration.
|
|
2792
|
+
* Non-enumerated hints (text, number, date, range, etc.) should not
|
|
2793
|
+
* aggregate live values — the client uses free-form input instead.
|
|
2794
|
+
*/
|
|
2795
|
+
function isEnumeratedHint(uiHint) {
|
|
2796
|
+
return ENUMERATED_HINTS.has(uiHint);
|
|
2797
|
+
}
|
|
2788
2798
|
/**
|
|
2789
2799
|
* Build the schema-derived facet structure from inference rules.
|
|
2790
2800
|
*
|
|
@@ -2846,20 +2856,31 @@ function createFacetsHandler(deps) {
|
|
|
2846
2856
|
const allValues = valuesManager.getAll();
|
|
2847
2857
|
const facets = [];
|
|
2848
2858
|
for (const [field, schema] of cached.fields) {
|
|
2849
|
-
//
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2859
|
+
// Only aggregate live values for enumerated hint types (dropdown, tags, etc.)
|
|
2860
|
+
// Non-enumerated types (text, number, date, range) use free-form input.
|
|
2861
|
+
let values;
|
|
2862
|
+
if (schema.enumValues) {
|
|
2863
|
+
values = schema.enumValues;
|
|
2864
|
+
}
|
|
2865
|
+
else if (isEnumeratedHint(schema.uiHint)) {
|
|
2866
|
+
const liveValues = new Set();
|
|
2867
|
+
for (const ruleName of schema.rules) {
|
|
2868
|
+
const fieldValues = allValues[ruleName]?.[field];
|
|
2869
|
+
if (fieldValues) {
|
|
2870
|
+
for (const v of fieldValues)
|
|
2871
|
+
liveValues.add(v);
|
|
2872
|
+
}
|
|
2856
2873
|
}
|
|
2874
|
+
values = [...liveValues].sort();
|
|
2875
|
+
}
|
|
2876
|
+
else {
|
|
2877
|
+
values = [];
|
|
2857
2878
|
}
|
|
2858
2879
|
facets.push({
|
|
2859
2880
|
field,
|
|
2860
2881
|
type: schema.type,
|
|
2861
2882
|
uiHint: schema.uiHint,
|
|
2862
|
-
values
|
|
2883
|
+
values,
|
|
2863
2884
|
rules: schema.rules,
|
|
2864
2885
|
});
|
|
2865
2886
|
}
|
package/dist/index.js
CHANGED
|
@@ -2471,6 +2471,16 @@ function isFacetable(prop) {
|
|
|
2471
2471
|
return false;
|
|
2472
2472
|
return prop.uiHint !== undefined || prop.enum !== undefined;
|
|
2473
2473
|
}
|
|
2474
|
+
/** uiHint types that represent enumerated value selection. */
|
|
2475
|
+
const ENUMERATED_HINTS = new Set(['dropdown', 'tags', 'select', 'multiselect']);
|
|
2476
|
+
/**
|
|
2477
|
+
* Check whether a uiHint type supports value enumeration.
|
|
2478
|
+
* Non-enumerated hints (text, number, date, range, etc.) should not
|
|
2479
|
+
* aggregate live values — the client uses free-form input instead.
|
|
2480
|
+
*/
|
|
2481
|
+
function isEnumeratedHint(uiHint) {
|
|
2482
|
+
return ENUMERATED_HINTS.has(uiHint);
|
|
2483
|
+
}
|
|
2474
2484
|
/**
|
|
2475
2485
|
* Build the schema-derived facet structure from inference rules.
|
|
2476
2486
|
*
|
|
@@ -2532,20 +2542,31 @@ function createFacetsHandler(deps) {
|
|
|
2532
2542
|
const allValues = valuesManager.getAll();
|
|
2533
2543
|
const facets = [];
|
|
2534
2544
|
for (const [field, schema] of cached.fields) {
|
|
2535
|
-
//
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2545
|
+
// Only aggregate live values for enumerated hint types (dropdown, tags, etc.)
|
|
2546
|
+
// Non-enumerated types (text, number, date, range) use free-form input.
|
|
2547
|
+
let values;
|
|
2548
|
+
if (schema.enumValues) {
|
|
2549
|
+
values = schema.enumValues;
|
|
2550
|
+
}
|
|
2551
|
+
else if (isEnumeratedHint(schema.uiHint)) {
|
|
2552
|
+
const liveValues = new Set();
|
|
2553
|
+
for (const ruleName of schema.rules) {
|
|
2554
|
+
const fieldValues = allValues[ruleName]?.[field];
|
|
2555
|
+
if (fieldValues) {
|
|
2556
|
+
for (const v of fieldValues)
|
|
2557
|
+
liveValues.add(v);
|
|
2558
|
+
}
|
|
2542
2559
|
}
|
|
2560
|
+
values = [...liveValues].sort();
|
|
2561
|
+
}
|
|
2562
|
+
else {
|
|
2563
|
+
values = [];
|
|
2543
2564
|
}
|
|
2544
2565
|
facets.push({
|
|
2545
2566
|
field,
|
|
2546
2567
|
type: schema.type,
|
|
2547
2568
|
uiHint: schema.uiHint,
|
|
2548
|
-
values
|
|
2569
|
+
values,
|
|
2549
2570
|
rules: schema.rules,
|
|
2550
2571
|
});
|
|
2551
2572
|
}
|
package/package.json
CHANGED