@instruments/materialgraph 1.2.0 → 1.4.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 CHANGED
@@ -4,6 +4,7 @@ import { CatalogClient } from "./catalog-client.js";
4
4
  import { CategoriesClient } from "./categories-client.js";
5
5
  import type { MaterialGraphClientOptions } from "./client-config.js";
6
6
  import { ColorsClient } from "./colors-client.js";
7
+ import type { DiscoveryReference, DiscoveryTerms, InterpretDiscoveryTermsInput, ColorlessVariantsResult, VariantSibling } from "./discovery-context-types.js";
7
8
  import type { RateLimit } from "./errors.js";
8
9
  import type { FindSampledTogetherInput, FindSampledTogetherOutput } from "./find-sampled-together-types.js";
9
10
  import type { FindVariantsByColorInput, FindVariantsByColorOutput } from "./find-variants-by-color-types.js";
@@ -98,6 +99,14 @@ export declare class MaterialGraphClient extends CatalogClient {
98
99
  readonly workflows: WorkflowsClient;
99
100
  constructor(options: MaterialGraphClientOptions);
100
101
  get lastRateLimit(): RateLimit | null;
102
+ /** Registry definitions and MG's catalog admission policy. */
103
+ discoveryReference(signal?: AbortSignal): Promise<DiscoveryReference>;
104
+ /** MG's exact category and generic color phrase readings. */
105
+ interpretDiscoveryTerms(input: InterpretDiscoveryTermsInput, signal?: AbortSignal): Promise<DiscoveryTerms>;
106
+ /** Colorless finishes among at most 250 supplied variants. */
107
+ colorlessVariants(variantIds: readonly string[], signal?: AbortSignal): Promise<ColorlessVariantsResult>;
108
+ /** The eligible colorways of this variant's product, in name/id order, capped at 300. */
109
+ variantSiblings(variantId: string, signal?: AbortSignal): Promise<VariantSibling[] | null>;
101
110
  /** Current catalog generation; authenticated, no SQL and no rate-limit charge. */
102
111
  getCatalogGeneration(signal?: AbortSignal): Promise<{
103
112
  generation: number;
package/client.js CHANGED
@@ -129,6 +129,24 @@ export class MaterialGraphClient extends CatalogClient {
129
129
  signal,
130
130
  });
131
131
  }
132
+ /** Registry definitions and MG's catalog admission policy. */
133
+ async discoveryReference(signal) {
134
+ return await this.#get("get_discovery_reference", undefined, signal);
135
+ }
136
+ /** MG's exact category and generic color phrase readings. */
137
+ async interpretDiscoveryTerms(input, signal) {
138
+ return await this.#post("interpret_discovery_terms", input, signal);
139
+ }
140
+ /** Colorless finishes among at most 250 supplied variants. */
141
+ async colorlessVariants(variantIds, signal) {
142
+ return await this.#post("find_colorless_variants", { variantIds }, signal);
143
+ }
144
+ /** The eligible colorways of this variant's product, in name/id order, capped at 300. */
145
+ async variantSiblings(variantId, signal) {
146
+ return await this.#get("list_variant_siblings", undefined, signal, {
147
+ variantId,
148
+ });
149
+ }
132
150
  /** Current catalog generation; authenticated, no SQL and no rate-limit charge. */
