@instruments/materialgraph 0.31.0 → 0.32.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/client.d.ts +2 -43
- package/client.js +1 -45
- package/index.d.ts +0 -3
- package/index.js +0 -1
- package/ndjson.d.ts +1 -1
- package/ndjson.js +1 -1
- package/operations.d.ts +1 -1
- package/operations.js +0 -1
- package/package.json +1 -1
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +24 -33
- package/search-result-validation.d.ts +0 -2
- package/search-result-validation.js +1 -17
- package/types.d.ts +2 -63
- package/validation.d.ts +0 -14
- package/validation.js +0 -38
- package/webmcp.generated.js +5 -6
- package/match-stream-types.d.ts +0 -306
- package/match-stream-types.js +0 -65
- package/match-stream.d.ts +0 -22
- package/match-stream.js +0 -308
- package/match-types.d.ts +0 -138
- package/match-types.js +0 -1
package/client.d.ts
CHANGED
|
@@ -15,8 +15,6 @@ import type { VariantId } from "./identifiers.js";
|
|
|
15
15
|
import type { ListEnumValuesOptions, ListEnumValuesResult } from "./list-enum-values-types.js";
|
|
16
16
|
import type { ListVariantFacetsInput, ListVariantFacetsOutput } from "./list-variant-facets-types.js";
|
|
17
17
|
import type { ListVariantsInput, ListVariantsOutput } from "./list-variants-types.js";
|
|
18
|
-
import type { MatchStreamEvent } from "./match-stream-types.js";
|
|
19
|
-
import type { MatchAnswer, MatchInput } from "./match-types.js";
|
|
20
18
|
import type { ListVariantAssetsOptions, MaterialDocumentPageOptions, VariantAssetPage } from "./material-asset-types.js";
|
|
21
19
|
import type { MaterialQueryPlan } from "./material-query-plan-types.js";
|
|
22
20
|
import type { SourceMaterialBatchReceipt, UploadSourceMaterialInput } from "./run-types.js";
|
|
@@ -35,7 +33,6 @@ export * from "./client-config.js";
|
|
|
35
33
|
* | --- | --- |
|
|
36
34
|
* | "find me something like this / matching these words" | {@link MaterialGraphClient.search} |
|
|
37
35
|
* | "tell me about THIS variant" | {@link MaterialGraphClient.getVariant} |
|
|
38
|
-
* | "what's IN this photo?" | {@link MaterialGraphClient.match} / {@link MaterialGraphClient.matchStream} |
|
|
39
36
|
* | "which materials, from anyone, meet this hard spec?" | {@link MaterialGraphClient.listVariants} |
|
|
40
37
|
* | "what's near this colour / this palette?" | {@link MaterialGraphClient.byColour}, `colours.palette()` |
|
|
41
38
|
* | "what goes with THIS material?" | {@link MaterialGraphClient.pairings}, {@link MaterialGraphClient.listVariants} (same product, other colourways) |
|
|
@@ -107,7 +104,7 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
107
104
|
* (ranking would be noise), {@link MaterialGraphClient.byColour} /
|
|
108
105
|
* `colours.palette()` for visual colour intent (`text` matches WORDS — "sage
|
|
109
106
|
* green" finds materials that SAY sage, not ones that look it),
|
|
110
|
-
* {@link MaterialGraphClient.
|
|
107
|
+
* {@link MaterialGraphClient.pairings}
|
|
111
108
|
* for what goes WITH something, {@link MaterialGraphClient.suggest} for typeahead.
|
|
112
109
|
*
|
|
113
110
|
* The full POST search primitive. `input.filters` are hard token sets on
|
|
@@ -130,44 +127,6 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
130
127
|
view: "card";
|
|
131
128
|
}, signal?: AbortSignal): Promise<SearchCardResponse>;
|
|
132
129
|
searchGet(params: SearchGetParams, signal?: AbortSignal): Promise<SearchResponse>;
|
|
133
|
-
/**
|
|
134
|
-
* THE QUESTION: "what materials are in this PHOTO?" — Material Match classifies
|
|
135
|
-
* the image, decomposes it into surfaces, and answers each one.
|
|
136
|
-
*
|
|
137
|
-
* Instead use {@link MaterialGraphClient.matchStream} whenever a human is
|
|
138
|
-
* watching, {@link MaterialGraphClient.search} with `image` for ONE ranked list
|
|
139
|
-
* rather than a per-surface decomposition, and
|
|
140
|
-
* {@link MaterialGraphClient.extractPalette} for the image's colours only.
|
|
141
|
-
*
|
|
142
|
-
* Exactly one of `imageBase64`, `imageUrl` or `vector`. Read `qualityFloor` and
|
|
143
|
-
* `droppedBelowFloor` before reporting an empty result: "nothing was good
|
|
144
|
-
* enough" and "nothing was found" are different answers.
|
|
145
|
-
*/
|
|
146
|
-
match(input: MatchInput, signal?: AbortSignal): Promise<MatchAnswer>;
|
|
147
|
-
/**
|
|
148
|
-
* Material Match as a PROGRESSIVE stream — the same POST
|
|
149
|
-
* `/api/v1/search/match` endpoint negotiated with `Accept:
|
|
150
|
-
* application/x-ndjson`, which runs the scene workflow (classify → decompose →
|
|
151
|
-
* one match per surface) and emits an event as each surface resolves. Use this
|
|
152
|
-
* wherever the user watches a photo come apart; use {@link match} when you only
|
|
153
|
-
* want the finished answer.
|
|
154
|
-
*
|
|
155
|
-
* Iterate it directly — the request opens on the first `next()`:
|
|
156
|
-
*
|
|
157
|
-
* ```ts
|
|
158
|
-
* for await (const event of client.matchStream({ imageBase64 })) {
|
|
159
|
-
* if (event.type === "surface") render(event.surface);
|
|
160
|
-
* }
|
|
161
|
-
* ```
|
|
162
|
-
*
|
|
163
|
-
* Every frame is validated before it is yielded, and the iterator ends only on
|
|
164
|
-
* a `complete` or `error` event — a truncated connection raises rather than
|
|
165
|
-
* passing for a short run. `signal` cancels the in-flight request itself, as
|
|
166
|
-
* does breaking out of the loop; a cancelled stream ends without raising.
|
|
167
|
-
* Requires an image (`imageBase64` or `imageUrl`); a `vector` input is
|
|
168
|
-
* buffered-only.
|
|
169
|
-
*/
|
|
170
|
-
matchStream(input: MatchInput, signal?: AbortSignal): AsyncGenerator<MatchStreamEvent, void, unknown>;
|
|
171
130
|
/**
|
|
172
131
|
* THE QUESTION: "what materials are near THIS colour?" — one colour (or a small
|
|
173
132
|
* palette), ranked by OKLab closeness to colour extracted from product imagery.
|
|
@@ -321,7 +280,7 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
321
280
|
* materials. The bridge from an inspiration image into the colour lens: extract
|
|
322
281
|
* here, then feed the swatches to `colours.palette()` or
|
|
323
282
|
* {@link MaterialGraphClient.byColour}. Instead use
|
|
324
|
-
|
|
283
|
+
|
|
325
284
|
*/
|
|
326
285
|
extractPalette(input: ExtractPaletteInput, signal?: AbortSignal): Promise<ExtractPaletteResponse>;
|
|
327
286
|
/** "Whose catalogs are in here, and how big is each?" — {@link listBrands}. */
|
package/client.js
CHANGED
|
@@ -7,7 +7,6 @@ import { listAttributes as listAttributesCall, listEnumValues as listEnumValuesC
|
|
|
7
7
|
import { ColoursClient } from "./colours-client.js";
|
|
8
8
|
import { MaterialGraphError } from "./errors.js";
|
|
9
9
|
import { HttpTransport } from "./http-transport.js";
|
|
10
|
-
import { matchStream as matchStreamCall } from "./match-stream.js";
|
|
11
10
|
import { listVariantAssets as listVariantAssetsCall, materialBlocks as materialBlocksCall, materialDocuments as materialDocumentsCall, } from "./material-resources-client.js";
|
|
12
11
|
// Aliased to `operation` — the local name every call site here already used.
|
|
13
12
|
import { resolveOperation as operation } from "./operations.js";
|
|
@@ -26,7 +25,6 @@ export * from "./client-config.js";
|
|
|
26
25
|
* | --- | --- |
|
|
27
26
|
* | "find me something like this / matching these words" | {@link MaterialGraphClient.search} |
|
|
28
27
|
* | "tell me about THIS variant" | {@link MaterialGraphClient.getVariant} |
|
|
29
|
-
* | "what's IN this photo?" | {@link MaterialGraphClient.match} / {@link MaterialGraphClient.matchStream} |
|
|
30
28
|
* | "which materials, from anyone, meet this hard spec?" | {@link MaterialGraphClient.listVariants} |
|
|
31
29
|
* | "what's near this colour / this palette?" | {@link MaterialGraphClient.byColour}, `colours.palette()` |
|
|
32
30
|
* | "what goes with THIS material?" | {@link MaterialGraphClient.pairings}, {@link MaterialGraphClient.listVariants} (same product, other colourways) |
|
|
@@ -135,48 +133,6 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
135
133
|
async searchGet(params, signal) {
|
|
136
134
|
return await this.#get("search_materials_get", { ...params }, signal);
|
|
137
135
|
}
|
|
138
|
-
/**
|
|
139
|
-
* THE QUESTION: "what materials are in this PHOTO?" — Material Match classifies
|
|
140
|
-
* the image, decomposes it into surfaces, and answers each one.
|
|
141
|
-
*
|
|
142
|
-
* Instead use {@link MaterialGraphClient.matchStream} whenever a human is
|
|
143
|
-
* watching, {@link MaterialGraphClient.search} with `image` for ONE ranked list
|
|
144
|
-
* rather than a per-surface decomposition, and
|
|
145
|
-
* {@link MaterialGraphClient.extractPalette} for the image's colours only.
|
|
146
|
-
*
|
|
147
|
-
* Exactly one of `imageBase64`, `imageUrl` or `vector`. Read `qualityFloor` and
|
|
148
|
-
* `droppedBelowFloor` before reporting an empty result: "nothing was good
|
|
149
|
-
* enough" and "nothing was found" are different answers.
|
|
150
|
-
*/
|
|
151
|
-
async match(input, signal) {
|
|
152
|
-
return await this.#post("match_material", input, signal);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Material Match as a PROGRESSIVE stream — the same POST
|
|
156
|
-
* `/api/v1/search/match` endpoint negotiated with `Accept:
|
|
157
|
-
* application/x-ndjson`, which runs the scene workflow (classify → decompose →
|
|
158
|
-
* one match per surface) and emits an event as each surface resolves. Use this
|
|
159
|
-
* wherever the user watches a photo come apart; use {@link match} when you only
|
|
160
|
-
* want the finished answer.
|
|
161
|
-
*
|
|
162
|
-
* Iterate it directly — the request opens on the first `next()`:
|
|
163
|
-
*
|
|
164
|
-
* ```ts
|
|
165
|
-
* for await (const event of client.matchStream({ imageBase64 })) {
|
|
166
|
-
* if (event.type === "surface") render(event.surface);
|
|
167
|
-
* }
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* Every frame is validated before it is yielded, and the iterator ends only on
|
|
171
|
-
* a `complete` or `error` event — a truncated connection raises rather than
|
|
172
|
-
* passing for a short run. `signal` cancels the in-flight request itself, as
|
|
173
|
-
* does breaking out of the loop; a cancelled stream ends without raising.
|
|
174
|
-
* Requires an image (`imageBase64` or `imageUrl`); a `vector` input is
|
|
175
|
-
* buffered-only.
|
|
176
|
-
*/
|
|
177
|
-
matchStream(input, signal) {
|
|
178
|
-
return matchStreamCall(this.#transport, input, signal);
|
|
179
|
-
}
|
|
180
136
|
/**
|
|
181
137
|
* THE QUESTION: "what materials are near THIS colour?" — one colour (or a small
|
|
182
138
|
* palette), ranked by OKLab closeness to colour extracted from product imagery.
|
|
@@ -419,7 +375,7 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
419
375
|
* materials. The bridge from an inspiration image into the colour lens: extract
|
|
420
376
|
* here, then feed the swatches to `colours.palette()` or
|
|
421
377
|
* {@link MaterialGraphClient.byColour}. Instead use
|
|
422
|
-
|
|
378
|
+
|
|
423
379
|
*/
|
|
424
380
|
async extractPalette(input, signal) {
|
|
425
381
|
return await this.#post("extract_image_palette", input, signal);
|
package/index.d.ts
CHANGED
|
@@ -28,9 +28,6 @@ export { ColoursClient } from "./colours-client.js";
|
|
|
28
28
|
export type { ColoursTransport } from "./colours-client.js";
|
|
29
29
|
export type * from "./palette-search-types.js";
|
|
30
30
|
export type * from "./query-understanding-types.js";
|
|
31
|
-
export type * from "./match-types.js";
|
|
32
|
-
export { MATCH_ERROR_REASONS, MATCH_IMAGE_TYPES, MATCH_OUTCOMES, MATCH_MATERIAL_FUNCTIONS, MATCH_STREAM_EVENT_TYPES, MATCH_SURFACE_STATUSES, MATCH_WORKFLOW_STEPS, } from "./match-stream-types.js";
|
|
33
|
-
export type * from "./match-stream-types.js";
|
|
34
31
|
export type * from "./material-query-plan-types.js";
|
|
35
32
|
export type * from "./association-types.js";
|
|
36
33
|
export type * from "./brand-types.js";
|
package/index.js
CHANGED
|
@@ -5,6 +5,5 @@ export { TERMINAL_RUN_EVENT_TYPES } from "./run-types.js";
|
|
|
5
5
|
export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
|
|
6
6
|
export { CategoriesClient } from "./categories-client.js";
|
|
7
7
|
export { ColoursClient } from "./colours-client.js";
|
|
8
|
-
export { MATCH_ERROR_REASONS, MATCH_IMAGE_TYPES, MATCH_OUTCOMES, MATCH_MATERIAL_FUNCTIONS, MATCH_STREAM_EVENT_TYPES, MATCH_SURFACE_STATUSES, MATCH_WORKFLOW_STEPS, } from "./match-stream-types.js";
|
|
9
8
|
export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
|
|
10
9
|
export { certificationProgramme, hasSpec, specTerm } from "./specifications.js";
|
package/ndjson.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A minimal, dependency-free NDJSON (newline-delimited JSON) line reader — the
|
|
3
|
-
* primitive
|
|
3
|
+
* primitive for line-oriented JSON streams. Hand-rolled so the
|
|
4
4
|
* SDK stays zero-runtime-dep and works unchanged inside Node route handlers,
|
|
5
5
|
* where `fetch` yields a byte `ReadableStream`.
|
|
6
6
|
*
|
package/ndjson.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A minimal, dependency-free NDJSON (newline-delimited JSON) line reader — the
|
|
3
|
-
* primitive
|
|
3
|
+
* primitive for line-oriented JSON streams. Hand-rolled so the
|
|
4
4
|
* SDK stays zero-runtime-dep and works unchanged inside Node route handlers,
|
|
5
5
|
* where `fetch` yields a byte `ReadableStream`.
|
|
6
6
|
*
|
package/operations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const MATERIALGRAPH_API_VERSION = "0.7.0";
|
|
2
|
-
declare const OPERATION_DEFINITIONS: readonly [readonly ["samplizeColorVecCache", "GET", "/api/v1/catalogues/samplize/colorvec", "samplize_colorvec_cache"], readonly ["samplizeCatalogueSearch", "POST", "/api/v1/catalogues/samplize/search", "samplize_catalogue_search"], readonly ["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"], readonly ["catalogPages", "GET", "/api/v1/catalogs/{catalogId}/pages", "list_catalog_pages"], readonly ["catalogPageRepresentation", "GET", "/api/v1/catalog-pages/{pageId}/representation", "get_catalog_page_representation"], readonly ["catalogReferences", "GET", "/api/v1/catalogs/{catalogId}/references", "list_catalog_product_references"], readonly ["search", "POST", "/api/v1/search", "search_materials_post"], readonly ["
|
|
2
|
+
declare const OPERATION_DEFINITIONS: readonly [readonly ["samplizeColorVecCache", "GET", "/api/v1/catalogues/samplize/colorvec", "samplize_colorvec_cache"], readonly ["samplizeCatalogueSearch", "POST", "/api/v1/catalogues/samplize/search", "samplize_catalogue_search"], readonly ["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"], readonly ["catalogPages", "GET", "/api/v1/catalogs/{catalogId}/pages", "list_catalog_pages"], readonly ["catalogPageRepresentation", "GET", "/api/v1/catalog-pages/{pageId}/representation", "get_catalog_page_representation"], readonly ["catalogReferences", "GET", "/api/v1/catalogs/{catalogId}/references", "list_catalog_product_references"], readonly ["search", "POST", "/api/v1/search", "search_materials_post"], readonly ["planQuery", "POST", "/api/v1/search/plan", "plan_material_query"], readonly ["samplizeCatalogue", "GET", "/api/v1/catalogues/samplize/products", "samplize_catalogue_products"], readonly ["searchGet", "GET", "/api/v1/search", "search_materials_get"], readonly ["byColour", "GET", "/api/v1/search/colours", "search_by_colour"], readonly ["catalogueReferences", "POST", "/api/v1/catalogues/references", "get_catalogue_references_batch"], readonly ["catalogueCollections", "GET", "/api/v1/catalogues/collections", "list_catalogue_channel_collections"], readonly ["catalogueDocumentAccess", "GET", "/api/v1/catalogues/documents/{documentId}", "get_catalogue_document_access"], readonly ["materialBlocks", "GET", "/api/v1/materials/{variantId}/blocks", "list_material_blocks"], readonly ["listVariantAssets", "GET", "/api/v1/variants/{variantId}/assets", "list_variant_assets"], readonly ["materialDocuments", "GET", "/api/v1/materials/{variantId}/documents", "list_material_documents"], readonly ["schema", "GET", "/api/v1/schema/value-dictionaries", "list_schema_value_dictionaries"], readonly ["pairings", "GET", "/api/v1/materials/{variantId}/pairings", "get_material_pairings"], readonly ["associatedFinishes", "GET", "/api/v1/associated/finishes", "list_associated_finishes"], readonly ["associatedProducts", "GET", "/api/v1/associated/products", "list_associated_products"], readonly ["applicability", "GET", "/api/v1/applicability", "get_applicability"], readonly ["listVariants", "GET", "/api/v1/variants", "list_variants"], readonly ["listVariantFacets", "POST", "/api/v1/variants/facets", "list_variant_facets"], readonly ["findVariantsByColour", "POST", "/api/v1/variants/by-colour", "find_variants_by_colour"], readonly ["findVariantsByVector", "POST", "/api/v1/variants/by-vector", "find_variants_by_vector"], readonly ["findCompanions", "POST", "/api/v1/variants/companions", "find_companions"], readonly ["resolveVariant", "POST", "/api/v1/variants/resolve", "resolve_variant"], readonly ["getVariant", "GET", "/api/v1/variants/{variantId}", "get_variant"], readonly ["resolveColour", "GET", "/api/v1/search/colours/resolve", "resolve_colour_name"], readonly ["listAttributes", "GET", "/api/v1/catalog/attributes", "catalog_list_attributes"], readonly ["listEnumValues", "GET", "/api/v1/catalog/enum-values", "catalog_list_enum_values"], readonly ["categories.list", "GET", "/api/v1/categories", "list_categories"], readonly ["categories.get", "GET", "/api/v1/categories/{id}", "get_category"], readonly ["whoami", "GET", "/api/v1/whoami", "whoami"], readonly ["colours.palette", "POST", "/api/v1/search/palettes", "search_by_palette"], readonly ["extractPalette", "POST", "/api/v1/search/palettes/extract", "extract_image_palette"], readonly ["brands", "GET", "/api/v1/brands", "list_brands"], readonly ["uploadSourceMaterial", "POST", "/api/v1/source-material", "upload_source_material"], readonly ["workflows.start", "POST", "/api/v1/workflows/{workflowId}/runs", "create_public_run"], readonly ["workflows.run", "GET", "/api/v1/workflows/{workflowId}/runs/{runId}", "get_public_run"], readonly ["citation", "GET", "/api/v1/citations/{citationId}", "get_verdict_citation"], readonly ["workflows.streamRunEvents", "GET", "/api/v1/workflows/{workflowId}/runs/{runId}/events", "list_public_run_events"]];
|
|
3
3
|
export type SdkOperationId = (typeof OPERATION_DEFINITIONS)[number][3];
|
|
4
4
|
export type SdkOperation = Readonly<{
|
|
5
5
|
clientMethod: (typeof OPERATION_DEFINITIONS)[number][0];
|
package/operations.js
CHANGED
|
@@ -33,7 +33,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
33
33
|
"list_catalog_product_references",
|
|
34
34
|
],
|
|
35
35
|
["search", "POST", "/api/v1/search", "search_materials_post"],
|
|
36
|
-
["match", "POST", "/api/v1/search/match", "match_material"],
|
|
37
36
|
["planQuery", "POST", "/api/v1/search/plan", "plan_material_query"],
|
|
38
37
|
[
|
|
39
38
|
"samplizeCatalogue",
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The API contract version the schemas were generated from. */
|
|
2
2
|
export declare const RESPONSE_SCHEMA_API_VERSION = "0.7.0";
|
|
3
3
|
/** Every SDK operation whose success response has a published JSON Schema. */
|
|
4
|
-
export declare const RESPONSE_SCHEMA_OPERATION_IDS: readonly ["samplize_colorvec_cache", "samplize_catalogue_search", "list_catalog_documents", "list_catalog_pages", "get_catalog_page_representation", "list_catalog_product_references", "search_materials_post", "
|
|
4
|
+
export declare const RESPONSE_SCHEMA_OPERATION_IDS: readonly ["samplize_colorvec_cache", "samplize_catalogue_search", "list_catalog_documents", "list_catalog_pages", "get_catalog_page_representation", "list_catalog_product_references", "search_materials_post", "plan_material_query", "samplize_catalogue_products", "search_materials_get", "search_by_colour", "get_catalogue_references_batch", "list_catalogue_channel_collections", "get_catalogue_document_access", "list_material_blocks", "list_variant_assets", "list_material_documents", "list_schema_value_dictionaries", "get_material_pairings", "list_associated_finishes", "list_associated_products", "get_applicability", "list_variants", "list_variant_facets", "find_variants_by_colour", "find_variants_by_vector", "find_companions", "resolve_variant", "get_variant", "resolve_colour_name", "catalog_list_attributes", "catalog_list_enum_values", "list_categories", "get_category", "whoami", "search_by_palette", "extract_image_palette", "list_brands", "upload_source_material", "create_public_run", "get_public_run", "get_verdict_citation"];
|
|
5
5
|
export declare const RESPONSE_SCHEMA_CATALOGUE_JSON: string;
|