sbuilder-mcp 0.101.2 → 0.101.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@ All notable changes to this project are documented in this file.
|
|
|
6
6
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
7
7
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
+
## [0.101.3] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `sb_review` reports a `filter_no_rows` finding for a filter or sort element with no enabled rows, except price filters with ranges or auto mode.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- `sb_add` seeds a sort select with the six product orders (newest, oldest, price, name) in the site language instead of publishing an empty panel, unless it targets a record list.
|
|
16
|
+
|
|
9
17
|
## [0.101.2] - 2026-10-29
|
|
10
18
|
|
|
11
19
|
### Fixed
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,14 @@ Mọi thay đổi đáng chú ý của dự án được ghi lại trong file n
|
|
|
6
6
|
Định dạng dựa trên [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
7
7
|
và dự án tuân theo [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
+
## [0.101.3] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `sb_review` báo finding `filter_no_rows` cho phần tử filter hoặc sắp xếp không có dòng nào được bật, trừ filter giá có khoảng giá hoặc chế độ auto.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- `sb_add` gieo cho select sắp xếp sáu thứ tự sản phẩm (mới nhất, cũ nhất, giá, tên) theo ngôn ngữ của site thay vì xuất bản panel rỗng, trừ khi nó nhắm tới danh sách bản ghi.
|
|
16
|
+
|
|
9
17
|
## [0.101.2] - 2026-10-29
|
|
10
18
|
|
|
11
19
|
### Fixed
|
|
@@ -12,7 +12,12 @@ import { siteToken } from '../../tools/credentialpick.js';
|
|
|
12
12
|
* attribute axis), the FIXED pairs from `schema/src/filters/sources.ts`, and
|
|
13
13
|
* price rows from the author's `filterRanges` in the `<from>-<to>` grammar
|
|
14
14
|
* `matchesRange` parses (measured live: `f.price=4500000000-7000000000` filters,
|
|
15
|
-
* `..` returns nothing). `sort`
|
|
15
|
+
* `..` returns nothing). A `sort` select gets the six product orders the editor's
|
|
16
|
+
* "Sort control" preset seeds (editor/src/element/sortOptions.ts, render/filters
|
|
17
|
+
* SortKeys; the vi labels are this server's) — without them it published an
|
|
18
|
+
* empty panel (TTG, 2026-10-30). Not
|
|
19
|
+
* when it aims at a record list, whose keys are `<fieldId>_asc|desc`. The
|
|
20
|
+
* blog/course sources are not covered.
|
|
16
21
|
*/
|
|
17
22
|
export const FILTER_VALUE_TYPES = new Set(['filter-checkbox', 'filter-radio', 'filter-tag', 'filter-color', 'select']);
|
|
18
23
|
/** The keys whose change re-derives the rows on sb_set. */
|
|
@@ -24,20 +29,49 @@ const FIXED = {
|
|
|
24
29
|
['in_stock', { en: 'In stock', vi: 'Còn hàng' }],
|
|
25
30
|
['out_of_stock', { en: 'Out of stock', vi: 'Hết hàng' }],
|
|
26
31
|
],
|
|
32
|
+
sort: [
|
|
33
|
+
['newest', { en: 'Newest', vi: 'Mới nhất' }],
|
|
34
|
+
['oldest', { en: 'Oldest', vi: 'Cũ nhất' }],
|
|
35
|
+
['price_asc', { en: 'Price: low to high', vi: 'Giá: thấp đến cao' }],
|
|
36
|
+
['price_desc', { en: 'Price: high to low', vi: 'Giá: cao đến thấp' }],
|
|
37
|
+
['name_asc', { en: 'Name: A-Z', vi: 'Tên: A-Z' }],
|
|
38
|
+
['name_desc', { en: 'Name: Z-A', vi: 'Tên: Z-A' }],
|
|
39
|
+
],
|
|
27
40
|
purchase_history: [
|
|
28
41
|
['purchased', { en: 'Purchased', vi: 'Đã mua' }],
|
|
29
42
|
['not_purchased', { en: 'Not purchased', vi: 'Chưa mua' }],
|
|
30
43
|
],
|
|
31
44
|
};
|
|
32
|
-
/**
|
|
33
|
-
|
|
45
|
+
/**
|
|
46
|
+
* The node's source as the renderer reads it: a `select` with none publishes as
|
|
47
|
+
* a sort (render/nodes/dropdown WireSource(n, "sort")).
|
|
48
|
+
*/
|
|
49
|
+
export function sourceOf(type, sp) {
|
|
50
|
+
if (typeof sp.filterSource === 'string' && sp.filterSource)
|
|
51
|
+
return sp.filterSource;
|
|
52
|
+
return type === 'select' ? 'sort' : '';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Would the dialog's save write rows for this node? `force` = its source just
|
|
56
|
+
* moved. `nodes` = the document, to leave a sort aimed at a record list alone.
|
|
57
|
+
*/
|
|
58
|
+
export function wantsRows(type, sp, force = false, nodes = {}) {
|
|
34
59
|
if (!FILTER_VALUE_TYPES.has(type))
|
|
35
60
|
return false;
|
|
36
61
|
const mode = sp.filterValueMode ?? 'all';
|
|
37
62
|
if (mode !== 'all' && mode !== '')
|
|
38
63
|
return false;
|
|
39
|
-
|
|
64
|
+
const source = sourceOf(type, sp);
|
|
65
|
+
if (!source)
|
|
40
66
|
return false;
|
|
67
|
+
if (source === 'sort') {
|
|
68
|
+
const targets = [
|
|
69
|
+
...(typeof sp.filterTarget === 'string' && sp.filterTarget ? [sp.filterTarget] : []),
|
|
70
|
+
...(Array.isArray(sp.filterTargets) ? sp.filterTargets.map(String) : []),
|
|
71
|
+
];
|
|
72
|
+
if (targets.some((t) => nodes[t]?.data.type === 'list-dataset' && nodes[t]?.config?.datasetSource === 'record'))
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
41
75
|
return force || !Array.isArray(sp.filterValues) || sp.filterValues.length === 0;
|
|
42
76
|
}
|
|
43
77
|
/** Category facets in the dialog's order: depth-first under each parent, strays appended flat. */
|
|
@@ -149,6 +149,10 @@ export const FIX = {
|
|
|
149
149
|
'{ "filterSource": "record", "filterAxis": "fld_…", "filterTargets": ["<list id>"], "filterBehavior": "filter" } — ' +
|
|
150
150
|
'axis types text/select/reference/url/date/boolean/integer/number. A sort select takes filterValues ' +
|
|
151
151
|
'[{ "value": "fld_…_asc" | "fld_…_desc", "label": "…" }].',
|
|
152
|
+
filter_no_rows: 'Re-derive its rows: sb_set id "<id>", namespace specials, keys { "filterSource": "<its source>" } — a product ' +
|
|
153
|
+
'sort gets the six orders, a catalogue source reads the facets, a price filter needs filterRanges. A sort aimed ' +
|
|
154
|
+
'at a record list takes filterValues [{ "value": "fld_…_asc" | "fld_…_desc", "label": "…", "enabled": true }]; ' +
|
|
155
|
+
'anything else, write specials.filterValues [{ "value": …, "label": …, "enabled": true }] yourself.',
|
|
152
156
|
record_relation_unset: 'Link it to its parent row: sb_set id "<id>", namespace config, keys { "recordRelationField": "fld_…" } — ' +
|
|
153
157
|
'the ID of a "reference" field in THIS list\'s collection that targets the enclosing list\'s collection ' +
|
|
154
158
|
'(GET /api/sites/{siteId}/collections/{id}/fields, refCollectionId).',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
+
import { FILTER_VALUE_TYPES, sourceOf } from './filtervalues.js';
|
|
2
3
|
import { childrenOf, childrenWithSatellites, isOverlay, isSharedSection, pageChildren, subtreeIds, appBlockRoot, SPEC_GLOBAL_REF, SPEC_APP_BLOCK_REF } from '../../core/tree.js';
|
|
3
4
|
import { STUCK_STATE, stickyBlockedBy, stuckHostOf, isPinnedNode } from './sticky.js';
|
|
4
5
|
import { bandOf, isGlobal } from './traps.js';
|
|
@@ -918,6 +919,31 @@ opts = {}) {
|
|
|
918
919
|
});
|
|
919
920
|
}
|
|
920
921
|
}
|
|
922
|
+
// A FILTER OR SORT WITH NO ROWS shows nothing to choose (TTG, 2026-10-30: the
|
|
923
|
+
// category page's "Sắp xếp" opened onto an empty panel; a filter-* with no
|
|
924
|
+
// rows renders nothing at all). The renderer prints ONLY specials.filterValues,
|
|
925
|
+
// except price rows derived from filterRanges and the `auto` mode that follows
|
|
926
|
+
// the page. Record filters are left out: their rows are a field's values this
|
|
927
|
+
// server cannot derive, and record_filter_invalid judges them.
|
|
928
|
+
{
|
|
929
|
+
const sp = (n.specials ?? {});
|
|
930
|
+
const mode = sp.filterValueMode ?? 'all';
|
|
931
|
+
const source = sourceOf(type, sp);
|
|
932
|
+
const rows = Array.isArray(sp.filterValues) ? sp.filterValues : [];
|
|
933
|
+
const priceDerived = source === 'price' && Array.isArray(sp.filterRanges) && sp.filterRanges.length > 0;
|
|
934
|
+
if (FILTER_VALUE_TYPES.has(type) &&
|
|
935
|
+
mode !== 'auto' &&
|
|
936
|
+
source && source !== 'record' && !priceDerived &&
|
|
937
|
+
!rows.some((r) => r?.enabled !== false && String(r?.value ?? '') !== '')) {
|
|
938
|
+
out.push({
|
|
939
|
+
code: 'filter_no_rows',
|
|
940
|
+
nodeId: id,
|
|
941
|
+
type,
|
|
942
|
+
problem: `A ${source} ${type} with no enabled rows — ${type === 'select' ? 'it opens onto an empty panel' : 'it renders nothing'}; a shopper has nothing to choose.`,
|
|
943
|
+
fix: fill('filter_no_rows', { id }),
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}
|
|
921
947
|
// RECORD LINK PARAMETERS and VISITOR FAVORITES (web_builder v1.0.174, contract §7.6/§7.7).
|
|
922
948
|
// Both read the record of the row they sit in — or the page's, on a record page.
|
|
923
949
|
{
|
package/dist/tools/page.js
CHANGED
|
@@ -41,7 +41,7 @@ import { stickyWarning } from '../domains/site/sticky.js';
|
|
|
41
41
|
import { HOVER_STATE, PARENT_HOVER_STATE, hoverHostNote, hoverRoutingNote } from '../domains/site/hover.js';
|
|
42
42
|
import { siteFor } from './context.js';
|
|
43
43
|
import { projectList, PAGE_FIELDS, TEMPLATE_FIELDS } from './project.js';
|
|
44
|
-
import { FILTER_VALUE_TYPES, RESOURCE_KEYS, filterPatches, wantsRows } from '../domains/site/filtervalues.js';
|
|
44
|
+
import { FILTER_VALUE_TYPES, RESOURCE_KEYS, filterPatches, sourceOf, wantsRows } from '../domains/site/filtervalues.js';
|
|
45
45
|
/**
|
|
46
46
|
* Findings, in the shape every surface returns them.
|
|
47
47
|
*
|
|
@@ -1638,8 +1638,8 @@ export function registerPageTools(server, ctx) {
|
|
|
1638
1638
|
const after = d.preview(patches).doc.nodes;
|
|
1639
1639
|
const targets = ids
|
|
1640
1640
|
.map((id) => ({ id, node: after[id] }))
|
|
1641
|
-
.filter(({ node }) => node && wantsRows(node.data.type, (node.specials ?? {})))
|
|
1642
|
-
.map(({ id, node }) => ({ id, specials: (node.specials ?? {}) }));
|
|
1641
|
+
.filter(({ node }) => node && wantsRows(node.data.type, (node.specials ?? {}), false, after))
|
|
1642
|
+
.map(({ id, node }) => ({ id, specials: { ...(node.specials ?? {}), filterSource: sourceOf(node.data.type, (node.specials ?? {})) } }));
|
|
1643
1643
|
if (targets.length) {
|
|
1644
1644
|
const got = await filterPatches(ctx, session.site(), targets);
|
|
1645
1645
|
patches.push(...got.patches);
|
|
@@ -1736,7 +1736,8 @@ export function registerPageTools(server, ctx) {
|
|
|
1736
1736
|
const resourced = batch
|
|
1737
1737
|
.filter((e) => e.namespace === 'specials' && !('filterValues' in e.keys) && RESOURCE_KEYS.some((k) => k in e.keys))
|
|
1738
1738
|
.map((e) => ({ id: e.id, specials: { ...(d.doc.nodes[e.id]?.specials ?? {}), ...e.keys } }))
|
|
1739
|
-
.filter((t) => wantsRows(d.doc.nodes[t.id]?.data.type ?? '', t.specials, true))
|
|
1739
|
+
.filter((t) => wantsRows(d.doc.nodes[t.id]?.data.type ?? '', t.specials, true, d.doc.nodes))
|
|
1740
|
+
.map((t) => ({ ...t, specials: { ...t.specials, filterSource: sourceOf(d.doc.nodes[t.id]?.data.type ?? '', t.specials) } }));
|
|
1740
1741
|
// Its patches join the batch only on the real write: a dry run's `patches`
|
|
1741
1742
|
// never echoes what a GET read (rule 8) — `filters` says the row counts.
|
|
1742
1743
|
const refiltered = resourced.length ? await filterPatches(ctx, session.site(), resourced) : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbuilder-mcp",
|
|
3
|
-
"version": "0.101.
|
|
3
|
+
"version": "0.101.3",
|
|
4
4
|
"description": "MCP server that designs and operates a Store Builder site — pages, data, theme and publish — through the platform's own API and live-edit protocol.",
|
|
5
5
|
"mcpName": "io.github.vuluu2k/sbuilder-mcp",
|
|
6
6
|
"type": "module",
|