133
151
  async getCatalogGeneration(signal) {
134
152
  return await this.#get("get_catalog_generation", undefined, signal);
@@ -0,0 +1,45 @@
1
+ import type { MaterialTile } from "./material-types.js";
2
+ /** Static registry definitions and MG-owned discovery policy, without product counts. */
3
+ export type DiscoveryReference = {
4
+ attributes: {
5
+ id: string;
6
+ name: string;
7
+ valueKind: string;
8
+ dictionaryId: string | null;
9
+ unit: string | null;
10
+ isArray: boolean;
11
+ filterable: boolean;
12
+ }[];
13
+ categories: {
14
+ id: string;
15
+ name: string;
16
+ path: string;
17
+ ancestorIds: string[];
18
+ inCatalog: boolean;
19
+ }[];
20
+ productTypes: {
21
+ id: string;
22
+ name: string;
23
+ description: string;
24
+ }[];
25
+ admittedBrandIds: string[];
26
+ };
27
+ export type InterpretDiscoveryTermsInput = {
28
+ text: string;
29
+ categoryIds: readonly string[];
30
+ };
31
+ export type DiscoveryTerms = {
32
+ categories: {
33
+ categoryIds: string[];
34
+ words: string[];
35
+ } | null;
36
+ colorWordHexes: string[];
37
+ };
38
+ export type ColorlessVariantsResult = {
39
+ variantIds: string[];
40
+ };
41
+ /** A sibling uses the same tile contract as the catalog's material cards. */
42
+ export type VariantSibling = MaterialTile & {
43
+ distinction?: string;
44
+ distinguishedBy?: "size" | "code";
45
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -48,6 +48,8 @@ export type FindSampledTogetherRow = {
48
48
  proportion: number;
49
49
  }[];
50
50
  variantId: string;
51
+ /** The trimmed source variant label; null when unknown or for a paint color sample. Separate from surface finish, color family and derived color names. */
52
+ variantLabel: string | null;
51
53
  variantName: string | null;
52
54
  };
53
55
  export type FindSampledTogetherOutput = {
@@ -63,6 +65,8 @@ export type FindSampledTogetherOutput = {
63
65
  /** The id or name this seed came from. */
64
66
  resolvedFrom: string;
65
67
  variantId: string;
68
+ /** The trimmed source variant label; null when unknown or for a paint color sample. Separate from surface finish, color family and derived color names. */
69
+ variantLabel: string | null;
66
70
  variantName: string | null;
67
71
  }[];
68
72
  /** Seed ids outside the materials catalog; present only when at least one was. */
@@ -91,6 +91,8 @@ export type UnresolvedColor = {
91
91
  input: string | null;
92
92
  };
93
93
  export type ColorVariantMatch = {
94
+ /** The trimmed source variant label; null when unknown or for a paint color sample. Separate from surface finish, color family and derived color names. */
95
+ variantLabel: string | null;
94
96
  productType: {
95
97
  id: string;
96
98
  name: string;
@@ -156,6 +158,8 @@ export type ColorRankedSeed = {
156
158
  };
157
159
  /** RERANK's own card — the same shape `ColorVariantMatch` above (`brandId`, `code`), plus its perceptual distance. */
158
160
  export type ColorRankMatch = {
161
+ /** The trimmed source variant label; null when unknown or for a paint color sample. Separate from surface finish, color family and derived color names. */
162
+ variantLabel: string | null;
159
163
  brand: string;
160
164
  brandId: string;
161
165
  code: string | null;
@@ -94,7 +94,7 @@ export type GetVariantOutput = {
94
94
  /** The variant's Material Bank SKU. Absent means none is recorded. */
95
95
  materialBankId?: string;
96
96
  name: string;
97
- /** The trimmed source variant label; null when unknown. Separate from surface finish and derived color names. */
97
+ /** The trimmed source variant label; null when unknown or for a paint color sample, whose own name identifies its color. Separate from surface finish, color family and derived color names. */
98
98
  variantLabel: string | null;
99
99
  /** Requested blocks or attributes the variant's product type does not carry. */
100
100
  notApplicable?: ListVariantsNotApplicable;
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type { DiscoveryReference, DiscoveryTerms, InterpretDiscoveryTermsInput, ColorlessVariantsResult, VariantSibling, } from "./discovery-context-types.js";
1
2
  export { MaterialGraphClient, DEFAULT_BASE_URL } from "./client.js";
2
3
  export type { MaterialGraphClientOptions } from "./client.js";
3
4
  export type { FilterOp, FilterTermCondition, FilterNumericCondition, FilterPresenceCondition, FilterAnyFieldCondition, FilterCondition, FilterGroups, OptionalFilterGroups, OrderByEntry, ListVariantsInclude, ListVariantsCollapse, ColorRegion, ColorRangeCondition, ListVariantsInput, ListVariantsPreference, ListVariantsSpecifications, ListVariantsNotApplicable, SampleSubject, ListVariantsItem, ListVariantsOutput, VariantCard, } from "./list-variants-types.js";
@@ -207,7 +207,7 @@ export type ListVariantsItem = {
207
207
  /** The variant's Material Bank SKU. Absent means none is recorded. */
208
208
  materialBankId?: string;
209
209
  name: string;
210
- /** The trimmed source variant label; null when unknown. Separate from surface finish and derived color names. */
210
+ /** The trimmed source variant label; null when unknown or for a paint color sample, whose own name identifies its color. Separate from surface finish, color family and derived color names. */
211
211
  variantLabel: string | null;
212
212
  notApplicable?: ListVariantsNotApplicable;
213
213
  preference?: ListVariantsPreference;
@@ -4,6 +4,7 @@ import type { ListBrandsPage } from "./brand-types.js";
4
4
  import type { CatalogDocumentList, CatalogPageListResult, CatalogProductReferenceReadResult, CatalogChannelCollectionsResponse, CatalogDocumentAccessResult, CatalogPageRepresentationReadResult, CatalogReferenceBatchResponse } from "./catalog-types.js";
5
5
  import type { CategoriesGetResult, CategoriesListResult } from "./category-types.js";
6
6
  import type { CategoryColorProfilesResponse } from "./color-profiles-types.js";
7
+ import type { DiscoveryReference, DiscoveryTerms, ColorlessVariantsResult, VariantSibling } from "./discovery-context-types.js";
7
8
  import type { FindSampledTogetherOutput } from "./find-sampled-together-types.js";
8
9
  import type { FindVariantsByColorOutput } from "./find-variants-by-color-types.js";
9
10
  import type { FindVariantsByVectorOutput } from "./find-variants-by-vector-types.js";
@@ -22,6 +23,10 @@ import type { SchemaResourceResponse } from "./schema-resource-types.js";
22
23
  import type { SearchVariantsOutput } from "./search-variants-types.js";
23
24
  import type { ExtractPaletteResponse, ListAttributesResult, PairingsResponse, ResolveColorResponse, WhoamiResponse } from "./types.js";
24
25
  export type OperationResponses = {
26
+ get_discovery_reference: DiscoveryReference;
27
+ interpret_discovery_terms: DiscoveryTerms;
28
+ find_colorless_variants: ColorlessVariantsResult;
29
+ list_variant_siblings: VariantSibling[] | null;
25
30
  find_nearest_paints: NearestPaintsOutput;
26
31
  get_catalog_generation: {
27
32
  generation: number;
@@ -1,5 +1,5 @@
1
1
  export declare const MATERIALGRAPH_API_VERSION = "0.8.0";
2
- declare const OPERATION_DEFINITIONS: readonly [readonly ["colors.nearestPaints", "GET", "/api/v1/colors/nearest-paints", "find_nearest_paints"], readonly ["getCatalogGeneration", "GET", "/api/v1/catalog/generation", "get_catalog_generation"], 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 ["samplizeCatalog", "GET", "/api/v1/catalogs/samplize/products", "samplize_catalog_products"], readonly ["catalogReferencesForVariants", "POST", "/api/v1/catalogs/references", "get_catalog_references_batch"], readonly ["catalogCollections", "GET", "/api/v1/catalogs/collections", "list_catalog_channel_collections"], readonly ["catalogDocumentAccess", "GET", "/api/v1/catalogs/documents/{documentId}", "get_catalog_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 ["searchVariants", "POST", "/api/v1/variants/search", "search_variants"], readonly ["findVariantsByColor", "GET", "/api/v1/variants/by-color", "find_variants_by_color"], readonly ["findVariantsByVector", "POST", "/api/v1/variants/by-vector", "find_variants_by_vector"], readonly ["findSampledTogether", "GET", "/api/v1/variants/sampled-together", "find_sampled_together"], readonly ["listSampledTogetherPairs", "GET", "/api/v1/variants/sampled-together/pairs", "list_sampled_together_pairs"], readonly ["resolveVariant", "POST", "/api/v1/variants/resolve", "resolve_variant"], readonly ["getVariant", "GET", "/api/v1/variants/{variantId}", "get_variant"], readonly ["resolveColor", "GET", "/api/v1/search/colors/resolve", "resolve_color_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 ["colors.profiles", "GET", "/api/v1/colors/profiles", "get_category_color_profiles"], 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 ["workflows.streamRunEvents", "GET", "/api/v1/workflows/{workflowId}/runs/{runId}/events", "list_public_run_events"]];
2
+ declare const OPERATION_DEFINITIONS: readonly [readonly ["discoveryReference", "GET", "/api/v1/catalog/discovery-reference", "get_discovery_reference"], readonly ["interpretDiscoveryTerms", "POST", "/api/v1/catalog/interpret-terms", "interpret_discovery_terms"], readonly ["colorlessVariants", "POST", "/api/v1/variants/colorless", "find_colorless_variants"], readonly ["variantSiblings", "GET", "/api/v1/variants/{variantId}/siblings", "list_variant_siblings"], readonly ["colors.nearestPaints", "GET", "/api/v1/colors/nearest-paints", "find_nearest_paints"], readonly ["getCatalogGeneration", "GET", "/api/v1/catalog/generation", "get_catalog_generation"], 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 ["samplizeCatalog", "GET", "/api/v1/catalogs/samplize/products", "samplize_catalog_products"], readonly ["catalogReferencesForVariants", "POST", "/api/v1/catalogs/references", "get_catalog_references_batch"], readonly ["catalogCollections", "GET", "/api/v1/catalogs/collections", "list_catalog_channel_collections"], readonly ["catalogDocumentAccess", "GET", "/api/v1/catalogs/documents/{documentId}", "get_catalog_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 ["searchVariants", "POST", "/api/v1/variants/search", "search_variants"], readonly ["findVariantsByColor", "GET", "/api/v1/variants/by-color", "find_variants_by_color"], readonly ["findVariantsByVector", "POST", "/api/v1/variants/by-vector", "find_variants_by_vector"], readonly ["findSampledTogether", "GET", "/api/v1/variants/sampled-together", "find_sampled_together"], readonly ["listSampledTogetherPairs", "GET", "/api/v1/variants/sampled-together/pairs", "list_sampled_together_pairs"], readonly ["resolveVariant", "POST", "/api/v1/variants/resolve", "resolve_variant"], readonly ["getVariant", "GET", "/api/v1/variants/{variantId}", "get_variant"], readonly ["resolveColor", "GET", "/api/v1/search/colors/resolve", "resolve_color_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 ["colors.profiles", "GET", "/api/v1/colors/profiles", "get_category_color_profiles"], 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 ["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<K extends SdkOperationId = SdkOperationId> = Readonly<{
5
5
  clientMethod: (typeof OPERATION_DEFINITIONS)[number][0];
@@ -1,6 +1,30 @@
1
1
  // GENERATED by apps/web/scripts/generate-openapi-v1.ts. Do not edit.
2
2
  export const MATERIALGRAPH_API_VERSION = "0.8.0";
3
3
  const OPERATION_DEFINITIONS = [
4
+ [
5
+ "discoveryReference",
6
+ "GET",
7
+ "/api/v1/catalog/discovery-reference",
8
+ "get_discovery_reference",
9
+ ],
10
+ [
11
+ "interpretDiscoveryTerms",
12
+ "POST",
13
+ "/api/v1/catalog/interpret-terms",
14
+ "interpret_discovery_terms",
15
+ ],
16
+ [
17
+ "colorlessVariants",
18
+ "POST",
19
+ "/api/v1/variants/colorless",
20
+ "find_colorless_variants",
21
+ ],
22
+ [
23
+ "variantSiblings",
24
+ "GET",
25
+ "/api/v1/variants/{variantId}/siblings",
26
+ "list_variant_siblings",
27
+ ],
4
28
  [
5
29
  "colors.nearestPaints",
6
30
  "GET",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instruments/materialgraph",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -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.8.0";
3
3
  /** Every SDK operation whose success response has a published JSON Schema. */
4
- export declare const RESPONSE_SCHEMA_OPERATION_IDS: readonly ["find_nearest_paints", "get_catalog_generation", "list_catalog_documents", "list_catalog_pages", "get_catalog_page_representation", "list_catalog_product_references", "samplize_catalog_products", "get_catalog_references_batch", "list_catalog_channel_collections", "get_catalog_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", "search_variants", "find_variants_by_color", "find_variants_by_vector", "find_sampled_together", "list_sampled_together_pairs", "resolve_variant", "get_variant", "resolve_color_name", "catalog_list_attributes", "catalog_list_enum_values", "list_categories", "get_category", "whoami", "get_category_color_profiles", "extract_image_palette", "list_brands", "upload_source_material", "create_public_run", "get_public_run"];
4
+ export declare const RESPONSE_SCHEMA_OPERATION_IDS: readonly ["get_discovery_reference", "interpret_discovery_terms", "find_colorless_variants", "list_variant_siblings", "find_nearest_paints", "get_catalog_generation", "list_catalog_documents", "list_catalog_pages", "get_catalog_page_representation", "list_catalog_product_references", "samplize_catalog_products", "get_catalog_references_batch", "list_catalog_channel_collections", "get_catalog_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", "search_variants", "find_variants_by_color", "find_variants_by_vector", "find_sampled_together", "list_sampled_together_pairs", "resolve_variant", "get_variant", "resolve_color_name", "catalog_list_attributes", "catalog_list_enum_values", "list_categories", "get_category", "whoami", "get_category_color_profiles", "extract_image_palette", "list_brands", "upload_source_material", "create_public_run", "get_public_run"];
5
5
  export declare const RESPONSE_SCHEMA_CATALOG_JSON: string;