@instruments/materialgraph 0.24.0 → 0.26.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 +20 -20
- package/associations-client.d.ts +4 -4
- package/associations-client.js +3 -10
- package/attribution-types.d.ts +3 -3
- package/brand-most-sampled-types.d.ts +4 -4
- package/brand-types.d.ts +6 -6
- package/brands-client.d.ts +4 -4
- package/brands-client.js +9 -13
- package/browse-types.d.ts +8 -8
- package/by-colour-types.d.ts +18 -18
- package/by-spec-types.d.ts +14 -14
- package/catalog-discovery-types.d.ts +14 -14
- package/catalogue-client.d.ts +4 -4
- package/catalogue-client.js +38 -37
- package/catalogue-types.d.ts +4 -4
- package/citation-types.d.ts +4 -4
- package/client-browse.d.ts +4 -4
- package/client-browse.js +24 -25
- package/client-config.d.ts +2 -2
- package/client-exploration.d.ts +3 -3
- package/client-exploration.js +4 -6
- package/client-source-material-comments.d.ts +4 -4
- package/client-source-material-comments.js +4 -38
- package/client-vocabulary.d.ts +8 -8
- package/client-vocabulary.js +20 -30
- package/client.d.ts +11 -45
- package/client.js +143 -188
- package/codes-client.d.ts +2 -2
- package/codes-client.js +8 -8
- package/codes-types.d.ts +34 -34
- package/colour-aggregate-types.d.ts +24 -24
- package/colours-client.d.ts +2 -2
- package/colours-client.js +15 -15
- package/compare-types.d.ts +10 -10
- package/composition-client.d.ts +3 -3
- package/composition-client.js +8 -7
- package/composition-types.d.ts +12 -12
- 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/correction-types.d.ts +10 -10
- package/demand-batch-types.d.ts +18 -18
- package/demand-types.d.ts +24 -24
- package/errors.d.ts +12 -12
- package/errors.js +53 -52
- package/exploration-types.d.ts +29 -22
- package/fan-deck-types.d.ts +6 -6
- package/http-transport.d.ts +13 -21
- package/http-transport.js +31 -28
- package/identify-types.d.ts +10 -10
- package/index.d.ts +0 -6
- package/index.js +0 -2
- package/match-rejection-types.d.ts +6 -6
- package/match-stream-types.d.ts +32 -32
- package/match-stream.d.ts +2 -2
- package/match-stream.js +55 -41
- package/match-types.d.ts +8 -8
- package/material-asset-types.d.ts +26 -26
- package/material-block-types.d.ts +6 -6
- package/material-query-plan-types.d.ts +26 -26
- package/material-resources-client.d.ts +5 -5
- package/material-resources-client.js +10 -20
- package/material-types.d.ts +12 -12
- package/ndjson.js +16 -8
- package/operations.d.ts +6 -6
- package/operations.js +9 -39
- package/package.json +2 -2
- package/palette-completion-types.d.ts +22 -22
- package/palette-search-types.d.ts +28 -28
- package/query-understanding-types.d.ts +43 -36
- package/render-assets-types.d.ts +8 -8
- package/resolve-client.d.ts +2 -2
- package/resolve-client.js +4 -6
- package/resolve-colour-types.d.ts +22 -6
- package/resolve-types.d.ts +10 -10
- package/run-types.d.ts +70 -70
- package/runs.d.ts +13 -26
- package/runs.js +77 -89
- 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 +38 -38
- package/schema-resource-types.js +5 -5
- package/search-card-types.d.ts +14 -5
- package/search-collapse-types.d.ts +4 -4
- package/search-mood-types.d.ts +2 -2
- package/search-refinement-types.d.ts +8 -8
- package/search-request-types.d.ts +6 -6
- package/search-response-receipt-types.d.ts +135 -34
- package/search-response-types.d.ts +2 -2
- package/search-result-validation.d.ts +3 -3
- package/search-result-validation.js +53 -36
- package/search-window-types.d.ts +2 -2
- package/slot-pool-types.d.ts +20 -20
- package/source-material-validation.d.ts +3 -3
- package/source-material-validation.js +35 -39
- package/spec-facet-types.d.ts +10 -10
- package/spec-types.d.ts +6 -6
- package/specifications.d.ts +9 -25
- package/specifications.js +15 -21
- package/sse.d.ts +2 -2
- package/sse.js +32 -16
- package/substitute-types.d.ts +22 -22
- package/suggest-types.d.ts +7 -7
- package/suggest-types.js +3 -3
- package/taxonomy-coverage-types.d.ts +8 -8
- package/types.d.ts +119 -119
- package/validation.d.ts +26 -26
- package/validation.js +97 -92
- package/webmcp.d.ts +2 -2
- package/webmcp.generated.js +94 -87
- 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/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/sse.js
CHANGED
|
@@ -26,13 +26,15 @@ export class SseDecoder {
|
|
|
26
26
|
const frames = [];
|
|
27
27
|
for (;;) {
|
|
28
28
|
const lineEnd = this.#nextLineEnd();
|
|
29
|
-
if (lineEnd === null)
|
|
29
|
+
if (lineEnd === null) {
|
|
30
30
|
break;
|
|
31
|
+
}
|
|
31
32
|
const line = this.#buffer.slice(0, lineEnd.index);
|
|
32
33
|
this.#buffer = this.#buffer.slice(lineEnd.nextIndex);
|
|
33
34
|
const frame = this.#consumeLine(line);
|
|
34
|
-
if (frame)
|
|
35
|
+
if (frame) {
|
|
35
36
|
frames.push(frame);
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
return frames;
|
|
38
40
|
}
|
|
@@ -45,8 +47,9 @@ export class SseDecoder {
|
|
|
45
47
|
: this.#buffer;
|
|
46
48
|
this.#buffer = "";
|
|
47
49
|
const frame = this.#consumeLine(line);
|
|
48
|
-
if (frame)
|
|
50
|
+
if (frame) {
|
|
49
51
|
return [frame];
|
|
52
|
+
}
|
|
50
53
|
}
|
|
51
54
|
const frame = this.#dispatch();
|
|
52
55
|
return frame ? [frame] : [];
|
|
@@ -55,11 +58,13 @@ export class SseDecoder {
|
|
|
55
58
|
#nextLineEnd() {
|
|
56
59
|
for (let i = 0; i < this.#buffer.length; i += 1) {
|
|
57
60
|
const char = this.#buffer[i];
|
|
58
|
-
if (char === "\n")
|
|
61
|
+
if (char === "\n") {
|
|
59
62
|
return { index: i, nextIndex: i + 1 };
|
|
63
|
+
}
|
|
60
64
|
if (char === "\r") {
|
|
61
|
-
if (i === this.#buffer.length - 1)
|
|
65
|
+
if (i === this.#buffer.length - 1) {
|
|
62
66
|
return null;
|
|
67
|
+
}
|
|
63
68
|
return this.#buffer[i + 1] === "\n"
|
|
64
69
|
? { index: i, nextIndex: i + 2 }
|
|
65
70
|
: { index: i, nextIndex: i + 1 };
|
|
@@ -68,15 +73,18 @@ export class SseDecoder {
|
|
|
68
73
|
return null;
|
|
69
74
|
}
|
|
70
75
|
#consumeLine(line) {
|
|
71
|
-
if (line.length === 0)
|
|
76
|
+
if (line.length === 0) {
|
|
72
77
|
return this.#dispatch();
|
|
73
|
-
|
|
78
|
+
}
|
|
79
|
+
if (line.startsWith(":")) {
|
|
74
80
|
return undefined;
|
|
81
|
+
}
|
|
75
82
|
const colon = line.indexOf(":");
|
|
76
83
|
const field = colon === -1 ? line : line.slice(0, colon);
|
|
77
84
|
let value = colon === -1 ? "" : line.slice(colon + 1);
|
|
78
|
-
if (value.startsWith(" "))
|
|
85
|
+
if (value.startsWith(" ")) {
|
|
79
86
|
value = value.slice(1);
|
|
87
|
+
}
|
|
80
88
|
if (field === "data") {
|
|
81
89
|
this.#dataLines.push(value);
|
|
82
90
|
this.#hasFields = true;
|
|
@@ -92,13 +100,16 @@ export class SseDecoder {
|
|
|
92
100
|
return undefined;
|
|
93
101
|
}
|
|
94
102
|
#dispatch() {
|
|
95
|
-
if (!this.#hasFields)
|
|
103
|
+
if (!this.#hasFields) {
|
|
96
104
|
return undefined;
|
|
105
|
+
}
|
|
97
106
|
const frame = { data: this.#dataLines.join("\n") };
|
|
98
|
-
if (this.#event !== undefined)
|
|
107
|
+
if (this.#event !== undefined) {
|
|
99
108
|
frame.event = this.#event;
|
|
100
|
-
|
|
109
|
+
}
|
|
110
|
+
if (this.#id !== undefined) {
|
|
101
111
|
frame.id = this.#id;
|
|
112
|
+
}
|
|
102
113
|
this.#dataLines = [];
|
|
103
114
|
this.#event = undefined;
|
|
104
115
|
this.#id = undefined;
|
|
@@ -117,28 +128,33 @@ export async function* readSseFrames(body, signal) {
|
|
|
117
128
|
const sse = new SseDecoder();
|
|
118
129
|
try {
|
|
119
130
|
for (;;) {
|
|
120
|
-
if (signal?.aborted)
|
|
131
|
+
if (signal?.aborted) {
|
|
121
132
|
return;
|
|
133
|
+
}
|
|
122
134
|
let result;
|
|
123
135
|
try {
|
|
124
136
|
result = await reader.read();
|
|
125
137
|
}
|
|
126
138
|
catch (error) {
|
|
127
|
-
if (signal?.aborted)
|
|
139
|
+
if (signal?.aborted) {
|
|
128
140
|
return;
|
|
141
|
+
}
|
|
129
142
|
throw error;
|
|
130
143
|
}
|
|
131
144
|
if (result.done) {
|
|
132
|
-
for (const frame of sse.push(decoder.decode()))
|
|
145
|
+
for (const frame of sse.push(decoder.decode())) {
|
|
133
146
|
yield frame;
|
|
134
|
-
|
|
147
|
+
}
|
|
148
|
+
for (const frame of sse.flush()) {
|
|
135
149
|
yield frame;
|
|
150
|
+
}
|
|
136
151
|
return;
|
|
137
152
|
}
|
|
138
153
|
const text = decoder.decode(result.value, { stream: true });
|
|
139
154
|
for (const frame of sse.push(text)) {
|
|
140
|
-
if (signal?.aborted)
|
|
155
|
+
if (signal?.aborted) {
|
|
141
156
|
return;
|
|
157
|
+
}
|
|
142
158
|
yield frame;
|
|
143
159
|
}
|
|
144
160
|
}
|
package/substitute-types.d.ts
CHANGED
|
@@ -2,40 +2,40 @@ import type { BySpecVerdict } from "./by-spec-types.js";
|
|
|
2
2
|
import type { VariantId } from "./identifiers.js";
|
|
3
3
|
import type { MaterialSuccessor } from "./material-types.js";
|
|
4
4
|
export type SubstituteSignatureFamily = "textile" | "tile" | "coating" | "lighting_electrical" | "acoustic" | "surface" | "furniture" | "sanitaryware" | "fittings" | "architectural_hardware";
|
|
5
|
-
export
|
|
5
|
+
export type SubstituteSignatureCriterion = {
|
|
6
6
|
role: "primary_material" | "performance";
|
|
7
7
|
attributeId: string;
|
|
8
8
|
term: string;
|
|
9
|
-
}
|
|
10
|
-
export
|
|
9
|
+
};
|
|
10
|
+
export type AvailableSubstituteSignature = {
|
|
11
11
|
family: SubstituteSignatureFamily;
|
|
12
12
|
form: string;
|
|
13
13
|
criteria: [SubstituteSignatureCriterion, SubstituteSignatureCriterion];
|
|
14
|
-
}
|
|
15
|
-
export
|
|
14
|
+
};
|
|
15
|
+
export type UnsupportedSubstituteSignature = {
|
|
16
16
|
family: SubstituteSignatureFamily;
|
|
17
17
|
form: string;
|
|
18
18
|
reason: string;
|
|
19
|
-
}
|
|
20
|
-
export
|
|
19
|
+
};
|
|
20
|
+
export type InsufficientSubstituteSignature = {
|
|
21
21
|
family: SubstituteSignatureFamily;
|
|
22
22
|
form: string;
|
|
23
23
|
missingRoles: ("primary_material" | "performance")[];
|
|
24
|
-
}
|
|
25
|
-
export
|
|
24
|
+
};
|
|
25
|
+
export type FindSubstitutesOptions = {
|
|
26
26
|
excludeBrands?: string[];
|
|
27
27
|
diversityBoost?: number;
|
|
28
28
|
limit?: number;
|
|
29
29
|
cursor?: string;
|
|
30
30
|
includeSamplingArtifacts?: boolean;
|
|
31
31
|
includeUnavailable?: boolean;
|
|
32
|
-
}
|
|
33
|
-
export
|
|
32
|
+
};
|
|
33
|
+
export type SubstituteMatchedCriterion = {
|
|
34
34
|
attributeId: string;
|
|
35
35
|
confidence: number | null;
|
|
36
36
|
sourceBasis: string | null;
|
|
37
|
-
}
|
|
38
|
-
export
|
|
37
|
+
};
|
|
38
|
+
export type SubstituteResultItem = {
|
|
39
39
|
variantId: VariantId;
|
|
40
40
|
brandSlug: string;
|
|
41
41
|
brand: string;
|
|
@@ -50,8 +50,8 @@ export interface SubstituteResultItem {
|
|
|
50
50
|
diversityAdjustment: number;
|
|
51
51
|
score: number;
|
|
52
52
|
verdict: BySpecVerdict;
|
|
53
|
-
}
|
|
54
|
-
export
|
|
53
|
+
};
|
|
54
|
+
export type AvailableSubstitutesResponse = {
|
|
55
55
|
status: "available";
|
|
56
56
|
signatureUsed: AvailableSubstituteSignature;
|
|
57
57
|
items: SubstituteResultItem[];
|
|
@@ -69,7 +69,7 @@ export interface AvailableSubstitutesResponse {
|
|
|
69
69
|
poolTruncated: boolean;
|
|
70
70
|
supersededBy: MaterialSuccessor | null;
|
|
71
71
|
nextCursor?: string;
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
/**
|
|
74
74
|
* MG-1686. The search read a bounded window of the matches and nothing in it
|
|
75
75
|
* reached the page, while more matches existed past the window. It is not an
|
|
@@ -77,7 +77,7 @@ export interface AvailableSubstitutesResponse {
|
|
|
77
77
|
* empty `items`. `reason` names what happened and the next move; follow
|
|
78
78
|
* `nextCursor` when it is present.
|
|
79
79
|
*/
|
|
80
|
-
export
|
|
80
|
+
export type InconclusiveSubstitutesResponse = {
|
|
81
81
|
status: "inconclusive";
|
|
82
82
|
signatureUsed: AvailableSubstituteSignature;
|
|
83
83
|
items: [];
|
|
@@ -86,17 +86,17 @@ export interface InconclusiveSubstitutesResponse {
|
|
|
86
86
|
reason: string;
|
|
87
87
|
supersededBy: MaterialSuccessor | null;
|
|
88
88
|
nextCursor?: string;
|
|
89
|
-
}
|
|
90
|
-
export
|
|
89
|
+
};
|
|
90
|
+
export type UnsupportedSubstitutesResponse = {
|
|
91
91
|
status: "unsupported";
|
|
92
92
|
signature: UnsupportedSubstituteSignature;
|
|
93
93
|
items: [];
|
|
94
94
|
supersededBy: MaterialSuccessor | null;
|
|
95
|
-
}
|
|
96
|
-
export
|
|
95
|
+
};
|
|
96
|
+
export type InsufficientSubstitutesResponse = {
|
|
97
97
|
status: "insufficient_signature";
|
|
98
98
|
signature: InsufficientSubstituteSignature;
|
|
99
99
|
items: [];
|
|
100
100
|
supersededBy: MaterialSuccessor | null;
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
export type FindSubstitutesResponse = AvailableSubstitutesResponse | InconclusiveSubstitutesResponse | UnsupportedSubstitutesResponse | InsufficientSubstitutesResponse;
|
package/suggest-types.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type SuggestKind = "product" | "brand" | "category";
|
|
|
18
18
|
/** How the query met the suggestion's label. Strongest first. */
|
|
19
19
|
export type SuggestMatch = "prefix" | "word" | "contains" | "fuzzy";
|
|
20
20
|
/** One ranked typeahead suggestion, carrying the identity it resolves to. */
|
|
21
|
-
export
|
|
21
|
+
export type Suggestion = {
|
|
22
22
|
kind: SuggestKind;
|
|
23
23
|
/** The entity's name as written, for display. */
|
|
24
24
|
label: string;
|
|
@@ -38,25 +38,25 @@ export interface Suggestion {
|
|
|
38
38
|
variantId: string | null;
|
|
39
39
|
/** Variants behind this entity IN MATERIALGRAPH — a coverage figure. */
|
|
40
40
|
variantCount: number;
|
|
41
|
-
}
|
|
41
|
+
};
|
|
42
42
|
/** The suggest response: the query as interpreted, plus the ranked suggestions. */
|
|
43
|
-
export
|
|
43
|
+
export type SuggestResponse = {
|
|
44
44
|
/** The normalised query the corpus was matched against. */
|
|
45
45
|
query: string;
|
|
46
46
|
/** Ranked best-match-first. Empty when nothing came close — a miss, not an error. */
|
|
47
47
|
suggestions: Suggestion[];
|
|
48
48
|
/** Present only when a narrowing governed corpus was applied. */
|
|
49
49
|
corpusScope?: CorpusScopeReceipt;
|
|
50
|
-
}
|
|
50
|
+
};
|
|
51
51
|
/** Options for {@link MaterialGraphClient.suggest}. */
|
|
52
|
-
export
|
|
52
|
+
export type SuggestOptions = {
|
|
53
53
|
/** How many suggestions to return (1–20, default 8). */
|
|
54
54
|
limit?: number;
|
|
55
55
|
/** Restrict to these kinds. Omit for all of them. */
|
|
56
56
|
kind?: SuggestKind | SuggestKind[];
|
|
57
57
|
/** Governed corpus membership; absent means the whole graph. */
|
|
58
58
|
corpusScope?: CorpusScope;
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
60
|
/**
|
|
61
61
|
* Shape the query string for a suggest call.
|
|
62
62
|
*
|
|
@@ -65,7 +65,7 @@ export interface SuggestOptions {
|
|
|
65
65
|
* here rather than being sent as repeated `?kind=` pairs the route would ignore.
|
|
66
66
|
* Undefined members are dropped by the transport.
|
|
67
67
|
*/
|
|
68
|
-
export declare
|
|
68
|
+
export declare const suggestQuery: (q: string, options?: SuggestOptions) => {
|
|
69
69
|
q: string;
|
|
70
70
|
limit?: number;
|
|
71
71
|
kind?: string;
|
package/suggest-types.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
* here rather than being sent as repeated `?kind=` pairs the route would ignore.
|
|
21
21
|
* Undefined members are dropped by the transport.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export const suggestQuery = (q, options) => {
|
|
24
24
|
const kind = Array.isArray(options?.kind)
|
|
25
25
|
? options.kind.join(",")
|
|
26
26
|
: options?.kind;
|
|
27
|
-
return {
|
|
28
|
-
}
|
|
27
|
+
return { corpusScope: options?.corpusScope, kind, limit: options?.limit, q };
|
|
28
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Exact, source-path-grained status coverage for primary product typing. */
|
|
2
|
-
export
|
|
2
|
+
export type ProductTypeStatusCoverageCounts = {
|
|
3
3
|
variants: number;
|
|
4
4
|
accepted: number;
|
|
5
5
|
proposed: number;
|
|
@@ -8,13 +8,13 @@ export interface ProductTypeStatusCoverageCounts {
|
|
|
8
8
|
proposedUnknownConfidence: number;
|
|
9
9
|
otherStatus: number;
|
|
10
10
|
missingPrimary: number;
|
|
11
|
-
}
|
|
12
|
-
export
|
|
11
|
+
};
|
|
12
|
+
export type ProductTypeStatusCoverageSourcePath = {
|
|
13
13
|
/** Complete stored source path; null means the product retained no path. */
|
|
14
14
|
sourcePath: string | null;
|
|
15
|
-
}
|
|
15
|
+
} & ProductTypeStatusCoverageCounts;
|
|
16
16
|
/** Current primary-assignment coverage, never an inferred acceptance decision. */
|
|
17
|
-
export
|
|
17
|
+
export type ProductTypeStatusCoverage = {
|
|
18
18
|
computedAt: string;
|
|
19
19
|
basis: {
|
|
20
20
|
count: "exact";
|
|
@@ -26,9 +26,9 @@ export interface ProductTypeStatusCoverage {
|
|
|
26
26
|
};
|
|
27
27
|
totals: ProductTypeStatusCoverageCounts;
|
|
28
28
|
sourcePaths: ProductTypeStatusCoverageSourcePath[];
|
|
29
|
-
}
|
|
30
|
-
export
|
|
29
|
+
};
|
|
30
|
+
export type ProductTypeCoverageOptions = {
|
|
31
31
|
[key: string]: number | undefined;
|
|
32
32
|
/** Reporting cutoff in [0,1], default 0.85; it never accepts a proposal. */
|
|
33
33
|
comparisonThreshold?: number;
|
|
34
|
-
}
|
|
34
|
+
};
|