@instruments/materialgraph 0.28.0 → 0.30.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/brands-client.d.ts +1 -1
- package/by-colour-types.d.ts +4 -4
- package/catalogue-client.d.ts +3 -3
- package/catalogue-client.js +3 -3
- package/catalogue-types.d.ts +1 -1
- package/client-vocabulary.d.ts +3 -5
- package/client-vocabulary.js +9 -6
- package/client.d.ts +73 -174
- package/client.js +85 -211
- package/colour-region-types.d.ts +18 -0
- package/colours-client.d.ts +10 -83
- package/colours-client.js +1 -85
- package/find-variants-by-colour-types.d.ts +197 -0
- package/find-variants-by-vector-types.d.ts +67 -0
- package/find-variants-by-vector-types.js +5 -0
- package/get-variant-types.d.ts +50 -0
- package/get-variant-types.js +10 -0
- package/identifiers.d.ts +1 -1
- package/identifiers.js +1 -1
- package/image-reference-types.d.ts +18 -0
- package/index.d.ts +8 -7
- package/index.js +1 -1
- package/list-enum-values-types.d.ts +58 -0
- package/list-variants-types.d.ts +6 -2
- package/material-asset-types.d.ts +4 -3
- package/material-types.d.ts +11 -150
- package/operations.d.ts +1 -1
- package/operations.js +26 -88
- package/package.json +1 -1
- package/palette-search-types.d.ts +3 -49
- package/resolve-colour-types.d.ts +5 -5
- package/resolve-variant-types.d.ts +75 -0
- package/{identify-types.js → resolve-variant-types.js} +2 -2
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +45 -84
- package/run-types.d.ts +23 -216
- package/runs.d.ts +10 -58
- package/runs.js +19 -106
- package/schema-resource-types.d.ts +2 -139
- package/schema-resource-types.js +0 -8
- package/search-card-types.d.ts +1 -1
- package/search-index-plan-types.d.ts +4 -1
- package/search-request-types.d.ts +10 -2
- package/spec-types.d.ts +4 -4
- package/spec-types.js +2 -2
- package/sse.d.ts +2 -2
- package/sse.js +2 -2
- package/types.d.ts +4 -38
- package/webmcp.generated.js +3 -3
- package/workflows-client.d.ts +54 -0
- package/workflows-client.js +41 -0
- package/client-source-material-comments.d.ts +0 -51
- package/client-source-material-comments.js +0 -6
- package/codes-client.d.ts +0 -118
- package/codes-client.js +0 -99
- package/codes-types.d.ts +0 -325
- package/colour-aggregate-types.d.ts +0 -163
- package/coordinate-client.d.ts +0 -23
- package/coordinate-client.js +0 -13
- package/demand-batch-types.d.ts +0 -118
- package/demand-types.d.ts +0 -154
- package/identify-types.d.ts +0 -82
- package/material-composition-client.d.ts +0 -21
- package/material-composition-client.js +0 -13
- package/material-composition-types.d.ts +0 -403
- package/material-composition-types.js +0 -1
- package/source-material-validation.d.ts +0 -7
- package/source-material-validation.js +0 -214
- package/spec-facet-types.d.ts +0 -48
- package/spec-facet-types.js +0 -7
- package/substitute-types.d.ts +0 -102
- package/substitute-types.js +0 -1
- package/suggest-types.d.ts +0 -67
- package/suggest-types.js +0 -28
- package/taxonomy-coverage-types.d.ts +0 -34
- package/taxonomy-coverage-types.js +0 -1
- /package/{codes-types.js → colour-region-types.js} +0 -0
- /package/{colour-aggregate-types.js → find-variants-by-colour-types.js} +0 -0
- /package/{demand-batch-types.js → image-reference-types.js} +0 -0
- /package/{demand-types.js → list-enum-values-types.js} +0 -0
package/codes-types.d.ts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hand-mirrored wire types for the advisory building-code surface
|
|
3
|
-
* (`GET /api/v1/codes/context`, `GET /api/v1/codes/requirements`,
|
|
4
|
-
* `POST /api/v1/codes/advisory` — MG-433, MG-674).
|
|
5
|
-
*
|
|
6
|
-
* Like the rest of the SDK these interfaces have NO runtime dependency on any
|
|
7
|
-
* `@materialgraph/*` package — they mirror the `codeAdvisoryInputSchema` /
|
|
8
|
-
* `codeAdvisoryResultSchema` Zod contracts the route is built from. Response
|
|
9
|
-
* enums follow the SDK's TOLERANT-PARSING contract (widened with `OpenEnum` so a
|
|
10
|
-
* new server value still type-checks); `requirement.scale` is an open IBC-scale
|
|
11
|
-
* id and `caveat` is the AHJ advisory sentence, both read as plain strings.
|
|
12
|
-
*
|
|
13
|
-
* ADVISORY ONLY: every verdict and the envelope carry the AHJ caveat — this is
|
|
14
|
-
* model code as adopted, never a legal determination.
|
|
15
|
-
*/
|
|
16
|
-
import type { VariantId } from "./identifiers.js";
|
|
17
|
-
import type { FilterGroups } from "./list-variants-types.js";
|
|
18
|
-
import type { OpenEnum } from "./types.js";
|
|
19
|
-
/**
|
|
20
|
-
* A code context: the space the registry is queried for.
|
|
21
|
-
*
|
|
22
|
-
* CONDITIONAL REQUIREMENT — two axes must END UP resolved, and each may be
|
|
23
|
-
* stated OR correlated. Every field below is optional in the type because the
|
|
24
|
-
* validator resolves them per axis independently; the rule it enforces at
|
|
25
|
-
* runtime is:
|
|
26
|
-
*
|
|
27
|
-
* > occupancyGroup, resolved = `input.occupancyGroup` ?? correlate(roomType)
|
|
28
|
-
* > spaceType, resolved = `input.spaceType` ?? correlate(roomType)
|
|
29
|
-
*
|
|
30
|
-
* and either resolving to nothing is a 400, verbatim:
|
|
31
|
-
*
|
|
32
|
-
* - `"An occupancy group is required — state occupancyGroup, or a roomType that
|
|
33
|
-
* correlates to one."`
|
|
34
|
-
* - `"A space type is required — state spaceType, or a roomType that correlates
|
|
35
|
-
* to one."`
|
|
36
|
-
* - `"Room type \"{roomType}\" does not correlate to an IBC occupancy group —
|
|
37
|
-
* state occupancyGroup explicitly."`
|
|
38
|
-
* - `"Room type \"{roomType}\" does not correlate to a Table 803.13 finish
|
|
39
|
-
* location — state spaceType explicitly."`
|
|
40
|
-
*
|
|
41
|
-
* So: give `occupancyGroup` + `spaceType`, or give `roomType` and let both
|
|
42
|
-
* correlate, or mix them — an explicit axis always wins over a correlated one,
|
|
43
|
-
* and a room is only consulted for an axis you did not state. Correlation never
|
|
44
|
-
* guesses: a room that maps to neither is an error naming the axis, and the
|
|
45
|
-
* response's `resolvedContext` is where you audit what was inferred for you.
|
|
46
|
-
*
|
|
47
|
-
* Discover every accepted value — jurisdictions, occupancy groups, finish
|
|
48
|
-
* locations, and the room correlations themselves — from
|
|
49
|
-
* {@link CodesClient.context}. Nothing here should be hardcoded.
|
|
50
|
-
*/
|
|
51
|
-
export type CodeContextRequest = {
|
|
52
|
-
/** A seeded jurisdiction id (e.g. `"us-tx"`); an unknown id is a 400 listing the seeded set. */
|
|
53
|
-
jurisdictionId: string;
|
|
54
|
-
/**
|
|
55
|
-
* The IBC occupancy group for the space (e.g. `"I-2"` hospital, `"A-2"`
|
|
56
|
-
* restaurant). Required unless `roomType` correlates to one. An uncovered
|
|
57
|
-
* group is a 400 listing the covered ones.
|
|
58
|
-
*/
|
|
59
|
-
occupancyGroup?: string;
|
|
60
|
-
/**
|
|
61
|
-
* The finish location: `"corridors"`, `"exit_stairs_passageways"`, or
|
|
62
|
-
* `"rooms_enclosed_spaces"`. Required unless `roomType` correlates to one.
|
|
63
|
-
*/
|
|
64
|
-
spaceType?: string;
|
|
65
|
-
/**
|
|
66
|
-
* A `room` term id (e.g. `"hotel_room"`) to correlate the regulatory axes
|
|
67
|
-
* from. Explicit `occupancyGroup` / `spaceType` always win. A room that
|
|
68
|
-
* correlates to neither axis is a 400 naming the axis — never a guess.
|
|
69
|
-
*/
|
|
70
|
-
roomType?: string;
|
|
71
|
-
/** Whether the space is sprinklered — relaxes several fire-finish floors. No default. */
|
|
72
|
-
sprinklered: boolean;
|
|
73
|
-
};
|
|
74
|
-
export type CodeAdvisoryInput = {
|
|
75
|
-
/**
|
|
76
|
-
* 1–100 opaque variant ids to badge, echoed back in `results` in this exact
|
|
77
|
-
* order and cardinality (duplicates are echoed, never collapsed). Preserve
|
|
78
|
-
* them verbatim — never parse or construct one.
|
|
79
|
-
*/
|
|
80
|
-
variantIds: VariantId[];
|
|
81
|
-
} & CodeContextRequest;
|
|
82
|
-
/** The resolved jurisdiction the verdicts were evaluated against. */
|
|
83
|
-
export type CodeAdvisoryJurisdiction = {
|
|
84
|
-
id: string;
|
|
85
|
-
name: string;
|
|
86
|
-
codeFamily: string;
|
|
87
|
-
edition: string;
|
|
88
|
-
adoptionNote: string;
|
|
89
|
-
};
|
|
90
|
-
/** The echoed evaluation context (the space the badges apply to). */
|
|
91
|
-
export type CodeAdvisoryContext = {
|
|
92
|
-
occupancyGroup: string;
|
|
93
|
-
spaceType: string;
|
|
94
|
-
sprinklered: boolean;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* What one material is, and therefore what it was held to. `dimensions` are the
|
|
98
|
-
* regulatory dimensions the material can be scored on; `basis` names which
|
|
99
|
-
* source(s) produced them: a mapped `productTypeId`, `applicationIds`, both, or
|
|
100
|
-
* `unresolved` when neither yielded anything. `unresolved` does NOT mean the
|
|
101
|
-
* material is answerable for nothing — it means we could not tell what the
|
|
102
|
-
* material is, so every requirement the space imposes was scored against it and
|
|
103
|
-
* `notApplicable` on the result is empty. That is a coverage gap in the
|
|
104
|
-
* product-type/application map, not a narrow material. A short `requirements`
|
|
105
|
-
* list under `product_type` / `application` / `both` is a genuine intersection;
|
|
106
|
-
* a full list under `unresolved` is the map falling short.
|
|
107
|
-
*/
|
|
108
|
-
export type MaterialCodeProfile = {
|
|
109
|
-
/** The variant's accepted primary product type, or null if it has none. */
|
|
110
|
-
productTypeId: string | null;
|
|
111
|
-
/** The variant's accepted `applications` terms, as stored. */
|
|
112
|
-
applicationIds: string[];
|
|
113
|
-
/** Regulatory dimensions this material can be held to. Empty ONLY when `basis` is `unresolved`. */
|
|
114
|
-
dimensions: OpenEnum<"fire" | "floor" | "slip" | "decorative">[];
|
|
115
|
-
basis: OpenEnum<"product_type" | "application" | "both" | "unresolved">;
|
|
116
|
-
};
|
|
117
|
-
/** Why one requirement the space imposes was excluded from this material's `requirements`. */
|
|
118
|
-
export type CodeRequirementExclusion = {
|
|
119
|
-
requirementId: string;
|
|
120
|
-
dimension: OpenEnum<"fire" | "floor" | "slip" | "decorative">;
|
|
121
|
-
reason: OpenEnum<"not_a_material_dimension">;
|
|
122
|
-
/** One readable line, e.g. `"Slip resistance is not a dimension wallcovering answers for."`. */
|
|
123
|
-
detail: string;
|
|
124
|
-
};
|
|
125
|
-
/** The threshold one requirement imposes: a class floor and/or a numeric floor. */
|
|
126
|
-
export type CodeRequirementThreshold = {
|
|
127
|
-
/** The IBC classification scale this requirement is measured on (open id). */
|
|
128
|
-
scale: string;
|
|
129
|
-
/** The minimum acceptable class on `scale`, or null when only a numeric floor applies. */
|
|
130
|
-
minClass: string | null;
|
|
131
|
-
/** A numeric floor (e.g. a DCOF minimum), or null when only a class floor applies. */
|
|
132
|
-
numericFloor: {
|
|
133
|
-
metric: string;
|
|
134
|
-
value: number;
|
|
135
|
-
unit: string;
|
|
136
|
-
} | null;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* The accepted fact a verdict was decided from — null when the material carried
|
|
140
|
-
* none, which is exactly the case that produces `verdict: "unknown"`.
|
|
141
|
-
*
|
|
142
|
-
* `confidence` and `sourceBasis` are the strength of the fact, not of the code
|
|
143
|
-
* reading. Quote them whenever you quote the badge: a `meets` resting on a
|
|
144
|
-
* `derived` value at low confidence is a materially different statement from one
|
|
145
|
-
* resting on a `tested` figure.
|
|
146
|
-
*/
|
|
147
|
-
export type CodeRequirementEvidence = {
|
|
148
|
-
attributeId: OpenEnum<"fire_classifications" | "slip_resistance_dcof">;
|
|
149
|
-
value: string;
|
|
150
|
-
confidence: number | null;
|
|
151
|
-
sourceBasis: string | null;
|
|
152
|
-
};
|
|
153
|
-
/** One requirement badged against one material. */
|
|
154
|
-
export type CodeRequirementVerdict = {
|
|
155
|
-
requirementId: string;
|
|
156
|
-
dimension: OpenEnum<"fire" | "floor" | "slip" | "decorative">;
|
|
157
|
-
section: string;
|
|
158
|
-
requirement: CodeRequirementThreshold;
|
|
159
|
-
/**
|
|
160
|
-
* What may be said about this material against this requirement:
|
|
161
|
-
* - `meets` — a defensible fact clears the threshold. Advisory, still not a
|
|
162
|
-
* determination.
|
|
163
|
-
* - `shortfall` — a defensible fact FAILS to clear it. A real negative.
|
|
164
|
-
* - `unknown` — no defensible fact maps onto `scale`. NOT a failure and NOT a
|
|
165
|
-
* pass: "no comparable rating on file". Never present it as either.
|
|
166
|
-
*/
|
|
167
|
-
verdict: OpenEnum<"meets" | "shortfall" | "unknown">;
|
|
168
|
-
evidence: CodeRequirementEvidence | null;
|
|
169
|
-
/** The AHJ advisory caveat — model code as adopted, never a legal determination. */
|
|
170
|
-
caveat: string;
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* One candidate's requirement verdicts folded into a single status and sentence.
|
|
174
|
-
* A shortfall outranks an unknown, and an unknown NEVER rolls up to a pass:
|
|
175
|
-
* `not_applicable` (nothing applied) is deliberately distinct from `meets`.
|
|
176
|
-
*/
|
|
177
|
-
export type CodeAdvisorySummary = {
|
|
178
|
-
/**
|
|
179
|
-
* The rolled-up card, and what each token licenses:
|
|
180
|
-
* - `meets` — every applicable requirement was `meets`. Advisory pass.
|
|
181
|
-
* - `shortfall` — at least one requirement failed on real evidence. Blocking.
|
|
182
|
-
* - `unverified` — nothing failed, but something is `unknown`. COMMON, and
|
|
183
|
-
* never a pass: it means "no comparable rating is on file". Show it as an
|
|
184
|
-
* open question, not a green tick.
|
|
185
|
-
* - `not_applicable` — the space imposes nothing this material answers for.
|
|
186
|
-
* Deliberately distinct from `meets`: it is silence, not approval.
|
|
187
|
-
*/
|
|
188
|
-
status: OpenEnum<"meets" | "shortfall" | "unverified" | "not_applicable">;
|
|
189
|
-
/** One deterministic sentence naming what failed, e.g. `"Falls short on fire for A-2 corridors."`. */
|
|
190
|
-
headline: string;
|
|
191
|
-
shortfallDimensions: OpenEnum<"fire" | "floor" | "slip" | "decorative">[];
|
|
192
|
-
unverifiedDimensions: OpenEnum<"fire" | "floor" | "slip" | "decorative">[];
|
|
193
|
-
};
|
|
194
|
-
/** Per-variant advisory outcome, in input order. */
|
|
195
|
-
export type CodeAdvisoryVariantResult = {
|
|
196
|
-
/** Opaque — echoed verbatim from `variantIds`, in that position. */
|
|
197
|
-
variantId: VariantId;
|
|
198
|
-
/** `evaluated` when the id resolved; `unknown_variant` (with `requirements: []`) when it did not. */
|
|
199
|
-
state: OpenEnum<"evaluated" | "unknown_variant">;
|
|
200
|
-
/** What this material is and what it was scored against. Null only for `state: "unknown_variant"`. */
|
|
201
|
-
material: MaterialCodeProfile | null;
|
|
202
|
-
/** Verdicts for the requirements this material is answerable for — the answerable subset only. */
|
|
203
|
-
requirements: CodeRequirementVerdict[];
|
|
204
|
-
/** Requirements the space imposes that this material cannot answer. Empty when nothing was excluded. */
|
|
205
|
-
notApplicable: CodeRequirementExclusion[];
|
|
206
|
-
/** The rolled-up card, or null for an id that resolved to nothing. */
|
|
207
|
-
summary: CodeAdvisorySummary | null;
|
|
208
|
-
};
|
|
209
|
-
/** The `POST /api/v1/codes/advisory` envelope — per-variant, per-requirement verdicts. */
|
|
210
|
-
export type CodeAdvisoryResponse = {
|
|
211
|
-
jurisdiction: CodeAdvisoryJurisdiction;
|
|
212
|
-
/** The context AS SUPPLIED, echoed verbatim. */
|
|
213
|
-
context: CodeAdvisoryContext;
|
|
214
|
-
/** The canonical axes the registry was queried with, and where they came from. */
|
|
215
|
-
resolvedContext: ResolvedCodeContext;
|
|
216
|
-
/** The AHJ advisory caveat, at the envelope level too. */
|
|
217
|
-
caveat: string;
|
|
218
|
-
results: CodeAdvisoryVariantResult[];
|
|
219
|
-
};
|
|
220
|
-
/** Where a resolved axis came from: stated outright, or correlated from a room type. */
|
|
221
|
-
export type ResolvedCodeContext = {
|
|
222
|
-
jurisdictionId: string;
|
|
223
|
-
occupancyGroup: string;
|
|
224
|
-
/** The canonical finish-location term id the registry was queried with. */
|
|
225
|
-
spaceType: string;
|
|
226
|
-
sprinklered: boolean;
|
|
227
|
-
basis: OpenEnum<"explicit" | "derived_from_room">;
|
|
228
|
-
/** The `room` term the axes were correlated from, or null. */
|
|
229
|
-
roomType: string | null;
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* How far a jurisdiction's rows have been reviewed against that AHJ's own tables.
|
|
233
|
-
*
|
|
234
|
-
* - `thorough` — reviewed against this jurisdiction's own adopted tables.
|
|
235
|
-
* - `model_baseline` — UNAMENDED model IBC stood in, because that AHJ's own
|
|
236
|
-
* amendments have not been reviewed. Local amendments may be stricter, so
|
|
237
|
-
* say "per model IBC" rather than naming the jurisdiction as the authority.
|
|
238
|
-
*/
|
|
239
|
-
export type CodeCoverageTier = OpenEnum<"thorough" | "model_baseline">;
|
|
240
|
-
export type CodeJurisdictionSummary = {
|
|
241
|
-
id: string;
|
|
242
|
-
name: string;
|
|
243
|
-
codeFamily: string;
|
|
244
|
-
edition: string;
|
|
245
|
-
coverage: CodeCoverageTier;
|
|
246
|
-
/** One honest line on how the model code actually applies in this jurisdiction. */
|
|
247
|
-
adoptionNote: string;
|
|
248
|
-
};
|
|
249
|
-
/** The `GET /api/v1/codes/context` envelope — the vocabulary for stating a context. */
|
|
250
|
-
export type CodeContextResponse = {
|
|
251
|
-
jurisdictions: CodeJurisdictionSummary[];
|
|
252
|
-
occupancyGroups: {
|
|
253
|
-
id: string;
|
|
254
|
-
label: string;
|
|
255
|
-
}[];
|
|
256
|
-
finishLocations: {
|
|
257
|
-
id: string;
|
|
258
|
-
label: string;
|
|
259
|
-
shortLabel: string;
|
|
260
|
-
}[];
|
|
261
|
-
dimensions: {
|
|
262
|
-
id: OpenEnum<"fire" | "floor" | "slip" | "decorative">;
|
|
263
|
-
label: string;
|
|
264
|
-
description: string;
|
|
265
|
-
/** The MaterialGraph attribute this dimension is scored against. */
|
|
266
|
-
attributeId: string;
|
|
267
|
-
}[];
|
|
268
|
-
scales: {
|
|
269
|
-
id: string;
|
|
270
|
-
label: string;
|
|
271
|
-
detail: string;
|
|
272
|
-
/** Ordered BEST FIRST: index 0 outranks index 1. */
|
|
273
|
-
classes: string[];
|
|
274
|
-
}[];
|
|
275
|
-
/** `room` → regulatory axes. `null` where the registry refuses to correlate. */
|
|
276
|
-
roomCorrelations: {
|
|
277
|
-
roomType: string;
|
|
278
|
-
label: string;
|
|
279
|
-
occupancyGroup: string | null;
|
|
280
|
-
finishLocation: string | null;
|
|
281
|
-
}[];
|
|
282
|
-
/** The AHJ advisory caveat. */
|
|
283
|
-
caveat: string;
|
|
284
|
-
};
|
|
285
|
-
/** One requirement a context imposes, independent of any candidate material. */
|
|
286
|
-
export type CodeRequirementListing = {
|
|
287
|
-
requirementId: string;
|
|
288
|
-
dimension: OpenEnum<"fire" | "floor" | "slip" | "decorative">;
|
|
289
|
-
/** The code section this demand is cited from. */
|
|
290
|
-
section: string;
|
|
291
|
-
attributeId: string;
|
|
292
|
-
requirement: CodeRequirementThreshold;
|
|
293
|
-
/** One readable line, e.g. `"Class A or better · ASTM E84 / UL 723"`. */
|
|
294
|
-
label: string;
|
|
295
|
-
};
|
|
296
|
-
/** Why one requirement the context imposes could not become a `list_variants` filter predicate. */
|
|
297
|
-
export type CodeSpecFilterUnexpressible = {
|
|
298
|
-
requirementId: string;
|
|
299
|
-
dimension: OpenEnum<"fire" | "floor" | "slip" | "decorative">;
|
|
300
|
-
reason: OpenEnum<"no_matchable_tokens" | "unsupported_scale" | "no_floor">;
|
|
301
|
-
/** One readable line naming why, e.g. `"Scale ... has no ordinal definition..."`. */
|
|
302
|
-
detail: string;
|
|
303
|
-
};
|
|
304
|
-
/**
|
|
305
|
-
* The `GET /api/v1/codes/requirements` envelope. An empty `requirements` array
|
|
306
|
-
* means the registry holds nothing for this context — it is not a pass.
|
|
307
|
-
*/
|
|
308
|
-
export type CodeRequirementsResponse = {
|
|
309
|
-
jurisdiction: CodeJurisdictionSummary;
|
|
310
|
-
context: ResolvedCodeContext;
|
|
311
|
-
requirements: CodeRequirementListing[];
|
|
312
|
-
/**
|
|
313
|
-
* The same requirements as a ready-to-use `list_variants` `filters` group
|
|
314
|
-
* (MG-2222, `{terms, numbers, presence}`) — pass it straight through as
|
|
315
|
-
* `listVariants({ filters })`.
|
|
316
|
-
* `null` when nothing here is filterable; read `specFilterUnexpressible`
|
|
317
|
-
* for why, not an empty `requirements` list.
|
|
318
|
-
*/
|
|
319
|
-
specFilter: FilterGroups | null;
|
|
320
|
-
/** The dimensions `specFilter` actually narrows on — a subset of `requirements`' dimensions. */
|
|
321
|
-
specFilterApplied: OpenEnum<"fire" | "floor" | "slip" | "decorative">[];
|
|
322
|
-
/** Requirements that could not be turned into a filter predicate, and why. */
|
|
323
|
-
specFilterUnexpressible: CodeSpecFilterUnexpressible[];
|
|
324
|
-
caveat: string;
|
|
325
|
-
};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire types for the colour AGGREGATE surface — `GET /api/v1/colours/profiles`
|
|
3
|
-
* and `GET /api/v1/colours/stats`.
|
|
4
|
-
*
|
|
5
|
-
* Kept out of `types.ts` for the same reason `material-types.ts` and
|
|
6
|
-
* `codes-types.ts` are: the shared mirror is at its source-size budget. Same
|
|
7
|
-
* tolerant-parsing contract as the rest of the mirror — response enums are
|
|
8
|
-
* widened so a new server value still type-checks.
|
|
9
|
-
*/
|
|
10
|
-
import type { OpenEnum } from "./types.js";
|
|
11
|
-
/**
|
|
12
|
-
* Which taxonomy tier a colour profile's `categoryKey` names — or `"merged"`,
|
|
13
|
-
* where the key is a composite over a caller-defined key set rather than a
|
|
14
|
-
* taxonomy node.
|
|
15
|
-
*/
|
|
16
|
-
export type CategoryTier = OpenEnum<"group" | "type" | "merged">;
|
|
17
|
-
/** How the endpoint picks which colours to keep. */
|
|
18
|
-
export type ColourProfileSelect = OpenEnum<"frequency" | "diverse">;
|
|
19
|
-
/** One representative colour bucket of a category. */
|
|
20
|
-
export type CategoryColour = {
|
|
21
|
-
hex: string;
|
|
22
|
-
oklab: {
|
|
23
|
-
l: number;
|
|
24
|
-
a: number;
|
|
25
|
-
b: number;
|
|
26
|
-
};
|
|
27
|
-
variantCount: number;
|
|
28
|
-
/** This bucket's share of the category's coloured variants, 0–1. */
|
|
29
|
-
proportion: number;
|
|
30
|
-
};
|
|
31
|
-
export type CategoryColourProfile = {
|
|
32
|
-
categoryKey: string;
|
|
33
|
-
level: CategoryTier;
|
|
34
|
-
name: string;
|
|
35
|
-
path: string;
|
|
36
|
-
/**
|
|
37
|
-
* Under `groupBy: "merged"`, the requested keys in composite-key order, so
|
|
38
|
-
* `categoryKey` never has to be split. Absent on a single-category profile.
|
|
39
|
-
*/
|
|
40
|
-
members?: string[];
|
|
41
|
-
variantCount: number;
|
|
42
|
-
avgLightness: number;
|
|
43
|
-
avgChroma: number;
|
|
44
|
-
colours: CategoryColour[];
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* The snapshot a profile response was computed from. Compare `variantCount`
|
|
48
|
-
* against `colours/stats`' `corpus.withColour` to see how complete the
|
|
49
|
-
* underlying materialized view currently is, and `refreshedAt` for its age.
|
|
50
|
-
*/
|
|
51
|
-
export type CategoryColourProfilesBasis = {
|
|
52
|
-
variantCount: number;
|
|
53
|
-
refreshedAt: string | null;
|
|
54
|
-
};
|
|
55
|
-
export type CategoryColourProfilesResponse = {
|
|
56
|
-
profiles: CategoryColourProfile[];
|
|
57
|
-
basis: CategoryColourProfilesBasis;
|
|
58
|
-
};
|
|
59
|
-
/** Request parameters for `colours.profiles()`. */
|
|
60
|
-
export type ColourProfilesParams = {
|
|
61
|
-
/** 1–8 category keys, at the tier named by `groupBy`. */
|
|
62
|
-
productTypeIds: readonly string[];
|
|
63
|
-
/**
|
|
64
|
-
* `"group"` merges each group's leaf product types into one palette;
|
|
65
|
-
* `"merged"` merges EVERY key's leaves into a single combined palette.
|
|
66
|
-
*/
|
|
67
|
-
groupBy?: "group" | "type" | "merged";
|
|
68
|
-
/** Representative colours per category, 1–64. */
|
|
69
|
-
topN?: number;
|
|
70
|
-
/** `"diverse"` maximises visual distinctness instead of frequency. */
|
|
71
|
-
select?: "frequency" | "diverse";
|
|
72
|
-
};
|
|
73
|
-
export type ColourStatsCorpus = {
|
|
74
|
-
variants: number;
|
|
75
|
-
withColour: number;
|
|
76
|
-
/** `withColour / variants`, 0–1. */
|
|
77
|
-
coverage: number;
|
|
78
|
-
};
|
|
79
|
-
export type ColourStatsFamily = {
|
|
80
|
-
id: string;
|
|
81
|
-
label: string;
|
|
82
|
-
variants: number;
|
|
83
|
-
brands: number;
|
|
84
|
-
};
|
|
85
|
-
export type ColourStatsGroup = {
|
|
86
|
-
key: string;
|
|
87
|
-
name: string;
|
|
88
|
-
productTypes: number;
|
|
89
|
-
variants: number;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* One cell of the brand x category x colour-family matrix — the shape that
|
|
93
|
-
* answers questions no single dimension can, such as "how many whites does
|
|
94
|
-
* Benjamin Moore offer in paint".
|
|
95
|
-
*/
|
|
96
|
-
export type ColourStatsRow = {
|
|
97
|
-
/** Opaque brand id — the join key for brand reads. Never parse it. */
|
|
98
|
-
brandId: string;
|
|
99
|
-
brandSlug: string;
|
|
100
|
-
brandName: string;
|
|
101
|
-
/**
|
|
102
|
-
* Product-type key. NULL means these variants carry NO accepted primary
|
|
103
|
-
* product type — a real population, kept so the matrix sums to the corpus,
|
|
104
|
-
* not an error and not a residual bucket.
|
|
105
|
-
*/
|
|
106
|
-
categoryKey: string | null;
|
|
107
|
-
family: string;
|
|
108
|
-
/**
|
|
109
|
-
* Distinct variants at this (brand, category, family) carrying an ACCEPTED
|
|
110
|
-
* `colour_family`. Not every variant of the brand.
|
|
111
|
-
*/
|
|
112
|
-
variants: number;
|
|
113
|
-
};
|
|
114
|
-
/** How to narrow the matrix. Passing ANY of these asks for `rows`. */
|
|
115
|
-
export type ColourStatsParams = {
|
|
116
|
-
/** `"brand,category"` — ask for the whole matrix, unscoped. */
|
|
117
|
-
groupBy?: string;
|
|
118
|
-
brandId?: string;
|
|
119
|
-
brandSlug?: string;
|
|
120
|
-
/**
|
|
121
|
-
* A product-type key, or the literal `"null"` for the unclassified
|
|
122
|
-
* population. Omitting it means every category — a different question.
|
|
123
|
-
*/
|
|
124
|
-
categoryKey?: string;
|
|
125
|
-
family?: string;
|
|
126
|
-
limit?: number;
|
|
127
|
-
};
|
|
128
|
-
/** Where each section came from, how fresh it is, and what it does NOT answer. */
|
|
129
|
-
export type ColourStatsBasis = {
|
|
130
|
-
corpus: string;
|
|
131
|
-
families: string;
|
|
132
|
-
groups: string;
|
|
133
|
-
groupsRefreshedAt: string | null;
|
|
134
|
-
groupsVariantCount: number;
|
|
135
|
-
/**
|
|
136
|
-
* Where `rows` came from, its freshness, and what it EXCLUDES — present only
|
|
137
|
-
* when `rows` is. Read it: the matrix deliberately omits Samplize, which is a
|
|
138
|
-
* sampling channel printing other manufacturers' colours rather than a maker.
|
|
139
|
-
*/
|
|
140
|
-
rows?: string;
|
|
141
|
-
omissions: string[];
|
|
142
|
-
};
|
|
143
|
-
export type ColourStatsResponse = {
|
|
144
|
-
corpus: ColourStatsCorpus;
|
|
145
|
-
families: ColourStatsFamily[];
|
|
146
|
-
groups: ColourStatsGroup[];
|
|
147
|
-
/**
|
|
148
|
-
* The brand x category x colour-family matrix. Present ONLY when you asked
|
|
149
|
-
* for it; ABSENT means nobody asked, never that the matrix is empty.
|
|
150
|
-
*
|
|
151
|
-
* `families` above is NOT scoped by the same parameters and stays
|
|
152
|
-
* platform-wide under all of them. Scoped counts live here.
|
|
153
|
-
*/
|
|
154
|
-
rows?: ColourStatsRow[];
|
|
155
|
-
/**
|
|
156
|
-
* Rows matching your query BEFORE the response cap — the honest total.
|
|
157
|
-
* A shortfall against `rows.length` means `rows` is a prefix.
|
|
158
|
-
*/
|
|
159
|
-
rowsMatched?: number;
|
|
160
|
-
/** TRUE when the matrix exceeded the cap and `rows` is a prefix. */
|
|
161
|
-
rowsTruncated?: boolean;
|
|
162
|
-
basis: ColourStatsBasis;
|
|
163
|
-
};
|
package/coordinate-client.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The COORDINATION lens: given several materials already chosen, what completes
|
|
3
|
-
* them. A thin wrapper over the shared {@link HttpTransport};
|
|
4
|
-
* `MaterialGraphClient.coordinate` delegates here.
|
|
5
|
-
*
|
|
6
|
-
* Extracted from `client.ts`, which sits above the repository's source-size
|
|
7
|
-
* limit, in the same per-lens shape as `brands-client` / `codes-client` /
|
|
8
|
-
* `colours-client`. Behaviour is unchanged.
|
|
9
|
-
*/
|
|
10
|
-
import type { HttpTransport } from "./http-transport.js";
|
|
11
|
-
import type { CoordinateInput, CoordinateResponse } from "./types.js";
|
|
12
|
-
/**
|
|
13
|
-
* THE QUESTION: "here is my whole scheme so far — what completes it?" The
|
|
14
|
-
* multi-seed form of `pairings`: lift is SUMMED across seeds, so a companion
|
|
15
|
-
* suiting one pick ranks below one suiting several. Returns demand-lift-ranked
|
|
16
|
-
* companions with colour swatches and an annotate-only `colourFit` that never
|
|
17
|
-
* reorders in v1.
|
|
18
|
-
*
|
|
19
|
-
* Instead use `pairings` for a single material, and `colours.palette()` when the
|
|
20
|
-
* scheme is COLOURS rather than materials. Check `unresolved` before presenting:
|
|
21
|
-
* a reference that resolved to nothing is named there, not dropped.
|
|
22
|
-
*/
|
|
23
|
-
export declare const coordinate: (transport: HttpTransport, input: CoordinateInput, signal?: AbortSignal) => Promise<CoordinateResponse>;
|
package/coordinate-client.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { resolveOperation } from "./operations.js";
|
|
2
|
-
/**
|
|
3
|
-
* THE QUESTION: "here is my whole scheme so far — what completes it?" The
|
|
4
|
-
* multi-seed form of `pairings`: lift is SUMMED across seeds, so a companion
|
|
5
|
-
* suiting one pick ranks below one suiting several. Returns demand-lift-ranked
|
|
6
|
-
* companions with colour swatches and an annotate-only `colourFit` that never
|
|
7
|
-
* reorders in v1.
|
|
8
|
-
*
|
|
9
|
-
* Instead use `pairings` for a single material, and `colours.palette()` when the
|
|
10
|
-
* scheme is COLOURS rather than materials. Check `unresolved` before presenting:
|
|
11
|
-
* a reference that resolved to nothing is named there, not dropped.
|
|
12
|
-
*/
|
|
13
|
-
export const coordinate = async (transport, input, signal) => await transport.requestJson(resolveOperation("coordinate_materials"), { body: input, signal });
|
package/demand-batch-types.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire types for BATCH candidate demand enrichment — `POST /api/v1/demand/batch`.
|
|
3
|
-
*
|
|
4
|
-
* Split out of `types.ts` for the repository's source-file size budget, the same
|
|
5
|
-
* reason `material-types.ts` and `catalog-discovery-types.ts` sit beside it;
|
|
6
|
-
* re-exported from `types.ts`, so importers see no difference.
|
|
7
|
-
*
|
|
8
|
-
* THE LENS: this answers "how much is each of these already-chosen materials
|
|
9
|
-
* actually specified?" — enrichment over a bounded id list you already hold. It
|
|
10
|
-
* never resolves, ranks, reorders or discovers. Use
|
|
11
|
-
* {@link MaterialGraphClient.demand} for one material named in free text,
|
|
12
|
-
* {@link MaterialGraphClient.pairings} for what goes WITH a material, and
|
|
13
|
-
* {@link MaterialGraphClient.search} to find candidates in the first place.
|
|
14
|
-
*/
|
|
15
|
-
import type { VariantId } from "./identifiers.js";
|
|
16
|
-
import type { DemandMomentum, DemandQuarter, DemandSignal, OpenEnum } from "./types.js";
|
|
17
|
-
/**
|
|
18
|
-
* Body for `POST /api/v1/demand/batch` — enrich 1–48 already-selected candidate
|
|
19
|
-
* ids with their real specification demand, in input order and cardinality.
|
|
20
|
-
*/
|
|
21
|
-
export type DemandBatchInput = {
|
|
22
|
-
/** 1–48 canonical variant ids. Order AND cardinality are preserved — duplicates are echoed, never collapsed. */
|
|
23
|
-
variantIds: VariantId[];
|
|
24
|
-
/** The behavioural signal to read demand from. Defaults to `sampled` (order co-occurrence) server-side. */
|
|
25
|
-
signal?: DemandSignal;
|
|
26
|
-
/** Optional declared context (e.g. `{ projectType: "hospitality" }`) — echoed for provenance, never used to rank or filter. */
|
|
27
|
-
context?: Record<string, string>;
|
|
28
|
-
};
|
|
29
|
-
/** Headline population behind the metric — this variant's own counts. */
|
|
30
|
-
export type DemandBatchPopulation = {
|
|
31
|
-
specCount: number;
|
|
32
|
-
projectCount: number;
|
|
33
|
-
customerCount: number;
|
|
34
|
-
};
|
|
35
|
-
/** The consideration→specification funnel (project-grain; `exclusionRate` is annotate-only). */
|
|
36
|
-
export type DemandBatchFunnel = {
|
|
37
|
-
consideredProjects: number;
|
|
38
|
-
specifiedProjects: number;
|
|
39
|
-
excludedCount: number;
|
|
40
|
-
exclusionRate: number;
|
|
41
|
-
};
|
|
42
|
-
/** Per-result guardrail status — present on `internal` (`mg:admin`) results only. */
|
|
43
|
-
export type DemandBatchEvidence = {
|
|
44
|
-
belowPrivacyFloor: boolean;
|
|
45
|
-
belowQualityFloor: boolean;
|
|
46
|
-
suppressedForPublic: boolean;
|
|
47
|
-
};
|
|
48
|
-
/** A variant that carries a usable demand signal. */
|
|
49
|
-
export type DemandBatchAvailableResult = {
|
|
50
|
-
variantId: VariantId;
|
|
51
|
-
state: "available";
|
|
52
|
-
population: DemandBatchPopulation;
|
|
53
|
-
/** Exact per-quarter counts (sparse — zero-spec quarters are absent). */
|
|
54
|
-
intervals: DemandQuarter[];
|
|
55
|
-
momentum: DemandMomentum;
|
|
56
|
-
/** The funnel; null when the signal is not `sampled` or no `considered` row/session exists. */
|
|
57
|
-
funnel: DemandBatchFunnel | null;
|
|
58
|
-
/** Exact guardrail evidence for `internal` callers; null for public. */
|
|
59
|
-
evidence: DemandBatchEvidence | null;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* A variant with a stats row that is below the public quality floor. We HAVE a
|
|
63
|
-
* reading and are declining to publish it — not a claim that nobody specifies it.
|
|
64
|
-
*/
|
|
65
|
-
export type DemandBatchInsufficientResult = {
|
|
66
|
-
variantId: VariantId;
|
|
67
|
-
state: "insufficient_data";
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* A variant with no stats — indistinguishable from a privacy-suppressed one for
|
|
71
|
-
* public callers, and therefore never reportable as "nobody specifies this".
|
|
72
|
-
*/
|
|
73
|
-
export type DemandBatchNoSignalResult = {
|
|
74
|
-
variantId: VariantId;
|
|
75
|
-
state: "no_signal";
|
|
76
|
-
};
|
|
77
|
-
/** A requested id that resolves to no real variant. */
|
|
78
|
-
export type DemandBatchUnknownResult = {
|
|
79
|
-
variantId: VariantId;
|
|
80
|
-
state: "unknown_variant";
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* One discriminated result per input id, in input order and cardinality.
|
|
84
|
-
*
|
|
85
|
-
* ABSENT IS NOT ZERO: only `available` carries numbers. The other three states
|
|
86
|
-
* each mean "no number to report", for three different reasons, and none of them
|
|
87
|
-
* licenses "this material is not specified" — see each member.
|
|
88
|
-
*/
|
|
89
|
-
export type DemandBatchResult = DemandBatchAvailableResult | DemandBatchInsufficientResult | DemandBatchNoSignalResult | DemandBatchUnknownResult;
|
|
90
|
-
/** The `POST /api/v1/demand/batch` envelope. */
|
|
91
|
-
export type DemandBatchResponse = {
|
|
92
|
-
/** The completed ingestion-session id these counts were mined in (the dataset generation). */
|
|
93
|
-
generationId: string;
|
|
94
|
-
metric: "specification_demand";
|
|
95
|
-
/** The metric universe — the window and signal the counts are scoped to. */
|
|
96
|
-
universe: {
|
|
97
|
-
window: "trailing_36mo";
|
|
98
|
-
signal: DemandSignal;
|
|
99
|
-
description: string;
|
|
100
|
-
};
|
|
101
|
-
/** The guardrail status under which `results` were projected. */
|
|
102
|
-
guardrail: {
|
|
103
|
-
audience: OpenEnum<"public" | "internal">;
|
|
104
|
-
minProjectCount: number;
|
|
105
|
-
minCustomerCount: number;
|
|
106
|
-
};
|
|
107
|
-
/** Outcome tallies over `results` — never a denominator for the metric. */
|
|
108
|
-
coverage: {
|
|
109
|
-
requested: number;
|
|
110
|
-
available: number;
|
|
111
|
-
insufficientData: number;
|
|
112
|
-
noSignal: number;
|
|
113
|
-
unknownVariant: number;
|
|
114
|
-
};
|
|
115
|
-
/** The echoed declared context, or null when none was supplied. */
|
|
116
|
-
context: Record<string, string> | null;
|
|
117
|
-
results: DemandBatchResult[];
|
|
118
|
-
};
|