@instruments/materialgraph 0.18.0 → 0.19.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 +29 -4
- package/browse-types.d.ts +14 -3
- package/by-colour-types.d.ts +24 -6
- package/by-spec-types.d.ts +4 -0
- package/catalogue-client.d.ts +3 -0
- package/catalogue-client.js +4 -0
- package/catalogue-types.d.ts +3 -1
- package/citation-types.d.ts +34 -0
- package/citation-types.js +1 -0
- package/client-browse.d.ts +1 -0
- package/client-browse.js +1 -0
- package/client-vocabulary.d.ts +10 -0
- package/client-vocabulary.js +32 -0
- package/client.d.ts +22 -45
- package/client.js +40 -55
- package/composition-types.d.ts +6 -0
- package/corpus-scope-types.d.ts +1 -1
- package/errors.d.ts +1 -1
- package/errors.js +2 -0
- package/index.d.ts +6 -0
- package/json-value-types.d.ts +8 -0
- package/json-value-types.js +1 -0
- package/match-types.d.ts +3 -0
- package/material-resources-client.d.ts +3 -0
- package/material-resources-client.js +4 -0
- package/material-types.d.ts +24 -0
- package/operations.d.ts +1 -1
- package/operations.js +37 -0
- package/package.json +1 -1
- package/palette-search-types.d.ts +16 -2
- package/render-assets-types.d.ts +65 -0
- package/render-assets-types.js +1 -0
- package/run-events.d.ts +13 -0
- package/samplize-catalogue-types.d.ts +92 -0
- package/samplize-catalogue-types.js +1 -0
- package/schedule-reference-types.d.ts +46 -0
- package/schedule-reference-types.js +1 -0
- package/schedule-references-client.d.ts +14 -0
- package/schedule-references-client.js +26 -0
- package/schedule-types.d.ts +34 -0
- package/search-mood-types.d.ts +6 -0
- package/search-mood-types.js +1 -0
- package/search-refinement-types.d.ts +5 -0
- package/search-request-types.d.ts +5 -0
- package/search-response-receipt-types.d.ts +8 -0
- package/search-result-validation.js +10 -0
- package/slot-pool-types.d.ts +2 -0
- package/spec-types.d.ts +6 -1
- package/specifications.d.ts +3 -1
- package/specifications.js +4 -0
- package/substitute-types.d.ts +75 -0
- package/substitute-types.js +1 -0
- package/taxonomy-coverage-types.d.ts +34 -0
- package/taxonomy-coverage-types.js +1 -0
- package/types.d.ts +15 -18
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { VariantId } from "./identifiers.js";
|
|
2
|
+
export type RenderAssetChannelRole = "base-color" | "normal" | "roughness" | "metalness" | "height" | "ambient-occlusion";
|
|
3
|
+
export type RenderAssetSourceBasis = "catalog_feed" | "declared" | "derived";
|
|
4
|
+
export type RenderAssetUnavailableReason = "no_accepted_appearance" | "pending" | "withheld" | "rejected" | "superseded" | "variant_inactive" | "delivery_unverified" | "integrity_error";
|
|
5
|
+
export interface RenderAssetFreshness {
|
|
6
|
+
revision: string;
|
|
7
|
+
updatedAt: string | null;
|
|
8
|
+
checkedAt: string | null;
|
|
9
|
+
}
|
|
10
|
+
export interface RenderAssetChannel {
|
|
11
|
+
role: RenderAssetChannelRole;
|
|
12
|
+
url: string;
|
|
13
|
+
sha256: string;
|
|
14
|
+
byteSize: number;
|
|
15
|
+
mimeType: "image/png";
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
bitDepth: 8 | 16;
|
|
19
|
+
colorSpace: "srgb" | "linear";
|
|
20
|
+
}
|
|
21
|
+
export interface MaterialRenderAssetsAvailable {
|
|
22
|
+
schemaVersion: "pbr-render-assets/v1";
|
|
23
|
+
variantId: VariantId;
|
|
24
|
+
status: "available";
|
|
25
|
+
setId: string;
|
|
26
|
+
state: "accepted";
|
|
27
|
+
sourceBasis: "derived";
|
|
28
|
+
fidelity: "unassessed";
|
|
29
|
+
acceptance: {
|
|
30
|
+
id: string;
|
|
31
|
+
verificationDecisionId: string;
|
|
32
|
+
acceptedAt: string;
|
|
33
|
+
checkVersion: string;
|
|
34
|
+
qa: {
|
|
35
|
+
status: "passed";
|
|
36
|
+
checkCount: number;
|
|
37
|
+
};
|
|
38
|
+
checkCount: number;
|
|
39
|
+
};
|
|
40
|
+
physicalRepeat: {
|
|
41
|
+
uMm: number;
|
|
42
|
+
vMm: number;
|
|
43
|
+
basis: "declared" | "measured";
|
|
44
|
+
};
|
|
45
|
+
tiling: {
|
|
46
|
+
u: boolean;
|
|
47
|
+
v: boolean;
|
|
48
|
+
};
|
|
49
|
+
normalConvention: "opengl" | "directx";
|
|
50
|
+
heightAmplitudeMm?: number;
|
|
51
|
+
channels: RenderAssetChannel[];
|
|
52
|
+
supersedesSetIds: string[];
|
|
53
|
+
freshness: RenderAssetFreshness;
|
|
54
|
+
}
|
|
55
|
+
export interface MaterialRenderAssetsUnavailable {
|
|
56
|
+
schemaVersion: "pbr-render-assets/v1";
|
|
57
|
+
variantId: VariantId;
|
|
58
|
+
status: "unavailable";
|
|
59
|
+
setId: string | null;
|
|
60
|
+
state: "pending" | "withheld" | "rejected" | "superseded" | "accepted" | null;
|
|
61
|
+
sourceBasis: RenderAssetSourceBasis | null;
|
|
62
|
+
reasonCodes: RenderAssetUnavailableReason[];
|
|
63
|
+
freshness: RenderAssetFreshness;
|
|
64
|
+
}
|
|
65
|
+
export type MaterialRenderAssets = MaterialRenderAssetsAvailable | MaterialRenderAssetsUnavailable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/run-events.d.ts
CHANGED
|
@@ -47,9 +47,22 @@ export interface CompositionReviewCriteriaSuggestion {
|
|
|
47
47
|
term?: string;
|
|
48
48
|
score: number;
|
|
49
49
|
}
|
|
50
|
+
/** Exact UTF-16 passage retained from the brief; no page coordinate is implied. */
|
|
51
|
+
export interface CompositionBriefCriterionSourceRef {
|
|
52
|
+
sourceId: string;
|
|
53
|
+
quote: string;
|
|
54
|
+
textRange: {
|
|
55
|
+
start: number;
|
|
56
|
+
end: number;
|
|
57
|
+
unit: "utf16";
|
|
58
|
+
};
|
|
59
|
+
}
|
|
50
60
|
export interface CompositionReviewCriteriaUnresolved {
|
|
51
61
|
slotId: string;
|
|
62
|
+
/** Unresolved negative language requires an explicit review decision. */
|
|
63
|
+
polarity?: "exclusion";
|
|
52
64
|
raw: string;
|
|
65
|
+
sourceRefs?: CompositionBriefCriterionSourceRef[];
|
|
53
66
|
/**
|
|
54
67
|
* Ranked corrections, best first. MG-994: every one of these is an attribute
|
|
55
68
|
* the slot's own category holds accepted values for, so accepting the top
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export interface SamplizeCatalogueOptions {
|
|
2
|
+
limit?: number;
|
|
3
|
+
after?: string;
|
|
4
|
+
/** Pin every subsequent page to the version returned by the first page. */
|
|
5
|
+
sourceVersion?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SamplizeCatalogueProduct {
|
|
8
|
+
variantId: string;
|
|
9
|
+
productId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code: string;
|
|
12
|
+
brand: {
|
|
13
|
+
slug: string;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
hex: string;
|
|
17
|
+
hexSource: {
|
|
18
|
+
publisher: "Samplize";
|
|
19
|
+
url: string;
|
|
20
|
+
source: "snowflake_product_tags";
|
|
21
|
+
};
|
|
22
|
+
lrv: number | null;
|
|
23
|
+
lrvSource: SamplizeLrvObservation | null;
|
|
24
|
+
lrvObservations: SamplizeLrvObservation[];
|
|
25
|
+
/** The primary sample variant count, never an aggregate of product orders. */
|
|
26
|
+
demand: SamplizeDemand | null;
|
|
27
|
+
collectionMemberships: SamplizeCollectionMembership[];
|
|
28
|
+
colourAnalysis: Record<string, unknown>;
|
|
29
|
+
oklab: {
|
|
30
|
+
L: number;
|
|
31
|
+
a: number;
|
|
32
|
+
b: number;
|
|
33
|
+
};
|
|
34
|
+
sourceProductId: string;
|
|
35
|
+
url: string;
|
|
36
|
+
sizeVariants: Array<{
|
|
37
|
+
sourceVariantId: string;
|
|
38
|
+
sku: string | null;
|
|
39
|
+
title: string | null;
|
|
40
|
+
price: number | null;
|
|
41
|
+
inventoryAvailable: boolean;
|
|
42
|
+
demand: SamplizeDemand | null;
|
|
43
|
+
}>;
|
|
44
|
+
publishedHexes: SamplizeHexObservation[];
|
|
45
|
+
hexObservations: SamplizeHexObservation[];
|
|
46
|
+
}
|
|
47
|
+
export interface SamplizeCataloguePage {
|
|
48
|
+
schemaVersion: 2;
|
|
49
|
+
corpusScope: "samplizeCatalogue";
|
|
50
|
+
sourceVersion: string;
|
|
51
|
+
source: Record<string, unknown>;
|
|
52
|
+
total: number;
|
|
53
|
+
items: SamplizeCatalogueProduct[];
|
|
54
|
+
nextCursor: string | null;
|
|
55
|
+
/** True on the final page; completeness requires collecting total unique IDs. */
|
|
56
|
+
complete: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface SamplizeHexObservation {
|
|
59
|
+
hex: string;
|
|
60
|
+
publisher: string;
|
|
61
|
+
source: string;
|
|
62
|
+
sourceUrl: string | null;
|
|
63
|
+
sourceBasis: string;
|
|
64
|
+
observedAt: string | null;
|
|
65
|
+
differsFromSelected: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface SamplizePublicationSource {
|
|
68
|
+
publisher: "Samplize";
|
|
69
|
+
source: "algolia_shopify_products";
|
|
70
|
+
sourceUrl: string;
|
|
71
|
+
observedAt: string | null;
|
|
72
|
+
}
|
|
73
|
+
export interface SamplizeLrvObservation extends SamplizePublicationSource {
|
|
74
|
+
field: string;
|
|
75
|
+
value: number;
|
|
76
|
+
}
|
|
77
|
+
export interface SamplizeDemand extends SamplizePublicationSource {
|
|
78
|
+
field: "recently_ordered_count";
|
|
79
|
+
sourceVariantId: string;
|
|
80
|
+
grain: "shopify_variant";
|
|
81
|
+
recentlyOrderedCount: number;
|
|
82
|
+
/** The publisher does not supply the time window. */
|
|
83
|
+
window: null;
|
|
84
|
+
}
|
|
85
|
+
export interface SamplizeCollectionMembership {
|
|
86
|
+
sourceCollectionId: string;
|
|
87
|
+
handle: string;
|
|
88
|
+
url: string;
|
|
89
|
+
publisher: "Samplize";
|
|
90
|
+
source: "algolia_shopify_products";
|
|
91
|
+
observedAt: string | null;
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** A personal preference; diminished references stay on the research board. */
|
|
2
|
+
export type ScheduleReferenceInfluence = "kept" | "diminished";
|
|
3
|
+
export interface PutScheduleReferenceFeedback {
|
|
4
|
+
/** Reuse unchanged after an uncertain response; a different command needs a new id. */
|
|
5
|
+
requestId: string;
|
|
6
|
+
/** The version last read for this reference, or zero before its first decision. */
|
|
7
|
+
expectedFeedbackVersion: number;
|
|
8
|
+
sourceRunId: string;
|
|
9
|
+
influence: ScheduleReferenceInfluence;
|
|
10
|
+
}
|
|
11
|
+
export type ScheduleReferenceSource = {
|
|
12
|
+
kind: "image";
|
|
13
|
+
laneId: string;
|
|
14
|
+
imageRef: string;
|
|
15
|
+
sourceName: string;
|
|
16
|
+
sourceDomain: string;
|
|
17
|
+
url: string | null;
|
|
18
|
+
caption: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "web";
|
|
21
|
+
domain: string;
|
|
22
|
+
url: string;
|
|
23
|
+
statement: string;
|
|
24
|
+
implication: string;
|
|
25
|
+
};
|
|
26
|
+
/** Immutable receipt for one decision, including the exact research frame it came from. */
|
|
27
|
+
export interface ScheduleReferenceFeedback {
|
|
28
|
+
eventId: string;
|
|
29
|
+
scheduleId: string;
|
|
30
|
+
referenceId: string;
|
|
31
|
+
version: number;
|
|
32
|
+
requestId: string;
|
|
33
|
+
sourceRunId: string;
|
|
34
|
+
sourceEventSequence: number;
|
|
35
|
+
source: ScheduleReferenceSource;
|
|
36
|
+
scope: {
|
|
37
|
+
kind: "project";
|
|
38
|
+
};
|
|
39
|
+
originalVerdict: "kept" | "set-aside";
|
|
40
|
+
influence: ScheduleReferenceInfluence;
|
|
41
|
+
decidedByPrincipalId: string;
|
|
42
|
+
decidedAt: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ScheduleReferenceFeedbackList {
|
|
45
|
+
items: ScheduleReferenceFeedback[];
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HttpTransport } from "./http-transport.js";
|
|
2
|
+
import type { PutScheduleReferenceFeedback, ScheduleReferenceFeedback, ScheduleReferenceFeedbackList } from "./schedule-reference-types.js";
|
|
3
|
+
/** Schedule-owned preferences, independent of an issued document's revision. */
|
|
4
|
+
export declare class ScheduleReferencesClient {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(transport: HttpTransport);
|
|
7
|
+
/** Read the latest saved preference for each reference. Empty means no decisions yet. */
|
|
8
|
+
list(scheduleId: string, signal?: AbortSignal): Promise<ScheduleReferenceFeedbackList>;
|
|
9
|
+
/**
|
|
10
|
+
* Save or reverse a preference. An exact request replay returns its original receipt;
|
|
11
|
+
* it does not undo newer decisions. A stale reference version raises a 409.
|
|
12
|
+
*/
|
|
13
|
+
put(scheduleId: string, referenceId: string, input: PutScheduleReferenceFeedback, signal?: AbortSignal): Promise<ScheduleReferenceFeedback>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { resolveOperation } from "./operations.js";
|
|
2
|
+
/** Schedule-owned preferences, independent of an issued document's revision. */
|
|
3
|
+
export class ScheduleReferencesClient {
|
|
4
|
+
#transport;
|
|
5
|
+
constructor(transport) {
|
|
6
|
+
this.#transport = transport;
|
|
7
|
+
}
|
|
8
|
+
/** Read the latest saved preference for each reference. Empty means no decisions yet. */
|
|
9
|
+
list(scheduleId, signal) {
|
|
10
|
+
return this.#transport.requestJson(resolveOperation("list_schedule_reference_feedback"), {
|
|
11
|
+
pathParams: { scheduleId },
|
|
12
|
+
signal,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Save or reverse a preference. An exact request replay returns its original receipt;
|
|
17
|
+
* it does not undo newer decisions. A stale reference version raises a 409.
|
|
18
|
+
*/
|
|
19
|
+
put(scheduleId, referenceId, input, signal) {
|
|
20
|
+
return this.#transport.requestJson(resolveOperation("put_schedule_reference_feedback"), {
|
|
21
|
+
pathParams: { scheduleId, referenceId },
|
|
22
|
+
body: input,
|
|
23
|
+
signal,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
package/schedule-types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VerdictCitation } from "./citation-types.js";
|
|
1
2
|
/**
|
|
2
3
|
* Finish-schedule wire types (MG-616) — the hand-mirror of
|
|
3
4
|
* `@materialgraph/products/schemes/finish-schedule`. Kept in their own module
|
|
@@ -51,6 +52,8 @@ export interface FinishScheduleCell {
|
|
|
51
52
|
state: FinishScheduleCellState;
|
|
52
53
|
confidence: number | null;
|
|
53
54
|
sourceBasis: string | null;
|
|
55
|
+
/** Omitted when the exact current claim has no supporting source. */
|
|
56
|
+
citation?: VerdictCitation;
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
56
59
|
* The rolled-up grade for one row, from its EVALUATED criterion cells only.
|
|
@@ -59,6 +62,33 @@ export interface FinishScheduleCell {
|
|
|
59
62
|
* `hard_no` means a required cell failed on a real value.
|
|
60
63
|
*/
|
|
61
64
|
export type FinishScheduleGrade = "meets_all" | "close" | "hard_no";
|
|
65
|
+
/** Exact retained brief passage behind a schedule criterion. */
|
|
66
|
+
export interface FinishScheduleCriterionSourceRef {
|
|
67
|
+
sourceId: string;
|
|
68
|
+
quote: string;
|
|
69
|
+
textRange: {
|
|
70
|
+
start: number;
|
|
71
|
+
end: number;
|
|
72
|
+
unit: "utf16";
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** Brief criterion carried into the issued row, including explicit exclusions. */
|
|
76
|
+
export type FinishScheduleCriterion = {
|
|
77
|
+
kind: "attribute" | "attribute-presence" | "attribute-exclusion" | "attribute-numeric" | "unresolved";
|
|
78
|
+
raw: string;
|
|
79
|
+
attributeId?: string;
|
|
80
|
+
term?: string;
|
|
81
|
+
comparator?: "at-least" | "at-most";
|
|
82
|
+
value?: number;
|
|
83
|
+
unit?: string;
|
|
84
|
+
polarity?: "exclusion";
|
|
85
|
+
coverageNote?: string;
|
|
86
|
+
suggestion?: {
|
|
87
|
+
attributeId: string;
|
|
88
|
+
term?: string;
|
|
89
|
+
};
|
|
90
|
+
sourceRefs?: FinishScheduleCriterionSourceRef[];
|
|
91
|
+
};
|
|
62
92
|
/** One numbered section of the schedule, and the heading it prints. */
|
|
63
93
|
export interface FinishScheduleSection {
|
|
64
94
|
/** The hundreds block, e.g. `100`. Also the base of every line number in it. */
|
|
@@ -147,6 +177,10 @@ export interface FinishScheduleOpenSlot {
|
|
|
147
177
|
}
|
|
148
178
|
/** One row: one slot, one specified material, fully graded. */
|
|
149
179
|
export interface FinishScheduleRow {
|
|
180
|
+
/** Criteria carried from the programme; absent on older schedule artifacts. */
|
|
181
|
+
criteria?: FinishScheduleCriterion[];
|
|
182
|
+
requiredCriteria?: FinishScheduleCriterion[];
|
|
183
|
+
preferredCriteria?: FinishScheduleCriterion[];
|
|
150
184
|
/**
|
|
151
185
|
* The printed line reference, e.g. `L-101` — how a drawing, an RFI or a
|
|
152
186
|
* substitution request names this line. Allocated from the Run's PROGRAMME
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -56,6 +56,11 @@ export type SearchFilter = {
|
|
|
56
56
|
attributeId: string;
|
|
57
57
|
term: string;
|
|
58
58
|
trust?: SearchFilterTrust;
|
|
59
|
+
} | {
|
|
60
|
+
/** Known effective values are required, and this term must be absent. */
|
|
61
|
+
attributeId: string;
|
|
62
|
+
excludesTerm: string;
|
|
63
|
+
trust?: SearchFilterTrust;
|
|
59
64
|
}
|
|
60
65
|
/**
|
|
61
66
|
* TERM SET — the attribute must equal any ONE of these. OR within the entry;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** samplizeCatalogue admits published US Samplize paint colours, regardless of stock. */
|
|
1
2
|
/**
|
|
2
3
|
* @module search-request-types
|
|
3
4
|
* The two request shapes for the `/search` surface — the POST JSON body and the
|
|
@@ -148,6 +149,8 @@ export interface SearchInput {
|
|
|
148
149
|
refinementToken?: string;
|
|
149
150
|
/** Only return materials with at least one catalog image. Default false (full catalog). */
|
|
150
151
|
hasImages?: boolean;
|
|
152
|
+
/** Require a recorded accepted sampleable=true fact; unknown and false are excluded. */
|
|
153
|
+
sampleableOnly?: boolean;
|
|
151
154
|
/**
|
|
152
155
|
* Opt-in seed-relative verdict cells (MG-629). Only meaningful with
|
|
153
156
|
* `similarTo: { variantId }`: each hit's `verdict` gains `preferred` cells
|
|
@@ -227,6 +230,8 @@ export interface SearchGetParams {
|
|
|
227
230
|
count?: OpenEnum<"true">;
|
|
228
231
|
/** "true" — only return materials with at least one catalog image. */
|
|
229
232
|
hasImages?: OpenEnum<"true">;
|
|
233
|
+
/** Require a recorded accepted sampleable=true fact. */
|
|
234
|
+
sampleableOnly?: OpenEnum<"true" | "false">;
|
|
230
235
|
/** Result projection — `"full"` (default) or the lean `"card"` grid form. */
|
|
231
236
|
view?: OpenEnum<"full" | "card">;
|
|
232
237
|
/**
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
* receipts emitted by ordinary Search responses.
|
|
5
5
|
*/
|
|
6
6
|
import type { OpenEnum } from "./types.js";
|
|
7
|
+
/** Inspectable metadata for an opaque, principal-bound search refinement receipt. */
|
|
8
|
+
export interface SearchRefinementReceipt {
|
|
9
|
+
token: string;
|
|
10
|
+
expiresAt: string;
|
|
11
|
+
poolSize: number;
|
|
12
|
+
schemaVersion: string;
|
|
13
|
+
projectionVersion: number;
|
|
14
|
+
}
|
|
7
15
|
/** The primary ranking source a query resolved to and reports as its mode. */
|
|
8
16
|
export type SearchMode = OpenEnum<"image" | "colour" | "text" | "lexical" | "entity-browse">;
|
|
9
17
|
/**
|
|
@@ -143,6 +143,15 @@ function checkAttributeVerdict(value, what, fail) {
|
|
|
143
143
|
requireNullableString(record.value, `${what}.value`, fail);
|
|
144
144
|
requireNullableBoundedNumber(record.confidence, `${what}.confidence`, fail, 0, 1);
|
|
145
145
|
requireNullableString(record.sourceBasis, `${what}.sourceBasis`, fail);
|
|
146
|
+
if (record.citation !== undefined) {
|
|
147
|
+
const citation = requireRecord(record.citation, `${what}.citation`, fail);
|
|
148
|
+
requireNonEmptyString(citation.citationId, `${what}.citation.citationId`, fail);
|
|
149
|
+
requireNonEmptyString(citation.sourceType, `${what}.citation.sourceType`, fail);
|
|
150
|
+
const count = requireNumber(citation.count, `${what}.citation.count`, fail);
|
|
151
|
+
if (!Number.isInteger(count) || count <= 0) {
|
|
152
|
+
throw fail(`${what}.citation.count must be a positive integer`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
146
155
|
const deviation = record.deviation;
|
|
147
156
|
if (deviation !== null)
|
|
148
157
|
checkVerdictDeviation(deviation, `${what}.deviation`, fail);
|
|
@@ -207,6 +216,7 @@ export function checkSearchResultItem(value, what, fail) {
|
|
|
207
216
|
if (record.signals !== undefined)
|
|
208
217
|
checkSignals(record.signals, `${what}.signals`, fail);
|
|
209
218
|
requireOptionalBoolean(record.retired, `${what}.retired`, fail);
|
|
219
|
+
requireOptionalBoolean(record.sampleable, `${what}.sampleable`, fail);
|
|
210
220
|
requireOptionalBoolean(record.belowFloor, `${what}.belowFloor`, fail);
|
|
211
221
|
requireOptionalBoolean(record.admittedOnColour, `${what}.admittedOnColour`, fail);
|
|
212
222
|
if (record.siblingCount !== undefined) {
|
package/slot-pool-types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* TOLERANT-PARSING CONTRACT: response enums are widened with {@link OpenEnum}
|
|
26
26
|
* so a new server value still type-checks; objects are read structurally.
|
|
27
27
|
*/
|
|
28
|
+
import type { VerdictCitation } from "./citation-types.js";
|
|
28
29
|
import type { VariantId } from "./identifiers.js";
|
|
29
30
|
import type { OpenEnum } from "./types.js";
|
|
30
31
|
/**
|
|
@@ -147,6 +148,7 @@ export interface SlotPoolVerdictCell {
|
|
|
147
148
|
*/
|
|
148
149
|
sourceBasis: string | null;
|
|
149
150
|
trustGap: OpenEnum<"below_confidence" | "basis_unmet" | "proposed"> | null;
|
|
151
|
+
citation?: VerdictCitation;
|
|
150
152
|
}
|
|
151
153
|
/** Why a candidate is labelled. An eligible candidate carries none of these. */
|
|
152
154
|
export type SlotPoolFlag = OpenEnum<"below-floor" | "required-not-applied" | "discontinued" | "superseded" | "unverified-value">;
|
package/spec-types.d.ts
CHANGED
|
@@ -64,6 +64,11 @@ export interface SpecTermFilter {
|
|
|
64
64
|
attributeId: string;
|
|
65
65
|
term: string;
|
|
66
66
|
}
|
|
67
|
+
/** A negative spec criterion; absence of a value remains unproven. */
|
|
68
|
+
export interface SpecExclusionFilter {
|
|
69
|
+
attributeId: string;
|
|
70
|
+
excludesTerm: string;
|
|
71
|
+
}
|
|
67
72
|
/**
|
|
68
73
|
* A presence spec criterion: the attribute must have ANY accepted value —
|
|
69
74
|
* "has an EPD on record", "has a measured slip figure at all". Not supported for
|
|
@@ -94,4 +99,4 @@ export interface CertificationProgrammeFilter {
|
|
|
94
99
|
* presence check. The union the search engine applies as a restriction BEFORE
|
|
95
100
|
* ranking. Identical in shape to the SDK's `SearchFilter`.
|
|
96
101
|
*/
|
|
97
|
-
export type SpecFilter = SpecTermFilter | SpecPresenceFilter;
|
|
102
|
+
export type SpecFilter = SpecTermFilter | SpecExclusionFilter | SpecPresenceFilter;
|
package/specifications.d.ts
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* hand-format the `attribute:value` string the `bySpec` route splits on its
|
|
15
15
|
* first `:`.
|
|
16
16
|
*/
|
|
17
|
-
import { type CertificationProgrammeFilter, type SpecPresenceFilter, type SpecTermFilter } from "./spec-types.js";
|
|
17
|
+
import { type CertificationProgrammeFilter, type SpecExclusionFilter, type SpecPresenceFilter, type SpecTermFilter } from "./spec-types.js";
|
|
18
|
+
/** A hard criterion excluding one known canonical value while retaining only variants with known values. */
|
|
19
|
+
export declare function excludeSpec(attributeId: string, excludesTerm: string): SpecExclusionFilter;
|
|
18
20
|
/**
|
|
19
21
|
* A term-equality criterion for `search({ filters })` — the attribute must
|
|
20
22
|
* carry this canonical value.
|
package/specifications.js
CHANGED
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
* first `:`.
|
|
16
16
|
*/
|
|
17
17
|
import { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID, } from "./spec-types.js";
|
|
18
|
+
/** A hard criterion excluding one known canonical value while retaining only variants with known values. */
|
|
19
|
+
export function excludeSpec(attributeId, excludesTerm) {
|
|
20
|
+
return { attributeId, excludesTerm };
|
|
21
|
+
}
|
|
18
22
|
/**
|
|
19
23
|
* A term-equality criterion for `search({ filters })` — the attribute must
|
|
20
24
|
* carry this canonical value.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { BySpecVerdict } from "./by-spec-types.js";
|
|
2
|
+
import type { VariantId } from "./identifiers.js";
|
|
3
|
+
import type { MaterialSuccessor } from "./material-types.js";
|
|
4
|
+
export type SubstituteSignatureFamily = "textile" | "tile" | "coating" | "lighting_electrical" | "acoustic" | "surface" | "furniture" | "sanitaryware" | "fittings" | "architectural_hardware";
|
|
5
|
+
export interface SubstituteSignatureCriterion {
|
|
6
|
+
role: "primary_material" | "performance";
|
|
7
|
+
attributeId: string;
|
|
8
|
+
term: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AvailableSubstituteSignature {
|
|
11
|
+
family: SubstituteSignatureFamily;
|
|
12
|
+
form: string;
|
|
13
|
+
criteria: [SubstituteSignatureCriterion, SubstituteSignatureCriterion];
|
|
14
|
+
}
|
|
15
|
+
export interface UnsupportedSubstituteSignature {
|
|
16
|
+
family: SubstituteSignatureFamily;
|
|
17
|
+
form: string;
|
|
18
|
+
reason: string;
|
|
19
|
+
}
|
|
20
|
+
export interface InsufficientSubstituteSignature {
|
|
21
|
+
family: SubstituteSignatureFamily;
|
|
22
|
+
form: string;
|
|
23
|
+
missingRoles: ("primary_material" | "performance")[];
|
|
24
|
+
}
|
|
25
|
+
export interface FindSubstitutesOptions {
|
|
26
|
+
excludeBrands?: string[];
|
|
27
|
+
diversityBoost?: number;
|
|
28
|
+
limit?: number;
|
|
29
|
+
cursor?: string;
|
|
30
|
+
includeSamplingArtifacts?: boolean;
|
|
31
|
+
includeUnavailable?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface SubstituteMatchedCriterion {
|
|
34
|
+
attributeId: string;
|
|
35
|
+
confidence: number | null;
|
|
36
|
+
sourceBasis: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface SubstituteResultItem {
|
|
39
|
+
variantId: VariantId;
|
|
40
|
+
brandSlug: string;
|
|
41
|
+
brand: string;
|
|
42
|
+
product: string;
|
|
43
|
+
variant: string;
|
|
44
|
+
color: string | null;
|
|
45
|
+
imageUrl: string | null;
|
|
46
|
+
hex: string | null;
|
|
47
|
+
matched: SubstituteMatchedCriterion[];
|
|
48
|
+
minConfidence: number | null;
|
|
49
|
+
baseScore: number;
|
|
50
|
+
diversityAdjustment: number;
|
|
51
|
+
score: number;
|
|
52
|
+
verdict: BySpecVerdict;
|
|
53
|
+
}
|
|
54
|
+
export interface AvailableSubstitutesResponse {
|
|
55
|
+
status: "available";
|
|
56
|
+
signatureUsed: AvailableSubstituteSignature;
|
|
57
|
+
items: SubstituteResultItem[];
|
|
58
|
+
candidatePoolSize: number;
|
|
59
|
+
droppedUnavailable: number;
|
|
60
|
+
supersededBy: MaterialSuccessor | null;
|
|
61
|
+
nextCursor?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface UnsupportedSubstitutesResponse {
|
|
64
|
+
status: "unsupported";
|
|
65
|
+
signature: UnsupportedSubstituteSignature;
|
|
66
|
+
items: [];
|
|
67
|
+
supersededBy: MaterialSuccessor | null;
|
|
68
|
+
}
|
|
69
|
+
export interface InsufficientSubstitutesResponse {
|
|
70
|
+
status: "insufficient_signature";
|
|
71
|
+
signature: InsufficientSubstituteSignature;
|
|
72
|
+
items: [];
|
|
73
|
+
supersededBy: MaterialSuccessor | null;
|
|
74
|
+
}
|
|
75
|
+
export type FindSubstitutesResponse = AvailableSubstitutesResponse | UnsupportedSubstitutesResponse | InsufficientSubstitutesResponse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Exact, source-path-grained status coverage for primary product typing. */
|
|
2
|
+
export interface ProductTypeStatusCoverageCounts {
|
|
3
|
+
variants: number;
|
|
4
|
+
accepted: number;
|
|
5
|
+
proposed: number;
|
|
6
|
+
proposedBelowThreshold: number;
|
|
7
|
+
/** Proposed rows with no confidence remain explicit rather than thresholded. */
|
|
8
|
+
proposedUnknownConfidence: number;
|
|
9
|
+
otherStatus: number;
|
|
10
|
+
missingPrimary: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ProductTypeStatusCoverageSourcePath extends ProductTypeStatusCoverageCounts {
|
|
13
|
+
/** Complete stored source path; null means the product retained no path. */
|
|
14
|
+
sourcePath: string | null;
|
|
15
|
+
}
|
|
16
|
+
/** Current primary-assignment coverage, never an inferred acceptance decision. */
|
|
17
|
+
export interface ProductTypeStatusCoverage {
|
|
18
|
+
computedAt: string;
|
|
19
|
+
basis: {
|
|
20
|
+
count: "exact";
|
|
21
|
+
universe: "non_superseded_variants";
|
|
22
|
+
assignment: "variant_primary_only";
|
|
23
|
+
sourcePath: "products.source_category_path";
|
|
24
|
+
/** Reporting cutoff only: higher-confidence proposals remain proposed. */
|
|
25
|
+
comparisonThreshold: number;
|
|
26
|
+
};
|
|
27
|
+
totals: ProductTypeStatusCoverageCounts;
|
|
28
|
+
sourcePaths: ProductTypeStatusCoverageSourcePath[];
|
|
29
|
+
}
|
|
30
|
+
export interface ProductTypeCoverageOptions {
|
|
31
|
+
[key: string]: number | undefined;
|
|
32
|
+
/** Reporting cutoff in [0,1], default 0.85; it never accepts a proposal. */
|
|
33
|
+
comparisonThreshold?: number;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|