@instruments/materialgraph 0.33.0 → 0.36.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/association-types.d.ts +11 -11
- package/associations-client.d.ts +7 -7
- package/associations-client.js +5 -5
- package/brand-types.d.ts +37 -41
- package/brand-types.js +3 -5
- package/brands-client.d.ts +22 -9
- package/brands-client.js +20 -6
- package/by-spec-types.d.ts +1 -1
- package/catalog-discovery-types.d.ts +3 -3
- package/catalogue-client.d.ts +2 -50
- package/catalogue-client.js +2 -10
- package/catalogue-types.d.ts +1 -1
- package/categories-client.d.ts +3 -5
- package/categories-client.js +1 -1
- package/category-types.d.ts +17 -30
- package/citation-types.d.ts +2 -2
- package/client-vocabulary.d.ts +2 -2
- package/client-vocabulary.js +4 -1
- package/client.d.ts +62 -105
- package/client.js +68 -106
- package/color-profiles-types.d.ts +70 -0
- package/colors-client.d.ts +76 -0
- package/colors-client.js +52 -0
- package/find-sampled-together-types.d.ts +70 -0
- package/{find-companions-types.js → find-sampled-together-types.js} +4 -4
- package/{find-variants-by-colour-types.d.ts → find-variants-by-color-types.d.ts} +70 -64
- package/find-variants-by-vector-types.d.ts +4 -1
- package/get-variant-types.d.ts +14 -2
- package/http-transport.d.ts +1 -1
- package/http-transport.js +1 -2
- package/identifiers.d.ts +2 -2
- package/identifiers.js +1 -1
- package/index.d.ts +5 -14
- package/index.js +1 -3
- package/list-variant-facets-types.d.ts +4 -4
- package/list-variants-types.d.ts +71 -21
- package/material-asset-types.d.ts +3 -3
- package/material-block-types.d.ts +9 -9
- package/material-types.d.ts +10 -8
- package/operations.d.ts +2 -2
- package/operations.js +19 -25
- package/package.json +2 -2
- package/{resolve-colour-types.d.ts → resolve-color-types.d.ts} +18 -18
- package/response-schemas.generated.d.ts +2 -2
- package/response-schemas.generated.js +41 -71
- package/response-schemas.js +1 -1
- package/samplize-catalogue-types.d.ts +4 -4
- package/samplize-colorvec.js +6 -6
- package/{corpus-scope-types.d.ts → search-catalogue-subset-types.d.ts} +3 -3
- package/search-variants-types.d.ts +33 -2
- package/types.d.ts +32 -284
- package/webmcp.generated.js +4 -9
- package/attribution-types.d.ts +0 -51
- package/attribution-types.js +0 -13
- package/by-colour-types.d.ts +0 -320
- package/colour-region-types.d.ts +0 -18
- package/colours-client.d.ts +0 -70
- package/colours-client.js +0 -38
- package/find-companions-types.d.ts +0 -70
- package/material-query-plan-types.d.ts +0 -70
- package/material-query-plan-types.js +0 -1
- package/ndjson.d.ts +0 -46
- package/ndjson.js +0 -111
- package/palette-search-types.d.ts +0 -171
- package/palette-search-types.js +0 -1
- package/query-understanding-types.d.ts +0 -254
- package/query-understanding-types.js +0 -1
- package/resolve-colour-types.js +0 -1
- package/search-card-types.d.ts +0 -86
- package/search-card-types.js +0 -1
- package/search-index-plan-types.d.ts +0 -74
- package/search-index-plan-types.js +0 -1
- package/search-refinement-types.d.ts +0 -103
- package/search-refinement-types.js +0 -2
- package/search-request-types.d.ts +0 -170
- package/search-request-types.js +0 -1
- package/search-response-receipt-types.d.ts +0 -24
- package/search-response-receipt-types.js +0 -1
- package/search-response-types.d.ts +0 -11
- package/search-response-types.js +0 -1
- package/search-result-validation.d.ts +0 -9
- package/search-result-validation.js +0 -83
- package/spec-types.d.ts +0 -109
- package/spec-types.js +0 -54
- package/specifications.d.ts +0 -34
- package/specifications.js +0 -56
- package/validation.d.ts +0 -43
- package/validation.js +0 -117
- /package/{by-colour-types.js → color-profiles-types.js} +0 -0
- /package/{colour-region-types.js → find-variants-by-color-types.js} +0 -0
- /package/{corpus-scope-types.js → resolve-color-types.js} +0 -0
- /package/{find-variants-by-colour-types.js → search-catalogue-subset-types.js} +0 -0
package/webmcp.generated.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
const json = [
|
|
2
|
-
"[{\"annotations\":{\"readOnlyHint\":true,\"untrustedContentHint\":true},\"description\":\"
|
|
3
|
-
",\"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"e was extracted.\",\"type\":[\"string\",\"null\"]},\"proportion\":{\"type\":\"number\",\"description\":\"The swatch's share of the analysed image, in [0,1].\"}},\"required\":[\"hex\",\"proportion\"],\"additionalProperties\":false},\"description\":\"The material's main-image palette — the FULL stored palette, uncapped and in stored order. Colours are EXTRACTED FROM PRODUCT IMAGERY (visual likeness, never a declared colour specification). A one-swatch palette means the extractor found one colour — solid-colour materials are genuinely monochrome — never that the list was trimmed. This array is always present: EMPTY means nothing is on record (unknown), not 'this material has no colours'.\"},\"colourMeta\":{\"type\":\"object\",\"properties\":{\"dominantFamily\":{\"type\":\"string\"},\"dominantHex\":{\"type\":\"string\"},\"mood\":{\"type\":\"string\"}},\"additionalProperties\":false},\"colourChip\":{\"type\":\"object\",\"properties\":{\"hex\":{\"type\":\"string\",\"description\":\"`#rrggbb` to fill the chip with. EXTRACTED FROM the product image (a visual likeness), never a manufacturer-declared colour specification — surfaces must not present it as one.\"}},\"required\":[\"hex\"],\"additionalProperties\":false,\"description\":\"Present when this material's product imagery carries nothing beyond one colour, so a surface should render that colour rather than the photograph. Set for COATINGS (paints, primers, stains, floor coatings) whose stored palette quantises to a single swatch — a paint's photo is a flat fill, and the colour we hold structured beats a JPEG of it. ABSENT means the question was not established (unknown product type, unextracted or multi-swatch palette) and the image should be rendered; it NEVER asserts 'this is not a coating'.\"},\"attributes\":{\"description\":\"Resolved attribute values for the ids sent in `returnAttributes`, keyed by attribute id. ABSENT entirely when `returnAttributes` was not sent. A key present with `null` means this variant carries no accepted value for that attribute — absent is not empty and neither is null: the three states are distinct on purpose. Values resolve with the normal variant-over-product precedence.\",\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}},{\"type\":\"null\"}]}},\"score\":{\"type\":\"number\",\"description\":\"The selected mode's weighted primary score on the [0, maxScore] scale.\"},\"retired\":{\"description\":\"MB lists the SKU as not visible/retired; demoted in ranking. Omitted when false.\",\"type\":\"boolean\"}},\"required\":[\"variantId\",\"brand\",\"product\",\"brandSlug\",\"productId\",\"color\",\"variantName\",\"imageUrl\",\"hasImage\",\"palette\",\"score\"],\"additionalProperties\":false}},\"view\":{\"default\":\"full\",\"description\":\"Projection echo — always 'full' on this envelope variant.\",\"type\":\"string\",\"const\":\"full\"},\"correctedQuery\":{\"description\":\"Present when a word no material carries was corrected before the search ran: `from` is the query as typed (normalised), `to` the phrasing the page shows results for.\",\"type\":\"object\",\"properties\":{\"from\":{\"type\":\"string\"},\"to\":{\"type\":\"string\"}},\"required\":[\"from\",\"to\"],\"additionalProperties\":false},\"attribution\":{\"type\":\"object\",\"properties\":{\"basis\":{\"type\":\"string\",\"enum\":[\"image\",\"colour\",\"lexical\",\"agent\",\"attribute\",\"match\"],\"description\":\"The ranking basis. On /api/v1/search this equals the envelope's `mode`. The historical match basis remains readable for stored outcomes.\"},\"issuedAt\":{\"type\":\"string\",\"description\":\"ISO-8601 timestamp of when this response was assembled, so a stored outcome carries its own age without a second lookup.\"},\"responseId\":{\"type\":\"string\",\"description\":\"This response's stable id — the same value as the `X-Request-Id` header. Store it next to the outcome (an order, a save, a click) to join that outcome back to the ranking that produced it. Opaque: round-trip it verbatim, never parse it.\"}},\"required\":[\"basis\",\"issuedAt\",\"responseId\"],\"additionalProperties\":false,\"description\":\"Result attribution receipt. Present on every successful ranked response. Nothing on our side retains it — what you store IS the record.\"},\"s",
|
|
7
|
-
"uggestions\":{\"default\":[],\"description\":\"Always empty: the one search offers no refinements. Read nothing from it.\",\"maxItems\":0,\"type\":\"array\",\"items\":{\"not\":{}}},\"mode\":{\"type\":\"string\",\"enum\":[\"image\",\"colour\",\"lexical\",\"agent\",\"attribute\"],\"description\":\"What ordered the page: 'image' (a look-alike: image similarity to the seed), 'colour' (the words or the caller named a colour: colour distance inside that colour's family), 'lexical' (the query's words, ranked by text rank on the index), 'attribute' (no words left to rank on: the category and filters define the page), or 'agent' (the search agent chose these variants and their order; scores are rank-based, 1 for the first result falling linearly, and `maxScore` is 1).\"},\"maxScore\":{\"type\":\"number\"},\"note\":{\"type\":\"string\"},\"cursor\":{\"type\":\"string\"},\"timings\":{\"description\":\"Wall-clock milliseconds per step of the search, keyed by step id. The key set is open and depends on the path a query took, so read it by iterating rather than by naming a key. Present only when `explain` is set: diagnostic, not part of the ranking contract.\",\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"type\":\"number\"}},\"explain\":{\"description\":\"Present only under `explain`: the receipt of the plan the search ran on. Diagnostic, like `timings`.\",\"type\":\"object\",\"properties\":{\"plan\":{\"type\":\"object\",\"properties\":{\"cached\":{\"type\":\"boolean\"},\"plan\":{\"type\":\"object\",\"properties\":{\"brands\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"ids\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"names\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"phrase\":{\"type\":\"string\"}},\"required\":[\"ids\",\"names\",\"phrase\"],\"additionalProperties\":false},{\"type\":\"null\"}]},\"category\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"label\":{\"type\":\"string\"},\"phrase\":{\"type\":\"string\"},\"productTypeIds\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"label\",\"phrase\",\"productTypeIds\"],\"additionalProperties\":false},{\"type\":\"null\"}]},\"colour\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"family12\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"familyId\":{\"type\":\"string\"},\"hex\":{\"type\":\"string\"},\"oklab\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":3,\"maxItems\":3},\"phrase\":{\"type\":\"string\"},\"range\":{\"type\":\"object\",\"properties\":{\"chroma\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},\"hue\":{\"anyOf\":[{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},{\"type\":\"null\"}]},\"lightness\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2}},\"required\":[\"chroma\",\"hue\",\"lightness\"],\"additionalProperties\":false}},\"required\":[\"family12\",\"familyId\",\"hex\",\"oklab\",\"phrase\"],\"additionalProperties\":false},{\"type\":\"null\"}]},\"corpusScope\":{\"type\":\"string\",\"enum\":[\"samplizeCatalogue\",\"materialBankOrderable\",\"materialBankNaOrderable\",\"materialBankNaAndCatalogue\",\"materialBankEuOrderable\",\"designShopOrderable\"]},\"excludeBrands\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"excludes\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"attributeId\":{\"type\":\"string\"},\"phrase\":{\"type\":\"string\"},\"term\":{\"type\":\"string\"}},\"required\":[\"attributeId\",\"phrase\",\"term\"],\"additionalProperties\":false}},\"leftover\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"normalised\":{\"type\":\"string\"},\"softAlone\":{\"type\":\"boolean\"},\"vendorColourNames\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"wants\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"attributeId\":{\"type\":\"string\"},\"fill\":{\"type\":\"number\"},\"phrase\":{\"type\":\"string\"},\"presence\":{\"type\":\"boolean\",\"const\":true},\"strength\":{\"type\":\"string\",\"enum\":[\"hard\",\"soft\"]},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"attributeId\",\"fill\",\"phrase\",\"strength\",\"terms\"],\"additionalProperties\":false}}},\"required\":[\"brands\",\"category\",\"colour\",\"excludeBrands\",\"excludes\",\"leftover\",\"normalised\",\"softAlone\",\"vendorColourNames\",\"wants\"],\"additionalProperties\":false",
|
|
8
|
-
",\"description\":\"The plan the search ran on: the category, brands, wanted and excluded attribute terms (each hard or soft, with its fill), the colour, the words left for text, and the caller's corpus scope when one was sent.\"},\"signature\":{\"type\":\"string\"},\"source\":{\"type\":\"string\",\"enum\":[\"dictionary\",\"jev\"]},\"version\":{\"type\":\"string\"}},\"required\":[\"cached\",\"plan\",\"signature\",\"source\",\"version\"],\"additionalProperties\":false}},\"required\":[\"plan\"],\"additionalProperties\":false},\"query\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{}},\"seed\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{}}},\"required\":[\"results\",\"view\",\"suggestions\",\"mode\",\"maxScore\",\"query\"],\"additionalProperties\":false},{\"type\":\"object\",\"properties\":{\"results\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"description\":\"Resolved attribute values for the ids sent in `returnAttributes`, keyed by attribute id. ABSENT entirely when `returnAttributes` was not sent. A key present with `null` means this variant carries no accepted value for that attribute — absent is not empty and neither is null: the three states are distinct on purpose. Values resolve with the normal variant-over-product precedence.\",\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}},{\"type\":\"null\"}]}},\"brand\":{\"type\":\"string\"},\"brandSlug\":{\"type\":[\"string\",\"null\"]},\"imageSha256\":{\"description\":\"SHA-256 of the displayed image `imageUrl` points at, as a hex digest. Lets a caller key a cache or dedupe on the asset rather than its URL. ABSENT means no hash is on record, never that there is no image.\",\"type\":\"string\"},\"imageUrl\":{\"type\":[\"string\",\"null\"]},\"manufacturerCode\":{\"description\":\"The governed manufacturer/source-native item code from `variants.code` (for example \\\"K-7265-BV\\\") — the same key and the same value the full item publishes. It is what separates two cards a reader cannot otherwise tell apart: brand, product name and variant name are shared by 280,334 of 371,515 cardable variants, because `name` is the PRODUCT name and a paint product is a whole collection. ABSENT means no code is recorded for the variant, never an invented one.\",\"type\":\"string\"},\"name\":{\"type\":\"string\",\"description\":\"Product name (the full item's `product`).\"},\"productId\":{\"type\":[\"string\",\"null\"]},\"projectSaveCapability\":{\"type\":\"string\",\"const\":\"allowed\"},\"resultId\":{\"type\":\"string\",\"description\":\"This exact hit's attribution key — `<responseId>:<rank>`, where rank is 1-based within THIS response. Unique across pages, because each page is its own response with its own id. Store it verbatim next to the outcome; it is opaque, and `attribution.responseId` is the field to group by.\"},\"sampleable\":{\"description\":\"Whether a physical sample is explicitly known to be orderable. Absent means unknown, never unavailable.\",\"type\":\"boolean\"},\"score\":{\"type\":\"number\"},\"sourceStatus\":{\"type\":\"string\",\"const\":\"provisional\"},\"variantCount\":{\"description\":\"How many eligible variants the row's product has, the same set `list_variants` pages, so a follow-up list of the product returns this many: the card's \\\"12 colourways\\\". ABSENT means the product is unknown or has no eligible variant.\",\"type\":\"integer\",\"exclusiveMinimum\":0,\"maximum\":9007199254740991},\"variantId\":{\"type\":\"string\"},\"variantName\":{\"type\":[\"string\",\"null\"]}},\"required\":[\"brand\",\"brandSlug\",\"imageUrl\",\"name\",\"productId\",\"score\",\"variantId\",\"variantName\"],\"additionalProperties\":false}},\"view\":{\"type\":\"string\",\"const\":\"card\",\"description\":\"Projection echo — always 'card' on this envelope variant.\"},\"correctedQuery\":{\"description\":\"Present when a word no material carries was corrected before the search ran: `from` is the query as typed (normalised), `to` the phrasing the page shows results for.\",\"type\":\"object\",\"properties\":{\"from\":{\"type\":\"string\"},\"to\":{\"type\":\"string\"}},\"required\":[\"from\",\"to\"],\"additionalProperties\":false},\"attribution\":{\"type\":\"object\",\"properties\":{\"basis\":{\"type\":\"string\",",
|
|
9
|
-
"\"enum\":[\"image\",\"colour\",\"lexical\",\"agent\",\"attribute\",\"match\"],\"description\":\"The ranking basis. On /api/v1/search this equals the envelope's `mode`. The historical match basis remains readable for stored outcomes.\"},\"issuedAt\":{\"type\":\"string\",\"description\":\"ISO-8601 timestamp of when this response was assembled, so a stored outcome carries its own age without a second lookup.\"},\"responseId\":{\"type\":\"string\",\"description\":\"This response's stable id — the same value as the `X-Request-Id` header. Store it next to the outcome (an order, a save, a click) to join that outcome back to the ranking that produced it. Opaque: round-trip it verbatim, never parse it.\"}},\"required\":[\"basis\",\"issuedAt\",\"responseId\"],\"additionalProperties\":false,\"description\":\"Result attribution receipt. Present on every successful ranked response. Nothing on our side retains it — what you store IS the record.\"},\"suggestions\":{\"default\":[],\"description\":\"Always empty: the one search offers no refinements. Read nothing from it.\",\"maxItems\":0,\"type\":\"array\",\"items\":{\"not\":{}}},\"mode\":{\"type\":\"string\",\"enum\":[\"image\",\"colour\",\"lexical\",\"agent\",\"attribute\"],\"description\":\"What ordered the page: 'image' (a look-alike: image similarity to the seed), 'colour' (the words or the caller named a colour: colour distance inside that colour's family), 'lexical' (the query's words, ranked by text rank on the index), 'attribute' (no words left to rank on: the category and filters define the page), or 'agent' (the search agent chose these variants and their order; scores are rank-based, 1 for the first result falling linearly, and `maxScore` is 1).\"},\"maxScore\":{\"type\":\"number\"},\"note\":{\"type\":\"string\"},\"cursor\":{\"type\":\"string\"},\"timings\":{\"description\":\"Wall-clock milliseconds per step of the search, keyed by step id. The key set is open and depends on the path a query took, so read it by iterating rather than by naming a key. Present only when `explain` is set: diagnostic, not part of the ranking contract.\",\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"type\":\"number\"}},\"explain\":{\"description\":\"Present only under `explain`: the receipt of the plan the search ran on. Diagnostic, like `timings`.\",\"type\":\"object\",\"properties\":{\"plan\":{\"type\":\"object\",\"properties\":{\"cached\":{\"type\":\"boolean\"},\"plan\":{\"type\":\"object\",\"properties\":{\"brands\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"ids\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"names\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"phrase\":{\"type\":\"string\"}},\"required\":[\"ids\",\"names\",\"phrase\"],\"additionalProperties\":false},{\"type\":\"null\"}]},\"category\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"label\":{\"type\":\"string\"},\"phrase\":{\"type\":\"string\"},\"productTypeIds\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"label\",\"phrase\",\"productTypeIds\"],\"additionalProperties\":false},{\"type\":\"null\"}]},\"colour\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"family12\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"familyId\":{\"type\":\"string\"},\"hex\":{\"type\":\"string\"},\"oklab\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":3,\"maxItems\":3},\"phrase\":{\"type\":\"string\"},\"range\":{\"type\":\"object\",\"properties\":{\"chroma\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},\"hue\":{\"anyOf\":[{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},{\"type\":\"null\"}]},\"lightness\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2}},\"required\":[\"chroma\",\"hue\",\"lightness\"],\"additionalProperties\":false}},\"required\":[\"family12\",\"familyId\",\"hex\",\"oklab\",\"phrase\"],\"additionalProperties\":false},{\"type\":\"null\"}]},\"corpusScope\":{\"type\":\"string\",\"enum\":[\"samplizeCatalogue\",\"materialBankOrderable\",\"materialBankNaOrderable\",\"materialBankNaAndCatalogue\",\"materialBankEuOrderable\",\"designShopOrderable\"]},\"excludeBrands\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"excludes\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"pr",
|
|
10
|
-
"operties\":{\"attributeId\":{\"type\":\"string\"},\"phrase\":{\"type\":\"string\"},\"term\":{\"type\":\"string\"}},\"required\":[\"attributeId\",\"phrase\",\"term\"],\"additionalProperties\":false}},\"leftover\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"normalised\":{\"type\":\"string\"},\"softAlone\":{\"type\":\"boolean\"},\"vendorColourNames\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"wants\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"attributeId\":{\"type\":\"string\"},\"fill\":{\"type\":\"number\"},\"phrase\":{\"type\":\"string\"},\"presence\":{\"type\":\"boolean\",\"const\":true},\"strength\":{\"type\":\"string\",\"enum\":[\"hard\",\"soft\"]},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"attributeId\",\"fill\",\"phrase\",\"strength\",\"terms\"],\"additionalProperties\":false}}},\"required\":[\"brands\",\"category\",\"colour\",\"excludeBrands\",\"excludes\",\"leftover\",\"normalised\",\"softAlone\",\"vendorColourNames\",\"wants\"],\"additionalProperties\":false,\"description\":\"The plan the search ran on: the category, brands, wanted and excluded attribute terms (each hard or soft, with its fill), the colour, the words left for text, and the caller's corpus scope when one was sent.\"},\"signature\":{\"type\":\"string\"},\"source\":{\"type\":\"string\",\"enum\":[\"dictionary\",\"jev\"]},\"version\":{\"type\":\"string\"}},\"required\":[\"cached\",\"plan\",\"signature\",\"source\",\"version\"],\"additionalProperties\":false}},\"required\":[\"plan\"],\"additionalProperties\":false},\"query\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{}},\"seed\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{}}},\"required\":[\"results\",\"view\",\"suggestions\",\"mode\",\"maxScore\",\"query\"],\"additionalProperties\":false}],\"type\":\"object\"},\"links\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"meta\":{\"type\":\"object\",\"properties\":{\"operationId\":{\"type\":\"string\",\"enum\":[\"search_materials_post\",\"search_materials_get\"]},\"requestId\":{\"type\":\"string\",\"minLength\":1}},\"required\":[\"operationId\",\"requestId\"],\"additionalProperties\":false},\"warnings\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"minLength\":1}}},\"required\":[\"data\",\"links\",\"meta\",\"warnings\"],\"additionalProperties\":false}}},\"path\":\"/api/v1/search\",\"requiredHeaders\":[],\"requiresVisibleConfirmation\":false}]",
|
|
2
|
+
"[{\"annotations\":{\"readOnlyHint\":true,\"untrustedContentHint\":true},\"description\":\"Reads `query` into filters, runs them through `list_variants` and answers with what was understood beside a page of variants. `understood` says what each phrase became: a hard `filter`, a ranking `preference`, or `not_applied` when nothing could serve it. `filters`, `optionalFilters` and `name` are exactly what ran, so the three can be sent to `list_variants` to narrow or widen the same search. A phrase with more than one meaning is answered with one and listed in `choices`: send its `handle` with an alternative's `group` and `id` in `selections` to switch it. `unresolved` lists words nothing in the vocabulary could read. A query that applies nothing returns no items, never the whole catalogue; a preference alone still ranks it. `cursor` is the previous page's `pageInfo.endCursor`, tied to the vocabulary version the query was read against; it pages this operation only, not `list_variants`. Requires the `mg:read` bearer scope.\",\"inputSchema\":{\"$ref\":\"#/$defs/schema0\",\"$defs\":{\"schema0\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"description\":\"Attribute/block ids to add; id fields always return.\",\"maxItems\":20,\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"cursor\":{\"type\":\"string\"},\"limit\":{\"description\":\"5-10 for examples.\",\"type\":\"integer\",\"minimum\":1,\"maximum\":50},\"query\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":200,\"description\":\"What to find, in plain words.\"},\"selections\":{\"description\":\"Switch a choice: its handle plus the alternative's group and id.\",\"maxItems\":8,\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"group\":{\"type\":\"string\"},\"handle\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"}},\"required\":[\"group\",\"handle\",\"id\"],\"additionalProperties\":false}},\"searchCatalogueSubset\":{\"description\":\"Only this corpus scope. Absent or all: every variant.\",\"type\":\"string\",\"enum\":[\"all\",\"samplizeCatalogue\",\"materialBankOrderable\",\"materialBankNaOrderable\",\"materialBankNaAndCatalogue\",\"materialBankEuOrderable\",\"designShopOrderable\"]},\"include\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"enum\":[\"image\",\"url\"]}}},\"required\":[\"query\"],\"additionalProperties\":false}}},\"method\":\"POST\",\"name\":\"search\",\"operationId\":\"search_variants\",\"outputSchema\":{\"$ref\":\"#/$defs/schema0\",\"$defs\":{\"schema1\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"number\"},{\"type\":\"boolean\"},{\"type\":\"null\"},{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/schema1\"}},{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"$ref\":\"#/$defs/schema1\"}}]},\"schema0\":{\"type\":\"object\",\"properties\":{\"excludedBySearchCatalogueSubset\":{\"description\":\"Filtered variant ids outside the materials catalogue.\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"items\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"category\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},{\"type\":\"null\"}],\"description\":\"The first original source category, or null when unknown.\"},\"categories\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},\"description\":\"All original source categories in source order.\"},\"productType\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},{\"type\":\"null\"}],\"description\":\"The accepted primary specification type, or null for a color sample or unresolved subject.\"},\"sampleSubject\":{\"type\":\"string\",\"enum\":[\"material\",\"paint_color_sample\",\"unknown\",\"conflict\"]},\"colorOptionValueId\":{\"type\":[\"string\",\"null\"]},\"code\":{\"description\":\"The brand's item code.\",\"type\":[\"string\",\"null\"]},\"image\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"alt\":{\"type\":\"string\"},\"url\":{\"type\":\"string\"}},\"required\":[\"alt\",\"url\"],\"additionalProperties\":false},{\"type\":\"null\"}],\"description\":\"The primary product image, or null when there is none.\"},\"brand\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"st",
|
|
3
|
+
"ring\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false,\"description\":\"The brand. `id` is the slug get_brand takes.\"},\"name\":{\"type\":\"string\",\"description\":\"The variant's own name.\"},\"product\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},\"url\":{\"description\":\"The brand's page for it, or null when none is known.\",\"type\":[\"string\",\"null\"]},\"variantId\":{\"type\":\"string\"},\"materialBankId\":{\"description\":\"The variant's Material Bank SKU. Absent: none recorded.\",\"type\":\"string\"},\"notApplicable\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"blocks\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false,\"description\":\"Requested blocks or attributes this product type does not carry.\"},\"preference\":{\"type\":\"object\",\"properties\":{\"matched\":{\"type\":\"array\",\"items\":{\"type\":\"number\"}},\"score\":{\"type\":\"number\"}},\"required\":[\"matched\",\"score\"],\"additionalProperties\":false},\"specifications\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"$ref\":\"#/$defs/schema1\"}}},\"variantCount\":{\"description\":\"Eligible variants of this product. Absent: none counted.\",\"type\":\"integer\",\"exclusiveMinimum\":0,\"maximum\":9007199254740991}},\"required\":[\"category\",\"categories\",\"productType\",\"sampleSubject\",\"colorOptionValueId\",\"code\",\"brand\",\"name\",\"product\",\"variantId\"],\"additionalProperties\":false}},\"pageInfo\":{\"type\":\"object\",\"properties\":{\"endCursor\":{\"type\":[\"string\",\"null\"]},\"hasNextPage\":{\"type\":\"boolean\"}},\"required\":[\"endCursor\",\"hasNextPage\"],\"additionalProperties\":false},\"preferenceMatchesRemain\":{\"description\":\"False: nothing from this page on meets any optionalFilter.\",\"type\":\"boolean\"},\"unavailableVariantIds\":{\"description\":\"Filtered ids in the catalogue this list can't show, e.g. retired.\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"unresolvedVariantIds\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"unstated\":{\"description\":\"Filtered attributes no variant in scope states at all.\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"words\":{\"description\":\"Each word asked for, and whether any variant in scope names it.\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"matched\":{\"type\":\"boolean\"},\"word\":{\"type\":\"string\"}},\"required\":[\"matched\",\"word\"],\"additionalProperties\":false}},\"choices\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"alternatives\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"group\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"kind\":{\"type\":\"string\"},\"label\":{\"type\":\"string\"}},\"required\":[\"group\",\"id\",\"kind\",\"label\"],\"additionalProperties\":false}},\"basis\":{\"type\":\"string\"},\"handle\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"selected\":{\"type\":\"object\",\"properties\":{\"group\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"kind\":{\"type\":\"string\"},\"label\":{\"type\":\"string\"}},\"required\":[\"group\",\"id\",\"kind\",\"label\"],\"additionalProperties\":false},\"text\":{\"type\":\"string\"}},\"required\":[\"alternatives\",\"basis\",\"handle\",\"reason\",\"selected\",\"text\"],\"additionalProperties\":false}},\"colors\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"hex\":{\"type\":\"string\",\"pattern\":\"^#[\\\\da-f]{6}$\",\"description\":\"The color's own point in the region; it orders matches.\"},\"intent\":{\"type\":\"string\",\"enum\":[\"required\",\"preferred\"]},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"range\":{\"type\":\"object\",\"properties\":{\"chroma\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},\"hue\":{\"anyOf\":[{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},{\"type\":\"null\"}]},\"lightness\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2}},\"required\":[\"chroma\",\"hue\",\"lightness\"],\"additionalProperties\":false}},\"required\":[\"hex\",\"op\",\"range\"],\"additionalProperties\":false},\"description\":\"The color regions that ran.\"},\"corrections\":{\"type\":\"array\",\"i",
|
|
4
|
+
"tems\":{\"type\":\"object\",\"properties\":{\"correction\":{\"type\":\"string\"},\"word\":{\"type\":\"string\"}},\"required\":[\"correction\",\"word\"],\"additionalProperties\":false}},\"filters\":{\"type\":\"object\",\"properties\":{\"anyField\":{\"description\":\"One of values in any of fields (term attributes).\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"fields\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"fields\",\"op\",\"values\"],\"additionalProperties\":false}},\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]},\"value\":{\"type\":\"number\"}},\"required\":[\"field\",\"op\",\"value\"],\"additionalProperties\":false}},\"presence\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"exists\",\"missing\"]}},\"required\":[\"field\",\"op\"],\"additionalProperties\":false}},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"all\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"field\",\"op\",\"values\"],\"additionalProperties\":false}}},\"additionalProperties\":false,\"description\":\"The filters that ran, the scope among them.\"},\"name\":{\"type\":\"string\",\"description\":\"The paint name looked up.\"},\"oneRowPer\":{\"type\":\"string\",\"enum\":[\"product\",\"variant\"],\"description\":\"A row per product, or per variant for a paint or color.\"},\"optionalFilters\":{\"type\":\"object\",\"properties\":{\"anyField\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"fields\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"fields\",\"op\",\"values\",\"weight\"],\"additionalProperties\":false}},\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]},\"value\":{\"type\":\"number\"},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"field\",\"op\",\"value\",\"weight\"],\"additionalProperties\":false}},\"presence\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"exists\",\"missing\"]},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"field\",\"op\",\"weight\"],\"additionalProperties\":false}},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"all\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"field\",\"op\",\"values\",\"weight\"],\"additionalProperties\":false}}},\"additionalProperties\":false,\"description\":\"The preferences that ran.\"},\"outcome\":{\"type\":\"string\",\"enum\":[\"page\",\"no_match\",\"nothing_understood\",\"out_of_scope\",\"brand_not_in_catalogue\"],\"description\":\"How the search ended.\"},\"scope\":{\"type\":\"object\",\"properties\":{\"anyField\":{\"description\":\"One of values in any of fields (term attributes).\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"fields\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"fields\",\"op\",\"values\"],\"additionalProperties\":false}},\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]},\"value\":{\"type\":\"number\"}},\"required\":[\"field\",\"op\",\"value\"],\"additionalProperties\":false}},\"presence\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"exists\",\"missing\"]}},\"r",
|
|
5
|
+
"equired\":[\"field\",\"op\"],\"additionalProperties\":false}},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"all\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"field\",\"op\",\"values\"],\"additionalProperties\":false}}},\"additionalProperties\":false,\"description\":\"The fixed scope, repeated in filters.\"},\"understood\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"applied\":{\"type\":\"string\",\"enum\":[\"filter\",\"preference\",\"not_applied\"],\"description\":\"filter narrows; preference only ranks; not_applied did neither.\"},\"id\":{\"type\":\"string\",\"description\":\"The parser's condition id.\"},\"kind\":{\"type\":\"string\",\"enum\":[\"category\",\"brand\",\"term\",\"number\",\"color\",\"paint\"]},\"label\":{\"type\":\"string\",\"description\":\"What the words were read as.\"},\"note\":{\"type\":\"string\"},\"text\":{\"type\":\"string\",\"description\":\"The query words it came from.\"}},\"required\":[\"applied\",\"id\",\"kind\",\"label\",\"text\"],\"additionalProperties\":false}},\"unresolved\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"items\",\"pageInfo\",\"oneRowPer\",\"outcome\",\"understood\"],\"additionalProperties\":false}}},\"path\":\"/api/v1/variants/search\",\"requiredHeaders\":[],\"requiresVisibleConfirmation\":false}]",
|
|
11
6
|
].join("");
|
|
12
7
|
export const WEBMCP_TOOLS = JSON.parse(json);
|
package/attribution-types.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Result attribution (MG-1131) — joining an outcome back to the ranking that
|
|
3
|
-
* produced it.
|
|
4
|
-
*
|
|
5
|
-
* When someone orders a sample days after a search, a list of SKUs cannot say
|
|
6
|
-
* which response returned it or on what basis it was ranked. Store
|
|
7
|
-
* {@link SearchResultItem.resultId} next to the order row and
|
|
8
|
-
* {@link ResponseAttribution} beside the search, and both questions become a
|
|
9
|
-
* join in your own warehouse.
|
|
10
|
-
*
|
|
11
|
-
* MaterialGraph keeps no ledger of these ids. What you store IS the record.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* The ranking basis, in one vocabulary across both ranked routes.
|
|
15
|
-
*
|
|
16
|
-
* The first seven values are `search()`'s `mode` verbatim, and there
|
|
17
|
-
* `attribution.basis === mode` always. `"match"` is what `match()` reports;
|
|
18
|
-
* that route has no `mode`, so this is the only field its outcomes can be
|
|
19
|
-
* grouped by.
|
|
20
|
-
*/
|
|
21
|
-
export type AttributionBasis = "image" | "colour" | "text" | "lexical" | "entity-browse" | "agent" | "attribute" | "match";
|
|
22
|
-
/**
|
|
23
|
-
* Envelope-level attribution receipt, on every successful ranked response.
|
|
24
|
-
*
|
|
25
|
-
* Store this beside the search and each result's `resultId` beside the outcome
|
|
26
|
-
* (an order, a save, a click), and "which sample was ordered off which ranking,
|
|
27
|
-
* on what basis" becomes a join in your own warehouse.
|
|
28
|
-
*
|
|
29
|
-
* A `resultId` is `<responseId>:<rank>`, rank being 1-based within the response
|
|
30
|
-
* that returned it — unique across pages, because each page is its own
|
|
31
|
-
* response. On the Match stream lane it also carries the surface id, so a hit
|
|
32
|
-
* sent twice (on its `surface` frame and again inside `complete`) keeps one key.
|
|
33
|
-
*
|
|
34
|
-
* Both ids are OPAQUE: store them verbatim, never parse them. Group on
|
|
35
|
-
* `responseId` and `basis`.
|
|
36
|
-
*
|
|
37
|
-
* Both fields are optional in the SDK types for one reason only: a server
|
|
38
|
-
* predating MG-1131 does not send them. Every current response does.
|
|
39
|
-
*/
|
|
40
|
-
export type ResponseAttribution = {
|
|
41
|
-
/**
|
|
42
|
-
* This response's stable id — the same value as the `X-Request-Id` header.
|
|
43
|
-
* Opaque: store it verbatim, never parse it. Group your stored outcomes by
|
|
44
|
-
* this field to recover the response that produced them.
|
|
45
|
-
*/
|
|
46
|
-
responseId: string;
|
|
47
|
-
/** How this ranking was produced. The field to group outcomes by. */
|
|
48
|
-
basis: AttributionBasis;
|
|
49
|
-
/** ISO-8601 timestamp of when the response was assembled. */
|
|
50
|
-
issuedAt: string;
|
|
51
|
-
};
|
package/attribution-types.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Result attribution (MG-1131) — joining an outcome back to the ranking that
|
|
3
|
-
* produced it.
|
|
4
|
-
*
|
|
5
|
-
* When someone orders a sample days after a search, a list of SKUs cannot say
|
|
6
|
-
* which response returned it or on what basis it was ranked. Store
|
|
7
|
-
* {@link SearchResultItem.resultId} next to the order row and
|
|
8
|
-
* {@link ResponseAttribution} beside the search, and both questions become a
|
|
9
|
-
* join in your own warehouse.
|
|
10
|
-
*
|
|
11
|
-
* MaterialGraph keeps no ledger of these ids. What you store IS the record.
|
|
12
|
-
*/
|
|
13
|
-
export {};
|
package/by-colour-types.d.ts
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire types for the single-colour lane — GET `/api/v1/search/colours`.
|
|
3
|
-
*
|
|
4
|
-
* Kept out of `types.ts` for the same reason `palette-search-types.ts` is: the
|
|
5
|
-
* shared mirror is at its source-size budget. Same tolerant-parsing contract as
|
|
6
|
-
* the rest of the mirror — response enums are widened so a new server value
|
|
7
|
-
* still type-checks.
|
|
8
|
-
*/
|
|
9
|
-
import type { CorpusScope, CorpusScopeReceipt } from "./corpus-scope-types.js";
|
|
10
|
-
import type { VariantId } from "./identifiers.js";
|
|
11
|
-
import type { QueryUnderstanding } from "./query-understanding-types.js";
|
|
12
|
-
import type { OklabTriple, OpenEnum, PaletteSwatch } from "./types.js";
|
|
13
|
-
/** Coarse group + fine type of a colour match's primary product type. */
|
|
14
|
-
export type MatchCategory = {
|
|
15
|
-
group: string | null;
|
|
16
|
-
type: string | null;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* One colour-palette match.
|
|
20
|
-
*
|
|
21
|
-
* `distance` and `closeness` are OKLab geometry over colour EXTRACTED FROM
|
|
22
|
-
* PRODUCT IMAGERY. Report the ORDER as visual likeness ("reads close to this
|
|
23
|
-
* colour"), never as a stated colour specification. `hex` itself may be the
|
|
24
|
-
* manufacturer's published colour — read `sourceBasis` before repeating it.
|
|
25
|
-
*/
|
|
26
|
-
export type ByColourMatch = {
|
|
27
|
-
/** Opaque — round-trip verbatim. */
|
|
28
|
-
variantId: VariantId;
|
|
29
|
-
brand: string;
|
|
30
|
-
product: string;
|
|
31
|
-
/** Record-route brand identity. */
|
|
32
|
-
brandSlug?: string | null;
|
|
33
|
-
/** Opaque MaterialGraph product-family identity. */
|
|
34
|
-
productId?: string | null;
|
|
35
|
-
/** Material Bank cart/order join key; absent when not on record. */
|
|
36
|
-
materialBankId?: string;
|
|
37
|
-
color: string | null;
|
|
38
|
-
variantName: string | null;
|
|
39
|
-
imageUrl: string | null;
|
|
40
|
-
/**
|
|
41
|
-
* SHA-256 of the displayed image `imageUrl` points at, as a hex digest.
|
|
42
|
-
* ABSENT means no hash is on record, never that there is no image.
|
|
43
|
-
*/
|
|
44
|
-
imageSha256?: string;
|
|
45
|
-
hex: string | null;
|
|
46
|
-
distance: number;
|
|
47
|
-
closeness: number;
|
|
48
|
-
category: MatchCategory | null;
|
|
49
|
-
oklab: OklabTriple | null;
|
|
50
|
-
/**
|
|
51
|
-
* Whether the reported `hex` has a hue compatible with the query colour, by
|
|
52
|
-
* colorscope's `isHueCompatible` at its default thresholds. A flag, never a
|
|
53
|
-
* gate. ABSENT when the match has no hex or the query was a palette.
|
|
54
|
-
*/
|
|
55
|
-
hueCompatible?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Where `hex` came from — PER MATCH, never per response. `"declared"`: the
|
|
58
|
-
* manufacturer published it (a paint's own colour system), so it may be
|
|
59
|
-
* repeated as their stated colour. `"derived"`: extracted from product
|
|
60
|
-
* imagery — visual likeness only. Widened to `string` so a new server value
|
|
61
|
-
* still type-checks. ABSENT when `hex` is null, or on a response captured
|
|
62
|
-
* before the field existed.
|
|
63
|
-
*/
|
|
64
|
-
sourceBasis?: OpenEnum<"declared" | "derived">;
|
|
65
|
-
/**
|
|
66
|
-
* OKLab distance from the QUERY colour to this match's `hex` — two single
|
|
67
|
-
* colours. NOT `distance`, which is the imagery ranking's geometry over whole
|
|
68
|
-
* PALETTES. The two disagree routinely: a match ranked 4th by imagery is often
|
|
69
|
-
* the closest by hex. ABSENT when the match has no hex, or when the query was
|
|
70
|
-
* a palette rather than one colour.
|
|
71
|
-
*/
|
|
72
|
-
colourDistance?: number;
|
|
73
|
-
/**
|
|
74
|
-
* `colourDistance` as a named band, so nobody thresholds a float. Not a
|
|
75
|
-
* confidence and not a percentage — `very-close` still covers differences a
|
|
76
|
-
* client would reject in a paint order, so read `sourceBasis` before quoting
|
|
77
|
-
* any of it as a specification. Widened to `string` so a new server band still
|
|
78
|
-
* type-checks. ABSENT exactly when `colourDistance` is.
|
|
79
|
-
*/
|
|
80
|
-
proximity?: OpenEnum<"indistinguishable" | "very-close" | "close" | "related" | "unrelated">;
|
|
81
|
-
/**
|
|
82
|
-
* The match's own image palette — the FULL stored palette, uncapped and in
|
|
83
|
-
* stored order, each swatch with `oklab` (see {@link ByColourSwatch}), so a
|
|
84
|
-
* card can render, sort or group colours without a second call. A one-swatch
|
|
85
|
-
* palette means the extractor found one colour (solid-colour materials are
|
|
86
|
-
* genuinely monochrome), not that the list was trimmed. ABSENT when no palette
|
|
87
|
-
* is on record: absent means unknown, NOT that the material has no colours.
|
|
88
|
-
* Like `hex`, these swatches come from product imagery, not from the
|
|
89
|
-
* manufacturer.
|
|
90
|
-
*/
|
|
91
|
-
palette?: ByColourSwatch[];
|
|
92
|
-
};
|
|
93
|
-
/** A {@link PaletteSwatch} on the colour lane, where `oklab` is always derived. */
|
|
94
|
-
export type ByColourSwatch = {
|
|
95
|
-
/** `hex` in OKLab — guaranteed present on this surface. */
|
|
96
|
-
oklab: OklabTriple;
|
|
97
|
-
} & PaletteSwatch;
|
|
98
|
-
/**
|
|
99
|
-
* Receipt for the `family` filter — ABSENT when none was asked for, so absence
|
|
100
|
-
* means "no gate ran", never "a gate that dropped nothing".
|
|
101
|
-
*/
|
|
102
|
-
export type ColourFamilyGate = {
|
|
103
|
-
/** The colorscope taxonomy family id the gate kept (normalised). */
|
|
104
|
-
family: string;
|
|
105
|
-
/** Candidates the gate examined — the retrieved pool. NOT a corpus total. */
|
|
106
|
-
considered: number;
|
|
107
|
-
/**
|
|
108
|
-
* Candidates the gate rejected — another family, or no readable hex (unknown
|
|
109
|
-
* is not membership). `considered − matches.length` is not the same number
|
|
110
|
-
* once the page is cut to `limit`; this is the gate's own cost.
|
|
111
|
-
*/
|
|
112
|
-
dropped: number;
|
|
113
|
-
/**
|
|
114
|
-
* Rows dropped a SECOND time, after the page was hydrated with the brand's
|
|
115
|
-
* declared `colour_hex`. A paint's chip photograph and its published hex are
|
|
116
|
-
* different colours and can fall in different families, so the page is
|
|
117
|
-
* re-gated on the hex it reports — every `hex` you receive belongs to the
|
|
118
|
-
* family you asked for. Absent means hydration moved nothing across a
|
|
119
|
-
* boundary.
|
|
120
|
-
*/
|
|
121
|
-
droppedOnPublishedHex?: number;
|
|
122
|
-
};
|
|
123
|
-
/** Receipt for the hard category gate and its treatment of unknown typing. */
|
|
124
|
-
export type ColourCategoryGate = {
|
|
125
|
-
/**
|
|
126
|
-
* Present when the caller named no category: the page then holds surface
|
|
127
|
-
* materials only (the `materials` product-type groups, listed in
|
|
128
|
-
* `requested`), so lights, taps and furniture do not answer a colour.
|
|
129
|
-
*/
|
|
130
|
-
defaulted?: true;
|
|
131
|
-
/** Category names or keys the gate kept: the caller's, or the default groups. */
|
|
132
|
-
requested: string[];
|
|
133
|
-
/** Only accepted primary product types can establish membership. */
|
|
134
|
-
requiresAcceptedPrimaryProductType: true;
|
|
135
|
-
/** Unknown/unclassified variants were ineligible, not proven non-members. */
|
|
136
|
-
unclassifiedVariantsExcluded: true;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Receipt for the colour-identity collapse that turns a variant-grain ranking
|
|
140
|
-
* into a page of TILES — one per (brand, product, dominant hex), one per stored
|
|
141
|
-
* photograph. Only responses stored before the one search carry it: the one
|
|
142
|
-
* search pages one row per product, so nothing collapses now.
|
|
143
|
-
*/
|
|
144
|
-
export type ColourCollapse = {
|
|
145
|
-
/** Ranked rows the collapse examined — this page's pool, never a corpus total. */
|
|
146
|
-
considered: number;
|
|
147
|
-
/** Rows dropped for repeating a better-ranked row's brand, product and hex. */
|
|
148
|
-
droppedByIdentity: number;
|
|
149
|
-
/** Rows dropped for resolving to a better-ranked row's stored photograph. */
|
|
150
|
-
droppedBySharedImage: number;
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* Receipt naming which retrieval lane answered, and the colours it actually ran
|
|
154
|
-
* on. The live endpoint always sends it.
|
|
155
|
-
*
|
|
156
|
-
* Every live page says `index`: the one search's colour key, the colour's
|
|
157
|
-
* family on the search index, nearest first by OKLab distance. A palette is
|
|
158
|
-
* ordered by its first colour, and `droppedColours` names the rest.
|
|
159
|
-
* `containment` and `palette` appear only on responses stored before the one
|
|
160
|
-
* search.
|
|
161
|
-
*/
|
|
162
|
-
export type ColourLaneReceipt = {
|
|
163
|
-
/** Which lane answered. Widened so a new server lane still type-checks. */
|
|
164
|
-
lane: OpenEnum<"index" | "containment" | "palette">;
|
|
165
|
-
/** Why this lane, in one sentence, for a human reader. */
|
|
166
|
-
reason: string;
|
|
167
|
-
/**
|
|
168
|
-
* How the page was ordered. `representative` — the containment default —
|
|
169
|
-
* draws the page in the contained set's own proportions of solid and
|
|
170
|
-
* multi-swatch materials, nearest-first within each, because ordering
|
|
171
|
-
* containment by proximity alone returns a page of solid-colour materials.
|
|
172
|
-
*/
|
|
173
|
-
order: OpenEnum<"representative" | "nearest" | "similarity">;
|
|
174
|
-
/**
|
|
175
|
-
* The colours the search ACTUALLY ran on, after minor-proportion accents were
|
|
176
|
-
* dropped. Compare against `query.colours`: a difference means the search that
|
|
177
|
-
* ran is not the search you asked for.
|
|
178
|
-
*/
|
|
179
|
-
effectiveColours: string[];
|
|
180
|
-
/**
|
|
181
|
-
* Colours removed from your query for carrying a proportion below the accent
|
|
182
|
-
* threshold. EMPTY is the normal case. Non-empty and those colours were absent
|
|
183
|
-
* from retrieval entirely — they did not merely rank low, so an empty-looking
|
|
184
|
-
* result is not evidence that nothing holds them.
|
|
185
|
-
*/
|
|
186
|
-
droppedColours: string[];
|
|
187
|
-
};
|
|
188
|
-
/** The `search/colours` response. */
|
|
189
|
-
export type ByColourResponse = {
|
|
190
|
-
query: {
|
|
191
|
-
/** Raw query provenance, when supplied. */
|
|
192
|
-
q?: string;
|
|
193
|
-
colours: string[];
|
|
194
|
-
categories?: string[];
|
|
195
|
-
/**
|
|
196
|
-
* Echoed brand filter as resolved SLUGS — what the canonical ids, slugs,
|
|
197
|
-
* or exact names you passed resolved to. Present only when a brand scope
|
|
198
|
-
* applied.
|
|
199
|
-
*/
|
|
200
|
-
brands?: string[];
|
|
201
|
-
/** Echoed `family` filter, normalised. Present only when one was applied. */
|
|
202
|
-
family?: string;
|
|
203
|
-
/** Applied single-colour containment order. */
|
|
204
|
-
order?: "representative" | "nearest";
|
|
205
|
-
/** Applied maximum OKLab distance to each reported match hex. */
|
|
206
|
-
maxColourDistance?: number;
|
|
207
|
-
oklab?: OklabTriple;
|
|
208
|
-
};
|
|
209
|
-
/** `matches.length` — THIS PAGE. Not a corpus total; this surface states none. */
|
|
210
|
-
count: number;
|
|
211
|
-
matches: ByColourMatch[];
|
|
212
|
-
/**
|
|
213
|
-
* Present only when `family` was asked for. A gated page can be SHORTER than
|
|
214
|
-
* `limit` — the gate runs over a retrieved pool, not the corpus — and this is
|
|
215
|
-
* what says so in counts rather than adjectives.
|
|
216
|
-
*/
|
|
217
|
-
familyGate?: ColourFamilyGate;
|
|
218
|
-
/** Applied `maxColourDistance` threshold and its page-bounded drop count. */
|
|
219
|
-
proximityGate?: {
|
|
220
|
-
maxColourDistance: number;
|
|
221
|
-
considered: number;
|
|
222
|
-
dropped: number;
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* Present only when `category` was asked for. It states that variants without
|
|
226
|
-
* an accepted primary product type were excluded by the hard gate; absence
|
|
227
|
-
* means no category gate ran.
|
|
228
|
-
*/
|
|
229
|
-
categoryGate?: ColourCategoryGate;
|
|
230
|
-
/**
|
|
231
|
-
* What the colour-identity collapse cost this page. Matches are TILES: a page
|
|
232
|
-
* can be SHORTER than `limit` when the pool collapsed harder than the
|
|
233
|
-
* overfetch allowed, and this says so in counts rather than adjectives.
|
|
234
|
-
*/
|
|
235
|
-
collapse?: ColourCollapse;
|
|
236
|
-
/**
|
|
237
|
-
* Which retrieval lane answered and the colours it ran on. The live endpoint
|
|
238
|
-
* always sends it; optional here only so responses captured before the lane
|
|
239
|
-
* split still type-check.
|
|
240
|
-
*/
|
|
241
|
-
lane?: ColourLaneReceipt;
|
|
242
|
-
/**
|
|
243
|
-
* The corpus this page was drawn from — present ONLY when the request
|
|
244
|
-
* narrowed it. ABSENT means the whole graph: every material MaterialGraph
|
|
245
|
-
* knows, orderable or not. Under a scope the `familyGate` and `collapse` pool
|
|
246
|
-
* counts describe the SCOPED corpus too, because the scope was applied inside
|
|
247
|
-
* retrieval rather than over the page it produced.
|
|
248
|
-
*/
|
|
249
|
-
corpusScope?: CorpusScopeReceipt;
|
|
250
|
-
/** Shared standard-search query-understanding receipt. */
|
|
251
|
-
understanding?: QueryUnderstanding;
|
|
252
|
-
};
|
|
253
|
-
/** Params for `search/colours`. */
|
|
254
|
-
export type ByColourParams = {
|
|
255
|
-
/** Raw material-domain query provenance for shared query understanding. */
|
|
256
|
-
q?: string;
|
|
257
|
-
/** A single hex (with or without `#`). */
|
|
258
|
-
hex?: string;
|
|
259
|
-
/** A palette — repeated as one `colour` query entry each. */
|
|
260
|
-
colour?: string | string[];
|
|
261
|
-
/** OKLab triple (all-or-none). */
|
|
262
|
-
l?: number;
|
|
263
|
-
a?: number;
|
|
264
|
-
b?: number;
|
|
265
|
-
/**
|
|
266
|
-
* HARD category filter — display names or taxonomy ids (repeatable). Absent,
|
|
267
|
-
* the page holds surface materials only (`categoryGate.defaulted`), so
|
|
268
|
-
* lights, taps and furniture do not answer a colour.
|
|
269
|
-
*/
|
|
270
|
-
category?: string | string[];
|
|
271
|
-
/**
|
|
272
|
-
* HARD brand filter (repeatable) — a canonical brand id, exact brand SLUG
|
|
273
|
-
* (`sherwin-williams`), or exact display name (`Sherwin-Williams`). Canonical
|
|
274
|
-
* ids and slugs are case-sensitive and opaque; display names are
|
|
275
|
-
* case-insensitive.
|
|
276
|
-
*
|
|
277
|
-
* This is how the CROSS-BRAND question is asked: pass one brand's colour as
|
|
278
|
-
* `hex` and scope to another to get that brand's nearest colours to it. It is
|
|
279
|
-
* applied inside retrieval, so `limit` still fills from the scoped brands —
|
|
280
|
-
* filtering a returned page instead comes back short, because a
|
|
281
|
-
* nearest-neighbour scan does not know to look further.
|
|
282
|
-
*
|
|
283
|
-
* An unknown brand is a typed 400 naming it, and an exact display name shared
|
|
284
|
-
* by multiple brands is a typed 400 with the candidates; neither becomes an
|
|
285
|
-
* empty page. Omitting it (or passing an empty list) searches every brand.
|
|
286
|
-
*/
|
|
287
|
-
brand?: string | string[];
|
|
288
|
-
/**
|
|
289
|
-
* HARD colour-family filter — ONE colorscope taxonomy family id, from the
|
|
290
|
-
* closed 15-value vocabulary colorscope itself publishes (`white`, `cream`,
|
|
291
|
-
* `gray`, `black`, `beige`, `taupe`, `brown`, `red`, `orange`, `yellow`,
|
|
292
|
-
* `green`, `teal`, `blue`, `purple`, `pink`). Case-insensitive; anything else
|
|
293
|
-
* is a 400 listing the vocabulary.
|
|
294
|
-
*
|
|
295
|
-
* This is NOT the `colour_family` facet vocabulary from `colourFacets()`, and
|
|
296
|
-
* NOT a match's stored dominant-family term — those are colorscope's NAMING
|
|
297
|
-
* families, a different (13-term) list. The family here is assigned from the
|
|
298
|
-
* match's dominant hex by colorscope's taxonomy ownership rules.
|
|
299
|
-
*
|
|
300
|
-
* A filtered page may come back shorter than `limit`: the gate runs over a
|
|
301
|
-
* retrieved pool, and `familyGate` on the response reports that pool and the
|
|
302
|
-
* drop.
|
|
303
|
-
*/
|
|
304
|
-
family?: string;
|
|
305
|
-
/**
|
|
306
|
-
* Kept so existing callers still parse: every page is ordered nearest first
|
|
307
|
-
* by the one search's colour key, so both values return the same page.
|
|
308
|
-
*/
|
|
309
|
-
order?: "representative" | "nearest";
|
|
310
|
-
/**
|
|
311
|
-
* Order by the colour of an existing Variant: materials the same colour as
|
|
312
|
-
* this one. Used when no hex, colour or OKLab triple is given.
|
|
313
|
-
*/
|
|
314
|
-
variantId?: string;
|
|
315
|
-
/** Maximum OKLab distance to each match's reported hex. Single-colour only. */
|
|
316
|
-
maxColourDistance?: number;
|
|
317
|
-
/** Narrow retrieval inside the server query; absent means the whole graph. */
|
|
318
|
-
corpusScope?: CorpusScope;
|
|
319
|
-
limit?: number;
|
|
320
|
-
};
|
package/colour-region-types.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A colour word's region in OKLCh: what a name like "sage" covers, rather than
|
|
3
|
-
* one point. A swatch counts inside it, so it is a box (lightness, chroma, hue)
|
|
4
|
-
* and not a distance. Search echoes it on the plan's colour and accepts it back
|
|
5
|
-
* on the request's `colour`, and the colour lookups carry it on each resolved
|
|
6
|
-
* region.
|
|
7
|
-
*/
|
|
8
|
-
export type ColourRegionRange = {
|
|
9
|
-
/** Inclusive OKLab lightness bounds, 0 to 1. */
|
|
10
|
-
lightness: [number, number];
|
|
11
|
-
/** Inclusive OKLCh chroma bounds. */
|
|
12
|
-
chroma: [number, number];
|
|
13
|
-
/**
|
|
14
|
-
* The hue arc in degrees, 0 to 360, inclusive. It wraps when its start is past
|
|
15
|
-
* its end (reds). `null` means any hue, which is what a neutral is.
|
|
16
|
-
*/
|
|
17
|
-
hue: [number, number] | null;
|
|
18
|
-
};
|