@instruments/materialgraph 3.2.0 → 3.3.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/baseline-types.d.ts +112 -0
- package/baseline-types.js +1 -0
- package/client-response-schema.js +1 -1
- package/client-vocabulary.d.ts +2 -0
- package/client-vocabulary.js +8 -0
- package/client.d.ts +32 -3
- package/client.js +46 -4
- package/find-variants-by-color-types.d.ts +1 -0
- package/get-variant-demand-types.d.ts +69 -0
- package/get-variant-demand-types.js +1 -0
- package/get-variant-types.d.ts +1 -1
- package/index.d.ts +3 -1
- package/list-sampled-together-pairs-types.d.ts +5 -5
- package/list-variants-types.d.ts +3 -2
- package/material-block-types.d.ts +1 -1
- package/operation-responses.d.ts +6 -0
- package/operations.generated.d.ts +1 -1
- package/operations.generated.js +9 -0
- package/package.json +1 -1
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +34 -28
- package/types.d.ts +7 -9
- package/webmcp.generated.js +4 -4
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module baseline-types
|
|
3
|
+
* @description Hand-maintained mirror of the Performance Baseline reads' wire
|
|
4
|
+
* shapes (`list_baselines`, `check_baselines`). The source of truth is
|
|
5
|
+
* `packages/search/src/baselines/baselines-contract.ts`; this SDK has no
|
|
6
|
+
* runtime dependency on `@materialgraph/search`, so the shapes are copied
|
|
7
|
+
* here and `contract-parity.test.ts` keeps them honest.
|
|
8
|
+
*/
|
|
9
|
+
import type { OpenEnum } from "./types.js";
|
|
10
|
+
/** Why a baseline exists. How binding it is on a project, the project decides. */
|
|
11
|
+
export type BaselineStrength = OpenEnum<"code_driven" | "industry_guideline" | "common_practice">;
|
|
12
|
+
/** The published source a baseline was read from. */
|
|
13
|
+
export interface BaselineSource {
|
|
14
|
+
citation: string;
|
|
15
|
+
edition: string;
|
|
16
|
+
publisher: string;
|
|
17
|
+
/** The day the page at `url` was read (ISO date). */
|
|
18
|
+
readOn: string;
|
|
19
|
+
url: string;
|
|
20
|
+
}
|
|
21
|
+
/** One way to meet a baseline: a `listVariants()` `filters` value. */
|
|
22
|
+
export type BaselineWayToMeet = {
|
|
23
|
+
terms: {
|
|
24
|
+
field: string;
|
|
25
|
+
op: "in";
|
|
26
|
+
values: string[];
|
|
27
|
+
}[];
|
|
28
|
+
} | {
|
|
29
|
+
numbers: {
|
|
30
|
+
field: string;
|
|
31
|
+
op: "gte";
|
|
32
|
+
value: number;
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* What a kind of material is normally expected to achieve in a kind of
|
|
37
|
+
* project. A typical expectation with its published source, never a code
|
|
38
|
+
* determination.
|
|
39
|
+
*/
|
|
40
|
+
export interface Baseline {
|
|
41
|
+
/** What it asks for, in a specifier's words. */
|
|
42
|
+
expects: string;
|
|
43
|
+
id: string;
|
|
44
|
+
note: string;
|
|
45
|
+
productTypeIds: string[];
|
|
46
|
+
sources: BaselineSource[];
|
|
47
|
+
/** The rooms it is for; null when it holds anywhere in the project. */
|
|
48
|
+
spaces: string[] | null;
|
|
49
|
+
strength: BaselineStrength;
|
|
50
|
+
/** A variant matching any one of these meets the baseline. */
|
|
51
|
+
waysToMeet: BaselineWayToMeet[];
|
|
52
|
+
}
|
|
53
|
+
/** Options for `listBaselines()` (GET `/api/v1/baselines`). */
|
|
54
|
+
export interface ListBaselinesOptions {
|
|
55
|
+
/** Keep baselines for these product types; omit for all. */
|
|
56
|
+
productTypeIds?: readonly string[];
|
|
57
|
+
/** A `sector` dictionary term that has baselines, e.g. `hospitality`. */
|
|
58
|
+
sector: string;
|
|
59
|
+
/** A room from the `use` dictionary, e.g. `corridor`. Omit for anywhere. */
|
|
60
|
+
space?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ListBaselinesResult {
|
|
63
|
+
baselines: Baseline[];
|
|
64
|
+
/** Show this wherever a baseline is shown. */
|
|
65
|
+
caveat: string;
|
|
66
|
+
sector: string;
|
|
67
|
+
space: string | null;
|
|
68
|
+
/** Rooms in this sector that have baselines of their own. */
|
|
69
|
+
spacesWithBaselines: string[];
|
|
70
|
+
}
|
|
71
|
+
/** Input for `checkBaselines()` (POST `/api/v1/baselines/check`). */
|
|
72
|
+
export interface CheckBaselinesInput {
|
|
73
|
+
sector: string;
|
|
74
|
+
space?: string;
|
|
75
|
+
/** 1 to 50 variant ids. */
|
|
76
|
+
variantIds: readonly string[];
|
|
77
|
+
}
|
|
78
|
+
/** `not_stated`: the brand states no value on that scale. A gap, never a fail. */
|
|
79
|
+
export type BaselineResult = OpenEnum<"matches" | "does_not_match" | "not_stated">;
|
|
80
|
+
export interface CheckBaselinesResult {
|
|
81
|
+
/** The baselines applied, each with how many variants fell under each result. */
|
|
82
|
+
baselines: (Baseline & {
|
|
83
|
+
counts: {
|
|
84
|
+
doesNotMatch: number;
|
|
85
|
+
matches: number;
|
|
86
|
+
notStated: number;
|
|
87
|
+
};
|
|
88
|
+
})[];
|
|
89
|
+
/** Show this wherever a result is shown. */
|
|
90
|
+
caveat: string;
|
|
91
|
+
sector: string;
|
|
92
|
+
space: string | null;
|
|
93
|
+
unavailableVariantIds?: string[];
|
|
94
|
+
unresolvedVariantIds?: string[];
|
|
95
|
+
variants: {
|
|
96
|
+
brand: string;
|
|
97
|
+
name: string;
|
|
98
|
+
product: string;
|
|
99
|
+
productType: string | null;
|
|
100
|
+
/** Empty: no baseline covers this product type here. */
|
|
101
|
+
results: {
|
|
102
|
+
baselineId: string;
|
|
103
|
+
result: BaselineResult;
|
|
104
|
+
/** What the brand states for the attributes the baseline reads. */
|
|
105
|
+
stated: {
|
|
106
|
+
attributeId: string;
|
|
107
|
+
value: string;
|
|
108
|
+
}[];
|
|
109
|
+
}[];
|
|
110
|
+
variantId: string;
|
|
111
|
+
}[];
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,7 +14,7 @@ const openStrings = new Set([
|
|
|
14
14
|
"MaterialTile.imageSource",
|
|
15
15
|
"PairingItem.availability",
|
|
16
16
|
"PairingItem.imageSource",
|
|
17
|
-
"PairingItem.demand.
|
|
17
|
+
"PairingItem.demand.trend",
|
|
18
18
|
"PairingItem.ranking.basis",
|
|
19
19
|
"PairingOrdering.anchorColorBasis",
|
|
20
20
|
"PairingOrdering.applied",
|
package/client-vocabulary.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ListBaselinesOptions, ListBaselinesResult } from "./baseline-types.js";
|
|
1
2
|
import type { HttpTransport } from "./http-transport.js";
|
|
2
3
|
import type { ListEnumValuesOptions, ListEnumValuesResult } from "./list-enum-values-types.js";
|
|
3
4
|
import type { ListAttributesOptions, ListAttributesResult, ResolveColorOptions, ResolveColorResponse } from "./types.js";
|
|
4
5
|
export declare const resolveColor: (transport: HttpTransport, name: string, signal?: AbortSignal, options?: ResolveColorOptions) => Promise<ResolveColorResponse>;
|
|
5
6
|
export declare const listAttributes: (transport: HttpTransport, options?: ListAttributesOptions, signal?: AbortSignal) => Promise<ListAttributesResult>;
|
|
6
7
|
export declare const listEnumValues: (transport: HttpTransport, options?: ListEnumValuesOptions, signal?: AbortSignal) => Promise<ListEnumValuesResult>;
|
|
8
|
+
export declare const listBaselines: (transport: HttpTransport, options: ListBaselinesOptions, signal?: AbortSignal) => Promise<ListBaselinesResult>;
|
package/client-vocabulary.js
CHANGED
|
@@ -28,3 +28,11 @@ export const listEnumValues = async (transport, options, signal) => await transp
|
|
|
28
28
|
},
|
|
29
29
|
signal,
|
|
30
30
|
});
|
|
31
|
+
export const listBaselines = async (transport, options, signal) => await transport.requestJson(resolveOperation("list_baselines"), {
|
|
32
|
+
query: {
|
|
33
|
+
productTypeIds: commaList(options.productTypeIds),
|
|
34
|
+
sector: options.sector,
|
|
35
|
+
space: options.space,
|
|
36
|
+
},
|
|
37
|
+
signal,
|
|
38
|
+
});
|
package/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ApplicabilityOptions, AssociatedOptions } from "./association-types.js";
|
|
2
|
+
import type { CheckBaselinesInput, CheckBaselinesResult, ListBaselinesOptions, ListBaselinesResult } from "./baseline-types.js";
|
|
2
3
|
import type { BrandsOptions } from "./brand-types.js";
|
|
3
4
|
import { CategoriesClient } from "./categories-client.js";
|
|
4
5
|
import type { MaterialGraphClientOptions } from "./client-config.js";
|
|
@@ -8,6 +9,7 @@ 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";
|
|
10
11
|
import type { FindVariantsByVectorInput, FindVariantsByVectorOutput } from "./find-variants-by-vector-types.js";
|
|
12
|
+
import type { GetVariantDemandInput, GetVariantDemandOutput, ListRisingVariantsInput, ListRisingVariantsOutput } from "./get-variant-demand-types.js";
|
|
11
13
|
import type { GetVariantOptions, GetVariantOutput } from "./get-variant-types.js";
|
|
12
14
|
import type { VariantId } from "./identifiers.js";
|
|
13
15
|
import type { ListEnumValuesOptions, ListEnumValuesResult } from "./list-enum-values-types.js";
|
|
@@ -113,6 +115,19 @@ export declare class MaterialGraphClient {
|
|
|
113
115
|
* never a guess. The submitted URL is never persisted.
|
|
114
116
|
*/
|
|
115
117
|
resolveVariant(input: ResolveVariantInput, signal?: AbortSignal): Promise<ResolveVariantOutput>;
|
|
118
|
+
/**
|
|
119
|
+
* How much each of 1 to 48 variants is sampled by Material Bank members
|
|
120
|
+
* (POST `/api/v1/demand`): `samplePercentile` within its category, with a
|
|
121
|
+
* `trend` and the `change` of this year against the year before. Results
|
|
122
|
+
* keep request order. No count is returned.
|
|
123
|
+
*/
|
|
124
|
+
getVariantDemand(input: GetVariantDemandInput, signal?: AbortSignal): Promise<GetVariantDemandOutput>;
|
|
125
|
+
/**
|
|
126
|
+
* The variants of one category sampled at least 15% more this year than
|
|
127
|
+
* the year before (GET `/api/v1/demand/rising`), largest `change` first.
|
|
128
|
+
* No count is returned.
|
|
129
|
+
*/
|
|
130
|
+
listRisingVariants(input: ListRisingVariantsInput, signal?: AbortSignal): Promise<ListRisingVariantsOutput>;
|
|
116
131
|
/**
|
|
117
132
|
* THE QUESTION: "tell me about THIS variant" (GET
|
|
118
133
|
* `/api/v1/variants/{variantId}`, `get_variant`).
|
|
@@ -229,9 +244,9 @@ export declare class MaterialGraphClient {
|
|
|
229
244
|
/**
|
|
230
245
|
* Every Sampled Together pair in the current generation (GET
|
|
231
246
|
* `/api/v1/variants/sampled-together/pairs`), trailing 36 months, sampled,
|
|
232
|
-
* each pair once with `a < b`. `
|
|
233
|
-
* own
|
|
234
|
-
* variant. Follow `nextCursor` until it is null; a page is not a total.
|
|
247
|
+
* each pair once with `a < b`. `packShare` is the pair's share of the rarer
|
|
248
|
+
* side's own sampled projects, so a sample pack can be dropped without one
|
|
249
|
+
* call per variant. Follow `nextCursor` until it is null; a page is not a total.
|
|
235
250
|
*/
|
|
236
251
|
listSampledTogetherPairs(input?: ListSampledTogetherPairsInput, signal?: AbortSignal): Promise<ListSampledTogetherPairsOutput>;
|
|
237
252
|
/**
|
|
@@ -269,6 +284,20 @@ export declare class MaterialGraphClient {
|
|
|
269
284
|
* `pageInfo.endCursor` for the next page.
|
|
270
285
|
*/
|
|
271
286
|
listEnumValues(options?: ListEnumValuesOptions, signal?: AbortSignal): Promise<ListEnumValuesResult>;
|
|
287
|
+
/**
|
|
288
|
+
* The Performance Baselines for a sector, and for a room within it when one
|
|
289
|
+
* is named: what a kind of material is normally expected to achieve, each
|
|
290
|
+
* with why it exists and its published source. Each `waysToMeet` entry is a
|
|
291
|
+
* `filters` value for {@link MaterialGraphClient.listVariants}. A typical
|
|
292
|
+
* expectation, never a code determination: show `caveat` with it.
|
|
293
|
+
*/
|
|
294
|
+
listBaselines(options: ListBaselinesOptions, signal?: AbortSignal): Promise<ListBaselinesResult>;
|
|
295
|
+
/**
|
|
296
|
+
* Up to 50 variants read against a sector's Performance Baselines. Each
|
|
297
|
+
* result is `matches`, `does_not_match` or `not_stated`, with what the brand
|
|
298
|
+
* states; `not_stated` is a gap in the data and never a failure.
|
|
299
|
+
*/
|
|
300
|
+
checkBaselines(input: CheckBaselinesInput, signal?: AbortSignal): Promise<CheckBaselinesResult>;
|
|
272
301
|
/**
|
|
273
302
|
* THE QUESTION: "what is this key allowed to do?" Check `scopes` before
|
|
274
303
|
* offering a capability: the write surfaces need `mg:ingest` / `mg:compose`,
|
package/client.js
CHANGED
|
@@ -2,7 +2,7 @@ import { applicability, declaredFinishes, declaredProducts, } from "./associatio
|
|
|
2
2
|
import { listBrands } from "./brands-client.js";
|
|
3
3
|
import { CategoriesClient } from "./categories-client.js";
|
|
4
4
|
import { DEFAULT_BASE_URL } from "./client-config.js";
|
|
5
|
-
import { listAttributes as listAttributesCall, listEnumValues as listEnumValuesCall, resolveColor as resolveColorCall, } from "./client-vocabulary.js";
|
|
5
|
+
import { listAttributes as listAttributesCall, listBaselines as listBaselinesCall, listEnumValues as listEnumValuesCall, resolveColor as resolveColorCall, } from "./client-vocabulary.js";
|
|
6
6
|
import { ColorsClient } from "./colors-client.js";
|
|
7
7
|
import { MaterialGraphError } from "./errors.js";
|
|
8
8
|
import { HttpTransport } from "./http-transport.js";
|
|
@@ -153,6 +153,30 @@ export class MaterialGraphClient {
|
|
|
153
153
|
signal,
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* How much each of 1 to 48 variants is sampled by Material Bank members
|
|
158
|
+
* (POST `/api/v1/demand`): `samplePercentile` within its category, with a
|
|
159
|
+
* `trend` and the `change` of this year against the year before. Results
|
|
160
|
+
* keep request order. No count is returned.
|
|
161
|
+
*/
|
|
162
|
+
async getVariantDemand(input, signal) {
|
|
163
|
+
return await this.#transport.requestJson(operation("get_variant_demand"), {
|
|
164
|
+
body: input,
|
|
165
|
+
signal,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The variants of one category sampled at least 15% more this year than
|
|
170
|
+
* the year before (GET `/api/v1/demand/rising`), largest `change` first.
|
|
171
|
+
* No count is returned.
|
|
172
|
+
*/
|
|
173
|
+
async listRisingVariants(input, signal) {
|
|
174
|
+
return await this.#get("list_rising_variants", {
|
|
175
|
+
category: input.category,
|
|
176
|
+
limit: input.limit === undefined ? undefined : String(input.limit),
|
|
177
|
+
projectType: input.projectType,
|
|
178
|
+
}, signal);
|
|
179
|
+
}
|
|
156
180
|
// ── Materials ──────────────────────────────────────────────────────────────
|
|
157
181
|
/**
|
|
158
182
|
* THE QUESTION: "tell me about THIS variant" (GET
|
|
@@ -355,9 +379,9 @@ export class MaterialGraphClient {
|
|
|
355
379
|
/**
|
|
356
380
|
* Every Sampled Together pair in the current generation (GET
|
|
357
381
|
* `/api/v1/variants/sampled-together/pairs`), trailing 36 months, sampled,
|
|
358
|
-
* each pair once with `a < b`. `
|
|
359
|
-
* own
|
|
360
|
-
* variant. Follow `nextCursor` until it is null; a page is not a total.
|
|
382
|
+
* each pair once with `a < b`. `packShare` is the pair's share of the rarer
|
|
383
|
+
* side's own sampled projects, so a sample pack can be dropped without one
|
|
384
|
+
* call per variant. Follow `nextCursor` until it is null; a page is not a total.
|
|
361
385
|
*/
|
|
362
386
|
async listSampledTogetherPairs(input = {}, signal) {
|
|
363
387
|
return await this.#get("list_sampled_together_pairs", {
|
|
@@ -412,6 +436,24 @@ export class MaterialGraphClient {
|
|
|
412
436
|
async listEnumValues(options, signal) {
|
|
413
437
|
return await listEnumValuesCall(this.#transport, options, signal);
|
|
414
438
|
}
|
|
439
|
+
/**
|
|
440
|
+
* The Performance Baselines for a sector, and for a room within it when one
|
|
441
|
+
* is named: what a kind of material is normally expected to achieve, each
|
|
442
|
+
* with why it exists and its published source. Each `waysToMeet` entry is a
|
|
443
|
+
* `filters` value for {@link MaterialGraphClient.listVariants}. A typical
|
|
444
|
+
* expectation, never a code determination: show `caveat` with it.
|
|
445
|
+
*/
|
|
446
|
+
async listBaselines(options, signal) {
|
|
447
|
+
return await listBaselinesCall(this.#transport, options, signal);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Up to 50 variants read against a sector's Performance Baselines. Each
|
|
451
|
+
* result is `matches`, `does_not_match` or `not_stated`, with what the brand
|
|
452
|
+
* states; `not_stated` is a gap in the data and never a failure.
|
|
453
|
+
*/
|
|
454
|
+
async checkBaselines(input, signal) {
|
|
455
|
+
return await this.#post("check_baselines", input, signal);
|
|
456
|
+
}
|
|
415
457
|
// Hard-specification search (formerly `bySpec()`) moved to
|
|
416
458
|
// {@link MaterialGraphClient.listVariants}
|
|
417
459
|
// (MG-2222): each `attribute:value` criterion is one `filters` condition —
|
|
@@ -37,6 +37,7 @@ export interface FindVariantsByColorInput {
|
|
|
37
37
|
cursor?: string;
|
|
38
38
|
/** Palette only: targets from this image's colors, not `colors[]`. */
|
|
39
39
|
image?: ImageReferenceInput;
|
|
40
|
+
/** Variants a page, 1 to 24 (a larger value is a 400). Omitted: 16 for contains and palette, every given id for rerank. */
|
|
40
41
|
limit?: number;
|
|
41
42
|
mode: FindVariantsByColorMode;
|
|
42
43
|
/** Independent specification type or group keys, e.g. wallcovering or coatings; filters specification types, not source categories. */
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module get-variant-demand-types
|
|
3
|
+
* @description Hand-maintained mirror of `get_variant_demand`'s and
|
|
4
|
+
* `list_rising_variants`' wire shapes.
|
|
5
|
+
* The source of truth is `packages/demand/src/contract.ts`; this SDK has
|
|
6
|
+
* no runtime dependency on `@materialgraph/demand`, so the shapes are copied
|
|
7
|
+
* here.
|
|
8
|
+
*/
|
|
9
|
+
import type { OpenEnum } from "./types.js";
|
|
10
|
+
export interface GetVariantDemandInput {
|
|
11
|
+
/** 1 to 48 variant ids. */
|
|
12
|
+
variantIds: string[];
|
|
13
|
+
/** One Material Bank project type; omit for every project type together. */
|
|
14
|
+
projectType?: string;
|
|
15
|
+
}
|
|
16
|
+
export type DemandTrend = OpenEnum<"rising" | "steady" | "falling">;
|
|
17
|
+
export type VariantDemand = {
|
|
18
|
+
state: "measured";
|
|
19
|
+
variantId: string;
|
|
20
|
+
/** The category the percentile is ranked within. */
|
|
21
|
+
category: string;
|
|
22
|
+
/** Share of the category's variants sampled as much or less, 1 to 100. */
|
|
23
|
+
samplePercentile: number;
|
|
24
|
+
/** Null when the year before cannot be shown. */
|
|
25
|
+
trend: DemandTrend | null;
|
|
26
|
+
/** This year against the year before; 0.4 is 40% more. Null with `trend`. */
|
|
27
|
+
change: number | null;
|
|
28
|
+
}
|
|
29
|
+
/** Too few members sampled it to show, or nobody did. */
|
|
30
|
+
| {
|
|
31
|
+
state: "not_shown";
|
|
32
|
+
variantId: string;
|
|
33
|
+
} | {
|
|
34
|
+
state: "unknown_variant";
|
|
35
|
+
variantId: string;
|
|
36
|
+
};
|
|
37
|
+
export interface GetVariantDemandOutput {
|
|
38
|
+
/** Last day of the measured year, as an ISO date. */
|
|
39
|
+
asOf: string;
|
|
40
|
+
basis: "measured";
|
|
41
|
+
source: string;
|
|
42
|
+
/** One reading per requested id, in request order, duplicates kept. */
|
|
43
|
+
results: VariantDemand[];
|
|
44
|
+
}
|
|
45
|
+
export interface ListRisingVariantsInput {
|
|
46
|
+
/** A MaterialGraph category id, such as `wallcovering`. */
|
|
47
|
+
category: string;
|
|
48
|
+
/** Variants to return, at most 100. Default 20. */
|
|
49
|
+
limit?: number;
|
|
50
|
+
/** One Material Bank project type; omit for every project type together. */
|
|
51
|
+
projectType?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface RisingVariant {
|
|
54
|
+
variantId: string;
|
|
55
|
+
/** Share of the category's variants sampled as much or less, 1 to 100. */
|
|
56
|
+
samplePercentile: number;
|
|
57
|
+
trend: DemandTrend | null;
|
|
58
|
+
/** This year against the year before; 0.4 is 40% more. */
|
|
59
|
+
change: number | null;
|
|
60
|
+
}
|
|
61
|
+
export interface ListRisingVariantsOutput {
|
|
62
|
+
/** Last day of the measured year, as an ISO date. */
|
|
63
|
+
asOf: string;
|
|
64
|
+
basis: "measured";
|
|
65
|
+
category: string;
|
|
66
|
+
/** Largest change first. */
|
|
67
|
+
results: RisingVariant[];
|
|
68
|
+
source: string;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/get-variant-types.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export interface GetVariantOutput {
|
|
|
59
59
|
}[];
|
|
60
60
|
attributes: Record<string, {
|
|
61
61
|
value: unknown;
|
|
62
|
-
valueSource: "brand" | "material_bank" | "measured" | "manual" | null;
|
|
62
|
+
valueSource: "brand" | "material_bank" | "measured" | "manual" | "inferred" | null;
|
|
63
63
|
wording: string | null;
|
|
64
64
|
level: "variant" | "product" | "brand";
|
|
65
65
|
}>;
|
package/index.d.ts
CHANGED
|
@@ -4,10 +4,12 @@ export type { MaterialGraphClientOptions } from "./client.js";
|
|
|
4
4
|
export type { FilterOp, FilterTermCondition, FilterNumericCondition, FilterPresenceCondition, FilterAnyFieldCondition, FilterCondition, FilterGroups, OptionalFilterGroups, OrderByEntry, ListVariantsInclude, ListVariantsCollapse, ColorRegion, ColorRangeCondition, ListVariantsInput, ListVariantsPreference, ListVariantsSpecifications, ListVariantsNotApplicable, SampleSizeObservation, VariantObservations, SampleSubject, ListVariantsItem, ListVariantsOutput, VariantCard, } from "./list-variants-types.js";
|
|
5
5
|
export type { ListVariantFacetsInput, VariantFacetValue, CategoricalVariantFacet, BooleanVariantFacet, NumericVariantFacet, VariantFacet, ListVariantFacetsOutput, } from "./list-variant-facets-types.js";
|
|
6
6
|
export type { SearchVariantsSelection, SearchVariantsInput, SearchVariantsUnderstood, SearchVariantsReading, SearchVariantsSuggestion, SearchVariantsChoice, SearchVariantsOutput, } from "./search-variants-types.js";
|
|
7
|
+
export type { Baseline, BaselineResult, BaselineSource, BaselineStrength, BaselineWayToMeet, CheckBaselinesInput, CheckBaselinesResult, ListBaselinesOptions, ListBaselinesResult, } from "./baseline-types.js";
|
|
7
8
|
export type { ListEnumValuesOptions, EnumValueMatch, EnumValueItem, ListEnumValuesResult, } from "./list-enum-values-types.js";
|
|
8
9
|
export type { GetVariantIfc, GetVariantOptions, GetVariantOutput, } from "./get-variant-types.js";
|
|
9
10
|
export type { ImageReferenceInput } from "./image-reference-types.js";
|
|
10
11
|
export type { SampledTogetherProjectType, FindSampledTogetherInput, FindSampledTogetherRow, FindSampledTogetherOutput, } from "./find-sampled-together-types.js";
|
|
12
|
+
export type { GetVariantDemandInput, GetVariantDemandOutput, DemandTrend, VariantDemand, ListRisingVariantsInput, ListRisingVariantsOutput, RisingVariant, } from "./get-variant-demand-types.js";
|
|
11
13
|
export type { ListSampledTogetherPairsInput, ListSampledTogetherPairsOutput, SampledTogetherPair, } from "./list-sampled-together-pairs-types.js";
|
|
12
14
|
export type { FindVariantsByColorMode, ColorConditionInput, FindVariantsByColorInput, ColorConditionReceipt, PaintCatalogVariant, ResolvedColor, ColorAlternative, UnresolvedColor, ColorVariantMatch, ColorPageInfo, FindVariantsByColorContainsResult, FindVariantsByColorPaletteResult, ColorRankedSeed, ColorRankMatch, ResolvedColorReference, CompareColorSimilarityReference, FindVariantsByColorRerankResult, FindVariantsByColorOutput, } from "./find-variants-by-color-types.js";
|
|
13
15
|
export { FIND_VARIANTS_BY_VECTOR_MODES } from "./find-variants-by-vector-types.js";
|
|
@@ -18,7 +20,7 @@ export type { OpaqueId, VariantId, ProductId, BatchId, SourceFileId, ProjectId,
|
|
|
18
20
|
export type { FileInput, UploadSourceMaterialInput, SourceMaterialReceiptFile, SourceMaterialBatchReceipt, } from "./source-material-types.js";
|
|
19
21
|
export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
|
|
20
22
|
export type { MaterialGraphErrorInit, MaterialGraphErrorKind, MaterialGraphRequestMetadata, ProblemDetail, RateLimit, SanitizedErrorValue, SanitizedIssue, SimpleErrorBody, } from "./errors.js";
|
|
21
|
-
export type { OpenEnum, JsonValue, OklabTriple, MaterialColor, ImageSource, MaterialAvailability, MaterialTile,
|
|
23
|
+
export type { OpenEnum, JsonValue, OklabTriple, MaterialColor, ImageSource, MaterialAvailability, MaterialTile, 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
24
|
export type { ResolveVariantInput, ResolveVariantSubject, ResolveVariantEvidence, ResolveVariantReceipt, ResolveVariantUnresolvedReason, ResolveVariantOutput, } from "./resolve-variant-types.js";
|
|
23
25
|
export { CategoriesClient } from "./categories-client.js";
|
|
24
26
|
export type { CategoryRef, CategoryKind, CategoryMatch, CategoryItem, CategoriesPageInfo, CategoriesListInput, CategoriesListResult, CategoryConcept, CategoryProductCategory, CategoriesGetResult, } from "./category-types.js";
|
|
@@ -22,9 +22,11 @@ export interface SampledTogetherPair {
|
|
|
22
22
|
/** Above 1 is sampled together more often than chance. */
|
|
23
23
|
lift: number;
|
|
24
24
|
lastSampledTogetherAt: string | null;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The pair's projects as a share of the rarer side's own sampled projects,
|
|
27
|
+
* 0 to 1. Near 1 is a sample pack. Null when either side has no total.
|
|
28
|
+
*/
|
|
29
|
+
packShare: number | null;
|
|
28
30
|
}
|
|
29
31
|
export interface ListSampledTogetherPairsOutput {
|
|
30
32
|
window: "trailing_36mo";
|
|
@@ -32,8 +34,6 @@ export interface ListSampledTogetherPairsOutput {
|
|
|
32
34
|
windowStart: string | null;
|
|
33
35
|
/** How fresh the pair evidence is. */
|
|
34
36
|
windowEnd: string | null;
|
|
35
|
-
/** End of the window the per-side totals were counted over. */
|
|
36
|
-
projectTotalsWindowEnd: string | null;
|
|
37
37
|
pairs: SampledTogetherPair[];
|
|
38
38
|
nextCursor: string | null;
|
|
39
39
|
}
|
package/list-variants-types.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export interface ListVariantsInput {
|
|
|
137
137
|
/** Every condition, across `terms`/`numbers`/`presence`/`anyField`, must match. */
|
|
138
138
|
filters?: FilterGroups;
|
|
139
139
|
include?: ListVariantsInclude[];
|
|
140
|
-
/** 1–50; defaults to 10. */
|
|
140
|
+
/** 1–50; defaults to 10. The most a page holds: a page also stops at 64 KB, so wide rows (`include`, many `attributes`) can end it early with `hasNextPage` true. Follow `endCursor` until it is false, even for a `variant in` list of 50 ids or fewer. */
|
|
141
141
|
limit?: number;
|
|
142
142
|
/**
|
|
143
143
|
* Find by name (MG-2222): every word must start a word of the product or
|
|
@@ -163,7 +163,7 @@ export interface ListVariantsInput {
|
|
|
163
163
|
*/
|
|
164
164
|
export interface ListVariantsPreference {
|
|
165
165
|
looks?: {
|
|
166
|
-
by: ("named" | "stated" | "described")[];
|
|
166
|
+
by: ("named" | "stated" | "described" | "related")[];
|
|
167
167
|
index: number;
|
|
168
168
|
words?: string;
|
|
169
169
|
}[];
|
|
@@ -272,6 +272,7 @@ export interface ListVariantsOutput {
|
|
|
272
272
|
matched: boolean;
|
|
273
273
|
word: string;
|
|
274
274
|
}[];
|
|
275
|
+
/** `hasNextPage` true means more rows remain, including a requested `variant in` id not on this page; it is never in the id lists below until its page is read. */
|
|
275
276
|
pageInfo: {
|
|
276
277
|
endCursor: string | null;
|
|
277
278
|
hasNextPage: boolean;
|
|
@@ -56,7 +56,7 @@ export interface MaterialBlockProjectionField {
|
|
|
56
56
|
attributeId: string;
|
|
57
57
|
label: string;
|
|
58
58
|
value: MaterialBlockFieldValue;
|
|
59
|
-
/** The value
|
|
59
|
+
/** The value in words, as the product page shows it: a term by its label, a measurement with its unit, a composition by its ingredients and shares. Absent when the field holds nothing; `value` stays the canonical form. */
|
|
60
60
|
displayValue?: string;
|
|
61
61
|
unit?: string;
|
|
62
62
|
status: MaterialBlockFieldStatus;
|
package/operation-responses.d.ts
CHANGED
|
@@ -1,5 +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
|
+
import type { CheckBaselinesResult, ListBaselinesResult } from "./baseline-types.js";
|
|
3
4
|
import type { ListBrandsPage } from "./brand-types.js";
|
|
4
5
|
import type { CategoriesGetResult, CategoriesListResult } from "./category-types.js";
|
|
5
6
|
import type { CategoryColorProfilesResponse } from "./color-profiles-types.js";
|
|
@@ -7,6 +8,7 @@ import type { DiscoveryReference, DiscoveryTerms, ColorlessVariantsResult, Varia
|
|
|
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";
|
|
11
|
+
import type { GetVariantDemandOutput, ListRisingVariantsOutput } from "./get-variant-demand-types.js";
|
|
10
12
|
import type { GetVariantOutput } from "./get-variant-types.js";
|
|
11
13
|
import type { ListEnumValuesResult } from "./list-enum-values-types.js";
|
|
12
14
|
import type { ListSampledTogetherPairsOutput } from "./list-sampled-together-pairs-types.js";
|
|
@@ -21,6 +23,8 @@ import type { SearchVariantsOutput } from "./search-variants-types.js";
|
|
|
21
23
|
import type { SourceMaterialBatchReceipt } from "./source-material-types.js";
|
|
22
24
|
import type { ExtractPaletteResponse, ListAttributesResult, PairingsResponse, ResolveColorResponse, WhoamiResponse } from "./types.js";
|
|
23
25
|
export interface OperationResponses {
|
|
26
|
+
check_baselines: CheckBaselinesResult;
|
|
27
|
+
list_baselines: ListBaselinesResult;
|
|
24
28
|
get_discovery_reference: DiscoveryReference;
|
|
25
29
|
interpret_discovery_terms: DiscoveryTerms;
|
|
26
30
|
find_colorless_variants: ColorlessVariantsResult;
|
|
@@ -33,6 +37,8 @@ export interface OperationResponses {
|
|
|
33
37
|
catalog_list_enum_values: ListEnumValuesResult;
|
|
34
38
|
extract_image_palette: ExtractPaletteResponse;
|
|
35
39
|
find_sampled_together: FindSampledTogetherOutput;
|
|
40
|
+
get_variant_demand: GetVariantDemandOutput;
|
|
41
|
+
list_rising_variants: ListRisingVariantsOutput;
|
|
36
42
|
list_sampled_together_pairs: ListSampledTogetherPairsOutput;
|
|
37
43
|
find_variants_by_color: FindVariantsByColorOutput;
|
|
38
44
|
find_variants_by_vector: FindVariantsByVectorOutput;
|
|
@@ -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 ["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"]];
|
|
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 ["getVariantDemand", "POST", "/api/v1/demand", "get_variant_demand"], readonly ["listRisingVariants", "GET", "/api/v1/demand/rising", "list_rising_variants"], 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 ["listBaselines", "GET", "/api/v1/baselines", "list_baselines"], readonly ["checkBaselines", "POST", "/api/v1/baselines/check", "check_baselines"], 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
|
@@ -112,6 +112,13 @@ const OPERATION_DEFINITIONS = [
|
|
|
112
112
|
"/api/v1/variants/sampled-together/pairs",
|
|
113
113
|
"list_sampled_together_pairs",
|
|
114
114
|
],
|
|
115
|
+
["getVariantDemand", "POST", "/api/v1/demand", "get_variant_demand"],
|
|
116
|
+
[
|
|
117
|
+
"listRisingVariants",
|
|
118
|
+
"GET",
|
|
119
|
+
"/api/v1/demand/rising",
|
|
120
|
+
"list_rising_variants",
|
|
121
|
+
],
|
|
115
122
|
["resolveVariant", "POST", "/api/v1/variants/resolve", "resolve_variant"],
|
|
116
123
|
["getVariant", "GET", "/api/v1/variants/{variantId}", "get_variant"],
|
|
117
124
|
[
|
|
@@ -132,6 +139,8 @@ const OPERATION_DEFINITIONS = [
|
|
|
132
139
|
"/api/v1/catalog/enum-values",
|
|
133
140
|
"catalog_list_enum_values",
|
|
134
141
|
],
|
|
142
|
+
["listBaselines", "GET", "/api/v1/baselines", "list_baselines"],
|
|
143
|
+
["checkBaselines", "POST", "/api/v1/baselines/check", "check_baselines"],
|
|
135
144
|
["categories.list", "GET", "/api/v1/categories", "list_categories"],
|
|
136
145
|
["categories.get", "GET", "/api/v1/categories/{id}", "get_category"],
|
|
137
146
|
["whoami", "GET", "/api/v1/whoami", "whoami"],
|
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", "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"];
|
|
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", "get_variant_demand", "list_rising_variants", "resolve_variant", "get_variant", "resolve_color_name", "catalog_list_attributes", "catalog_list_enum_values", "list_baselines", "check_baselines", "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;
|