@instruments/materialgraph 0.13.0 → 0.14.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/package.json +1 -1
- package/search-result-validation.js +7 -0
- package/types.d.ts +7 -5
package/package.json
CHANGED
|
@@ -162,6 +162,13 @@ export function checkSearchResultItem(value, what, fail) {
|
|
|
162
162
|
// `z.string().optional()` — absent, or a string. NOT nullable: the emit path
|
|
163
163
|
// omits the key rather than sending null when no MB identity is known.
|
|
164
164
|
requireOptionalString(record.materialBankId, `${what}.materialBankId`, fail);
|
|
165
|
+
requireOptionalString(record.manufacturerCode, `${what}.manufacturerCode`, fail);
|
|
166
|
+
if (record.projectSaveCapability !== undefined) {
|
|
167
|
+
requireEnum(record.projectSaveCapability, ["allowed"], `${what}.projectSaveCapability`, fail);
|
|
168
|
+
}
|
|
169
|
+
if (record.sourceStatus !== undefined) {
|
|
170
|
+
requireEnum(record.sourceStatus, ["provisional"], `${what}.sourceStatus`, fail);
|
|
171
|
+
}
|
|
165
172
|
// Same shape as `materialBankId`: absent, or a string. The emit path omits
|
|
166
173
|
// the key when no primary product type is on record rather than sending null,
|
|
167
174
|
// so "we don't know what this is" and "this is a null kind of thing" cannot
|
package/types.d.ts
CHANGED
|
@@ -131,19 +131,19 @@ export interface SearchResultItem {
|
|
|
131
131
|
brandSlug: string | null;
|
|
132
132
|
productId: ProductId | null;
|
|
133
133
|
/**
|
|
134
|
-
* The variant's Material Bank SKU
|
|
135
|
-
*
|
|
136
|
-
* and means nothing anywhere else; this is the id you are expected to match
|
|
134
|
+
* The variant's Material Bank SKU, unlike our opaque `variantId`; this is the
|
|
135
|
+
* id you are expected to match
|
|
137
136
|
* against Material Bank's own catalogue, so a result list can be joined to a
|
|
138
137
|
* cart, an order or an analytics event without a per-result lookup.
|
|
139
|
-
*
|
|
140
138
|
* Populated on EVERY lane: `search()` (all four arms), `match()`, and
|
|
141
139
|
* `matchStream()` frames.
|
|
142
|
-
*
|
|
143
140
|
* ABSENT means no MB identity is known for the variant — never that the SKU
|
|
144
141
|
* cannot be ordered. Presence is the orderability tell; absence is silence.
|
|
145
142
|
*/
|
|
146
143
|
materialBankId?: string;
|
|
144
|
+
manufacturerCode?: string;
|
|
145
|
+
projectSaveCapability?: "allowed";
|
|
146
|
+
sourceStatus?: "provisional";
|
|
147
147
|
/**
|
|
148
148
|
* What kind of material this is — the variant's primary product type, as a
|
|
149
149
|
* display name (`"Wall Tile"`, `"Modular Carpet"`, `"Interior Paint"`).
|
|
@@ -286,6 +286,8 @@ export interface SearchCardItem {
|
|
|
286
286
|
name: string;
|
|
287
287
|
variantName: string | null;
|
|
288
288
|
imageUrl: string | null;
|
|
289
|
+
projectSaveCapability?: "allowed";
|
|
290
|
+
sourceStatus?: "provisional";
|
|
289
291
|
score: number;
|
|
290
292
|
/**
|
|
291
293
|
* Resolved values for the attribute ids sent in `returnAttributes`, keyed by
|