@instruments/materialgraph 0.6.0 → 0.7.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.
package/spec-types.d.ts CHANGED
@@ -11,12 +11,21 @@
11
11
  * class, but with an EPD on record" reaches for a NAMED, typed criterion instead
12
12
  * of hand-assembling a magic `attribute:value` string.
13
13
  *
14
- * These criteria drive two operations equally:
15
- * - `client.search({ filters: [...] })` — spec gates layered onto a ranked
16
- * (colour / visual / lexical) search.
17
- * - `client.bySpec(...)` — the value-anchored, spec-only primitive, which takes
14
+ * These criteria drive two operations equally, and choosing between them IS the
15
+ * routing decision:
16
+ * - `client.search({ filters: [...] })` — spec gates layered onto a RANKED
17
+ * (colour / visual / lexical) search. Reach for it when relevance still
18
+ * matters: "something like this seed, but Class A".
19
+ * - `client.bySpec(...)` — the value-anchored, SPEC-ONLY primitive, which takes
18
20
  * the same criteria as `attribute:value` strings (build them with the helpers
19
- * in `./specifications`).
21
+ * in `./specifications`). Reach for it when the spec is the whole question and
22
+ * ranking would be noise.
23
+ *
24
+ * Discover the tokens before you spend them: `client.specificationFacets()` for
25
+ * what is facetable at all, `client.attributeValues()` for one attribute's
26
+ * values, `client.resolveAttribute()` / `client.resolveAttributeValue()` to turn
27
+ * a phrase into a canonical pair. A hand-guessed token returns an honest empty
28
+ * answer, which is the hardest kind of bug to see.
20
29
  */
21
30
  /**
22
31
  * The virtual attribute id that matches a certification PROGRAMME wherever it
package/spec-types.js CHANGED
@@ -11,12 +11,21 @@
11
11
  * class, but with an EPD on record" reaches for a NAMED, typed criterion instead
12
12
  * of hand-assembling a magic `attribute:value` string.
13
13
  *
14
- * These criteria drive two operations equally:
15
- * - `client.search({ filters: [...] })` — spec gates layered onto a ranked
16
- * (colour / visual / lexical) search.
17
- * - `client.bySpec(...)` — the value-anchored, spec-only primitive, which takes
14
+ * These criteria drive two operations equally, and choosing between them IS the
15
+ * routing decision:
16
+ * - `client.search({ filters: [...] })` — spec gates layered onto a RANKED
17
+ * (colour / visual / lexical) search. Reach for it when relevance still
18
+ * matters: "something like this seed, but Class A".
19
+ * - `client.bySpec(...)` — the value-anchored, SPEC-ONLY primitive, which takes
18
20
  * the same criteria as `attribute:value` strings (build them with the helpers
19
- * in `./specifications`).
21
+ * in `./specifications`). Reach for it when the spec is the whole question and
22
+ * ranking would be noise.
23
+ *
24
+ * Discover the tokens before you spend them: `client.specificationFacets()` for
25
+ * what is facetable at all, `client.attributeValues()` for one attribute's
26
+ * values, `client.resolveAttribute()` / `client.resolveAttributeValue()` to turn
27
+ * a phrase into a canonical pair. A hand-guessed token returns an honest empty
28
+ * answer, which is the hardest kind of bug to see.
20
29
  */
21
30
  /**
22
31
  * The virtual attribute id that matches a certification PROGRAMME wherever it
@@ -6,6 +6,11 @@
6
6
  * Split out of `types.ts` for the repository's source-file size budget, the same
7
7
  * reason `catalog-discovery-types.ts` sits beside it; both are re-exported from
8
8
  * `types.ts`, so importers see no difference.
9
+ *
10
+ * THE LENS: entity typeahead — it ranks NAMES, not materials. `mg.search()` is
11
+ * what answers a committed query; `mg.suggestColour()` covers colour names and
12
+ * `mg.searchVocabulary()` covers attribute/value tokens. Suggestions are a page
13
+ * of the best matches, never a census of matching entities.
9
14
  */
10
15
  /** Which kind of entity a suggestion is — and therefore what `refId` means. */
11
16
  export type SuggestKind = "product" | "brand" | "category";
@@ -25,8 +30,12 @@ export interface Suggestion {
25
30
  brandSlug: string | null;
26
31
  brandName: string | null;
27
32
  categoryKey: string | null;
28
- /** A representative variant, so a client can open a material record directly. */
33
+ /**
34
+ * A representative variant, so a client can open a material record directly.
35
+ * Opaque, and null when none was picked — not a product without variants.
36
+ */
29
37
  variantId: string | null;
38
+ /** Variants behind this entity IN MATERIALGRAPH — a coverage figure. */
30
39
  variantCount: number;
31
40
  }
32
41
  /** The suggest response: the query as interpreted, plus the ranked suggestions. */
package/suggest-types.js CHANGED
@@ -6,6 +6,11 @@
6
6
  * Split out of `types.ts` for the repository's source-file size budget, the same
7
7
  * reason `catalog-discovery-types.ts` sits beside it; both are re-exported from
8
8
  * `types.ts`, so importers see no difference.
9
+ *
10
+ * THE LENS: entity typeahead — it ranks NAMES, not materials. `mg.search()` is
11
+ * what answers a committed query; `mg.suggestColour()` covers colour names and
12
+ * `mg.searchVocabulary()` covers attribute/value tokens. Suggestions are a page
13
+ * of the best matches, never a census of matching entities.
9
14
  */
10
15
  /**
11
16
  * Shape the query string for a suggest call.