@instruments/materialgraph 0.46.0 → 1.0.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 +2 -2
- package/brand-types.d.ts +3 -3
- package/brands-client.d.ts +3 -3
- package/brands-client.js +3 -3
- package/{catalogue-client.d.ts → catalog-client.d.ts} +13 -13
- package/{catalogue-client.js → catalog-client.js} +13 -13
- package/{catalogue-types.d.ts → catalog-types.d.ts} +42 -42
- package/client-response-schema.js +1 -1
- package/client-vocabulary.js +1 -1
- package/client.d.ts +13 -12
- package/client.js +16 -14
- package/color-profiles-types.d.ts +1 -1
- package/colors-client.d.ts +6 -6
- package/colors-client.js +3 -3
- package/find-sampled-together-types.d.ts +2 -2
- package/find-variants-by-color-types.d.ts +6 -6
- package/find-variants-by-vector-types.d.ts +5 -5
- package/get-variant-types.d.ts +26 -0
- package/identifiers.d.ts +1 -1
- package/image-reference-types.d.ts +2 -2
- package/index.d.ts +4 -4
- package/list-variant-facets-types.d.ts +2 -2
- package/list-variants-types.d.ts +5 -5
- package/material-asset-types.d.ts +1 -1
- package/operation-responses.d.ts +8 -8
- package/operations.generated.d.ts +1 -1
- package/operations.generated.js +14 -14
- package/package.json +1 -1
- package/resolve-color-types.d.ts +13 -13
- package/resolve-variant-types.d.ts +1 -1
- package/response-schemas.generated.d.ts +2 -2
- package/response-schemas.generated.js +43 -42
- package/response-schemas.js +20 -20
- package/runs.js +1 -1
- package/{samplize-catalogue-types.d.ts → samplize-catalog-types.d.ts} +5 -5
- package/samplize-colorvec.d.ts +1 -1
- package/samplize-colorvec.js +2 -2
- package/{search-catalogue-subset-types.d.ts → search-catalog-subset-types.d.ts} +5 -5
- package/search-variants-types.d.ts +4 -4
- package/types.d.ts +6 -6
- package/webmcp.generated.js +4 -4
- /package/{catalogue-types.js → catalog-types.js} +0 -0
- /package/{samplize-catalogue-types.js → samplize-catalog-types.js} +0 -0
- /package/{search-catalogue-subset-types.js → search-catalog-subset-types.js} +0 -0
package/association-types.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { ProductTypeReceipt } from "./material-types.js";
|
|
|
12
12
|
* with {@link PairingItem}, so the two can never be concatenated into one list.
|
|
13
13
|
* Present them as separate sections, and never describe a pairing as available.
|
|
14
14
|
*/
|
|
15
|
-
import type {
|
|
15
|
+
import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
|
|
16
16
|
/**
|
|
17
17
|
* Why an association is believed.
|
|
18
18
|
*
|
|
@@ -102,7 +102,7 @@ export type AssociatedOptions = {
|
|
|
102
102
|
* carrying a Material Bank id; absent or `all` is the whole declared set.
|
|
103
103
|
* Membership does not establish sampleability; use `sampleableOnly` for that.
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
searchCatalogSubset?: SearchCatalogSubset;
|
|
106
106
|
/** Return only associations whose effective sampleability is true. */
|
|
107
107
|
sampleableOnly?: boolean;
|
|
108
108
|
/**
|
package/brand-types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (`GET /api/v1/brands`), the same page and the same input the MCP
|
|
4
4
|
* `list_brands` tool and the `mg brand list` command take.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
|
|
7
7
|
export type BrandsOptions = {
|
|
8
8
|
/**
|
|
9
9
|
* A brand name, alias or misspelling, e.g. `"Kvadrat"`. Omit to browse the
|
|
@@ -21,10 +21,10 @@ export type BrandsOptions = {
|
|
|
21
21
|
* per-variant test `listVariants()` applies. Absent or `"all"` is every brand
|
|
22
22
|
* that carries materials.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
searchCatalogSubset?: SearchCatalogSubset;
|
|
25
25
|
/** Page size, 1 to 50. Never a bound on the list. */
|
|
26
26
|
limit?: number;
|
|
27
|
-
/** The previous page's `pageInfo.endCursor`, with the same `query`, `categoryId` and `
|
|
27
|
+
/** The previous page's `pageInfo.endCursor`, with the same `query`, `categoryId` and `searchCatalogSubset`. */
|
|
28
28
|
cursor?: string;
|
|
29
29
|
};
|
|
30
30
|
export type BrandItem = {
|
package/brands-client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* {@link HttpTransport}. `MaterialGraphClient.brands` delegates here; the
|
|
4
4
|
* contract lives in this file.
|
|
5
5
|
*
|
|
6
|
-
* A brand is a COMPANY, not a
|
|
6
|
+
* A brand is a COMPANY, not a catalog. The list says which brands have
|
|
7
7
|
* eligible materials in the scope asked for, and nothing about how many
|
|
8
8
|
* products a brand sells.
|
|
9
9
|
*/
|
|
@@ -18,11 +18,11 @@ import type { HttpTransport } from "./http-transport.js";
|
|
|
18
18
|
* name) as the `brand` filter value:
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
|
-
* const { items } = await mg.brands({ query: "Autex",
|
|
21
|
+
* const { items } = await mg.brands({ query: "Autex", searchCatalogSubset: "materialBankNaOrderable" });
|
|
22
22
|
* const brand = items.find((b) => b.brandId === "autex-acoustics");
|
|
23
23
|
* if (!brand) throw new Error("autex-acoustics is not on this page");
|
|
24
24
|
* const page = await mg.listVariants({
|
|
25
|
-
*
|
|
25
|
+
* searchCatalogSubset: "materialBankNaOrderable",
|
|
26
26
|
* filters: { terms: [{ field: "brand", op: "in", values: [brand.brandId] }] },
|
|
27
27
|
* limit: 3,
|
|
28
28
|
* });
|
package/brands-client.js
CHANGED
|
@@ -8,11 +8,11 @@ import { resolveOperation } from "./operations.js";
|
|
|
8
8
|
* name) as the `brand` filter value:
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
* const { items } = await mg.brands({ query: "Autex",
|
|
11
|
+
* const { items } = await mg.brands({ query: "Autex", searchCatalogSubset: "materialBankNaOrderable" });
|
|
12
12
|
* const brand = items.find((b) => b.brandId === "autex-acoustics");
|
|
13
13
|
* if (!brand) throw new Error("autex-acoustics is not on this page");
|
|
14
14
|
* const page = await mg.listVariants({
|
|
15
|
-
*
|
|
15
|
+
* searchCatalogSubset: "materialBankNaOrderable",
|
|
16
16
|
* filters: { terms: [{ field: "brand", op: "in", values: [brand.brandId] }] },
|
|
17
17
|
* limit: 3,
|
|
18
18
|
* });
|
|
@@ -23,7 +23,7 @@ export const listBrands = async (transport, options = {}, signal) => await trans
|
|
|
23
23
|
cursor: options.cursor,
|
|
24
24
|
limit: options.limit,
|
|
25
25
|
query: options.query,
|
|
26
|
-
|
|
26
|
+
searchCatalogSubset: options.searchCatalogSubset,
|
|
27
27
|
},
|
|
28
28
|
signal,
|
|
29
29
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { CatalogDocumentList, CatalogPageListResult, CatalogProductReferenceReadResult,
|
|
1
|
+
import type { CatalogDocumentList, CatalogPageListResult, CatalogProductReferenceReadResult, CatalogChannelCollectionsResponse, CatalogCollectionsOptions, CatalogDocumentAccessResult, CatalogPageRepresentationReadResult, CatalogReferenceBatchResponse } from "./catalog-types.js";
|
|
2
2
|
import type { HttpTransport } from "./http-transport.js";
|
|
3
3
|
import type { VariantId } from "./identifiers.js";
|
|
4
4
|
import type { ResolveVariantInput, ResolveVariantOutput } from "./resolve-variant-types.js";
|
|
5
|
-
import type {
|
|
6
|
-
/**
|
|
7
|
-
export declare class
|
|
5
|
+
import type { SamplizeCatalogOptions, SamplizeCatalogPage } from "./samplize-catalog-types.js";
|
|
6
|
+
/** Catalog publication operations inherited by the public SDK client. */
|
|
7
|
+
export declare class CatalogClient {
|
|
8
8
|
#private;
|
|
9
9
|
protected constructor(transport: HttpTransport);
|
|
10
10
|
/**
|
|
11
11
|
* THE QUESTION: "what does this brand page or code resolve to in the
|
|
12
12
|
* graph?" Give `input.url` alone, or `input.code` with `input.brandId` (from
|
|
13
|
-
* {@link
|
|
13
|
+
* {@link CatalogClient.brands} - inherited by {@link MaterialGraphClient})
|
|
14
14
|
* when there is no page to read.
|
|
15
15
|
*
|
|
16
16
|
* Exact and scoreless: a sibling colorway, a similar image or a brand match
|
|
@@ -21,17 +21,17 @@ export declare class CatalogueClient {
|
|
|
21
21
|
*/
|
|
22
22
|
resolveVariant(input: ResolveVariantInput, signal?: AbortSignal): Promise<ResolveVariantOutput>;
|
|
23
23
|
/** Complete version-pinned Samplize paint corpus; stock never limits eligibility. */
|
|
24
|
-
|
|
24
|
+
samplizeCatalog(options?: SamplizeCatalogOptions, signal?: AbortSignal): Promise<SamplizeCatalogPage>;
|
|
25
25
|
/**
|
|
26
26
|
* Read exact, verified brand-publication page relationships for variants.
|
|
27
27
|
* Missing evidence stays explicit; this operation never guesses a page from
|
|
28
28
|
* a generic PDF.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
catalogReferencesForVariants(input: {
|
|
31
31
|
variantIds: VariantId[];
|
|
32
|
-
}, signal?: AbortSignal): Promise<
|
|
33
|
-
/** List product collections with governed
|
|
34
|
-
|
|
32
|
+
}, signal?: AbortSignal): Promise<CatalogReferenceBatchResponse>;
|
|
33
|
+
/** List product collections with governed catalog-channel membership. */
|
|
34
|
+
catalogCollections(options?: CatalogCollectionsOptions, signal?: AbortSignal): Promise<CatalogChannelCollectionsResponse>;
|
|
35
35
|
/** List immutable catalog documents retained from verified source material. */
|
|
36
36
|
catalogs(signal?: AbortSignal): Promise<CatalogDocumentList>;
|
|
37
37
|
/** List stable one-based page identities and their representation status. */
|
|
@@ -40,9 +40,9 @@ export declare class CatalogueClient {
|
|
|
40
40
|
offset?: number;
|
|
41
41
|
}, signal?: AbortSignal): Promise<CatalogPageListResult>;
|
|
42
42
|
/** Read a retained page representation or its exact missing-artifact receipt. */
|
|
43
|
-
catalogPageRepresentation(pageId: string, signal?: AbortSignal): Promise<
|
|
43
|
+
catalogPageRepresentation(pageId: string, signal?: AbortSignal): Promise<CatalogPageRepresentationReadResult>;
|
|
44
44
|
/** Read every verified product/page reference for one retained catalog. */
|
|
45
45
|
catalogReferences(catalogId: string, signal?: AbortSignal): Promise<CatalogProductReferenceReadResult>;
|
|
46
|
-
/** Resolve browser-safe access to one immutable
|
|
47
|
-
|
|
46
|
+
/** Resolve browser-safe access to one immutable catalog document. */
|
|
47
|
+
catalogDocumentAccess(documentId: string, signal?: AbortSignal): Promise<CatalogDocumentAccessResult>;
|
|
48
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveOperation } from "./operations.js";
|
|
2
|
-
/**
|
|
3
|
-
export class
|
|
2
|
+
/** Catalog publication operations inherited by the public SDK client. */
|
|
3
|
+
export class CatalogClient {
|
|
4
4
|
#transport;
|
|
5
5
|
constructor(transport) {
|
|
6
6
|
this.#transport = transport;
|
|
@@ -8,7 +8,7 @@ export class CatalogueClient {
|
|
|
8
8
|
/**
|
|
9
9
|
* THE QUESTION: "what does this brand page or code resolve to in the
|
|
10
10
|
* graph?" Give `input.url` alone, or `input.code` with `input.brandId` (from
|
|
11
|
-
* {@link
|
|
11
|
+
* {@link CatalogClient.brands} - inherited by {@link MaterialGraphClient})
|
|
12
12
|
* when there is no page to read.
|
|
13
13
|
*
|
|
14
14
|
* Exact and scoreless: a sibling colorway, a similar image or a brand match
|
|
@@ -21,20 +21,20 @@ export class CatalogueClient {
|
|
|
21
21
|
return await this.#transport.requestJson(resolveOperation("resolve_variant"), { body: input, signal });
|
|
22
22
|
}
|
|
23
23
|
/** Complete version-pinned Samplize paint corpus; stock never limits eligibility. */
|
|
24
|
-
async
|
|
25
|
-
return await this.#transport.requestJson(resolveOperation("
|
|
24
|
+
async samplizeCatalog(options = {}, signal) {
|
|
25
|
+
return await this.#transport.requestJson(resolveOperation("samplize_catalog_products"), { query: { ...options }, signal });
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Read exact, verified brand-publication page relationships for variants.
|
|
29
29
|
* Missing evidence stays explicit; this operation never guesses a page from
|
|
30
30
|
* a generic PDF.
|
|
31
31
|
*/
|
|
32
|
-
async
|
|
33
|
-
return await this.#transport.requestJson(resolveOperation("
|
|
32
|
+
async catalogReferencesForVariants(input, signal) {
|
|
33
|
+
return await this.#transport.requestJson(resolveOperation("get_catalog_references_batch"), { body: input, signal });
|
|
34
34
|
}
|
|
35
|
-
/** List product collections with governed
|
|
36
|
-
async
|
|
37
|
-
return await this.#transport.requestJson(resolveOperation("
|
|
35
|
+
/** List product collections with governed catalog-channel membership. */
|
|
36
|
+
async catalogCollections(options = {}, signal) {
|
|
37
|
+
return await this.#transport.requestJson(resolveOperation("list_catalog_channel_collections"), {
|
|
38
38
|
query: {
|
|
39
39
|
limit: options.limit,
|
|
40
40
|
offset: options.offset,
|
|
@@ -59,8 +59,8 @@ export class CatalogueClient {
|
|
|
59
59
|
async catalogReferences(catalogId, signal) {
|
|
60
60
|
return await this.#transport.requestJson(resolveOperation("list_catalog_product_references"), { pathParams: { catalogId }, signal });
|
|
61
61
|
}
|
|
62
|
-
/** Resolve browser-safe access to one immutable
|
|
63
|
-
async
|
|
64
|
-
return await this.#transport.requestJson(resolveOperation("
|
|
62
|
+
/** Resolve browser-safe access to one immutable catalog document. */
|
|
63
|
+
async catalogDocumentAccess(documentId, signal) {
|
|
64
|
+
return await this.#transport.requestJson(resolveOperation("get_catalog_document_access"), { pathParams: { documentId }, signal });
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** A verified product location in a specific immutable brand publication. */
|
|
2
|
-
export type
|
|
2
|
+
export type CatalogReference = {
|
|
3
3
|
anchor: {
|
|
4
4
|
coordinateSpace: "normalized_0_1000";
|
|
5
5
|
/** Page carrying the printed code; defaults to page.documentPage. Do not draw it on another page. */
|
|
@@ -33,7 +33,7 @@ export type CatalogueReference = {
|
|
|
33
33
|
id: string;
|
|
34
34
|
name: string;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
catalog: {
|
|
37
37
|
id: string;
|
|
38
38
|
title: string;
|
|
39
39
|
};
|
|
@@ -62,7 +62,7 @@ export type CatalogueReference = {
|
|
|
62
62
|
* product is missing from the printed book; nobody records how many of a
|
|
63
63
|
* brand's products a publication contains.
|
|
64
64
|
*/
|
|
65
|
-
export type
|
|
65
|
+
export type CatalogReferenceAbsenceReason =
|
|
66
66
|
/**
|
|
67
67
|
* The registry retains no publication for the variant's brand. It says
|
|
68
68
|
* nothing about whether the brand publishes one.
|
|
@@ -75,12 +75,12 @@ export type CatalogueReferenceAbsenceReason =
|
|
|
75
75
|
/** Pages were reviewed and this product is not among the references yet. */
|
|
76
76
|
| "product_not_yet_referenced";
|
|
77
77
|
/** The brand publication a `no_verified_reference` result was judged against. */
|
|
78
|
-
export type
|
|
78
|
+
export type CatalogReferencePublication = {
|
|
79
79
|
brand: {
|
|
80
80
|
id: string;
|
|
81
81
|
name: string;
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
catalog: {
|
|
84
84
|
id: string;
|
|
85
85
|
title: string;
|
|
86
86
|
};
|
|
@@ -94,16 +94,16 @@ export type CatalogueReferencePublication = {
|
|
|
94
94
|
/** Reviewed references the publication holds; present only when its pages were reviewed. */
|
|
95
95
|
referencedProductCount?: number;
|
|
96
96
|
};
|
|
97
|
-
export type
|
|
97
|
+
export type CatalogReferenceResult = {
|
|
98
98
|
variantId: string;
|
|
99
99
|
status: "verified";
|
|
100
|
-
reference:
|
|
100
|
+
reference: CatalogReference;
|
|
101
101
|
} | {
|
|
102
102
|
variantId: string;
|
|
103
103
|
status: "no_verified_reference";
|
|
104
|
-
reason:
|
|
104
|
+
reason: CatalogReferenceAbsenceReason;
|
|
105
105
|
/** Absent only when `reason` is `no_publication_on_record`. */
|
|
106
|
-
publication?:
|
|
106
|
+
publication?: CatalogReferencePublication;
|
|
107
107
|
} | {
|
|
108
108
|
variantId: string;
|
|
109
109
|
status: "unresolved_variant";
|
|
@@ -114,8 +114,8 @@ export type CatalogueReferenceResult = {
|
|
|
114
114
|
variantId: string;
|
|
115
115
|
status: "upstream_failure";
|
|
116
116
|
};
|
|
117
|
-
export type
|
|
118
|
-
results:
|
|
117
|
+
export type CatalogReferenceBatchResponse = {
|
|
118
|
+
results: CatalogReferenceResult[];
|
|
119
119
|
coverage: {
|
|
120
120
|
requested: number;
|
|
121
121
|
verified: number;
|
|
@@ -125,14 +125,14 @@ export type CatalogueReferenceBatchResponse = {
|
|
|
125
125
|
upstreamFailure: number;
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
|
-
/** Bounds for the flat
|
|
129
|
-
export type
|
|
128
|
+
/** Bounds for the flat catalog-channel collection shelf. */
|
|
129
|
+
export type CatalogCollectionsOptions = {
|
|
130
130
|
limit?: number;
|
|
131
131
|
offset?: number;
|
|
132
132
|
sampleLimit?: number;
|
|
133
133
|
};
|
|
134
|
-
/** One representative product image carried by a
|
|
135
|
-
export type
|
|
134
|
+
/** One representative product image carried by a catalog collection. */
|
|
135
|
+
export type CatalogCollectionSampleProduct = {
|
|
136
136
|
imageUrl: string | null;
|
|
137
137
|
hex?: string | null;
|
|
138
138
|
productId: string;
|
|
@@ -140,21 +140,21 @@ export type CatalogueCollectionSampleProduct = {
|
|
|
140
140
|
variantId: string;
|
|
141
141
|
variantName: string | null;
|
|
142
142
|
};
|
|
143
|
-
/** A product collection whose variants have governed
|
|
144
|
-
export type
|
|
143
|
+
/** A product collection whose variants have governed catalog membership. */
|
|
144
|
+
export type CatalogChannelCollection = {
|
|
145
145
|
id: string;
|
|
146
146
|
slug: string;
|
|
147
147
|
name: string;
|
|
148
148
|
homepageUrl: string | null;
|
|
149
149
|
productCount: number;
|
|
150
150
|
variantCount: number;
|
|
151
|
-
sampleProducts:
|
|
151
|
+
sampleProducts: CatalogCollectionSampleProduct[];
|
|
152
152
|
};
|
|
153
|
-
/** The flat, paginated
|
|
154
|
-
export type
|
|
155
|
-
collections:
|
|
153
|
+
/** The flat, paginated catalog-channel collection read model. */
|
|
154
|
+
export type CatalogChannelCollectionsResponse = {
|
|
155
|
+
collections: CatalogChannelCollection[];
|
|
156
156
|
channel: {
|
|
157
|
-
token: "
|
|
157
|
+
token: "catalog";
|
|
158
158
|
basis: "governed_variant_membership";
|
|
159
159
|
};
|
|
160
160
|
counts: {
|
|
@@ -168,17 +168,17 @@ export type CatalogueChannelCollectionsResponse = {
|
|
|
168
168
|
hasMore: boolean;
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
|
-
export type
|
|
171
|
+
export type CatalogDocumentAccess = {
|
|
172
172
|
documentId: string;
|
|
173
173
|
contentType: "application/pdf";
|
|
174
174
|
readerUrl: string;
|
|
175
175
|
originalUrl: string;
|
|
176
176
|
byteRanges: "supported" | "unknown";
|
|
177
177
|
};
|
|
178
|
-
export type
|
|
178
|
+
export type CatalogDocumentAccessResult = {
|
|
179
179
|
documentId: string;
|
|
180
180
|
status: "available";
|
|
181
|
-
access:
|
|
181
|
+
access: CatalogDocumentAccess;
|
|
182
182
|
} | {
|
|
183
183
|
documentId: string;
|
|
184
184
|
status: "unresolved_document";
|
|
@@ -296,7 +296,7 @@ export type CatalogProductReferenceList = {
|
|
|
296
296
|
};
|
|
297
297
|
pagesWithReferences: number;
|
|
298
298
|
precision: {
|
|
299
|
-
reason: "
|
|
299
|
+
reason: "labeled_denominator_not_recorded";
|
|
300
300
|
status: "not_measured";
|
|
301
301
|
};
|
|
302
302
|
productCoverage: {
|
|
@@ -309,7 +309,7 @@ export type CatalogProductReferenceList = {
|
|
|
309
309
|
status: "not_measured";
|
|
310
310
|
};
|
|
311
311
|
};
|
|
312
|
-
references:
|
|
312
|
+
references: CatalogReference[];
|
|
313
313
|
source: "verified-source-material-registry";
|
|
314
314
|
status: "available";
|
|
315
315
|
};
|
|
@@ -319,17 +319,17 @@ export type CatalogProductReferenceUnavailable = {
|
|
|
319
319
|
status: "source_unavailable";
|
|
320
320
|
};
|
|
321
321
|
export type CatalogProductReferenceReadResult = CatalogProductReferenceList | CatalogProductReferenceUnavailable;
|
|
322
|
-
export type
|
|
322
|
+
export type CatalogPageRequiredArtifact = {
|
|
323
323
|
mediaType: "image/webp";
|
|
324
|
-
version: "
|
|
324
|
+
version: "catalog-page-webp-v1";
|
|
325
325
|
};
|
|
326
|
-
export type
|
|
326
|
+
export type CatalogPageAvailableArtifact = {
|
|
327
327
|
bucket: "materialgraph";
|
|
328
328
|
key: string;
|
|
329
329
|
url: string;
|
|
330
|
-
mediaType:
|
|
330
|
+
mediaType: CatalogPageRequiredArtifact["mediaType"];
|
|
331
331
|
};
|
|
332
|
-
export type
|
|
332
|
+
export type CatalogPage = {
|
|
333
333
|
catalogId: string;
|
|
334
334
|
documentId: string;
|
|
335
335
|
editionId: string;
|
|
@@ -343,7 +343,7 @@ export type CataloguePage = {
|
|
|
343
343
|
printedPageLabel?: string;
|
|
344
344
|
};
|
|
345
345
|
representation: {
|
|
346
|
-
artifact:
|
|
346
|
+
artifact: CatalogPageAvailableArtifact;
|
|
347
347
|
status: "available";
|
|
348
348
|
};
|
|
349
349
|
} | {
|
|
@@ -360,24 +360,24 @@ export type CataloguePage = {
|
|
|
360
360
|
printedPageLabel?: string;
|
|
361
361
|
};
|
|
362
362
|
representation: {
|
|
363
|
-
requiredArtifact:
|
|
363
|
+
requiredArtifact: CatalogPageRequiredArtifact;
|
|
364
364
|
reason: "retained_representation_not_found";
|
|
365
365
|
status: "unavailable";
|
|
366
366
|
};
|
|
367
367
|
};
|
|
368
|
-
type
|
|
368
|
+
type CatalogPageAvailable = Extract<CatalogPage, {
|
|
369
369
|
representation: {
|
|
370
370
|
status: "available";
|
|
371
371
|
};
|
|
372
372
|
}>;
|
|
373
|
-
type
|
|
373
|
+
type CatalogPageUnavailable = Extract<CatalogPage, {
|
|
374
374
|
representation: {
|
|
375
375
|
status: "unavailable";
|
|
376
376
|
};
|
|
377
377
|
}>;
|
|
378
378
|
export type CatalogPageListResult = {
|
|
379
379
|
catalog: CatalogDocument;
|
|
380
|
-
pages:
|
|
380
|
+
pages: CatalogPage[];
|
|
381
381
|
pagination: {
|
|
382
382
|
count: number;
|
|
383
383
|
hasMore: boolean;
|
|
@@ -400,13 +400,13 @@ export type CatalogPageListResult = {
|
|
|
400
400
|
reason: "retained_source_not_found";
|
|
401
401
|
status: "source_unavailable";
|
|
402
402
|
};
|
|
403
|
-
export type
|
|
404
|
-
artifact:
|
|
405
|
-
page:
|
|
403
|
+
export type CatalogPageRepresentationReadResult = {
|
|
404
|
+
artifact: CatalogPageAvailableArtifact;
|
|
405
|
+
page: CatalogPageAvailable;
|
|
406
406
|
status: "available";
|
|
407
407
|
} | {
|
|
408
|
-
requiredArtifact:
|
|
409
|
-
page:
|
|
408
|
+
requiredArtifact: CatalogPageRequiredArtifact;
|
|
409
|
+
page: CatalogPageUnavailable;
|
|
410
410
|
reason: "retained_representation_not_found";
|
|
411
411
|
status: "unavailable";
|
|
412
412
|
} | {
|
|
@@ -3,7 +3,7 @@ const isRecord = (value) => typeof value === "object" && value !== null && !Arra
|
|
|
3
3
|
// discriminants stay closed so their associated object shapes remain true.
|
|
4
4
|
const openStrings = new Set([
|
|
5
5
|
"CategoryColorProfilesResponse.profiles.level",
|
|
6
|
-
"FindVariantsByColorResponse.
|
|
6
|
+
"FindVariantsByColorResponse.searchCatalogSubset.scope",
|
|
7
7
|
"GetCategoryResponse.kind",
|
|
8
8
|
"ListAttributesResponse.items.match.method",
|
|
9
9
|
"ListCategoriesResponse.items.match.method",
|
package/client-vocabulary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveOperation } from "./operations.js";
|
|
2
2
|
export const resolveColor = async (transport, name, signal, options) => await transport.requestJson(resolveOperation("resolve_color_name"), {
|
|
3
|
-
query: {
|
|
3
|
+
query: { searchCatalogSubset: options?.searchCatalogSubset, name },
|
|
4
4
|
signal,
|
|
5
5
|
});
|
|
6
6
|
/**
|
package/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApplicabilityOptions, AssociatedOptions } from "./association-types.js";
|
|
2
2
|
import type { BrandsOptions } from "./brand-types.js";
|
|
3
|
-
import {
|
|
3
|
+
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";
|
|
@@ -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 extends
|
|
59
|
+
export declare class MaterialGraphClient extends CatalogClient {
|
|
60
60
|
#private;
|
|
61
61
|
readonly baseUrl: string;
|
|
62
62
|
/**
|
|
@@ -76,7 +76,7 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
76
76
|
/**
|
|
77
77
|
* THE QUESTION: "what colors does this category come in?" (`profiles`).
|
|
78
78
|
* `profiles` is an aggregate over a category, not a list of materials, and
|
|
79
|
-
*
|
|
79
|
+
* is counted live at request time.
|
|
80
80
|
*
|
|
81
81
|
* Instead use {@link MaterialGraphClient.findVariantsByColor} (`mode:
|
|
82
82
|
* "palette"`) for the materials near one or several colors and
|
|
@@ -97,8 +97,8 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
97
97
|
readonly workflows: WorkflowsClient;
|
|
98
98
|
constructor(options: MaterialGraphClientOptions);
|
|
99
99
|
get lastRateLimit(): RateLimit | null;
|
|
100
|
-
/** Current
|
|
101
|
-
|
|
100
|
+
/** Current catalog generation; authenticated, no SQL and no rate-limit charge. */
|
|
101
|
+
getCatalogGeneration(signal?: AbortSignal): Promise<{
|
|
102
102
|
generation: number;
|
|
103
103
|
}>;
|
|
104
104
|
/**
|
|
@@ -159,10 +159,10 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
159
159
|
* condition across all four ANDed, 20 at most), or a category/brand listing. An explicit
|
|
160
160
|
* `variant in` id that does not resolve to an eligible variant is
|
|
161
161
|
* reported in `unresolvedVariantIds` when it names no variant, in
|
|
162
|
-
* `unavailableVariantIds` when it names a
|
|
162
|
+
* `unavailableVariantIds` when it names a catalog variant this list
|
|
163
163
|
* cannot show in the requested scope (a retired one, for example), or in
|
|
164
|
-
* `
|
|
165
|
-
* materials
|
|
164
|
+
* `excludedBySearchCatalogSubset` when it names a real variant outside the
|
|
165
|
+
* materials catalog, never silently dropped from the page.
|
|
166
166
|
*
|
|
167
167
|
* `filters`/`optionalFilters`/`orderBy`/`colors` are sent as URL-encoded
|
|
168
168
|
* JSON; `attributes`/`include`/`words` as comma-separated lists — the server
|
|
@@ -190,7 +190,7 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
190
190
|
* answered with one and listed in `choices`; send its `handle` with an
|
|
191
191
|
* alternative's `group` and `id` in `selections` to switch it, or its
|
|
192
192
|
* `text` in `leaveOut` to drop the condition. A query that
|
|
193
|
-
* applies nothing returns no items, never the whole
|
|
193
|
+
* applies nothing returns no items, never the whole catalog; a preference
|
|
194
194
|
* alone still ranks it.
|
|
195
195
|
*/
|
|
196
196
|
searchVariants(input: SearchVariantsInput, signal?: AbortSignal): Promise<SearchVariantsOutput>;
|
|
@@ -221,11 +221,12 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
221
221
|
* an image reference, or both fused into one embedding. `filters` is the
|
|
222
222
|
* same tree {@link MaterialGraphClient.listVariants} takes, less its `orText`
|
|
223
223
|
* and `unstated` additions. `query.mode`
|
|
224
|
-
* values other than `"text"` embed through Voyage and spend the
|
|
225
|
-
*
|
|
224
|
+
* values other than `"text"` embed through Voyage and spend the key's own
|
|
225
|
+
* `embed` rate limit, 10 a minute by default. An upload is embedded once and
|
|
226
|
+
* its vector kept, so a repeat image-only query on it spends nothing.
|
|
226
227
|
*/
|
|
227
228
|
findVariantsByVector(input: FindVariantsByVectorInput, signal?: AbortSignal): Promise<FindVariantsByVectorOutput>;
|
|
228
|
-
/** Resolve a color name to its hex, and the named paint's
|
|
229
|
+
/** Resolve a color name to its hex, and the named paint's catalog variant. */
|
|
229
230
|
resolveColor(name: string, signal?: AbortSignal, options?: ResolveColorOptions): Promise<ResolveColorResponse>;
|
|
230
231
|
/**
|
|
231
232
|
* THE QUESTION: "which attribute means this phrase?" or "what could a
|
package/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { applicability, declaredFinishes, declaredProducts, } from "./associations-client.js";
|
|
2
2
|
import { listBrands } from "./brands-client.js";
|
|
3
|
-
import {
|
|
3
|
+
import { CatalogClient } from "./catalog-client.js";
|
|
4
4
|
import { CategoriesClient } from "./categories-client.js";
|
|
5
5
|
import { DEFAULT_BASE_URL } from "./client-config.js";
|
|
6
6
|
import { listAttributes as listAttributesCall, listEnumValues as listEnumValuesCall, resolveColor as resolveColorCall, } from "./client-vocabulary.js";
|
|
@@ -50,7 +50,7 @@ export { DEFAULT_BASE_URL } from "./client-config.js";
|
|
|
50
50
|
* And three reading rules that apply to every lens: ids are opaque (see
|
|
51
51
|
* `./identifiers.ts`), absent is not false, and a page is not a corpus.
|
|
52
52
|
*/
|
|
53
|
-
export class MaterialGraphClient extends
|
|
53
|
+
export class MaterialGraphClient extends CatalogClient {
|
|
54
54
|
baseUrl;
|
|
55
55
|
/**
|
|
56
56
|
* THE QUESTION: "what kinds of thing exist, and what are their keys?"
|
|
@@ -69,7 +69,7 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
69
69
|
/**
|
|
70
70
|
* THE QUESTION: "what colors does this category come in?" (`profiles`).
|
|
71
71
|
* `profiles` is an aggregate over a category, not a list of materials, and
|
|
72
|
-
*
|
|
72
|
+
* is counted live at request time.
|
|
73
73
|
*
|
|
74
74
|
* Instead use {@link MaterialGraphClient.findVariantsByColor} (`mode:
|
|
75
75
|
* "palette"`) for the materials near one or several colors and
|
|
@@ -129,9 +129,9 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
129
129
|
signal,
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
/** Current
|
|
133
|
-
async
|
|
134
|
-
return await this.#get("
|
|
132
|
+
/** Current catalog generation; authenticated, no SQL and no rate-limit charge. */
|
|
133
|
+
async getCatalogGeneration(signal) {
|
|
134
|
+
return await this.#get("get_catalog_generation", undefined, signal);
|
|
135
135
|
}
|
|
136
136
|
// ── Materials ──────────────────────────────────────────────────────────────
|
|
137
137
|
/**
|
|
@@ -159,6 +159,7 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
159
159
|
blocks: options?.blocks !== undefined && options.blocks.length > 0
|
|
160
160
|
? options.blocks.join(",")
|
|
161
161
|
: undefined,
|
|
162
|
+
ifc: options?.ifc === true ? "true" : undefined,
|
|
162
163
|
}, signal, { variantId });
|
|
163
164
|
}
|
|
164
165
|
async materialBlocks(variantId, signal) {
|
|
@@ -220,10 +221,10 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
220
221
|
* condition across all four ANDed, 20 at most), or a category/brand listing. An explicit
|
|
221
222
|
* `variant in` id that does not resolve to an eligible variant is
|
|
222
223
|
* reported in `unresolvedVariantIds` when it names no variant, in
|
|
223
|
-
* `unavailableVariantIds` when it names a
|
|
224
|
+
* `unavailableVariantIds` when it names a catalog variant this list
|
|
224
225
|
* cannot show in the requested scope (a retired one, for example), or in
|
|
225
|
-
* `
|
|
226
|
-
* materials
|
|
226
|
+
* `excludedBySearchCatalogSubset` when it names a real variant outside the
|
|
227
|
+
* materials catalog, never silently dropped from the page.
|
|
227
228
|
*
|
|
228
229
|
* `filters`/`optionalFilters`/`orderBy`/`colors` are sent as URL-encoded
|
|
229
230
|
* JSON; `attributes`/`include`/`words` as comma-separated lists — the server
|
|
@@ -238,7 +239,7 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
238
239
|
colors: input.colors !== undefined && input.colors.length > 0
|
|
239
240
|
? JSON.stringify(input.colors)
|
|
240
241
|
: undefined,
|
|
241
|
-
|
|
242
|
+
searchCatalogSubset: input.searchCatalogSubset,
|
|
242
243
|
cursor: input.cursor,
|
|
243
244
|
filters: input.filters ? JSON.stringify(input.filters) : undefined,
|
|
244
245
|
include: input.include !== undefined && input.include.length > 0
|
|
@@ -280,7 +281,7 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
280
281
|
* answered with one and listed in `choices`; send its `handle` with an
|
|
281
282
|
* alternative's `group` and `id` in `selections` to switch it, or its
|
|
282
283
|
* `text` in `leaveOut` to drop the condition. A query that
|
|
283
|
-
* applies nothing returns no items, never the whole
|
|
284
|
+
* applies nothing returns no items, never the whole catalog; a preference
|
|
284
285
|
* alone still ranks it.
|
|
285
286
|
*/
|
|
286
287
|
async searchVariants(input, signal) {
|
|
@@ -332,13 +333,14 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
332
333
|
* an image reference, or both fused into one embedding. `filters` is the
|
|
333
334
|
* same tree {@link MaterialGraphClient.listVariants} takes, less its `orText`
|
|
334
335
|
* and `unstated` additions. `query.mode`
|
|
335
|
-
* values other than `"text"` embed through Voyage and spend the
|
|
336
|
-
*
|
|
336
|
+
* values other than `"text"` embed through Voyage and spend the key's own
|
|
337
|
+
* `embed` rate limit, 10 a minute by default. An upload is embedded once and
|
|
338
|
+
* its vector kept, so a repeat image-only query on it spends nothing.
|
|
337
339
|
*/
|
|
338
340
|
async findVariantsByVector(input, signal) {
|
|
339
341
|
return await this.#post("find_variants_by_vector", input, signal);
|
|
340
342
|
}
|
|
341
|
-
/** Resolve a color name to its hex, and the named paint's
|
|
343
|
+
/** Resolve a color name to its hex, and the named paint's catalog variant. */
|
|
342
344
|
async resolveColor(name, signal, options) {
|
|
343
345
|
return await resolveColorCall(this.#transport, name, signal, options);
|
|
344
346
|
}
|
|
@@ -55,6 +55,6 @@ export type ColorProfilesParams = {
|
|
|
55
55
|
groupBy?: "group" | "type" | "merged";
|
|
56
56
|
/** Representative colors per category, 1 to 64. The server defaults to 8. */
|
|
57
57
|
topN?: number;
|
|
58
|
-
/** `"diverse"`
|
|
58
|
+
/** `"diverse"` maximizes visual distinctness instead of frequency. */
|
|
59
59
|
select?: "frequency" | "diverse";
|
|
60
60
|
};
|