@instruments/materialgraph 2.3.0 → 3.0.1
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 +14 -2
- package/client.js +18 -3
- package/get-variant-types.d.ts +1 -1
- package/index.d.ts +0 -1
- package/operation-responses.d.ts +0 -7
- package/operations.generated.d.ts +1 -1
- package/operations.generated.js +0 -31
- package/package.json +1 -1
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +28 -42
- package/catalog-client.d.ts +0 -43
- package/catalog-client.js +0 -51
- package/catalog-types.d.ts +0 -373
- package/catalog-types.js +0 -1
package/client.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ApplicabilityOptions, AssociatedOptions } from "./association-types.js";
|
|
2
2
|
import type { BrandsOptions } from "./brand-types.js";
|
|
3
|
-
import { CatalogClient } from "./catalog-client.js";
|
|
4
3
|
import { CategoriesClient } from "./categories-client.js";
|
|
5
4
|
import type { MaterialGraphClientOptions } from "./client-config.js";
|
|
6
5
|
import { ColorsClient } from "./colors-client.js";
|
|
@@ -16,6 +15,7 @@ import type { ListSampledTogetherPairsInput, ListSampledTogetherPairsOutput } fr
|
|
|
16
15
|
import type { ListVariantFacetsInput, ListVariantFacetsOutput } from "./list-variant-facets-types.js";
|
|
17
16
|
import type { ListVariantsInput, ListVariantsOutput } from "./list-variants-types.js";
|
|
18
17
|
import type { ListVariantAssetsOptions, MaterialDocumentPageOptions, VariantAssetPage } from "./material-asset-types.js";
|
|
18
|
+
import type { ResolveVariantInput, ResolveVariantOutput } from "./resolve-variant-types.js";
|
|
19
19
|
import type { SchemaResource, SchemaResourceResponse } from "./schema-resource-types.js";
|
|
20
20
|
import type { SearchVariantsInput, SearchVariantsOutput } from "./search-variants-types.js";
|
|
21
21
|
import type { SourceMaterialBatchReceipt, UploadSourceMaterialInput } from "./source-material-types.js";
|
|
@@ -56,7 +56,7 @@ export type { MaterialGraphClientOptions } from "./client-config.js";
|
|
|
56
56
|
* And three reading rules that apply to every lens: ids are opaque (see
|
|
57
57
|
* `./identifiers.ts`), absent is not false, and a page is not a corpus.
|
|
58
58
|
*/
|
|
59
|
-
export declare class MaterialGraphClient
|
|
59
|
+
export declare class MaterialGraphClient {
|
|
60
60
|
#private;
|
|
61
61
|
readonly baseUrl: string;
|
|
62
62
|
/**
|
|
@@ -101,6 +101,18 @@ export declare class MaterialGraphClient extends CatalogClient {
|
|
|
101
101
|
getCatalogGeneration(signal?: AbortSignal): Promise<{
|
|
102
102
|
generation: number;
|
|
103
103
|
}>;
|
|
104
|
+
/**
|
|
105
|
+
* THE QUESTION: "what does this brand page or code resolve to in the
|
|
106
|
+
* graph?" Give `input.url` alone, or `input.code` with `input.brandId` (from
|
|
107
|
+
* {@link MaterialGraphClient.brands}) when there is no page to read.
|
|
108
|
+
*
|
|
109
|
+
* Exact and scoreless: a sibling colorway, a similar image or a brand match
|
|
110
|
+
* alone never identifies a variant. Read `outcome` - `identified` names
|
|
111
|
+
* an exact stored variant, `placed` an exact brand with no variant match,
|
|
112
|
+
* `ambiguous` carries bounded `candidates`, and `unresolved` states why,
|
|
113
|
+
* never a guess. The submitted URL is never persisted.
|
|
114
|
+
*/
|
|
115
|
+
resolveVariant(input: ResolveVariantInput, signal?: AbortSignal): Promise<ResolveVariantOutput>;
|
|
104
116
|
/**
|
|
105
117
|
* THE QUESTION: "tell me about THIS variant" (GET
|
|
106
118
|
* `/api/v1/variants/{variantId}`, `get_variant`).
|
package/client.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { applicability, declaredFinishes, declaredProducts, } from "./associations-client.js";
|
|
2
2
|
import { listBrands } from "./brands-client.js";
|
|
3
|
-
import { CatalogClient } from "./catalog-client.js";
|
|
4
3
|
import { CategoriesClient } from "./categories-client.js";
|
|
5
4
|
import { DEFAULT_BASE_URL } from "./client-config.js";
|
|
6
5
|
import { listAttributes as listAttributesCall, listEnumValues as listEnumValuesCall, resolveColor as resolveColorCall, } from "./client-vocabulary.js";
|
|
@@ -48,7 +47,7 @@ export { DEFAULT_BASE_URL } from "./client-config.js";
|
|
|
48
47
|
* And three reading rules that apply to every lens: ids are opaque (see
|
|
49
48
|
* `./identifiers.ts`), absent is not false, and a page is not a corpus.
|
|
50
49
|
*/
|
|
51
|
-
export class MaterialGraphClient
|
|
50
|
+
export class MaterialGraphClient {
|
|
52
51
|
baseUrl;
|
|
53
52
|
/**
|
|
54
53
|
* THE QUESTION: "what kinds of thing exist, and what are their keys?"
|
|
@@ -91,7 +90,6 @@ export class MaterialGraphClient extends CatalogClient {
|
|
|
91
90
|
? {}
|
|
92
91
|
: { timeoutMs: options.timeoutMs }),
|
|
93
92
|
});
|
|
94
|
-
super(transport);
|
|
95
93
|
this.#transport = transport;
|
|
96
94
|
this.baseUrl = transport.baseUrl;
|
|
97
95
|
this.categories = new CategoriesClient({
|
|
@@ -140,6 +138,23 @@ export class MaterialGraphClient extends CatalogClient {
|
|
|
140
138
|
async getCatalogGeneration(signal) {
|
|
141
139
|
return await this.#get("get_catalog_generation", undefined, signal);
|
|
142
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* THE QUESTION: "what does this brand page or code resolve to in the
|
|
143
|
+
* graph?" Give `input.url` alone, or `input.code` with `input.brandId` (from
|
|
144
|
+
* {@link MaterialGraphClient.brands}) when there is no page to read.
|
|
145
|
+
*
|
|
146
|
+
* Exact and scoreless: a sibling colorway, a similar image or a brand match
|
|
147
|
+
* alone never identifies a variant. Read `outcome` - `identified` names
|
|
148
|
+
* an exact stored variant, `placed` an exact brand with no variant match,
|
|
149
|
+
* `ambiguous` carries bounded `candidates`, and `unresolved` states why,
|
|
150
|
+
* never a guess. The submitted URL is never persisted.
|
|
151
|
+
*/
|
|
152
|
+
async resolveVariant(input, signal) {
|
|
153
|
+
return await this.#transport.requestJson(operation("resolve_variant"), {
|
|
154
|
+
body: input,
|
|
155
|
+
signal,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
143
158
|
// ── Materials ──────────────────────────────────────────────────────────────
|
|
144
159
|
/**
|
|
145
160
|
* THE QUESTION: "tell me about THIS variant" (GET
|
package/get-variant-types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { ListVariantsNotApplicable, ListVariantsSpecifications, SampleSubje
|
|
|
11
11
|
import type { VariantColorPalette } from "./material-block-types.js";
|
|
12
12
|
/** The detail to add under `specifications`; absent, the answer is the compact item alone. */
|
|
13
13
|
export type GetVariantOptions = {
|
|
14
|
-
/** Canonical attribute ids, e.g. `["
|
|
14
|
+
/** Canonical attribute ids, e.g. `["nrc"]`. */
|
|
15
15
|
attributes?: readonly string[];
|
|
16
16
|
/** Canonical block ids, returned whole, e.g. `["acoustic"]`. */
|
|
17
17
|
blocks?: readonly string[];
|
package/index.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.
|
|
|
20
20
|
export type { MaterialGraphErrorInit, MaterialGraphErrorKind, MaterialGraphRequestMetadata, ProblemDetail, RateLimit, SanitizedErrorValue, SanitizedIssue, SimpleErrorBody, } from "./errors.js";
|
|
21
21
|
export type { OpenEnum, JsonValue, OklabTriple, MaterialColor, ImageSource, MaterialAvailability, MaterialTile, DemandMomentum, CompanionDemand, ProjectTypeShare, CospecPairing, ColorPairing, PairingOrderMode, PairingRanking, PairingOrdering, PairingItem, PairingsResponse, AttributeMatch, AttributeListItem, OutsideScopeAttribute, ListAttributesResult, WhoamiResponse, PairingsOptions, ListAttributesOptions, ExtractedPalette, ExtractPaletteResponse, ExtractPaletteInput, ResolveValueCandidate, ValueResolution, ResolveColorOptions, ResolveColorCatalogVariant, ResolveColorVariant, ResolveColorResponse, BySpecVerdictState, BySpecVerdictCell, BySpecVerdict, MaterialVerdict, BySpecUnresolvedCriterion, } from "./types.js";
|
|
22
22
|
export type { ResolveVariantInput, ResolveVariantSubject, ResolveVariantEvidence, ResolveVariantReceipt, ResolveVariantUnresolvedReason, ResolveVariantOutput, } from "./resolve-variant-types.js";
|
|
23
|
-
export type { CatalogReference, CatalogReferenceAbsenceReason, CatalogReferencePublication, CatalogReferenceResult, CatalogReferenceBatchResponse, CatalogDocumentAccess, CatalogDocumentAccessResult, CatalogDocument, CatalogEdition, CatalogAvailableReceipt, CatalogFailureReceipt, UnavailableCatalogDocument, CatalogPublication, CatalogDocumentList, CatalogProductReferenceList, CatalogProductReferenceUnavailable, CatalogProductReferenceReadResult, CatalogPageRequiredArtifact, CatalogPageAvailableArtifact, CatalogPage, CatalogPageListResult, CatalogPageRepresentationReadResult, } from "./catalog-types.js";
|
|
24
23
|
export { CategoriesClient } from "./categories-client.js";
|
|
25
24
|
export type { CategoryRef, CategoryKind, CategoryMatch, CategoryItem, CategoriesPageInfo, CategoriesListInput, CategoriesListResult, CategoryConcept, CategoryProductCategory, CategoriesGetResult, } from "./category-types.js";
|
|
26
25
|
export { ColorsClient } from "./colors-client.js";
|
package/operation-responses.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** Response types belong to operation ids, never a caller-selected generic. */
|
|
2
2
|
import type { ApplicabilityResponse, DeclaredAssociationsResponse } from "./association-types.js";
|
|
3
3
|
import type { ListBrandsPage } from "./brand-types.js";
|
|
4
|
-
import type { CatalogDocumentList, CatalogPageListResult, CatalogProductReferenceReadResult, CatalogDocumentAccessResult, CatalogPageRepresentationReadResult, CatalogReferenceBatchResponse } from "./catalog-types.js";
|
|
5
4
|
import type { CategoriesGetResult, CategoriesListResult } from "./category-types.js";
|
|
6
5
|
import type { CategoryColorProfilesResponse } from "./color-profiles-types.js";
|
|
7
6
|
import type { DiscoveryReference, DiscoveryTerms, ColorlessVariantsResult, VariantSibling } from "./discovery-context-types.js";
|
|
@@ -38,9 +37,6 @@ export type OperationResponses = {
|
|
|
38
37
|
find_variants_by_color: FindVariantsByColorOutput;
|
|
39
38
|
find_variants_by_vector: FindVariantsByVectorOutput;
|
|
40
39
|
get_applicability: ApplicabilityResponse;
|
|
41
|
-
get_catalog_page_representation: CatalogPageRepresentationReadResult;
|
|
42
|
-
get_catalog_document_access: CatalogDocumentAccessResult;
|
|
43
|
-
get_catalog_references_batch: CatalogReferenceBatchResponse;
|
|
44
40
|
get_category: CategoriesGetResult;
|
|
45
41
|
get_category_color_profiles: CategoryColorProfilesResponse;
|
|
46
42
|
get_material_pairings: PairingsResponse;
|
|
@@ -48,9 +44,6 @@ export type OperationResponses = {
|
|
|
48
44
|
list_associated_finishes: DeclaredAssociationsResponse;
|
|
49
45
|
list_associated_products: DeclaredAssociationsResponse;
|
|
50
46
|
list_brands: ListBrandsPage;
|
|
51
|
-
list_catalog_documents: CatalogDocumentList;
|
|
52
|
-
list_catalog_pages: CatalogPageListResult;
|
|
53
|
-
list_catalog_product_references: CatalogProductReferenceReadResult;
|
|
54
47
|
list_categories: CategoriesListResult;
|
|
55
48
|
list_material_blocks: MaterialBlockProjection;
|
|
56
49
|
list_material_documents: MaterialDocumentPage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const MATERIALGRAPH_API_VERSION = "0.8.0";
|
|
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 ["
|
|
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 ["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"]];
|
|
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];
|
package/operations.generated.js
CHANGED
|
@@ -37,37 +37,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
37
37
|
"/api/v1/catalog/generation",
|
|
38
38
|
"get_catalog_generation",
|
|
39
39
|
],
|
|
40
|
-
["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"],
|
|
41
|
-
[
|
|
42
|
-
"catalogPages",
|
|
43
|
-
"GET",
|
|
44
|
-
"/api/v1/catalogs/{catalogId}/pages",
|
|
45
|
-
"list_catalog_pages",
|
|
46
|
-
],
|
|
47
|
-
[
|
|
48
|
-
"catalogPageRepresentation",
|
|
49
|
-
"GET",
|
|
50
|
-
"/api/v1/catalog-pages/{pageId}/representation",
|
|
51
|
-
"get_catalog_page_representation",
|
|
52
|
-
],
|
|
53
|
-
[
|
|
54
|
-
"catalogReferences",
|
|
55
|
-
"GET",
|
|
56
|
-
"/api/v1/catalogs/{catalogId}/references",
|
|
57
|
-
"list_catalog_product_references",
|
|
58
|
-
],
|
|
59
|
-
[
|
|
60
|
-
"catalogReferencesForVariants",
|
|
61
|
-
"POST",
|
|
62
|
-
"/api/v1/catalogs/references",
|
|
63
|
-
"get_catalog_references_batch",
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
"catalogDocumentAccess",
|
|
67
|
-
"GET",
|
|
68
|
-
"/api/v1/catalogs/documents/{documentId}",
|
|
69
|
-
"get_catalog_document_access",
|
|
70
|
-
],
|
|
71
40
|
[
|
|
72
41
|
"materialBlocks",
|
|
73
42
|
"GET",
|
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.8.0";
|
|
3
3
|
/** Every SDK operation whose success response has a published JSON Schema. */
|
|
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", "
|
|
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_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"];
|
|
5
5
|
export declare const RESPONSE_SCHEMA_CATALOG_JSON: string;
|