@instruments/materialgraph 0.25.0 → 0.27.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 +38 -27
- package/associations-client.d.ts +4 -4
- package/associations-client.js +3 -10
- package/attribution-types.d.ts +4 -4
- package/brand-types.d.ts +14 -6
- package/brands-client.d.ts +7 -38
- package/brands-client.js +10 -40
- package/by-colour-types.d.ts +58 -31
- package/by-spec-types.d.ts +6 -73
- package/by-spec-types.js +7 -5
- package/catalog-discovery-types.d.ts +11 -26
- package/catalogue-client.d.ts +16 -35
- package/catalogue-client.js +32 -67
- package/catalogue-types.d.ts +44 -4
- package/categories-client.d.ts +63 -0
- package/categories-client.js +48 -0
- package/category-types.d.ts +114 -0
- package/citation-types.d.ts +4 -4
- package/client-config.d.ts +4 -6
- package/client-config.js +2 -4
- package/client-source-material-comments.d.ts +4 -4
- package/client-source-material-comments.js +4 -38
- package/client-vocabulary.d.ts +7 -9
- package/client-vocabulary.js +22 -30
- package/client.d.ts +110 -244
- package/client.js +217 -387
- package/codes-client.d.ts +2 -2
- package/codes-client.js +8 -8
- package/codes-types.d.ts +55 -34
- package/colour-aggregate-types.d.ts +24 -24
- package/colours-client.d.ts +6 -11
- package/colours-client.js +11 -19
- package/coordinate-client.d.ts +2 -2
- package/coordinate-client.js +1 -13
- package/corpus-scope-types.d.ts +3 -3
- package/corpus-scope-types.js +1 -25
- package/demand-batch-types.d.ts +18 -18
- package/demand-types.d.ts +24 -24
- package/errors.d.ts +13 -13
- package/errors.js +54 -52
- package/http-transport.d.ts +13 -21
- package/http-transport.js +31 -28
- package/identify-types.d.ts +54 -44
- package/identify-types.js +5 -3
- package/index.d.ts +11 -27
- package/index.js +4 -6
- package/list-variant-facets-types.d.ts +60 -0
- package/list-variants-types.d.ts +142 -0
- package/list-variants-types.js +12 -0
- package/match-stream-types.d.ts +45 -32
- package/match-stream-types.js +2 -0
- package/match-stream.d.ts +2 -2
- package/match-stream.js +67 -49
- package/match-types.d.ts +32 -8
- package/material-asset-types.d.ts +89 -69
- package/material-block-types.d.ts +8 -6
- package/material-composition-client.d.ts +21 -0
- package/material-composition-client.js +13 -0
- package/material-composition-types.d.ts +403 -0
- package/material-query-plan-types.d.ts +61 -145
- package/material-resources-client.d.ts +12 -10
- package/material-resources-client.js +27 -22
- package/material-types.d.ts +16 -24
- package/ndjson.js +16 -8
- package/operations.d.ts +6 -6
- package/operations.js +29 -156
- package/package.json +5 -1
- package/palette-search-types.d.ts +87 -52
- package/query-understanding-types.d.ts +65 -40
- package/resolve-client.d.ts +8 -12
- package/resolve-client.js +9 -13
- package/resolve-colour-types.d.ts +8 -8
- package/resolve-types.d.ts +10 -10
- package/response-schemas.d.ts +20 -0
- package/response-schemas.generated.d.ts +5 -0
- package/response-schemas.generated.js +160 -0
- package/response-schemas.js +113 -0
- package/run-types.d.ts +64 -145
- package/runs.d.ts +9 -58
- package/runs.js +60 -149
- package/samplize-catalogue-types.d.ts +18 -18
- package/samplize-colorvec.d.ts +20 -20
- package/samplize-colorvec.js +66 -42
- package/schema-resource-types.d.ts +52 -39
- package/schema-resource-types.js +5 -5
- package/search-card-types.d.ts +26 -4
- package/search-index-plan-types.d.ts +70 -0
- package/search-refinement-types.d.ts +10 -40
- package/search-refinement-types.js +1 -0
- package/search-request-types.d.ts +121 -204
- package/search-response-receipt-types.d.ts +13 -253
- package/search-response-types.d.ts +2 -2
- package/search-result-validation.d.ts +3 -19
- package/search-result-validation.js +42 -183
- package/source-material-validation.d.ts +3 -3
- package/source-material-validation.js +35 -39
- package/spec-facet-types.d.ts +11 -16
- package/spec-types.d.ts +23 -16
- package/spec-types.js +8 -7
- package/specifications.d.ts +14 -72
- package/specifications.js +39 -89
- package/sse.d.ts +2 -2
- package/sse.js +32 -16
- package/substitute-types.d.ts +22 -22
- package/suggest-types.d.ts +11 -17
- package/suggest-types.js +3 -3
- package/taxonomy-coverage-types.d.ts +8 -8
- package/types.d.ts +202 -405
- package/validation.d.ts +26 -26
- package/validation.js +97 -92
- package/webmcp.d.ts +3 -3
- package/webmcp.generated.js +10 -93
- package/brand-most-sampled-types.d.ts +0 -33
- package/browse-types.d.ts +0 -236
- package/client-browse.d.ts +0 -78
- package/client-browse.js +0 -72
- package/client-exploration.d.ts +0 -9
- package/client-exploration.js +0 -7
- package/compare-types.d.ts +0 -89
- package/composition-client.d.ts +0 -33
- package/composition-client.js +0 -27
- package/composition-types.d.ts +0 -455
- package/composition-types.js +0 -10
- package/correction-types.d.ts +0 -88
- package/exploration-types.d.ts +0 -118
- package/exploration-types.js +0 -1
- package/fan-deck-types.d.ts +0 -42
- package/fan-deck-types.js +0 -9
- package/match-rejection-types.d.ts +0 -43
- package/match-rejection-types.js +0 -7
- package/palette-completion-types.d.ts +0 -115
- package/palette-completion-types.js +0 -1
- package/project-types.d.ts +0 -79
- package/project-types.js +0 -9
- package/projects.d.ts +0 -13
- package/projects.js +0 -46
- package/render-assets-types.d.ts +0 -65
- package/render-assets-types.js +0 -1
- package/run-events.d.ts +0 -106
- package/run-events.js +0 -32
- package/schedule-reference-types.d.ts +0 -46
- package/schedule-reference-types.js +0 -1
- package/schedule-references-client.d.ts +0 -14
- package/schedule-references-client.js +0 -26
- package/schedule-types.d.ts +0 -261
- package/schedule-types.js +0 -1
- package/search-collapse-types.d.ts +0 -69
- package/search-collapse-types.js +0 -1
- package/search-mood-types.d.ts +0 -6
- package/search-mood-types.js +0 -1
- package/search-window-types.d.ts +0 -25
- package/search-window-types.js +0 -1
- package/slot-pool-types.d.ts +0 -372
- package/slot-pool-types.js +0 -1
- /package/{brand-most-sampled-types.js → category-types.js} +0 -0
- /package/{browse-types.js → list-variant-facets-types.js} +0 -0
- /package/{compare-types.js → material-composition-types.js} +0 -0
- /package/{correction-types.js → search-index-plan-types.js} +0 -0
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
/** Material blocks, safe assets, and technical documents over one shared transport. */
|
|
2
|
-
import { HttpTransport } from "./http-transport.js";
|
|
3
1
|
import { resolveOperation } from "./operations.js";
|
|
4
2
|
/** Read known and explicitly unobserved canonical material fields. */
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
export const materialBlocks = async (transport, variantId, signal) => await transport.requestJson(resolveOperation("list_material_blocks"), { pathParams: { variantId }, signal });
|
|
4
|
+
/**
|
|
5
|
+
* Read one bounded, filtered, cursor-paged page of a variant's images and
|
|
6
|
+
* files. `imageRoles` narrows only images and `documentTypes` narrows only
|
|
7
|
+
* documents, each implying its own kind; the server refuses either paired
|
|
8
|
+
* with other kinds, or with each other, rather than silently widening.
|
|
9
|
+
*/
|
|
10
|
+
export const listVariantAssets = async (transport, variantId, options, signal) => await transport.requestJson(resolveOperation("list_variant_assets"), {
|
|
11
|
+
pathParams: { variantId },
|
|
12
|
+
query: options
|
|
13
|
+
? {
|
|
14
|
+
cursor: options.cursor,
|
|
15
|
+
documentTypes: options.documentTypes?.join(","),
|
|
16
|
+
imageRoles: options.imageRoles?.join(","),
|
|
17
|
+
kinds: options.kinds?.join(","),
|
|
18
|
+
limit: options.limit,
|
|
19
|
+
}
|
|
20
|
+
: undefined,
|
|
21
|
+
signal,
|
|
22
|
+
});
|
|
16
23
|
/**
|
|
17
24
|
* Read the owning Product's URL-deduplicated document page. Variant declarations
|
|
18
25
|
* retain exact attribution; consumers inspect `appliesToRequestedVariant`
|
|
19
26
|
* before presenting a sibling Variant declaration as applicable.
|
|
20
27
|
*/
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
}
|
|
28
|
+
export const materialDocuments = async (transport, variantId, options, signal) => await transport.requestJson(resolveOperation("list_material_documents"), {
|
|
29
|
+
pathParams: { variantId },
|
|
30
|
+
query: options
|
|
31
|
+
? { cursor: options.cursor, limit: options.limit }
|
|
32
|
+
: undefined,
|
|
33
|
+
signal,
|
|
34
|
+
});
|
package/material-types.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export type MaterialAvailability = OpenEnum<"available" | "discontinued" | "supe
|
|
|
41
41
|
* successor that has itself been superseded reports `discontinued`/`unknown`
|
|
42
42
|
* here; follow `variantId` for the next link in the chain.
|
|
43
43
|
*/
|
|
44
|
-
export
|
|
44
|
+
export type MaterialSuccessor = {
|
|
45
45
|
/** Opaque — round-trip verbatim to read the successor. */
|
|
46
46
|
variantId: VariantId;
|
|
47
47
|
brandSlug: string;
|
|
@@ -51,12 +51,12 @@ export interface MaterialSuccessor {
|
|
|
51
51
|
variant: string;
|
|
52
52
|
color: string | null;
|
|
53
53
|
availability: MaterialAvailability;
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
/**
|
|
56
56
|
* The grid-card projection of a material. Tiles carry `availability` but not the
|
|
57
57
|
* successor record — read the detail projection for that.
|
|
58
58
|
*/
|
|
59
|
-
export
|
|
59
|
+
export type MaterialTile = {
|
|
60
60
|
/** Accepted sampleability fact. Absent means unknown, never false. */
|
|
61
61
|
sampleable?: boolean;
|
|
62
62
|
/** Opaque — round-trip verbatim into every other material read. */
|
|
@@ -77,20 +77,7 @@ export interface MaterialTile {
|
|
|
77
77
|
* the attribute is absent — never render a missing key as "unnamed".
|
|
78
78
|
*/
|
|
79
79
|
colourName?: string;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A sibling card: the tile, plus — when another variant of the same product
|
|
83
|
-
* shares both its `variantName` and its `colourName` — the one attribute that
|
|
84
|
-
* tells them apart (MG-1857: IndoTeak's Reclaimed Teak is ten "Unfinished"
|
|
85
|
-
* variants that differ only by product code). Declared size first, then product
|
|
86
|
-
* code. The two fields arrive together or not at all; absent means nothing
|
|
87
|
-
* collides, or neither attribute separates every look-alike.
|
|
88
|
-
*/
|
|
89
|
-
export interface SiblingTile extends MaterialTile {
|
|
90
|
-
distinguishedBy?: OpenEnum<"size" | "code">;
|
|
91
|
-
/** This sibling's value of `distinguishedBy`, e.g. `"3.5 in"`. */
|
|
92
|
-
distinction?: string;
|
|
93
|
-
}
|
|
80
|
+
};
|
|
94
81
|
/**
|
|
95
82
|
* A canonical attribute/term pair carried on a detail record.
|
|
96
83
|
*
|
|
@@ -99,7 +86,7 @@ export interface SiblingTile extends MaterialTile {
|
|
|
99
86
|
* `specificationFacets()` and `attributeValues()`. An attribute absent from
|
|
100
87
|
* `facets` is unrecorded, never known-false.
|
|
101
88
|
*/
|
|
102
|
-
export
|
|
89
|
+
export type MaterialFacet = {
|
|
103
90
|
attributeId: string;
|
|
104
91
|
term: string;
|
|
105
92
|
/**
|
|
@@ -108,9 +95,9 @@ export interface MaterialFacet {
|
|
|
108
95
|
* payloads. Only `specification` facets are valid inputs to `bySpec`.
|
|
109
96
|
*/
|
|
110
97
|
role?: "identity" | "specification";
|
|
111
|
-
}
|
|
98
|
+
};
|
|
112
99
|
/** A retained product-type proposal. It is review evidence, never a category. */
|
|
113
|
-
export
|
|
100
|
+
export type ProposedProductType = {
|
|
114
101
|
id: string;
|
|
115
102
|
displayName: string;
|
|
116
103
|
confidence: number | null;
|
|
@@ -118,12 +105,12 @@ export interface ProposedProductType {
|
|
|
118
105
|
sourceUrl: string | null;
|
|
119
106
|
isPrimary: boolean;
|
|
120
107
|
scope: "variant" | "product";
|
|
121
|
-
}
|
|
108
|
+
};
|
|
122
109
|
/** Accepted display categories remain separate from this review-state receipt. */
|
|
123
|
-
export
|
|
110
|
+
export type ProductTypeReceipt = {
|
|
124
111
|
state: "accepted" | "proposed" | "unknown";
|
|
125
112
|
proposedProductTypes: ProposedProductType[];
|
|
126
|
-
}
|
|
113
|
+
};
|
|
127
114
|
/**
|
|
128
115
|
* One dimensional configuration of a material. Numeric fields are millimetres
|
|
129
116
|
* (mass in kilograms); string fields are the source's own descriptors. The
|
|
@@ -154,8 +141,13 @@ export interface MaterialDetail extends MaterialTile {
|
|
|
154
141
|
/** Opaque — the product family; siblings share it. */
|
|
155
142
|
productId: ProductId;
|
|
156
143
|
color: string | null;
|
|
157
|
-
/**
|
|
144
|
+
/** The variant's Material Bank SKU. Null means none is recorded, not unknown. */
|
|
158
145
|
materialBankId: string | null;
|
|
146
|
+
/**
|
|
147
|
+
* The manufacturer's own item code from `variants.code`, the same key search
|
|
148
|
+
* results carry. ABSENT means no code is recorded, never an invented one.
|
|
149
|
+
*/
|
|
150
|
+
manufacturerCode?: string;
|
|
159
151
|
/**
|
|
160
152
|
* Explicit source-governed permission to save this exact source-coded variant
|
|
161
153
|
* to a Project. Absent means unknown/not allowed; never infer it from identity.
|
package/ndjson.js
CHANGED
|
@@ -32,8 +32,9 @@ export class NdjsonDecoder {
|
|
|
32
32
|
const lines = [];
|
|
33
33
|
for (;;) {
|
|
34
34
|
const index = this.#buffer.indexOf("\n");
|
|
35
|
-
if (index === -1)
|
|
35
|
+
if (index === -1) {
|
|
36
36
|
break;
|
|
37
|
+
}
|
|
37
38
|
lines.push(this.#buffer.slice(0, index));
|
|
38
39
|
this.#buffer = this.#buffer.slice(index + 1);
|
|
39
40
|
}
|
|
@@ -46,8 +47,9 @@ export class NdjsonDecoder {
|
|
|
46
47
|
* raise, not this decoder's fragment to discard.
|
|
47
48
|
*/
|
|
48
49
|
flush() {
|
|
49
|
-
if (this.#buffer.length === 0)
|
|
50
|
+
if (this.#buffer.length === 0) {
|
|
50
51
|
return [];
|
|
52
|
+
}
|
|
51
53
|
const remainder = this.#buffer;
|
|
52
54
|
this.#buffer = "";
|
|
53
55
|
return [remainder];
|
|
@@ -66,34 +68,40 @@ export async function* readNdjsonLines(body, signal) {
|
|
|
66
68
|
const ndjson = new NdjsonDecoder();
|
|
67
69
|
try {
|
|
68
70
|
for (;;) {
|
|
69
|
-
if (signal?.aborted)
|
|
71
|
+
if (signal?.aborted) {
|
|
70
72
|
return;
|
|
73
|
+
}
|
|
71
74
|
let result;
|
|
72
75
|
try {
|
|
73
76
|
result = await reader.read();
|
|
74
77
|
}
|
|
75
78
|
catch (error) {
|
|
76
|
-
if (signal?.aborted)
|
|
79
|
+
if (signal?.aborted) {
|
|
77
80
|
return;
|
|
81
|
+
}
|
|
78
82
|
throw error;
|
|
79
83
|
}
|
|
80
84
|
if (result.done) {
|
|
81
85
|
// `decode()` with no argument flushes any dangling multi-byte sequence.
|
|
82
86
|
for (const line of ndjson.push(decoder.decode())) {
|
|
83
|
-
if (line.trim().length > 0)
|
|
87
|
+
if (line.trim().length > 0) {
|
|
84
88
|
yield line;
|
|
89
|
+
}
|
|
85
90
|
}
|
|
86
91
|
for (const line of ndjson.flush()) {
|
|
87
|
-
if (line.trim().length > 0)
|
|
92
|
+
if (line.trim().length > 0) {
|
|
88
93
|
yield line;
|
|
94
|
+
}
|
|
89
95
|
}
|
|
90
96
|
return;
|
|
91
97
|
}
|
|
92
98
|
for (const line of ndjson.push(decoder.decode(result.value, { stream: true }))) {
|
|
93
|
-
if (signal?.aborted)
|
|
99
|
+
if (signal?.aborted) {
|
|
94
100
|
return;
|
|
95
|
-
|
|
101
|
+
}
|
|
102
|
+
if (line.trim().length > 0) {
|
|
96
103
|
yield line;
|
|
104
|
+
}
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
}
|
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 ["
|
|
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 ["identify", "POST", "/api/v1/identify", "retrieval.identify"], readonly ["match", "POST", "/api/v1/search/match", "match_material"], readonly ["suggest", "GET", "/api/v1/search/suggest", "search_suggest"], readonly ["colours.stats", "GET", "/api/v1/colours/stats", "get_colour_stats"], readonly ["coordinate", "POST", "/api/v1/pairings/coordinate", "coordinate_materials"], 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 ["material", "GET", "/api/v1/materials/{variantId}", "get_material"], 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 ["compositionReport", "GET", "/api/v1/composition/report", "get_composition_report"], readonly ["schema", "GET", "/api/v1/schema/blocks", "list_schema_blocks"], readonly ["schema", "GET", "/api/v1/schema/attributes", "list_schema_attributes"], readonly ["schema", "GET", "/api/v1/schema/verticals", "list_schema_verticals"], readonly ["schema", "GET", "/api/v1/schema/product-types", "list_schema_product_types"], readonly ["schema", "GET", "/api/v1/schema/units", "list_schema_units"], readonly ["schema", "GET", "/api/v1/schema/value-dictionaries", "list_schema_value_dictionaries"], readonly ["schema", "GET", "/api/v1/schema/source-requirements", "list_schema_source_requirements"], readonly ["schema", "GET", "/api/v1/schema/product-type-templates", "list_schema_product_type_templates"], readonly ["schema", "GET", "/api/v1/schema/mappings", "list_schema_mappings"], 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 ["colours.profiles", "GET", "/api/v1/colours/profiles", "get_category_colour_profiles"], readonly ["resolveColour", "GET", "/api/v1/search/colours/resolve", "resolve_colour_name"], readonly ["suggestColour", "GET", "/api/v1/search/colours/suggest", "suggest_colour_names"], readonly ["listAttributes", "GET", "/api/v1/catalog/attributes", "catalog_list_attributes"], readonly ["searchVocabulary", "GET", "/api/v1/catalog/vocabulary/search", "catalog_vocabulary_search"], readonly ["resolve", "POST", "/api/v1/resolve", "resolve_phrases"], readonly ["categories.list", "GET", "/api/v1/categories", "list_categories"], readonly ["categories.get", "GET", "/api/v1/categories/{id}", "get_category"], readonly ["productTypeCoverage", "GET", "/api/v1/taxonomy/coverage", "get_product_type_status_coverage"], readonly ["whoami", "GET", "/api/v1/whoami", "whoami"], readonly ["demand", "GET", "/api/v1/demand", "get_material_demand"], readonly ["colours.palette", "POST", "/api/v1/search/palettes", "search_by_palette"], readonly ["extractPalette", "POST", "/api/v1/search/palettes/extract", "extract_image_palette"], readonly ["colours.gradient", "POST", "/api/v1/search/gradients", "search_by_gradient"], readonly ["specificationFacets", "GET", "/api/v1/catalog/specifications/facets", "list_spec_facets"], readonly ["brands", "GET", "/api/v1/brands", "list_brands"], readonly ["uploadSourceMaterial", "POST", "/api/v1/source-material", "upload_source_material"], readonly ["sourceMaterialBatch", "GET", "/api/v1/source-material/{batchId}", "get_source_material_batch"], readonly ["sourceMaterialComments.list", "GET", "/api/v1/source-material/{batchId}/sources/{sourceId}/comments", "list_source_material_comments"], readonly ["sourceMaterialComments.post", "POST", "/api/v1/source-material/{batchId}/sources/{sourceId}/comments", "post_source_material_comment"], readonly ["createRun", "POST", "/api/v1/runs", "create_public_run"], readonly ["run", "GET", "/api/v1/runs/{runId}", "get_public_run"], readonly ["citation", "GET", "/api/v1/citations/{citationId}", "get_verdict_citation"], readonly ["streamRunEvents", "GET", "/api/v1/runs/{runId}/events", "list_public_run_events"], readonly ["demandBatch", "POST", "/api/v1/demand/batch", "get_demand_batch"], readonly ["codeAdvisory", "POST", "/api/v1/codes/advisory", "resolveCodeAdvisory"], readonly ["codes.context", "GET", "/api/v1/codes/context", "list_code_context"], readonly ["codes.requirements", "GET", "/api/v1/codes/requirements", "list_code_requirements"]];
|
|
3
3
|
export type SdkOperationId = (typeof OPERATION_DEFINITIONS)[number][3];
|
|
4
4
|
export type SdkOperation = Readonly<{
|
|
5
5
|
clientMethod: (typeof OPERATION_DEFINITIONS)[number][0];
|
|
@@ -9,13 +9,13 @@ export type SdkOperation = Readonly<{
|
|
|
9
9
|
}>;
|
|
10
10
|
export declare const SDK_OPERATIONS: readonly SdkOperation[];
|
|
11
11
|
/** Look up a registered operation by its OpenAPI `operationId`. */
|
|
12
|
-
export declare
|
|
12
|
+
export declare const findSdkOperation: (operationId: SdkOperationId) => SdkOperation | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* Look up a registered operation, or throw. The lookup every caller that holds
|
|
15
|
-
* a literal `operationId` wants — lived as a private copy in `client.ts`
|
|
16
|
-
*
|
|
15
|
+
* a literal `operationId` wants — lived as a private copy in `client.ts`
|
|
16
|
+
* before the association lens would have made it a second.
|
|
17
17
|
*/
|
|
18
|
-
export declare
|
|
18
|
+
export declare const resolveOperation: (operationId: SdkOperationId) => SdkOperation;
|
|
19
19
|
/** Substitute `{param}` path placeholders with percent-encoded values. */
|
|
20
|
-
export declare
|
|
20
|
+
export declare const operationPath: (sdkOperation: SdkOperation, pathParams?: Readonly<Record<string, string>>) => string;
|
|
21
21
|
export {};
|
package/operations.js
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
import { MaterialGraphError } from "./errors.js";
|
|
2
2
|
export const MATERIALGRAPH_API_VERSION = "0.7.0";
|
|
3
3
|
const OPERATION_DEFINITIONS = [
|
|
4
|
-
[
|
|
5
|
-
"brandMostSampled",
|
|
6
|
-
"GET",
|
|
7
|
-
"/api/v1/brands/most-sampled",
|
|
8
|
-
"brands.most_sampled",
|
|
9
|
-
],
|
|
10
|
-
[
|
|
11
|
-
"colours.complete",
|
|
12
|
-
"POST",
|
|
13
|
-
"/api/v1/colours/palettes/complete",
|
|
14
|
-
"complete_interior_palette",
|
|
15
|
-
],
|
|
16
|
-
[
|
|
17
|
-
"colours.discover",
|
|
18
|
-
"GET",
|
|
19
|
-
"/api/v1/colours/palettes",
|
|
20
|
-
"discover_interior_palettes",
|
|
21
|
-
],
|
|
22
4
|
[
|
|
23
5
|
"samplizeColorVecCache",
|
|
24
6
|
"GET",
|
|
@@ -31,18 +13,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
31
13
|
"/api/v1/catalogues/samplize/search",
|
|
32
14
|
"samplize_catalogue_search",
|
|
33
15
|
],
|
|
34
|
-
[
|
|
35
|
-
"scheduleReferences.list",
|
|
36
|
-
"GET",
|
|
37
|
-
"/api/v1/schedules/{scheduleId}/references",
|
|
38
|
-
"list_schedule_reference_feedback",
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
"scheduleReferences.put",
|
|
42
|
-
"PUT",
|
|
43
|
-
"/api/v1/schedules/{scheduleId}/references/{referenceId}",
|
|
44
|
-
"put_schedule_reference_feedback",
|
|
45
|
-
],
|
|
46
16
|
["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"],
|
|
47
17
|
[
|
|
48
18
|
"catalogPages",
|
|
@@ -64,15 +34,10 @@ const OPERATION_DEFINITIONS = [
|
|
|
64
34
|
],
|
|
65
35
|
["search", "POST", "/api/v1/search", "search_materials_post"],
|
|
66
36
|
["identify", "POST", "/api/v1/identify", "retrieval.identify"],
|
|
67
|
-
["
|
|
68
|
-
["
|
|
69
|
-
[
|
|
70
|
-
|
|
71
|
-
"GET",
|
|
72
|
-
"/api/v1/corrections/{correctionId}",
|
|
73
|
-
"corrections.get",
|
|
74
|
-
],
|
|
75
|
-
["listCorrections", "GET", "/api/v1/corrections", "corrections.list"],
|
|
37
|
+
["match", "POST", "/api/v1/search/match", "match_material"],
|
|
38
|
+
["suggest", "GET", "/api/v1/search/suggest", "search_suggest"],
|
|
39
|
+
["colours.stats", "GET", "/api/v1/colours/stats", "get_colour_stats"],
|
|
40
|
+
["coordinate", "POST", "/api/v1/pairings/coordinate", "coordinate_materials"],
|
|
76
41
|
["planQuery", "POST", "/api/v1/search/plan", "plan_material_query"],
|
|
77
42
|
[
|
|
78
43
|
"samplizeCatalogue",
|
|
@@ -81,19 +46,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
81
46
|
"samplize_catalogue_products",
|
|
82
47
|
],
|
|
83
48
|
["searchGet", "GET", "/api/v1/search", "search_materials_get"],
|
|
84
|
-
["match", "POST", "/api/v1/search/match", "match_material"],
|
|
85
|
-
[
|
|
86
|
-
"rejectMatchResult",
|
|
87
|
-
"POST",
|
|
88
|
-
"/api/v1/search/match/{responseId}/rejections",
|
|
89
|
-
"reject_match_result",
|
|
90
|
-
],
|
|
91
|
-
[
|
|
92
|
-
"matchRejections",
|
|
93
|
-
"GET",
|
|
94
|
-
"/api/v1/search/match/{responseId}/rejections",
|
|
95
|
-
"list_match_rejections",
|
|
96
|
-
],
|
|
97
49
|
["byColour", "GET", "/api/v1/search/colours", "search_by_colour"],
|
|
98
50
|
["material", "GET", "/api/v1/materials/{variantId}", "get_material"],
|
|
99
51
|
[
|
|
@@ -114,12 +66,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
114
66
|
"/api/v1/catalogues/documents/{documentId}",
|
|
115
67
|
"get_catalogue_document_access",
|
|
116
68
|
],
|
|
117
|
-
[
|
|
118
|
-
"siblings",
|
|
119
|
-
"GET",
|
|
120
|
-
"/api/v1/materials/{variantId}/siblings",
|
|
121
|
-
"get_material_siblings",
|
|
122
|
-
],
|
|
123
69
|
[
|
|
124
70
|
"materialBlocks",
|
|
125
71
|
"GET",
|
|
@@ -127,16 +73,10 @@ const OPERATION_DEFINITIONS = [
|
|
|
127
73
|
"list_material_blocks",
|
|
128
74
|
],
|
|
129
75
|
[
|
|
130
|
-
"
|
|
76
|
+
"listVariantAssets",
|
|
131
77
|
"GET",
|
|
132
|
-
"/api/v1/
|
|
133
|
-
"
|
|
134
|
-
],
|
|
135
|
-
[
|
|
136
|
-
"materialRenderAssets",
|
|
137
|
-
"GET",
|
|
138
|
-
"/api/v1/materials/{variantId}/render-assets",
|
|
139
|
-
"get_material_render_assets",
|
|
78
|
+
"/api/v1/variants/{variantId}/assets",
|
|
79
|
+
"list_variant_assets",
|
|
140
80
|
],
|
|
141
81
|
[
|
|
142
82
|
"materialDocuments",
|
|
@@ -145,16 +85,10 @@ const OPERATION_DEFINITIONS = [
|
|
|
145
85
|
"list_material_documents",
|
|
146
86
|
],
|
|
147
87
|
[
|
|
148
|
-
"
|
|
88
|
+
"compositionReport",
|
|
149
89
|
"GET",
|
|
150
|
-
"/api/v1/
|
|
151
|
-
"
|
|
152
|
-
],
|
|
153
|
-
[
|
|
154
|
-
"exploration.candidates",
|
|
155
|
-
"POST",
|
|
156
|
-
"/api/v1/materials/{variantId}/candidates",
|
|
157
|
-
"read_material_candidates",
|
|
90
|
+
"/api/v1/composition/report",
|
|
91
|
+
"get_composition_report",
|
|
158
92
|
],
|
|
159
93
|
["schema", "GET", "/api/v1/schema/blocks", "list_schema_blocks"],
|
|
160
94
|
["schema", "GET", "/api/v1/schema/attributes", "list_schema_attributes"],
|
|
@@ -191,12 +125,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
191
125
|
"/api/v1/materials/{variantId}/pairings",
|
|
192
126
|
"get_material_pairings",
|
|
193
127
|
],
|
|
194
|
-
[
|
|
195
|
-
"findSubstitutes",
|
|
196
|
-
"POST",
|
|
197
|
-
"/api/v1/materials/{variantId}/substitutes",
|
|
198
|
-
"find_material_substitutes",
|
|
199
|
-
],
|
|
200
128
|
[
|
|
201
129
|
"associatedFinishes",
|
|
202
130
|
"GET",
|
|
@@ -210,22 +138,19 @@ const OPERATION_DEFINITIONS = [
|
|
|
210
138
|
"list_associated_products",
|
|
211
139
|
],
|
|
212
140
|
["applicability", "GET", "/api/v1/applicability", "get_applicability"],
|
|
213
|
-
["
|
|
141
|
+
["listVariants", "GET", "/api/v1/variants", "list_variants"],
|
|
214
142
|
[
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"/api/v1/
|
|
218
|
-
"
|
|
143
|
+
"listVariantFacets",
|
|
144
|
+
"POST",
|
|
145
|
+
"/api/v1/variants/facets",
|
|
146
|
+
"list_variant_facets",
|
|
219
147
|
],
|
|
220
|
-
["browse", "GET", "/api/v1/search/browse", "search_browse_by_colour"],
|
|
221
|
-
["colourFacets", "GET", "/api/v1/colours/facets", "get_colour_facets"],
|
|
222
148
|
[
|
|
223
149
|
"colours.profiles",
|
|
224
150
|
"GET",
|
|
225
151
|
"/api/v1/colours/profiles",
|
|
226
152
|
"get_category_colour_profiles",
|
|
227
153
|
],
|
|
228
|
-
["colours.stats", "GET", "/api/v1/colours/stats", "get_colour_stats"],
|
|
229
154
|
[
|
|
230
155
|
"resolveColour",
|
|
231
156
|
"GET",
|
|
@@ -238,18 +163,11 @@ const OPERATION_DEFINITIONS = [
|
|
|
238
163
|
"/api/v1/search/colours/suggest",
|
|
239
164
|
"suggest_colour_names",
|
|
240
165
|
],
|
|
241
|
-
["suggest", "GET", "/api/v1/search/suggest", "search_suggest"],
|
|
242
|
-
[
|
|
243
|
-
"resolveAttribute",
|
|
244
|
-
"GET",
|
|
245
|
-
"/api/v1/catalog/attributes/resolve",
|
|
246
|
-
"catalog_resolve_attribute",
|
|
247
|
-
],
|
|
248
166
|
[
|
|
249
|
-
"
|
|
167
|
+
"listAttributes",
|
|
250
168
|
"GET",
|
|
251
|
-
"/api/v1/catalog/attributes
|
|
252
|
-
"
|
|
169
|
+
"/api/v1/catalog/attributes",
|
|
170
|
+
"catalog_list_attributes",
|
|
253
171
|
],
|
|
254
172
|
[
|
|
255
173
|
"searchVocabulary",
|
|
@@ -258,8 +176,8 @@ const OPERATION_DEFINITIONS = [
|
|
|
258
176
|
"catalog_vocabulary_search",
|
|
259
177
|
],
|
|
260
178
|
["resolve", "POST", "/api/v1/resolve", "resolve_phrases"],
|
|
261
|
-
["
|
|
262
|
-
["
|
|
179
|
+
["categories.list", "GET", "/api/v1/categories", "list_categories"],
|
|
180
|
+
["categories.get", "GET", "/api/v1/categories/{id}", "get_category"],
|
|
263
181
|
[
|
|
264
182
|
"productTypeCoverage",
|
|
265
183
|
"GET",
|
|
@@ -267,7 +185,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
267
185
|
"get_product_type_status_coverage",
|
|
268
186
|
],
|
|
269
187
|
["whoami", "GET", "/api/v1/whoami", "whoami"],
|
|
270
|
-
["coordinate", "POST", "/api/v1/pairings/coordinate", "coordinate_materials"],
|
|
271
188
|
["demand", "GET", "/api/v1/demand", "get_material_demand"],
|
|
272
189
|
["colours.palette", "POST", "/api/v1/search/palettes", "search_by_palette"],
|
|
273
190
|
[
|
|
@@ -288,27 +205,7 @@ const OPERATION_DEFINITIONS = [
|
|
|
288
205
|
"/api/v1/catalog/specifications/facets",
|
|
289
206
|
"list_spec_facets",
|
|
290
207
|
],
|
|
291
|
-
[
|
|
292
|
-
"attributeValues",
|
|
293
|
-
"GET",
|
|
294
|
-
"/api/v1/catalog/attributes/{attributeId}/values",
|
|
295
|
-
"list_attribute_values",
|
|
296
|
-
],
|
|
297
|
-
[
|
|
298
|
-
"applicableSpecs",
|
|
299
|
-
"GET",
|
|
300
|
-
"/api/v1/taxonomy/categories/{key}/specs",
|
|
301
|
-
"get_applicable_specs",
|
|
302
|
-
],
|
|
303
|
-
["glossary", "GET", "/api/v1/glossary/{term}", "explain_material_term"],
|
|
304
208
|
["brands", "GET", "/api/v1/brands", "list_brands"],
|
|
305
|
-
["brand", "GET", "/api/v1/brands/{brandSlug}", "get_brand_profile"],
|
|
306
|
-
[
|
|
307
|
-
"brandColourDeck",
|
|
308
|
-
"GET",
|
|
309
|
-
"/api/v1/brands/{brandSlug}/colours",
|
|
310
|
-
"brand_colour_deck",
|
|
311
|
-
],
|
|
312
209
|
[
|
|
313
210
|
"uploadSourceMaterial",
|
|
314
211
|
"POST",
|
|
@@ -333,16 +230,8 @@ const OPERATION_DEFINITIONS = [
|
|
|
333
230
|
"/api/v1/source-material/{batchId}/sources/{sourceId}/comments",
|
|
334
231
|
"post_source_material_comment",
|
|
335
232
|
],
|
|
336
|
-
["capabilities", "GET", "/api/v1/capabilities", "list_public_capabilities"],
|
|
337
233
|
["createRun", "POST", "/api/v1/runs", "create_public_run"],
|
|
338
|
-
["listRuns", "GET", "/api/v1/runs", "list_public_runs"],
|
|
339
234
|
["run", "GET", "/api/v1/runs/{runId}", "get_public_run"],
|
|
340
|
-
[
|
|
341
|
-
"runSchedule",
|
|
342
|
-
"GET",
|
|
343
|
-
"/api/v1/runs/{runId}/schedule",
|
|
344
|
-
"get_run_finish_schedule",
|
|
345
|
-
],
|
|
346
235
|
["citation", "GET", "/api/v1/citations/{citationId}", "get_verdict_citation"],
|
|
347
236
|
[
|
|
348
237
|
"streamRunEvents",
|
|
@@ -350,19 +239,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
350
239
|
"/api/v1/runs/{runId}/events",
|
|
351
240
|
"list_public_run_events",
|
|
352
241
|
],
|
|
353
|
-
["resumeRun", "POST", "/api/v1/runs/{runId}/resume", "resume_public_run"],
|
|
354
|
-
["cancelRun", "POST", "/api/v1/runs/{runId}/cancel", "cancel_public_run"],
|
|
355
|
-
["varyScheme", "POST", "/api/v1/schemes/vary", "vary_schemes"],
|
|
356
|
-
["slotPools", "POST", "/api/v1/schemes/pools", "slot_pools"],
|
|
357
|
-
["createProject", "POST", "/api/v1/projects", "create_box_project"],
|
|
358
|
-
["listProjects", "GET", "/api/v1/projects", "list_box_projects"],
|
|
359
|
-
["getProject", "GET", "/api/v1/projects/{projectId}", "get_box_project"],
|
|
360
|
-
[
|
|
361
|
-
"appendProjectEvent",
|
|
362
|
-
"POST",
|
|
363
|
-
"/api/v1/projects/{projectId}/events",
|
|
364
|
-
"append_box_project_event",
|
|
365
|
-
],
|
|
366
242
|
["demandBatch", "POST", "/api/v1/demand/batch", "get_demand_batch"],
|
|
367
243
|
["codeAdvisory", "POST", "/api/v1/codes/advisory", "resolveCodeAdvisory"],
|
|
368
244
|
["codes.context", "GET", "/api/v1/codes/context", "list_code_context"],
|
|
@@ -373,23 +249,20 @@ const OPERATION_DEFINITIONS = [
|
|
|
373
249
|
"list_code_requirements",
|
|
374
250
|
],
|
|
375
251
|
];
|
|
376
|
-
export const SDK_OPERATIONS = Object.freeze(OPERATION_DEFINITIONS.map(([clientMethod, method, path, operationId]) => Object.freeze({ clientMethod, method,
|
|
252
|
+
export const SDK_OPERATIONS = Object.freeze(OPERATION_DEFINITIONS.map(([clientMethod, method, path, operationId]) => Object.freeze({ clientMethod, method, operationId, path })));
|
|
377
253
|
/** Look up a registered operation by its OpenAPI `operationId`. */
|
|
378
|
-
export
|
|
379
|
-
return SDK_OPERATIONS.find((candidate) => candidate.operationId === operationId);
|
|
380
|
-
}
|
|
254
|
+
export const findSdkOperation = (operationId) => SDK_OPERATIONS.find((candidate) => candidate.operationId === operationId);
|
|
381
255
|
/**
|
|
382
256
|
* Look up a registered operation, or throw. The lookup every caller that holds
|
|
383
|
-
* a literal `operationId` wants — lived as a private copy in `client.ts`
|
|
384
|
-
*
|
|
257
|
+
* a literal `operationId` wants — lived as a private copy in `client.ts`
|
|
258
|
+
* before the association lens would have made it a second.
|
|
385
259
|
*/
|
|
386
|
-
export
|
|
260
|
+
export const resolveOperation = (operationId) => {
|
|
387
261
|
const match = findSdkOperation(operationId);
|
|
388
|
-
if (!match)
|
|
262
|
+
if (!match) {
|
|
389
263
|
throw MaterialGraphError.unexpected(`Unknown SDK operation: ${operationId}`);
|
|
264
|
+
}
|
|
390
265
|
return match;
|
|
391
|
-
}
|
|
266
|
+
};
|
|
392
267
|
/** Substitute `{param}` path placeholders with percent-encoded values. */
|
|
393
|
-
export
|
|
394
|
-
return Object.entries(pathParams).reduce((path, [name, value]) => path.replace(`{${name}}`, encodeURIComponent(value)), sdkOperation.path);
|
|
395
|
-
}
|
|
268
|
+
export const operationPath = (sdkOperation, pathParams = {}) => Object.entries(pathParams).reduce((path, [name, value]) => path.replace(`{${name}}`, encodeURIComponent(value)), sdkOperation.path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instruments/materialgraph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"./samplize-colorvec": {
|
|
15
15
|
"types": "./samplize-colorvec.d.ts",
|
|
16
16
|
"import": "./samplize-colorvec.js"
|
|
17
|
+
},
|
|
18
|
+
"./response-schemas": {
|
|
19
|
+
"types": "./response-schemas.d.ts",
|
|
20
|
+
"import": "./response-schemas.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"dependencies": {
|